Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: "niko3x@proton.me" <niko3x@proton.me>,
	Jes Sorensen <Jes.Sorensen@gmail.com>
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 2/3] wifi: rtl8xxxu: honour the retry count of injected frames on gen1 chips
Date: Sun, 22 Nov 2026 02:00:23 +0000	[thread overview]
Message-ID: <323a762f8e0846c6b958c77672aeca75@realtek.com> (raw)
In-Reply-To: <20261120-b4-inject-v1-2-1e1693af0c6b@proton.me>

Ahmet Zeren via B4 Relay <devnull+niko3x.proton.me@kernel.org> wrote:

[...]

>  drivers/net/wireless/realtek/rtl8xxxu/core.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> index 969875fd54..b159d9b64c 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> @@ -5245,6 +5245,24 @@ static bool rtl8xxxu_tx_rate_inject(struct ieee80211_tx_info *tx_info,
>         return true;
>  }
> 
> +/*
> + * Retry limit of an injected frame: none if no ACK is expected, else the
> + * radiotap retry count. -1 leaves it to the hardware.
> + */
> +static int rtl8xxxu_tx_retry_inject(struct ieee80211_tx_info *tx_info)
> +{
> +       if (!(tx_info->flags & IEEE80211_TX_CTL_INJECTED))
> +               return -1;
> +
> +       if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
> +               return 0;
> +
> +       if (tx_info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
> +               return tx_info->control.rates[0].count - 1;
> +
> +       return -1;
> +}
> +
>  /*
>   * Fill in v1 (gen1) specific TX descriptor bits.
>   * This format is used on 8188cu/8192cu/8723au
> @@ -5262,9 +5280,11 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>         u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
>         u32 rate = 0;
>         u16 seq_number;
> +       int retries;
>         bool inject;
> 
>         inject = rtl8xxxu_tx_rate_inject(tx_info, &rate, &sgi);
> +       retries = rtl8xxxu_tx_retry_inject(tx_info);
> 
>         if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX)
>                 dev_info(dev, "%s: TX rate: %d, pkt size %u\n",
> @@ -5314,6 +5334,12 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>                 tx_desc->txdw4 |= cpu_to_le32(TXDESC32_USE_DRIVER_RATE |
>                                               TXDESC_DISABLE_DATA_FB);
> 
> +       if (retries >= 0) {
> +               tx_desc->txdw5 &= ~cpu_to_le32(TXDESC32_RETRY_LIMIT_MASK);

Can we squash this with ieee80211_is_mgmt(hdr->frame_control) case?
Then we don't need to clear the bits again.

> +               tx_desc->txdw5 |= cpu_to_le32(retries << TXDESC32_RETRY_LIMIT_SHIFT |
> +                                             TXDESC32_RETRY_LIMIT_ENABLE);

le32_encode_bits(retries, TXDESC32_RETRY_LIMIT_ENABLE) ?

> +       }
> +
>         /*
>          * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled
>          */
> @@ -7979,6 +8005,8 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
>         SET_IEEE80211_PERM_ADDR(hw, priv->mac_addr);
> 
>         hw->extra_tx_headroom = priv->fops->tx_desc_size;
> +       /* The TX descriptor retry limit is 6 bits wide */
> +       hw->max_rate_tries = 64;

define a TXDESC32_RETRY_LIMIT_MAX along TXDESC32_RETRY_LIMIT_ENABLE.
We don't need the comment, and it is clear that 64 is because
TXDESC32_RETRY_LIMIT_ENABLE is 6 bits wide.

>         ieee80211_hw_set(hw, SIGNAL_DBM);
> 
>         /*
> 
> --
> 2.56.1
> 


  reply	other threads:[~2026-11-22  2:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 22:09 [PATCH rtw-next 0/3] wifi: rtl8xxxu: honour rate, retries and bandwidth of injected frames Ahmet Zeren via B4 Relay
2026-11-19 22:09 ` [PATCH rtw-next 1/3] wifi: rtl8xxxu: honour the rate of injected frames on gen1 chips Ahmet Zeren via B4 Relay
2026-11-22  1:51   ` Ping-Ke Shih
2026-11-19 22:09 ` [PATCH rtw-next 2/3] wifi: rtl8xxxu: honour the retry count " Ahmet Zeren via B4 Relay
2026-11-22  2:00   ` Ping-Ke Shih [this message]
2026-11-19 22:09 ` [PATCH rtw-next 3/3] wifi: rtl8xxxu: honour the bandwidth " Ahmet Zeren via B4 Relay
2026-11-22  2:05   ` 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=323a762f8e0846c6b958c77672aeca75@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=niko3x@proton.me \
    /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