Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: acio <spam@acio.nl>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH rtw-next] wifi: rtw89: do RA association again when the station RSSI is known
Date: Wed, 11 Nov 2026 03:22:40 +0000	[thread overview]
Message-ID: <d1d88bf5d1ef461dbb55988f906892b5@realtek.com> (raw)
In-Reply-To: <20261108131723.206533-1-spam@acio.nl>

acio <spam@acio.nl> wrote:
> From: Vincent Schurink <spam@acio.nl>
> 
> When a station associates to an AP, the AP does not know the RSSI of
> the station yet. Thus, rtw89_phy_ra_assoc() sends init_rate_lv 0 to the
> firmware. With this value, the firmware RA of RTL8922A uses 20 MHz and
> VHT-MCS 2 for the station. The firmware RA does not try a higher rate,
> also when the PER is 0. On an 80 MHz AP, the TCP throughput to the
> station stays at approximately 35 Mbit/s.
> 
> Set a flag when the RSSI is not known at the RA association. When the
> RSSI is known, the periodic RA update does the RA association again.
> 
> Tested on RTL8912AU (RTL8922A, USB) in AP mode with hostapd 2.10 and
> VHT 80 MHz. The client is an Intel Meteor Lake CNVi (iwlwifi) at
> -45 dBm.
> Before: TX rate VHT-MCS 2 at 20 MHz, TCP 35 Mbit/s.
> After: TX rate VHT-MCS 7 to 9 at 80 MHz, TCP 186 to 320 Mbit/s.
> 
> Signed-off-by: Vincent Schurink <spam@acio.nl>
> ---
>  drivers/net/wireless/realtek/rtw89/core.h |  1 +
>  drivers/net/wireless/realtek/rtw89/phy.c  | 14 ++++++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
> index 0d893b992a4..ca5f2aced33 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.h
> +++ b/drivers/net/wireless/realtek/rtw89/core.h
> @@ -4711,6 +4711,7 @@ struct rtw89_sta_link {
>         struct rtw89_vif_link *rtwvif_link;
>         struct rtw89_ra_info ra;
>         struct rtw89_ra_report ra_report;
> +       bool ra_rssi_unknown;
>         int max_agg_wait;
>         u8 prev_rssi;
>         struct ewma_rssi avg_rssi;
> diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
> index 795920b899d..96660b781a5 100644
> --- a/drivers/net/wireless/realtek/rtw89/phy.c
> +++ b/drivers/net/wireless/realtek/rtw89/phy.c
> @@ -717,6 +717,19 @@ void rtw89_phy_rate_pattern_vif(struct rtw89_dev *rtwdev,
>  static void rtw89_phy_ra_update_sta_iter(void *data, struct ieee80211_sta *sta)
>  {
>         struct rtw89_dev *rtwdev = (struct rtw89_dev *)data;
> +       struct rtw89_sta *rtwsta = sta_to_rtwsta(sta);
> +       struct rtw89_sta_link *rtwsta_link;
> +       unsigned int link_id;
> +       u8 rssi;
> +
> +       rtw89_sta_for_each_link(rtwsta, rtwsta_link, link_id) {
> +               if (!rtwsta_link->ra_rssi_unknown)
> +                       continue;
> +
> +               rssi = ewma_rssi_read(&rtwsta_link->avg_rssi) >> RSSI_FACTOR;
> +               if (rssi > 1)
> +                       rtw89_phy_ra_assoc(rtwdev, rtwsta_link);

Can we move rssi logic to an individual function and call it to update
ra->init_rate_lv?

	if (rssi > 40)
		ra->init_rate_lv = 1;
	else if (rssi > 20)
		ra->init_rate_lv = 2;
	else if (rssi > 1)
		ra->init_rate_lv = 3;
	else
		ra->init_rate_lv = 0;

The rtw89_phy_ra_update_sta() will call rtw89_fw_h2c_ra() to send H2C command.


> +       }
> 
>         rtw89_phy_ra_update_sta(rtwdev, sta, IEEE80211_RC_SUPP_RATES_CHANGED);
>  }
> @@ -755,6 +768,7 @@ void rtw89_phy_ra_assoc(struct rtw89_dev *rtwdev, struct rtw89_sta_link *rtwsta_
>                 ra->init_rate_lv = 3;
>         else
>                 ra->init_rate_lv = 0;
> +       rtwsta_link->ra_rssi_unknown = rssi <= 1;
>         ra->upd_all = 1;
>         rtw89_debug(rtwdev, RTW89_DBG_RA,
>                     "ra assoc: macid = %d, mode = %d, bw = %d, nss = %d, lv = %d",
> --
> 2.53.0


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 13:17 [PATCH rtw-next] wifi: rtw89: do RA association again when the station RSSI is known acio
2026-11-11  3:22 ` Ping-Ke Shih [this message]
2026-11-12  7:58   ` V. S.

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=d1d88bf5d1ef461dbb55988f906892b5@realtek.com \
    --to=pkshih@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=spam@acio.nl \
    /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