mt76: mt7615: fix hw queue mapping
authorLorenzo Bianconi <lorenzo@kernel.org>
Sat, 30 May 2020 22:32:04 +0000 (00:32 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 21 Jul 2020 17:01:14 +0000 (19:01 +0200)
mt7622/mt7663 chipsets rely on a fixed reverse queue map order respect
to mac80211 one:
- q(0): IEEE80211_AC_BK
- q(1): IEEE80211_AC_BE
- q(2): IEEE80211_AC_VI
- q(3): IEEE80211_AC_VO

Fixes: cdad4874057d ("mt76: mt7615: add dma and tx queue initialization for MT7622")
Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support")
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/dma.c
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
drivers/net/wireless/mediatek/mt76/mt7615/mac.h
drivers/net/wireless/mediatek/mt76/mt7615/main.c
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
drivers/net/wireless/mediatek/mt76/usb.c

index 5a124610d4af02d5bd5084ccee5c2c2f59bd473a..83fdcf5db3c7924de280f15fc300aacd7855a44c 100644 (file)
@@ -36,10 +36,10 @@ static int
 mt7622_init_tx_queues_multi(struct mt7615_dev *dev)
 {
        static const u8 wmm_queue_map[] = {
-               MT7622_TXQ_AC0,
-               MT7622_TXQ_AC1,
-               MT7622_TXQ_AC2,
-               MT7622_TXQ_AC3,
+               [IEEE80211_AC_BK] = MT7622_TXQ_AC0,
+               [IEEE80211_AC_BE] = MT7622_TXQ_AC1,
+               [IEEE80211_AC_VI] = MT7622_TXQ_AC2,
+               [IEEE80211_AC_VO] = MT7622_TXQ_AC3,
        };
        int ret;
        int i;
index 9f1c6ca7a665bcce42da6c1bb885e9c9456f7ac2..5990355bc731e286fc0f17dd5063ae74f4f2d686 100644 (file)
@@ -528,7 +528,7 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
 
        if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) {
                q_idx = wmm_idx * MT7615_MAX_WMM_SETS +
-                       skb_get_queue_mapping(skb);
+                       mt7615_lmac_mapping(dev, skb_get_queue_mapping(skb));
                p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
        } else if (beacon) {
                if (ext_phy)
index f0d4b29a52a240b1516be57f1b88855d10313ca8..81608ab656b8ef7d42ed755f906234e699ef027e 100644 (file)
@@ -124,21 +124,6 @@ enum tx_pkt_type {
        MT_TX_TYPE_FW,
 };
 
-enum tx_pkt_queue_idx {
-       MT_LMAC_AC00,
-       MT_LMAC_AC01,
-       MT_LMAC_AC02,
-       MT_LMAC_AC03,
-       MT_LMAC_ALTX0 = 0x10,
-       MT_LMAC_BMC0,
-       MT_LMAC_BCN0,
-       MT_LMAC_PSMP0,
-       MT_LMAC_ALTX1,
-       MT_LMAC_BMC1,
-       MT_LMAC_BCN1,
-       MT_LMAC_PSMP1,
-};
-
 enum tx_port_idx {
        MT_TX_PORT_IDX_LMAC,
        MT_TX_PORT_IDX_MCU
index 52d6544698fee4091bb31aeec1f764215aab1a4e..beaca8127680827f81c4ee6f9179f30c088013c0 100644 (file)
@@ -397,6 +397,7 @@ mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
        struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
        struct mt7615_dev *dev = mt7615_hw_dev(hw);
 
+       queue = mt7615_lmac_mapping(dev, queue);
        queue += mvif->wmm_idx * MT7615_MAX_WMM_SETS;
 
        return mt7615_mcu_set_wmm(dev, queue, params);
index d6176d316bee26674d8f9d18ec265679167da161..3e7d51bf42a4d32f9796610f79e5fee68c8c3b8d 100644 (file)
@@ -282,6 +282,21 @@ struct mt7615_dev {
        struct list_head wd_head;
 };
 
+enum tx_pkt_queue_idx {
+       MT_LMAC_AC00,
+       MT_LMAC_AC01,
+       MT_LMAC_AC02,
+       MT_LMAC_AC03,
+       MT_LMAC_ALTX0 = 0x10,
+       MT_LMAC_BMC0,
+       MT_LMAC_BCN0,
+       MT_LMAC_PSMP0,
+       MT_LMAC_ALTX1,
+       MT_LMAC_BMC1,
+       MT_LMAC_BCN1,
+       MT_LMAC_PSMP1,
+};
+
 enum {
        HW_BSSID_0 = 0x0,
        HW_BSSID_1,
@@ -447,6 +462,21 @@ static inline u16 mt7615_wtbl_size(struct mt7615_dev *dev)
                return MT7615_WTBL_SIZE;
 }
 
+static inline u8 mt7615_lmac_mapping(struct mt7615_dev *dev, u8 ac)
+{
+       static const u8 lmac_queue_map[] = {
+               [IEEE80211_AC_BK] = MT_LMAC_AC00,
+               [IEEE80211_AC_BE] = MT_LMAC_AC01,
+               [IEEE80211_AC_VI] = MT_LMAC_AC02,
+               [IEEE80211_AC_VO] = MT_LMAC_AC03,
+       };
+
+       if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map)))
+               return MT_LMAC_AC01; /* BE */
+
+       return lmac_queue_map[ac];
+}
+
 void mt7615_dma_reset(struct mt7615_dev *dev);
 void mt7615_scan_work(struct work_struct *work);
 void mt7615_roc_work(struct work_struct *work);
index fb97ea25b4d436a88ca309d25757d8a96dc10b98..27abcdb61a064fae5ebbac1197d8c13e8642a7ce 100644 (file)
@@ -1010,17 +1010,18 @@ static void mt76u_tx_kick(struct mt76_dev *dev, struct mt76_queue *q)
 static u8 mt76u_ac_to_hwq(struct mt76_dev *dev, u8 ac)
 {
        if (mt76_chip(dev) == 0x7663) {
-               static const u8 wmm_queue_map[] = {
-                       [IEEE80211_AC_VO] = 0,
-                       [IEEE80211_AC_VI] = 1,
-                       [IEEE80211_AC_BE] = 2,
-                       [IEEE80211_AC_BK] = 4,
+               static const u8 lmac_queue_map[] = {
+                       /* ac to lmac mapping */
+                       [IEEE80211_AC_BK] = 0,
+                       [IEEE80211_AC_BE] = 1,
+                       [IEEE80211_AC_VI] = 2,
+                       [IEEE80211_AC_VO] = 4,
                };
 
-               if (WARN_ON(ac >= ARRAY_SIZE(wmm_queue_map)))
-                       return 2; /* BE */
+               if (WARN_ON(ac >= ARRAY_SIZE(lmac_queue_map)))
+                       return 1; /* BE */
 
-               return wmm_queue_map[ac];
+               return lmac_queue_map[ac];
        }
 
        return mt76_ac_to_hwq(ac);