wifi: rtw89: add hardware rate v1 and adjust related things for WiFi 7
Ping-Ke Shih
maintainercover wifi: rtw89: add hardware rate v1 and adjust related things for WiFi 7
The coming WiFi 7 chip named 8922AE uses different rate code, and basically we can use chip generations (i.e. 802.11ax/802.11be) to determine which one we should use.
The things related to rate in this patchset are
- The rate to set fixed rate configured by 'iw bitrates'
- TX rate (set by rate mask for firmware rate adaptive mechanism)
- TX rate report (reported by firmware to tell driver TX rate it is currently using)
- RX rate from RX descriptor
- TX/RX histogram in debugfs
It still only support HE rate, and we will support EHT later. So, everything is almost unchanged for existing chips.
Among this patchset, some are to adjust H2C/C2H marco to use struct, such as 4/10, 6/10 and 7/10. They don't change logic at all.
Ping-Ke Shih (9):
wifi: rtw89: add chip_info::chip_gen to determine chip generation
wifi: rtw89: define hardware rate v1 for WiFi 7 chips
wifi: rtw89: use struct to set RA H2C command
wifi: rtw89: add H2C RA command V1 to support WiFi 7 chips
wifi: rtw89: use struct to access firmware C2H event header
wifi: rtw89: use struct to access RA report
wifi: rtw89: add C2H RA event V1 to support WiFi 7 chips
wifi: rtw89: add to display hardware rates v1 histogram in debugfs
wifi: rtw89: get data rate mode/NSS/MCS v1 from RX descriptor
Zong-Zhe Yang (1):
wifi: rtw89: phy: rate pattern handles HW rate by chip gen
drivers/net/wireless/realtek/rtw89/core.c | 24 +- drivers/net/wireless/realtek/rtw89/core.h | 205 +++++++++++++- drivers/net/wireless/realtek/rtw89/debug.c | 35 ++- drivers/net/wireless/realtek/rtw89/fw.c | 104 +++++--- drivers/net/wireless/realtek/rtw89/fw.h | 251 ++++++------------ drivers/net/wireless/realtek/rtw89/phy.c | 93 +++++-- drivers/net/wireless/realtek/rtw89/rtw8851b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852c.c | 1 + drivers/net/wireless/realtek/rtw89/txrx.h | 47 +++- 11 files changed, 486 insertions(+), 277 deletions(-)
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 1/10 wifi: rtw89: add chip_info::chip_gen to determine chip generation
The coming WiFi 7 chip is 8922AE which uses different hardware rate and register naming rule. Adding a chip_info::chip_gen field can help to do things by generations accordingly.
--- drivers/net/wireless/realtek/rtw89/core.h | 9 +++++++++ drivers/net/wireless/realtek/rtw89/rtw8851b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852c.c | 1 + 5 files changed, 13 insertions(+)
drivers/net/wireless/realtek/rtw89/core.h +9 -0
@@ -109,6 +109,14 @@ enum rtw89_core_chip_id {RTL8852B ,RTL8852C ,RTL8851B , + RTL8922A, +}; + +enum rtw89_chip_gen { +RTW89_CHIP_AX , +RTW89_CHIP_BE , + +RTW89_CHIP_GEN_NUM , }; enum rtw89_cv {
@@ -3177,6 +3185,7 @@ struct rtw89_antdiv_info {struct rtw89_chip_info {enum rtw89_core_chip_id chip_id; +enum rtw89_chip_gen chip_gen;const struct rtw89_chip_ops *ops;const char *fw_basename;u8 fw_format_max;
drivers/net/wireless/realtek/rtw89/rtw8851b.c +1 -0
@@ -2334,6 +2334,7 @@ static const struct wiphy_wowlan_support rtw_wowlan_stub_8851b = {const struct rtw89_chip_info rtw8851b_chip_info = { .chip_id =RTL8851B , + .chip_gen =RTW89_CHIP_AX , .ops = &rtw8851b_chip_ops, .fw_basename =RTW8851B_FW_BASENAME , .fw_format_max =RTW8851B_FW_FORMAT_MAX ,
drivers/net/wireless/realtek/rtw89/rtw8852a.c +1 -0
@@ -2071,6 +2071,7 @@ static const struct rtw89_chip_ops rtw8852a_chip_ops = {const struct rtw89_chip_info rtw8852a_chip_info = { .chip_id =RTL8852A , + .chip_gen =RTW89_CHIP_AX , .ops = &rtw8852a_chip_ops, .fw_basename =RTW8852A_FW_BASENAME , .fw_format_max =RTW8852A_FW_FORMAT_MAX ,
drivers/net/wireless/realtek/rtw89/rtw8852b.c +1 -0
@@ -2503,6 +2503,7 @@ static const struct wiphy_wowlan_support rtw_wowlan_stub_8852b = {const struct rtw89_chip_info rtw8852b_chip_info = { .chip_id =RTL8852B , + .chip_gen =RTW89_CHIP_AX , .ops = &rtw8852b_chip_ops, .fw_basename =RTW8852B_FW_BASENAME , .fw_format_max =RTW8852B_FW_FORMAT_MAX ,
drivers/net/wireless/realtek/rtw89/rtw8852c.c +1 -0
@@ -2802,6 +2802,7 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = {const struct rtw89_chip_info rtw8852c_chip_info = { .chip_id =RTL8852C , + .chip_gen =RTW89_CHIP_AX , .ops = &rtw8852c_chip_ops, .fw_basename =RTW8852C_FW_BASENAME , .fw_format_max =RTW8852C_FW_FORMAT_MAX ,
Signature · 1 line
2.25.1
Re: [PATCH 01/10] wifi: rtw89: add chip_info::chip_gen to determine chip generation
Quoted 5 lines · Ping-Ke Shih
The coming WiFi 7 chip is 8922AE which uses different hardware rate and register naming rule. Adding a
chip_info::chip_genfield can help to do things by generations accordingly.Signed-off-by Ping-Ke Shih <[email protected]>
10 patches applied to wireless-next.git, thanks.
f698afa7ce37 wifi: rtw89: add chip_info::chip_gen to determine chip generation 9e5c6c0df94e wifi: rtw89: define hardware rate v1 for WiFi 7 chips 2ef14155c29b wifi: rtw89: phy: rate pattern handles HW rate by chip gen 401b0c161b09 wifi: rtw89: use struct to set RA H2C command c97683ff01a4 wifi: rtw89: add H2C RA command V1 to support WiFi 7 chips c342ac219516 wifi: rtw89: use struct to access firmware C2H event header 57cafeb18f06 wifi: rtw89: use struct to access RA report 5c152231c341 wifi: rtw89: add C2H RA event V1 to support WiFi 7 chips ae775faa8750 wifi: rtw89: add to display hardware rates v1 histogram in debugfs 023d2f14abf8 wifi: rtw89: get data rate mode/NSS/MCS v1 from RX descriptor
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/10 wifi: rtw89: define hardware rate v1 for WiFi 7 chips
In reply to Ping-Ke ShihTo support EHT rate, hardware rate v1 is introduced. The CCK and OFDM rates are persistent. HT/VHT/HE rates use different rate code from original, and add new code for EHT rates.
--- drivers/net/wireless/realtek/rtw89/core.h | 188 ++++++++++++++++++++++ 1 file changed, 188 insertions(+)
drivers/net/wireless/realtek/rtw89/core.h +188 -0
@@ -395,6 +395,194 @@ enum rtw89_hw_rate {RTW89_HW_RATE_HE_NSS4_MCS9 =0x1B9 ,RTW89_HW_RATE_HE_NSS4_MCS10 =0x1BA ,RTW89_HW_RATE_HE_NSS4_MCS11 =0x1BB , + +RTW89_HW_RATE_V1_MCS0 =0x100 , +RTW89_HW_RATE_V1_MCS1 =0x101 , +RTW89_HW_RATE_V1_MCS2 =0x102 , +RTW89_HW_RATE_V1_MCS3 =0x103 , +RTW89_HW_RATE_V1_MCS4 =0x104 , +RTW89_HW_RATE_V1_MCS5 =0x105 , +RTW89_HW_RATE_V1_MCS6 =0x106 , +RTW89_HW_RATE_V1_MCS7 =0x107 , +RTW89_HW_RATE_V1_MCS8 =0x108 , +RTW89_HW_RATE_V1_MCS9 =0x109 , +RTW89_HW_RATE_V1_MCS10 =0x10A , +RTW89_HW_RATE_V1_MCS11 =0x10B , +RTW89_HW_RATE_V1_MCS12 =0x10C , +RTW89_HW_RATE_V1_MCS13 =0x10D , +RTW89_HW_RATE_V1_MCS14 =0x10E , +RTW89_HW_RATE_V1_MCS15 =0x10F , +RTW89_HW_RATE_V1_MCS16 =0x110 , +RTW89_HW_RATE_V1_MCS17 =0x111 , +RTW89_HW_RATE_V1_MCS18 =0x112 , +RTW89_HW_RATE_V1_MCS19 =0x113 , +RTW89_HW_RATE_V1_MCS20 =0x114 , +RTW89_HW_RATE_V1_MCS21 =0x115 , +RTW89_HW_RATE_V1_MCS22 =0x116 , +RTW89_HW_RATE_V1_MCS23 =0x117 , +RTW89_HW_RATE_V1_MCS24 =0x118 , +RTW89_HW_RATE_V1_MCS25 =0x119 , +RTW89_HW_RATE_V1_MCS26 =0x11A , +RTW89_HW_RATE_V1_MCS27 =0x11B , +RTW89_HW_RATE_V1_MCS28 =0x11C , +RTW89_HW_RATE_V1_MCS29 =0x11D , +RTW89_HW_RATE_V1_MCS30 =0x11E , +RTW89_HW_RATE_V1_MCS31 =0x11F , +RTW89_HW_RATE_V1_VHT_NSS1_MCS0 =0x200 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS1 =0x201 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS2 =0x202 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS3 =0x203 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS4 =0x204 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS5 =0x205 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS6 =0x206 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS7 =0x207 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS8 =0x208 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS9 =0x209 , +RTW89_HW_RATE_V1_VHT_NSS1_MCS10 =0x20A , +RTW89_HW_RATE_V1_VHT_NSS1_MCS11 =0x20B , +RTW89_HW_RATE_V1_VHT_NSS2_MCS0 =0x220 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS1 =0x221 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS2 =0x222 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS3 =0x223 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS4 =0x224 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS5 =0x225 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS6 =0x226 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS7 =0x227 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS8 =0x228 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS9 =0x229 , +RTW89_HW_RATE_V1_VHT_NSS2_MCS10 =0x22A , +RTW89_HW_RATE_V1_VHT_NSS2_MCS11 =0x22B , +RTW89_HW_RATE_V1_VHT_NSS3_MCS0 =0x240 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS1 =0x241 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS2 =0x242 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS3 =0x243 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS4 =0x244 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS5 =0x245 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS6 =0x246 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS7 =0x247 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS8 =0x248 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS9 =0x249 , +RTW89_HW_RATE_V1_VHT_NSS3_MCS10 =0x24A , +RTW89_HW_RATE_V1_VHT_NSS3_MCS11 =0x24B , +RTW89_HW_RATE_V1_VHT_NSS4_MCS0 =0x260 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS1 =0x261 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS2 =0x262 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS3 =0x263 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS4 =0x264 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS5 =0x265 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS6 =0x266 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS7 =0x267 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS8 =0x268 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS9 =0x269 , +RTW89_HW_RATE_V1_VHT_NSS4_MCS10 =0x26A , +RTW89_HW_RATE_V1_VHT_NSS4_MCS11 =0x26B , +RTW89_HW_RATE_V1_HE_NSS1_MCS0 =0x300 , +RTW89_HW_RATE_V1_HE_NSS1_MCS1 =0x301 , +RTW89_HW_RATE_V1_HE_NSS1_MCS2 =0x302 , +RTW89_HW_RATE_V1_HE_NSS1_MCS3 =0x303 , +RTW89_HW_RATE_V1_HE_NSS1_MCS4 =0x304 , +RTW89_HW_RATE_V1_HE_NSS1_MCS5 =0x305 , +RTW89_HW_RATE_V1_HE_NSS1_MCS6 =0x306 , +RTW89_HW_RATE_V1_HE_NSS1_MCS7 =0x307 , +RTW89_HW_RATE_V1_HE_NSS1_MCS8 =0x308 , +RTW89_HW_RATE_V1_HE_NSS1_MCS9 =0x309 , +RTW89_HW_RATE_V1_HE_NSS1_MCS10 =0x30A , +RTW89_HW_RATE_V1_HE_NSS1_MCS11 =0x30B , +RTW89_HW_RATE_V1_HE_NSS2_MCS0 =0x320 , +RTW89_HW_RATE_V1_HE_NSS2_MCS1 =0x321 , +RTW89_HW_RATE_V1_HE_NSS2_MCS2 =0x322 , +RTW89_HW_RATE_V1_HE_NSS2_MCS3 =0x323 , +RTW89_HW_RATE_V1_HE_NSS2_MCS4 =0x324 , +RTW89_HW_RATE_V1_HE_NSS2_MCS5 =0x325 , +RTW89_HW_RATE_V1_HE_NSS2_MCS6 =0x326 , +RTW89_HW_RATE_V1_HE_NSS2_MCS7 =0x327 , +RTW89_HW_RATE_V1_HE_NSS2_MCS8 =0x328 , +RTW89_HW_RATE_V1_HE_NSS2_MCS9 =0x329 , +RTW89_HW_RATE_V1_HE_NSS2_MCS10 =0x32A , +RTW89_HW_RATE_V1_HE_NSS2_MCS11 =0x32B , +RTW89_HW_RATE_V1_HE_NSS3_MCS0 =0x340 , +RTW89_HW_RATE_V1_HE_NSS3_MCS1 =0x341 , +RTW89_HW_RATE_V1_HE_NSS3_MCS2 =0x342 , +RTW89_HW_RATE_V1_HE_NSS3_MCS3 =0x343 , +RTW89_HW_RATE_V1_HE_NSS3_MCS4 =0x344 , +RTW89_HW_RATE_V1_HE_NSS3_MCS5 =0x345 , +RTW89_HW_RATE_V1_HE_NSS3_MCS6 =0x346 , +RTW89_HW_RATE_V1_HE_NSS3_MCS7 =0x347 , +RTW89_HW_RATE_V1_HE_NSS3_MCS8 =0x348 , +RTW89_HW_RATE_V1_HE_NSS3_MCS9 =0x349 , +RTW89_HW_RATE_V1_HE_NSS3_MCS10 =0x34A , +RTW89_HW_RATE_V1_HE_NSS3_MCS11 =0x34B , +RTW89_HW_RATE_V1_HE_NSS4_MCS0 =0x360 , +RTW89_HW_RATE_V1_HE_NSS4_MCS1 =0x361 , +RTW89_HW_RATE_V1_HE_NSS4_MCS2 =0x362 , +RTW89_HW_RATE_V1_HE_NSS4_MCS3 =0x363 , +RTW89_HW_RATE_V1_HE_NSS4_MCS4 =0x364 , +RTW89_HW_RATE_V1_HE_NSS4_MCS5 =0x365 , +RTW89_HW_RATE_V1_HE_NSS4_MCS6 =0x366 , +RTW89_HW_RATE_V1_HE_NSS4_MCS7 =0x367 , +RTW89_HW_RATE_V1_HE_NSS4_MCS8 =0x368 , +RTW89_HW_RATE_V1_HE_NSS4_MCS9 =0x369 , +RTW89_HW_RATE_V1_HE_NSS4_MCS10 =0x36A , +RTW89_HW_RATE_V1_HE_NSS4_MCS11 =0x36B , +RTW89_HW_RATE_V1_EHT_NSS1_MCS0 =0x400 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS1 =0x401 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS2 =0x402 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS3 =0x403 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS4 =0x404 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS5 =0x405 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS6 =0x406 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS7 =0x407 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS8 =0x408 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS9 =0x409 , +RTW89_HW_RATE_V1_EHT_NSS1_MCS10 =0x40A , +RTW89_HW_RATE_V1_EHT_NSS1_MCS11 =0x40B , +RTW89_HW_RATE_V1_EHT_NSS1_MCS12 =0x40C , +RTW89_HW_RATE_V1_EHT_NSS1_MCS13 =0x40D , +RTW89_HW_RATE_V1_EHT_NSS1_MCS14 =0x40E , +RTW89_HW_RATE_V1_EHT_NSS1_MCS15 =0x40F , +RTW89_HW_RATE_V1_EHT_NSS2_MCS0 =0x420 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS1 =0x421 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS2 =0x422 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS3 =0x423 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS4 =0x424 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS5 =0x425 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS6 =0x426 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS7 =0x427 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS8 =0x428 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS9 =0x429 , +RTW89_HW_RATE_V1_EHT_NSS2_MCS10 =0x42A , +RTW89_HW_RATE_V1_EHT_NSS2_MCS11 =0x42B , +RTW89_HW_RATE_V1_EHT_NSS2_MCS12 =0x42C , +RTW89_HW_RATE_V1_EHT_NSS2_MCS13 =0x42D , +RTW89_HW_RATE_V1_EHT_NSS3_MCS0 =0x440 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS1 =0x441 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS2 =0x442 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS3 =0x443 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS4 =0x444 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS5 =0x445 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS6 =0x446 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS7 =0x447 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS8 =0x448 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS9 =0x449 , +RTW89_HW_RATE_V1_EHT_NSS3_MCS10 =0x44A , +RTW89_HW_RATE_V1_EHT_NSS3_MCS11 =0x44B , +RTW89_HW_RATE_V1_EHT_NSS3_MCS12 =0x44C , +RTW89_HW_RATE_V1_EHT_NSS3_MCS13 =0x44D , +RTW89_HW_RATE_V1_EHT_NSS4_MCS0 =0x460 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS1 =0x461 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS2 =0x462 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS3 =0x463 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS4 =0x464 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS5 =0x465 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS6 =0x466 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS7 =0x467 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS8 =0x468 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS9 =0x469 , +RTW89_HW_RATE_V1_EHT_NSS4_MCS10 =0x46A , +RTW89_HW_RATE_V1_EHT_NSS4_MCS11 =0x46B , +RTW89_HW_RATE_V1_EHT_NSS4_MCS12 =0x46C , +RTW89_HW_RATE_V1_EHT_NSS4_MCS13 =0x46D , +RTW89_HW_RATE_NR , RTW89_HW_RATE_MASK_MOD = GENMASK(8, 7),
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 3/10 wifi: rtw89: phy: rate pattern handles HW rate by chip gen
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
Rate pattern is controlled by 'iw bitrates' to fix rate as desired, and we extend to support v1 rate.
--- drivers/net/wireless/realtek/rtw89/phy.c | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-)
drivers/net/wireless/realtek/rtw89/phy.c +28 -15
@@ -444,6 +444,12 @@ static bool __check_rate_pattern(struct rtw89_phy_rate_pattern *next,return true; } +#define RTW89_HW_RATE_BY_CHIP_GEN (rate) \ + { \ + [RTW89_CHIP_AX] = RTW89_HW_RATE_ ## rate, \ + [RTW89_CHIP_BE] = RTW89_HW_RATE_V1_ ## rate, \ + } +void rtw89_phy_rate_pattern_vif (struct rtw89_dev *rtwdev,struct ieee80211_vif *vif,const struct cfg80211_bitrate_mask *mask)
@@ -452,39 +458,46 @@ void rtw89_phy_rate_pattern_vif(struct rtw89_dev *rtwdev,struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;struct rtw89_phy_rate_pattern next_pattern = {0 };const struct rtw89_chan *chan =rtw89_chan_get (rtwdev,RTW89_SUB_ENTITY_0 ); -static const u16 hw_rate_he[] = {RTW89_HW_RATE_HE_NSS1_MCS0 , -RTW89_HW_RATE_HE_NSS2_MCS0 , -RTW89_HW_RATE_HE_NSS3_MCS0 , -RTW89_HW_RATE_HE_NSS4_MCS0 }; -static const u16 hw_rate_vht[] = {RTW89_HW_RATE_VHT_NSS1_MCS0 , -RTW89_HW_RATE_VHT_NSS2_MCS0 , -RTW89_HW_RATE_VHT_NSS3_MCS0 , -RTW89_HW_RATE_VHT_NSS4_MCS0 }; -static const u16 hw_rate_ht[] = {RTW89_HW_RATE_MCS0 , -RTW89_HW_RATE_MCS8 , -RTW89_HW_RATE_MCS16 , -RTW89_HW_RATE_MCS24 }; +static const u16 hw_rate_he[][RTW89_CHIP_GEN_NUM ] = { +RTW89_HW_RATE_BY_CHIP_GEN (HE_NSS1_MCS0 ), +RTW89_HW_RATE_BY_CHIP_GEN (HE_NSS2_MCS0 ), +RTW89_HW_RATE_BY_CHIP_GEN (HE_NSS3_MCS0 ), +RTW89_HW_RATE_BY_CHIP_GEN (HE_NSS4_MCS0 ), + }; +static const u16 hw_rate_vht[][RTW89_CHIP_GEN_NUM ] = { +RTW89_HW_RATE_BY_CHIP_GEN (VHT_NSS1_MCS0 ), +RTW89_HW_RATE_BY_CHIP_GEN (VHT_NSS2_MCS0 ), +RTW89_HW_RATE_BY_CHIP_GEN (VHT_NSS3_MCS0 ), +RTW89_HW_RATE_BY_CHIP_GEN (VHT_NSS4_MCS0 ), + }; +static const u16 hw_rate_ht[][RTW89_CHIP_GEN_NUM ] = { +RTW89_HW_RATE_BY_CHIP_GEN (MCS0 ), +RTW89_HW_RATE_BY_CHIP_GEN (MCS8 ), +RTW89_HW_RATE_BY_CHIP_GEN (MCS16 ), +RTW89_HW_RATE_BY_CHIP_GEN (MCS24 ), + };u8 band = chan->band_type;enum nl80211_band nl_band =rtw89_hw_to_nl80211_band (band); +enum rtw89_chip_gen chip_gen = rtwdev->chip->chip_gen;u8 tx_nss = rtwdev->hal.tx_nss;u8 i;for (i =0 ; i < tx_nss; i++) -if (!__check_rate_pattern (&next_pattern, hw_rate_he[i], +if (!__check_rate_pattern (&next_pattern, hw_rate_he[i][chip_gen],RA_MASK_HE_RATES ,RTW89_RA_MODE_HE , mask->control[nl_band].he_mcs[i],0 , true)) goto out;for (i =0 ; i < tx_nss; i++) -if (!__check_rate_pattern (&next_pattern, hw_rate_vht[i], +if (!__check_rate_pattern (&next_pattern, hw_rate_vht[i][chip_gen],RA_MASK_VHT_RATES ,RTW89_RA_MODE_VHT , mask->control[nl_band].vht_mcs[i],0 , true)) goto out;for (i =0 ; i < tx_nss; i++) -if (!__check_rate_pattern (&next_pattern, hw_rate_ht[i], +if (!__check_rate_pattern (&next_pattern, hw_rate_ht[i][chip_gen],RA_MASK_HT_RATES ,RTW89_RA_MODE_HT , mask->control[nl_band].ht_mcs[i],0 , true))
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 4/10 wifi: rtw89: use struct to set RA H2C command
In reply to Ping-Ke ShihRA (rate adaptive) H2C command is used to tell firmware which rates can be used for specified MAC ID. Basically, this commit doesn't change result. Only change to set two 32-bit instead of continual 8-byte rate masks one by one. Originally, we only set 5-byte masks, because existing WiFi 6 2SS chips only need 5-byte masks. Setting two 32-bit masks will be more efficient and also can support coming WiFi 7 2SS chips containing more rates.
--- drivers/net/wireless/realtek/rtw89/fw.c | 79 +++++----- drivers/net/wireless/realtek/rtw89/fw.h | 187 +++++------------------- 2 files changed, 73 insertions(+), 193 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.c +39 -40
@@ -1903,61 +1903,60 @@ int rtw89_fw_h2c_tp_offload(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)return ret; } -#define H2C_RA_LEN 16int rtw89_fw_h2c_ra (struct rtw89_dev *rtwdev,struct rtw89_ra_info *ra,bool csi) {struct sk_buff *skb; -u8 *cmd; +struct rtw89_h2c_ra *h2c; +u32 len =sizeof (*h2c);int ret; - skb =rtw89_fw_h2c_alloc_skb_with_hdr (rtwdev,H2C_RA_LEN ); + skb =rtw89_fw_h2c_alloc_skb_with_hdr (rtwdev, len);if (!skb) {rtw89_err (rtwdev,"failed to alloc skb for h2c join\n" );return -ENOMEM ; } -skb_put (skb,H2C_RA_LEN ); - cmd = skb->data; +skb_put (skb, len); + h2c = (struct rtw89_h2c_ra *)skb->data;rtw89_debug (rtwdev,RTW89_DBG_RA ,"ra cmd msk: %llx " , ra->ra_mask); -RTW89_SET_FWCMD_RA_MODE (cmd, ra->mode_ctrl); -RTW89_SET_FWCMD_RA_BW_CAP (cmd, ra->bw_cap); -RTW89_SET_FWCMD_RA_MACID (cmd, ra->macid); -RTW89_SET_FWCMD_RA_DCM (cmd, ra->dcm_cap); -RTW89_SET_FWCMD_RA_ER (cmd, ra->er_cap); -RTW89_SET_FWCMD_RA_INIT_RATE_LV (cmd, ra->init_rate_lv); -RTW89_SET_FWCMD_RA_UPD_ALL (cmd, ra->upd_all); -RTW89_SET_FWCMD_RA_SGI (cmd, ra->en_sgi); -RTW89_SET_FWCMD_RA_LDPC (cmd, ra->ldpc_cap); -RTW89_SET_FWCMD_RA_STBC (cmd, ra->stbc_cap); -RTW89_SET_FWCMD_RA_SS_NUM (cmd, ra->ss_num); -RTW89_SET_FWCMD_RA_GILTF (cmd, ra->giltf); -RTW89_SET_FWCMD_RA_UPD_BW_NSS_MASK (cmd, ra->upd_bw_nss_mask); -RTW89_SET_FWCMD_RA_UPD_MASK (cmd, ra->upd_mask); -RTW89_SET_FWCMD_RA_MASK_0 (cmd,FIELD_GET (MASKBYTE0 , ra->ra_mask)); -RTW89_SET_FWCMD_RA_MASK_1 (cmd,FIELD_GET (MASKBYTE1 , ra->ra_mask)); -RTW89_SET_FWCMD_RA_MASK_2 (cmd,FIELD_GET (MASKBYTE2 , ra->ra_mask)); -RTW89_SET_FWCMD_RA_MASK_3 (cmd,FIELD_GET (MASKBYTE3 , ra->ra_mask)); -RTW89_SET_FWCMD_RA_MASK_4 (cmd,FIELD_GET (MASKBYTE4 , ra->ra_mask)); -RTW89_SET_FWCMD_RA_FIX_GILTF_EN (cmd, ra->fix_giltf_en); -RTW89_SET_FWCMD_RA_FIX_GILTF (cmd, ra->fix_giltf); - -if (csi) { -RTW89_SET_FWCMD_RA_BFEE_CSI_CTL (cmd,1 ); -RTW89_SET_FWCMD_RA_BAND_NUM (cmd, ra->band_num); -RTW89_SET_FWCMD_RA_CR_TBL_SEL (cmd, ra->cr_tbl_sel); -RTW89_SET_FWCMD_RA_FIXED_CSI_RATE_EN (cmd, ra->fixed_csi_rate_en); -RTW89_SET_FWCMD_RA_RA_CSI_RATE_EN (cmd, ra->ra_csi_rate_en); -RTW89_SET_FWCMD_RA_FIXED_CSI_MCS_SS_IDX (cmd, ra->csi_mcs_ss_idx); -RTW89_SET_FWCMD_RA_FIXED_CSI_MODE (cmd, ra->csi_mode); -RTW89_SET_FWCMD_RA_FIXED_CSI_GI_LTF (cmd, ra->csi_gi_ltf); -RTW89_SET_FWCMD_RA_FIXED_CSI_BW (cmd, ra->csi_bw); - } - + h2c->w0 =le32_encode_bits (ra->mode_ctrl,RTW89_H2C_RA_W0_MODE ) | +le32_encode_bits (ra->bw_cap,RTW89_H2C_RA_W0_BW_CAP ) | +le32_encode_bits (ra->macid,RTW89_H2C_RA_W0_MACID ) | +le32_encode_bits (ra->dcm_cap,RTW89_H2C_RA_W0_DCM ) | +le32_encode_bits (ra->er_cap,RTW89_H2C_RA_W0_ER ) | +le32_encode_bits (ra->init_rate_lv,RTW89_H2C_RA_W0_INIT_RATE_LV ) | +le32_encode_bits (ra->upd_all,RTW89_H2C_RA_W0_UPD_ALL ) | +le32_encode_bits (ra->en_sgi,RTW89_H2C_RA_W0_SGI ) | +le32_encode_bits (ra->ldpc_cap,RTW89_H2C_RA_W0_LDPC ) | +le32_encode_bits (ra->stbc_cap,RTW89_H2C_RA_W0_STBC ) | +le32_encode_bits (ra->ss_num,RTW89_H2C_RA_W0_SS_NUM ) | +le32_encode_bits (ra->giltf,RTW89_H2C_RA_W0_GILTF ) | +le32_encode_bits (ra->upd_bw_nss_mask,RTW89_H2C_RA_W0_UPD_BW_NSS_MASK ) | +le32_encode_bits (ra->upd_mask,RTW89_H2C_RA_W0_UPD_MASK ); + h2c->w1 =le32_encode_bits (ra->ra_mask,RTW89_H2C_RA_W1_RAMASK_LO32 ); + h2c->w2 =le32_encode_bits (ra->ra_mask >>32 ,RTW89_H2C_RA_W2_RAMASK_HI32 ); + h2c->w3 =le32_encode_bits (ra->fix_giltf_en,RTW89_H2C_RA_W3_FIX_GILTF_EN ) | +le32_encode_bits (ra->fix_giltf,RTW89_H2C_RA_W3_FIX_GILTF ); + +if (!csi) + goto done; + + h2c->w2 |=le32_encode_bits (1 ,RTW89_H2C_RA_W2_BFEE_CSI_CTL ); + h2c->w3 |=le32_encode_bits (ra->band_num,RTW89_H2C_RA_W3_BAND_NUM ) | +le32_encode_bits (ra->cr_tbl_sel,RTW89_H2C_RA_W3_CR_TBL_SEL ) | +le32_encode_bits (ra->fixed_csi_rate_en,RTW89_H2C_RA_W3_FIXED_CSI_RATE_EN ) | +le32_encode_bits (ra->ra_csi_rate_en,RTW89_H2C_RA_W3_RA_CSI_RATE_EN ) | +le32_encode_bits (ra->csi_mcs_ss_idx,RTW89_H2C_RA_W3_FIXED_CSI_MCS_SS_IDX ) | +le32_encode_bits (ra->csi_mode,RTW89_H2C_RA_W3_FIXED_CSI_MODE ) | +le32_encode_bits (ra->csi_gi_ltf,RTW89_H2C_RA_W3_FIXED_CSI_GI_LTF ) | +le32_encode_bits (ra->csi_bw,RTW89_H2C_RA_W3_FIXED_CSI_BW ); + +done:rtw89_h2c_pkt_set_hdr (rtwdev, skb,FWCMD_TYPE_H2C ,H2C_CAT_OUTSRC ,H2C_CL_OUTSRC_RA ,H2C_FUNC_OUTSRC_RA_MACIDCFG ,0 ,0 , -H2C_RA_LEN ); + len); ret =rtw89_h2c_tx (rtwdev, skb, false);if (ret) {
drivers/net/wireless/realtek/rtw89/fw.h +34 -153
194 lines not on this page · raw message
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 5/10 wifi: rtw89: add H2C RA command V1 to support WiFi 7 chips
In reply to Ping-Ke ShihH2C RA V1 command adds two words to support WiFi 7 chips, which can possibly support up to 4SS rates. Because current chips have only 2SS rates, leave the fields blank for now. The main changes are to set extended bits of EHT mode and bandwidth -- add a bit for EHT mode; add a bit to enumerate 320MHz channel bandwidth.
--- drivers/net/wireless/realtek/rtw89/core.h | 5 +++-- drivers/net/wireless/realtek/rtw89/fw.c | 18 +++++++++++++++++- drivers/net/wireless/realtek/rtw89/fw.h | 11 +++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/core.h +3 -2
@@ -2700,9 +2700,10 @@ struct rtw89_ra_info {* Bit2 : HT * Bit3 : VHT * Bit4 : HE +* Bit5 : EHT */ - u8 mode_ctrl:5; - u8 bw_cap:2; + u8 mode_ctrl:6; + u8 bw_cap:3; /* enum rtw89_bandwidth */u8 macid; u8 dcm_cap:1; u8 er_cap:1;
drivers/net/wireless/realtek/rtw89/fw.c +17 -1
@@ -1905,11 +1905,19 @@ int rtw89_fw_h2c_tp_offload(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)int rtw89_fw_h2c_ra (struct rtw89_dev *rtwdev,struct rtw89_ra_info *ra,bool csi) { -struct sk_buff *skb; +const struct rtw89_chip_info *chip = rtwdev->chip; +struct rtw89_h2c_ra_v1 *h2c_v1;struct rtw89_h2c_ra *h2c;u32 len =sizeof (*h2c); +bool format_v1 = false; +struct sk_buff *skb;int ret; +if (chip->chip_gen ==RTW89_CHIP_BE ) { + len =sizeof (*h2c_v1); + format_v1 = true; + } + skb =rtw89_fw_h2c_alloc_skb_with_hdr (rtwdev, len);if (!skb) {rtw89_err (rtwdev,"failed to alloc skb for h2c join\n" );
@@ -1939,6 +1947,14 @@ int rtw89_fw_h2c_ra(struct rtw89_dev *rtwdev, struct rtw89_ra_info *ra, bool csi h2c->w3 =le32_encode_bits (ra->fix_giltf_en,RTW89_H2C_RA_W3_FIX_GILTF_EN ) |le32_encode_bits (ra->fix_giltf,RTW89_H2C_RA_W3_FIX_GILTF ); +if (!format_v1) + goto csi; + + h2c_v1 = (struct rtw89_h2c_ra_v1 *)h2c; + h2c_v1->w4 =le32_encode_bits (ra->mode_ctrl,RTW89_H2C_RA_V1_W4_MODE_EHT ) | +le32_encode_bits (ra->bw_cap,RTW89_H2C_RA_V1_W4_BW_EHT ); + +csi:if (!csi) goto done;
drivers/net/wireless/realtek/rtw89/fw.h +11 -0
@@ -327,6 +327,17 @@ struct rtw89_h2c_ra {#define RTW89_H2C_RA_W3_FIXED_CSI_GI_LTF GENMASK(28, 26)#define RTW89_H2C_RA_W3_FIXED_CSI_BW GENMASK(31, 29) +struct rtw89_h2c_ra_v1 { +struct rtw89_h2c_ra v0; +__le32 w4; +__le32 w5; +} __packed; + +#define RTW89_H2C_RA_V1_W4_MODE_EHT GENMASK(6, 0) +#define RTW89_H2C_RA_V1_W4_BW_EHT GENMASK(10, 8) +#define RTW89_H2C_RA_V1_W4_RAMASK_UHL16 GENMASK(31, 16) +#define RTW89_H2C_RA_V1_W5_RAMASK_UHH16 GENMASK(15, 0) +static inline void RTW89_SET_FWCMD_SEC_IDX (void *cmd,u32 val) {le32p_replace_bits ((__le32 *)(cmd) +0x00 , val,GENMASK (7 ,0 ));
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 6/10 wifi: rtw89: use struct to access firmware C2H event header
In reply to Ping-Ke ShihFirmware C2H events contain two-word header which can indicate category, class, function and length of received events. Use struct to access them, and doesn't change logic at all.
--- drivers/net/wireless/realtek/rtw89/fw.c | 9 +++++---- drivers/net/wireless/realtek/rtw89/fw.h | 17 +++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.c +5 -4
@@ -2830,12 +2830,13 @@ void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev)static void rtw89_fw_c2h_parse_attr (struct sk_buff *c2h) { +const struct rtw89_c2h_hdr *hdr = (const struct rtw89_c2h_hdr *)c2h->data;struct rtw89_fw_c2h_attr *attr =RTW89_SKB_C2H_CB (c2h); - attr->category =RTW89_GET_C2H_CATEGORY (c2h->data); - attr->class =RTW89_GET_C2H_CLASS (c2h->data); - attr->func =RTW89_GET_C2H_FUNC (c2h->data); - attr->len =RTW89_GET_C2H_LEN (c2h->data); + attr->category =le32_get_bits (hdr->w0,RTW89_C2H_HDR_W0_CATEGORY ); + attr->class =le32_get_bits (hdr->w0,RTW89_C2H_HDR_W0_CLASS ); + attr->func =le32_get_bits (hdr->w0,RTW89_C2H_HDR_W0_FUNC ); + attr->len =le32_get_bits (hdr->w1,RTW89_C2H_HDR_W1_LEN ); } static bool rtw89_fw_c2h_chk_atomic(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/fw.h +9 -8
@@ -3101,14 +3101,15 @@ inline void RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_Y(void *cmd, u32 val)#define RTW89_C2H_HEADER_LEN 8 -#define RTW89_GET_C2H_CATEGORY (c2h) \ - le32_get_bits(*((const __le32 *)c2h), GENMASK(1, 0)) -#define RTW89_GET_C2H_CLASS (c2h) \ - le32_get_bits(*((const __le32 *)c2h), GENMASK(7, 2)) -#define RTW89_GET_C2H_FUNC (c2h) \ - le32_get_bits(*((const __le32 *)c2h), GENMASK(15, 8)) -#define RTW89_GET_C2H_LEN (c2h) \ - le32_get_bits(*((const __le32 *)(c2h) + 1), GENMASK(13, 0)) +struct rtw89_c2h_hdr { +__le32 w0; +__le32 w1; +} __packed; + +#define RTW89_C2H_HDR_W0_CATEGORY GENMASK(1, 0) +#define RTW89_C2H_HDR_W0_CLASS GENMASK(7, 2) +#define RTW89_C2H_HDR_W0_FUNC GENMASK(15, 8) +#define RTW89_C2H_HDR_W1_LEN GENMASK(13, 0)struct rtw89_fw_c2h_attr {u8 category;
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 7/10 wifi: rtw89: use struct to access RA report
In reply to Ping-Ke ShihRA (rate adaptive), a mechanism to select proper rate, is implemented in firmware, and this report is used to tell driver TX rate it is currently using. Use struct to access this report, and doesn't change logic at all.
--- drivers/net/wireless/realtek/rtw89/fw.h | 24 ++++++++++++------------ drivers/net/wireless/realtek/rtw89/phy.c | 13 +++++++------ 2 files changed, 19 insertions(+), 18 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.h +12 -12
@@ -3160,18 +3160,18 @@ struct rtw89_c2h_mac_bcnfltr_rpt {#define RTW89_C2H_MAC_BCNFLTR_RPT_W2_EVENT GENMASK(11, 10)#define RTW89_C2H_MAC_BCNFLTR_RPT_W2_MA GENMASK(23, 16) -#define RTW89_GET_PHY_C2H_RA_RPT_MACID (c2h) \ - le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 0)) -#define RTW89_GET_PHY_C2H_RA_RPT_RETRY_RATIO (c2h) \ - le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(23, 16)) -#define RTW89_GET_PHY_C2H_RA_RPT_MCSNSS (c2h) \ - le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(6, 0)) -#define RTW89_GET_PHY_C2H_RA_RPT_MD_SEL (c2h) \ - le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(9, 8)) -#define RTW89_GET_PHY_C2H_RA_RPT_GILTF (c2h) \ - le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(12, 10)) -#define RTW89_GET_PHY_C2H_RA_RPT_BW (c2h) \ - le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(14, 13)) +struct rtw89_c2h_ra_rpt { +struct rtw89_c2h_hdr hdr; +__le32 w2; +__le32 w3; +} __packed; + +#define RTW89_C2H_RA_RPT_W2_MACID GENMASK(15, 0) +#define RTW89_C2H_RA_RPT_W2_RETRY_RATIO GENMASK(23, 16) +#define RTW89_C2H_RA_RPT_W3_MCSNSS GENMASK(6, 0) +#define RTW89_C2H_RA_RPT_W3_MD_SEL GENMASK(9, 8) +#define RTW89_C2H_RA_RPT_W3_GILTF GENMASK(12, 10) +#define RTW89_C2H_RA_RPT_W3_BW GENMASK(14, 13)/* VHT, HE, HT-old: [6:4]: NSS, [3:0]: MCS * HT-new: [6:5]: NA, [4:0]: MCS
drivers/net/wireless/realtek/rtw89/phy.c +7 -6
@@ -2244,21 +2244,22 @@ static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta)struct rtw89_phy_iter_ra_data *ra_data = (struct rtw89_phy_iter_ra_data *)data;struct rtw89_dev *rtwdev = ra_data->rtwdev;struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; +const struct rtw89_c2h_ra_rpt *c2h = + (const struct rtw89_c2h_ra_rpt *)ra_data->c2h->data;struct rtw89_ra_report *ra_report = &rtwsta->ra_report; -struct sk_buff *c2h = ra_data->c2h;u8 mode, rate, bw, giltf, mac_id;u16 legacy_bitrate;bool valid;u8 mcs =0 ; - mac_id =RTW89_GET_PHY_C2H_RA_RPT_MACID (c2h->data); + mac_id =le32_get_bits (c2h->w2,RTW89_C2H_RA_RPT_W2_MACID );if (mac_id != rtwsta->mac_id)return ; - rate =RTW89_GET_PHY_C2H_RA_RPT_MCSNSS (c2h->data); - bw =RTW89_GET_PHY_C2H_RA_RPT_BW (c2h->data); - giltf =RTW89_GET_PHY_C2H_RA_RPT_GILTF (c2h->data); - mode =RTW89_GET_PHY_C2H_RA_RPT_MD_SEL (c2h->data); + rate =le32_get_bits (c2h->w3,RTW89_C2H_RA_RPT_W3_MCSNSS ); + bw =le32_get_bits (c2h->w3,RTW89_C2H_RA_RPT_W3_BW ); + giltf =le32_get_bits (c2h->w3,RTW89_C2H_RA_RPT_W3_GILTF ); + mode =le32_get_bits (c2h->w3,RTW89_C2H_RA_RPT_W3_MD_SEL );if (mode ==RTW89_RA_RPT_MODE_LEGACY ) { valid =rtw89_ra_report_to_bitrate (rtwdev, rate, &legacy_bitrate);
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 8/10 wifi: rtw89: add C2H RA event V1 to support WiFi 7 chips
In reply to Ping-Ke ShihWiFi 7 chips have more rate mode (EHT), higher MCS and more bandwidth, so define and use reserved bits to carry these information in C2H events. Also, the SS/MCS encoded bits of VHT and HE are changed, so define V1 masks for them.
--- drivers/net/wireless/realtek/rtw89/core.h | 2 ++ drivers/net/wireless/realtek/rtw89/fw.h | 14 +++++++-- drivers/net/wireless/realtek/rtw89/phy.c | 35 +++++++++++++++++++---- 3 files changed, 42 insertions(+), 9 deletions(-)
drivers/net/wireless/realtek/rtw89/core.h +2 -0
@@ -587,6 +587,8 @@ enum rtw89_hw_rate {RTW89_HW_RATE_MASK_MOD =GENMASK (8 ,7 ),RTW89_HW_RATE_MASK_VAL =GENMASK (6 ,0 ), +RTW89_HW_RATE_V1_MASK_MOD =GENMASK (10 ,8 ), + RTW89_HW_RATE_V1_MASK_VAL = GENMASK(7, 0), };/* 2G channels,
drivers/net/wireless/realtek/rtw89/fw.h +11 -3
@@ -3168,16 +3168,24 @@ struct rtw89_c2h_ra_rpt {#define RTW89_C2H_RA_RPT_W2_MACID GENMASK(15, 0)#define RTW89_C2H_RA_RPT_W2_RETRY_RATIO GENMASK(23, 16) +#define RTW89_C2H_RA_RPT_W2_MCSNSS_B7 BIT(31)#define RTW89_C2H_RA_RPT_W3_MCSNSS GENMASK(6, 0)#define RTW89_C2H_RA_RPT_W3_MD_SEL GENMASK(9, 8)#define RTW89_C2H_RA_RPT_W3_GILTF GENMASK(12, 10)#define RTW89_C2H_RA_RPT_W3_BW GENMASK(14, 13) - -/* VHT, HE, HT-old: [6:4]: NSS, [3:0]: MCS -* HT-new: [6:5]: NA, [4:0]: MCS +#define RTW89_C2H_RA_RPT_W3_MD_SEL_B2 BIT(15) +#define RTW89_C2H_RA_RPT_W3_BW_B2 BIT(16) + +/* For WiFi 6 chips: +* VHT, HE, HT-old: [6:4]: NSS, [3:0]: MCS +* HT-new: [6:5]: NA, [4:0]: MCS +* For WiFi 7 chips (V1): +* HT, VHT, HE, EHT: [7:5]: NSS, [4:0]: MCS */ #define RTW89_RA_RATE_MASK_NSS GENMASK(6, 4)#define RTW89_RA_RATE_MASK_MCS GENMASK(3, 0) +#define RTW89_RA_RATE_MASK_NSS_V1 GENMASK(7, 5) +#define RTW89_RA_RATE_MASK_MCS_V1 GENMASK(4, 0)#define RTW89_RA_RATE_MASK_HT_MCS GENMASK(4, 0)#define RTW89_MK_HT_RATE (nss, mcs) (FIELD_PREP(GENMASK(4, 3), nss) | \ FIELD_PREP(GENMASK(2, 0), mcs))
drivers/net/wireless/realtek/rtw89/phy.c +29 -6
@@ -2247,10 +2247,13 @@ static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta)const struct rtw89_c2h_ra_rpt *c2h = (const struct rtw89_c2h_ra_rpt *)ra_data->c2h->data;struct rtw89_ra_report *ra_report = &rtwsta->ra_report; +const struct rtw89_chip_info *chip = rtwdev->chip; +bool format_v1 = chip->chip_gen ==RTW89_CHIP_BE ;u8 mode, rate, bw, giltf, mac_id;u16 legacy_bitrate;bool valid;u8 mcs =0 ; +u8 t; mac_id =le32_get_bits (c2h->w2,RTW89_C2H_RA_RPT_W2_MACID );if (mac_id != rtwsta->mac_id)
@@ -2261,6 +2264,15 @@ static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta) giltf =le32_get_bits (c2h->w3,RTW89_C2H_RA_RPT_W3_GILTF ); mode =le32_get_bits (c2h->w3,RTW89_C2H_RA_RPT_W3_MD_SEL ); +if (format_v1) { + t =le32_get_bits (c2h->w2,RTW89_C2H_RA_RPT_W2_MCSNSS_B7 ); + rate |=u8_encode_bits (t,BIT (7 )); + t =le32_get_bits (c2h->w3,RTW89_C2H_RA_RPT_W3_BW_B2 ); + bw |=u8_encode_bits (t,BIT (2 )); + t =le32_get_bits (c2h->w3,RTW89_C2H_RA_RPT_W3_MD_SEL_B2 ); + mode |=u8_encode_bits (t,BIT (2 )); + } +if (mode ==RTW89_RA_RPT_MODE_LEGACY ) { valid =rtw89_ra_report_to_bitrate (rtwdev, rate, &legacy_bitrate);if (!valid)
@@ -2287,16 +2299,24 @@ static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta)break ;case RTW89_RA_RPT_MODE_VHT : ra_report->txrate.flags |=RATE_INFO_FLAGS_VHT_MCS ; - ra_report->txrate.mcs =FIELD_GET (RTW89_RA_RATE_MASK_MCS , rate); - ra_report->txrate.nss =FIELD_GET (RTW89_RA_RATE_MASK_NSS , rate) +1 ; + ra_report->txrate.mcs = format_v1 ? +u8_get_bits (rate,RTW89_RA_RATE_MASK_MCS_V1 ) : +u8_get_bits (rate,RTW89_RA_RATE_MASK_MCS ); + ra_report->txrate.nss = format_v1 ? +u8_get_bits (rate,RTW89_RA_RATE_MASK_NSS_V1 ) +1 : +u8_get_bits (rate,RTW89_RA_RATE_MASK_NSS ) +1 ;if (giltf) ra_report->txrate.flags |=RATE_INFO_FLAGS_SHORT_GI ; mcs = ra_report->txrate.mcs;break ;case RTW89_RA_RPT_MODE_HE : ra_report->txrate.flags |=RATE_INFO_FLAGS_HE_MCS ; - ra_report->txrate.mcs =FIELD_GET (RTW89_RA_RATE_MASK_MCS , rate); - ra_report->txrate.nss =FIELD_GET (RTW89_RA_RATE_MASK_NSS , rate) +1 ; + ra_report->txrate.mcs = format_v1 ? +u8_get_bits (rate,RTW89_RA_RATE_MASK_MCS_V1 ) : +u8_get_bits (rate,RTW89_RA_RATE_MASK_MCS ); + ra_report->txrate.nss = format_v1 ? +u8_get_bits (rate,RTW89_RA_RATE_MASK_NSS_V1 ) +1 : +u8_get_bits (rate,RTW89_RA_RATE_MASK_NSS ) +1 ;if (giltf ==RTW89_GILTF_2XHE08 || giltf ==RTW89_GILTF_1XHE08 ) ra_report->txrate.he_gi =NL80211_RATE_INFO_HE_GI_0_8 ;else if (giltf ==RTW89_GILTF_2XHE16 || giltf ==RTW89_GILTF_1XHE16 )
@@ -2309,8 +2329,11 @@ static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta) ra_report->txrate.bw =rtw89_hw_to_rate_info_bw (bw); ra_report->bit_rate =cfg80211_calculate_bitrate (&ra_report->txrate); - ra_report->hw_rate =FIELD_PREP (RTW89_HW_RATE_MASK_MOD , mode) | -FIELD_PREP (RTW89_HW_RATE_MASK_VAL , rate); + ra_report->hw_rate = format_v1 ? +u16_encode_bits (mode,RTW89_HW_RATE_V1_MASK_MOD ) | +u16_encode_bits (rate,RTW89_HW_RATE_V1_MASK_VAL ) : +u16_encode_bits (mode,RTW89_HW_RATE_MASK_MOD ) | +u16_encode_bits (rate,RTW89_HW_RATE_MASK_VAL ); ra_report->might_fallback_legacy = mcs <=2 ; sta->deflink.agg.max_rc_amsdu_len =get_max_amsdu_len (rtwdev, ra_report); rtwsta->max_agg_wait = sta->deflink.agg.max_rc_amsdu_len /1500 -1 ;
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 9/10 wifi: rtw89: add to display hardware rates v1 histogram in debugfs
In reply to Ping-Ke ShihThe upcoming WiFi 7 chips support EHT rates, and hardware rate codes are changed too, so modify to adapt the changes. (EHT counters are still zeros in below example)
RX count:
Legacy: [0, 0, 0, 0]
OFDM: [0, 0, 0, 0, 0, 0, 0, 0]
HT 0: [0, 0, 0, 0, 0, 0, 0, 0]
HT 1: [0, 0, 0, 0, 0, 0, 0, 0] VHT 1SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0] VHT 2SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0]
HE 1SS: [0, 0, 42, 0, 43, 90, 75, 0, 26, 20, 260, 7] HE 2SS: [0, 96, 232, 84, 125, 184, 52, 0, 0, 0, 0, 0]
EHT 1SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0] EHT 2SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
--- drivers/net/wireless/realtek/rtw89/core.h | 1 + drivers/net/wireless/realtek/rtw89/debug.c | 35 +++++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-)
drivers/net/wireless/realtek/rtw89/core.h +1 -0
@@ -584,6 +584,7 @@ enum rtw89_hw_rate {RTW89_HW_RATE_V1_EHT_NSS4_MCS13 =0x46D ,RTW89_HW_RATE_NR , +RTW89_HW_RATE_INVAL ,RTW89_HW_RATE_MASK_MOD =GENMASK (8 ,7 ), RTW89_HW_RATE_MASK_VAL = GENMASK(6, 0),
drivers/net/wireless/realtek/rtw89/debug.c +24 -11
@@ -3325,20 +3325,26 @@ rtw89_debug_append_rx_rate(struct seq_file *m, struct rtw89_pkt_stat *pkt_stat, pkt_stat->rx_rate_cnt[first_rate + i]); } +#define FIRST_RATE_SAME (rate) {RTW89_HW_RATE_ ## rate, RTW89_HW_RATE_ ## rate} +#define FIRST_RATE_ENUM (rate) {RTW89_HW_RATE_ ## rate, RTW89_HW_RATE_V1_ ## rate} +#define FIRST_RATE_GEV1 (rate) {RTW89_HW_RATE_INVAL, RTW89_HW_RATE_V1_ ## rate} +static const struct rtw89_rx_rate_cnt_info { -enum rtw89_hw_rate first_rate; +enum rtw89_hw_rate first_rate[RTW89_CHIP_GEN_NUM ];int len;int ext;const char *rate_mode; } rtw89_rx_rate_cnt_infos[] = { - {RTW89_HW_RATE_CCK1 ,4 ,0 ,"Legacy:" }, - {RTW89_HW_RATE_OFDM6 ,8 ,0 ,"OFDM:" }, - {RTW89_HW_RATE_MCS0 ,8 ,0 ,"HT 0:" }, - {RTW89_HW_RATE_MCS8 ,8 ,0 ,"HT 1:" }, - {RTW89_HW_RATE_VHT_NSS1_MCS0 ,10 ,2 ,"VHT 1SS:" }, - {RTW89_HW_RATE_VHT_NSS2_MCS0 ,10 ,2 ,"VHT 2SS:" }, - {RTW89_HW_RATE_HE_NSS1_MCS0 ,12 ,0 ,"HE 1SS:" }, - {RTW89_HW_RATE_HE_NSS2_MCS0 ,12 ,0 ,"HE 2ss:" }, + {FIRST_RATE_SAME (CCK1 ),4 ,0 ,"Legacy:" }, + {FIRST_RATE_SAME (OFDM6 ),8 ,0 ,"OFDM:" }, + {FIRST_RATE_ENUM (MCS0 ),8 ,0 ,"HT 0:" }, + {FIRST_RATE_ENUM (MCS8 ),8 ,0 ,"HT 1:" }, + {FIRST_RATE_ENUM (VHT_NSS1_MCS0 ),10 ,2 ,"VHT 1SS:" }, + {FIRST_RATE_ENUM (VHT_NSS2_MCS0 ),10 ,2 ,"VHT 2SS:" }, + {FIRST_RATE_ENUM (HE_NSS1_MCS0 ),12 ,0 ,"HE 1SS:" }, + {FIRST_RATE_ENUM (HE_NSS2_MCS0 ),12 ,0 ,"HE 2SS:" }, + {FIRST_RATE_GEV1 (EHT_NSS1_MCS0 ),14 ,2 ,"EHT 1SS:" }, + {FIRST_RATE_GEV1 (EHT_NSS2_MCS0 ),14 ,0 ,"EHT 2SS:" }, };static int rtw89_debug_priv_phy_info_get (struct seq_file *m,void *v)
@@ -3347,7 +3353,9 @@ static int rtw89_debug_priv_phy_info_get(struct seq_file *m, void *v)struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;struct rtw89_traffic_stats *stats = &rtwdev->stats;struct rtw89_pkt_stat *pkt_stat = &rtwdev->phystat.last_pkt_stat; +const struct rtw89_chip_info *chip = rtwdev->chip;const struct rtw89_rx_rate_cnt_info *info; +enum rtw89_hw_rate first_rate;int i; seq_printf(m, "TP TX: %u [%u] Mbps (lv: %d), RX: %u [%u] Mbps (lv: %d)\n",
@@ -3359,15 +3367,20 @@ static int rtw89_debug_priv_phy_info_get(struct seq_file *m, void *v) stats->rx_avg_len);seq_puts (m,"RX count:\n" ); +for (i =0 ; i <ARRAY_SIZE (rtw89_rx_rate_cnt_infos); i++) { info = &rtw89_rx_rate_cnt_infos[i]; + first_rate = info->first_rate[chip->chip_gen]; +if (first_rate >=RTW89_HW_RATE_NR ) +continue ; +seq_printf (m,"%10s [" , info->rate_mode);rtw89_debug_append_rx_rate (m, pkt_stat, - info->first_rate, info->len); + first_rate, info->len);if (info->ext) {seq_puts (m,"][" );rtw89_debug_append_rx_rate (m, pkt_stat, - info->first_rate + info->len, info->ext); + first_rate + info->len, info->ext); }seq_puts (m,"]\n" ); }
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 10/10 wifi: rtw89: get data rate mode/NSS/MCS v1 from RX descriptor
In reply to Ping-Ke ShihThe data rate from RX descriptor also uses hardware rate v1 for WiFi 7 chips. The rate code contains three parts -- mode, NSS and MCS. For CCK/OFDM/HT rates, NSS/MCS parts are the same as before. VHT/HE/EHT rates are changed and listed as below:
mode NSS MCS V0 [8:7] [6:4] [3:0] V1 [10:8] [7:5] [4:0]
--- drivers/net/wireless/realtek/rtw89/core.c | 24 ++++++------ drivers/net/wireless/realtek/rtw89/phy.c | 2 +- drivers/net/wireless/realtek/rtw89/txrx.h | 47 ++++++++++++++++++++--- 3 files changed, 55 insertions(+), 18 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +12 -12
@@ -1456,16 +1456,16 @@ static bool rtw89_core_rx_ppdu_match(struct rtw89_dev *rtwdev,bool ret; data_rate = desc_info->data_rate; - data_rate_mode =GET_DATA_RATE_MODE (data_rate); + data_rate_mode =rtw89_get_data_rate_mode (rtwdev, data_rate);if (data_rate_mode ==DATA_RATE_MODE_NON_HT ) { - rate_idx =GET_DATA_RATE_NOT_HT_IDX (data_rate); + rate_idx =rtw89_get_data_not_ht_idx (rtwdev, data_rate);/* rate_idx is still hardware value here */ }else if (data_rate_mode ==DATA_RATE_MODE_HT ) { - rate_idx =GET_DATA_RATE_HT_IDX (data_rate); + rate_idx =rtw89_get_data_ht_mcs (rtwdev, data_rate); }else if (data_rate_mode ==DATA_RATE_MODE_VHT ) { - rate_idx =GET_DATA_RATE_VHT_HE_IDX (data_rate); + rate_idx =rtw89_get_data_mcs (rtwdev, data_rate); }else if (data_rate_mode ==DATA_RATE_MODE_HE ) { - rate_idx =GET_DATA_RATE_VHT_HE_IDX (data_rate); + rate_idx =rtw89_get_data_mcs (rtwdev, data_rate); }else {rtw89_warn (rtwdev,"invalid RX rate mode %d\n" , data_rate_mode); }
@@ -1929,26 +1929,26 @@ static void rtw89_core_update_rx_status(struct rtw89_dev *rtwdev, rx_status->bw =rtw89_hw_to_rate_info_bw (desc_info->bw); data_rate = desc_info->data_rate; - data_rate_mode =GET_DATA_RATE_MODE (data_rate); + data_rate_mode =rtw89_get_data_rate_mode (rtwdev, data_rate);if (data_rate_mode ==DATA_RATE_MODE_NON_HT ) { rx_status->encoding =RX_ENC_LEGACY ; - rx_status->rate_idx =GET_DATA_RATE_NOT_HT_IDX (data_rate); + rx_status->rate_idx =rtw89_get_data_not_ht_idx (rtwdev, data_rate);/* convert rate_idx after we get the correct band */ }else if (data_rate_mode ==DATA_RATE_MODE_HT ) { rx_status->encoding =RX_ENC_HT ; - rx_status->rate_idx =GET_DATA_RATE_HT_IDX (data_rate); + rx_status->rate_idx =rtw89_get_data_ht_mcs (rtwdev, data_rate);if (desc_info->gi_ltf) rx_status->enc_flags |=RX_ENC_FLAG_SHORT_GI ; }else if (data_rate_mode ==DATA_RATE_MODE_VHT ) { rx_status->encoding =RX_ENC_VHT ; - rx_status->rate_idx =GET_DATA_RATE_VHT_HE_IDX (data_rate); - rx_status->nss =GET_DATA_RATE_NSS (data_rate) +1 ; + rx_status->rate_idx =rtw89_get_data_mcs (rtwdev, data_rate); + rx_status->nss =rtw89_get_data_nss (rtwdev, data_rate) +1 ;if (desc_info->gi_ltf) rx_status->enc_flags |=RX_ENC_FLAG_SHORT_GI ; }else if (data_rate_mode ==DATA_RATE_MODE_HE ) { rx_status->encoding =RX_ENC_HE ; - rx_status->rate_idx =GET_DATA_RATE_VHT_HE_IDX (data_rate); - rx_status->nss =GET_DATA_RATE_NSS (data_rate) +1 ; + rx_status->rate_idx =rtw89_get_data_mcs (rtwdev, data_rate); + rx_status->nss =rtw89_get_data_nss (rtwdev, data_rate) +1 ; }else {rtw89_warn (rtwdev,"invalid RX rate mode %d\n" , data_rate_mode); }
drivers/net/wireless/realtek/rtw89/phy.c +1 -1
@@ -3014,7 +3014,7 @@ static void rtw89_phy_antdiv_sts_instance_add(struct rtw89_dev *rtwdev,struct rtw89_rx_phy_ppdu *phy_ppdu, struct rtw89_antdiv_stats *stats) { - if (GET_DATA_RATE_MODE(phy_ppdu->rate) == DATA_RATE_MODE_NON_HT) { + if (rtw89_get_data_rate_mode(rtwdev, phy_ppdu->rate) == DATA_RATE_MODE_NON_HT) { if (phy_ppdu->rate < RTW89_HW_RATE_OFDM6) { ewma_rssi_add(&stats->cck_rssi_avg, phy_ppdu->rssi_avg); stats->pkt_cnt_cck++;
drivers/net/wireless/realtek/rtw89/txrx.h +42 -5
61 lines not on this page · raw message
Signature · 1 line
2.25.1