wifi: rtw89: 8922a: Add new fields for scan offload H2C command

Update scan offload H2C format to fit firmware version 35.21.
The new fields indicate lengths of variable length members, so
when driver and firmware are using mismatch version, FW could
handle the parsing better.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240731070506.46100-3-pkshih@realtek.com
This commit is contained in:
Po-Hao Huang 2024-07-31 15:05:03 +08:00 committed by Ping-Ke Shih
parent ca33c15a93
commit 6ca6b918f2
4 changed files with 28 additions and 6 deletions

View File

@ -4367,6 +4367,7 @@ enum rtw89_fw_feature {
RTW89_FW_FEATURE_NO_LPS_PG, RTW89_FW_FEATURE_NO_LPS_PG,
RTW89_FW_FEATURE_BEACON_FILTER, RTW89_FW_FEATURE_BEACON_FILTER,
RTW89_FW_FEATURE_MACID_PAUSE_SLEEP, RTW89_FW_FEATURE_MACID_PAUSE_SLEEP,
RTW89_FW_FEATURE_SCAN_OFFLOAD_BE_V0,
RTW89_FW_FEATURE_WOW_REASON_V1, RTW89_FW_FEATURE_WOW_REASON_V1,
RTW89_FW_FEATURE_RFK_PRE_NOTIFY_V0, RTW89_FW_FEATURE_RFK_PRE_NOTIFY_V0,
}; };

View File

@ -683,6 +683,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
__CFG_FW_FEAT(RTL8922A, ge, 0, 34, 30, 0, CRASH_TRIGGER), __CFG_FW_FEAT(RTL8922A, ge, 0, 34, 30, 0, CRASH_TRIGGER),
__CFG_FW_FEAT(RTL8922A, ge, 0, 34, 11, 0, MACID_PAUSE_SLEEP), __CFG_FW_FEAT(RTL8922A, ge, 0, 34, 11, 0, MACID_PAUSE_SLEEP),
__CFG_FW_FEAT(RTL8922A, ge, 0, 34, 35, 0, SCAN_OFFLOAD), __CFG_FW_FEAT(RTL8922A, ge, 0, 34, 35, 0, SCAN_OFFLOAD),
__CFG_FW_FEAT(RTL8922A, lt, 0, 35, 21, 0, SCAN_OFFLOAD_BE_V0),
__CFG_FW_FEAT(RTL8922A, ge, 0, 35, 12, 0, BEACON_FILTER), __CFG_FW_FEAT(RTL8922A, ge, 0, 35, 12, 0, BEACON_FILTER),
__CFG_FW_FEAT(RTL8922A, ge, 0, 35, 22, 0, WOW_REASON_V1), __CFG_FW_FEAT(RTL8922A, ge, 0, 35, 22, 0, WOW_REASON_V1),
__CFG_FW_FEAT(RTL8922A, lt, 0, 35, 31, 0, RFK_PRE_NOTIFY_V0), __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 31, 0, RFK_PRE_NOTIFY_V0),
@ -4907,6 +4908,7 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
u8 macc_role_size = sizeof(*macc_role) * option->num_macc_role; u8 macc_role_size = sizeof(*macc_role) * option->num_macc_role;
u8 opch_size = sizeof(*opch) * option->num_opch; u8 opch_size = sizeof(*opch) * option->num_opch;
u8 probe_id[NUM_NL80211_BANDS]; u8 probe_id[NUM_NL80211_BANDS];
u8 cfg_len = sizeof(*h2c);
unsigned int cond; unsigned int cond;
void *ptr; void *ptr;
int ret; int ret;
@ -4915,7 +4917,7 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
rtw89_scan_get_6g_disabled_chan(rtwdev, option); rtw89_scan_get_6g_disabled_chan(rtwdev, option);
len = sizeof(*h2c) + macc_role_size + opch_size; len = cfg_len + macc_role_size + opch_size;
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len); skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
if (!skb) { if (!skb) {
rtw89_err(rtwdev, "failed to alloc skb for h2c scan offload\n"); rtw89_err(rtwdev, "failed to alloc skb for h2c scan offload\n");
@ -4980,10 +4982,24 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
le32_encode_bits(RTW89_HW_RATE_OFDM6, le32_encode_bits(RTW89_HW_RATE_OFDM6,
RTW89_H2C_SCANOFLD_BE_W8_PROBE_RATE_6GHZ); RTW89_H2C_SCANOFLD_BE_W8_PROBE_RATE_6GHZ);
} }
ptr += sizeof(*h2c);
if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V0, &rtwdev->fw)) {
cfg_len = offsetofend(typeof(*h2c), w8);
goto flex_member;
}
h2c->w9 = le32_encode_bits(sizeof(*h2c) / sizeof(h2c->w0),
RTW89_H2C_SCANOFLD_BE_W9_SIZE_CFG) |
le32_encode_bits(sizeof(*macc_role) / sizeof(macc_role->w0),
RTW89_H2C_SCANOFLD_BE_W9_SIZE_MACC) |
le32_encode_bits(sizeof(*opch) / sizeof(opch->w0),
RTW89_H2C_SCANOFLD_BE_W9_SIZE_OP);
flex_member:
ptr += cfg_len;
for (i = 0; i < option->num_macc_role; i++) { for (i = 0; i < option->num_macc_role; i++) {
macc_role = (struct rtw89_h2c_scanofld_be_macc_role *)&h2c->role[i]; macc_role = ptr;
macc_role->w0 = macc_role->w0 =
le32_encode_bits(0, RTW89_H2C_SCANOFLD_BE_MACC_ROLE_W0_BAND) | le32_encode_bits(0, RTW89_H2C_SCANOFLD_BE_MACC_ROLE_W0_BAND) |
le32_encode_bits(0, RTW89_H2C_SCANOFLD_BE_MACC_ROLE_W0_PORT) | le32_encode_bits(0, RTW89_H2C_SCANOFLD_BE_MACC_ROLE_W0_PORT) |

View File

@ -2711,7 +2711,9 @@ struct rtw89_h2c_scanofld_be {
__le32 w6; __le32 w6;
__le32 w7; __le32 w7;
__le32 w8; __le32 w8;
struct rtw89_h2c_scanofld_be_macc_role role[]; __le32 w9; /* Added after SCAN_OFFLOAD_BE_V1 */
/* struct rtw89_h2c_scanofld_be_macc_role (flexible number) */
/* struct rtw89_h2c_scanofld_be_opch (flexible number) */
} __packed; } __packed;
#define RTW89_H2C_SCANOFLD_BE_W0_OP GENMASK(1, 0) #define RTW89_H2C_SCANOFLD_BE_W0_OP GENMASK(1, 0)
@ -2742,6 +2744,9 @@ struct rtw89_h2c_scanofld_be {
#define RTW89_H2C_SCANOFLD_BE_W8_PROBE_RATE_2GHZ GENMASK(7, 0) #define RTW89_H2C_SCANOFLD_BE_W8_PROBE_RATE_2GHZ GENMASK(7, 0)
#define RTW89_H2C_SCANOFLD_BE_W8_PROBE_RATE_5GHZ GENMASK(15, 8) #define RTW89_H2C_SCANOFLD_BE_W8_PROBE_RATE_5GHZ GENMASK(15, 8)
#define RTW89_H2C_SCANOFLD_BE_W8_PROBE_RATE_6GHZ GENMASK(23, 16) #define RTW89_H2C_SCANOFLD_BE_W8_PROBE_RATE_6GHZ GENMASK(23, 16)
#define RTW89_H2C_SCANOFLD_BE_W9_SIZE_CFG GENMASK(7, 0)
#define RTW89_H2C_SCANOFLD_BE_W9_SIZE_MACC GENMASK(15, 8)
#define RTW89_H2C_SCANOFLD_BE_W9_SIZE_OP GENMASK(23, 16)
static inline void RTW89_SET_FWCMD_P2P_MACID(void *cmd, u32 val) static inline void RTW89_SET_FWCMD_P2P_MACID(void *cmd, u32 val)
{ {

View File

@ -13,10 +13,10 @@
#include "rtw8922a_rfk.h" #include "rtw8922a_rfk.h"
#include "util.h" #include "util.h"
#define RTW8922A_FW_FORMAT_MAX 0 #define RTW8922A_FW_FORMAT_MAX 1
#define RTW8922A_FW_BASENAME "rtw89/rtw8922a_fw" #define RTW8922A_FW_BASENAME "rtw89/rtw8922a_fw"
#define RTW8922A_MODULE_FIRMWARE \ #define RTW8922A_MODULE_FIRMWARE \
RTW8922A_FW_BASENAME ".bin" RTW8922A_FW_BASENAME "-" __stringify(RTW8922A_FW_FORMAT_MAX) ".bin"
#define HE_N_USER_MAX_8922A 4 #define HE_N_USER_MAX_8922A 4