Commit 9de7829a authored by Zong-Zhe Yang's avatar Zong-Zhe Yang Committed by Kalle Valo

wifi: rtw89: fw: implement MRC H2C command functions

Implement MRC (multiple role concurrent) H2C commands. Mainly deal with
H2C format, LE type built from CPU value, default setting on some fields,
and then sending the command to FW. Besides, MRC start, MRC delete, and
MRC request TSF need to wait for a report from C2H events.
Signed-off-by: default avatarZong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240213073514.23796-4-pkshih@realtek.com
parent b8e59e55
This diff is collapsed.
...@@ -3397,6 +3397,45 @@ enum rtw89_h2c_mrc_role_types { ...@@ -3397,6 +3397,45 @@ enum rtw89_h2c_mrc_role_types {
RTW89_H2C_MRC_ROLE_EMPTY = 2, RTW89_H2C_MRC_ROLE_EMPTY = 2,
}; };
#define RTW89_MAC_MRC_MAX_ADD_SLOT_NUM 3
#define RTW89_MAC_MRC_MAX_ADD_ROLE_NUM_PER_SLOT 1 /* before MLO */
struct rtw89_fw_mrc_add_slot_arg {
u16 duration; /* unit: TU */
bool courtesy_en;
u8 courtesy_period;
u8 courtesy_target; /* slot idx */
unsigned int role_num;
struct {
enum rtw89_h2c_mrc_role_types role_type;
bool is_master;
bool en_tx_null;
enum rtw89_band band;
enum rtw89_bandwidth bw;
u8 macid;
u8 central_ch;
u8 primary_ch;
u8 null_early; /* unit: TU */
/* if MLD, for macid: [0, chip::support_mld_num)
* otherwise, for macid: [0, 32)
*/
u32 macid_main_bitmap;
/* for MLD, bit X maps to macid: X + chip::support_mld_num */
u32 macid_paired_bitmap;
} roles[RTW89_MAC_MRC_MAX_ADD_ROLE_NUM_PER_SLOT];
};
struct rtw89_fw_mrc_add_arg {
u8 sch_idx;
enum rtw89_h2c_mrc_sch_types sch_type;
bool btc_in_sch;
unsigned int slot_num;
struct rtw89_fw_mrc_add_slot_arg slots[RTW89_MAC_MRC_MAX_ADD_SLOT_NUM];
};
struct rtw89_h2c_mrc_add_role { struct rtw89_h2c_mrc_add_role {
__le32 w0; __le32 w0;
__le32 w1; __le32 w1;
...@@ -3453,6 +3492,13 @@ enum rtw89_h2c_mrc_start_actions { ...@@ -3453,6 +3492,13 @@ enum rtw89_h2c_mrc_start_actions {
RTW89_H2C_MRC_START_ACTION_REPLACE_OLD = 1, RTW89_H2C_MRC_START_ACTION_REPLACE_OLD = 1,
}; };
struct rtw89_fw_mrc_start_arg {
u8 sch_idx;
u8 old_sch_idx;
u64 start_tsf;
enum rtw89_h2c_mrc_start_actions action;
};
struct rtw89_h2c_mrc_start { struct rtw89_h2c_mrc_start {
__le32 w0; __le32 w0;
__le32 start_tsf_low; __le32 start_tsf_low;
...@@ -3476,6 +3522,14 @@ struct rtw89_h2c_mrc_del { ...@@ -3476,6 +3522,14 @@ struct rtw89_h2c_mrc_del {
#define RTW89_MAC_MRC_MAX_REQ_TSF_NUM 2 #define RTW89_MAC_MRC_MAX_REQ_TSF_NUM 2
struct rtw89_fw_mrc_req_tsf_arg {
unsigned int num;
struct {
u8 band;
u8 port;
} infos[RTW89_MAC_MRC_MAX_REQ_TSF_NUM];
};
struct rtw89_h2c_mrc_req_tsf { struct rtw89_h2c_mrc_req_tsf {
u8 req_tsf_num; u8 req_tsf_num;
u8 infos[] __counted_by(req_tsf_num); u8 infos[] __counted_by(req_tsf_num);
...@@ -3489,6 +3543,13 @@ enum rtw89_h2c_mrc_upd_bitmap_actions { ...@@ -3489,6 +3543,13 @@ enum rtw89_h2c_mrc_upd_bitmap_actions {
RTW89_H2C_MRC_UPD_BITMAP_ACTION_ADD = 1, RTW89_H2C_MRC_UPD_BITMAP_ACTION_ADD = 1,
}; };
struct rtw89_fw_mrc_upd_bitmap_arg {
u8 sch_idx;
u8 macid;
u8 client_macid;
enum rtw89_h2c_mrc_upd_bitmap_actions action;
};
struct rtw89_h2c_mrc_upd_bitmap { struct rtw89_h2c_mrc_upd_bitmap {
__le32 w0; __le32 w0;
__le32 w1; __le32 w1;
...@@ -3499,6 +3560,14 @@ struct rtw89_h2c_mrc_upd_bitmap { ...@@ -3499,6 +3560,14 @@ struct rtw89_h2c_mrc_upd_bitmap {
#define RTW89_H2C_MRC_UPD_BITMAP_W0_MACID GENMASK(31, 16) #define RTW89_H2C_MRC_UPD_BITMAP_W0_MACID GENMASK(31, 16)
#define RTW89_H2C_MRC_UPD_BITMAP_W1_CLIENT_MACID GENMASK(15, 0) #define RTW89_H2C_MRC_UPD_BITMAP_W1_CLIENT_MACID GENMASK(15, 0)
struct rtw89_fw_mrc_sync_arg {
u8 offset; /* unit: TU */
struct {
u8 band;
u8 port;
} src, dest;
};
struct rtw89_h2c_mrc_sync { struct rtw89_h2c_mrc_sync {
__le32 w0; __le32 w0;
__le32 w1; __le32 w1;
...@@ -3511,6 +3580,17 @@ struct rtw89_h2c_mrc_sync { ...@@ -3511,6 +3580,17 @@ struct rtw89_h2c_mrc_sync {
#define RTW89_H2C_MRC_SYNC_W0_DEST_BAND GENMASK(23, 20) #define RTW89_H2C_MRC_SYNC_W0_DEST_BAND GENMASK(23, 20)
#define RTW89_H2C_MRC_SYNC_W1_OFFSET GENMASK(15, 0) #define RTW89_H2C_MRC_SYNC_W1_OFFSET GENMASK(15, 0)
struct rtw89_fw_mrc_upd_duration_arg {
u8 sch_idx;
u64 start_tsf;
unsigned int slot_num;
struct {
u8 slot_idx;
u16 duration; /* unit: TU */
} slots[RTW89_MAC_MRC_MAX_ADD_SLOT_NUM];
};
struct rtw89_h2c_mrc_upd_duration { struct rtw89_h2c_mrc_upd_duration {
__le32 w0; __le32 w0;
__le32 start_tsf_low; __le32 start_tsf_low;
...@@ -4565,6 +4645,20 @@ int rtw89_fw_h2c_mcc_sync(struct rtw89_dev *rtwdev, u8 group, u8 source, ...@@ -4565,6 +4645,20 @@ int rtw89_fw_h2c_mcc_sync(struct rtw89_dev *rtwdev, u8 group, u8 source,
u8 target, u8 offset); u8 target, u8 offset);
int rtw89_fw_h2c_mcc_set_duration(struct rtw89_dev *rtwdev, int rtw89_fw_h2c_mcc_set_duration(struct rtw89_dev *rtwdev,
const struct rtw89_fw_mcc_duration *p); const struct rtw89_fw_mcc_duration *p);
int rtw89_fw_h2c_mrc_add(struct rtw89_dev *rtwdev,
const struct rtw89_fw_mrc_add_arg *arg);
int rtw89_fw_h2c_mrc_start(struct rtw89_dev *rtwdev,
const struct rtw89_fw_mrc_start_arg *arg);
int rtw89_fw_h2c_mrc_del(struct rtw89_dev *rtwdev, u8 sch_idx);
int rtw89_fw_h2c_mrc_req_tsf(struct rtw89_dev *rtwdev,
const struct rtw89_fw_mrc_req_tsf_arg *arg,
struct rtw89_mac_mrc_tsf_rpt *rpt);
int rtw89_fw_h2c_mrc_upd_bitmap(struct rtw89_dev *rtwdev,
const struct rtw89_fw_mrc_upd_bitmap_arg *arg);
int rtw89_fw_h2c_mrc_sync(struct rtw89_dev *rtwdev,
const struct rtw89_fw_mrc_sync_arg *arg);
int rtw89_fw_h2c_mrc_upd_duration(struct rtw89_dev *rtwdev,
const struct rtw89_fw_mrc_upd_duration_arg *arg);
static inline void rtw89_fw_h2c_init_ba_cam(struct rtw89_dev *rtwdev) static inline void rtw89_fw_h2c_init_ba_cam(struct rtw89_dev *rtwdev)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment