Linux wireless drivers development
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stf_xl@wp.pl>
To: Ho Jie Feng <hjf3108@gmail.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH wireless-next v2 3/7] wifi: rt2800: make MCS 16 fall back to MCS 8 on devices with 3 TX chains
Date: Thu, 5 Nov 2026 08:54:15 +0100	[thread overview]
Message-ID: <20261105075415.GC64923@wp.pl> (raw)
In-Reply-To: <20261031165117.2868671-4-hjf3108@gmail.com>

On Sun, Nov 01, 2026 at 12:51:10AM +0800, Ho Jie Feng wrote:
> MCS 15 has worse reliability than MCS 16, since 16 and above
> are 3 stream rates, and 15 is the top of the 2 stream rates.
> Falling back from MCS 16 to MCS 15 does not make sense, so
> make the fallback to MCS 8 on all devices with 3 TX chains,
> like the Ralink driver does.
> 
> The retry chain is now MCS 16 to MCS 8, skipping 7 MCS rates
> in between. Reflect that in the retry calculation code. This
> also fixes the retry count on RT3883, which already used this
> fallback.
> 
> Test results:
>    before after
> TX 28.2   29.1
> RX 70.4   70.2
> 
> Signed-off-by: Ho Jie Feng <hjf3108@gmail.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 10 +++++++++-
>  drivers/net/wireless/ralink/rt2x00/rt2x00.h    |  5 +++++
>  drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 14 ++++++++++++--
>  3 files changed, 26 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> index e7b6edf485099..5e1ee016624c6 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> @@ -1116,6 +1116,14 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi,
>  		 */
>  		__set_bit(TXDONE_SUCCESS, &txdesc.flags);
>  		txdesc.retry = ((mcs > real_mcs) ? mcs - real_mcs : 0);
> +
> +		/*
> +		 * On devices with 3 TX chains MCS16 falls back to MCS8, so a
> +		 * frame that was sent below MCS16 after a three stream rate
> +		 * skipped MCS9 to MCS15.
> +		 */
> +		if (rt2x00_is_3t(rt2x00dev) && mcs >= 16 && real_mcs < 16)
> +			txdesc.retry -= 7;
I would prefer to change condition to: real_mcs <= 8 
It would be visible that we can not overflow txdesc.retry by subtraction.

Otherwise the patch looks good to me.

Regards
Stanislaw
>  	} else {
>  		/*
>  		 * Transmission failed. The number of retries is
> @@ -6303,7 +6311,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
>  	reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
>  	rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
>  
> -	if (rt2x00_rt(rt2x00dev, RT3883)) {
> +	if (rt2x00_is_3t(rt2x00dev)) {
>  		rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_0, 0x12111008);
>  		rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413);
>  	}
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> index a80508db32d9c..f82dda0266f9b 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> @@ -1193,6 +1193,11 @@ static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev)
>  	return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
>  }
>  
> +static inline bool rt2x00_is_3t(struct rt2x00_dev *rt2x00dev)
> +{
> +	return rt2x00dev->default_ant.tx_chain_num == 3;
> +}
> +
>  /* Helpers for capability flags */
>  
>  static inline bool
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
> index 4d94b7062f440..db33c1215de97 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
> @@ -329,10 +329,10 @@ static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
>  	 * lowest rate was used.
>  	 */
>  	for (i = 0; i < retry_rates && i < IEEE80211_TX_MAX_RATES; i++) {
> -		tx_info->status.rates[i].idx = rate_idx - i;
> +		tx_info->status.rates[i].idx = rate_idx;
>  		tx_info->status.rates[i].flags = rate_flags;
>  
> -		if (rate_idx - i == 0) {
> +		if (rate_idx == 0) {
>  			/*
>  			 * The lowest rate (index 0) was used until the
>  			 * number of max retries was reached.
> @@ -340,8 +340,18 @@ static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
>  			tx_info->status.rates[i].count = retry_rates - i;
>  			i++;
>  			break;
> +		} else if (rate_idx == 16) {
> +			/*
> +			 * TX_FBK_CFG_3S_0 makes MCS16 fall back to MCS8 on
> +			 * devices with 3 TX chains, the decrement below shifts
> +			 * it back to 8.
> +			 */
> +			if (rt2x00_is_3t(rt2x00dev) &&
> +			    (rate_flags & IEEE80211_TX_RC_MCS))
> +				rate_idx = 9;
>  		}
>  		tx_info->status.rates[i].count = 1;
> +		rate_idx--;
>  	}
>  	if (i < (IEEE80211_TX_MAX_RATES - 1))
>  		tx_info->status.rates[i].idx = -1; /* terminate */
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-11-05  7:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31 16:51 [PATCH wireless-next v2 0/7] wifi: rt2x00: improve the throughput of rt2800usb Ho Jie Feng
2026-10-31 16:51 ` [PATCH wireless-next v2 1/7] wifi: rt2x00: start the link tuner when an interface is added Ho Jie Feng
2026-11-05  7:41   ` Stanislaw Gruszka
2026-10-31 16:51 ` [PATCH wireless-next v2 2/7] wifi: rt2800: calibrate the crystal of RT3593 with the beacons Ho Jie Feng
2026-11-05  7:50   ` Stanislaw Gruszka
2026-10-31 16:51 ` [PATCH wireless-next v2 3/7] wifi: rt2800: make MCS 16 fall back to MCS 8 on devices with 3 TX chains Ho Jie Feng
2026-11-05  7:54   ` Stanislaw Gruszka [this message]
2026-10-31 16:51 ` [PATCH wireless-next v2 4/7] wifi: rt2800: don't report an A-MPDU length to minstrel_ht Ho Jie Feng
2026-11-05  7:54   ` Stanislaw Gruszka
2026-10-31 16:51 ` [PATCH wireless-next v2 5/7] wifi: rt2800: support A-MSDU in A-MPDU Ho Jie Feng
2026-11-05  7:55   ` Stanislaw Gruszka
2026-10-31 16:51 ` [PATCH wireless-next v2 6/7] wifi: rt2800usb: enable RX bulk aggregation Ho Jie Feng
2026-11-05  8:10   ` Stanislaw Gruszka
2026-10-31 16:51 ` [PATCH wireless-next v2 7/7] wifi: rt2x00usb: use a threaded NAPI with GRO for RX Ho Jie Feng
2026-11-05  8:20   ` Stanislaw Gruszka
2026-10-31 16:55 ` [PATCH wireless-next v2 0/7] wifi: rt2x00: improve the throughput of rt2800usb Jie Feng

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=20261105075415.GC64923@wp.pl \
    --to=stf_xl@wp.pl \
    --cc=hjf3108@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    /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