From: Ho Jie Feng <hjf3108@gmail.com>
To: linux-wireless@vger.kernel.org, Stanislaw Gruszka <stf_xl@wp.pl>
Cc: Ho Jie Feng <hjf3108@gmail.com>
Subject: [PATCH wireless-next v2 3/7] wifi: rt2800: make MCS 16 fall back to MCS 8 on devices with 3 TX chains
Date: Sun, 1 Nov 2026 00:51:10 +0800 [thread overview]
Message-ID: <20261031165117.2868671-4-hjf3108@gmail.com> (raw)
In-Reply-To: <20261031165117.2868671-1-hjf3108@gmail.com>
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;
} 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
next prev parent reply other threads:[~2026-10-31 16:51 UTC|newest]
Thread overview: 9+ 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-10-31 16:51 ` [PATCH wireless-next v2 2/7] wifi: rt2800: calibrate the crystal of RT3593 with the beacons Ho Jie Feng
2026-10-31 16:51 ` Ho Jie Feng [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-10-31 16:51 ` [PATCH wireless-next v2 5/7] wifi: rt2800: support A-MSDU in A-MPDU Ho Jie Feng
2026-10-31 16:51 ` [PATCH wireless-next v2 6/7] wifi: rt2800usb: enable RX bulk aggregation Ho Jie Feng
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-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=20261031165117.2868671-4-hjf3108@gmail.com \
--to=hjf3108@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=stf_xl@wp.pl \
/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