From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <dian_syuan0116@realtek.com>, <echuang@realtek.com>,
<phhuang@realtek.com>, <kevin_yang@realtek.com>
Subject: [PATCH rtw-next 09/15] wifi: rtw89: 8922d: add extra data to PS H2C
Date: Wed, 9 Sep 2026 14:59:58 +0800 [thread overview]
Message-ID: <20260909070004.35353-10-pkshih@realtek.com> (raw)
In-Reply-To: <20260909070004.35353-1-pkshih@realtek.com>
From: Eric Huang <echuang@realtek.com>
Append 2GHz regulatory mode and per-link BSS color to LPS
multi-link H2C to assist firmware backup and restore the
settings.
Signed-off-by: Eric Huang <echuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/core.h | 1 +
drivers/net/wireless/realtek/rtw89/fw.c | 44 +++++++++++++++++++++--
drivers/net/wireless/realtek/rtw89/fw.h | 17 +++++++++
3 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index d725124b39bf..e88942c469e4 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -6023,6 +6023,7 @@ enum rtw89_fw_feature {
RTW89_FW_FEATURE_SER_L1_BY_EVENT,
RTW89_FW_FEATURE_SIM_SER_L0L1_BY_HALT_H2C,
RTW89_FW_FEATURE_LPS_ML_INFO_V1,
+ RTW89_FW_FEATURE_LPS_ML_INFO_V1_EXTRA,
RTW89_FW_FEATURE_SER_POST_RECOVER_DMAC,
RTW89_FW_FEATURE_TX_HISTORY_V1,
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index dcbdf4b5e4b2..300686ed0f6e 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -983,6 +983,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 109, 1, SCAN_OFFLOAD_BE_V1),
__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 113, 0, RFK_TXIQK_V0),
__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 113, 2, SCAN_OFFLOAD_BE_V2),
+ __CFG_FW_FEAT(RTL8922D, ge, 0, 35, 119, 0, LPS_ML_INFO_V1_EXTRA),
};
static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,
@@ -3486,26 +3487,59 @@ void rtw89_bb_lps_cmn_info_rx_gain_fill(struct rtw89_dev *rtwdev,
}
}
+static void
+rtw89_fw_h2c_lps_ml_cmn_info_v1_extra_fill(struct rtw89_dev *rtwdev,
+ struct rtw89_vif *rtwvif,
+ struct rtw89_h2c_lps_ml_cmn_info_v1_extra *h2c)
+{
+ u8 regd = rtw89_regd_get(rtwdev, RTW89_BAND_2G);
+ struct ieee80211_bss_conf *bss_conf;
+ struct rtw89_vif_link *rtwvif_link;
+ unsigned int link_id;
+
+ static_assert(sizeof(*h2c) % 4 == 0);
+
+ h2c->regu_mode_on_24g = regd == RTW89_FCC ? RTW89_BB_REGULATION_FCC :
+ RTW89_BB_REGULATION_CE;
+
+ rtw89_vif_for_each_link(rtwvif, rtwvif_link, link_id) {
+ u8 phy_idx = rtwvif_link->phy_idx;
+
+ rcu_read_lock();
+ bss_conf = rtw89_vif_rcu_dereference_link(rtwvif_link, true);
+ h2c->bss_color[phy_idx] = bss_conf->he_bss_color.color;
+ rcu_read_unlock();
+ }
+}
+
int rtw89_fw_h2c_lps_ml_cmn_info_v1(struct rtw89_dev *rtwdev,
struct rtw89_vif *rtwvif)
{
static const u8 bcn_bw_ofst[] = {0, 0, 0, 3, 6, 9, 0, 12};
+ struct rtw89_h2c_lps_ml_cmn_info_v1_extra *h2c_extra;
const struct rtw89_chip_info *chip = rtwdev->chip;
struct rtw89_efuse *efuse = &rtwdev->efuse;
struct rtw89_h2c_lps_ml_cmn_info_v1 *h2c;
struct rtw89_vif_link *rtwvif_link;
const struct rtw89_chan *chan;
struct rtw89_bb_ctx *bb;
- u32 len = sizeof(*h2c);
unsigned int link_id;
struct sk_buff *skb;
u8 beacon_bw_ofst;
+ bool has_extra;
u32 done;
+ u32 len;
int ret;
if (chip->chip_gen != RTW89_CHIP_BE)
return 0;
+ has_extra = RTW89_CHK_FW_FEATURE(LPS_ML_INFO_V1_EXTRA, &rtwdev->fw);
+ if (has_extra)
+ len = sizeof(*h2c_extra);
+ else
+ len = sizeof(*h2c);
+
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
if (!skb) {
rtw89_err(rtwdev, "failed to alloc skb for h2c lps_ml_cmn_info_v1\n");
@@ -3514,7 +3548,13 @@ int rtw89_fw_h2c_lps_ml_cmn_info_v1(struct rtw89_dev *rtwdev,
skb_put(skb, len);
h2c = (struct rtw89_h2c_lps_ml_cmn_info_v1 *)skb->data;
- h2c->fmt_id = 0x20;
+ if (has_extra) {
+ h2c_extra = container_of(h2c, typeof(*h2c_extra), v1);
+ h2c->fmt_id = RTW89_H2C_LPS_ML_CMN_INFO_FMT_ID_V1_EXTRA;
+ rtw89_fw_h2c_lps_ml_cmn_info_v1_extra_fill(rtwdev, rtwvif, h2c_extra);
+ } else {
+ h2c->fmt_id = RTW89_H2C_LPS_ML_CMN_INFO_FMT_ID_V1;
+ }
h2c->mlo_dbcc_mode = cpu_to_le32(rtwdev->mlo_dbcc_mode);
h2c->rfe_type = efuse->rfe_type;
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
index 6cb1f6dfb650..d1bd82788376 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.h
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
@@ -2091,6 +2091,16 @@ struct rtw89_bb_link_info_rx_gain {
u8 wb_g_elna[RTW89_BB_PS_LINK_RX_GAIN_TAB_MAX][BB_GT2_G_ELNA_NUM];
} __packed;
+enum rtw89_bb_regulation_mode {
+ RTW89_BB_REGULATION_FCC = 0,
+ RTW89_BB_REGULATION_CE = 1,
+};
+
+enum rtw89_h2c_lps_ml_cmn_info_fmt_id {
+ RTW89_H2C_LPS_ML_CMN_INFO_FMT_ID_V1 = 0x20,
+ RTW89_H2C_LPS_ML_CMN_INFO_FMT_ID_V1_EXTRA = 0x21,
+};
+
struct rtw89_h2c_lps_ml_cmn_info_v1 {
u8 fmt_id;
u8 rfe_type;
@@ -2106,6 +2116,13 @@ struct rtw89_h2c_lps_ml_cmn_info_v1 {
struct rtw89_bb_link_info_rx_gain rx_gain[RTW89_BB_PS_LINK_BUF_MAX];
} __packed;
+struct rtw89_h2c_lps_ml_cmn_info_v1_extra {
+ struct rtw89_h2c_lps_ml_cmn_info_v1 v1;
+ u8 regu_mode_on_24g;
+ u8 bss_color[RTW89_BB_PS_LINK_BUF_MAX];
+ u8 rsvd[2];
+} __packed;
+
struct rtw89_h2c_phy_rfe_type {
u8 rfe_type;
u8 rsvd[3];
--
2.25.1
next prev parent reply other threads:[~2026-09-09 7:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 6:59 [PATCH rtw-next 00/15] wifi: rtw89: correct MLO behavior, fix Coverity issues, and update hardware settings Ping-Ke Shih
2026-09-09 6:59 ` [PATCH rtw-next 01/15] wifi: rtw89: consider sta maximum AMSDU subframes number to decide TX work waiting Ping-Ke Shih
2026-09-09 6:59 ` [PATCH rtw-next 02/15] wifi: rtw89: mlo: update link id to FW upon connection Ping-Ke Shih
2026-09-09 6:59 ` [PATCH rtw-next 03/15] Revert "wifi: rtw89: fix unable to receive probe responses under MLO connection" Ping-Ke Shih
2026-09-09 6:59 ` [PATCH rtw-next 04/15] wifi: rtw89: modify active scan rule for 6GHz band Ping-Ke Shih
2026-09-09 6:59 ` [PATCH rtw-next 05/15] wifi: rtw89: fix ctrl_sco_cck for Wi-Fi 7 Ping-Ke Shih
2026-09-09 6:59 ` [PATCH rtw-next 06/15] wifi: rtw89: 8852a: prevent potential OOB in ctrl_sco_cck Ping-Ke Shih
2026-09-09 6:59 ` [PATCH rtw-next 07/15] wifi: rtw89: fw: cmd_ofld_flush always reset counter Ping-Ke Shih
2026-09-09 6:59 ` [PATCH rtw-next 08/15] wifi: rtw89: explicitly declare TX queue flags by DECLARE_BITMAP() Ping-Ke Shih
2026-09-09 6:59 ` Ping-Ke Shih [this message]
2026-09-09 6:59 ` [PATCH rtw-next 10/15] wifi: rtw89: mac: change beamformee CSI direct forward to CMAC_TXDMA Ping-Ke Shih
2026-09-09 7:00 ` [PATCH rtw-next 11/15] wifi: rtw89: fw: extend ch_info format of hw_scan to v2 Ping-Ke Shih
2026-09-09 7:00 ` [PATCH rtw-next 12/15] wifi: rtw89: 8922d: update BA cam format to G7 Ping-Ke Shih
2026-09-09 7:00 ` [PATCH rtw-next 13/15] wifi: rtw89: 8851b: rfk: set DCK start and delay time Ping-Ke Shih
2026-09-09 7:00 ` [PATCH rtw-next 14/15] wifi: rtw89: 8852b: update default value for ANA SWR Ping-Ke Shih
2026-09-09 7:00 ` [PATCH rtw-next 15/15] wifi: rtw89: phy: correct PHY-1 EDCCA report register access 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=20260909070004.35353-10-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=dian_syuan0116@realtek.com \
--cc=echuang@realtek.com \
--cc=kevin_yang@realtek.com \
--cc=linux-wireless@vger.kernel.org \
--cc=phhuang@realtek.com \
/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