]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: mt7996: Fix BAND2 tx queues initialization when NPU is enabled
authorLorenzo Bianconi <lorenzo@kernel.org>
Thu, 22 Jan 2026 10:39:48 +0000 (11:39 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 23 Mar 2026 09:23:00 +0000 (09:23 +0000)
Fix BAND2 tx queues initialization for MT7990 chipset when NPU is
enabled. This is a preliminary patch to enable NPU offload for MT7996
(Eagle) chipset.

Tested-by: Kang Yang <kang.yang@airoha.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260122-mt76-npu-eagle-offload-v2-4-2374614c0de6@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7996/init.c
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h

index 2e439f0815d4e00bfbb19d9fbeacd6a92387c1f3..e678f06b4556dcc79c5b9b350c1f7c61f41efe26 100644 (file)
@@ -683,8 +683,9 @@ static int mt7996_register_phy(struct mt7996_dev *dev, enum mt76_band_id band)
                return 0;
 
        if (dev->hif2 &&
-           ((is_mt7996(&dev->mt76) && band == MT_BAND2) ||
-            (is_mt7992(&dev->mt76) && band == MT_BAND1))) {
+           ((is_mt7992(&dev->mt76) && band == MT_BAND1) ||
+            (is_mt7996(&dev->mt76) && band == MT_BAND2 &&
+             !mt76_npu_device_active(&dev->mt76)))) {
                hif1_ofs = MT_WFDMA0_PCIE1(0) - MT_WFDMA0(0);
                wed = &dev->mt76.mmio.wed_hif2;
        }
@@ -724,14 +725,19 @@ static int mt7996_register_phy(struct mt7996_dev *dev, enum mt76_band_id band)
        /* init wiphy according to mphy and phy */
        mt7996_init_wiphy_band(mphy->hw, phy);
 
-       if (is_mt7996(&dev->mt76) && !dev->hif2 && band == MT_BAND1) {
+       if (is_mt7996(&dev->mt76) &&
+           ((band == MT_BAND1 && !dev->hif2) ||
+            (band == MT_BAND2 && mt76_npu_device_active(&dev->mt76)))) {
                int i;
 
                for (i = 0; i <= MT_TXQ_PSD; i++)
-                       mphy->q_tx[i] = dev->mt76.phys[MT_BAND0]->q_tx[0];
+                       mphy->q_tx[i] = dev->mt76.phys[band - 1]->q_tx[0];
        } else {
-               ret = mt7996_init_tx_queues(mphy->priv, MT_TXQ_ID(band),
-                                           MT7996_TX_RING_SIZE,
+               int size = is_mt7996(&dev->mt76) &&
+                          mt76_npu_device_active(&dev->mt76)
+                          ? MT7996_NPU_TX_RING_SIZE / 2 : MT7996_TX_RING_SIZE;
+
+               ret = mt7996_init_tx_queues(mphy->priv, MT_TXQ_ID(band), size,
                                            MT_TXQ_RING_BASE(band) + hif1_ofs,
                                            wed);
                if (ret)
index f8b79b05169b063d7e4a29c25ad99504cc1b6eb4..09808e79ec86966209453ceb72958b72a3aa2303 100644 (file)
@@ -29,6 +29,7 @@
 #define MT7996_RX_RING_SIZE            1536
 #define MT7996_RX_MCU_RING_SIZE                512
 #define MT7996_RX_MCU_RING_SIZE_WA     1024
+#define MT7996_NPU_TX_RING_SIZE                1024
 /* scatter-gather of mcu event is not supported in connac3 */
 #define MT7996_RX_MCU_BUF_SIZE         (2048 + \
                                         SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))