wifi: rtw89: add RNR support for 6 GHz scan
Ping-Ke Shih
maintainerPATCH v2 1/1 wifi: rtw89: add RNR support for 6 GHz scan
From: Po-Hao Huang <[email protected]>
Since 6 GHz band has around 60 channels and more strict rules for active probing. Reduced neighbor report can be used to reduce the channels we scan and get specific target BSS info to probe for.
Declare flag WIPHY_FLAG_SPLIT_SCAN_6GHZ so the scan request could be divided into two portions: legacy bands and 6 GHz bands. So RNR information from legacy bands could later be used when 6 GHz scan.
When the scan flag NL80211_SCAN_FLAG_COLOCATED_6GHZ is set, cfg80211 will pass down a reduced channel set which contains PSCs and non-PSC with RNR info received in the 2 GHz/5 GHz band. This reduces the scan duration by allowing us to only scan for channels in which APs are currently operating.
---
v2: fix an error reported by smatch.
rtw89_update_6ghz_rnr_chan() error: uninitialized symbol 'ret'
--- drivers/net/wireless/realtek/rtw89/core.c | 35 +++++- drivers/net/wireless/realtek/rtw89/fw.c | 136 +++++++++++++++++++--- drivers/net/wireless/realtek/rtw89/fw.h | 7 ++ 3 files changed, 162 insertions(+), 16 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +34 -1
@@ -1400,6 +1400,34 @@ static void rtw89_stats_trigger_frame(struct rtw89_dev *rtwdev, } } +static void rtw89_core_cancel_6ghz_probe_tx (struct rtw89_dev *rtwdev, +struct sk_buff *skb) +{ +struct ieee80211_rx_status *rx_status =IEEE80211_SKB_RXCB (skb); +struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; +struct list_head *pkt_list = rtwdev->scan_info.pkt_list; +struct rtw89_pktofld_info *info; +const u8 *ies = mgmt->u.beacon.variable, *ssid_ie; + +if (rx_status->band !=NL80211_BAND_6GHZ ) +return ; + + ssid_ie =cfg80211_find_ie (WLAN_EID_SSID , ies, skb->len); + +list_for_each_entry (info, &pkt_list[NL80211_BAND_6GHZ ], list) { +if (ether_addr_equal (info->bssid, mgmt->bssid)) { +rtw89_fw_h2c_del_pkt_offload (rtwdev, info->id); +continue ; + } + +if (!ssid_ie || ssid_ie[1 ] != info->ssid_len || info->ssid_len ==0 ) +continue ; + +if (memcmp (&ssid_ie[2 ], info->ssid, info->ssid_len) ==0 ) +rtw89_fw_h2c_del_pkt_offload (rtwdev, info->id); + } +} +static void rtw89_vif_rx_stats_iter (void *data,u8 *mac,struct ieee80211_vif *vif) {
@@ -1412,6 +1440,11 @@ static void rtw89_vif_rx_stats_iter(void *data, u8 *mac,struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;const u8 *bssid = iter_data->bssid; +if (rtwdev->scanning && + (ieee80211_is_beacon (hdr->frame_control) || +ieee80211_is_probe_resp (hdr->frame_control))) +rtw89_core_cancel_6ghz_probe_tx (rtwdev, skb); +if (!vif->bss_conf.bssid)return ;
@@ -3372,7 +3405,7 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev) hw->wiphy->flags |=WIPHY_FLAG_SUPPORTS_TDLS |WIPHY_FLAG_TDLS_EXTERNAL_SETUP | -WIPHY_FLAG_AP_UAPSD ; +WIPHY_FLAG_AP_UAPSD |WIPHY_FLAG_SPLIT_SCAN_6GHZ ; hw->wiphy->features |=NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR ; hw->wiphy->max_scan_ssids =RTW89_SCANOFLD_MAX_SSID ;
drivers/net/wireless/realtek/rtw89/fw.c +121 -15
186 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/fw.h +7 -0
@@ -237,6 +237,7 @@ struct rtw89_mac_chinfo {u16 tx_pwr_idx;u8 rsvd1;struct list_head list; +bool is_psc; };struct rtw89_scan_option {
@@ -247,6 +248,12 @@ struct rtw89_scan_option {struct rtw89_pktofld_info {struct list_head list;u8 id; + +/* Below fields are for 6 GHz RNR use only */ +u8 ssid[IEEE80211_MAX_SSID_LEN ]; +u8 ssid_len; +u8 bssid[ETH_ALEN ]; +u16 channel_6ghz; };static inline void RTW89_SET_FWCMD_RA_IS_DIS (void *cmd,u32 val)
Signature · 1 line
2.25.1
Quoted 10 lines · Ping-Ke Shih
From: Po-Hao Huang <[email protected]>
Since 6 GHz band has around 60 channels and more strict rules for active probing. Reduced neighbor report can be used to reduce the channels we scan and get specific target BSS info to probe for.
Declare flag
WIPHY_FLAG_SPLIT_SCAN_6GHZso the scan request could be divided into two portions: legacy bands and 6 GHz bands. So RNR information from legacy bands could later be used when 6 GHz scan.
Quoted 8 lines
When the scan flag
NL80211_SCAN_FLAG_COLOCATED_6GHZis set, cfg80211 will pass down a reduced channel set which contains PSCs and non-PSC with RNR info received in the 2 GHz/5 GHz band. This reduces the scan duration by allowing us to only scan for channels in which APs are currently operating.Signed-off-by Po-Hao Huang <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
Patch applied to wireless-next.git, thanks.
c6aa9a9c4725 wifi: rtw89: add RNR support for 6 GHz scan
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches