| From b5c9fa8bc514d8db22a93c3d4d3e686b9b34a52d Mon Sep 17 00:00:00 2001 |
| From: Rex Lu <rex.lu@mediatek.com> |
| Date: Wed, 21 Aug 2024 20:13:37 +0800 |
| Subject: [PATCH] wifi: mt76: mt7915: fix add ba issue on tid not equal to zero |
| case |
| |
| Signed-off-by: Rex Lu <rex.lu@mediatek.com> |
| --- |
| mt76.h | 6 ++++++ |
| mt7915/main.c | 7 +++++++ |
| 2 files changed, 13 insertions(+) |
| |
| diff --git a/mt76.h b/mt76.h |
| index bdc9a9b..592c3cd 100644 |
| --- a/mt76.h |
| +++ b/mt76.h |
| @@ -52,6 +52,8 @@ |
| #define MT_WED_RRO_Q_MSDU_PG(_n) __MT_WED_RRO_Q(MT76_WED_RRO_Q_MSDU_PG, _n) |
| #define MT_WED_RRO_Q_IND __MT_WED_RRO_Q(MT76_WED_RRO_Q_IND, 0) |
| |
| +#define AMPDU_ADDBA_SUCC_SHFT IEEE80211_NUM_TIDS |
| + |
| struct mt76_dev; |
| struct mt76_phy; |
| struct mt76_wcid; |
| @@ -356,6 +358,10 @@ struct mt76_wcid { |
| int inactive_count; |
| |
| struct rate_info rate; |
| + /* |
| + *Bit 0 - 15: ADDBA of TID n started |
| + *Bit 16 - 31: ADDBA of TID n succeeded |
| + */ |
| unsigned long ampdu_state; |
| |
| u16 idx; |
| diff --git a/mt7915/main.c b/mt7915/main.c |
| index 73a7153..35b97db 100644 |
| --- a/mt7915/main.c |
| +++ b/mt7915/main.c |
| @@ -907,12 +907,14 @@ mt7915_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| case IEEE80211_AMPDU_TX_OPERATIONAL: |
| mtxq->aggr = true; |
| mtxq->send_bar = false; |
| + set_bit((tid + AMPDU_ADDBA_SUCC_SHFT), &msta->wcid.ampdu_state); |
| ret = mt7915_mcu_add_tx_ba(dev, params, true); |
| break; |
| case IEEE80211_AMPDU_TX_STOP_FLUSH: |
| case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: |
| mtxq->aggr = false; |
| clear_bit(tid, &msta->wcid.ampdu_state); |
| + clear_bit((tid + AMPDU_ADDBA_SUCC_SHFT), &msta->wcid.ampdu_state); |
| ret = mt7915_mcu_add_tx_ba(dev, params, false); |
| break; |
| case IEEE80211_AMPDU_TX_START: |
| @@ -922,6 +924,7 @@ mt7915_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| case IEEE80211_AMPDU_TX_STOP_CONT: |
| mtxq->aggr = false; |
| clear_bit(tid, &msta->wcid.ampdu_state); |
| + clear_bit((tid + AMPDU_ADDBA_SUCC_SHFT), &msta->wcid.ampdu_state); |
| ret = mt7915_mcu_add_tx_ba(dev, params, false); |
| ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
| break; |
| @@ -1747,6 +1750,10 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, |
| if (msta->wcid.idx > 0xff) |
| return -EIO; |
| |
| + if (!test_bit((mvif->qos_map[path->mtk_wdma.tid >> 2] + AMPDU_ADDBA_SUCC_SHFT), |
| + &msta->wcid.ampdu_state)) |
| + return -EAGAIN; |
| + |
| path->type = DEV_PATH_MTK_WDMA; |
| path->dev = ctx->dev; |
| path->mtk_wdma.wdma_idx = wed->wdma_idx; |
| -- |
| 2.45.2 |
| |