Commit b473c0e4 authored by Felix Fietkau's avatar Felix Fietkau

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: fca9615f ("mt76: mt7603: fix up hardware queue index for PS filtered packets")
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 95ff66d1
...@@ -4,6 +4,13 @@ ...@@ -4,6 +4,13 @@
#include "mac.h" #include "mac.h"
#include "../dma.h" #include "../dma.h"
static const u8 wmm_queue_map[] = {
[IEEE80211_AC_BK] = 0,
[IEEE80211_AC_BE] = 1,
[IEEE80211_AC_VI] = 2,
[IEEE80211_AC_VO] = 3,
};
static void static void
mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb) mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
{ {
...@@ -22,10 +29,10 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb) ...@@ -22,10 +29,10 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
struct mt7603_sta *msta; struct mt7603_sta *msta;
struct mt76_wcid *wcid; struct mt76_wcid *wcid;
u8 tid = 0, hwq = 0;
void *priv; void *priv;
int idx; int idx;
u32 val; u32 val;
u8 tid = 0;
if (skb->len < MT_TXD_SIZE + sizeof(struct ieee80211_hdr)) if (skb->len < MT_TXD_SIZE + sizeof(struct ieee80211_hdr))
goto free; goto free;
...@@ -42,19 +49,36 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb) ...@@ -42,19 +49,36 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
goto free; goto free;
priv = msta = container_of(wcid, struct mt7603_sta, wcid); priv = msta = container_of(wcid, struct mt7603_sta, wcid);
val = le32_to_cpu(txd[0]);
val &= ~(MT_TXD0_P_IDX | MT_TXD0_Q_IDX);
val |= FIELD_PREP(MT_TXD0_Q_IDX, MT_TX_HW_QUEUE_MGMT);
txd[0] = cpu_to_le32(val);
sta = container_of(priv, struct ieee80211_sta, drv_priv); sta = container_of(priv, struct ieee80211_sta, drv_priv);
hdr = (struct ieee80211_hdr *)&skb->data[MT_TXD_SIZE]; hdr = (struct ieee80211_hdr *)&skb->data[MT_TXD_SIZE];
if (ieee80211_is_data_qos(hdr->frame_control))
hwq = wmm_queue_map[IEEE80211_AC_BE];
if (ieee80211_is_data_qos(hdr->frame_control)) {
tid = *ieee80211_get_qos_ctl(hdr) & tid = *ieee80211_get_qos_ctl(hdr) &
IEEE80211_QOS_CTL_TAG1D_MASK; IEEE80211_QOS_CTL_TAG1D_MASK;
skb_set_queue_mapping(skb, tid_to_ac[tid]); u8 qid = tid_to_ac[tid];
hwq = wmm_queue_map[qid];
skb_set_queue_mapping(skb, qid);
} else if (ieee80211_is_data(hdr->frame_control)) {
skb_set_queue_mapping(skb, IEEE80211_AC_BE);
hwq = wmm_queue_map[IEEE80211_AC_BE];
} else {
skb_pull(skb, MT_TXD_SIZE);
if (!ieee80211_is_bufferable_mmpdu(skb))
goto free;
skb_push(skb, MT_TXD_SIZE);
skb_set_queue_mapping(skb, MT_TXQ_PSD);
hwq = MT_TX_HW_QUEUE_MGMT;
}
ieee80211_sta_set_buffered(sta, tid, true); ieee80211_sta_set_buffered(sta, tid, true);
val = le32_to_cpu(txd[0]);
val &= ~(MT_TXD0_P_IDX | MT_TXD0_Q_IDX);
val |= FIELD_PREP(MT_TXD0_Q_IDX, hwq);
txd[0] = cpu_to_le32(val);
spin_lock_bh(&dev->ps_lock); spin_lock_bh(&dev->ps_lock);
__skb_queue_tail(&msta->psq, skb); __skb_queue_tail(&msta->psq, skb);
if (skb_queue_len(&msta->psq) >= 64) { if (skb_queue_len(&msta->psq) >= 64) {
...@@ -151,12 +175,6 @@ static int mt7603_poll_tx(struct napi_struct *napi, int budget) ...@@ -151,12 +175,6 @@ static int mt7603_poll_tx(struct napi_struct *napi, int budget)
int mt7603_dma_init(struct mt7603_dev *dev) int mt7603_dma_init(struct mt7603_dev *dev)
{ {
static const u8 wmm_queue_map[] = {
[IEEE80211_AC_BK] = 0,
[IEEE80211_AC_BE] = 1,
[IEEE80211_AC_VI] = 2,
[IEEE80211_AC_VO] = 3,
};
int ret; int ret;
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment