From: Ping-Ke Shih <pkshih@realtek.com>
To: Enver Ikromov <owner@ph4ntom-rev.uz>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH rtw-next v5 09/10] wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames
Date: Mon, 16 Nov 2026 03:00:10 +0000 [thread overview]
Message-ID: <a56a85ff19dc4bd29cb3c81cb7e0c77a@realtek.com> (raw)
In-Reply-To: <20261113235211.1911-10-owner@ph4ntom-rev.uz>
Enver Ikromov <owner@ph4ntom-rev.uz> wrote:
> For injected frames, rtw89_core_tx_update_injection() only applies
> the radiotap rate and leaves several TX descriptor and completion
> settings mismatched with the radiotap flags:
>
> - The management path sets hw_ssn_sel/hw_seq_mode (and MLO links set
> upd_wlan_hdr), overwriting user-supplied sequence numbers when
> IEEE80211_TX_CTL_ASSIGN_SEQ is not set, and leaving hw_seq_mode
> enabled even on injected control frames that have no seq_ctrl field.
> Conversely, injected data frames leave hw_seq_mode unset when
> ASSIGN_SEQ is requested on a monitor interface.
> - Unicast frames unconditionally set RTS_EN = 1 and HW_RTS_EN = 1 in
> txwd_info4. On normal traffic HW_RTS_EN = 1 gates RTS on the MAC
> length/duration threshold (4080B / 2816us), whereas for injected
> frames RTS_EN must follow IEEE80211_TX_RC_USE_RTS_CTS with
> HW_RTS_EN = 0 so short frames requesting RTS/CTS actually emit RTS.
No need to describe driver behavior.
> - IEEE80211_TX_CTL_NO_ACK (e.g. IEEE80211_RADIOTAP_F_TX_NOACK) neither
> sets BE_TXD_BODY6_NO_ACK on Wi-Fi 7 descriptors nor bounds retries,
> causing unacknowledged frames to be retransmitted up to the retry
> limit. Note that Wi-Fi 6 TXWD v0 chips (RTL8852A/B, RTL8851B) have
> no dedicated per-packet NO_ACK descriptor bit and rely on
> tx_cnt_lmt = 1 to suppress retransmissions; when that single attempt
> completes with RTW89_TX_RETRY_LIMIT, suppress false tx_retry_lmt
> accounting in rtw89_pci_tx_status() and set
> IEEE80211_TX_STAT_NOACK_TRANSMITTED in rtw89_tx_rpt_tx_status() too.
> - hw->max_rate_tries is left at the mac80211 default (4), truncating
> IEEE80211_RADIOTAP_DATA_RETRIES, and info->control.rates[0].count is
> ignored when a radiotap rate is specified.
> - Positive radiotap HT/VHT/legacy rate indices are added to the table
> base without clamping to the chip's valid MCS or legacy rate bounds.
>
> Configure hardware sequence assignment according to
> IEEE80211_TX_CTL_ASSIGN_SEQ (and never on control frames), drive
> rts_en and hw_rts_en for radiotap RTS/CTS, advertise
> RTW89_TX_DATA_CNT_LMT_MAX (63) in hw->max_rate_tries, honor
> rates[0].count and NO_ACK descriptor/status semantics, and clamp
> positive radiotap rate indices to valid hardware ranges.
>
> Signed-off-by: Enver Ikromov <owner@ph4ntom-rev.uz>
> ---
> drivers/net/wireless/realtek/rtw89/core.c | 63 ++++++++++++++++++-----
> drivers/net/wireless/realtek/rtw89/core.h | 4 ++
> drivers/net/wireless/realtek/rtw89/mac.h | 2 +
> drivers/net/wireless/realtek/rtw89/pci.c | 3 +-
> 4 files changed, 58 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> index 84c12c6..7d174d2 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.c
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -1252,12 +1252,43 @@ static void rtw89_core_tx_update_injection(struct rtw89_dev *rtwdev,
> const struct rtw89_hw_rate_def *hw_rate = &rtw89_hw_rate[rtwdev->chip->chip_gen];
> enum mac80211_rate_control_flags flags = info->control.rates[0].flags;
> struct rtw89_tx_desc_info *desc_info = &tx_req->desc_info;
> + struct ieee80211_hdr *hdr = (void *)tx_req->skb->data;
> const struct rtw89_chan *chan;
> s8 idx = info->control.rates[0].idx;
> - u8 nss, mcs;
> + u8 nss, mcs, max_mcs;
>
> desc_info->use_rate = true;
> desc_info->dis_data_fb = true;
> + desc_info->hw_rts_en = false;
> + desc_info->rts_en = (flags & IEEE80211_TX_RC_USE_RTS_CTS) &&
> + !desc_info->is_bmc &&
> + !(info->flags & IEEE80211_TX_CTL_NO_ACK);
> +
> + /* Control frames have no seq_ctrl field; otherwise keep the
> + * sequence number supplied by user space unless ASSIGN_SEQ is set.
> + */
> + if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) ||
> + ieee80211_is_ctl(hdr->frame_control)) {
> + desc_info->upd_wlan_hdr = false;
Does it need to update this?
> + desc_info->hw_ssn_sel = 0;
> + desc_info->hw_seq_mode = 0;
> + } else {
> + desc_info->hw_ssn_sel = RTW89_MGMT_HW_SSN_SEL;
> + desc_info->hw_seq_mode = RTW89_MGMT_HW_SEQ_MODE;
This is only for MGMT frames. If you inject QoS data frames, the sequence
number should count per TID. But for injection it seems not build BA seesion
, so this is harmless.
> + }
> +
> + /* Suppress hardware retransmissions (and ACK waiting on BE) for NO_ACK;
> + * otherwise honor explicit radiotap retry limits when a rate is set.
> + */
First line of block comment should be empty.
But this comment is not necessary. The code explains itself.
> + if (info->flags & IEEE80211_TX_CTL_NO_ACK) {
> + desc_info->no_ack = true;
> + desc_info->tx_cnt_lmt_en = true;
> + desc_info->tx_cnt_lmt = 1;
> + } else if (info->control.rates[0].count) {
> + desc_info->tx_cnt_lmt_en = true;
> + desc_info->tx_cnt_lmt = umin(info->control.rates[0].count,
> + RTW89_TX_DATA_CNT_LMT_MAX);
You have set
hw->max_rate_tries = RTW89_TX_DATA_CNT_LMT_MAX;
Is it still necessary to have umin()?
> + }
>
> /* No rate was given in the radiotap header. Management frames
> * already carry the rate from rtw89_core_tx_update_mgmt_info(), so
> @@ -1283,16 +1314,20 @@ static void rtw89_core_tx_update_injection(struct rtw89_dev *rtwdev,
> desc_info->gi_ltf = 1;
>
> if (flags & IEEE80211_TX_RC_VHT_MCS) {
> + max_mcs = rtwdev->chip->chip_gen == RTW89_CHIP_BE ? 11 : 9;
I think the maximum standard VHT MCS rate is 9. Just use 9 inline.
> nss = umin(idx >> 4, ARRAY_SIZE(hw_rate->vht) - 1);
> - mcs = idx & 0xf;
> + mcs = umin(idx & 0xf, max_mcs);
> desc_info->data_rate = hw_rate->vht[nss] + mcs;
> } else if (flags & IEEE80211_TX_RC_MCS) {
> - desc_info->data_rate = hw_rate->ht + idx;
> + desc_info->data_rate = hw_rate->ht + umin(idx, 31);
> } else {
> chan = rtw89_chan_get(rtwdev, tx_req->rtwvif_link->chanctx_idx);
> -
> - desc_info->data_rate = idx + (chan->band_type == RTW89_BAND_2G ?
> - RTW89_HW_RATE_CCK1 : RTW89_HW_RATE_OFDM6);
> + if (chan->band_type == RTW89_BAND_2G)
> + desc_info->data_rate = RTW89_HW_RATE_CCK1 +
> + umin(idx, 11);
> + else
> + desc_info->data_rate = RTW89_HW_RATE_OFDM6 +
> + umin(idx, 7);
> }
> }
>
[...]
> diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
> index 6d19e75..6c4d6c0 100644
> --- a/drivers/net/wireless/realtek/rtw89/pci.c
> +++ b/drivers/net/wireless/realtek/rtw89/pci.c
> @@ -475,7 +475,8 @@ static void rtw89_pci_tx_status(struct rtw89_dev *rtwdev,
> if (tx_status == RTW89_TX_DONE) {
> info->flags |= IEEE80211_TX_STAT_ACK;
> tx_ring->tx_acked++;
> - } else {
> + } else if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) ||
> + tx_status != RTW89_TX_RETRY_LIMIT) {
Will it be a problem without this change?
This branch is only to sum internal counters of the driver.
> if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)
> rtw89_debug(rtwdev, RTW89_DBG_FW,
> "failed to TX of status %x\n", tx_status);
> --
> 2.56.0.windows.4
next prev parent reply other threads:[~2026-11-16 3:00 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 23:52 [PATCH rtw-next v5 00/10] wifi: rtw89: monitor mode RX filter and raw frame injection fixes Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 01/10] wifi: rtw89: avoid NULL vif dereference in rtw89_ops_tx() Enver Ikromov
2026-11-15 3:23 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 02/10] wifi: rtw89: handle negative rate index for injected frames Enver Ikromov
2026-11-15 3:38 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 03/10] wifi: rtw89: fix RX filter configuration for monitor mode Enver Ikromov
2026-11-15 3:48 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-17 7:17 ` Ping-Ke Shih
2026-11-17 9:40 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 04/10] wifi: rtw89: protect pure_monitor_mode_vif with RCU Enver Ikromov
2026-11-15 4:00 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 05/10] wifi: rtw89: use AP self role for monitor interfaces Enver Ikromov
2026-11-15 4:08 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-17 0:41 ` Ping-Ke Shih
2026-11-17 9:40 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 06/10] wifi: rtw89: transmit frames from " Enver Ikromov
2026-11-16 1:35 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 07/10] wifi: rtw89: send injected control frames through the management path Enver Ikromov
2026-11-16 2:14 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 08/10] wifi: rtw89: skip host-side TX hooks for injected frames Enver Ikromov
2026-11-16 2:20 ` Ping-Ke Shih
2026-11-16 15:28 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 09/10] wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK " Enver Ikromov
2026-11-16 3:00 ` Ping-Ke Shih [this message]
2026-11-16 15:28 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 10/10] wifi: rtw89: restore channel when leaving idle on non-chanctx devices Enver Ikromov
2026-11-16 3:45 ` Ping-Ke Shih
2026-11-16 15:28 ` Enver Ikromov
2026-11-17 4:14 ` Zong-Zhe Yang
2026-11-17 9:40 ` Enver Ikromov
2026-11-16 7:56 ` Zong-Zhe Yang
2026-11-16 15:28 ` Enver Ikromov
2026-11-15 3:12 ` [PATCH rtw-next v5 00/10] wifi: rtw89: monitor mode RX filter and raw frame injection fixes Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
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=a56a85ff19dc4bd29cb3c81cb7e0c77a@realtek.com \
--to=pkshih@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=owner@ph4ntom-rev.uz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.