mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ahmet Zeren via B4 Relay <devnull+niko3x.proton.me@kernel.org>
To: Jes Sorensen <Jes.Sorensen@gmail.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Ping-Ke Shih <pkshih@realtek.com>,
	Ahmet Zeren <niko3x@proton.me>
Subject: [PATCH rtw-next v2 3/3] wifi: rtl8xxxu: honour the bandwidth of injected frames on gen1 chips
Date: Sun, 22 Nov 2026 08:59:31 +0300	[thread overview]
Message-ID: <20261122-b4-inject-v2-3-0ee720fe706d@proton.me> (raw)
In-Reply-To: <20261122-b4-inject-v2-0-0ee720fe706d@proton.me>

From: Ahmet Zeren <niko3x@proton.me>

Injected frames are always sent at 20 MHz, even when they ask for 40 MHz
on a 40 MHz channel, because only QoS data frames get the 40 MHz bits in
the TX descriptor.

Set them for injected frames with IEEE80211_TX_RC_40_MHZ_WIDTH.

Tested on RTL8192CU (0bda:8178) on channel 6 HT40+ and HT40-, received
by a second radio sniffing at 40 MHz: MCS 0 and 7 requested at 40 MHz
arrive at 40 MHz (without this patch: 20 MHz), requested at 20 MHz they
stay at 20 MHz.

Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ahmet Zeren <niko3x@proton.me>
---
 drivers/net/wireless/realtek/rtl8xxxu/core.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 7d6f5243f64..0f7c4ee4437 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -5278,6 +5278,7 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
 	u16 seq_number;
 	int retries;
 	bool inject;
+	bool bw40;
 
 	inject = rtl8xxxu_tx_rate_inject(tx_info, &rate, &sgi);
 	retries = rtl8xxxu_tx_retry_inject(tx_info);
@@ -5313,17 +5314,22 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
 		tx_desc->txdw5 |= cpu_to_le32(TXDESC32_RETRY_LIMIT_ENABLE);
 	}
 
-	if (ieee80211_is_data_qos(hdr->frame_control)) {
+	if (ieee80211_is_data_qos(hdr->frame_control))
 		tx_desc->txdw4 |= cpu_to_le32(TXDESC32_QOS);
 
-		if (conf_is_ht40(&hw->conf)) {
-			tx_desc->txdw4 |= cpu_to_le32(TXDESC_DATA_BW);
+	if (inject)
+		bw40 = tx_info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH;
+	else
+		bw40 = ieee80211_is_data_qos(hdr->frame_control) &&
+		       conf_is_ht40(&hw->conf);
 
-			if (conf_is_ht40_minus(&hw->conf))
-				tx_desc->txdw4 |= cpu_to_le32(TXDESC_PRIME_CH_OFF_UPPER);
-			else
-				tx_desc->txdw4 |= cpu_to_le32(TXDESC_PRIME_CH_OFF_LOWER);
-		}
+	if (bw40) {
+		tx_desc->txdw4 |= cpu_to_le32(TXDESC_DATA_BW);
+
+		if (conf_is_ht40_minus(&hw->conf))
+			tx_desc->txdw4 |= cpu_to_le32(TXDESC_PRIME_CH_OFF_UPPER);
+		else
+			tx_desc->txdw4 |= cpu_to_le32(TXDESC_PRIME_CH_OFF_LOWER);
 	}
 
 	if (short_preamble)

-- 
2.56.1



      parent reply	other threads:[~2026-11-22  5:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  5:59 [PATCH rtw-next v2 0/3] wifi: rtl8xxxu: honour rate, retries and bandwidth of injected frames Ahmet Zeren via B4 Relay
2026-11-22  5:59 ` [PATCH rtw-next v2 1/3] wifi: rtl8xxxu: honour the rate of injected frames on gen1 chips Ahmet Zeren via B4 Relay
2026-11-22  5:59 ` [PATCH rtw-next v2 2/3] wifi: rtl8xxxu: honour the retry count " Ahmet Zeren via B4 Relay
2026-11-22  5:59 ` Ahmet Zeren via B4 Relay [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=20261122-b4-inject-v2-3-0ee720fe706d@proton.me \
    --to=devnull+niko3x.proton.me@kernel.org \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=niko3x@proton.me \
    --cc=pkshih@realtek.com \
    /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

all inboxes | Powered by JetHome®