Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: "V. S." <spam@acio.nl>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH rtw-next v3] wifi: rtw89: set RA init rate level when the station RSSI is known
Date: Mon, 16 Nov 2026 00:41:29 +0000	[thread overview]
Message-ID: <a0448c760a5243a7b956b16e9d563183@realtek.com> (raw)
In-Reply-To: <CAJKtVVa6n++Uhy7z58d-Wbb3oGnTHz+bHt07_Akp7FPn6F2qYA@mail.gmail.com>

V. S. <spam@acio.nl> wrote:
> Ping-Ke Shih <pkshih@realtek.com> wrote:
> > How about memset(ra, 0, offsetof(typeof(*ra), rssi_unknown)) ?
> 
> Good idea. I did this for v4. Then the RA update does not need the
> local variable, and it clears the flag after it uses the flag.
> 
> > /* driver helpers (not clear by rtw89_phy_ra_sta_update()) */
> >
> > > + bool rssi_unknown:1;
> 
> One change from your proposal: rssi_unknown must be a plain bool, not
> a bit-field. offsetof() cannot be used on a bit-field. With
> "bool rssi_unknown:1;", gcc stops with the error "attempt to take
> address of bit-field structure member". I also wrote "not cleared"
> in the comment.
> 
> Also, with this memset the order of the fields is important for
> future changes. rssi_unknown is the boundary of the memset:
> - A new field for the H2C command must be above rssi_unknown. If it is
>   below, rtw89_phy_ra_sta_update() does not clear it, and the RA update
>   sends an old value.
> - A new driver helper must be below rssi_unknown. If it is above, the
>   memset clears it every 2 seconds.
> The comment marks this boundary. Tell me if you want a stronger
> comment, for example "keep driver helpers below this line".

The stronger comment is good to me.

I have another thought is to use struct_group() to have clear boundary, such as

struct rtw89_ra_info {
	...

	/* keep driver helpers below in group (not cleared by rtw89_phy_ra_sta_update()) */
	struct_group(helpers,
	             bool rssi_unknown;
	);
};

> 
> This is the v4 change:
> 
> --- a/drivers/net/wireless/realtek/rtw89/core.h
> +++ b/drivers/net/wireless/realtek/rtw89/core.h
> @@ struct rtw89_ra_info {
>   u8 macid_msb:2;
>   u8 band:2; /* enum rtw89_band */
>   u8 is_new_dbgreg:1;
> + /* driver helpers (not cleared by rtw89_phy_ra_sta_update()) */
> + bool rssi_unknown;
>  };
> 
> --- a/drivers/net/wireless/realtek/rtw89/phy.c
> +++ b/drivers/net/wireless/realtek/rtw89/phy.c
> @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
> - memset(ra, 0, sizeof(*ra));
> + memset(ra, 0, offsetof(typeof(*ra), rssi_unknown));
> @@ void rtw89_phy_ra_update_sta_link(struct rtw89_dev *rtwdev,
>   rcu_read_unlock();
> 
> + ra->init_rate_lv = rtw89_phy_ra_get_init_rate_lv(rtwsta_link);
> + if (ra->rssi_unknown && ra->init_rate_lv) {
> + ra->upd_all = 1;
> + ra->rssi_unknown = false;
> + }
>   if (changed & IEEE80211_RC_SUPP_RATES_CHANGED)
>   ra->upd_mask = 1;
> @@ void rtw89_phy_ra_assoc(struct rtw89_dev *rtwdev, struct
> rtw89_sta_link *rtwsta_link)
>   ra->init_rate_lv = rtw89_phy_ra_get_init_rate_lv(rtwsta_link);
> + ra->rssi_unknown = !ra->init_rate_lv;
>   ra->upd_all = 1;

I think the coming v4 will be good to me.

> 
> Only rtw89_phy_ra_assoc() and rtw89_phy_ra_update_sta_link() call
> rtw89_phy_ra_sta_update(). A new station starts with a zeroed
> rtw89_sta, and rtw89_phy_ra_assoc() sets the flag again for each
> association.
> 
> I tested this on RTL8912AU in AP mode. The client is at -56 to
> -59 dBm, and each connection sends TCP for 60 s. 8 of 8 connections
> use 80 MHz (VHT 1SS MCS 9 or 2SS MCS 5 to 7), 341 to 428 Mbit/s. PMF
> still works.
> 
> If this is OK for you, I will send v4 with "Suggested-by: Ping-Ke Shih".

With/without suggested-by are OK to me.



      reply	other threads:[~2026-11-16  0:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  8:07 [PATCH rtw-next v3] wifi: rtw89: set RA init rate level when the station RSSI is known Vincent Schurink
2026-11-13  8:24 ` Ping-Ke Shih
2026-11-13 15:34   ` V. S.
2026-11-15  3:05     ` Ping-Ke Shih
2026-11-15 11:59       ` V. S.
2026-11-16  0:41         ` Ping-Ke Shih [this message]

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=a0448c760a5243a7b956b16e9d563183@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