diff mbox series

[1/3] mt76: mt7663: fix when beacon filter is being applied

Message ID 801a2aa986f5486a0e789065feef7b77c612ea7b.1614863741.git.objelf@gmail.com
State New
Headers show
Series [1/3] mt76: mt7663: fix when beacon filter is being applied | expand

Commit Message

Sean Wang March 4, 2021, 1:25 p.m. UTC
From: Sean Wang <sean.wang@mediatek.com>


HW beacon filter command is being applied until we're in associated state
because the command would rely on the associated access point's beacon
interval and DTIM information.

Fixes: 7124198ab1a4 ("mt76: mt7615: enable beacon filtering by default for offload fw")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>

---
 drivers/net/wireless/mediatek/mt76/mt7615/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.25.1

Comments

Lorenzo Bianconi March 4, 2021, 1:38 p.m. UTC | #1
> From: Sean Wang <sean.wang@mediatek.com>

> 

> Each packet should be padded with the additional zero to become 4-bytes

> alignment in sdio tx aggregation.

> 

> Fixes: 1522ff731f84 ("mt76: mt7663s: introduce sdio tx aggregation")

> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

> ---

>  drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c | 7 ++++++-

>  1 file changed, 6 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c

> index 9fb506f2ace6..2d3b7d1e2c92 100644

> --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c

> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c

> @@ -218,6 +218,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)

>  	int qid, err, nframes = 0, len = 0, pse_sz = 0, ple_sz = 0;

>  	bool mcu = q == dev->q_mcu[MT_MCUQ_WM];

>  	struct mt76_sdio *sdio = &dev->sdio;

> +	u8 pad;

>  

>  	qid = mcu ? ARRAY_SIZE(sdio->xmit_buf) - 1 : q->qid;

>  	while (q->first != q->head) {

> @@ -234,7 +235,8 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)

>  			goto next;

>  		}

>  

> -		if (len + e->skb->len + 4 > MT76S_XMIT_BUF_SZ)

> +		pad = roundup(e->skb->len, 4) - e->skb->len;

> +		if (len + e->skb->len + pad + 4 > MT76S_XMIT_BUF_SZ)

>  			break;

>  

>  		if (mt7663s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz,

> @@ -252,6 +254,9 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)

>  			len += iter->len;

>  			nframes++;

>  		}

> +

> +		memset(sdio->xmit_buf[qid] + len, 0, pad);

> +		len += pad;


maybe it is better to do something like:

		if (unlikely(pad)) {
			memset(sdio->xmit_buf[qid] + len, 0, pad);
			len += pad;
		}

Regards,
Lorenzo

>  next:

>  		q->first = (q->first + 1) % q->ndesc;

>  		e->done = true;

> -- 

> 2.25.1
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 1aa6928f88fc..1cb310bf01ee 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -217,8 +217,6 @@  static int mt7615_add_interface(struct ieee80211_hw *hw,
 	ret = mt7615_mcu_add_dev_info(phy, vif, true);
 	if (ret)
 		goto out;
-
-	mt7615_mac_set_beacon_filter(phy, vif, true);
 out:
 	mt7615_mutex_release(dev);
 
@@ -244,7 +242,6 @@  static void mt7615_remove_interface(struct ieee80211_hw *hw,
 
 	mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);
 
-	mt7615_mac_set_beacon_filter(phy, vif, false);
 	mt7615_mcu_add_dev_info(phy, vif, false);
 
 	rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
@@ -548,6 +545,9 @@  static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
 	if (changed & BSS_CHANGED_ARP_FILTER)
 		mt7615_mcu_update_arp_filter(hw, vif, info);
 
+	if (changed & BSS_CHANGED_ASSOC)
+		mt7615_mac_set_beacon_filter(phy, vif, info->assoc);
+
 	mt7615_mutex_release(dev);
 }