rtw89: read RX bandwidth from v1 type RX descriptor
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 18 Mar 2022 02:32:14 +0000 (10:32 +0800)
committerKalle Valo <kvalo@kernel.org>
Wed, 6 Apr 2022 07:48:16 +0000 (10:48 +0300)
8852C uses different fields to represent RX bandwidth. Since other fields
are the same, I check chip_id to get bandwidth instead of creating another
v1 function.

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

index 245d851..d923e4a 100644 (file)
@@ -1492,6 +1492,7 @@ void rtw89_core_query_rxdesc(struct rtw89_dev *rtwdev,
                             struct rtw89_rx_desc_info *desc_info,
                             u8 *data, u32 data_offset)
 {
+       const struct rtw89_chip_info *chip = rtwdev->chip;
        struct rtw89_rxdesc_short *rxd_s;
        struct rtw89_rxdesc_long *rxd_l;
        u8 shift_len, drv_info_len;
@@ -1502,7 +1503,10 @@ void rtw89_core_query_rxdesc(struct rtw89_dev *rtwdev,
        desc_info->long_rxdesc = RTW89_GET_RXWD_LONG_RXD(rxd_s);
        desc_info->pkt_type = RTW89_GET_RXWD_RPKT_TYPE(rxd_s);
        desc_info->mac_info_valid = RTW89_GET_RXWD_MAC_INFO_VALID(rxd_s);
-       desc_info->bw = RTW89_GET_RXWD_BW(rxd_s);
+       if (chip->chip_id == RTL8852C)
+               desc_info->bw = RTW89_GET_RXWD_BW_V1(rxd_s);
+       else
+               desc_info->bw = RTW89_GET_RXWD_BW(rxd_s);
        desc_info->data_rate = RTW89_GET_RXWD_DATA_RATE(rxd_s);
        desc_info->gi_ltf = RTW89_GET_RXWD_GI_LTF(rxd_s);
        desc_info->user_id = RTW89_GET_RXWD_USER_ID(rxd_s);
index 1250e26..b889e7b 100644 (file)
        le32_get_bits((rxdesc)->dword0, GENMASK(13, 0))
 #define RTW89_GET_RXWD_BW(rxdesc) \
        le32_get_bits((rxdesc)->dword1, GENMASK(31, 30))
+#define RTW89_GET_RXWD_BW_V1(rxdesc) \
+       le32_get_bits((rxdesc)->dword1, GENMASK(31, 29))
 #define RTW89_GET_RXWD_GI_LTF(rxdesc) \
        le32_get_bits((rxdesc)->dword1, GENMASK(27, 25))
 #define RTW89_GET_RXWD_DATA_RATE(rxdesc) \