All of lore.kernel.org
 help / color / mirror / Atom feed
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 02/10] wifi: rtw89: handle negative rate index for injected frames
Date: Sun, 15 Nov 2026 03:38:45 +0000	[thread overview]
Message-ID: <5360bf7242ef43c995f09d161486a330@realtek.com> (raw)
In-Reply-To: <20261113235211.1911-3-owner@ph4ntom-rev.uz>

Enver Ikromov <owner@ph4ntom-rev.uz> wrote:
> When the radiotap header of an injected frame carries no rate,
> info->control.rates[0].idx is -1.

> rtw89_core_tx_update_injection()
> stores the index in a u8, so the value becomes 0xff and is added to
> the CCK1/OFDM6 base, programming an invalid hardware rate into the TX
> descriptor.

I don't prefer to describe function name in commit message. Just
describe the problem you encountered and how to fix it.

For this patch, you want to handle the rate idx < 0 case, and solution
is set rate to 1M and 6M for 2GHz band and others respectively, right?

I guess LLM help to generate this. Code flow is not important to
commit message. The patch should explain the flow itself.

> 
> Use a signed index. If it is negative, keep the rate already selected
> by rtw89_core_tx_update_mgmt_info() for management frames, and fall
> back to data_retry_lowest_rate (or OFDM6 when
> IEEE80211_TX_CTL_NO_CCK_RATE is set) for data frames.
> 
> Fixes: e96abe4fd7cd ("wifi: rtw89: consider data rate/bandwidth/GI for injected packets")
> Cc: stable@vger.kernel.org
> Signed-off-by: Enver Ikromov <owner@ph4ntom-rev.uz>
> ---
>  drivers/net/wireless/realtek/rtw89/core.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> index b7df97e..527593e 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.c
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -1239,12 +1239,25 @@ static void rtw89_core_tx_update_injection(struct rtw89_dev *rtwdev,
>         enum mac80211_rate_control_flags flags = info->control.rates[0].flags;
>         struct rtw89_tx_desc_info *desc_info = &tx_req->desc_info;
>         const struct rtw89_chan *chan;
> -       u8 idx = info->control.rates[0].idx;
> +       s8 idx = info->control.rates[0].idx;
>         u8 nss, mcs;
> 
>         desc_info->use_rate = true;
>         desc_info->dis_data_fb = true;
> 
> +       /* No rate was given in the radiotap header. Management frames
> +        * already carry the rate from rtw89_core_tx_update_mgmt_info(), so
> +        * only data frames need a fallback.
> +        */
> +       if (idx < 0) {
> +               if (tx_req->tx_type == RTW89_CORE_TX_TYPE_DATA)
> +                       desc_info->data_rate =
> +                               info->flags & IEEE80211_TX_CTL_NO_CCK_RATE ?
> +                               RTW89_HW_RATE_OFDM6 :
> +                               desc_info->data_retry_lowest_rate;
> +               return;
> +       }
> +

How about just set idx = 0 if idx < 0? The existing code can select valid rate,
since any rate is well for the case idx < 0.

>         if (flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
>                 desc_info->data_bw = 3;
>         else if (flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
> --
> 2.56.0.windows.4
> 


  reply	other threads:[~2026-11-15  3:38 UTC|newest]

Thread overview: 14+ 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-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 [this message]
2026-11-13 23:52 ` [PATCH rtw-next v5 03/10] wifi: rtw89: fix RX filter configuration for monitor mode 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-13 23:52 ` [PATCH rtw-next v5 05/10] wifi: rtw89: use AP self role for monitor interfaces Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 06/10] wifi: rtw89: transmit frames from " 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-13 23:52 ` [PATCH rtw-next v5 08/10] wifi: rtw89: skip host-side TX hooks for injected frames 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-13 23:52 ` [PATCH rtw-next v5 10/10] wifi: rtw89: restore channel when leaving idle on non-chanctx devices 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

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=5360bf7242ef43c995f09d161486a330@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.