[PATCH] wifi: mt76: mt7996: refresh the tx BA session timer on NPU devices

Gilly1970 posted 1 patch 6 days, 14 hours ago
drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] wifi: mt76: mt7996: refresh the tx BA session timer on NPU devices
Posted by Gilly1970 6 days, 14 hours ago
From: Chris Scott <gilroyscott1970@gmail.com>

mt7996_mac_add_txs_skb() refreshes mac80211's tx BlockAck session timer
only when a WED device is active. Airoha boards offload through the NPU
instead, so on those the condition is never true and nothing keeps the
timer alive.

NPU-forwarded frames do not traverse mac80211, and the only other places
that stamp tid_tx->last_tx are in the software tx path. When the peer
negotiates a non-zero BlockAck timeout in the ADDBA response (Intel
stations commonly do, most others answer 0) mac80211 arms
tid_tx->session_timer, which then expires in the middle of an offloaded
transfer and tears the session down with a DELBA.

The session does not come back on its own either: mt7996 restarts one
from mt7996_tx_check_aggr(), reached via mt7996_txwi_free(), and
offloaded frames carry no driver token so they never get there.
mac80211's ieee80211_aggr_check() fallback needs
RATE_CTRL_CAPA_AMPDU_TRIGGER, which mt7996 does not set. The reported
symptom is a file transfer to an Intel client dropping from line rate to
a few MB/s and staying there, with a single ping from the router - one
frame on the software path - restoring it instantly.

Extend the check with mt76_npu_device_active(). TXS reports do arrive
for NPU-forwarded frames, measured at roughly 24 per second on a busy
radio, which is far more than a seconds-scale session timer needs.

A second user who independently saw the same collapse, held off only by
a once-a-second ping from the AP, ran a patched image for 100 hours
(~175 TB of offloaded iperf3 traffic, ~4 Gbit/s) without it recurring.

Link: https://forum.openwrt.org/t/quantum-fiber-w1700k-support/222776/3900
Link: https://forum.openwrt.org/t/quantum-fiber-w1700k-support/222776/3901
Link: https://forum.openwrt.org/t/gemtek-w1700k-community-builds/249319/458
Fixes: 377aa17d2aed ("wifi: mt76: mt7996: Add NPU offload support to MT7996 driver")
Signed-off-by: Chris Scott <gilroyscott1970@gmail.com>
---
 drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
index dc1a3e9..e50db1f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
@@ -1540,7 +1540,8 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
 		}
 	}
 
-	if (mtk_wed_device_active(&dev->mt76.mmio.wed) && wcid->sta) {
+	if ((mtk_wed_device_active(&dev->mt76.mmio.wed) ||
+	     mt76_npu_device_active(&dev->mt76)) && wcid->sta) {
 		struct ieee80211_sta *sta;
 		u8 tid;
 
-- 
2.43.0
Re: [PATCH] wifi: mt76: mt7996: refresh the tx BA session timer on NPU devices
Posted by Lorenzo Bianconi 5 days, 6 hours ago
> From: Chris Scott <gilroyscott1970@gmail.com>
> 
> mt7996_mac_add_txs_skb() refreshes mac80211's tx BlockAck session timer
> only when a WED device is active. Airoha boards offload through the NPU
> instead, so on those the condition is never true and nothing keeps the
> timer alive.
> 
> NPU-forwarded frames do not traverse mac80211, and the only other places
> that stamp tid_tx->last_tx are in the software tx path. When the peer
> negotiates a non-zero BlockAck timeout in the ADDBA response (Intel
> stations commonly do, most others answer 0) mac80211 arms
> tid_tx->session_timer, which then expires in the middle of an offloaded
> transfer and tears the session down with a DELBA.
> 
> The session does not come back on its own either: mt7996 restarts one
> from mt7996_tx_check_aggr(), reached via mt7996_txwi_free(), and
> offloaded frames carry no driver token so they never get there.
> mac80211's ieee80211_aggr_check() fallback needs
> RATE_CTRL_CAPA_AMPDU_TRIGGER, which mt7996 does not set. The reported
> symptom is a file transfer to an Intel client dropping from line rate to
> a few MB/s and staying there, with a single ping from the router - one
> frame on the software path - restoring it instantly.
> 
> Extend the check with mt76_npu_device_active(). TXS reports do arrive
> for NPU-forwarded frames, measured at roughly 24 per second on a busy
> radio, which is far more than a seconds-scale session timer needs.
> 
> A second user who independently saw the same collapse, held off only by
> a once-a-second ping from the AP, ran a patched image for 100 hours
> (~175 TB of offloaded iperf3 traffic, ~4 Gbit/s) without it recurring.
> 
> Link: https://forum.openwrt.org/t/quantum-fiber-w1700k-support/222776/3900
> Link: https://forum.openwrt.org/t/quantum-fiber-w1700k-support/222776/3901
> Link: https://forum.openwrt.org/t/gemtek-w1700k-community-builds/249319/458
> Fixes: 377aa17d2aed ("wifi: mt76: mt7996: Add NPU offload support to MT7996 driver")
> Signed-off-by: Chris Scott <gilroyscott1970@gmail.com>

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> ---
>  drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> index dc1a3e9..e50db1f 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> @@ -1540,7 +1540,8 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
>  		}
>  	}
>  
> -	if (mtk_wed_device_active(&dev->mt76.mmio.wed) && wcid->sta) {
> +	if ((mtk_wed_device_active(&dev->mt76.mmio.wed) ||
> +	     mt76_npu_device_active(&dev->mt76)) && wcid->sta) {
>  		struct ieee80211_sta *sta;
>  		u8 tid;
>  
> -- 
> 2.43.0
>