Skip to content

Commit b473c0e

Browse files
committed
wifi: mt76: mt7603: fix tx queue of loopback packets
Use the correct WMM AC queue instead of the MGMT one to fix potential issues with aggregation sequence number tracking. Drop non-bufferable packets. Fixes: fca9615 ("mt76: mt7603: fix up hardware queue index for PS filtered packets") Signed-off-by: Felix Fietkau <nbd@nbd.name>
1 parent 95ff66d commit b473c0e

File tree

1 file changed

+32
-14
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7603

1 file changed

+32
-14
lines changed

drivers/net/wireless/mediatek/mt76/mt7603/dma.c

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
#include "mac.h"
55
#include "../dma.h"
66

7+
static const u8 wmm_queue_map[] = {
8+
[IEEE80211_AC_BK] = 0,
9+
[IEEE80211_AC_BE] = 1,
10+
[IEEE80211_AC_VI] = 2,
11+
[IEEE80211_AC_VO] = 3,
12+
};
13+
714
static void
815
mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
916
{
@@ -22,10 +29,10 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
2229
struct ieee80211_sta *sta;
2330
struct mt7603_sta *msta;
2431
struct mt76_wcid *wcid;
32+
u8 tid = 0, hwq = 0;
2533
void *priv;
2634
int idx;
2735
u32 val;
28-
u8 tid = 0;
2936

3037
if (skb->len < MT_TXD_SIZE + sizeof(struct ieee80211_hdr))
3138
goto free;
@@ -42,19 +49,36 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
4249
goto free;
4350

4451
priv = msta = container_of(wcid, struct mt7603_sta, wcid);
45-
val = le32_to_cpu(txd[0]);
46-
val &= ~(MT_TXD0_P_IDX | MT_TXD0_Q_IDX);
47-
val |= FIELD_PREP(MT_TXD0_Q_IDX, MT_TX_HW_QUEUE_MGMT);
48-
txd[0] = cpu_to_le32(val);
4952

5053
sta = container_of(priv, struct ieee80211_sta, drv_priv);
5154
hdr = (struct ieee80211_hdr *)&skb->data[MT_TXD_SIZE];
52-
if (ieee80211_is_data_qos(hdr->frame_control))
55+
56+
hwq = wmm_queue_map[IEEE80211_AC_BE];
57+
if (ieee80211_is_data_qos(hdr->frame_control)) {
5358
tid = *ieee80211_get_qos_ctl(hdr) &
54-
IEEE80211_QOS_CTL_TAG1D_MASK;
55-
skb_set_queue_mapping(skb, tid_to_ac[tid]);
59+
IEEE80211_QOS_CTL_TAG1D_MASK;
60+
u8 qid = tid_to_ac[tid];
61+
hwq = wmm_queue_map[qid];
62+
skb_set_queue_mapping(skb, qid);
63+
} else if (ieee80211_is_data(hdr->frame_control)) {
64+
skb_set_queue_mapping(skb, IEEE80211_AC_BE);
65+
hwq = wmm_queue_map[IEEE80211_AC_BE];
66+
} else {
67+
skb_pull(skb, MT_TXD_SIZE);
68+
if (!ieee80211_is_bufferable_mmpdu(skb))
69+
goto free;
70+
skb_push(skb, MT_TXD_SIZE);
71+
skb_set_queue_mapping(skb, MT_TXQ_PSD);
72+
hwq = MT_TX_HW_QUEUE_MGMT;
73+
}
74+
5675
ieee80211_sta_set_buffered(sta, tid, true);
5776

77+
val = le32_to_cpu(txd[0]);
78+
val &= ~(MT_TXD0_P_IDX | MT_TXD0_Q_IDX);
79+
val |= FIELD_PREP(MT_TXD0_Q_IDX, hwq);
80+
txd[0] = cpu_to_le32(val);
81+
5882
spin_lock_bh(&dev->ps_lock);
5983
__skb_queue_tail(&msta->psq, skb);
6084
if (skb_queue_len(&msta->psq) >= 64) {
@@ -151,12 +175,6 @@ static int mt7603_poll_tx(struct napi_struct *napi, int budget)
151175

152176
int mt7603_dma_init(struct mt7603_dev *dev)
153177
{
154-
static const u8 wmm_queue_map[] = {
155-
[IEEE80211_AC_BK] = 0,
156-
[IEEE80211_AC_BE] = 1,
157-
[IEEE80211_AC_VI] = 2,
158-
[IEEE80211_AC_VO] = 3,
159-
};
160178
int ret;
161179
int i;
162180

0 commit comments

Comments
 (0)