wifi: rtw89: 8851b: enable firmware features of hw_scan and crash_trigger
Ping-Ke Shih
maintainercover wifi: rtw89: 8851b: enable firmware features of hw_scan and crash_trigger
After verification, we can enable hw_scan and crash_trigger simulation by this patchset. During verification of crash_trigger simulation (patch 4/4), we find that driver doesn't configure TX power properly in certain situation, so refine debugfs entry by patch 2/4 and correct TX power by patch 3/4.
Po-Hao Huang (1):
wifi: rtw89: 8851b: enable hw_scan support
Zong-Zhe Yang (3):
wifi: rtw89: debug: txpwr table access only valid page according to
chip
wifi: rtw89: set TX power without precondition during setting channel
wifi: rtw89: 8851b: configure CRASH_TRIGGER feature for 8851B
drivers/net/wireless/realtek/rtw89/core.c | 5 ++--- drivers/net/wireless/realtek/rtw89/debug.c | 13 ++++++++++++- drivers/net/wireless/realtek/rtw89/fw.c | 2 ++ drivers/net/wireless/realtek/rtw89/fw.h | 2 +- drivers/net/wireless/realtek/rtw89/reg.h | 6 ++++++ 5 files changed, 23 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 1/4 wifi: rtw89: 8851b: enable hw_scan support
From: Po-Hao Huang <[email protected]>
This enables hw_scan for 8851b after firmware version 0.29.37.1. Extend the channel info struct with padding zeros so newer firmware can work properly, this change is backward compatible with older firmware.
--- drivers/net/wireless/realtek/rtw89/fw.c | 1 + drivers/net/wireless/realtek/rtw89/fw.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/fw.c +1 -0
@@ -257,6 +257,7 @@ struct __fw_feat_cfg {static const struct __fw_feat_cfg fw_feat_tbl[] = {__CFG_FW_FEAT (RTL8851B , ge,0 ,29 ,37 ,1 ,TX_WAKE ), +__CFG_FW_FEAT (RTL8851B , ge,0 ,29 ,37 ,1 ,SCAN_OFFLOAD ),__CFG_FW_FEAT (RTL8852A , le,0 ,13 ,29 ,0 ,OLD_HT_RA_FORMAT ),__CFG_FW_FEAT (RTL8852A , ge,0 ,13 ,35 ,0 ,SCAN_OFFLOAD ),__CFG_FW_FEAT (RTL8852A , ge,0 ,13 ,35 ,0 ,TX_WAKE ),
drivers/net/wireless/realtek/rtw89/fw.h +1 -1
@@ -243,7 +243,7 @@ struct rtw89_fw_macid_pause_grp {#define RTW89_SCANOFLD_MAX_IE_LEN 512#define RTW89_SCANOFLD_PKT_NONE 0xFF#define RTW89_SCANOFLD_DEBUG_MASK 0x1F -#define RTW89_MAC_CHINFO_SIZE 24 +#define RTW89_MAC_CHINFO_SIZE 28#define RTW89_SCAN_LIST_GUARD 4#define RTW89_SCAN_LIST_LIMIT \ ((RTW89_H2C_MAX_SIZE / RTW89_MAC_CHINFO_SIZE) - RTW89_SCAN_LIST_GUARD)
Signature · 1 line
2.25.1
Re: [PATCH 1/4] wifi: rtw89: 8851b: enable hw_scan support
Quoted 9 lines · Ping-Ke Shih
From: Po-Hao Huang <[email protected]>
This enables
hw_scanfor 8851b after firmware version 0.29.37.1. Extend the channel info struct with padding zeros so newer firmware can work properly, this change is backward compatible with older firmware.Signed-off-by Po-Hao Huang <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
4 patches applied to wireless-next.git, thanks.
9c52e8bf07c7 wifi: rtw89: 8851b: enable hw_scan supportb25e755e5e41 wifi: rtw89: debug: txpwr table access only valid page according to chip db67b03b04b4 wifi: rtw89: set TX power without precondition during setting channel 57369e2aa2eb wifi: rtw89: 8851b: configure CRASH_TRIGGER feature for 8851B
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Ping-Ke Shih
maintainerPATCH 2/4 wifi: rtw89: debug: txpwr table access only valid page according to chip
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
We now support RTL8851B which has only single RF path. For chip with single RF path, TX power page is valid only in single path section. So, we refine debugfs txpwr table to access TX power page according to RF path number of runtime chip. It can prevent us from reading beyond valid sections.
--- drivers/net/wireless/realtek/rtw89/debug.c | 13 ++++++++++++- drivers/net/wireless/realtek/rtw89/reg.h | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/debug.c +12 -1
@@ -376,6 +376,7 @@ struct txpwr_map {u8 size;u32 addr_from;u32 addr_to; +u32 addr_to_1ss; };#define __GEN_TXPWR_ENT2 (_t, _e0, _e1) \
@@ -413,6 +414,7 @@ static const struct txpwr_map __txpwr_map_byr = { .size = ARRAY_SIZE(__txpwr_ent_byr), .addr_from = R_AX_PWR_BY_RATE, .addr_to = R_AX_PWR_BY_RATE_MAX, + .addr_to_1ss = R_AX_PWR_BY_RATE_1SS_MAX, };static const struct txpwr_ent __txpwr_ent_lmt[] = {
@@ -468,6 +470,7 @@ static const struct txpwr_map __txpwr_map_lmt = { .size = ARRAY_SIZE(__txpwr_ent_lmt), .addr_from = R_AX_PWR_LMT, .addr_to = R_AX_PWR_LMT_MAX, + .addr_to_1ss = R_AX_PWR_LMT_1SS_MAX, };static const struct txpwr_ent __txpwr_ent_lmt_ru[] = {
@@ -495,6 +498,7 @@ static const struct txpwr_map __txpwr_map_lmt_ru = { .size = ARRAY_SIZE(__txpwr_ent_lmt_ru), .addr_from = R_AX_PWR_RU_LMT, .addr_to = R_AX_PWR_RU_LMT_MAX, + .addr_to_1ss = R_AX_PWR_RU_LMT_1SS_MAX, }; static u8 __print_txpwr_ent(struct seq_file *m, const struct txpwr_ent *ent,
@@ -527,6 +531,8 @@ static int __print_txpwr_map(struct seq_file *m, struct rtw89_dev *rtwdev, const struct txpwr_map *map) {u8 fct = rtwdev->chip->txpwr_factor_mac; +u8 path_num = rtwdev->chip->rf_path_num; +u32 max_valid_addr;u32 val, addr;s8 *buf, tmp;u8 cur, i;
@@ -536,7 +542,12 @@ static int __print_txpwr_map(struct seq_file *m, struct rtw89_dev *rtwdev,if (!buf)return -ENOMEM ; -for (addr = map->addr_from; addr <= map->addr_to; addr +=4 ) { +if (path_num ==1 ) + max_valid_addr = map->addr_to_1ss; +else + max_valid_addr = map->addr_to; + +for (addr = map->addr_from; addr <= max_valid_addr; addr +=4 ) { ret =rtw89_mac_txpwr_read32 (rtwdev,RTW89_PHY_0 , addr, &val);if (ret) val =MASKDWORD ;
drivers/net/wireless/realtek/rtw89/reg.h +6 -0
@@ -3342,16 +3342,22 @@#define B_AX_PWR_UL_TB_2T_MASK GENMASK(4, 0)#define B_AX_PWR_UL_TB_2T_V1_MASK GENMASK(7, 0)#define R_AX_PWR_BY_RATE_TABLE0 0xD2C0 +#define R_AX_PWR_BY_RATE_TABLE6 0xD2D8#define R_AX_PWR_BY_RATE_TABLE10 0xD2E8#define R_AX_PWR_BY_RATE R_AX_PWR_BY_RATE_TABLE0 +#define R_AX_PWR_BY_RATE_1SS_MAX R_AX_PWR_BY_RATE_TABLE6#define R_AX_PWR_BY_RATE_MAX R_AX_PWR_BY_RATE_TABLE10#define R_AX_PWR_LMT_TABLE0 0xD2EC +#define R_AX_PWR_LMT_TABLE9 0xD310#define R_AX_PWR_LMT_TABLE19 0xD338#define R_AX_PWR_LMT R_AX_PWR_LMT_TABLE0 +#define R_AX_PWR_LMT_1SS_MAX R_AX_PWR_LMT_TABLE9#define R_AX_PWR_LMT_MAX R_AX_PWR_LMT_TABLE19#define R_AX_PWR_RU_LMT_TABLE0 0xD33C +#define R_AX_PWR_RU_LMT_TABLE5 0xD350#define R_AX_PWR_RU_LMT_TABLE11 0xD368#define R_AX_PWR_RU_LMT R_AX_PWR_RU_LMT_TABLE0 +#define R_AX_PWR_RU_LMT_1SS_MAX R_AX_PWR_RU_LMT_TABLE5#define R_AX_PWR_RU_LMT_MAX R_AX_PWR_RU_LMT_TABLE11#define R_AX_PWR_MACID_LMT_TABLE0 0xD36C#define R_AX_PWR_MACID_LMT_TABLE127 0xD568
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 3/4 wifi: rtw89: set TX power without precondition during setting channel
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
The key condition to check in wrapper of setting TX power is whether entity is active or not. Before entity is active, we restrict TX power from being set by outside callers, e.g. SAR/regulatory.
We mark entity as inactive when powering off MAC. Then, we will mark it as active when we initialize HW channel stuffs after MAC power on. Although we can get an active entity after leaving idle phase, TX power doesn't be set well for default channel until stack set target channel for connection. It causes that RF things cannot use better TX power during this interval.
Below are some cases which may encounter this or a similar situation.
* hw scan process before connection
As described above.
* right after restart hardware process (SER L2)
HW stuffs of target channel is initialized after mac80211 restart hardware, but we unexpectedly need to wait one more command to set channel again or to set TX power.
To fix it and improve RF behavior in that interval, during setting channel, we don't need to check entity state before setting TX power, which actually is used to restrict outside callers. It means we call chip ops directly to replace the wrapper call. Then, TX power can be initialized as long as we initialize/setup HW stuffs on one channel.
Besides, all chips should configure ops of setting TX power, so we remove trivial check on pointer.
--- drivers/net/wireless/realtek/rtw89/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +2 -3
@@ -336,8 +336,7 @@ void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev) sub_entity_idx =RTW89_SUB_ENTITY_0 ; phy_idx =RTW89_PHY_0 ; chan =rtw89_chan_get (rtwdev, sub_entity_idx); -if (chip->ops->set_txpwr) - chip->ops->set_txpwr (rtwdev, chan, phy_idx); + chip->ops->set_txpwr (rtwdev, chan, phy_idx); }void rtw89_set_channel (struct rtw89_dev *rtwdev)
@@ -373,7 +372,7 @@ void rtw89_set_channel(struct rtw89_dev *rtwdev) chip->ops->set_channel (rtwdev, &chan, mac_idx, phy_idx); -rtw89_core_set_chip_txpwr (rtwdev); + chip->ops->set_txpwr (rtwdev, &chan, phy_idx);rtw89_chip_set_channel_done (rtwdev, &bak, &chan, mac_idx, phy_idx);
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 4/4 wifi: rtw89: 8851b: configure CRASH_TRIGGER feature for 8851B
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
RTL8851B firmware supports CRASH_TRIGGER feature from v0.29.41.0. After this is configured, debugfs fw_crash can support type 1 on RTL8851B to trigger firmware crash and verify L2 recovery through simulation.
--- drivers/net/wireless/realtek/rtw89/fw.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtw89/fw.c +1 -0
@@ -258,6 +258,7 @@ struct __fw_feat_cfg {static const struct __fw_feat_cfg fw_feat_tbl[] = {__CFG_FW_FEAT (RTL8851B , ge,0 ,29 ,37 ,1 ,TX_WAKE ),__CFG_FW_FEAT (RTL8851B , ge,0 ,29 ,37 ,1 ,SCAN_OFFLOAD ), +__CFG_FW_FEAT (RTL8851B , ge,0 ,29 ,41 ,0 ,CRASH_TRIGGER ),__CFG_FW_FEAT (RTL8852A , le,0 ,13 ,29 ,0 ,OLD_HT_RA_FORMAT ),__CFG_FW_FEAT (RTL8852A , ge,0 ,13 ,35 ,0 ,SCAN_OFFLOAD ),__CFG_FW_FEAT (RTL8852A , ge,0 ,13 ,35 ,0 ,TX_WAKE ),
Signature · 1 line
2.25.1