The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH RFT rtw-next v2 0/2] wifi: rtw88: honour rate, retries and bandwidth of injected frames
@ 2026-11-27  8:59 Ahmet Zeren via B4 Relay
  2026-11-27  8:59 ` [PATCH RFT rtw-next v2 1/2] wifi: rtw88: use the rate, bandwidth and GI " Ahmet Zeren via B4 Relay
  2026-11-27  9:00 ` [PATCH RFT rtw-next v2 2/2] wifi: rtw88: honour the retry count and NO_ACK " Ahmet Zeren via B4 Relay
  0 siblings, 2 replies; 5+ messages in thread
From: Ahmet Zeren via B4 Relay @ 2026-11-27  8:59 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: linux-wireless, Luka Gejak, Bitterblue Smith, linux-kernel,
	Ahmet Zeren

rtw88 ignores most of the radiotap header of injected frames: the
firmware rate adaptation picks the rate, the frames are sent at 20 MHz,
and the radiotap retry count and NO_ACK have no effect. The same was
recently fixed in rtw89, and Ping-Ke agreed to take similar patches for
rtw88 in the thread "rtw88: injected frames ignore radiotap rate and
retry count".

Patch 1 uses the injected legacy, HT or VHT rate, bandwidth and guard
interval, without rate fallback.

Patch 2 programs the TX descriptor retry limit for injected frames, sets
max_rate_tries so the radiotap retry count is no longer clamped to zero,
and reports NO_ACK frames as such.

Non-injected frames are not affected. Injected frames without a radiotap
rate keep the current rate selection. Keeping the sequence number of
injected management frames (IEEE80211_TX_CTL_ASSIGN_SEQ, also done in
rtw89) is not covered here.

These are compile tested only, I have no rtw88 hardware. Luka offered to
test. A way to test, with the rtw88 device in monitor mode and a second
radio sniffing the same channel:
- inject data frames with a radiotap rate, HT MCS or VHT MCS, with and
  without short GI, and check they arrive at that rate
- set the monitor interface to a 40 or 80 MHz channel first (e.g.
  "iw dev wlan0 set freq 5180 80 5210"; mac80211 drops frames asking for
  more than the channel width), then inject frames asking for 40 or
  80 MHz and check the bandwidth on the sniffer
- inject unicast frames to an absent station with a radiotap rate and
  retries 0 and 6: the sniffer should see 1 and 7 copies of each frame
  (mac80211 ignores the retry count without a rate, and caps it at 30);
  with the NO_ACK flag it should see 1 copy
- a quick check that normal station mode still works
Please mention the chip, the bus and the band you tested.

One open question: Enver found that on rtw89 AX chips an unacked
unicast NO_ACK frame completes with "retry limit" rather than "done".
If rtw88 reports it the same way, such frames end up reported as failed
instead of IEEE80211_TX_STAT_NOACK_TRANSMITTED. Luka, could you check
the TX status of injected NO_ACK frames to an absent station? If they
come back as failed, I'll also treat that report as sent.

checkpatch --strict, W=1 and sparse are clean for each patch.

AI tool use (Documentation/process/generated-content.rst): the patches
were written with help from Claude Code (Claude Opus 5.5). It was asked
to apply the rtl8xxxu injection fixes to rtw88, using the rtw89
changes as a model, check the descriptor bits against rtl8xxxu, and
review the result. I have reviewed the changes and take responsibility
for them.

---
Changes in v2:
- Patch 2: program the radiotap retry count only when the frame has a
  usable radiotap rate (Luka).
- Patch 2: in the TX report, set IEEE80211_TX_STAT_NOACK_TRANSMITTED
  instead of IEEE80211_TX_STAT_ACK for NO_ACK frames that were sent,
  including group addressed frames (Luka).
- Patch 2: limit max_rate_tries by both the descriptor retry limit and
  IEEE80211_MAX_TX_RETRY.
- Patch 1: no change; DATA_SC stays zero, Luka's hardware test supports
  that REG_DATA_SC is used for frames narrower than the channel.
- Link to v1: https://patch.msgid.link/20261124-b4-rtw88-inject-v1-0-f7457e496924@proton.me

To: Ping-Ke Shih <pkshih@realtek.com>
Cc: linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

---
Ahmet Zeren (2):
      wifi: rtw88: use the rate, bandwidth and GI of injected frames
      wifi: rtw88: honour the retry count and NO_ACK of injected frames

 drivers/net/wireless/realtek/rtw88/main.c |  1 +
 drivers/net/wireless/realtek/rtw88/main.h |  3 ++
 drivers/net/wireless/realtek/rtw88/tx.c   | 51 +++++++++++++++++++++++++++++--
 drivers/net/wireless/realtek/rtw88/tx.h   |  2 ++
 4 files changed, 55 insertions(+), 2 deletions(-)
---
base-commit: 8b29fd95e2d3cb80564eb7cb34248b844422ba1e
change-id: 20261124-b4-rtw88-inject-dfb3f092da48

Best regards,
--  
Ahmet Zeren <niko3x@proton.me>



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

* [PATCH RFT rtw-next v2 1/2] wifi: rtw88: use the rate, bandwidth and GI of injected frames
  2026-11-27  8:59 [PATCH RFT rtw-next v2 0/2] wifi: rtw88: honour rate, retries and bandwidth of injected frames Ahmet Zeren via B4 Relay
@ 2026-11-27  8:59 ` Ahmet Zeren via B4 Relay
  2026-11-27  9:00 ` [PATCH RFT rtw-next v2 2/2] wifi: rtw88: honour the retry count and NO_ACK " Ahmet Zeren via B4 Relay
  1 sibling, 0 replies; 5+ messages in thread
From: Ahmet Zeren via B4 Relay @ 2026-11-27  8:59 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: linux-wireless, Luka Gejak, Bitterblue Smith, linux-kernel,
	Ahmet Zeren

From: Ahmet Zeren <niko3x@proton.me>

Injected frames ignore the rate, bandwidth and guard interval requested
in their radiotap header. Data frames have no station, so USE_RATE is not
set and the firmware rate adaptation picks the rate. Management frames
are sent at the lowest basic rate.

Use the injected rate, bandwidth and guard interval and disable rate
fallback, like rtw89 does since commit e96abe4fd7cd ("wifi: rtw89:
consider data rate/bandwidth/GI for injected packets"). Injected frames
without a radiotap rate are unchanged.

Signed-off-by: Ahmet Zeren <niko3x@proton.me>
---
 drivers/net/wireless/realtek/rtw88/tx.c | 35 +++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/tx.c b/drivers/net/wireless/realtek/rtw88/tx.c
index 701ed7c4f3f..dd5537d0cf1 100644
--- a/drivers/net/wireless/realtek/rtw88/tx.c
+++ b/drivers/net/wireless/realtek/rtw88/tx.c
@@ -405,6 +405,38 @@ out:
 	}
 }
 
+static void rtw_tx_injected_pkt_info_update(struct rtw_dev *rtwdev,
+					    struct rtw_tx_pkt_info *pkt_info,
+					    struct ieee80211_tx_info *info)
+{
+	struct ieee80211_tx_rate *rate = &info->control.rates[0];
+	u8 nss, mcs;
+
+	if (!(info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT))
+		return;
+
+	if (rate->flags & IEEE80211_TX_RC_VHT_MCS) {
+		nss = ieee80211_rate_get_vht_nss(rate);
+		mcs = ieee80211_rate_get_vht_mcs(rate);
+		pkt_info->rate = DESC_RATEVHT1SS_MCS0 + (nss - 1) * 10 + mcs;
+	} else if (rate->flags & IEEE80211_TX_RC_MCS) {
+		pkt_info->rate = DESC_RATEMCS0 + rate->idx;
+	} else {
+		pkt_info->rate = ieee80211_get_tx_rate(rtwdev->hw, info)->hw_value;
+	}
+
+	if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
+		pkt_info->bw = RTW_CHANNEL_WIDTH_80;
+	else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
+		pkt_info->bw = RTW_CHANNEL_WIDTH_40;
+	else
+		pkt_info->bw = RTW_CHANNEL_WIDTH_20;
+
+	pkt_info->short_gi = rate->flags & IEEE80211_TX_RC_SHORT_GI;
+	pkt_info->use_rate = true;
+	pkt_info->dis_rate_fallback = true;
+}
+
 void rtw_tx_pkt_info_update(struct rtw_dev *rtwdev,
 			    struct rtw_tx_pkt_info *pkt_info,
 			    struct ieee80211_sta *sta,
@@ -432,6 +464,9 @@ void rtw_tx_pkt_info_update(struct rtw_dev *rtwdev,
 	else if (ieee80211_is_data(fc))
 		rtw_tx_data_pkt_info_update(rtwdev, pkt_info, sta, skb);
 
+	if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED))
+		rtw_tx_injected_pkt_info_update(rtwdev, pkt_info, info);
+
 	bmc = is_broadcast_ether_addr(hdr->addr1) ||
 	      is_multicast_ether_addr(hdr->addr1);
 

-- 
2.56.1



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

* [PATCH RFT rtw-next v2 2/2] wifi: rtw88: honour the retry count and NO_ACK of injected frames
  2026-11-27  8:59 [PATCH RFT rtw-next v2 0/2] wifi: rtw88: honour rate, retries and bandwidth of injected frames Ahmet Zeren via B4 Relay
  2026-11-27  8:59 ` [PATCH RFT rtw-next v2 1/2] wifi: rtw88: use the rate, bandwidth and GI " Ahmet Zeren via B4 Relay
@ 2026-11-27  9:00 ` Ahmet Zeren via B4 Relay
  2026-11-27 11:59   ` Luka Gejak
  1 sibling, 1 reply; 5+ messages in thread
From: Ahmet Zeren via B4 Relay @ 2026-11-27  9:00 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: linux-wireless, Luka Gejak, Bitterblue Smith, linux-kernel,
	Ahmet Zeren

From: Ahmet Zeren <niko3x@proton.me>

max_rate_tries is not set, so mac80211 clamps the radiotap retry count
of injected frames to zero, and the TX descriptor retry limit is never
programmed. Injected unicast frames, even NO_ACK ones, are retried up to
the default limit, so frames to an absent station stall injection. The
TX report path also reports NO_ACK frames as not acked.

Limit max_rate_tries by both the TX descriptor retry limit and
IEEE80211_MAX_TX_RETRY, and program the descriptor retry limit for
injected frames: no retries for NO_ACK frames, otherwise the radiotap
retry count if the frame has a usable radiotap rate. In the TX report,
report NO_ACK frames that were sent as IEEE80211_TX_STAT_NOACK_TRANSMITTED
rather than acked; this includes group addressed frames.

rtw89 got similar changes in commit 92608bb5f14f ("wifi: rtw89: honor
ASSIGN_SEQ, retries, and NO_ACK for injected frames"). The retry limit
fields are at the same place as TXDESC40_RETRY_LIMIT_* in the
RTL8192EU/RTL8723BU TX descriptor of rtl8xxxu.

Signed-off-by: Ahmet Zeren <niko3x@proton.me>
---
 drivers/net/wireless/realtek/rtw88/main.c |  1 +
 drivers/net/wireless/realtek/rtw88/main.h |  3 +++
 drivers/net/wireless/realtek/rtw88/tx.c   | 16 ++++++++++++++--
 drivers/net/wireless/realtek/rtw88/tx.h   |  2 ++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 826e1bc3724..c715a6e86a1 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -2273,6 +2273,7 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
 		max_tx_headroom += RTW_SDIO_DATA_PTR_ALIGN;
 
 	hw->extra_tx_headroom = max_tx_headroom;
+	hw->max_rate_tries = min(RTW_TX_DATA_RTY_LMT_MAX + 1, IEEE80211_MAX_TX_RETRY);
 	hw->queues = IEEE80211_NUM_ACS;
 	hw->txq_data_size = sizeof(struct rtw_txq);
 	hw->sta_data_size = sizeof(struct rtw_sta_info);
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 525f17590ad..7888033376c 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -625,6 +625,9 @@ struct rtw_tx_pkt_info {
 	bool stbc;
 	bool ldpc;
 	bool dis_rate_fallback;
+	bool rty_lmt_en;
+	u8 data_rty_lmt;
+#define RTW_TX_DATA_RTY_LMT_MAX	0x3f
 	bool bmc;
 	bool use_rate;
 	bool ls;
diff --git a/drivers/net/wireless/realtek/rtw88/tx.c b/drivers/net/wireless/realtek/rtw88/tx.c
index dd5537d0cf1..32621b5c4fa 100644
--- a/drivers/net/wireless/realtek/rtw88/tx.c
+++ b/drivers/net/wireless/realtek/rtw88/tx.c
@@ -66,7 +66,9 @@ void rtw_tx_fill_tx_desc(struct rtw_dev *rtwdev,
 		      le32_encode_bits(pkt_info->nav_use_hdr, RTW_TX_DESC_W3_NAVUSEHDR) |
 		      le32_encode_bits(pkt_info->ampdu_factor, RTW_TX_DESC_W3_MAX_AGG_NUM);
 
-	tx_desc->w4 = le32_encode_bits(pkt_info->rate, RTW_TX_DESC_W4_DATARATE);
+	tx_desc->w4 = le32_encode_bits(pkt_info->rate, RTW_TX_DESC_W4_DATARATE) |
+		      le32_encode_bits(pkt_info->rty_lmt_en, RTW_TX_DESC_W4_RTY_LMT_EN) |
+		      le32_encode_bits(pkt_info->data_rty_lmt, RTW_TX_DESC_W4_DATA_RTY_LMT);
 
 	if (rtwdev->chip->old_datarate_fb_limit)
 		tx_desc->w4 |= le32_encode_bits(0x1f, RTW_TX_DESC_W4_DATARATE_FB_LIMIT);
@@ -224,7 +226,9 @@ static void rtw_tx_report_tx_status(struct rtw_dev *rtwdev,
 
 	info = IEEE80211_SKB_CB(skb);
 	ieee80211_tx_info_clear_status(info);
-	if (acked)
+	if (acked && info->flags & IEEE80211_TX_CTL_NO_ACK)
+		info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
+	else if (acked)
 		info->flags |= IEEE80211_TX_STAT_ACK;
 	else
 		info->flags &= ~IEEE80211_TX_STAT_ACK;
@@ -412,6 +416,14 @@ static void rtw_tx_injected_pkt_info_update(struct rtw_dev *rtwdev,
 	struct ieee80211_tx_rate *rate = &info->control.rates[0];
 	u8 nss, mcs;
 
+	if (info->flags & IEEE80211_TX_CTL_NO_ACK) {
+		pkt_info->rty_lmt_en = true;
+		pkt_info->data_rty_lmt = 0;
+	} else if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT) {
+		pkt_info->rty_lmt_en = true;
+		pkt_info->data_rty_lmt = rate->count - 1;
+	}
+
 	if (!(info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT))
 		return;
 
diff --git a/drivers/net/wireless/realtek/rtw88/tx.h b/drivers/net/wireless/realtek/rtw88/tx.h
index 168f48e8785..b6c687d33db 100644
--- a/drivers/net/wireless/realtek/rtw88/tx.h
+++ b/drivers/net/wireless/realtek/rtw88/tx.h
@@ -46,6 +46,8 @@ struct rtw_tx_desc {
 #define RTW_TX_DESC_W3_MAX_AGG_NUM GENMASK(21, 17)
 #define RTW_TX_DESC_W4_DATARATE GENMASK(6, 0)
 #define RTW_TX_DESC_W4_DATARATE_FB_LIMIT GENMASK(12, 8)
+#define RTW_TX_DESC_W4_RTY_LMT_EN BIT(17)
+#define RTW_TX_DESC_W4_DATA_RTY_LMT GENMASK(23, 18)
 #define RTW_TX_DESC_W4_RTSRATE GENMASK(28, 24)
 #define RTW_TX_DESC_W5_DATA_SHORT BIT(4)
 #define RTW_TX_DESC_W5_DATA_BW GENMASK(6, 5)

-- 
2.56.1



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

* Re: [PATCH RFT rtw-next v2 2/2] wifi: rtw88: honour the retry count and NO_ACK of injected frames
  2026-11-27  9:00 ` [PATCH RFT rtw-next v2 2/2] wifi: rtw88: honour the retry count and NO_ACK " Ahmet Zeren via B4 Relay
@ 2026-11-27 11:59   ` Luka Gejak
  2026-11-27 12:24     ` Ahmet Zeren
  0 siblings, 1 reply; 5+ messages in thread
From: Luka Gejak @ 2026-11-27 11:59 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: linux-wireless, Luka Gejak, Bitterblue Smith, linux-kernel,
	Ahmet Zeren

Hi Ahmet,

Thanks for the update. One comment below.

On November 27, 2026 12:00:00 PM GMT+03:00, Ahmet Zeren
<niko3x@proton.me> wrote:

[ ... ]
>  	info = IEEE80211_SKB_CB(skb);
>  	ieee80211_tx_info_clear_status(info);
> -	if (acked)
> +	if (acked && info->flags & IEEE80211_TX_CTL_NO_ACK)
> +		info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
> +	else if (acked)
>  		info->flags |= IEEE80211_TX_STAT_ACK;

As far as I can see, ieee80211_add_tx_radiotap_header() sets
IEEE80211_RADIOTAP_F_TX_FAIL for a unicast frame whenever
IEEE80211_TX_STAT_ACK is clear. So with this change the monitor capture
can show a failed transmission even when CCX reports success.

Could we check for IEEE80211_TX_STAT_NOACK_TRANSMITTED there too? For the
test in the cover letter, I think we need the raw CCX result to tell
whether the firmware actually reported retry exhaustion.

Best regards,
Luka Gejak

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

* Re: [PATCH RFT rtw-next v2 2/2] wifi: rtw88: honour the retry count and NO_ACK of injected frames
  2026-11-27 11:59   ` Luka Gejak
@ 2026-11-27 12:24     ` Ahmet Zeren
  0 siblings, 0 replies; 5+ messages in thread
From: Ahmet Zeren @ 2026-11-27 12:24 UTC (permalink / raw)
  To: Luka Gejak; +Cc: Ping-Ke Shih, linux-wireless, Bitterblue Smith, linux-kernel


Hi Luka,

> As far as I can see, ieee80211_add_tx_radiotap_header() sets
> IEEE80211_RADIOTAP_F_TX_FAIL for a unicast frame whenever
> IEEE80211_TX_STAT_ACK is clear.

Yes I missed that. It also affects rtl8xxxu, which already reports
NO_ACK frames as IEEE80211_TX_STAT_NOACK_TRANSMITTED. I think it's
better fixed in mac80211, so that TX_FAIL is not set when
IEEE80211_TX_STAT_NOACK_TRANSMITTED is. I'll send a separate patch for
that, tested with rtl8xxxu.

> For the test in the cover letter, I think we need the raw CCX result to
> tell whether the firmware actually reported retry exhaustion.

Agreed. For testing only, this prints it with CONFIG_RTW88_DEBUG and
rtw88_core debug_mask=0x2:

--- a/drivers/net/wireless/realtek/rtw88/tx.c
+++ b/drivers/net/wireless/realtek/rtw88/tx.c
@@ void rtw_tx_report_handle(struct rtw_dev *rtwdev, struct sk_buff *skb, int src)
 		st = GET_CCX_REPORT_STATUS_V1(c2h->payload);
 	}

+	rtw_dbg(rtwdev, RTW_DBG_TX, "tx report: sn %u status 0x%02x\n", sn, st);
+
 	spin_lock_irqsave(&tx_report->q_lock, flags);

Thanks,
Ahmet



Sent with Proton Mail secure email.

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

end of thread, other threads:[~2026-11-27 12:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  8:59 [PATCH RFT rtw-next v2 0/2] wifi: rtw88: honour rate, retries and bandwidth of injected frames Ahmet Zeren via B4 Relay
2026-11-27  8:59 ` [PATCH RFT rtw-next v2 1/2] wifi: rtw88: use the rate, bandwidth and GI " Ahmet Zeren via B4 Relay
2026-11-27  9:00 ` [PATCH RFT rtw-next v2 2/2] wifi: rtw88: honour the retry count and NO_ACK " Ahmet Zeren via B4 Relay
2026-11-27 11:59   ` Luka Gejak
2026-11-27 12:24     ` Ahmet Zeren

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