wifi: rtw89: 8922a: download template probe requests for 6 GHz band
authorPo-Hao Huang <phhuang@realtek.com>
Thu, 28 Mar 2024 05:26:55 +0000 (13:26 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Wed, 3 Apr 2024 02:22:41 +0000 (10:22 +0800)
8922a FW supports RNR parsing, provide template probe requests and
let FW do the replacement for SSID/BSSID/short SSIDs.
Don't declare WIPHY_FLAG_SPLIT_SCAN_6GHZ so proper IEs such as
6 GHz capabilities can be passed down within the same scan request.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240328052656.18823-3-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/fw.h
drivers/net/wireless/realtek/rtw89/rtw8851b.c
drivers/net/wireless/realtek/rtw89/rtw8852a.c
drivers/net/wireless/realtek/rtw89/rtw8852b.c
drivers/net/wireless/realtek/rtw89/rtw8852c.c
drivers/net/wireless/realtek/rtw89/rtw8922a.c

index d474b8d..1de40fa 100644 (file)
@@ -4486,7 +4486,11 @@ 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_SPLIT_SCAN_6GHZ;
+                           WIPHY_FLAG_AP_UAPSD;
+
+       if (!chip->support_rnr)
+               hw->wiphy->flags |= WIPHY_FLAG_SPLIT_SCAN_6GHZ;
+
        hw->wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
 
        hw->wiphy->max_scan_ssids = RTW89_SCANOFLD_MAX_SSID;
index fc1ed86..12133bc 100644 (file)
@@ -3981,6 +3981,7 @@ struct rtw89_chip_info {
        u8 support_bands;
        u16 support_bandwidths;
        bool support_unii4;
+       bool support_rnr;
        bool ul_tb_waveform_ctrl;
        bool ul_tb_pwr_diff;
        bool hw_sec_hdr;
index f27486d..18bef26 100644 (file)
@@ -4692,6 +4692,7 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
        struct rtw89_h2c_scanofld_be_macc_role *macc_role;
        struct rtw89_chan *op = &scan_info->op_chan;
        struct rtw89_h2c_scanofld_be_opch *opch;
+       struct rtw89_pktofld_info *pkt_info;
        struct rtw89_h2c_scanofld_be *h2c;
        struct sk_buff *skb;
        u8 macc_role_size = sizeof(*macc_role) * option->num_macc_role;
@@ -4716,6 +4717,16 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
        h2c = (struct rtw89_h2c_scanofld_be *)skb->data;
        ptr = skb->data;
 
+       memset(probe_id, RTW89_SCANOFLD_PKT_NONE, sizeof(probe_id));
+
+       list_for_each_entry(pkt_info, &scan_info->pkt_list[NL80211_BAND_6GHZ], list) {
+               if (pkt_info->wildcard_6ghz) {
+                       /* Provide wildcard as template */
+                       probe_id[NL80211_BAND_6GHZ] = pkt_info->id;
+                       break;
+               }
+       }
+
        h2c->w0 = le32_encode_bits(option->operation, RTW89_H2C_SCANOFLD_BE_W0_OP) |
                  le32_encode_bits(option->scan_mode,
                                   RTW89_H2C_SCANOFLD_BE_W0_SCAN_MODE) |
@@ -5553,6 +5564,7 @@ static bool rtw89_is_6ghz_wildcard_probe_req(struct rtw89_dev *rtwdev,
                info->ssid_len = req->ssids[ssid_idx].ssid_len;
                return false;
        } else {
+               info->wildcard_6ghz = true;
                return true;
        }
 }
@@ -5587,12 +5599,8 @@ static int rtw89_append_probe_req_ie(struct rtw89_dev *rtwdev,
                        goto out;
                }
 
-               if (rtw89_is_6ghz_wildcard_probe_req(rtwdev, rtwvif, info, band,
-                                                    ssid_idx)) {
-                       kfree_skb(new);
-                       kfree(info);
-                       goto out;
-               }
+               rtw89_is_6ghz_wildcard_probe_req(rtwdev, rtwvif, info, band,
+                                                ssid_idx);
 
                ret = rtw89_fw_h2c_add_pkt_offload(rtwdev, &info->id, new);
                if (ret) {
@@ -5750,6 +5758,10 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
                                continue;
                        else if (info->channel_6ghz && probe_count != 0)
                                ch_info->period += RTW89_CHANNEL_TIME_6G;
+
+                       if (info->wildcard_6ghz)
+                               continue;
+
                        ch_info->pkt_id[probe_count++] = info->id;
                        if (probe_count >= RTW89_SCANOFLD_MAX_SSID)
                                break;
@@ -5804,6 +5816,10 @@ static void rtw89_hw_scan_add_chan_be(struct rtw89_dev *rtwdev, int chan_type,
                        if (info->channel_6ghz &&
                            ch_info->pri_ch != info->channel_6ghz)
                                continue;
+
+                       if (info->wildcard_6ghz)
+                               continue;
+
                        ch_info->pkt_id[probe_count++] = info->id;
                        if (probe_count >= RTW89_SCANOFLD_MAX_SSID)
                                break;
index a7e78a8..d247fe4 100644 (file)
@@ -340,8 +340,9 @@ struct rtw89_mac_chinfo_be {
 struct rtw89_pktofld_info {
        struct list_head list;
        u8 id;
+       bool wildcard_6ghz;
 
-       /* Below fields are for 6 GHz RNR use only */
+       /* Below fields are for WiFi 6 chips 6 GHz RNR use only */
        u8 ssid[IEEE80211_MAX_SSID_LEN];
        u8 ssid_len;
        u8 bssid[ETH_ALEN];
index 51d3e61..2e89c18 100644 (file)
@@ -2447,6 +2447,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
        .dig_regs               = &rtw8851b_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_chanctx_num    = 0,
+       .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
                                  BIT(NL80211_BAND_5GHZ),
        .support_bandwidths     = BIT(NL80211_CHAN_WIDTH_20) |
index 2deadec..e93cee1 100644 (file)
@@ -2163,6 +2163,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
        .dig_regs               = &rtw8852a_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_chanctx_num    = 1,
+       .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
                                  BIT(NL80211_BAND_5GHZ),
        .support_bandwidths     = BIT(NL80211_CHAN_WIDTH_20) |
index d025c41..85908c5 100644 (file)
@@ -2597,6 +2597,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
        .dig_regs               = &rtw8852b_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_chanctx_num    = 0,
+       .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
                                  BIT(NL80211_BAND_5GHZ),
        .support_bandwidths     = BIT(NL80211_CHAN_WIDTH_20) |
index 17e6164..db354af 100644 (file)
@@ -2934,6 +2934,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
        .dig_regs               = &rtw8852c_dig_regs,
        .tssi_dbw_table         = &rtw89_8852c_tssi_dbw_table,
        .support_chanctx_num    = 2,
+       .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
                                  BIT(NL80211_BAND_5GHZ) |
                                  BIT(NL80211_BAND_6GHZ),
index 0a5dc42..b45a96f 100644 (file)
@@ -2545,6 +2545,7 @@ const struct rtw89_chip_info rtw8922a_chip_info = {
        .dig_regs               = &rtw8922a_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_chanctx_num    = 2,
+       .support_rnr            = true,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
                                  BIT(NL80211_BAND_5GHZ) |
                                  BIT(NL80211_BAND_6GHZ),