* [PATCH RFT rtw-next 0/2] wifi: rtw88: honour rate, retries and bandwidth of injected frames
@ 2026-11-24 8:32 Ahmet Zeren via B4 Relay
2026-11-24 8:32 ` [PATCH RFT rtw-next 1/2] wifi: rtw88: use the rate, bandwidth and GI " Ahmet Zeren via B4 Relay
2026-11-24 8:32 ` [PATCH RFT rtw-next 2/2] wifi: rtw88: honour the retry count and NO_ACK " Ahmet Zeren via B4 Relay
0 siblings, 2 replies; 7+ messages in thread
From: Ahmet Zeren via B4 Relay @ 2026-11-24 8:32 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.
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.
---
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 | 2 ++
drivers/net/wireless/realtek/rtw88/tx.c | 49 ++++++++++++++++++++++++++++++-
drivers/net/wireless/realtek/rtw88/tx.h | 2 ++
4 files changed, 53 insertions(+), 1 deletion(-)
---
base-commit: 8b29fd95e2d3cb80564eb7cb34248b844422ba1e
change-id: 20261124-b4-rtw88-inject-dfb3f092da48
Best regards,
--
Ahmet Zeren <niko3x@proton.me>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH RFT rtw-next 1/2] wifi: rtw88: use the rate, bandwidth and GI of injected frames
2026-11-24 8:32 [PATCH RFT rtw-next 0/2] wifi: rtw88: honour rate, retries and bandwidth of injected frames Ahmet Zeren via B4 Relay
@ 2026-11-24 8:32 ` Ahmet Zeren via B4 Relay
2026-11-25 21:50 ` Luka Gejak
2026-11-24 8:32 ` [PATCH RFT rtw-next 2/2] wifi: rtw88: honour the retry count and NO_ACK " Ahmet Zeren via B4 Relay
1 sibling, 1 reply; 7+ messages in thread
From: Ahmet Zeren via B4 Relay @ 2026-11-24 8:32 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 [flat|nested] 7+ messages in thread
* [PATCH RFT rtw-next 2/2] wifi: rtw88: honour the retry count and NO_ACK of injected frames
2026-11-24 8:32 [PATCH RFT rtw-next 0/2] wifi: rtw88: honour rate, retries and bandwidth of injected frames Ahmet Zeren via B4 Relay
2026-11-24 8:32 ` [PATCH RFT rtw-next 1/2] wifi: rtw88: use the rate, bandwidth and GI " Ahmet Zeren via B4 Relay
@ 2026-11-24 8:32 ` Ahmet Zeren via B4 Relay
2026-11-25 21:52 ` Luka Gejak
1 sibling, 1 reply; 7+ messages in thread
From: Ahmet Zeren via B4 Relay @ 2026-11-24 8:32 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.
Set max_rate_tries to IEEE80211_MAX_TX_RETRY, the most mac80211 can
pass, and program the TX descriptor retry limit for injected frames: no
retries for NO_ACK frames, otherwise the radiotap retry count. Report
NO_ACK frames as IEEE80211_TX_STAT_NOACK_TRANSMITTED, like rtw89 does
since 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 | 2 ++
drivers/net/wireless/realtek/rtw88/tx.c | 14 +++++++++++++-
drivers/net/wireless/realtek/rtw88/tx.h | 2 ++
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 826e1bc3724..dd7197380ad 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 = 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..9c809544113 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -625,6 +625,8 @@ struct rtw_tx_pkt_info {
bool stbc;
bool ldpc;
bool dis_rate_fallback;
+ bool rty_lmt_en;
+ u8 data_rty_lmt;
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..f0ff8c70a1f 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,6 +226,8 @@ static void rtw_tx_report_tx_status(struct rtw_dev *rtwdev,
info = IEEE80211_SKB_CB(skb);
ieee80211_tx_info_clear_status(info);
+ if (info->flags & IEEE80211_TX_CTL_NO_ACK)
+ info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
if (acked)
info->flags |= IEEE80211_TX_STAT_ACK;
else
@@ -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 (rate->count) {
+ 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 [flat|nested] 7+ messages in thread
* Re: [PATCH RFT rtw-next 1/2] wifi: rtw88: use the rate, bandwidth and GI of injected frames
2026-11-24 8:32 ` [PATCH RFT rtw-next 1/2] wifi: rtw88: use the rate, bandwidth and GI " Ahmet Zeren via B4 Relay
@ 2026-11-25 21:50 ` Luka Gejak
2026-11-25 22:34 ` Ahmet Zeren
0 siblings, 1 reply; 7+ messages in thread
From: Luka Gejak @ 2026-11-25 21:50 UTC (permalink / raw)
To: niko3x, Ahmet Zeren via B4 Relay, Ping-Ke Shih
Cc: linux-wireless, Bitterblue Smith, linux-kernel, Ahmet Zeren
Hi Ahmet,
Thanks for picking this up. One comment below.
On November 24, 2026 11:32:30 AM GMT+03:00, Ahmet Zeren
<niko3x@proton.me> wrote:
[ ... ]
> + 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;
Do we also need DATA_SC when the requested width is narrower than the
channel? The RTL8822B vendor driver sets it alongside DATA_BW for HT and
VHT data. Here we leave it at zero and program the primary subchannels
through REG_DATA_SC. I am unsure which one the MAC uses with USE_RATE set.
Could we check that a 40 MHz frame on an 80 MHz channel goes out on the
half containing the primary channel, with the primary channel in each
half in turn?
Best regards,
Luka Gejak
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFT rtw-next 2/2] wifi: rtw88: honour the retry count and NO_ACK of injected frames
2026-11-24 8:32 ` [PATCH RFT rtw-next 2/2] wifi: rtw88: honour the retry count and NO_ACK " Ahmet Zeren via B4 Relay
@ 2026-11-25 21:52 ` Luka Gejak
2026-11-25 22:38 ` Ahmet Zeren
0 siblings, 1 reply; 7+ messages in thread
From: Luka Gejak @ 2026-11-25 21:52 UTC (permalink / raw)
To: niko3x, Ahmet Zeren via B4 Relay, Ping-Ke Shih
Cc: linux-wireless, Bitterblue Smith, linux-kernel, Ahmet Zeren
Hi Ahmet,
I have two comments for patch 2 as well.
On November 24, 2026 11:32:31 AM GMT+03:00, Ahmet Zeren
<niko3x@proton.me> wrote:
[ ... ]
> info = IEEE80211_SKB_CB(skb);
> ieee80211_tx_info_clear_status(info);
> + if (info->flags & IEEE80211_TX_CTL_NO_ACK)
> + info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
> if (acked)
> info->flags |= IEEE80211_TX_STAT_ACK;
As far as I can see, a successful report for a group addressed frame
sets both flags. The zero CCX status means the transmission succeeded,
so for these frames it does not imply an ACK. Could we reserve
IEEE80211_TX_STAT_ACK for frames that expect an ACK and use the CCX result
to decide whether a NO_ACK frame was transmitted?
[ ... ]
> + if (info->flags & IEEE80211_TX_CTL_NO_ACK) {
> + pkt_info->rty_lmt_en = true;
> + pkt_info->data_rty_lmt = 0;
> + } else if (rate->count) {
> + pkt_info->rty_lmt_en = true;
> + pkt_info->data_rty_lmt = rate->count - 1;
> + }
> +
> if (!(info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT))
> return;
So if I read the parser right, it clears IEEE80211_TX_CTRL_RATE_INJECT
when the requested rate is unsupported but still fills in rate->count.
For example, if I replay a capture with a two stream VHT rate on a one
stream adapter, we keep the usual rate selection but limit the frame to
one attempt when the capture has no retry field.
Could we gate the rate->count case on IEEE80211_TX_CTRL_RATE_INJECT as
well, like rtl8xxxu does? The NO_ACK case can still apply without a rate.
Best regards,
Luka Gejak
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFT rtw-next 1/2] wifi: rtw88: use the rate, bandwidth and GI of injected frames
2026-11-25 21:50 ` Luka Gejak
@ 2026-11-25 22:34 ` Ahmet Zeren
0 siblings, 0 replies; 7+ messages in thread
From: Ahmet Zeren @ 2026-11-25 22:34 UTC (permalink / raw)
To: Luka Gejak
Cc: Ahmet Zeren via B4 Relay, Ping-Ke Shih, linux-wireless,
Bitterblue Smith, linux-kernel
Hi Luka,
Thanks for looking at it.
> Do we also need DATA_SC when the requested width is narrower than the
> channel?
You may be right, I'm not sure. rtw_set_channel_mac() writes
REG_DATA_SC on every channel change, with the 20 MHz primary and on an
80 MHz channel, the 40 MHz half that contains the primary; and the
normal rtw88 TX paths leave DATA_SC at zero. My guess is that the MAC
uses that register then, but I can't tell whether that still holds
with USE_RATE set without hardware.
If you can run that test (a 40 MHz frame on an 80 MHz channel, with the
primary channel in each half), that would settle it. If it goes out on
the wrong half I'll add DATA_SC to the descriptor.
Thanks,
Ahmet
Sent with Proton Mail secure email.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFT rtw-next 2/2] wifi: rtw88: honour the retry count and NO_ACK of injected frames
2026-11-25 21:52 ` Luka Gejak
@ 2026-11-25 22:38 ` Ahmet Zeren
0 siblings, 0 replies; 7+ messages in thread
From: Ahmet Zeren @ 2026-11-25 22:38 UTC (permalink / raw)
To: Luka Gejak
Cc: Ahmet Zeren via B4 Relay, Ping-Ke Shih, linux-wireless,
Bitterblue Smith, linux-kernel, owner
Hi Luka,
You're right on both points, thanks. I'll fix them in v2: the retry
count will only be used when IEEE80211_TX_CTRL_RATE_INJECT is set, and
the TX report will set IEEE80211_TX_STAT_NOACK_TRANSMITTED instead of
IEEE80211_TX_STAT_ACK for NO_ACK frames that were sent.
Both came from following the rtw89 change, commit 92608bb5f14f ("wifi:
rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames"), so
rtw89 has the same two issues:
- rtw89_core_tx_update_injection() uses control.rates[0].count without
checking IEEE80211_TX_CTRL_RATE_INJECT
- rtw89_tx_rpt_tx_status() sets IEEE80211_TX_STAT_NOACK_TRANSMITTED and
then also IEEE80211_TX_STAT_ACK when the frame was sent
There is a third one there: max_rate_tries is set to
RTW89_TX_DATA_CNT_LMT_MAX (63), but control.rates[].count is only 5 bits
wide (IEEE80211_MAX_TX_RETRY is 31), so radiotap retry counts above 30
wrap around. My rtl8xxxu patch has the same overflow, I'll send a fix
for it.
Enver, Cc'ing you since it's your patch. I can send fixes for rtw89 as
well if you prefer, but I have no rtw89 hardware to test them.
Thanks,
Ahmet
Sent with Proton Mail secure email.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-25 22:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 8:32 [PATCH RFT rtw-next 0/2] wifi: rtw88: honour rate, retries and bandwidth of injected frames Ahmet Zeren via B4 Relay
2026-11-24 8:32 ` [PATCH RFT rtw-next 1/2] wifi: rtw88: use the rate, bandwidth and GI " Ahmet Zeren via B4 Relay
2026-11-25 21:50 ` Luka Gejak
2026-11-25 22:34 ` Ahmet Zeren
2026-11-24 8:32 ` [PATCH RFT rtw-next 2/2] wifi: rtw88: honour the retry count and NO_ACK " Ahmet Zeren via B4 Relay
2026-11-25 21:52 ` Luka Gejak
2026-11-25 22:38 ` Ahmet Zeren
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®