All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH 08/12] iwlwifi: mvm: Refactor setting of SSIDs for 6GHz scan
Date: Thu,  5 Aug 2021 13:19:30 +0300	[thread overview]
Message-ID: <iwlwifi.20210805130823.02512b7a1443.Ibb023b09b86179ed049a195f4e32e887c2f4971d@changeid> (raw)
In-Reply-To: <20210805101934.431479-1-luca@coelho.fi>

From: Ilan Peer <ilan.peer@intel.com>

- Short SSIDs should always be added for direct SSIDs included
  in the scan request. However, this was not done in case that
  information for collocated APs was included. Fix this.
- With the above fix, if the FW also supports discovery of hidden
  APs over the 6GHz band, also set the corresponding full SSID
  information.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 104 +++++-------------
 1 file changed, 28 insertions(+), 76 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index 82ab08af0e21..e1b436e805b1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -1661,22 +1661,32 @@ iwl_mvm_umac_scan_cfg_channels_v6(struct iwl_mvm *mvm,
 }
 
 static int
-iwl_mvm_umac_scan_fill_6g_chan_list(struct iwl_mvm_scan_params *params,
-				    __le32 *cmd_short_ssid, u8 *cmd_bssid,
-				    u8 *scan_ssid_num, u8 *bssid_num)
+iwl_mvm_umac_scan_fill_6g_chan_list(struct iwl_mvm *mvm,
+				    struct iwl_mvm_scan_params *params,
+				     struct iwl_scan_probe_params_v4 *pp)
 {
 	int j, idex_s = 0, idex_b = 0;
 	struct cfg80211_scan_6ghz_params *scan_6ghz_params =
 		params->scan_6ghz_params;
+	bool hidden_supported = fw_has_capa(&mvm->fw->ucode_capa,
+					    IWL_UCODE_TLV_CAPA_HIDDEN_6GHZ_SCAN);
 
-	if (!params->n_6ghz_params) {
-		for (j = 0; j < params->n_ssids; j++) {
-			cmd_short_ssid[idex_s++] =
-				cpu_to_le32(~crc32_le(~0, params->ssids[j].ssid,
-						      params->ssids[j].ssid_len));
-			(*scan_ssid_num)++;
+	for (j = 0; j < params->n_ssids && idex_s < SCAN_SHORT_SSID_MAX_SIZE;
+	     j++) {
+		if (!params->ssids[j].ssid_len)
+			continue;
+
+		pp->short_ssid[idex_s] =
+			cpu_to_le32(~crc32_le(~0, params->ssids[j].ssid,
+					      params->ssids[j].ssid_len));
+
+		if (hidden_supported) {
+			pp->direct_scan[idex_s].id = WLAN_EID_SSID;
+			pp->direct_scan[idex_s].len = params->ssids[j].ssid_len;
+			memcpy(pp->direct_scan[idex_s].ssid, params->ssids[j].ssid,
+			       params->ssids[j].ssid_len);
 		}
-		return 0;
+		idex_s++;
 	}
 
 	/*
@@ -1693,31 +1703,32 @@ iwl_mvm_umac_scan_fill_6g_chan_list(struct iwl_mvm_scan_params *params,
 		/* First, try to place the short SSID */
 		if (scan_6ghz_params[j].short_ssid_valid) {
 			for (k = 0; k < idex_s; k++) {
-				if (cmd_short_ssid[k] ==
+				if (pp->short_ssid[k] ==
 				    cpu_to_le32(scan_6ghz_params[j].short_ssid))
 					break;
 			}
 
 			if (k == idex_s && idex_s < SCAN_SHORT_SSID_MAX_SIZE) {
-				cmd_short_ssid[idex_s++] =
+				pp->short_ssid[idex_s++] =
 					cpu_to_le32(scan_6ghz_params[j].short_ssid);
-				(*scan_ssid_num)++;
 			}
 		}
 
 		/* try to place BSSID for the same entry */
 		for (k = 0; k < idex_b; k++) {
-			if (!memcmp(&cmd_bssid[ETH_ALEN * k],
+			if (!memcmp(&pp->bssid_array[k],
 				    scan_6ghz_params[j].bssid, ETH_ALEN))
 				break;
 		}
 
 		if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE) {
-			memcpy(&cmd_bssid[ETH_ALEN * idex_b++],
+			memcpy(&pp->bssid_array[idex_b++],
 			       scan_6ghz_params[j].bssid, ETH_ALEN);
-			(*bssid_num)++;
 		}
 	}
+
+	pp->short_ssid_num = idex_s;
+	pp->bssid_num = idex_b;
 	return 0;
 }
 
@@ -1865,60 +1876,6 @@ iwl_mvm_umac_scan_cfg_channels_v6_6g(struct iwl_mvm_scan_params *params,
 	}
 }
 
-static void
-iwl_mvm_umac_scan_cfg_6g_direct_ssids(struct iwl_mvm *mvm,
-				      struct iwl_mvm_scan_params *params,
-				      struct iwl_scan_probe_params_v4 *pp)
-{
-	u8 next_free_idx = pp->short_ssid_num;
-	int i;
-
-	if (!fw_has_capa(&mvm->fw->ucode_capa,
-			 IWL_UCODE_TLV_CAPA_HIDDEN_6GHZ_SCAN)) {
-		IWL_DEBUG_SCAN(mvm,
-			       "6GHz hidden scan: Not supported by FW\n");
-		return;
-	}
-
-	for (i = params->n_ssids - 1; i >= 0; i--) {
-		__le32 short_ssid;
-		u8 ssid_idx, j;
-
-		if (!params->ssids[i].ssid_len)
-			continue;
-
-		short_ssid = cpu_to_le32(~crc32_le(~0, params->ssids[i].ssid,
-						   params->ssids[i].ssid_len));
-
-		for (j = 0; j < pp->short_ssid_num; j++)
-			if (short_ssid == pp->short_ssid[j])
-				break;
-
-		if (j == pp->short_ssid_num) {
-			/*
-			 * If there are no available slots for the short SSID, do not
-			 * place it.
-			 */
-			if (next_free_idx < SCAN_SHORT_SSID_MAX_SIZE)
-				ssid_idx = next_free_idx++;
-			else
-				continue;
-		} else {
-			ssid_idx = j;
-		}
-
-		if (ssid_idx >= PROBE_OPTION_MAX)
-			continue;
-
-		pp->direct_scan[ssid_idx].id = WLAN_EID_SSID;
-		pp->direct_scan[ssid_idx].len = params->ssids[i].ssid_len;
-		memcpy(pp->direct_scan[ssid_idx].ssid, params->ssids[i].ssid,
-		       params->ssids[i].ssid_len);
-	}
-
-	pp->short_ssid_num = next_free_idx;
-}
-
 static u8 iwl_mvm_scan_umac_chan_flags_v2(struct iwl_mvm *mvm,
 					  struct iwl_mvm_scan_params *params,
 					  struct ieee80211_vif *vif)
@@ -2445,15 +2402,10 @@ static int iwl_mvm_scan_umac_v14(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	cp->n_aps_override[0] = IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY;
 	cp->n_aps_override[1] = IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS;
 
-	ret = iwl_mvm_umac_scan_fill_6g_chan_list(params, pb->short_ssid,
-						  pb->bssid_array[0],
-						  &pb->short_ssid_num,
-						  &pb->bssid_num);
+	ret = iwl_mvm_umac_scan_fill_6g_chan_list(mvm, params, pb);
 	if (ret)
 		return ret;
 
-	iwl_mvm_umac_scan_cfg_6g_direct_ssids(mvm, params, pb);
-
 	iwl_mvm_umac_scan_cfg_channels_v6_6g(params,
 					     params->n_channels,
 					     pb, cp, vif->type);
-- 
2.32.0


  parent reply	other threads:[~2021-08-05 10:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 10:19 [PATCH 00/12] iwlwifi: updates intended for v5.15 2021-08-05 Luca Coelho
2021-08-05 10:19 ` [PATCH 01/12] iwlwifi: mvm: d3: separate TKIP data from key iteration Luca Coelho
2021-08-26 20:35   ` Luca Coelho
2021-08-05 10:19 ` [PATCH 02/12] iwlwifi: mvm: d3: remove fixed cmd_flags argument Luca Coelho
2021-08-05 10:19 ` [PATCH 03/12] iwlwifi: mvm: d3: refactor TSC/RSC configuration Luca Coelho
2021-08-05 10:19 ` [PATCH 04/12] iwlwifi: mvm: d3: add separate key iteration for GTK type Luca Coelho
2021-08-05 10:19 ` [PATCH 05/12] iwlwifi: mvm: d3: make key reprogramming iteration optional Luca Coelho
2021-08-05 10:19 ` [PATCH 06/12] iwlwifi: mvm: d3: implement RSC command version 5 Luca Coelho
2021-08-05 10:19 ` [PATCH 07/12] iwlwifi: mvm: silently drop encrypted frames for unknown station Luca Coelho
2021-08-05 10:19 ` Luca Coelho [this message]
2021-08-05 10:19 ` [PATCH 09/12] iwlwifi: mvm: fix access to BSS elements Luca Coelho
2021-08-05 10:19 ` [PATCH 10/12] iwlwifi: rename ACPI_SAR_NUM_CHAIN_LIMITS to ACPI_SAR_NUM_CHAINS Luca Coelho
2021-08-05 10:19 ` [PATCH 11/12] iwlwifi: convert flat SAR profile table to a struct version Luca Coelho
2021-08-05 10:19 ` [PATCH 12/12] iwlwifi: remove ACPI_SAR_NUM_TABLES definition Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iwlwifi.20210805130823.02512b7a1443.Ibb023b09b86179ed049a195f4e32e887c2f4971d@changeid \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.