wifi: mt76: connac: enable critical packet mode support for mt7992
authorHoward Hsu <howard-yh.hsu@mediatek.com>
Wed, 20 Mar 2024 11:09:15 +0000 (19:09 +0800)
committerFelix Fietkau <nbd@nbd.name>
Thu, 2 May 2024 10:44:51 +0000 (12:44 +0200)
For mt7992 chipsets, critical packet mode should be properly configured
to let the HW SDO module correctly fill the AC queue in TX descriptors of
some higher priority packets such as ARP and ICMP.
Without this patch, HW queues may hang when running MU traffic.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
drivers/net/wireless/mediatek/mt76/mt7996/main.c
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h

index 608deb47dada12ef9a79d5e8615d4be1f49756ef..836cc4d5b1d2ccf6359fa510647adb750c385139 100644 (file)
@@ -1220,6 +1220,7 @@ enum {
        MCU_EXT_CMD_TXDPD_CAL = 0x60,
        MCU_EXT_CMD_CAL_CACHE = 0x67,
        MCU_EXT_CMD_RED_ENABLE = 0x68,
+       MCU_EXT_CMD_CP_SUPPORT = 0x75,
        MCU_EXT_CMD_SET_RADAR_TH = 0x7c,
        MCU_EXT_CMD_SET_RDD_PATTERN = 0x7d,
        MCU_EXT_CMD_MWDS_SUPPORT = 0x80,
index 995c265442df3ff653628dcf7d134a4be7dcce24..338ff10b121d73c42e3f0eb43e591c0f72d2756a 100644 (file)
@@ -35,6 +35,14 @@ int mt7996_run(struct ieee80211_hw *hw)
                ret = mt7996_mcu_set_hdr_trans(dev, true);
                if (ret)
                        goto out;
+
+               if (is_mt7992(&dev->mt76)) {
+                       u8 queue = mt76_connac_lmac_mapping(IEEE80211_AC_VI);
+
+                       ret = mt7996_mcu_cp_support(dev, queue);
+                       if (ret)
+                               goto out;
+               }
        }
 
        mt7996_mac_enable_nf(dev, phy->mt76->band_idx);
index 4f33170d051d343c625bcdd42bfe0450b4f26913..3041bbc1986984fb95633239e6ae38237bd0847c 100644 (file)
@@ -4533,3 +4533,16 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy)
        return mt76_mcu_skb_send_msg(&dev->mt76, skb,
                                     MCU_WM_UNI_CMD(TXPOWER), true);
 }
+
+int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode)
+{
+       __le32 cp_mode;
+
+       if (mode < mt76_connac_lmac_mapping(IEEE80211_AC_BE) ||
+           mode > mt76_connac_lmac_mapping(IEEE80211_AC_VO))
+               return -EINVAL;
+
+       cp_mode = cpu_to_le32(mode);
+       return mt76_mcu_send_msg(&dev->mt76, MCU_WA_EXT_CMD(CP_SUPPORT),
+                                &cp_mode, sizeof(cp_mode), true);
+}
index 73b2dbeb26b4877ecf4d9991a59f36f8bb87972f..177cfff31120ed72d2e3a1e34be994fcb8bd5344 100644 (file)
@@ -613,6 +613,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
 int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
                                     struct ieee80211_vif *vif,
                                     struct ieee80211_sta *sta);
+int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
 #ifdef CONFIG_MAC80211_DEBUGFS
 void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                            struct ieee80211_sta *sta, struct dentry *dir);