Explorar el Código

qcacld-3.0: Enable intra band for LFR3 roaming channel map

If intra band is enabled, just build roam channel map from valid
channel list, ignore all other ways:
	1. from the occupied channels list
	2. from ini
	3. channels in the neighbor list

then channel map will include full channels of that band except
dfs/unsafe channels, which make roam scan time much longer.

Fix:
Firt try to get channel cache from following way as config:
        1. from the occupied channels list
        2. from ini
        3. channels in the neighbor list
Then filter channels by intra band config.

If channel num is 0,  use full channel list from same band
except dfs/unsafe channels.

Refactor roam scan channel retrieve code, converge duplicate code
for DFS, unsafe, intra band check.

Change-Id: I69e28be76c05284d32e237b9af33d5c01b9bb742
CRs-Fixed: 2541937
Jianmin Zhu hace 5 años
padre
commit
b136060fc3
Se han modificado 1 ficheros con 153 adiciones y 269 borrados
  1. 153 269
      core/sme/src/csr/csr_api_roam.c

+ 153 - 269
core/sme/src/csr/csr_api_roam.c

@@ -2357,8 +2357,91 @@ QDF_STATUS csr_get_tsm_stats(struct mac_context *mac,
 	return status;
 }
 
-
 #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD)
+/**
+ * csr_check_band_freq_match() - check if passed band and ch freq match
+ * @band: band to match with channel frequency
+ * @freq: freq to match with band
+ *
+ * Return: bool if match else false
+ */
+static bool
+csr_check_band_freq_match(enum band_info band, uint32_t freq)
+{
+	if (band == BAND_ALL)
+		return true;
+
+	if (band == BAND_2G && WLAN_REG_IS_24GHZ_CH_FREQ(freq))
+		return true;
+
+	if (band == BAND_5G && WLAN_REG_IS_5GHZ_CH_FREQ(freq))
+		return true;
+
+	return false;
+}
+
+/**
+ * is_dfs_unsafe_extra_band_chan() - check if dfs unsafe or extra band channel
+ * @mac_ctx: MAC context
+ * @freq: channel freq to check
+ * @band: band for intra band check
+.*.
+ * Return: bool if match else false
+ */
+static bool
+is_dfs_unsafe_extra_band_chan(struct mac_context *mac_ctx, uint32_t freq,
+			      enum band_info band)
+{
+	uint16_t  unsafe_chan[NUM_CHANNELS];
+	uint16_t  unsafe_chan_cnt = 0;
+	uint16_t  cnt = 0;
+	bool      is_unsafe_chan;
+	qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
+
+	if (!qdf_ctx) {
+		cds_err("qdf_ctx is NULL");
+		return true;
+	}
+
+	if ((mac_ctx->mlme_cfg->lfr.roaming_dfs_channel ==
+	     ROAMING_DFS_CHANNEL_DISABLED ||
+	     mac_ctx->roam.configParam.sta_roam_policy.dfs_mode ==
+	     CSR_STA_ROAM_POLICY_DFS_DISABLED) &&
+	    (wlan_reg_is_dfs_for_freq(mac_ctx->pdev, freq))) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
+			  ("dfs freq %d"), freq);
+		return true;
+	}
+
+	pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan,
+				    &unsafe_chan_cnt,
+				    sizeof(unsafe_chan));
+	if (mac_ctx->roam.configParam.sta_roam_policy.skip_unsafe_channels &&
+	    unsafe_chan_cnt) {
+		is_unsafe_chan = false;
+		for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) {
+			if (unsafe_chan[cnt] ==
+			    wlan_reg_freq_to_chan(mac_ctx->pdev, freq)) {
+				is_unsafe_chan = true;
+				QDF_TRACE(QDF_MODULE_ID_SME,
+					  QDF_TRACE_LEVEL_DEBUG,
+					  ("ignoring unsafe channel freq %d"),
+					  freq);
+				return true;
+			}
+		}
+	}
+	sme_debug("band %d", band);
+	if (!csr_check_band_freq_match(band, freq)) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
+			  ("ignoring non-intra band freq %d"),
+			freq);
+		return true;
+	}
+
+	return false;
+}
+
 /**
  * csr_fetch_ch_lst_from_received_list() - fetch channel list from received list
  * and update req msg
@@ -2379,62 +2462,17 @@ csr_fetch_ch_lst_from_received_list(struct mac_context *mac_ctx,
 	uint8_t i = 0;
 	uint8_t num_channels = 0;
 	uint32_t *freq_lst = NULL;
-	uint16_t  unsafe_chan[NUM_CHANNELS];
-	uint16_t  unsafe_chan_cnt = 0;
-	uint16_t  cnt = 0;
-	bool      is_unsafe_chan;
-	qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
-	bool is_dfs_ch;
-
-	if (!qdf_ctx) {
-		cds_err("qdf_ctx is NULL");
-		return;
-	}
-	pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan,
-			&unsafe_chan_cnt,
-			sizeof(unsafe_chan));
+	enum band_info band = BAND_ALL;
 
 	if (curr_ch_lst_info->numOfChannels == 0)
 		return;
 
 	freq_lst = curr_ch_lst_info->freq_list;
 	for (i = 0; i < curr_ch_lst_info->numOfChannels; i++) {
-		is_dfs_ch = wlan_reg_is_dfs_ch(
-				mac_ctx->pdev,
-				wlan_reg_freq_to_chan(mac_ctx->pdev,
-						      *freq_lst));
-		if (((mac_ctx->mlme_cfg->lfr.roaming_dfs_channel ==
-			 ROAMING_DFS_CHANNEL_DISABLED) ||
-		     (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode ==
-			 CSR_STA_ROAM_POLICY_DFS_DISABLED)) &&
-		     is_dfs_ch) {
-			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
-				  ("ignoring dfs channel freq %d"), *freq_lst);
+		if (is_dfs_unsafe_extra_band_chan(mac_ctx, *freq_lst, band)) {
 			freq_lst++;
 			continue;
 		}
-
-		if (mac_ctx->roam.configParam.sta_roam_policy.
-				skip_unsafe_channels &&
-				unsafe_chan_cnt) {
-			is_unsafe_chan = false;
-			for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) {
-				if (unsafe_chan[cnt] ==
-				    wlan_reg_freq_to_chan(
-						mac_ctx->pdev, *freq_lst)) {
-					is_unsafe_chan = true;
-					break;
-				}
-			}
-			if (is_unsafe_chan) {
-				QDF_TRACE(QDF_MODULE_ID_SME,
-					  QDF_TRACE_LEVEL_DEBUG,
-					  ("ignoring unsafe channel freq %d"),
-					  *freq_lst);
-				freq_lst++;
-				continue;
-			}
-		}
 		req_buf->ConnectedNetwork.chan_freq_cache[num_channels++] = *freq_lst;
 		freq_lst++;
 	}
@@ -17916,28 +17954,6 @@ csr_update_roam_scan_offload_request(struct mac_context *mac_ctx,
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
 
 #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD)
-/**
- * csr_check_band_freq_match() - check if passed band and ch freq match
- * @band: band to match with channel frequency
- * @freq: freq to match with band
- *
- * Return: bool if match else false
- */
-static bool
-csr_check_band_freq_match(enum band_info band, uint32_t freq)
-{
-	if (band == BAND_ALL)
-		return true;
-
-	if (band == BAND_2G && WLAN_REG_IS_24GHZ_CH_FREQ(freq))
-		return true;
-
-	if (band == BAND_5G && WLAN_REG_IS_5GHZ_CH_FREQ(freq))
-		return true;
-
-	return false;
-}
-
 /**
  * csr_populate_roam_chan_list()
  * parameters
@@ -17956,21 +17972,6 @@ csr_populate_roam_chan_list(struct mac_context *mac_ctx,
 	uint8_t i = 0;
 	uint8_t num_channels = 0;
 	uint32_t *freq_lst = src->freq_list;
-	uint16_t  unsafe_chan[NUM_CHANNELS];
-	uint16_t  unsafe_chan_cnt = 0;
-	uint16_t  cnt = 0;
-	bool      is_unsafe_chan;
-	bool      is_dfs_ch;
-	qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
-
-	if (!qdf_ctx) {
-		cds_err("qdf_ctx is NULL");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan,
-			&unsafe_chan_cnt,
-			 sizeof(unsafe_chan));
 
 	/*
 	 * The INI channels need to be filtered with respect to the current band
@@ -17988,46 +17989,13 @@ csr_populate_roam_chan_list(struct mac_context *mac_ctx,
 	num_channels = dst->ChannelCount;
 	for (i = 0; i < src->numOfChannels; i++) {
 		if (csr_is_channel_present_in_list(dst->chan_freq_cache,
-						   num_channels, *freq_lst))
-			continue;
-		if (!csr_check_band_freq_match(
-			band, *freq_lst))
-			continue;
-		is_dfs_ch = wlan_reg_is_dfs_ch(
-			mac_ctx->pdev,
-			wlan_reg_freq_to_chan(mac_ctx->pdev, *freq_lst));
-		/* Allow DFS channels only if the DFS roaming is enabled */
-		if (((mac_ctx->mlme_cfg->lfr.roaming_dfs_channel ==
-			 ROAMING_DFS_CHANNEL_DISABLED) ||
-		     (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode ==
-			 CSR_STA_ROAM_POLICY_DFS_DISABLED)) &&
-		    is_dfs_ch) {
-			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
-				  ("ignoring dfs channel freq %d"), *freq_lst);
+						   num_channels, *freq_lst)) {
 			freq_lst++;
 			continue;
 		}
-
-		if (mac_ctx->roam.configParam.sta_roam_policy.
-				skip_unsafe_channels &&
-				unsafe_chan_cnt) {
-			is_unsafe_chan = false;
-			for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) {
-				if (unsafe_chan[cnt] ==
-				    wlan_reg_freq_to_chan(mac_ctx->pdev,
-							  *freq_lst)) {
-					is_unsafe_chan = true;
-					break;
-				}
-			}
-			if (is_unsafe_chan) {
-				QDF_TRACE(QDF_MODULE_ID_SME,
-					  QDF_TRACE_LEVEL_DEBUG,
-					  ("ignoring unsafe channel %d"),
-					  *freq_lst);
-				freq_lst++;
-				continue;
-			}
+		if (is_dfs_unsafe_extra_band_chan(mac_ctx, *freq_lst, band)) {
+			freq_lst++;
+			continue;
 		}
 		dst->chan_freq_cache[num_channels++] = *freq_lst;
 		freq_lst++;
@@ -18089,58 +18057,30 @@ csr_fetch_ch_lst_from_occupied_lst(struct mac_context *mac_ctx,
 {
 	uint8_t i = 0;
 	uint8_t num_channels = 0;
-	uint32_t *ch_lst =
-		mac_ctx->scan.occupiedChannels[session_id].channel_freq_list;
-	uint16_t  unsafe_chan[NUM_CHANNELS];
-	uint16_t  unsafe_chan_cnt = 0;
-	uint16_t  cnt = 0;
-	bool      is_unsafe_chan;
-	qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
+	uint32_t op_freq;
+	uint8_t op_chan;
+	struct csr_roam_session *session;
+	uint32_t *ch_lst;
+	enum band_info band = BAND_ALL;
 
-	if (!qdf_ctx) {
-		cds_err("qdf_ctx is NULL");
-		return;
-	}
+	session = &mac_ctx->roam.roamSession[session_id];
+	ch_lst = mac_ctx->scan.occupiedChannels[session_id].channel_freq_list;
+	op_freq = session->connectedProfile.op_freq;
 
 	QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
 		"Num of channels before filtering=%d",
 		mac_ctx->scan.occupiedChannels[session_id].numChannels);
-	pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan,
-			&unsafe_chan_cnt,
-			 sizeof(unsafe_chan));
+
+	if (CSR_IS_ROAM_INTRA_BAND_ENABLED(mac_ctx)) {
+		op_chan = wlan_reg_freq_to_chan(mac_ctx->pdev, op_freq);
+		band = csr_get_rf_band(op_chan);
+	}
 	for (i = 0; i < mac_ctx->scan.occupiedChannels[session_id].numChannels;
 	     i++) {
-		if (((mac_ctx->mlme_cfg->lfr.roaming_dfs_channel ==
-			 ROAMING_DFS_CHANNEL_DISABLED) ||
-		     (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode ==
-			 CSR_STA_ROAM_POLICY_DFS_DISABLED)) &&
-			 (wlan_reg_is_dfs_ch(mac_ctx->pdev,
-				wlan_reg_freq_to_chan(mac_ctx->pdev, *ch_lst)))) {
-			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
-				("ignoring dfs channel freq %d"), *ch_lst);
+		if (is_dfs_unsafe_extra_band_chan(mac_ctx, *ch_lst, band)) {
 			ch_lst++;
 			continue;
 		}
-
-		if (mac_ctx->roam.configParam.sta_roam_policy.
-				skip_unsafe_channels &&
-				unsafe_chan_cnt) {
-			is_unsafe_chan = false;
-			for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) {
-				if (unsafe_chan[cnt] == wlan_reg_freq_to_chan(mac_ctx->pdev, *ch_lst)) {
-					is_unsafe_chan = true;
-					break;
-				}
-			}
-			if (is_unsafe_chan) {
-				QDF_TRACE(QDF_MODULE_ID_SME,
-						QDF_TRACE_LEVEL_DEBUG,
-					("ignoring unsafe channel freq %d"),
-					*ch_lst);
-				ch_lst++;
-				continue;
-			}
-		}
 		req_buf->ConnectedNetwork.chan_freq_cache[num_channels++] = *ch_lst;
 		if (*ch_lst)
 			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
@@ -18174,23 +18114,17 @@ csr_fetch_valid_ch_lst(struct mac_context *mac_ctx,
 	uint32_t host_channels = 0;
 	uint32_t *ch_freq_list = NULL;
 	uint8_t i = 0, num_channels = 0;
-	uint16_t  unsafe_chan[NUM_CHANNELS];
-	uint16_t  unsafe_chan_cnt = 0;
-	uint16_t  cnt = 0;
-	bool      is_unsafe_chan;
-	qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	enum band_info band = BAND_ALL;
 	uint8_t op_chan;
+	uint32_t op_freq;
+	struct csr_roam_session *session;
 
-	if (!qdf_ctx) {
-		cds_err("qdf_ctx is NULL");
-		return QDF_STATUS_E_FAILURE;
+	session = &mac_ctx->roam.roamSession[session_id];
+	op_freq = session->connectedProfile.op_freq;
+	if (CSR_IS_ROAM_INTRA_BAND_ENABLED(mac_ctx)) {
+		op_chan = wlan_reg_freq_to_chan(mac_ctx->pdev, op_freq);
+		band = csr_get_rf_band(op_chan);
 	}
-
-	pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan,
-			&unsafe_chan_cnt,
-			sizeof(unsafe_chan));
-
 	host_channels = sizeof(mac_ctx->roam.valid_ch_freq_list);
 	status = csr_get_cfg_valid_channels(mac_ctx,
 					    mac_ctx->roam.valid_ch_freq_list,
@@ -18200,63 +18134,15 @@ csr_fetch_valid_ch_lst(struct mac_context *mac_ctx,
 			 "Failed to get the valid channel list");
 		return status;
 	}
-
-	if (CSR_IS_ROAM_INTRA_BAND_ENABLED(mac_ctx)) {
-		op_chan = wlan_reg_freq_to_chan(
-					mac_ctx->pdev,
-					mac_ctx->roam.roamSession[session_id].
-					connectedProfile.op_freq);
-		band = csr_get_rf_band(op_chan);
-		sme_debug("updated band %d operational freq %d", band,
-			  mac_ctx->roam.roamSession[session_id].
-			  connectedProfile.op_freq);
-	}
-
 	ch_freq_list = mac_ctx->roam.valid_ch_freq_list;
 	mac_ctx->roam.numValidChannels = host_channels;
 
 	for (i = 0; i < mac_ctx->roam.numValidChannels; i++) {
-		uint8_t channel =
-			wlan_reg_freq_to_chan(mac_ctx->pdev, *ch_freq_list);
-
-		if (!csr_check_band_freq_match(band, *ch_freq_list)) {
-			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
-				("ignoring non-intra band channel %d"),
-				channel);
+		if (is_dfs_unsafe_extra_band_chan(mac_ctx, *ch_freq_list,
+						  band)) {
 			ch_freq_list++;
 			continue;
 		}
-
-		if (((mac_ctx->mlme_cfg->lfr.roaming_dfs_channel ==
-			 ROAMING_DFS_CHANNEL_DISABLED) ||
-		     (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode ==
-			 CSR_STA_ROAM_POLICY_DFS_DISABLED)) &&
-		    (wlan_reg_is_dfs_ch(mac_ctx->pdev, channel))) {
-			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
-				("ignoring dfs channel %d"), channel);
-			ch_freq_list++;
-			continue;
-		}
-
-		if (mac_ctx->roam.configParam.
-				sta_roam_policy.skip_unsafe_channels &&
-				unsafe_chan_cnt) {
-			is_unsafe_chan = false;
-			for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) {
-				if (unsafe_chan[cnt] == channel) {
-					is_unsafe_chan = true;
-					break;
-				}
-			}
-			if (is_unsafe_chan) {
-				QDF_TRACE(QDF_MODULE_ID_SME,
-						QDF_TRACE_LEVEL_DEBUG,
-					("ignoring unsafe channel %d"),
-					channel);
-				ch_freq_list++;
-				continue;
-			}
-		}
 		req_buf->ConnectedNetwork.chan_freq_cache[num_channels++] =
 								*ch_freq_list;
 		ch_freq_list++;
@@ -18499,52 +18385,50 @@ csr_create_roam_scan_offload_request(struct mac_context *mac_ctx,
 		  ese_neighbor_list_recvd, curr_ch_lst_info->numOfChannels);
 #endif
 
-	if (!CSR_IS_ROAM_INTRA_BAND_ENABLED(mac_ctx)) {
-		if (ese_neighbor_list_recvd ||
-		    curr_ch_lst_info->numOfChannels == 0) {
-			/*
-			 * Retrieve the Channel Cache either from ini or from
-			 * the occupied channels list along with preferred
-			 * channel list configured by the client.
-			 * Give Preference to INI Channels
-			 */
-			if (specific_chan_info->numOfChannels) {
-				status = csr_fetch_ch_lst_from_ini(mac_ctx,
-								   roam_info,
-								   req_buf);
-				if (!QDF_IS_STATUS_SUCCESS(status)) {
-					QDF_TRACE(QDF_MODULE_ID_SME,
-						  QDF_TRACE_LEVEL_DEBUG,
-						  "Fetch channel list from ini failed");
-					qdf_mem_free(req_buf);
-					return NULL;
-				}
-			} else {
-				csr_fetch_ch_lst_from_occupied_lst(mac_ctx,
-						session_id, reason, req_buf,
-						roam_info);
-				/* Add the preferred channel list configured by
-				 * client to the roam channel list along with
-				 * occupied channel list.
-				 */
-				csr_add_ch_lst_from_roam_scan_list(mac_ctx,
-								   req_buf,
-								   roam_info);
-			}
+	if (ese_neighbor_list_recvd ||
+	    curr_ch_lst_info->numOfChannels == 0) {
+		/*
+		 * Retrieve the Channel Cache either from ini or from
+		 * the occupied channels list along with preferred
+		 * channel list configured by the client.
+		 * Give Preference to INI Channels
+		 */
+		if (specific_chan_info->numOfChannels) {
+			status = csr_fetch_ch_lst_from_ini(mac_ctx,
+							   roam_info,
+							   req_buf);
+		if (!QDF_IS_STATUS_SUCCESS(status)) {
+			QDF_TRACE(QDF_MODULE_ID_SME,
+				  QDF_TRACE_LEVEL_DEBUG,
+				  "Fetch channel list from ini failed");
+			qdf_mem_free(req_buf);
+			return NULL;
 		}
-#ifdef FEATURE_WLAN_ESE
-		else {
-			/*
-			 * If ESE is enabled, and a neighbor Report is received,
-			 * then Ignore the INI Channels or the Occupied Channel
-			 * List. Consider the channels in the neighbor list sent
-			 * by the ESE AP
+		} else {
+			csr_fetch_ch_lst_from_occupied_lst(mac_ctx, session_id,
+							   reason, req_buf,
+							   roam_info);
+			/* Add the preferred channel list configured by
+			 * client to the roam channel list along with
+			 * occupied channel list.
 			 */
-			csr_fetch_ch_lst_from_received_list(mac_ctx, roam_info,
-					curr_ch_lst_info, req_buf);
+			csr_add_ch_lst_from_roam_scan_list(mac_ctx,
+							   req_buf,
+							   roam_info);
 		}
-#endif
 	}
+#ifdef FEATURE_WLAN_ESE
+	else {
+		/*
+		 * If ESE is enabled, and a neighbor Report is received,
+		 * then Ignore the INI Channels or the Occupied Channel
+		 * List. Consider the channels in the neighbor list sent
+		 * by the ESE AP
+		 */
+		csr_fetch_ch_lst_from_received_list(mac_ctx, roam_info,
+						    curr_ch_lst_info, req_buf);
+	}
+#endif
 	if (req_buf->ConnectedNetwork.ChannelCount == 0) {
 		/* Maintain the Valid Channels List */
 		status = csr_fetch_valid_ch_lst(mac_ctx, req_buf, session_id);