]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: phy: define PHY status IE length for generations
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 6 May 2026 13:09:50 +0000 (21:09 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Wed, 13 May 2026 03:32:54 +0000 (11:32 +0800)
Both RTL8922A and RTL8922D are WiFi 7 chips, but their IE length of PHY
status are different. Define them accordingly.

Generation 0: WiFi 6 chips
Generation 1: WiFi 7 RTL8922A
Generation 2: WiFi 7 RTL8922D

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260506131000.1706298-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/phy.c
drivers/net/wireless/realtek/rtw89/phy.h
drivers/net/wireless/realtek/rtw89/phy_be.c

index d6bf1d57e8e122a0b1e0f151b87b0af8167e6958..caedb2bd21d5daab7dd11c83298ecbc624793406 100644 (file)
@@ -2040,29 +2040,14 @@ static void rtw89_core_rx_process_phy_ppdu_iter(void *data,
        }
 }
 
-#define VAR_LEN 0xff
-#define VAR_LEN_UNIT 8
 static u16 rtw89_core_get_phy_status_ie_len(struct rtw89_dev *rtwdev,
                                            const struct rtw89_phy_sts_iehdr *iehdr)
 {
-       static const u8 physts_ie_len_tabs[RTW89_CHIP_GEN_NUM][32] = {
-               [RTW89_CHIP_AX] = {
-                       16, 32, 24, 24, 8, 8, 8, 8, VAR_LEN, 8, VAR_LEN, 176, VAR_LEN,
-                       VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, 16, 24, VAR_LEN,
-                       VAR_LEN, VAR_LEN, 0, 24, 24, 24, 24, 32, 32, 32, 32
-               },
-               [RTW89_CHIP_BE] = {
-                       32, 40, 24, 24, 8, 8, 8, 8, VAR_LEN, 8, VAR_LEN, 176, VAR_LEN,
-                       VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, 88, 56, VAR_LEN,
-                       VAR_LEN, VAR_LEN, 0, 24, 24, 24, 24, 32, 32, 32, 32
-               },
-       };
-       const u8 *physts_ie_len_tab;
+       const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
+       const u8 *physts_ie_len_tab = phy->physt_ie_len;
        u16 ie_len;
        u8 ie;
 
-       physts_ie_len_tab = physts_ie_len_tabs[rtwdev->chip->chip_gen];
-
        ie = le32_get_bits(iehdr->w0, RTW89_PHY_STS_IEHDR_TYPE);
        if (physts_ie_len_tab[ie] != VAR_LEN)
                ie_len = physts_ie_len_tab[ie];
index f98a77f9fc1a0fa2238f077058294885b3cf7a02..4f82b1a9fa4c63e62d271e7cbec02006b3e94fb2 100644 (file)
@@ -8948,6 +8948,10 @@ const struct rtw89_phy_gen_def rtw89_phy_gen_ax = {
        .cr_base = 0x10000,
        .physt_bmp_start = R_PHY_STS_BITMAP_ADDR_START,
        .physt_bmp_eht = 0xfc,
+       .physt_ie_len = {16, 32, 24, 24, 8, 8, 8, 8, VAR_LEN, 8, VAR_LEN, 176, VAR_LEN,
+                        VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, 16, 24, VAR_LEN,
+                        VAR_LEN, VAR_LEN, 0, 24, 24, 24, 24, 32, 32, 32, 32},
+       .physt_gen = 0,
        .ccx = &rtw89_ccx_regs_ax,
        .physts = &rtw89_physts_regs_ax,
        .cfo = &rtw89_cfo_regs_ax,
index a6e685654037dec479d7e6b19da46c2d16a4c233..d8038ae5ca86977e2553b78dd18ef681ea0cae82 100644 (file)
 #define EDCCA_UNIT_CONVER 128
 #define EDCCA_PWROFST_DEFAULT 18
 
+#define VAR_LEN 0xff
+#define VAR_LEN_UNIT 8
+
 enum rtw89_phy_c2h_ra_func {
        RTW89_PHY_C2H_FUNC_STS_RPT,
        RTW89_PHY_C2H_FUNC_MU_GPTBL_RPT,
@@ -573,6 +576,8 @@ struct rtw89_phy_gen_def {
        u32 cr_base;
        u32 physt_bmp_start;
        u32 physt_bmp_eht;
+       u8 physt_ie_len[32];
+       u8 physt_gen;
        const struct rtw89_ccx_regs *ccx;
        const struct rtw89_physts_regs *physts;
        const struct rtw89_cfo_regs *cfo;
index 5cd298a2c91b9afa83f4b9a4c15b104ca8fdf989..23137f2dbd4bd87dbc75566413d3507ad415ac80 100644 (file)
@@ -1561,6 +1561,10 @@ const struct rtw89_phy_gen_def rtw89_phy_gen_be = {
        .cr_base = 0x20000,
        .physt_bmp_start = R_PHY_STS_BITMAP_ADDR_START,
        .physt_bmp_eht = R_PHY_STS_BITMAP_EHT,
+       .physt_ie_len = {32, 40, 24, 24, 8, 8, 8, 8, VAR_LEN, 8, VAR_LEN, 176, VAR_LEN,
+                        VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, 88, 56, VAR_LEN,
+                        VAR_LEN, VAR_LEN, 0, 24, 24, 24, 24, 32, 32, 32, 32},
+       .physt_gen = 1,
        .ccx = &rtw89_ccx_regs_be,
        .physts = &rtw89_physts_regs_be,
        .cfo = &rtw89_cfo_regs_be,
@@ -1582,6 +1586,10 @@ const struct rtw89_phy_gen_def rtw89_phy_gen_be_v1 = {
        .cr_base = 0x0,
        .physt_bmp_start = R_PHY_STS_BITMAP_ADDR_START_BE4,
        .physt_bmp_eht = R_PHY_STS_BITMAP_EHT_BE4,
+       .physt_ie_len = {32, 40, 24, 24, 16, 16, 16, 16, VAR_LEN, VAR_LEN, VAR_LEN, 168,
+                        VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, VAR_LEN, 32, 56,
+                        96, VAR_LEN, VAR_LEN, 0, 24, 24, 24, 24, 32, 32, 32, 32},
+       .physt_gen = 2,
        .ccx = &rtw89_ccx_regs_be_v1,
        .physts = &rtw89_physts_regs_be_v1,
        .cfo = &rtw89_cfo_regs_be_v1,