rtw88: 8723d: follow up fixes
PATCH 2/3 rtw88: coex: 8723d: handle BT inquiry cases
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
Coex mechanism used to make BT have higher priority and more time to transfer data when BT inquiry-page, which leads to poor WiFi performance. Should take WiFi traffic into consideration. If the WiFi is having heavy traffic, use another parameter to make sure WiFi has more chance to TX/RX, while guarantee the priority of BT for inquiry. If the WiFi isn't busy (connected or not), set proper parameter to fix originals.
--- drivers/net/wireless/realtek/rtw88/coex.c | 9 ++++++--- drivers/net/wireless/realtek/rtw88/rtw8723d.c | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtw88/coex.c +6 -3
@@ -1351,12 +1351,15 @@ static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) tdma_case =108 ; else tdma_case =109 ; + }else if (coex_stat->wl_gl_busy) { + table_case =114 ; + tdma_case =121 ; }else if (coex_stat->wl_connected) { - table_case =101 ; - tdma_case =110 ; - }else { table_case =100 ; tdma_case =100 ; + }else { + table_case =101 ; + tdma_case =100 ; } }
drivers/net/wireless/realtek/rtw88/rtw8723d.c +3 -2
@@ -2039,7 +2039,7 @@ static const struct coex_tdma_para tdma_sant_8723d[] = {/* Non-Shared-Antenna TDMA */ static const struct coex_tdma_para tdma_nsant_8723d[] = { - { {0x00 ,0x00 ,0x00 ,0x40 ,0x00 } },/* case-100 */ + { {0x00 ,0x00 ,0x00 ,0x40 ,0x01 } },/* case-100 */ { {0x61 ,0x45 ,0x03 ,0x11 ,0x11 } },/* case-101 */ { {0x61 ,0x3a ,0x03 ,0x11 ,0x11 } }, { {0x61 ,0x30 ,0x03 ,0x11 ,0x11 } },
@@ -2059,7 +2059,8 @@ static const struct coex_tdma_para tdma_nsant_8723d[] = { { {0x51, 0x3a, 0x03, 0x10, 0x50} }, { {0x51, 0x30, 0x03, 0x10, 0x50} }, { {0x51, 0x20, 0x03, 0x10, 0x50} }, - { {0x51, 0x10, 0x03, 0x10, 0x50} } + { {0x51, 0x10, 0x03, 0x10, 0x50} }, /* case-120 */ + { {0x51, 0x08, 0x03, 0x10, 0x50} }, };/* rssi in percentage % (dbm = % - 100) */
Signature · 1 line
2.17.1
PATCH 1/3 rtw88: coex: 8723d: set antanna control owner
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
Without setting antenna control owner, the WiFi could be disconnected if the BT has traffic. Because the antenna is switched to BT side for its traffic, and the WiFi will have no chance to transfer data. Set control owner to prevent WiFi disconnect issue.
--- drivers/net/wireless/realtek/rtw88/coex.c | 12 ++++++++++-- drivers/net/wireless/realtek/rtw88/main.h | 1 + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 5 +++++ drivers/net/wireless/realtek/rtw88/rtw8723d.h | 1 + 4 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/coex.c +10 -2
@@ -748,10 +748,18 @@ void rtw_coex_write_indirect_reg(struct rtw_dev *rtwdev, u16 addr,static void rtw_coex_coex_ctrl_owner (struct rtw_dev *rtwdev,bool wifi_control) { -if (wifi_control) +struct rtw_chip_info *chip = rtwdev->chip; +const struct rtw_hw_reg *btg_reg = chip->btg_reg; + +if (wifi_control) {rtw_write32_set (rtwdev,REG_SYS_SDIO_CTRL ,BIT_LTE_MUX_CTRL_PATH ); -else +if (btg_reg) +rtw_write8_set (rtwdev, btg_reg->addr, btg_reg->mask); + }else {rtw_write32_clr (rtwdev,REG_SYS_SDIO_CTRL ,BIT_LTE_MUX_CTRL_PATH ); +if (btg_reg) +rtw_write8_clr (rtwdev, btg_reg->addr, btg_reg->mask); + } }static void rtw_coex_set_gnt_bt (struct rtw_dev *rtwdev,u8 state)
drivers/net/wireless/realtek/rtw88/main.h +1 -0
@@ -1177,6 +1177,7 @@ struct rtw_chip_info {const struct coex_rf_para *wl_rf_para_tx;const struct coex_rf_para *wl_rf_para_rx;const struct coex_5g_afh_map *afh_5g; +const struct rtw_hw_reg *btg_reg;const struct rtw_reg_domain *coex_info_hw_regs; };
drivers/net/wireless/realtek/rtw88/rtw8723d.c +5 -0
@@ -2067,6 +2067,10 @@ static const u8 wl_rssi_step_8723d[] = {60, 50, 44, 30};static const u8 bt_rssi_step_8723d[] = {30 ,30 ,30 ,30 };static const struct coex_5g_afh_map afh_5g_8723d[] = { {0 ,0 ,0 } }; +static const struct rtw_hw_reg btg_reg_8723d = { + .addr =REG_BTG_SEL , .mask =BIT_MASK_BTG_WL , +}; +/* wl_tx_dec_power, bt_tx_dec_power, wl_rx_gain, bt_rx_lna_constrain */ static const struct coex_rf_para rf_para_tx_8723d[] = { {0 ,0 , false,7 },/* for normal */
@@ -2733,6 +2737,7 @@ struct rtw_chip_info rtw8723d_hw_spec = { .bt_afh_span_bw40 = 0x30, .afh_5g_num = ARRAY_SIZE(afh_5g_8723d), .afh_5g = afh_5g_8723d, + .btg_reg = &btg_reg_8723d, .coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8723d), .coex_info_hw_regs = coex_info_hw_regs_8723d,
drivers/net/wireless/realtek/rtw88/rtw8723d.h +1 -0
@@ -145,6 +145,7 @@ static inline s32 iqk_mult(s32 x, s32 y, s32 *ext)#define REG_GPIO_INTM 0x0048#define REG_BTG_SEL 0x0067 +#define BIT_MASK_BTG_WL BIT(7)#define REG_LTECOEX_PATH_CONTROL 0x0070#define REG_LTECOEX_CTRL 0x07c0#define REG_LTECOEX_WRITE_DATA 0x07c4
Signature · 1 line
2.17.1
PATCH 3/3 rtw88: fix EAPOL 4-way failure by finish IQK earlier
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
If we connect to an AP with WPA2 security, the IQK and the EAPOL 4-way handshake may be failed due to overlap, because driver does IQK right after assoc success.
For 802.11n devices, they used to do IQK in driver that could requires more than 100ms to finished. During IQK, any TX/RX events are paused. So, if the EAPOL 4-way started before IQK is finished, the 1/4 and 2/4 could be dropped, then the AP will issue deauth with reason IEEE8021X_FAILED (23).
To resolve this, move IQK routine into managed TX prepare, which is ieee80211_ops::mgd_prepare_tx() called before the managed frames (auth/assoc) are sent. This can make sure IQK is done before connection. While scanning, not to do IQK for each channel because it would take too long.
For 802.11ac devices, they used to do IQK in firmware, and it takes less time to finish it, so we do not see EAPOL 4-way failure on them. But, it is still worth to move the IQK to mgd_prepare_tx().
--- drivers/net/wireless/realtek/rtw88/mac80211.c | 3 +-- drivers/net/wireless/realtek/rtw88/main.c | 16 ++++++++++++++++ drivers/net/wireless/realtek/rtw88/main.h | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/mac80211.c +1 -2
@@ -341,13 +341,11 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,rtw_leave_lps_deep (rtwdev);if (changed &BSS_CHANGED_ASSOC ) { -struct rtw_chip_info *chip = rtwdev->chip;enum rtw_net_type net_type;if (conf->assoc) {rtw_coex_connect_notify (rtwdev,COEX_ASSOCIATE_FINISH ); net_type =RTW_NET_MGD_LINKED ; - chip->ops->phy_calibration (rtwdev); rtwvif->aid = conf->aid;rtw_fw_download_rsvd_page (rtwdev);
@@ -663,6 +661,7 @@ static void rtw_ops_mgd_prepare_tx(struct ieee80211_hw *hw,mutex_lock (&rtwdev->mutex);rtw_leave_lps_deep (rtwdev);rtw_coex_connect_notify (rtwdev,COEX_ASSOCIATE_START ); +rtw_chip_prepare_tx (rtwdev);mutex_unlock (&rtwdev->mutex); }
drivers/net/wireless/realtek/rtw88/main.c +16 -0
@@ -408,6 +408,22 @@ void rtw_set_channel(struct rtw_dev *rtwdev) }rtw_phy_set_tx_power_level (rtwdev, center_chan); + +/* If set channel isn't for scanning, we'll do RF calibration once in +* this channel while mgd_prepare_tx. +*/ +if (!test_bit (RTW_FLAG_SCANNING , rtwdev->flags)) + rtwdev->need_rfk = true; +} + +void rtw_chip_prepare_tx (struct rtw_dev *rtwdev) +{ +struct rtw_chip_info *chip = rtwdev->chip; + +if (rtwdev->need_rfk) { + rtwdev->need_rfk = false; + chip->ops->phy_calibration (rtwdev); + } }static void rtw_vif_write_addr (struct rtw_dev *rtwdev,u32 start,u8 *addr)
drivers/net/wireless/realtek/rtw88/main.h +3 -0
@@ -1723,6 +1723,8 @@ struct rtw_dev {struct rtw_fw_state wow_fw;struct rtw_wow_param wow; +bool need_rfk; +/* hci related data, must be last */ u8 priv[]__aligned(sizeof(void *)) ; };
@@ -1796,6 +1798,7 @@ void rtw_restore_reg(struct rtw_dev *rtwdev, struct rtw_backup_info *bckp, u32 num);void rtw_desc_to_mcsrate (u16 rate,u8 *mcs,u8 *nss);void rtw_set_channel (struct rtw_dev *rtwdev); +void rtw_chip_prepare_tx (struct rtw_dev *rtwdev);void rtw_vif_port_config (struct rtw_dev *rtwdev,struct rtw_vif *rtwvif,u32 config);void rtw_tx_report_purge_timer (struct timer_list *t);
Signature · 1 line
2.17.1
cover rtw88: 8723d: follow up fixes
From: Yan-Hsuan Chuang <[email protected]>
The RTL8723DE devices have been tested by Canonical for the coex and basic wifi functions. And they have reported some issues for RTL8723DE. Fix them accordingly.
Ping-Ke Shih (3):
rtw88: coex: 8723d: set antanna control owner
rtw88: coex: 8723d: handle BT inquiry cases
rtw88: fix EAPOL 4-way failure by finish IQK earlier
drivers/net/wireless/realtek/rtw88/coex.c | 21 ++++++++++++++----- drivers/net/wireless/realtek/rtw88/mac80211.c | 3 +-- drivers/net/wireless/realtek/rtw88/main.c | 16 ++++++++++++++ drivers/net/wireless/realtek/rtw88/main.h | 4 ++++ drivers/net/wireless/realtek/rtw88/rtw8723d.c | 10 +++++++-- drivers/net/wireless/realtek/rtw88/rtw8723d.h | 1 + 6 files changed, 46 insertions(+), 9 deletions(-)
Signature · 1 line
2.17.1
This works for me by following verification steps:
1. pair with one Bluetooth headset,
2. connect to some WLAN
3. run nmcli d disconnect $ifname, nmcli d connect $ifname interactively with time intervals for 100 runs.
4. wireless interface is still alive without that "deauthenticated (Reason: 23=IEEE8021X_FAILED)" error.
Quoted 19 lines · On 2020-05-18 16:14, [email protected] wrote:
From: Yan-Hsuan Chuang <[email protected]>
The RTL8723DE devices have been tested by Canonical for the coex and basic wifi functions. And they have reported some issues for RTL8723DE. Fix them accordingly.
Ping-Ke Shih (3):
rtw88: coex: 8723d: set antanna control owner
rtw88: coex: 8723d: handle BT inquiry cases
rtw88: fix EAPOL 4-way failure by finish IQK earlierdrivers/net/wireless/realtek/rtw88/coex.c | 21 ++++++++++++++----- drivers/net/wireless/realtek/rtw88/mac80211.c | 3 +-- drivers/net/wireless/realtek/rtw88/main.c | 16 ++++++++++++++ drivers/net/wireless/realtek/rtw88/main.h | 4 ++++ drivers/net/wireless/realtek/rtw88/rtw8723d.c | 10 +++++++-- drivers/net/wireless/realtek/rtw88/rtw8723d.h | 1 + 6 files changed, 46 insertions(+), 9 deletions(-)
Re: [PATCH 3/3] rtw88: fix EAPOL 4-way failure by finish IQK earlier
In reply to [email protected]Quoted 5 lines · On 2020-05-18 16:14:44 [+0800], [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
If we connect to an AP with WPA2 security, the IQK and the EAPOL 4-way handshake may be failed due to overlap, because driver does IQK right after assoc success.
Connectig to an AP with WPA2 security may fail. The IQK and the EAPOL 4-way handshake may overlap because the driver does IQK right after assoc success.
Quoted 5 lines
For 802.11n devices, they used to do IQK in driver that could requires more than 100ms to finished. During IQK, any TX/RX events are paused. So, if the EAPOL 4-way started before IQK is finished, the 1/4 and 2/4 could be dropped, then the AP will issue deauth with reason
IEEE8021X_FAILED(23).
For 802.11n devices the IQK is done in the driver and could require more than 100ms to complete. During IQK any TX/RX events are paused. So if the EAPOL 4-way handshake started before IQK finished then the 1/4 and 2/4 part of the handshake could be dropped. The AP will then issue deauth with reason IEEE8021X_FAILED (23).
Quoted 5 lines
To resolve this, move IQK routine into managed TX prepare, which is
ieee80211_ops::mgd_prepare_tx()called before the managed frames (auth/assoc) are sent. This can make sure IQK is done before connection. While scanning, not to do IQK for each channel because it would take too long.
To resolve this move IQK routine into managed TX prepare (ieee80211_ops::mgd_prepare_tx()). The callback is called before the managed frames (auth/assoc) are sent. This will make sure that IQK is completed before the handshake starts. Don't do IQK during scanning because doing it each channel ill take too long.
Quoted 4 lines
For 802.11ac devices, they used to do IQK in firmware, and it takes less time to finish it, so we do not see EAPOL 4-way failure on them. But, it is still worth to move the IQK to
mgd_prepare_tx().
The 802.11ac devices do IQK in firmware and it takes less time to complete. Therefore we don't see a failure during the EAPOL 4-way handshake. It is still worth IQK to ieee80211_ops::mgd_prepare_tx().
Quoted 40 lines
Fixes f5df1a8b4376 ("rtw88: 8723d: Add 8723DE to Kconfig and Makefile")Signed-off-by Ping-Ke Shih <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>--- drivers/net/wireless/realtek/rtw88/mac80211.c | 3 +-- drivers/net/wireless/realtek/rtw88/main.c | 16 ++++++++++++++++ drivers/net/wireless/realtek/rtw88/main.h | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-)drivers/net/wireless/realtek/rtw88/mac80211.c +1
-2@@ -341,13 +341,11 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,rtw_leave_lps_deep (rtwdev);if (changed &BSS_CHANGED_ASSOC ) { -struct rtw_chip_info *chip = rtwdev->chip;enum rtw_net_type net_type;if (conf->assoc) {rtw_coex_connect_notify (rtwdev,COEX_ASSOCIATE_FINISH ); net_type =RTW_NET_MGD_LINKED ; - chip->ops->phy_calibration (rtwdev); rtwvif->aid = conf->aid;rtw_fw_download_rsvd_page (rtwdev);@@ -663,6 +661,7 @@ static void rtw_ops_mgd_prepare_tx(struct ieee80211_hw *hw,mutex_lock (&rtwdev->mutex);rtw_leave_lps_deep (rtwdev);rtw_coex_connect_notify (rtwdev,COEX_ASSOCIATE_START ); +rtw_chip_prepare_tx (rtwdev);mutex_unlock (&rtwdev->mutex); }drivers/net/wireless/realtek/rtw88/main.c +0
-0
drivers/net/wireless/realtek/rtw88/main.c void rtw_set_channel(struct rtw_dev *rtwdev) · line 414
Quoted 7 lines
drivers/net/wireless/realtek/rtw88/main.c +4
-0@@ -408,6 +408,22 @@ void rtw_set_channel(struct rtw_dev *rtwdev) }rtw_phy_set_tx_power_level (rtwdev, center_chan); + +/* If set channel isn't for scanning, we'll do RF calibration once in +* this channel while mgd_prepare_tx. +*/
/* If the channel isn't set for scanning, we'll do RF calibration * in ::mgd_prepare_tx(). Performing the calibration during * scanning on each channel takes too long. */
drivers/net/wireless/realtek/rtw88/main.c void rtw_set_channel(struct rtw_dev *rtwdev) · line 427
Quoted 13 lines
drivers/net/wireless/realtek/rtw88/main.c +12
-0+if (!test_bit (RTW_FLAG_SCANNING , rtwdev->flags)) + rtwdev->need_rfk = true; +} + +void rtw_chip_prepare_tx (struct rtw_dev *rtwdev) +{ +struct rtw_chip_info *chip = rtwdev->chip; + +if (rtwdev->need_rfk) { + rtwdev->need_rfk = false; + chip->ops->phy_calibration (rtwdev); + } }
Sebastian
Quoted 5 lines · On 2020-05-18 16:14:41 [+0800], [email protected] wrote:
From: Yan-Hsuan Chuang <[email protected]>
The RTL8723DE devices have been tested by Canonical for the coex and basic wifi functions. And they have reported some issues for RTL8723DE. Fix them accordingly.
Minor rewording in 3/3, otherwise looks good.
Sebastian
Quoted 12 lines · On 2020-05-18 16:14:41 [+0800], [email protected] wrote:
Quoted 5 lines
From: Yan-Hsuan Chuang <[email protected]>
The RTL8723DE devices have been tested by Canonical for the coex and basic wifi functions. And they have reported some issues for RTL8723DE. Fix them accordingly.
Minor rewording in 3/3, otherwise looks good.
Sebastian
Thanks. I will improve the wording in v2.
Yan-Hsuan