rtw88: minor throughput improvement
v3 cover rtw88: minor throughput improvement
From: Yan-Hsuan Chuang <[email protected]>
This patchset mainly adds support for beamforming and power tracking. Power tracking can monitor the thermal value of the device and adjust corresponding power indexes, to make sure the RF output power is expected.
And another thing is to add a debugfs for physical layer information. This is useful when sometimes the environment is too harsh for the device, and provides the activities for us to debug.
v1 -> v2
* Do not use cast on "const" pointers
* Add macros for checking current band, also used in power tracking
* Some refinement for power tracking
* Remove regulatory's module parameter for user's hint, and enable it by choosing the Kconfig
* Add some description for beamforming module parameter
v2 -> v3
* more refinement for magic numbers
* split patch set, remove regulatory patch, for further discussion
Tsang-Shian Lin (1):
rtw88: add phy_info debugfs to show Tx/Rx physical status
Tzu-En Huang (3):
rtw88: add power tracking support
rtw88: Enable 802.11ac beamformee support
rtw88: add set_bitrate_mask support
Yan-Hsuan Chuang (1):
rtw88: use macro to check the current band
drivers/net/wireless/realtek/rtw88/Makefile | 1 + drivers/net/wireless/realtek/rtw88/bf.c | 400 +++++++++++++++ drivers/net/wireless/realtek/rtw88/bf.h | 92 ++++ drivers/net/wireless/realtek/rtw88/debug.c | 174 ++++++- drivers/net/wireless/realtek/rtw88/debug.h | 1 + drivers/net/wireless/realtek/rtw88/fw.c | 1 + drivers/net/wireless/realtek/rtw88/mac.c | 2 +- drivers/net/wireless/realtek/rtw88/mac80211.c | 64 +++ drivers/net/wireless/realtek/rtw88/main.c | 153 +++++- drivers/net/wireless/realtek/rtw88/main.h | 166 ++++++- drivers/net/wireless/realtek/rtw88/phy.c | 137 +++++- drivers/net/wireless/realtek/rtw88/phy.h | 12 + drivers/net/wireless/realtek/rtw88/reg.h | 1 + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 461 +++++++++++++++++- drivers/net/wireless/realtek/rtw88/rtw8822b.h | 12 + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 351 ++++++++++++- drivers/net/wireless/realtek/rtw88/rtw8822c.h | 12 + drivers/net/wireless/realtek/rtw88/rx.c | 69 ++- 18 files changed, 2027 insertions(+), 82 deletions(-) create mode 100644 drivers/net/wireless/realtek/rtw88/bf.c create mode 100644 drivers/net/wireless/realtek/rtw88/bf.h
Signature · 1 line
2.17.1
PATCH v3 1/5 rtw88: use macro to check the current band
From: Yan-Hsuan Chuang <[email protected]>
Add macros to see which band we are, based on the current channel.
---
v2 -> v3
* no change
drivers/net/wireless/realtek/rtw88/mac.c | 2 +- drivers/net/wireless/realtek/rtw88/main.h | 13 ++++++ drivers/net/wireless/realtek/rtw88/phy.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 40 +++++++++---------- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 16 ++++---- 5 files changed, 41 insertions(+), 32 deletions(-)
drivers/net/wireless/realtek/rtw88/mac.c +1 -1
@@ -47,7 +47,7 @@ void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw, value8 =rtw_read8 (rtwdev,REG_CCK_CHECK ); value8 = value8 & ~BIT_CHECK_CCK_EN ; -if (channel >35 ) +if (IS_CH_5G_BAND (channel)) value8 |=BIT_CHECK_CCK_EN ;rtw_write8 (rtwdev,REG_CCK_CHECK , value8); }
drivers/net/wireless/realtek/rtw88/main.h +13 -0
@@ -58,6 +58,19 @@ struct rtw_hci {u8 bulkout_num; }; +#define IS_CH_5G_BAND_1 (channel) ((channel) >= 36 && (channel <= 48)) +#define IS_CH_5G_BAND_2 (channel) ((channel) >= 52 && (channel <= 64)) +#define IS_CH_5G_BAND_3 (channel) ((channel) >= 100 && (channel <= 144)) +#define IS_CH_5G_BAND_4 (channel) ((channel) >= 149 && (channel <= 177)) + +#define IS_CH_5G_BAND_MID (channel) \ + (IS_CH_5G_BAND_2(channel) || IS_CH_5G_BAND_3(channel)) + +#define IS_CH_2G_BAND (channel) ((channel) <= 14) +#define IS_CH_5G_BAND (channel) \ + (IS_CH_5G_BAND_1(channel) || IS_CH_5G_BAND_2(channel) || \ + IS_CH_5G_BAND_3(channel) || IS_CH_5G_BAND_4(channel)) +enum rtw_supported_band {RTW_BAND_2G =1 <<0 ,RTW_BAND_5G =1 <<1 ,
drivers/net/wireless/realtek/rtw88/phy.c +1 -1
@@ -1748,7 +1748,7 @@ void rtw_get_tx_power_params(struct rtw_dev *rtwdev, u8 path, u8 rate, u8 bw, group =rtw_get_channel_group (ch);/* base power index for 2.4G/5G */ -if (ch <=14 ) { +if (IS_CH_2G_BAND (ch)) { band =PHY_BAND_2G ; *base = rtw_phy_get_2g_tx_power_index(rtwdev, &pwr_idx->pwr_idx_2g,
drivers/net/wireless/realtek/rtw88/rtw8822b.c +18 -22
@@ -211,9 +211,8 @@ static int rtw8822b_mac_init(struct rtw_dev *rtwdev)static void rtw8822b_set_channel_rfe_efem (struct rtw_dev *rtwdev,u8 channel) {struct rtw_hal *hal = &rtwdev->hal; -bool is_channel_2g = (channel <=14 ) ? true : false; -if (is_channel_2g) { +if (IS_CH_2G_BAND (channel)) {rtw_write32s_mask (rtwdev,REG_RFESEL0 ,0xffffff ,0x705770 );rtw_write32s_mask (rtwdev,REG_RFESEL8 ,MASKBYTE1 ,0x57 );rtw_write32s_mask (rtwdev,REG_RFECTL ,BIT (4 ),0 );
@@ -241,9 +240,8 @@ static void rtw8822b_set_channel_rfe_efem(struct rtw_dev *rtwdev, u8 channel)static void rtw8822b_set_channel_rfe_ifem (struct rtw_dev *rtwdev,u8 channel) {struct rtw_hal *hal = &rtwdev->hal; -bool is_channel_2g = (channel <=14 ) ? true : false; -if (is_channel_2g) { +if (IS_CH_2G_BAND (channel)) {/* signal source */ rtw_write32s_mask (rtwdev,REG_RFESEL0 ,0xffffff ,0x745774 );rtw_write32s_mask (rtwdev,REG_RFESEL8 ,MASKBYTE1 ,0x57 );
@@ -255,7 +253,7 @@ static void rtw8822b_set_channel_rfe_ifem(struct rtw_dev *rtwdev, u8 channel)rtw_write32s_mask (rtwdev,REG_RFEINV ,BIT (11 ) |BIT (10 ) |0x3f ,0x0 ); -if (is_channel_2g) { +if (IS_CH_2G_BAND (channel)) {if (hal->antenna_rx ==BB_PATH_AB || hal->antenna_tx ==BB_PATH_AB ) {/* 2TX or 2RX */
@@ -350,7 +348,7 @@ static void rtw8822b_set_channel_cca(struct rtw_dev *rtwdev, u8 channel, u8 bw,u32 reg82c, reg830, reg838;bool is_efem_cca = false, is_ifem_cca = false, is_rfe_type = false; -if (channel <=14 ) { +if (IS_CH_2G_BAND (channel)) { cca_ccut = rfe_info->cca_ccut_2g; if (hal->antenna_rx == BB_PATH_A ||
@@ -381,7 +379,7 @@ static void rtw8822b_set_channel_cca(struct rtw_dev *rtwdev, u8 channel, u8 bw, is_efem_cca = true;break ;case RTW_RFE_IFEM2G_EFEM5G : -if (channel <=14 ) +if (IS_CH_2G_BAND (channel)) is_ifem_cca = true;else is_efem_cca = true;
@@ -405,9 +403,7 @@ static void rtw8822b_set_channel_cca(struct rtw_dev *rtwdev, u8 channel, u8 bw,if (is_efem_cca && !(hal->cut_version ==RTW_CHIP_VER_CUT_B ))rtw_write32_mask (rtwdev,REG_L1WT ,MASKDWORD ,0x9194b2b9 ); -if (bw ==RTW_CHANNEL_WIDTH_20 && - ((channel >=52 && channel <=64 ) || - (channel >=100 && channel <=144 ))) +if (bw ==RTW_CHANNEL_WIDTH_20 &&IS_CH_5G_BAND_MID (channel))rtw_write32_mask (rtwdev,REG_CCA2ND ,0xf0 ,0x4 ); }
@@ -442,7 +438,7 @@ static void rtw8822b_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw) rf_reg18 &= ~(RF18_BAND_MASK |RF18_CHANNEL_MASK |RF18_RFSI_MASK |RF18_BW_MASK ); - rf_reg18 |= (channel <=14 ?RF18_BAND_2G :RF18_BAND_5G ); + rf_reg18 |= (IS_CH_2G_BAND (channel) ?RF18_BAND_2G :RF18_BAND_5G ); rf_reg18 |= (channel &RF18_CHANNEL_MASK );if (channel >144 ) rf_reg18 |=RF18_RFSI_GT_CH144 ;
@@ -464,13 +460,13 @@ static void rtw8822b_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)break ; } -if (channel <=14 ) +if (IS_CH_2G_BAND (channel)) rf_reg_be =0x0 ; -else if (channel >=36 && channel <=64 ) +else if (IS_CH_5G_BAND_1 (channel) ||IS_CH_5G_BAND_2 (channel)) rf_reg_be = low_band[(channel -36 ) >>1 ]; -else if (channel >=100 && channel <=144 ) +else if (IS_CH_5G_BAND_3 (channel)) rf_reg_be = middle_band[(channel -100 ) >>1 ]; -else if (channel >=149 && channel <=177 ) +else if (IS_CH_5G_BAND_4 (channel)) rf_reg_be = high_band[(channel -149 ) >>1 ];else goto err;
@@ -539,7 +535,7 @@ static void rtw8822b_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw,u8 rfe_option = efuse->rfe_option;u32 val32; -if (channel <=14 ) { +if (IS_CH_2G_BAND (channel)) {rtw_write32_mask (rtwdev,REG_RXPSEL ,BIT (28 ),0x1 );rtw_write32_mask (rtwdev,REG_CCK_CHECK ,BIT (7 ),0x0 );rtw_write32_mask (rtwdev,REG_ENTXCCK ,BIT (18 ),0x0 );
@@ -556,22 +552,22 @@ static void rtw8822b_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw, }rtw_write32_mask (rtwdev,REG_RFEINV ,0x300 ,0x2 ); - }else if (channel >35 ) { + }else if (IS_CH_5G_BAND (channel)) {rtw_write32_mask (rtwdev,REG_ENTXCCK ,BIT (18 ),0x1 );rtw_write32_mask (rtwdev,REG_CCK_CHECK ,BIT (7 ),0x1 );rtw_write32_mask (rtwdev,REG_RXPSEL ,BIT (28 ),0x0 );rtw_write32_mask (rtwdev,REG_RXCCAMSK ,0x0000FC00 ,34 ); -if (channel >=36 && channel <=64 ) +if (IS_CH_5G_BAND_1 (channel) ||IS_CH_5G_BAND_2 (channel))rtw_write32_mask (rtwdev,REG_ACGG2TBL ,0x1f ,0x1 ); -else if (channel >=100 && channel <=144 ) +else if (IS_CH_5G_BAND_3 (channel))rtw_write32_mask (rtwdev,REG_ACGG2TBL ,0x1f ,0x2 ); -else if (channel >=149 ) +else if (IS_CH_5G_BAND_4 (channel))rtw_write32_mask (rtwdev,REG_ACGG2TBL ,0x1f ,0x3 ); -if (channel >=36 && channel <=48 ) +if (IS_CH_5G_BAND_1 (channel))rtw_write32_mask (rtwdev,REG_CLKTRK ,0x1ffe0000 ,0x494 ); -else if (channel >=52 && channel <=64 ) +else if (IS_CH_5G_BAND_2 (channel))rtw_write32_mask (rtwdev,REG_CLKTRK ,0x1ffe0000 ,0x453 );else if (channel >=100 && channel <=116 )rtw_write32_mask (rtwdev,REG_CLKTRK ,0x1ffe0000 ,0x452 );
drivers/net/wireless/realtek/rtw88/rtw8822c.c +8 -8
@@ -1287,11 +1287,11 @@ static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw) rf_reg18 &= ~(RF18_BAND_MASK |RF18_CHANNEL_MASK |RF18_RFSI_MASK |RF18_BW_MASK ); - rf_reg18 |= (channel <=14 ?RF18_BAND_2G :RF18_BAND_5G ); + rf_reg18 |= (IS_CH_2G_BAND (channel) ?RF18_BAND_2G :RF18_BAND_5G ); rf_reg18 |= (channel &RF18_CHANNEL_MASK ); -if (channel >144 ) +if (IS_CH_5G_BAND_4 (channel)) rf_reg18 |=RF18_RFSI_GT_CH140 ; -else if (channel >=80 ) +else if (IS_CH_5G_BAND_3 (channel)) rf_reg18 |=RF18_RFSI_GE_CH80 ;switch (bw) {
@@ -1341,7 +1341,7 @@ static void rtw8822c_toggle_igi(struct rtw_dev *rtwdev)static void rtw8822c_set_channel_bb (struct rtw_dev *rtwdev,u8 channel,u8 bw,u8 primary_ch_idx) { -if (channel <=14 ) { +if (IS_CH_2G_BAND (channel)) {rtw_write32_clr (rtwdev,REG_BGCTRL ,BITS_RX_IQ_WEIGHT );rtw_write32_mask (rtwdev,REG_RXCCKSEL ,0xf0000000 ,0x8 );rtw_write32_set (rtwdev,REG_TXF4 ,BIT (20 ));
@@ -1406,7 +1406,7 @@ static void rtw8822c_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw,rtw_write32_mask (rtwdev,REG_TXDFIR0 ,0x70 ,0x3 ); else rtw_write32_mask(rtwdev, REG_TXDFIR0, 0x70, 0x1); - } else if (channel > 35) { + } else if (IS_CH_5G_BAND(channel)) {rtw_write32_set (rtwdev,REG_CCKTXONLY ,BIT_BB_CCK_CHECK_EN );rtw_write32_set (rtwdev,REG_CCK_CHECK ,BIT_CHECK_CCK_EN );rtw_write32_set (rtwdev,REG_BGCTRL ,BITS_RX_IQ_WEIGHT );
@@ -1414,17 +1414,17 @@ static void rtw8822c_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw,rtw_write32_mask (rtwdev,REG_RXCCKSEL ,0xf0000000 ,0x0 );rtw_write32_mask (rtwdev,REG_CCAMSK ,0x3F000000 ,0x22 );rtw_write32_mask (rtwdev,REG_TXDFIR0 ,0x70 ,0x3 ); -if (channel >=36 && channel <=64 ) { +if (IS_CH_5G_BAND_1 (channel) ||IS_CH_5G_BAND_2 (channel)) {rtw_write32_mask (rtwdev,REG_RXAGCCTL0 ,BITS_RXAGC_OFDM ,0x1 );rtw_write32_mask (rtwdev,REG_RXAGCCTL ,BITS_RXAGC_OFDM ,0x1 ); - }else if (channel >=100 && channel <=144 ) { + }else if (IS_CH_5G_BAND_3 (channel)) {rtw_write32_mask (rtwdev,REG_RXAGCCTL0 ,BITS_RXAGC_OFDM ,0x2 );rtw_write32_mask (rtwdev,REG_RXAGCCTL ,BITS_RXAGC_OFDM ,0x2 ); - }else if (channel >=149 ) { + }else if (IS_CH_5G_BAND_4 (channel)) {rtw_write32_mask (rtwdev,REG_RXAGCCTL0 ,BITS_RXAGC_OFDM ,0x3 ); rtw_write32_mask(rtwdev, REG_RXAGCCTL, BITS_RXAGC_OFDM,
Signature · 1 line
2.17.1
Re: [PATCH v3 1/5] rtw88: use macro to check the current band
Quoted 5 lines · <[email protected]> wrote:
From: Yan-Hsuan Chuang <[email protected]>
Add macros to see which band we are, based on the current channel.
Signed-off-by Yan-Hsuan Chuang <[email protected]>
5 patches applied to wireless-drivers-next.git, thanks.
8575b534b000 rtw88: use macro to check the current band c97ee3e0bea2 rtw88: add power tracking support0bd9557341b7 rtw88: Enable 802.11ac beamformee support f39e9bd49a3d rtw88: add set_bitrate_mask support 082a36dc9995 rtw88: add phy_info debugfs to show Tx/Rx physical status
Signature · 3 lines
https://patchwork.kernel.org/patch/11204137/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH v3 2/5 rtw88: add power tracking support
In reply to [email protected]From: Tzu-En Huang <[email protected]>
The temperature of the chip can affect the output power of the RF components. Hence driver requires to compensate the power by adjusting the power index recorded in the power swing table.
And if the difference of current thermal value to the default thermal value exceeds a threshold, the RF IQK should be triggered to re-calibrate the characteristics of the RF components, to keep the output IQ vectors of the RF components orthogonal enough.
---
v1 -> v2
* Use macros to check current band
* Some coding style refinement
* Not casting "const" pointers
v2 -> v3
* Use RF_PATH_* for thermal values
drivers/net/wireless/realtek/rtw88/fw.c | 1 + drivers/net/wireless/realtek/rtw88/main.h | 49 ++- drivers/net/wireless/realtek/rtw88/phy.c | 126 +++++++ drivers/net/wireless/realtek/rtw88/phy.h | 12 + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 330 ++++++++++++++++++ drivers/net/wireless/realtek/rtw88/rtw8822c.c | 228 ++++++++++++ 6 files changed, 745 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/fw.c +1 -0
@@ -117,6 +117,7 @@ static void rtw_fw_ra_report_handle(struct rtw_dev *rtwdev, u8 *payload,if (WARN (length <7 ,"invalid ra report c2h length\n" ))return ; + rtwdev->dm_info.tx_rate =GET_RA_REPORT_RATE (payload); ra_data.rtwdev = rtwdev; ra_data.payload = payload;rtw_iterate_stas_atomic (rtwdev, rtw_fw_ra_report_iter, &ra_data);
drivers/net/wireless/realtek/rtw88/main.h +48 -1
85 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/phy.c +126 -0
141 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/phy.h +12 -0
@@ -41,9 +41,21 @@ void rtw_phy_cfg_rf(struct rtw_dev *rtwdev, const struct rtw_table *tbl, u32 addr, u32 data);void rtw_phy_init_tx_power (struct rtw_dev *rtwdev);void rtw_phy_load_tables (struct rtw_dev *rtwdev); +u8 rtw_phy_get_tx_power_index (struct rtw_dev *rtwdev,u8 rf_path,u8 rate, +enum rtw_bandwidth bw,u8 channel,u8 regd);void rtw_phy_set_tx_power_level (struct rtw_dev *rtwdev,u8 channel);void rtw_phy_tx_power_by_rate_config (struct rtw_hal *hal);void rtw_phy_tx_power_limit_config (struct rtw_hal *hal); +void rtw_phy_pwrtrack_avg (struct rtw_dev *rtwdev,u8 thermal,u8 path); +bool rtw_phy_pwrtrack_thermal_changed (struct rtw_dev *rtwdev,u8 thermal, +u8 path); +u8 rtw_phy_pwrtrack_get_delta (struct rtw_dev *rtwdev,u8 path); +s8 rtw_phy_pwrtrack_get_pwridx (struct rtw_dev *rtwdev, +struct rtw_swing_table *swing_table, +u8 tbl_path,u8 therm_path,u8 delta); +bool rtw_phy_pwrtrack_need_iqk (struct rtw_dev *rtwdev); +void rtw_phy_config_swing_table (struct rtw_dev *rtwdev, +struct rtw_swing_table *swing_table);struct rtw_txpwr_lmt_cfg_pair {u8 regd;
drivers/net/wireless/realtek/rtw88/rtw8822b.c +330 -0
372 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/rtw8822c.c +228 -0
270 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v3 2/5] rtw88: add power tracking support
Quoted 75 lines · On Tue, Oct 22, 2019 at 6:04 PM <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
The temperature of the chip can affect the output power of the RF components. Hence driver requires to compensate the power by adjusting the power index recorded in the power swing table.
And if the difference of current thermal value to the default thermal value exceeds a threshold, the RF IQK should be triggered to re-calibrate the characteristics of the RF components, to keep the output IQ vectors of the RF components orthogonal enough.
Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>---
v1 -> v2
* Use macros to check current band
* Some coding style refinement
* Not casting "const" pointersv2 -> v3
* Use RF_PATH_* for thermal valuesdrivers/net/wireless/realtek/rtw88/fw.c | 1 + drivers/net/wireless/realtek/rtw88/main.h | 49 ++- drivers/net/wireless/realtek/rtw88/phy.c | 126 +++++++ drivers/net/wireless/realtek/rtw88/phy.h | 12 + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 330 ++++++++++++++++++ drivers/net/wireless/realtek/rtw88/rtw8822c.c | 228 ++++++++++++ 6 files changed, 745 insertions(+), 1 deletion(-)drivers/net/wireless/realtek/rtw88/main.h +26
-0+/* This table stores the values of TX power that will be adjusted by power +* tracking. +* +* For 5G bands, there are 3 different settings. +* For 2G there are cck rate and ofdm rate with different settings. +*/ +struct rtw_pwr_track_tbl { +const u8 *pwrtrk_5gb_n[RTW_PWR_TRK_5G_NUM ]; +const u8 *pwrtrk_5gb_p[RTW_PWR_TRK_5G_NUM ]; +const u8 *pwrtrk_5ga_n[RTW_PWR_TRK_5G_NUM ]; +const u8 *pwrtrk_5ga_p[RTW_PWR_TRK_5G_NUM ]; +const u8 *pwrtrk_2gb_n; +const u8 *pwrtrk_2gb_p; +const u8 *pwrtrk_2ga_n; +const u8 *pwrtrk_2ga_p; +const u8 *pwrtrk_2g_cckb_n; +const u8 *pwrtrk_2g_cckb_p; +const u8 *pwrtrk_2g_ccka_n; +const u8 *pwrtrk_2g_ccka_p; +}; +/* hardware configuration for each IC */ struct rtw_chip_info {struct rtw_chip_ops *ops;@@ -1171,6 +1202,11 @@ struct rtw_phy_cck_pd_reg {#define DACK_MSBK_BACKUP_NUM 0xf#define DACK_DCK_BACKUP_NUM 0x2 +struct rtw_swing_table { +const u8 *p[RTW_RF_PATH_MAX ]; +const u8 *n[RTW_RF_PATH_MAX ]; +}; +struct rtw_dm_info {u32 cck_fa_cnt;u32 ofdm_fa_cnt;
drivers/net/wireless/realtek/rtw88/main.h struct rtw_dm_info { · line 1239
Quoted 7 lines
drivers/net/wireless/realtek/rtw88/main.h +4
-0@@ -1197,6 +1233,15 @@ struct rtw_dm_info {u8 cck_gi_u_bnd;u8 cck_gi_l_bnd; +u8 tx_rate; +u8 thermal_avg[RTW_RF_PATH_MAX ]; +u8 thermal_meter_k; +s8 delta_power_index[RTW_RF_PATH_MAX ];
I don't see any chance that delta_power_index[] will be < 0. Either from rtw_phy_pwrtrack_get_pwridx() or swing_table.
Maybe just use u8 instead of s8?
drivers/net/wireless/realtek/rtw88/main.h struct rtw_dm_info { · line 1243
Quoted 4 lines
drivers/net/wireless/realtek/rtw88/main.h +4
-0+s8 rtw_phy_pwrtrack_get_pwridx (struct rtw_dev *rtwdev, +struct rtw_swing_table *swing_table, +u8 tbl_path,u8 therm_path,u8 delta) +{
Same as above.
Quoted 3 lines
drivers/net/wireless/realtek/rtw88/main.h +0
-1--2.17.1
Then I think I have no problem other than above.
Chris
RE: [PATCH v3 2/5] rtw88: add power tracking support
Quoted 99 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Chiu
Sent: Tuesday, October 22, 2019 8:36 PM
To: Tony Chuang
Cc: Kalle Valo; linux-wireless; Brian Norris
Subject: Re: [PATCH v3 2/5] rtw88: add power tracking supportQuoted 23 lines · On Tue, Oct 22, 2019 at 6:04 PM <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
The temperature of the chip can affect the output power of the RF components. Hence driver requires to compensate the power by adjusting the power index recorded in the power swing table.
And if the difference of current thermal value to the default thermal value exceeds a threshold, the RF IQK should be triggered to re-calibrate the characteristics of the RF components, to keep the output IQ vectors of the RF components orthogonal enough.
Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>---
v1 -> v2
* Use macros to check current band
* Some coding style refinement
* Not casting "const" pointersQuoted 8 lines
v2 -> v3
* Use RF_PATH_* for thermal valuesdrivers/net/wireless/realtek/rtw88/fw.c | 1 + drivers/net/wireless/realtek/rtw88/main.h | 49 ++- drivers/net/wireless/realtek/rtw88/phy.c | 126 +++++++ drivers/net/wireless/realtek/rtw88/phy.h | 12 + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 330++++++++++++++++++
Review
Quoted 4 lines
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 228 ++++++++++++ 6 files changed, 745 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/wireless/realtek/rtw88/main.hQuoted 40 lines
index
492a2bfc0d5a..757b0ce2bbee100644drivers/net/wireless/realtek/rtw88/main.h +26
-0+/* This table stores the values of TX power that will be adjusted by power +* tracking. +* +* For 5G bands, there are 3 different settings. +* For 2G there are cck rate and ofdm rate with different settings. +*/ +struct rtw_pwr_track_tbl { +const u8 *pwrtrk_5gb_n[RTW_PWR_TRK_5G_NUM ]; +const u8 *pwrtrk_5gb_p[RTW_PWR_TRK_5G_NUM ]; +const u8 *pwrtrk_5ga_n[RTW_PWR_TRK_5G_NUM ]; +const u8 *pwrtrk_5ga_p[RTW_PWR_TRK_5G_NUM ]; +const u8 *pwrtrk_2gb_n; +const u8 *pwrtrk_2gb_p; +const u8 *pwrtrk_2ga_n; +const u8 *pwrtrk_2ga_p; +const u8 *pwrtrk_2g_cckb_n; +const u8 *pwrtrk_2g_cckb_p; +const u8 *pwrtrk_2g_ccka_n; +const u8 *pwrtrk_2g_ccka_p; +}; +/* hardware configuration for each IC */ struct rtw_chip_info {struct rtw_chip_ops *ops;@@ -1171,6 +1202,11 @@ struct rtw_phy_cck_pd_reg {#define DACK_MSBK_BACKUP_NUM 0xf#define DACK_DCK_BACKUP_NUM 0x2 +struct rtw_swing_table { +const u8 *p[RTW_RF_PATH_MAX ]; +const u8 *n[RTW_RF_PATH_MAX ]; +}; +struct rtw_dm_info {u32 cck_fa_cnt;u32 ofdm_fa_cnt;drivers/net/wireless/realtek/rtw88/main.h struct rtw_dm_info { · line 1239
Quoted 7 lines
drivers/net/wireless/realtek/rtw88/main.h +4
-0@@ -1197,6 +1233,15 @@ struct rtw_dm_info {u8 cck_gi_u_bnd;u8 cck_gi_l_bnd; +u8 tx_rate; +u8 thermal_avg[RTW_RF_PATH_MAX ]; +u8 thermal_meter_k; +s8 delta_power_index[RTW_RF_PATH_MAX ];I don't see any chance that delta_power_index[] will be < 0. Either from
rtw_phy_pwrtrack_get_pwridx()orswing_table.
Quoted 2 lines
Maybe just use u8 instead of s8?
I think "return -delta_swing_table_idx_neg[delta];" should be stored with s8 ?
Yan-Hsuan
Re: [PATCH v3 2/5] rtw88: add power tracking support
Quoted 11 lines · Tony Chuang
Quoted 7 lines
I don't see any chance that delta_power_index[] will be < 0. Either from
rtw_phy_pwrtrack_get_pwridx()orswing_table.Maybe just use u8 instead of s8?
I think "return -delta_swing_table_idx_neg[delta];" should be stored with s8 ?
Sorry for missing that. I was somehow misled by the naming 'power_index'.
Quoted 1 line
Yan-Hsuan
Re: [PATCH v3 2/5] rtw88: add power tracking support
In reply to [email protected]Quoted 14 lines · On Tue, Oct 22, 2019 at 6:04 PM <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
The temperature of the chip can affect the output power of the RF components. Hence driver requires to compensate the power by adjusting the power index recorded in the power swing table.
And if the difference of current thermal value to the default thermal value exceeds a threshold, the RF IQK should be triggered to re-calibrate the characteristics of the RF components, to keep the output IQ vectors of the RF components orthogonal enough.
Quoted 3 lines
Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>---
Quoted 9 lines
v1 -> v2
* Use macros to check current band
* Some coding style refinement
* Not casting "const" pointersv2 -> v3
* Use RF_PATH_* for thermal values
PATCH v3 3/5 rtw88: Enable 802.11ac beamformee support
In reply to [email protected]From: Tzu-En Huang <[email protected]>
Enable MU-MIMO transmit beamformee support for chipset 8822b and 8822c.
If the driver is in station mode and associated with an AP, and the capabilities of both meet the requirement of beamforming, driver will run as a beamformee and the corresponding chip settings will be set.
In addition, module parameter support_bf is added to enable or disable beamforming. Sometimes driver will need to disable for inter-operate issues, and it would be easier for driver to debug.
---
v1 -> v2
* Not casting "const" pointers
* Add some description for having a module parameter
v2 -> v3
* some coding style refine
drivers/net/wireless/realtek/rtw88/Makefile | 1 + drivers/net/wireless/realtek/rtw88/bf.c | 400 ++++++++++++++++++ drivers/net/wireless/realtek/rtw88/bf.h | 92 ++++ drivers/net/wireless/realtek/rtw88/debug.h | 1 + drivers/net/wireless/realtek/rtw88/mac80211.c | 11 + drivers/net/wireless/realtek/rtw88/main.c | 38 ++ drivers/net/wireless/realtek/rtw88/main.h | 43 ++ drivers/net/wireless/realtek/rtw88/reg.h | 1 + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 46 ++ drivers/net/wireless/realtek/rtw88/rtw8822c.c | 59 +++ 10 files changed, 692 insertions(+) create mode 100644 drivers/net/wireless/realtek/rtw88/bf.c create mode 100644 drivers/net/wireless/realtek/rtw88/bf.h
drivers/net/wireless/realtek/rtw88/Makefile +1 -0
@@ -14,6 +14,7 @@ rtw88-y += main.o \ fw.o \ ps.o \ sec.o \ + bf.o \ regd.o rtw88-$(CONFIG_RTW88_8822BE) += rtw8822b.o rtw8822b_table.o
drivers/net/wireless/realtek/rtw88/bf.c new file +400 -0
400 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/bf.h new file +92 -0
92 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/debug.h +1 -0
@@ -17,6 +17,7 @@ enum rtw_debug_mask {RTW_DBG_REGD =0x00000100 ,RTW_DBG_DEBUGFS =0x00000200 ,RTW_DBG_PS =0x00000400 , +RTW_DBG_BF =0x00000800 , RTW_DBG_ALL = 0xffffffff };
drivers/net/wireless/realtek/rtw88/mac80211.c +11 -0
@@ -10,6 +10,7 @@#include "coex.h" #include "ps.h" #include "reg.h" +#include "bf.h" #include "debug.h" static void rtw_ops_tx(struct ieee80211_hw *hw,
@@ -157,6 +158,7 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw, rtwvif->stats.tx_cnt =0 ; rtwvif->stats.rx_cnt =0 ; rtwvif->in_lps = false; +memset (&rtwvif->bfee,0 ,sizeof (struct rtw_bfee )); rtwvif->conf = &rtw_vif_port[port];rtw_txq_init (rtwdev, vif->txq);
@@ -348,11 +350,14 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,rtw_fw_download_rsvd_page (rtwdev, vif);rtw_send_rsvd_page_h2c (rtwdev);rtw_coex_media_status_notify (rtwdev, conf->assoc); +if (rtw_bf_support) +rtw_bf_assoc (rtwdev, vif, conf); }else {rtw_leave_lps (rtwdev); net_type =RTW_NET_NO_LINK ; rtwvif->aid =0 ;rtw_reset_rsvd_page (rtwdev); +rtw_bf_disassoc (rtwdev, vif, conf); } rtwvif->net_type = net_type;
@@ -368,6 +373,12 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,if (changed &BSS_CHANGED_BEACON )rtw_fw_download_rsvd_page (rtwdev, vif); +if (changed &BSS_CHANGED_MU_GROUPS ) { +struct rtw_chip_info *chip = rtwdev->chip; + + chip->ops->set_gid_table (rtwdev, vif, conf); + } +if (changed &BSS_CHANGED_ERP_SLOT )rtw_conf_tx (rtwdev, rtwvif);
drivers/net/wireless/realtek/rtw88/main.c +38 -0
@@ -14,16 +14,20 @@#include "efuse.h" #include "tx.h" #include "debug.h" +#include "bf.h" unsigned int rtw_fw_lps_deep_mode;EXPORT_SYMBOL (rtw_fw_lps_deep_mode); +bool rtw_bf_support = true;unsigned int rtw_debug_mask;EXPORT_SYMBOL (rtw_debug_mask);module_param_named (lps_deep_mode, rtw_fw_lps_deep_mode, uint,0644 ); +module_param_named (support_bf, rtw_bf_support, bool,0644 );module_param_named (debug_mask, rtw_debug_mask, uint,0644 );MODULE_PARM_DESC (lps_deep_mode,"Deeper PS mode. If 0, deep PS is disabled" ); +MODULE_PARM_DESC (support_bf,"Set Y to enable beamformee support" );MODULE_PARM_DESC (debug_mask,"Debugging mask" );static struct ieee80211_channel rtw_channeltable_2g[] = {
@@ -126,9 +130,29 @@ static struct ieee80211_supported_band rtw_band_5ghz = { };struct rtw_watch_dog_iter_data { +struct rtw_dev *rtwdev;struct rtw_vif *rtwvif; }; +static void rtw_dynamic_csi_rate (struct rtw_dev *rtwdev,struct rtw_vif *rtwvif) +{ +struct rtw_bf_info *bf_info = &rtwdev->bf_info; +struct rtw_chip_info *chip = rtwdev->chip; +u8 fix_rate_enable =0 ; +u8 new_csi_rate_idx; + +if (rtwvif->bfee.role !=RTW_BFEE_SU && + rtwvif->bfee.role !=RTW_BFEE_MU ) +return ; + + chip->ops->cfg_csi_rate (rtwdev, rtwdev->dm_info.min_rssi, + bf_info->cur_csi_rpt_rate, + fix_rate_enable, &new_csi_rate_idx); + +if (new_csi_rate_idx != bf_info->cur_csi_rpt_rate) + bf_info->cur_csi_rpt_rate = new_csi_rate_idx; +} +static void rtw_vif_watch_dog_iter (void *data,u8 *mac,struct ieee80211_vif *vif) {
@@ -139,6 +163,8 @@ static void rtw_vif_watch_dog_iter(void *data, u8 *mac,if (vif->bss_conf.assoc) iter_data->rtwvif = rtwvif; +rtw_dynamic_csi_rate (iter_data->rtwdev, rtwvif); + rtwvif->stats.tx_unicast =0 ; rtwvif->stats.rx_unicast =0 ; rtwvif->stats.tx_cnt =0 ;
@@ -192,6 +218,7 @@ static void rtw_watch_dog_work(struct work_struct *work)rtw_phy_dynamic_mechanism (rtwdev); + data.rtwdev = rtwdev;/* use atomic version to avoid taking local->iflist_mtx mutex */ rtw_iterate_vifs_atomic (rtwdev, rtw_vif_watch_dog_iter, &data);
@@ -870,6 +897,12 @@ static void rtw_init_vht_cap(struct rtw_dev *rtwdev,IEEE80211_VHT_CAP_HTC_VHT |IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |0 ; + + vht_cap->cap |=IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | +IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE ; + vht_cap->cap |= (rtwdev->hal.bfee_sts_cap << +IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT ); + mcs_map =IEEE80211_VHT_MCS_SUPPORT_0_9 <<0 |IEEE80211_VHT_MCS_NOT_SUPPORTED <<4 | IEEE80211_VHT_MCS_NOT_SUPPORTED << 6 |
@@ -1005,6 +1038,8 @@ static int rtw_chip_parameter_setup(struct rtw_dev *rtwdev)/* default use ack */ rtwdev->hal.rcr |=BIT_VHT_DACK ; + hal->bfee_sts_cap =3 ; +return ret; }
@@ -1342,6 +1377,9 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)rtw_debugfs_init (rtwdev); + rtwdev->bf_info.bfer_mu_cnt =0 ; + rtwdev->bf_info.bfer_su_cnt =0 ; +return 0 ; }EXPORT_SYMBOL (rtw_register_hw);
drivers/net/wireless/realtek/rtw88/main.h +43 -0
85 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/reg.h +1 -0
@@ -326,6 +326,7 @@#define REG_RXFLTMAP0 0x06A0#define REG_RXFLTMAP1 0x06A2#define REG_RXFLTMAP2 0x06A4 +#define REG_RXFLTMAP4 0x068A#define REG_BT_COEX_TABLE0 0x06C0#define REG_BT_COEX_TABLE1 0x06C4#define REG_BT_COEX_BRK_TABLE 0x06C8
drivers/net/wireless/realtek/rtw88/rtw8822b.c +46 -0
82 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/rtw8822c.c +59 -0
89 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 4/5 rtw88: add set_bitrate_mask support
In reply to [email protected]From: Tzu-En Huang <[email protected]>
Support setting bit rate from upper layer.
After configuring the original rate control result in the driver, the result is then masked by the bit rate mask received from the ops set_bitrate_mask. Lastly, the masked result will be sent to firmware.
---
v1 -> v2
* No change
v2 -> v3
* use u64_encode_bits
drivers/net/wireless/realtek/rtw88/mac80211.c | 53 +++++++++++++ drivers/net/wireless/realtek/rtw88/main.c | 78 +++++++++++++++---- drivers/net/wireless/realtek/rtw88/main.h | 3 + 3 files changed, 118 insertions(+), 16 deletions(-)
drivers/net/wireless/realtek/rtw88/mac80211.c +53 -0
@@ -475,6 +475,8 @@ static int rtw_ops_sta_remove(struct ieee80211_hw *hw,for (i =0 ; i <ARRAY_SIZE (sta->txq); i++)rtw_txq_cleanup (rtwdev, sta->txq[i]); +kfree (si->mask); + rtwdev->sta_cnt--; rtw_info(rtwdev, "sta %pM with macid %d left\n",
@@ -684,6 +686,56 @@ static void rtw_ops_flush(struct ieee80211_hw *hw,mutex_unlock (&rtwdev->mutex); } +struct rtw_iter_bitrate_mask_data { +struct rtw_dev *rtwdev; +struct ieee80211_vif *vif; +const struct cfg80211_bitrate_mask *mask; +}; + +static void rtw_ra_mask_info_update_iter (void *data,struct ieee80211_sta *sta) +{ +struct rtw_iter_bitrate_mask_data *br_data = data; +struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv; + +if (si->vif != br_data->vif) +return ; + +/* free previous mask setting */ +kfree (si->mask); + si->mask =kmemdup (br_data->mask,sizeof (struct cfg80211_bitrate_mask ), +GFP_ATOMIC ); +if (!si->mask) { + si->use_cfg_mask = false; +return ; + } + + si->use_cfg_mask = true; +rtw_update_sta_info (br_data->rtwdev, si); +} + +static void rtw_ra_mask_info_update (struct rtw_dev *rtwdev, +struct ieee80211_vif *vif, +const struct cfg80211_bitrate_mask *mask) +{ +struct rtw_iter_bitrate_mask_data br_data; + + br_data.rtwdev = rtwdev; + br_data.vif = vif; + br_data.mask = mask; +rtw_iterate_stas_atomic (rtwdev, rtw_ra_mask_info_update_iter, &br_data); +} + +static int rtw_ops_set_bitrate_mask (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +const struct cfg80211_bitrate_mask *mask) +{ +struct rtw_dev *rtwdev = hw->priv; + +rtw_ra_mask_info_update (rtwdev, vif, mask); + +return 0 ; +} +const struct ieee80211_ops rtw_ops = { .tx = rtw_ops_tx, .wake_tx_queue = rtw_ops_wake_tx_queue,
@@ -705,5 +757,6 @@ const struct ieee80211_ops rtw_ops = { .set_rts_threshold = rtw_ops_set_rts_threshold, .sta_statistics = rtw_ops_sta_statistics, .flush = rtw_ops_flush, + .set_bitrate_mask = rtw_ops_set_bitrate_mask, };EXPORT_SYMBOL (rtw_ops);
drivers/net/wireless/realtek/rtw88/main.c +62 -16
95 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/main.h +3 -0
@@ -646,6 +646,9 @@ struct rtw_sta_info {DECLARE_BITMAP (tid_ba,IEEE80211_NUM_TIDS );struct rtw_ra_report ra_report; + +bool use_cfg_mask; +struct cfg80211_bitrate_mask *mask; };enum rtw_bfee_role {
Signature · 1 line
2.17.1
Re: [PATCH v3 4/5] rtw88: add set_bitrate_mask support
Quoted 37 lines · On Tue, Oct 22, 2019 at 6:04 PM <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
Support setting bit rate from upper layer.
After configuring the original rate control result in the driver, the result is then masked by the bit rate mask received from the opsset_bitrate_mask. Lastly, the masked result will be sent to firmware.Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>---
v1 -> v2
* No changev2 -> v3
* useu64_encode_bitsdrivers/net/wireless/realtek/rtw88/mac80211.c | 53 +++++++++++++ drivers/net/wireless/realtek/rtw88/main.c | 78 +++++++++++++++---- drivers/net/wireless/realtek/rtw88/main.h | 3 + 3 files changed, 118 insertions(+), 16 deletions(-)drivers/net/wireless/realtek/rtw88/mac80211.c +6
-0@@ -684,6 +686,56 @@ static void rtw_ops_flush(struct ieee80211_hw *hw,mutex_unlock (&rtwdev->mutex); } +struct rtw_iter_bitrate_mask_data { +struct rtw_dev *rtwdev; +struct ieee80211_vif *vif; +const struct cfg80211_bitrate_mask *mask; +}; +
drivers/net/wireless/realtek/rtw88/mac80211.c static void rtw_ops_flush(struct ieee80211_hw *hw, · line 704
Quoted 10 lines
drivers/net/wireless/realtek/rtw88/mac80211.c +10
-0+static void rtw_ra_mask_info_update_iter (void *data,struct ieee80211_sta *sta) +{ +struct rtw_iter_bitrate_mask_data *br_data = data; +struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv; + +if (si->vif != br_data->vif) +return ; + +/* free previous mask setting */ +kfree (si->mask);
You may want to do NULL check for si->mask before kfree.
Quoted 34 lines
drivers/net/wireless/realtek/rtw88/mac80211.c +11
-0+ si->mask =kmemdup (br_data->mask,sizeof (struct cfg80211_bitrate_mask ), +GFP_ATOMIC ); +if (!si->mask) { + si->use_cfg_mask = false; +return ; + } + + si->use_cfg_mask = true; +rtw_update_sta_info (br_data->rtwdev, si); +} +drivers/net/wireless/realtek/rtw88/main.c +15
-0@@ -612,12 +612,71 @@ static u8 get_rate_id(u8 wireless_set, enum rtw_bandwidth bw_mode, u8 tx_num)#define RA_MASK_OFDM_IN_HT_2G 0x00010#define RA_MASK_OFDM_IN_HT_5G 0x00030 +static u64 rtw_update_rate_mask (struct rtw_dev *rtwdev, +struct rtw_sta_info *si, +u64 ra_mask,bool is_vht_enable, +u8 wireless_set) +{ +struct rtw_hal *hal = &rtwdev->hal; +const struct cfg80211_bitrate_mask *mask = si->mask; +u64 cfg_mask =GENMASK (63 ,0 ); +u8 rssi_level, band; + +if (wireless_set !=WIRELESS_CCK ) { + rssi_level = si->rssi_level; +if (rssi_level ==0 ) + ra_mask &=0xffffffffffffffffULL ; +else if (rssi_level ==1 )
drivers/net/wireless/realtek/rtw88/main.c static u8 get_rate_id(u8 wireless_set, enum rtw_bandwidth bw_mode, u8 tx_num) · line 639
Quoted 10 lines
drivers/net/wireless/realtek/rtw88/main.c +10
-0+ ra_mask &=0xfffffffffffffff0ULL ; + else if (rssi_level == 2) + ra_mask &= 0xffffffffffffefe0ULL; + else if (rssi_level == 3) + ra_mask &= 0xffffffffffffcfc0ULL; + else if (rssi_level == 4) + ra_mask &= 0xffffffffffff8f80ULL; + else if (rssi_level >= 5) + ra_mask &= 0xffffffffffff0f00ULL; + }
Would be better to enumerate rssi_level instead of 0 to 5. Does level 0 means bad rssi or good?
Quoted 3 lines
drivers/net/wireless/realtek/rtw88/main.c +0
-1--2.17.1
Pkshih
maintainerRE: [PATCH v3 4/5] rtw88: add set_bitrate_mask support
Quoted 53 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Chiu
Sent: Tuesday, October 22, 2019 8:49 PM
To: Tony Chuang
Cc: Kalle Valo; linux-wireless; Brian Norris
Subject: Re: [PATCH v3 4/5] rtw88: addset_bitrate_masksupportQuoted 18 lines · On Tue, Oct 22, 2019 at 6:04 PM <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
Support setting bit rate from upper layer.
After configuring the original rate control result in the driver, the result is then masked by the bit rate mask received from the opsset_bitrate_mask. Lastly, the masked result will be sent to firmware.Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>---
v1 -> v2
* No changev2 -> v3
* useu64_encode_bitsReview
Quoted 6 lines
drivers/net/wireless/realtek/rtw88/mac80211.c | 53 +++++++++++++ drivers/net/wireless/realtek/rtw88/main.c | 78 +++++++++++++++---- drivers/net/wireless/realtek/rtw88/main.h | 3 + 3 files changed, 118 insertions(+), 16 deletions(-)(quoted diff) +0
-0
b/drivers/net/wireless/realtek/rtw88/mac80211.cQuoted 17 lines
index
bc04cc280a96..2247bd61e716100644drivers/net/wireless/realtek/rtw88/mac80211.c +10
-0@@ -684,6 +686,56 @@ static void rtw_ops_flush(struct ieee80211_hw *hw,mutex_unlock (&rtwdev->mutex); } +struct rtw_iter_bitrate_mask_data { +struct rtw_dev *rtwdev; +struct ieee80211_vif *vif; +const struct cfg80211_bitrate_mask *mask; +}; + +static void rtw_ra_mask_info_update_iter (void *data,struct ieee80211_sta *sta) +{ +struct rtw_iter_bitrate_mask_data *br_data = data; +struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv;
Quoted 8 lines
drivers/net/wireless/realtek/rtw88/mac80211.c static void rtw_ops_flush(struct ieee80211_hw *hw, · line 704
Quoted 6 lines
drivers/net/wireless/realtek/rtw88/mac80211.c +6
-0+ +if (si->vif != br_data->vif) +return ; + +/* free previous mask setting */ +kfree (si->mask);You may want to do NULL check for
si->maskbefore kfree.
kfree checks NULL by itself, and checkpatch also warns this kind of needless checking.
Quoted 54 lines
Quoted 35 lines
drivers/net/wireless/realtek/rtw88/mac80211.c +11
-0+ si->mask =kmemdup (br_data->mask,sizeof (struct cfg80211_bitrate_mask ), +GFP_ATOMIC ); +if (!si->mask) { + si->use_cfg_mask = false; +return ; + } + + si->use_cfg_mask = true; +rtw_update_sta_info (br_data->rtwdev, si); +} +drivers/net/wireless/realtek/rtw88/main.c +15
-0@@ -612,12 +612,71 @@ static u8 get_rate_id(u8 wireless_set, enum rtw_bandwidth bw_mode, u8 tx_num)#define RA_MASK_OFDM_IN_HT_2G 0x00010#define RA_MASK_OFDM_IN_HT_5G 0x00030 +static u64 rtw_update_rate_mask (struct rtw_dev *rtwdev, +struct rtw_sta_info *si, +u64 ra_mask,bool is_vht_enable, +u8 wireless_set) +{ +struct rtw_hal *hal = &rtwdev->hal; +const struct cfg80211_bitrate_mask *mask = si->mask; +u64 cfg_mask =GENMASK (63 ,0 ); +u8 rssi_level, band; + +if (wireless_set !=WIRELESS_CCK ) { + rssi_level = si->rssi_level; +if (rssi_level ==0 ) + ra_mask &=0xffffffffffffffffULL ; +else if (rssi_level ==1 )drivers/net/wireless/realtek/rtw88/main.c static u8 get_rate_id(u8 wireless_set, enum rtw_bandwidth bw_mode, u8 tx_num) · line 639
Quoted 10 lines
drivers/net/wireless/realtek/rtw88/main.c +10
-0+ ra_mask &=0xfffffffffffffff0ULL ; + else if (rssi_level == 2) + ra_mask &= 0xffffffffffffefe0ULL; + else if (rssi_level == 3) + ra_mask &= 0xffffffffffffcfc0ULL; + else if (rssi_level == 4) + ra_mask &= 0xffffffffffff8f80ULL; + else if (rssi_level >= 5) + ra_mask &= 0xffffffffffff0f00ULL; + }Would be better to enumerate
rssi_levelinstead of 0 to 5. Does level 0 means bad rssi or good?Quoted 3 lines
drivers/net/wireless/realtek/rtw88/main.c +0
-1--2.17.1
------Please consider the environment before printing this e-mail.
RE: [PATCH v3 4/5] rtw88: add set_bitrate_mask support
Quoted 80 lines
[mailto:[email protected]] On Behalf
Quoted 6 lines
Of Chris Chiu
Sent: Tuesday, October 22, 2019 8:49 PM
To: Tony Chuang
Cc: Kalle Valo; linux-wireless; Brian Norris
Subject: Re: [PATCH v3 4/5] rtw88: addset_bitrate_masksupportQuoted 21 lines
Quoted 20 lines · On Tue, Oct 22, 2019 at 6:04 PM <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
Support setting bit rate from upper layer.
After configuring the original rate control result in the driver, the result is then masked by the bit rate mask received from the opsset_bitrate_mask. Lastly, the masked result will be sent to firmware.Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>---
v1 -> v2
* No changev2 -> v3
* useu64_encode_bitsdrivers/net/wireless/realtek/rtw88/mac80211.c | 53 +++++++++++++ drivers/net/wireless/realtek/rtw88/main.c | 78+++++++++++++++----
Quoted 9 lines
Review
Quoted 4 lines
drivers/net/wireless/realtek/rtw88/main.h | 3 + 3 files changed, 118 insertions(+), 16 deletions(-)(quoted diff) +0
-0
b/drivers/net/wireless/realtek/rtw88/mac80211.cdrivers/net/wireless/realtek/rtw88/mac80211.c static void rtw_ops_flush(struct ieee80211_hw
Quoted 4 lines
index
bc04cc280a96..2247bd61e716100644drivers/net/wireless/realtek/rtw88/mac80211.c +0
-0@@ -684,6 +686,56 @@ static void rtw_ops_flush(struct ieee80211_hw*hw,
Quoted 10 lines
drivers/net/wireless/realtek/rtw88/mac80211.c static void rtw_ops_flush(struct ieee80211_hw *hw,
Quoted 10 lines
drivers/net/wireless/realtek/rtw88/mac80211.c +7
-0mutex_unlock (&rtwdev->mutex); } +struct rtw_iter_bitrate_mask_data { +struct rtw_dev *rtwdev; +struct ieee80211_vif *vif; +const struct cfg80211_bitrate_mask *mask; +}; + +static void rtw_ra_mask_info_update_iter(void *data, struct
ieee80211_sta*sta)Quoted 11 lines
drivers/net/wireless/realtek/rtw88/mac80211.c static void rtw_ops_flush(struct ieee80211_hw *hw, · line 704
Quoted 9 lines
drivers/net/wireless/realtek/rtw88/mac80211.c +9
-0+{ +struct rtw_iter_bitrate_mask_data *br_data = data; +struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv; + +if (si->vif != br_data->vif) +return ; + +/* free previous mask setting */ +kfree (si->mask);You may want to do NULL check for
si->maskbefore kfree.kfree checks NULL by itself, and checkpatch also warns this kind of needless checking.
Quoted 2 lines
drivers/net/wireless/realtek/rtw88/mac80211.c static void rtw_ops_flush(struct ieee80211_hw · line 705
Quoted 2 lines
drivers/net/wireless/realtek/rtw88/mac80211.c +1
-0+ si->mask = kmemdup(br_data->mask, sizeof(struct
cfg80211_bitrate_mask),Quoted 11 lines
Review
Quoted 11 lines
drivers/net/wireless/realtek/rtw88/mac80211.c +10
-0+ GFP_ATOMIC); +if (!si->mask) { + si->use_cfg_mask = false; +return ; + } + + si->use_cfg_mask = true; +rtw_update_sta_info (br_data->rtwdev, si); +} +(quoted diff) +0
-0
b/drivers/net/wireless/realtek/rtw88/main.c
Quoted 37 lines
Quoted 4 lines
drivers/net/wireless/realtek/rtw88/main.c static u8 get_rate_id(u8 wireless_set, enum
Quoted 4 lines
index
47e74f0aec06..e53143132a9b100644drivers/net/wireless/realtek/rtw88/main.c +0
-0@@ -612,12 +612,71 @@ static u8 get_rate_id(u8 wireless_set, enum
rtw_bandwidthbw_mode, u8tx_num)Quoted 32 lines
Quoted 18 lines
drivers/net/wireless/realtek/rtw88/main.c +15
-0#define RA_MASK_OFDM_IN_HT_2G 0x00010#define RA_MASK_OFDM_IN_HT_5G 0x00030 +static u64 rtw_update_rate_mask (struct rtw_dev *rtwdev, +struct rtw_sta_info *si, +u64 ra_mask,bool is_vht_enable, +u8 wireless_set) +{ +struct rtw_hal *hal = &rtwdev->hal; +const struct cfg80211_bitrate_mask *mask = si->mask; +u64 cfg_mask =GENMASK (63 ,0 ); +u8 rssi_level, band; + +if (wireless_set !=WIRELESS_CCK ) { + rssi_level = si->rssi_level; +if (rssi_level ==0 ) + ra_mask &=0xffffffffffffffffULL ; +else if (rssi_level ==1 )drivers/net/wireless/realtek/rtw88/main.c static u8 get_rate_id(u8 wireless_set, enum rtw_bandwidth bw_mode, u8 tx_num) · line 639
Quoted 10 lines
drivers/net/wireless/realtek/rtw88/main.c +10
-0+ ra_mask &=0xfffffffffffffff0ULL ; + else if (rssi_level == 2) + ra_mask &= 0xffffffffffffefe0ULL; + else if (rssi_level == 3) + ra_mask &= 0xffffffffffffcfc0ULL; + else if (rssi_level == 4) + ra_mask &= 0xffffffffffff8f80ULL; + else if (rssi_level >= 5) + ra_mask &= 0xffffffffffff0f00ULL; + }Would be better to enumerate
rssi_levelinstead of 0 to 5. Does level 0 means bad rssi or good?
I think 0 is the lowest level. And I think we don't need to add an enum for this kind of levels, as the number just presents the meaning of it.
Yan-Hsuan
Chris Chiu
Reviewed-byRe: [PATCH v3 4/5] rtw88: add set_bitrate_mask support
Tony Chuang <[email protected]> 於 2019年10月23日 上午10:37 寫道:
Quoted 11 lines
Quoted 11 lines
[mailto:[email protected]] On Behalf
Quoted 10 lines
Of Chris Chiu
Sent: Tuesday, October 22, 2019 8:49 PM
To: Tony Chuang
Cc: Kalle Valo; linux-wireless; Brian Norris
Subject: Re: [PATCH v3 4/5] rtw88: addset_bitrate_masksupportQuoted 4 lines · On Tue, Oct 22, 2019 at 6:04 PM <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Support setting bit rate from upper layer.
After configuring the original rate control result in the driver, the result is then masked by the bit rate mask received from the opsset_bitrate_mask. Lastly, the masked result will be sent to firmware.Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>
Quoted 38 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
---
v1 -> v2
* No changev2 -> v3
* useu64_encode_bitsdrivers/net/wireless/realtek/rtw88/main.c +21
-0+static u64 rtw_update_rate_mask (struct rtw_dev *rtwdev, +struct rtw_sta_info *si, +u64 ra_mask,bool is_vht_enable, +u8 wireless_set) +{ +struct rtw_hal *hal = &rtwdev->hal; +const struct cfg80211_bitrate_mask *mask = si->mask; +u64 cfg_mask =GENMASK (63 ,0 ); +u8 rssi_level, band; + +if (wireless_set !=WIRELESS_CCK ) { + rssi_level = si->rssi_level; +if (rssi_level ==0 ) + ra_mask &=0xffffffffffffffffULL ; +else if (rssi_level ==1 ) + ra_mask &=0xfffffffffffffff0ULL ; +else if (rssi_level ==2 ) + ra_mask &=0xffffffffffffefe0ULL ; +else if (rssi_level ==3 ) + ra_mask &=0xffffffffffffcfc0ULL ; +else if (rssi_level ==4 )Quoted 8 lines
Quoted 8 lines
drivers/net/wireless/realtek/rtw88/main.c static u8 get_rate_id(u8 wireless_set, enum rtw_bandwidth bw_mode, u8 tx_num) · line 639
Quoted 4 lines
drivers/net/wireless/realtek/rtw88/main.c +4
-0+ ra_mask &=0xffffffffffff8f80ULL ; + else if (rssi_level >= 5) + ra_mask &= 0xffffffffffff0f00ULL; + }Would be better to enumerate
rssi_levelinstead of 0 to 5. Does level 0 means bad rssi or good?
Quoted 4 lines
I think 0 is the lowest level. And I think we don't need to add an enum for this kind of levels, as the number just presents the meaning of it.
Yan-Hsuan
OK. I think it also makes sense to me.
Chris
PATCH v3 5/5 rtw88: add phy_info debugfs to show Tx/Rx physical status
In reply to [email protected]From: Tsang-Shian Lin <[email protected]>
This commit adds several Tx/Rx physical information to phy_info debugfs for 8822B/8822C. By this debugfs, we can know physical information, such as Tx/Rx rate, RSSI, EVM,SNR, etc. The information is gotten from the packets of Tx/Rx path. It has no impact for the performance of 8822B/8822C.
In the fields, we may meet different kinds of problems, but we may have no professional instrument to check them. At this moment, this debugfs is a good tool, and it may provide useful information for debug.
---
v1 -> v2
* No change
v2 -> v3
* refine get evm code, use S8_MIN
drivers/net/wireless/realtek/rtw88/debug.c | 174 +++++++++++++++--- drivers/net/wireless/realtek/rtw88/main.c | 37 +++- drivers/net/wireless/realtek/rtw88/main.h | 58 ++++++ drivers/net/wireless/realtek/rtw88/phy.c | 9 + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 45 +++++ drivers/net/wireless/realtek/rtw88/rtw8822b.h | 12 ++ drivers/net/wireless/realtek/rtw88/rtw8822c.c | 48 +++++ drivers/net/wireless/realtek/rtw88/rtw8822c.h | 12 ++ drivers/net/wireless/realtek/rtw88/rx.c | 69 ++++++- 9 files changed, 431 insertions(+), 33 deletions(-)
drivers/net/wireless/realtek/rtw88/debug.c +153 -21
@@ -498,12 +498,32 @@ static void rtw_print_vht_rate_txt(struct seq_file *m, u8 rate)seq_printf (m," VHT%uSMCS%u" , n_ss, mcs_n); } +static void rtw_print_rate (struct seq_file *m,u8 rate) +{ +switch (rate) { + case DESC_RATE1M...DESC_RATE11M: +rtw_print_cck_rate_txt (m, rate); +break ; + case DESC_RATE6M...DESC_RATE54M: +rtw_print_ofdm_rate_txt (m, rate); +break ; + case DESC_RATEMCS0...DESC_RATEMCS15: +rtw_print_ht_rate_txt (m, rate); +break ; + case DESC_RATEVHT1SS_MCS0...DESC_RATEVHT2SS_MCS9: +rtw_print_vht_rate_txt (m, rate); +break ; +default : +seq_printf (m," Unknown rate=0x%x\n" , rate); +break ; + } +} +static int rtw_debugfs_get_tx_pwr_tbl (struct seq_file *m,void *v) {struct rtw_debugfs_priv *debugfs_priv = m->private;struct rtw_dev *rtwdev = debugfs_priv->rtwdev;struct rtw_hal *hal = &rtwdev->hal; -void (*print_rate)(struct seq_file *,u8 ) =NULL ;u8 path, rate;struct rtw_power_params pwr_param = {0 };u8 bw = hal->current_band_width;
@@ -528,30 +548,11 @@ static int rtw_debugfs_get_tx_pwr_tbl(struct seq_file *m, void *v) rate < DESC_RATEVHT1SS_MCS0)continue ; -switch (rate) { - case DESC_RATE1M...DESC_RATE11M: - print_rate = rtw_print_cck_rate_txt; -break ; - case DESC_RATE6M...DESC_RATE54M: - print_rate = rtw_print_ofdm_rate_txt; -break ; - case DESC_RATEMCS0...DESC_RATEMCS15: - print_rate = rtw_print_ht_rate_txt; -break ; - case DESC_RATEVHT1SS_MCS0...DESC_RATEVHT2SS_MCS9: - print_rate = rtw_print_vht_rate_txt; -break ; -default : - print_rate =NULL ; -break ; - } -rtw_get_tx_power_params (rtwdev, path, rate, bw, ch, regd, &pwr_param);seq_printf (m,"%4c " , path +'A' ); -if (print_rate) -print_rate (m, rate); +rtw_print_rate (m, rate); seq_printf(m, " %3u(0x%02x) %4u %4d (%4d %4d)\n", hal->tx_pwr_tbl[path][rate], hal->tx_pwr_tbl[path][rate],
@@ -567,6 +568,132 @@ static int rtw_debugfs_get_tx_pwr_tbl(struct seq_file *m, void *v)return 0 ; } +static int rtw_debugfs_get_phy_info (struct seq_file *m,void *v) +{ +struct rtw_debugfs_priv *debugfs_priv = m->private; +struct rtw_dev *rtwdev = debugfs_priv->rtwdev; +struct rtw_dm_info *dm_info = &rtwdev->dm_info; +struct rtw_traffic_stats *stats = &rtwdev->stats; +struct rtw_pkt_count *last_cnt = &dm_info->last_pkt_count; +struct rtw_efuse *efuse = &rtwdev->efuse; +struct ewma_evm *ewma_evm = dm_info->ewma_evm; +struct ewma_snr *ewma_snr = dm_info->ewma_snr; +u8 ss, rate_id; + +seq_puts (m,"==========[Common Info]========\n" ); +seq_printf (m,"Is link = %c\n" ,rtw_is_assoc (rtwdev) ?'Y' :'N' ); +seq_printf (m,"Current CH(fc) = %u\n" , rtwdev->hal.current_channel); +seq_printf (m,"Current BW = %u\n" , rtwdev->hal.current_band_width); +seq_printf (m,"Current IGI = 0x%x\n" , dm_info->igi_history[0 ]); +seq_printf (m,"TP {Tx, Rx} = {%u, %u}Mbps\n\n" , + stats->tx_throughput, stats->rx_throughput); + +seq_puts (m,"==========[Tx Phy Info]========\n" ); +seq_puts (m,"[Tx Rate] = " ); +rtw_print_rate (m, dm_info->tx_rate); +seq_printf (m,"(0x%x)\n\n" , dm_info->tx_rate); + +seq_puts (m,"==========[Rx Phy Info]========\n" ); +seq_printf (m,"[Rx Beacon Count] = %u\n" , last_cnt->num_bcn_pkt); +seq_puts (m,"[Rx Rate] = " ); +rtw_print_rate (m, dm_info->curr_rx_rate); +seq_printf (m,"(0x%x)\n" , dm_info->curr_rx_rate); + +seq_puts (m,"[Rx Rate Count]:\n" ); +seq_printf (m," * CCK = {%u, %u, %u, %u}\n" , + last_cnt->num_qry_pkt[DESC_RATE1M ], + last_cnt->num_qry_pkt[DESC_RATE2M ], + last_cnt->num_qry_pkt[DESC_RATE5_5M ], + last_cnt->num_qry_pkt[DESC_RATE11M ]); + +seq_printf (m," * OFDM = {%u, %u, %u, %u, %u, %u, %u, %u}\n" , + last_cnt->num_qry_pkt[DESC_RATE6M ], + last_cnt->num_qry_pkt[DESC_RATE9M ], + last_cnt->num_qry_pkt[DESC_RATE12M ], + last_cnt->num_qry_pkt[DESC_RATE18M ], + last_cnt->num_qry_pkt[DESC_RATE24M ], + last_cnt->num_qry_pkt[DESC_RATE36M ], + last_cnt->num_qry_pkt[DESC_RATE48M ], + last_cnt->num_qry_pkt[DESC_RATE54M ]); + +for (ss =0 ; ss < efuse->hw_cap.nss; ss++) { + rate_id =DESC_RATEMCS0 + ss *8 ; +seq_printf (m," * HT_MCS[%u:%u] = {%u, %u, %u, %u, %u, %u, %u, %u}\n" , + ss *8 , ss *8 +7 , + last_cnt->num_qry_pkt[rate_id], + last_cnt->num_qry_pkt[rate_id +1 ], + last_cnt->num_qry_pkt[rate_id +2 ], + last_cnt->num_qry_pkt[rate_id +3 ], + last_cnt->num_qry_pkt[rate_id +4 ], + last_cnt->num_qry_pkt[rate_id +5 ], + last_cnt->num_qry_pkt[rate_id +6 ], + last_cnt->num_qry_pkt[rate_id +7 ]); + } + +for (ss =0 ; ss < efuse->hw_cap.nss; ss++) { + rate_id =DESC_RATEVHT1SS_MCS0 + ss *10 ; +seq_printf (m," * VHT_MCS-%uss MCS[0:9] = {%u, %u, %u, %u, %u, %u, %u, %u, %u, %u}\n" , + ss +1 , + last_cnt->num_qry_pkt[rate_id], + last_cnt->num_qry_pkt[rate_id +1 ], + last_cnt->num_qry_pkt[rate_id +2 ], + last_cnt->num_qry_pkt[rate_id +3 ], + last_cnt->num_qry_pkt[rate_id +4 ], + last_cnt->num_qry_pkt[rate_id +5 ], + last_cnt->num_qry_pkt[rate_id +6 ], + last_cnt->num_qry_pkt[rate_id +7 ], + last_cnt->num_qry_pkt[rate_id +8 ], + last_cnt->num_qry_pkt[rate_id +9 ]); + } + +seq_printf (m,"[RSSI(dBm)] = {%d, %d}\n" , + dm_info->rssi[RF_PATH_A ] -100 , + dm_info->rssi[RF_PATH_B ] -100 ); +seq_printf (m,"[Rx EVM(dB)] = {-%d, -%d}\n" , + dm_info->rx_evm_dbm[RF_PATH_A ], + dm_info->rx_evm_dbm[RF_PATH_B ]); +seq_printf (m,"[Rx SNR] = {%d, %d}\n" , + dm_info->rx_snr[RF_PATH_A ], + dm_info->rx_snr[RF_PATH_B ]); +seq_printf (m,"[CFO_tail(KHz)] = {%d, %d}\n" , + dm_info->cfo_tail[RF_PATH_A ], + dm_info->cfo_tail[RF_PATH_B ]); + +if (dm_info->curr_rx_rate >=DESC_RATE11M ) { +seq_puts (m,"[Rx Average Status]:\n" ); +seq_printf (m," * OFDM, EVM: {-%d}, SNR: {%d}\n" , + (u8 )ewma_evm_read (&ewma_evm[RTW_EVM_OFDM ]), + (u8 )ewma_snr_read (&ewma_snr[RTW_SNR_OFDM_A ])); +seq_printf (m," * 1SS, EVM: {-%d}, SNR: {%d}\n" , + (u8 )ewma_evm_read (&ewma_evm[RTW_EVM_1SS ]), + (u8 )ewma_snr_read (&ewma_snr[RTW_SNR_1SS_A ])); +seq_printf (m," * 2SS, EVM: {-%d, -%d}, SNR: {%d, %d}\n" , + (u8 )ewma_evm_read (&ewma_evm[RTW_EVM_2SS_A ]), + (u8 )ewma_evm_read (&ewma_evm[RTW_EVM_2SS_B ]), + (u8 )ewma_snr_read (&ewma_snr[RTW_SNR_2SS_A ]), + (u8 )ewma_snr_read (&ewma_snr[RTW_SNR_2SS_B ])); + } + +seq_puts (m,"[Rx Counter]:\n" ); +seq_printf (m," * CCA (CCK, OFDM, Total) = (%u, %u, %u)\n" , + dm_info->cck_cca_cnt, + dm_info->ofdm_cca_cnt, + dm_info->total_cca_cnt); +seq_printf (m," * False Alarm (CCK, OFDM, Total) = (%u, %u, %u)\n" , + dm_info->cck_fa_cnt, + dm_info->ofdm_fa_cnt, + dm_info->total_fa_cnt); +seq_printf (m," * CCK cnt (ok, err) = (%u, %u)\n" , + dm_info->cck_ok_cnt, dm_info->cck_err_cnt); +seq_printf (m," * OFDM cnt (ok, err) = (%u, %u)\n" , + dm_info->ofdm_ok_cnt, dm_info->ofdm_err_cnt); +seq_printf (m," * HT cnt (ok, err) = (%u, %u)\n" , + dm_info->ht_ok_cnt, dm_info->ht_err_cnt); +seq_printf (m," * VHT cnt (ok, err) = (%u, %u)\n" , + dm_info->vht_ok_cnt, dm_info->vht_err_cnt); +return 0 ; +} +#define rtw_debug_impl_mac (page, addr) \ static struct rtw_debugfs_priv rtw_debug_priv_mac_ ##page = { \ .cb_read = rtw_debug_get_mac_page, \
@@ -653,6 +780,10 @@ static struct rtw_debugfs_priv rtw_debug_priv_rsvd_page = { .cb_read = rtw_debugfs_get_rsvd_page, }; +static struct rtw_debugfs_priv rtw_debug_priv_phy_info = { + .cb_read = rtw_debugfs_get_phy_info, +}; +#define rtw_debugfs_add_core (name, mode, fopname, parent) \ do { \ rtw_debug_priv_ ##name.rtwdev = rtwdev; \
@@ -682,6 +813,7 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev)rtw_debugfs_add_rw (rf_read);rtw_debugfs_add_rw (dump_cam);rtw_debugfs_add_rw (rsvd_page); +rtw_debugfs_add_r (phy_info);rtw_debugfs_add_r (mac_0);rtw_debugfs_add_r (mac_1);rtw_debugfs_add_r (mac_2);
drivers/net/wireless/realtek/rtw88/main.c +31 -6
@@ -178,6 +178,7 @@ static void rtw_watch_dog_work(struct work_struct *work) { struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, watch_dog_work.work); +struct rtw_traffic_stats *stats = &rtwdev->stats;struct rtw_watch_dog_iter_data data = {};bool busy_traffic =test_bit (RTW_FLAG_BUSY_TRAFFIC , rtwdev->flags);bool ps_active;
@@ -198,17 +199,24 @@ static void rtw_watch_dog_work(struct work_struct *work)if (busy_traffic !=test_bit (RTW_FLAG_BUSY_TRAFFIC , rtwdev->flags))rtw_coex_wl_status_change_notify (rtwdev); -if (rtwdev->stats.tx_cnt >RTW_LPS_THRESHOLD || - rtwdev->stats.rx_cnt >RTW_LPS_THRESHOLD ) +if (stats->tx_cnt >RTW_LPS_THRESHOLD || + stats->rx_cnt >RTW_LPS_THRESHOLD ) ps_active = true;else ps_active = false; +ewma_tp_add (&stats->tx_ewma_tp, + (u32)(stats->tx_unicast >>RTW_TP_SHIFT )); +ewma_tp_add (&stats->rx_ewma_tp, + (u32)(stats->rx_unicast >>RTW_TP_SHIFT )); + stats->tx_throughput =ewma_tp_read (&stats->tx_ewma_tp); + stats->rx_throughput =ewma_tp_read (&stats->rx_ewma_tp); +/* reset tx/rx statictics */ - rtwdev->stats.tx_unicast =0 ; - rtwdev->stats.rx_unicast =0 ; - rtwdev->stats.tx_cnt =0 ; - rtwdev->stats.rx_cnt =0 ; + stats->tx_unicast =0 ; + stats->rx_unicast =0 ; + stats->tx_cnt =0 ; + stats->rx_cnt =0 ;if (test_bit (RTW_FLAG_SCANNING , rtwdev->flags)) goto unlock;
@@ -1281,6 +1289,21 @@ int rtw_chip_info_setup(struct rtw_dev *rtwdev) }EXPORT_SYMBOL (rtw_chip_info_setup); +static void rtw_stats_init (struct rtw_dev *rtwdev) +{ +struct rtw_traffic_stats *stats = &rtwdev->stats; +struct rtw_dm_info *dm_info = &rtwdev->dm_info; +int i; + +ewma_tp_init (&stats->tx_ewma_tp); +ewma_tp_init (&stats->rx_ewma_tp); + +for (i =0 ; i <RTW_EVM_NUM ; i++) +ewma_evm_init (&dm_info->ewma_evm[i]); +for (i =0 ; i <RTW_SNR_NUM ; i++) +ewma_snr_init (&dm_info->ewma_snr[i]); +} +int rtw_core_init (struct rtw_dev *rtwdev) {struct rtw_chip_info *chip = rtwdev->chip;
@@ -1329,6 +1352,8 @@ int rtw_core_init(struct rtw_dev *rtwdev)rtw_add_rsvd_page (rtwdev,RSVD_BEACON , false);mutex_unlock (&rtwdev->mutex); +rtw_stats_init (rtwdev); +/* default rx filter setting */ rtwdev->hal.rcr =BIT_APP_FCS |BIT_APP_MIC |BIT_APP_ICV | BIT_HTC_LOC_CTRL | BIT_APP_PHYSTS |
drivers/net/wireless/realtek/rtw88/main.h +58 -0
102 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/phy.c +9 -0
@@ -222,10 +222,19 @@ static void rtw_phy_stat_rssi(struct rtw_dev *rtwdev) dm_info->min_rssi = data.min_rssi; } +static void rtw_phy_stat_rate_cnt (struct rtw_dev *rtwdev) +{ +struct rtw_dm_info *dm_info = &rtwdev->dm_info; + + dm_info->last_pkt_count = dm_info->cur_pkt_count; +memset (&dm_info->cur_pkt_count,0 ,sizeof (dm_info->cur_pkt_count)); +} +static void rtw_phy_statistics (struct rtw_dev *rtwdev) {rtw_phy_stat_rssi (rtwdev);rtw_phy_stat_false_alarm (rtwdev); +rtw_phy_stat_rate_cnt (rtwdev); }#define DIG_PERF_FA_TH_LOW 250
drivers/net/wireless/realtek/rtw88/rtw8822b.c +45 -0
82 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/rtw8822b.h +12 -0
@@ -127,6 +127,18 @@ _rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data) le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(11, 8))#define GET_PHY_STAT_P1_HT_RXSC (phy_stat) \ le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(15, 12)) +#define GET_PHY_STAT_P1_RXEVM_A (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(7, 0)) +#define GET_PHY_STAT_P1_RXEVM_B (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(15, 8)) +#define GET_PHY_STAT_P1_CFO_TAIL_A (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(7, 0)) +#define GET_PHY_STAT_P1_CFO_TAIL_B (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(15, 8)) +#define GET_PHY_STAT_P1_RXSNR_A (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(7, 0)) +#define GET_PHY_STAT_P1_RXSNR_B (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(15, 8))#define REG_HTSTFWT 0x800#define REG_RXPSEL 0x808
drivers/net/wireless/realtek/rtw88/rtw8822c.c +48 -0
86 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/rtw8822c.h +12 -0
@@ -149,6 +149,18 @@ const struct rtw_table name ## _tbl = { \ le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(11, 8))#define GET_PHY_STAT_P1_HT_RXSC (phy_stat) \ le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(15, 12)) +#define GET_PHY_STAT_P1_RXEVM_A (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(7, 0)) +#define GET_PHY_STAT_P1_RXEVM_B (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(15, 8)) +#define GET_PHY_STAT_P1_CFO_TAIL_A (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(7, 0)) +#define GET_PHY_STAT_P1_CFO_TAIL_B (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(15, 8)) +#define GET_PHY_STAT_P1_RXSNR_A (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(7, 0)) +#define GET_PHY_STAT_P1_RXSNR_B (phy_stat) \ + le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(15, 8))#define REG_ANAPARLDO_POW_MAC 0x0029#define BIT_LDOE25_PON BIT(0)
drivers/net/wireless/realtek/rtw88/rx.c +63 -6
89 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v3 5/5] rtw88: add phy_info debugfs to show Tx/Rx physical status
Quoted 9 lines · On Tue, Oct 22, 2019 at 6:04 PM <[email protected]> wrote:
From: Tsang-Shian Lin <[email protected]>
This commit adds several Tx/Rx physical information to
phy_infodebugfs for 8822B/8822C. By this debugfs, we can know physical information, such as Tx/Rx rate, RSSI, EVM,SNR, etc. The information is gotten from the packets of Tx/Rx path. It has no impact for the performance of 8822B/8822C.
Quoted 8 lines
In the fields, we may meet different kinds of problems, but we may have no professional instrument to check them. At this moment, this debugfs is a good tool, and it may provide useful information for debug.
Signed-off-by Tsang-Shian Lin <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>---
Quoted 10 lines
v1 -> v2
* No changev2 -> v3
* refine get evm code, useS8_MIN--
2.17.1