]> git.hungrycats.org Git - linux/commitdiff
wifi: mt76: restrict NPU/PPE active checks to MMIO devices
authorDevin Wittmayer <lucid_duck@justthetip.ca>
Mon, 20 Jul 2026 23:27:36 +0000 (16:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Sep 2026 11:36:17 +0000 (13:36 +0200)
[ Upstream commit 7981aca2bd28a1f7ad7eeab89715442a95b1f72e ]

mt76_npu_device_active() and mt76_ppe_device_active() read dev->mmio.npu
and dev->mmio.ppe_dev. The mmio, usb and sdio bus structs share a union in
struct mt76_dev, so on USB and SDIO these read unrelated data from the
usb/sdio struct, which is non-NULL in practice.

mt76_npu_device_active() then returns true on USB, and
mt76_rx_poll_complete() takes the offload path and skips
mt76_rx_aggr_reorder(). RX A-MPDU subframes are delivered out of order and
the peer's TCP stack treats that as loss: heavy retransmissions and reduced
throughput in AP mode. Seen on mt7921u, mt7925u, mt76x2u and mt76x0u.

Gate both helpers on mt76_is_mmio() so they only run for the bus type that
owns the mmio union member.

Fixes: 7fb554b1b623 ("wifi: mt76: Introduce the NPU generic layer")
Cc: stable@vger.kernel.org
Tested-by: Nick Morrow <morrownr@gmail.com>
Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca>
Link: https://patch.msgid.link/20260720232640.41293-1-lucid_duck@justthetip.ca
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt76.h

index 556078771859970b5a65a89169dbc22458e95243..d511592a1ad877afa3d58a1394b89db58479a5fe 100644 (file)
@@ -1705,12 +1705,12 @@ static inline int mt76_npu_net_setup_tc(struct ieee80211_hw *hw,
 
 static inline bool mt76_npu_device_active(struct mt76_dev *dev)
 {
-       return !!rcu_access_pointer(dev->mmio.npu);
+       return mt76_is_mmio(dev) && !!rcu_access_pointer(dev->mmio.npu);
 }
 
 static inline bool mt76_ppe_device_active(struct mt76_dev *dev)
 {
-       return !!rcu_access_pointer(dev->mmio.ppe_dev);
+       return mt76_is_mmio(dev) && !!rcu_access_pointer(dev->mmio.ppe_dev);
 }
 
 static inline int mt76_npu_send_msg(struct airoha_npu *npu, int ifindex,