]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: extend PHY status parser to support WiFi 7 chips
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 27 Oct 2023 01:50:59 +0000 (09:50 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 30 Oct 2023 17:25:31 +0000 (19:25 +0200)
PHY status IEs is used to have more information about received packets,
such as RSSI and EVM. For each PHY IE type, it has different predefined
PHY IE length, and the length are changed, so add them for WiFi 7 chips
accordingly.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231027015059.10032-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c

index bc30be774037892c1ec52a37d2621bae0a96728f..c689fc2b2d49e8e31acb852ef59a3dd9a1e6cd08 100644 (file)
@@ -1513,14 +1513,24 @@ static void rtw89_core_rx_process_phy_ppdu_iter(void *data,
 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_tab[32] = {
-               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
+       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, 16, 24, VAR_LEN,
+                       VAR_LEN, VAR_LEN, 0, 24, 24, 24, 24, 32, 32, 32, 32
+               },
        };
+       const u8 *physts_ie_len_tab;
        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];
@@ -1607,6 +1617,9 @@ static int rtw89_core_rx_process_phy_ppdu(struct rtw89_dev *rtwdev,
 
        len_from_header = le32_get_bits(hdr->w0, RTW89_PHY_STS_HDR_W0_LEN) << 3;
 
+       if (rtwdev->chip->chip_gen == RTW89_CHIP_BE)
+               len_from_header += PHY_STS_HDR_LEN;
+
        if (len_from_header != phy_ppdu->len) {
                rtw89_debug(rtwdev, RTW89_DBG_UNEXP, "phy ppdu len mismatch\n");
                return -EINVAL;