developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1 | From b5c9fa8bc514d8db22a93c3d4d3e686b9b34a52d Mon Sep 17 00:00:00 2001 |
| 2 | From: Rex Lu <rex.lu@mediatek.com> |
| 3 | Date: Wed, 21 Aug 2024 20:13:37 +0800 |
| 4 | Subject: [PATCH] wifi: mt76: mt7915: fix add ba issue on tid not equal to zero |
| 5 | case |
| 6 | |
| 7 | Signed-off-by: Rex Lu <rex.lu@mediatek.com> |
| 8 | --- |
| 9 | mt76.h | 6 ++++++ |
| 10 | mt7915/main.c | 7 +++++++ |
| 11 | 2 files changed, 13 insertions(+) |
| 12 | |
| 13 | diff --git a/mt76.h b/mt76.h |
| 14 | index bdc9a9b..592c3cd 100644 |
| 15 | --- a/mt76.h |
| 16 | +++ b/mt76.h |
| 17 | @@ -52,6 +52,8 @@ |
| 18 | #define MT_WED_RRO_Q_MSDU_PG(_n) __MT_WED_RRO_Q(MT76_WED_RRO_Q_MSDU_PG, _n) |
| 19 | #define MT_WED_RRO_Q_IND __MT_WED_RRO_Q(MT76_WED_RRO_Q_IND, 0) |
| 20 | |
| 21 | +#define AMPDU_ADDBA_SUCC_SHFT IEEE80211_NUM_TIDS |
| 22 | + |
| 23 | struct mt76_dev; |
| 24 | struct mt76_phy; |
| 25 | struct mt76_wcid; |
| 26 | @@ -356,6 +358,10 @@ struct mt76_wcid { |
| 27 | int inactive_count; |
| 28 | |
| 29 | struct rate_info rate; |
| 30 | + /* |
| 31 | + *Bit 0 - 15: ADDBA of TID n started |
| 32 | + *Bit 16 - 31: ADDBA of TID n succeeded |
| 33 | + */ |
| 34 | unsigned long ampdu_state; |
| 35 | |
| 36 | u16 idx; |
| 37 | diff --git a/mt7915/main.c b/mt7915/main.c |
| 38 | index 73a7153..35b97db 100644 |
| 39 | --- a/mt7915/main.c |
| 40 | +++ b/mt7915/main.c |
| 41 | @@ -907,12 +907,14 @@ mt7915_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 42 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
| 43 | mtxq->aggr = true; |
| 44 | mtxq->send_bar = false; |
| 45 | + set_bit((tid + AMPDU_ADDBA_SUCC_SHFT), &msta->wcid.ampdu_state); |
| 46 | ret = mt7915_mcu_add_tx_ba(dev, params, true); |
| 47 | break; |
| 48 | case IEEE80211_AMPDU_TX_STOP_FLUSH: |
| 49 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: |
| 50 | mtxq->aggr = false; |
| 51 | clear_bit(tid, &msta->wcid.ampdu_state); |
| 52 | + clear_bit((tid + AMPDU_ADDBA_SUCC_SHFT), &msta->wcid.ampdu_state); |
| 53 | ret = mt7915_mcu_add_tx_ba(dev, params, false); |
| 54 | break; |
| 55 | case IEEE80211_AMPDU_TX_START: |
| 56 | @@ -922,6 +924,7 @@ mt7915_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 57 | case IEEE80211_AMPDU_TX_STOP_CONT: |
| 58 | mtxq->aggr = false; |
| 59 | clear_bit(tid, &msta->wcid.ampdu_state); |
| 60 | + clear_bit((tid + AMPDU_ADDBA_SUCC_SHFT), &msta->wcid.ampdu_state); |
| 61 | ret = mt7915_mcu_add_tx_ba(dev, params, false); |
| 62 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
| 63 | break; |
| 64 | @@ -1747,6 +1750,10 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, |
| 65 | if (msta->wcid.idx > 0xff) |
| 66 | return -EIO; |
| 67 | |
| 68 | + if (!test_bit((mvif->qos_map[path->mtk_wdma.tid >> 2] + AMPDU_ADDBA_SUCC_SHFT), |
| 69 | + &msta->wcid.ampdu_state)) |
| 70 | + return -EAGAIN; |
| 71 | + |
| 72 | path->type = DEV_PATH_MTK_WDMA; |
| 73 | path->dev = ctx->dev; |
| 74 | path->mtk_wdma.wdma_idx = wed->wdma_idx; |
| 75 | -- |
| 76 | 2.45.2 |
| 77 | |