Skip to contentSkip to conversation

rtw89: some fixes related to hw_scan

PATCH In review Ping-Ke Shih 2 participants 6 messages Apr 1, 2022 – Apr 6, 2022 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

v2 cover rtw89: some fixes related to hw_scan

After applying hw_scan, it can't play STA and monitor mode simultaneously, because power is off after hw_scan unconditionally. The new firmware, which supports hw_scan, adds an new C2H message to notify driver, but this message is debug purpose, so just add a dummy function to avoid the unsupported message. More, correct BT-coexistence behavior during hw_scan, and correct dwell period of DFS channel.

This patchset is based on "rtw89: add firmware reset and dump firmware memory and backtrace"

v2: add more fixes to make hw_scan work well.

---
Hi Kalle,

I know this week is still merge window. I would like to put these fixes together to correct hw_scan behavior in one go.

Ching-Te Ku (1):
rtw89: coex: Add case for scan offload

Po Hao Huang (3):
rtw89: change idle mode condition during hw_scan
rtw89: packet offload handler to avoid warning
rtw89: fix misconfiguration on hw_scan channel time

 drivers/net/wireless/realtek/rtw89/coex.c | 12 +++++++++++-
 drivers/net/wireless/realtek/rtw89/core.c |  8 ++++----
 drivers/net/wireless/realtek/rtw89/fw.c   |  2 +-
 drivers/net/wireless/realtek/rtw89/mac.c  |  8 +++++++-
 4 files changed, 23 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH v2 2/4 rtw89: packet offload handler to avoid warning

From: Po Hao Huang <[email protected]>

Add a dummy function for packet offload to eliminate warning message "c2h class 1 func 2 not support". This c2h is for debug purpose and its presence itself can do the work, so further parsing won't be required for now.

---
 drivers/net/wireless/realtek/rtw89/mac.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/mac.c +7 -1
index 0a8fd672b41f6..b4855886d1207 100644
@@ -3341,12 +3341,18 @@ rtw89_mac_c2h_bcn_cnt(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len)
 {
 }
 
+static void
+rtw89_mac_c2h_pkt_ofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *c2h,
+			   u32 len)
+{
+}
+
 static
 void (* const rtw89_mac_c2h_ofld_handler[])(struct rtw89_dev *rtwdev,
 					    struct sk_buff *c2h, u32 len) = {
 	[RTW89_MAC_C2H_FUNC_EFUSE_DUMP] = NULL,
 	[RTW89_MAC_C2H_FUNC_READ_RSP] = NULL,
-	[RTW89_MAC_C2H_FUNC_PKT_OFLD_RSP] = NULL,
+	[RTW89_MAC_C2H_FUNC_PKT_OFLD_RSP] = rtw89_mac_c2h_pkt_ofld_rsp,
 	[RTW89_MAC_C2H_FUNC_BCN_RESEND] = NULL,
 	[RTW89_MAC_C2H_FUNC_MACID_PAUSE] = rtw89_mac_c2h_macid_pause,
 	[RTW89_MAC_C2H_FUNC_SCANOFLD_RSP] = rtw89_mac_c2h_scanofld_rsp,
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v2 1/4 rtw89: change idle mode condition during hw_scan

In reply to Ping-Ke Shih

From: Po Hao Huang <[email protected]>

Previously we only consider single interface's status, idle mode behavior could be unexpected when multiple interfaces is active. Change to enter/leave idle mode by mac80211's configuration state.

---
 drivers/net/wireless/realtek/rtw89/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +4 -4
index c61061358980b..be25b9a42fc11 100644
@@ -1798,9 +1798,9 @@ static void rtw89_ips_work(struct work_struct *work)
 {
 	struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
 						ips_work);
-
 	mutex_lock(&rtwdev->mutex);
-	rtw89_enter_ips(rtwdev);
+	if (rtwdev->hw->conf.flags & IEEE80211_CONF_IDLE)
+		rtw89_enter_ips(rtwdev);
 	mutex_unlock(&rtwdev->mutex);
 }
 
@@ -2703,7 +2703,7 @@ void rtw89_core_scan_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
 
 	rtwdev->scanning = true;
 	rtw89_leave_lps(rtwdev);
-	if (hw_scan && rtwvif->net_type == RTW89_NET_TYPE_NO_LINK)
+	if (hw_scan && (rtwdev->hw->conf.flags & IEEE80211_CONF_IDLE))
 		rtw89_leave_ips(rtwdev);
 
 	ether_addr_copy(rtwvif->mac_addr, mac_addr);
@@ -2727,7 +2727,7 @@ void rtw89_core_scan_complete(struct rtw89_dev *rtwdev,
 
 	rtwdev->scanning = false;
 	rtwdev->dig.bypass_dig = true;
-	if (hw_scan && rtwvif->net_type == RTW89_NET_TYPE_NO_LINK)
+	if (hw_scan && (rtwdev->hw->conf.flags & IEEE80211_CONF_IDLE))
 		ieee80211_queue_work(rtwdev->hw, &rtwdev->ips_work);
 }
 
Signature · 1 line
2.25.1
author maintainer
#4 lore raw

PATCH v2 3/4 rtw89: coex: Add case for scan offload

In reply to Ping-Ke Shih

From: Ching-Te Ku <[email protected]>

Turn off coexistence driver control, let firmware can control the traffic during scan. This prevents potential unexpected behavior of the BT driver.

---
 drivers/net/wireless/realtek/rtw89/coex.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/coex.c +11 -1
index 07f26718b66fb..bf433a68c1ded 100644
@@ -3068,7 +3068,17 @@ static void _action_wl_scan(struct rtw89_dev *rtwdev)
 	struct rtw89_btc_wl_info *wl = &btc->cx.wl;
 	struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info;
 
-	if (rtwdev->dbcc_en) {
+	if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD, &rtwdev->fw)) {
+		_set_ant(rtwdev, NM_EXEC, BTC_PHY_ALL, BTC_ANT_W25G);
+		if (btc->mdinfo.ant.type == BTC_ANT_SHARED)
+			_set_policy(rtwdev, BTC_CXP_OFFE_DEF,
+				    BTC_RSN_NTFY_SCAN_START);
+		else
+			_set_policy(rtwdev, BTC_CXP_OFF_EQ0,
+				    BTC_RSN_NTFY_SCAN_START);
+
+		rtw89_debug(rtwdev, RTW89_DBG_BTC, "[BTC], Scan offload!\n");
+	} else if (rtwdev->dbcc_en) {
 		if (wl_dinfo->real_band[RTW89_PHY_0] != RTW89_BAND_2G &&
 		    wl_dinfo->real_band[RTW89_PHY_1] != RTW89_BAND_2G)
 			_action_wl_5g(rtwdev);
Signature · 1 line
2.25.1
author maintainer
#5 lore raw

PATCH v2 4/4 rtw89: fix misconfiguration on hw_scan channel time

In reply to Ping-Ke Shih

From: Po Hao Huang <[email protected]>

Without this patch, hw scan won't stay long enough on DFS/passive channels. Found previous logic error and fix it.

---
 drivers/net/wireless/realtek/rtw89/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/fw.c +1 -1
index 4848f25e7a0af..022d52b0c2e78 100644
@@ -2099,7 +2099,7 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
 		ch_info->num_pkt = 0;
 		break;
 	case RTW89_CHAN_DFS:
-		ch_info->period = min_t(u8, ch_info->period,
+		ch_info->period = max_t(u8, ch_info->period,
 					RTW89_DFS_CHAN_TIME);
 		ch_info->dwell_time = RTW89_DWELL_TIME;
 		break;
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v2 1/4] rtw89: change idle mode condition during hw_scan

In reply to Ping-Ke Shih
Quoted 8 lines · Ping-Ke Shih

From: Po Hao Huang <[email protected]>

Previously we only consider single interface's status, idle mode behavior could be unexpected when multiple interfaces is active. Change to enter/leave idle mode by mac80211's configuration state.

4 patches applied to wireless-next.git, thanks.

ee20d538c498 rtw89: change idle mode condition during hw_scan 2b8219e9b746 rtw89: packet offload handler to avoid warning 841f2633840e rtw89: coex: Add case for scan offload 65ee4971a262 rtw89: fix misconfiguration on hw_scan channel time

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches