Linux wireless drivers development
 help / color / mirror / Atom feed
From: Dmitry Gomzyakov <nicerok11@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Dmitry Gomzyakov <nicerok11@gmail.com>
Subject: [PATCH 2/2] wifi: mt76: mt7996: always fill txwi for 802.3 packets
Date: Sun, 10 May 2026 15:29:11 +0500	[thread overview]
Message-ID: <20260510102911.1883849-3-kyoto1337@protonmail.com> (raw)
In-Reply-To: <20260510102911.1883849-1-kyoto1337@protonmail.com>

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


      parent reply	other threads:[~2026-05-10 10:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260510102911.1883849-3-kyoto1337@protonmail.com \
    --to=nicerok11@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox