Commit 77eaa281 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt7615: mcu: use proper msg size in mt7615_mcu_add_wtbl_bmc

Use proper mcu message size in mt7615_mcu_add_wtbl_bmc and do not
allocate a huge buffer. Moreover use stack memory instead of heap one
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent b876457c
...@@ -987,39 +987,33 @@ int mt7615_mcu_set_wtbl_key(struct mt7615_dev *dev, int wcid, ...@@ -987,39 +987,33 @@ int mt7615_mcu_set_wtbl_key(struct mt7615_dev *dev, int wcid,
&wtbl_sec_key, buf_len); &wtbl_sec_key, buf_len);
} }
int mt7615_mcu_add_wtbl_bmc(struct mt7615_dev *dev, struct ieee80211_vif *vif) int mt7615_mcu_add_wtbl_bmc(struct mt7615_dev *dev,
struct ieee80211_vif *vif)
{ {
struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv; struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
struct wtbl_generic *wtbl_generic; struct {
struct wtbl_rx *wtbl_rx; struct wtbl_generic g_wtbl;
int buf_len, ret; struct wtbl_rx rx_wtbl;
u8 *buf; } data = {
.g_wtbl = {
buf = kzalloc(MT7615_WTBL_UPDATE_MAX_SIZE, GFP_KERNEL); .tag = cpu_to_le16(WTBL_GENERIC),
if (!buf) .len = cpu_to_le16(sizeof(struct wtbl_generic)),
return -ENOMEM; .muar_idx = 0xe,
},
wtbl_generic = (struct wtbl_generic *)buf; .rx_wtbl = {
buf_len = sizeof(*wtbl_generic); .tag = cpu_to_le16(WTBL_RX),
wtbl_generic->tag = cpu_to_le16(WTBL_GENERIC); .len = cpu_to_le16(sizeof(struct wtbl_rx)),
wtbl_generic->len = cpu_to_le16(buf_len); .rca1 = 1,
eth_broadcast_addr(wtbl_generic->peer_addr); .rca2 = 1,
wtbl_generic->muar_idx = 0xe; .rv = 1,
},
wtbl_rx = (struct wtbl_rx *)(buf + buf_len); };
buf_len += sizeof(*wtbl_rx); eth_broadcast_addr(data.g_wtbl.peer_addr);
wtbl_rx->tag = cpu_to_le16(WTBL_RX);
wtbl_rx->len = cpu_to_le16(sizeof(*wtbl_rx));
wtbl_rx->rca1 = 1;
wtbl_rx->rca2 = 1;
wtbl_rx->rv = 1;
ret = __mt7615_mcu_set_wtbl(dev, mvif->sta.wcid.idx,
WTBL_RESET_AND_SET, 2, buf,
buf_len);
kfree(buf); return __mt7615_mcu_set_wtbl(dev, mvif->sta.wcid.idx,
return ret; WTBL_RESET_AND_SET, 2, &data,
sizeof(struct wtbl_generic) +
sizeof(struct wtbl_rx));
} }
int mt7615_mcu_del_wtbl_bmc(struct mt7615_dev *dev, struct ieee80211_vif *vif) int mt7615_mcu_del_wtbl_bmc(struct mt7615_dev *dev, struct ieee80211_vif *vif)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment