wifi: rtw89: mac: parse MRC C2H failure report
Ping-Ke Shih
maintainerPATCH v2 1/2 wifi: rtw89: mac: parse MRC C2H failure report
From: Zong-Zhe Yang <[email protected]>
MRC (multi-role concurrency) has a C2H event for status report. Newer FW will report some kinds of failures. We parse them now and show by debug log.
---
v2: no change
--- drivers/net/wireless/realtek/rtw89/mac.c | 40 ++++++++++++++++++++++++ drivers/net/wireless/realtek/rtw89/mac.h | 10 ++++++ 2 files changed, 50 insertions(+)
drivers/net/wireless/realtek/rtw89/mac.c +40 -0
@@ -5202,6 +5202,46 @@ rtw89_mac_c2h_mrc_status_rpt(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32case RTW89_MAC_MRC_DEL_SCH_OK : func =H2C_FUNC_DEL_MRC ;break ; +case RTW89_MAC_MRC_EMPTY_SCH_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: empty sch fail\n" ); +return ; +case RTW89_MAC_MRC_ROLE_NOT_EXIST_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: role not exist fail\n" ); +return ; +case RTW89_MAC_MRC_DATA_NOT_FOUND_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: data not found fail\n" ); +return ; +case RTW89_MAC_MRC_GET_NEXT_SLOT_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: get next slot fail\n" ); +return ; +case RTW89_MAC_MRC_ALT_ROLE_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: alt role fail\n" ); +return ; +case RTW89_MAC_MRC_ADD_PSTIMER_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: add ps timer fail\n" ); +return ; +case RTW89_MAC_MRC_MALLOC_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: malloc fail\n" ); +return ; +case RTW89_MAC_MRC_SWITCH_CH_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: switch ch fail\n" ); +return ; +case RTW89_MAC_MRC_TXNULL0_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: tx null-0 fail\n" ); +return ; +case RTW89_MAC_MRC_PORT_FUNC_EN_FAIL : +rtw89_debug (rtwdev,RTW89_DBG_CHAN , +"MRC C2H STS RPT: port func en fail\n" ); +return ;default :rtw89_debug (rtwdev,RTW89_DBG_CHAN ,"invalid MRC C2H STS RPT: status %d\n" , status);
drivers/net/wireless/realtek/rtw89/mac.h +10 -0
@@ -466,6 +466,16 @@ enum rtw89_mac_mrc_status {RTW89_MAC_MRC_START_SCH_OK =0 ,RTW89_MAC_MRC_STOP_SCH_OK =1 ,RTW89_MAC_MRC_DEL_SCH_OK =2 , +RTW89_MAC_MRC_EMPTY_SCH_FAIL =16 , +RTW89_MAC_MRC_ROLE_NOT_EXIST_FAIL =17 , +RTW89_MAC_MRC_DATA_NOT_FOUND_FAIL =18 , +RTW89_MAC_MRC_GET_NEXT_SLOT_FAIL =19 , +RTW89_MAC_MRC_ALT_ROLE_FAIL =20 , +RTW89_MAC_MRC_ADD_PSTIMER_FAIL =21 , +RTW89_MAC_MRC_MALLOC_FAIL =22 , +RTW89_MAC_MRC_SWITCH_CH_FAIL =23 , +RTW89_MAC_MRC_TXNULL0_FAIL =24 , + RTW89_MAC_MRC_PORT_FUNC_EN_FAIL = 25, }; struct rtw89_mac_ax_coex {
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 2/2 wifi: rtw89: unify the selection logic of RFK table when MCC
From: Zong-Zhe Yang <[email protected]>
Driver will notify FW the target index of RFK table to use at some moments. When MCC (multi-channel concurrent), the correctness of the notification is especially important.
We now unify the selection logic of RFK table as below among chips.
1. check each table if it matches target channel
2. check all tables if any is idle by iterating active channels
3. replace the first table if all are busy unexpectedly
---
v2: correct precedence of selection logic of RFK MCC table slots
- frist, search for exactly matched slot
- if not, search for an idle slot
- if not, force to use first slot
--- drivers/net/wireless/realtek/rtw89/chan.c | 22 ++++++ drivers/net/wireless/realtek/rtw89/chan.h | 4 ++ drivers/net/wireless/realtek/rtw89/core.h | 7 +- drivers/net/wireless/realtek/rtw89/phy.c | 69 +++++++++++++++++++ drivers/net/wireless/realtek/rtw89/phy.h | 16 +++++ .../net/wireless/realtek/rtw89/rtw8852c_rfk.c | 32 +++------ .../net/wireless/realtek/rtw89/rtw8922a_rfk.c | 17 ++++- 7 files changed, 141 insertions(+), 26 deletions(-)
drivers/net/wireless/realtek/rtw89/chan.c +22 -0
@@ -141,6 +141,28 @@ bool rtw89_assign_entity_chan(struct rtw89_dev *rtwdev,return band_changed; } +int rtw89_iterate_entity_chan (struct rtw89_dev *rtwdev, +int (*iterator)(const struct rtw89_chan *chan, +void *data), +void *data) +{ +struct rtw89_hal *hal = &rtwdev->hal; +const struct rtw89_chan *chan; +int ret; +u8 idx; + +lockdep_assert_held (&rtwdev->mutex); + +for_each_set_bit (idx, hal->entity_map,NUM_OF_RTW89_SUB_ENTITY ) { + chan =rtw89_chan_get (rtwdev, idx); + ret =iterator (chan, data); +if (ret) +return ret; + } + +return 0 ; +} + static void __rtw89_config_entity_chandef(struct rtw89_dev *rtwdev, enum rtw89_sub_entity_idx idx, const struct cfg80211_chan_def *chandef,
drivers/net/wireless/realtek/rtw89/chan.h +4 -0
@@ -78,6 +78,10 @@ void rtw89_chan_create(struct rtw89_chan *chan, u8 center_chan, u8 primary_chan,bool rtw89_assign_entity_chan (struct rtw89_dev *rtwdev,enum rtw89_sub_entity_idx idx,const struct rtw89_chan *new); +int rtw89_iterate_entity_chan (struct rtw89_dev *rtwdev, +int (*iterator)(const struct rtw89_chan *chan, +void *data), +void *data);void rtw89_config_entity_chandef (struct rtw89_dev *rtwdev,enum rtw89_sub_entity_idx idx,const struct cfg80211_chan_def *chandef);
drivers/net/wireless/realtek/rtw89/core.h +6 -1
@@ -4695,7 +4695,12 @@ struct rtw89_dack_info {bool msbk_timeout[RTW89_DACK_PATH_NR ]; }; -#define RTW89_RFK_CHS_NR 3 +enum rtw89_rfk_chs_nrs { + __RTW89_RFK_CHS_NR_V0 =2 , + __RTW89_RFK_CHS_NR_V1 =3 , + +RTW89_RFK_CHS_NR = __RTW89_RFK_CHS_NR_V1, +};struct rtw89_rfk_mcc_info {u8 ch[RTW89_RFK_CHS_NR ];
drivers/net/wireless/realtek/rtw89/phy.c +69 -0
81 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/phy.h +16 -0
@@ -715,6 +715,19 @@ enum rtw89_phy_gain_band_be rtw89_subband_to_gain_band_be(enum rtw89_subband sub } } +struct rtw89_rfk_chan_desc { +/* desc is valid iff ch is non-zero */ +u8 ch; + +/* To avoid us from extending old chip code every time, each new +* field must be defined along with a bool flag in positivte way. +*/ +bool has_band; +u8 band; +bool has_bw; +u8 bw; +}; +enum rtw89_rfk_flag {RTW89_RFK_F_WRF =0 ,RTW89_RFK_F_WM =1 ,
@@ -950,5 +963,8 @@ enum rtw89_rf_path_bit rtw89_phy_get_kpath(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);enum rtw89_rf_path rtw89_phy_get_syn_sel (struct rtw89_dev *rtwdev,enum rtw89_phy_idx phy_idx); +u8 rtw89_rfk_chan_lookup (struct rtw89_dev *rtwdev, +const struct rtw89_rfk_chan_desc *desc,u8 desc_nr, +const struct rtw89_chan *target_chan);#endif
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c +9 -23
@@ -4070,12 +4070,11 @@ void rtw8852c_set_channel_rf(struct rtw89_dev *rtwdev,void rtw8852c_mcc_get_ch_info (struct rtw89_dev *rtwdev,enum rtw89_phy_idx phy_idx) {struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc; - DECLARE_BITMAP(map, RTW89_IQK_CHS_NR) = {}; +struct rtw89_rfk_chan_desc desc[__RTW89_RFK_CHS_NR_V0] = {};const struct rtw89_chan *chan;enum rtw89_entity_mode mode;u8 chan_idx;u8 idx; -u8 i; mode =rtw89_get_entity_mode (rtwdev);switch (mode) {
@@ -4087,34 +4086,21 @@ void rtw8852c_mcc_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_ibreak ; } -for (i =0 ; i <= chan_idx; i++) { - chan =rtw89_chan_get (rtwdev, i); + chan =rtw89_chan_get (rtwdev, chan_idx); -for (idx =0 ; idx <RTW89_IQK_CHS_NR ; idx++) { -if (rfk_mcc->ch[idx] == chan->channel && - rfk_mcc->band[idx] == chan->band_type) { -if (i != chan_idx) { -set_bit (idx, map); -break ; - } +for (idx =0 ; idx <ARRAY_SIZE (desc); idx++) { +struct rtw89_rfk_chan_desc *p = &desc[idx]; - goto bottom; - } - } - } + p->ch = rfk_mcc->ch[idx]; - idx =find_first_zero_bit (map,RTW89_IQK_CHS_NR ); -if (idx ==RTW89_IQK_CHS_NR ) { -rtw89_debug (rtwdev,RTW89_DBG_RFK , -"%s: no empty rfk table; force replace the first\n" , - __func__); - idx =0 ; + p->has_band = true; + p->band = rfk_mcc->band[idx]; } + idx =rtw89_rfk_chan_lookup (rtwdev, desc,ARRAY_SIZE (desc), chan); + rfk_mcc->ch[idx] = chan->channel; rfk_mcc->band[idx] = chan->band_type; - -bottom: rfk_mcc->table_idx = idx; }
drivers/net/wireless/realtek/rtw89/rtw8922a_rfk.c +15 -2
@@ -255,6 +255,7 @@ static void rtw8922a_chlk_ktbl_sel(struct rtw89_dev *rtwdev, u8 kpath, u8 idx)static void rtw8922a_chlk_reload (struct rtw89_dev *rtwdev) {struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc; +struct rtw89_rfk_chan_desc desc[__RTW89_RFK_CHS_NR_V1] = {};enum rtw89_sub_entity_idx sub_entity_idx;const struct rtw89_chan *chan;enum rtw89_entity_mode mode;
@@ -265,16 +266,28 @@ static void rtw8922a_chlk_reload(struct rtw89_dev *rtwdev)switch (mode) {case RTW89_ENTITY_MODE_MCC_PREPARE : sub_entity_idx =RTW89_SUB_ENTITY_1 ; - tbl_sel =1 ;break ;default : sub_entity_idx =RTW89_SUB_ENTITY_0 ; - tbl_sel =0 ;break ; } chan =rtw89_chan_get (rtwdev, sub_entity_idx); +for (tbl_sel =0 ; tbl_sel <ARRAY_SIZE (desc); tbl_sel++) { +struct rtw89_rfk_chan_desc *p = &desc[tbl_sel]; + + p->ch = rfk_mcc->ch[tbl_sel]; + + p->has_band = true; + p->band = rfk_mcc->band[tbl_sel]; + + p->has_bw = true; + p->bw = rfk_mcc->bw[tbl_sel]; + } + + tbl_sel =rtw89_rfk_chan_lookup (rtwdev, desc,ARRAY_SIZE (desc), chan); + rfk_mcc->ch[tbl_sel] = chan->channel; rfk_mcc->band[tbl_sel] = chan->band_type; rfk_mcc->bw[tbl_sel] = chan->band_width;
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerQuoted 8 lines · Ping-Ke Shih
From: Zong-Zhe Yang <[email protected]>
MRC (multi-role concurrency) has a C2H event for status report. Newer FW will report some kinds of failures. We parse them now and show by debug log.
Signed-off-by Zong-Zhe Yang <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
2 patch(es) applied to rtw-next branch of rtw.git, thanks.
1e71be6a3446 wifi: rtw89: mac: parse MRC C2H failure report 8095364696d3 wifi: rtw89: unify the selection logic of RFK table when MCC