Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 0/2] wifi: mt76: fix NAT performance degradation on MT799x
@ 2026-05-10 10:29 Dmitry Gomzyakov
  2026-05-10 10:29 ` [PATCH 1/2] wifi: mt76: connac: add MT7991A (0x7991) to is_mt7996() Dmitry Gomzyakov
  2026-05-10 10:29 ` [PATCH 2/2] wifi: mt76: mt7996: always fill txwi for 802.3 packets Dmitry Gomzyakov
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Gomzyakov @ 2026-05-10 10:29 UTC (permalink / raw)
  To: linux-wireless; +Cc: Dmitry Gomzyakov

From: Dmitry Gomzyakov <nicerok11@gmail.com>

This series fixes severe IPv4 NAT download performance degradation
(30-40 Mbps limit) observed on MT799x platforms (MT7987A+MT7991A,
MT7992, MT7996).

Patch 1 adds MT7991A (0x7991) to is_mt7996() to ensure correct
chip-specific settings are used.

Patch 2 restores host-driven TXWI filling for all packets, fixing
firmware misinterpretation of NAT-modified IPv4 packets.

Dmitry Gomzyakov (2):
  wifi: mt76: connac: add MT7991A (0x7991) to is_mt7996()
  wifi: mt76: mt7996: always fill txwi for 802.3 packets

 mt76_connac.h |  3 ++-
 mt7996/mac.c  | 12 +++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)

--
2.54.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] wifi: mt76: connac: add MT7991A (0x7991) to is_mt7996()
  2026-05-10 10:29 [PATCH 0/2] wifi: mt76: fix NAT performance degradation on MT799x Dmitry Gomzyakov
@ 2026-05-10 10:29 ` Dmitry Gomzyakov
  2026-05-10 10:29 ` [PATCH 2/2] wifi: mt76: mt7996: always fill txwi for 802.3 packets Dmitry Gomzyakov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Gomzyakov @ 2026-05-10 10:29 UTC (permalink / raw)
  To: linux-wireless; +Cc: Dmitry Gomzyakov

From: Dmitry Gomzyakov <nicerok11@gmail.com>

The MT7991A chipset uses PCI device ID 0x7991 (MT7996_DEVICE_ID_2),
but is_mt7996() only checks for 0x7990. This causes MT7991A devices
to use incorrect chip-specific settings, such as:
- MSDU_CNT_V2 instead of MSDU_CNT in TX descriptors
- Wrong WTBL BMC size (32 instead of 64)
- Incorrect prefetch depth for MCU queues

Fixes: 63a4edf1cb74 ("wifi: mt76: mt7996: add macros for pci decive id")
Signed-off-by: Dmitry Gomzyakov <nicerok11@gmail.com>
---
 mt76_connac.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mt76_connac.h b/mt76_connac.h
index 51423c77..db07f3dc 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -230,7 +230,8 @@ static inline bool is_mt798x(struct mt76_dev *dev)
 
 static inline bool is_mt7996(struct mt76_dev *dev)
 {
-	return mt76_chip(dev) == 0x7990;
+	u16 chip = mt76_chip(dev);
+	return chip == 0x7990 || chip == 0x7991;
 }
 
 static inline bool is_mt7992(struct mt76_dev *dev)
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] wifi: mt76: mt7996: always fill txwi for 802.3 packets
  2026-05-10 10:29 [PATCH 0/2] wifi: mt76: fix NAT performance degradation on MT799x Dmitry Gomzyakov
  2026-05-10 10:29 ` [PATCH 1/2] wifi: mt76: connac: add MT7991A (0x7991) to is_mt7996() Dmitry Gomzyakov
@ 2026-05-10 10:29 ` Dmitry Gomzyakov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Gomzyakov @ 2026-05-10 10:29 UTC (permalink / raw)
  To: linux-wireless; +Cc: Dmitry Gomzyakov

From: Dmitry Gomzyakov <nicerok11@gmail.com>

Commit 55218e636092 reverted host-driven TXD filling to rely on
Software Defined Offload (SDO). However, SDO cannot correctly parse
IPv4 packets modified by NAT (changed TTL and recalculated IP/TCP
checksums), leaving TXWI mostly zero-filled.

This causes the firmware to misinterpret or drop packets,
resulting in severe throughput degradation (30-40 Mbps limit on
WiFi IPv4 download through NAT).

Always fill TXWI via mt7996_mac_write_txwi() and always set
MT_CT_INFO_APPLY_TXD, matching the behavior of mt7915 and the
proprietary driver.

Fixes: 55218e636092 ("Revert \"wifi: mt76: mt7996: fill txd by host driver\"")
Signed-off-by: Dmitry Gomzyakov <nicerok11@gmail.com>
---
 mt7996/mac.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/mt7996/mac.c b/mt7996/mac.c
index 7d454e21..a219b063 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -1093,10 +1093,9 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
 
 	pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb);
 	memset(txwi_ptr, 0, MT_TXD_SIZE);
-	/* Transmit non qos data by 802.11 header and need to fill txd by host*/
-	if (!is_8023 || pid >= MT_PACKET_ID_FIRST)
-		mt7996_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, key,
-				      pid, qid, 0);
+	/* Always fill txwi for firmware to avoid incorrect header processing */
+	mt7996_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, key,
+			      pid, qid, 0);
 
 	/* MT7996 and MT7992 require driver to provide the MAC TXP for AddBA
 	 * req
@@ -1145,9 +1144,8 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
 		txp->fw.nbuf = nbuf;
 
 		txp->fw.flags = cpu_to_le16(MT_CT_INFO_FROM_HOST);
-
-		if (!is_8023 || pid >= MT_PACKET_ID_FIRST)
-			txp->fw.flags |= cpu_to_le16(MT_CT_INFO_APPLY_TXD);
+		/* Always apply TXD to ensure correct firmware processing */
+		txp->fw.flags |= cpu_to_le16(MT_CT_INFO_APPLY_TXD);
 
 		if (!key)
 			txp->fw.flags |= cpu_to_le16(MT_CT_INFO_NONE_CIPHER_FRAME);
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-10 10:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10 10:29 [PATCH 0/2] wifi: mt76: fix NAT performance degradation on MT799x Dmitry Gomzyakov
2026-05-10 10:29 ` [PATCH 1/2] wifi: mt76: connac: add MT7991A (0x7991) to is_mt7996() Dmitry Gomzyakov
2026-05-10 10:29 ` [PATCH 2/2] wifi: mt76: mt7996: always fill txwi for 802.3 packets Dmitry Gomzyakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox