Browse Source

qcacld-3.0: Prevent SCC channel filtering in PCL

Keep SCC channels in the PCL list, if SCC is allowed on those
frequencies.Do not remove these frequencies, if the
mandatory channel list doesn't have the SCC frequencies.

Also, whenever the user configured frequency of the SAP is
different following a STA disconnect, switch it back to the
home channel.

Change-Id: Ia5fe8943136791084de02a2d3a8ff250008978be
CRs-Fixed: 3196278
Surya Prakash Sivaraj 2 years ago
parent
commit
130b642843

+ 49 - 12
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -1593,6 +1593,7 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
 	struct policy_mgr_conc_connection_info info = {0};
 	uint8_t num_cxn_del = 0;
 	QDF_STATUS status;
+	uint32_t sta_gc_present = 0;
 
 	if (intf_ch_freq)
 		*intf_ch_freq = 0;
@@ -1601,12 +1602,6 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
 		policy_mgr_err("Invalid pm context");
 		return false;
 	}
-	if (!pm_ctx->do_sap_unsafe_ch_check)
-		return false;
-
-	if (!sta_sap_scc_on_dfs_chan && !sta_sap_scc_on_lte_coex_chan &&
-	    !sta_sap_scc_on_indoor_channel)
-		return false;
 
 	policy_mgr_get_sta_sap_scc_on_dfs_chnl(psoc, &sta_sap_scc_on_dfs_chnl_config_value);
 
@@ -1624,15 +1619,25 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
 					psoc, &op_ch_freq_list[cc_count],
 					&vdev_id[cc_count], PM_P2P_GO_MODE);
 
+	sta_gc_present =
+		policy_mgr_mode_specific_connection_count(psoc,
+							  PM_STA_MODE, NULL) +
+		policy_mgr_mode_specific_connection_count(psoc,
+							  PM_P2P_CLIENT_MODE,
+							  NULL);
+
+
 	for (i = 0 ; i < cc_count; i++) {
 		if (sap_vdev_id != INVALID_VDEV_ID &&
 		    sap_vdev_id != vdev_id[i])
 			continue;
+
 		if (policy_mgr_is_any_mode_active_on_band_along_with_session(
 				psoc,  vdev_id[i],
 				WLAN_REG_IS_24GHZ_CH_FREQ(op_ch_freq_list[i]) ?
 				POLICY_MGR_BAND_24 : POLICY_MGR_BAND_5))
 			continue;
+
 		if (sta_sap_scc_on_dfs_chan &&
 		    (sta_sap_scc_on_dfs_chnl_config_value != 2) &&
 		     wlan_reg_is_dfs_for_freq(pm_ctx->pdev,
@@ -1657,7 +1662,13 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
 					 curr_sap_freq);
 			break;
 		}
-
+		/* When STA+SAP SCC is allowed on indoor channel,
+		 * Restart the SAP when :
+		 * 1. The user configured SAP frequency is not
+		 * the same as current freq. (or)
+		 * 2. The frequency is not allowed in the indoor
+		 * channel.
+		 */
 		if (sta_sap_scc_on_indoor_channel &&
 		    wlan_reg_is_freq_indoor(pm_ctx->pdev, op_ch_freq_list[i]) &&
 		    pm_ctx->last_disconn_sta_freq == op_ch_freq_list[i]) {
@@ -1667,6 +1678,16 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
 					 curr_sap_freq);
 			break;
 		}
+
+		if (!sta_gc_present &&
+		    WLAN_REG_IS_24GHZ_CH_FREQ(op_ch_freq_list[i]) &&
+		    WLAN_REG_IS_5GHZ_CH_FREQ(pm_ctx->user_config_sap_ch_freq)) {
+			sap_vdev_id = vdev_id[i];
+			curr_sap_freq = op_ch_freq_list[i];
+			policy_mgr_debug("Indoor sap_ch_freq %u",
+					 curr_sap_freq);
+			break;
+		}
 	}
 
 	if (!curr_sap_freq) {
@@ -1679,6 +1700,7 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
 	policy_mgr_store_and_del_conn_info_by_vdev_id(psoc, sap_vdev_id,
 						      &info, &num_cxn_del);
 
+
 	/* Add the user config ch as first condidate */
 	pcl_channels[0] = pm_ctx->user_config_sap_ch_freq;
 	pcl_weight[0] = 0;
@@ -1689,18 +1711,35 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
 		pcl_len++;
 	else
 		pcl_len = 1;
+
+
 	for (i = 0; i < pcl_len; i++) {
 		if (pcl_channels[i] == curr_sap_freq)
 			continue;
-		if (!wlan_reg_is_same_band_freqs(
-				curr_sap_freq, pcl_channels[i]))
-			continue;
+
 		if (!policy_mgr_is_safe_channel(psoc, pcl_channels[i]) ||
 		    wlan_reg_is_dfs_for_freq(pm_ctx->pdev, pcl_channels[i]))
 			continue;
+
+		/* SAP moved to 2G, due to STA on DFS or Indoor where
+		 * concurrency is not allowed, now that there is no
+		 * STA/GC in 5G band, move 2.g SAP to 5G band if SAP
+		 * was initially started on 5G band.
+		 * Checking again here as pcl_channels[0] could be
+		 * on indoor which is not removed in policy_mgr_get_pcl
+		 */
+		if (!sta_gc_present &&
+		    !policy_mgr_sap_allowed_on_indoor_freq(pm_ctx->psoc,
+							   pm_ctx->pdev,
+							   pcl_channels[i])) {
+			policy_mgr_debug("Do not allow SAP on indoor frequency, STA is absent");
+			continue;
+		}
+
 		new_sap_freq = pcl_channels[i];
 		break;
 	}
+
 	/* Restore the connection entry */
 	if (num_cxn_del > 0)
 		policy_mgr_restore_deleted_conn_info(psoc, &info, num_cxn_del);
@@ -2055,7 +2094,6 @@ void policy_mgr_check_sap_restart(struct wlan_objmgr_psoc *psoc,
 				 vdev_id, ch_freq);
 
 end:
-	pm_ctx->do_sap_unsafe_ch_check = false;
 	pm_ctx->last_disconn_sta_freq = 0;
 }
 
@@ -2143,7 +2181,6 @@ static void __policy_mgr_check_sta_ap_concurrent_ch_intf(
 		}
 
 end:
-	pm_ctx->do_sap_unsafe_ch_check = false;
 	pm_ctx->last_disconn_sta_freq = 0;
 }
 

+ 22 - 4
components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -4016,13 +4016,20 @@ void policy_mgr_check_scc_sbs_channel(struct wlan_objmgr_psoc *psoc,
 		/*
 		 * STA + SAP where doing SCC on 5 GHz indoor channel.
 		 * STA moved/roamed to 2.4 GHz. Move SAP to initially
-		 * started channel
+		 * started channel.
+		 *
+		 * STA+SAP where STA is moved/roamed to 5GHz indoor
+		 * and SAP is on 2.4GHz due to previous concurrency.
+		 * Move SAP to STA channel on SCC.
 		 */
 		sta_sap_scc_on_indoor_channel_allowed =
 			policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(psoc);
-		if (wlan_reg_is_freq_indoor(pm_ctx->pdev, sap_ch_freq) &&
-		    WLAN_REG_IS_24GHZ_CH_FREQ(*intf_ch_freq) &&
-		    sta_sap_scc_on_indoor_channel_allowed) {
+
+		if (sta_sap_scc_on_indoor_channel_allowed &&
+		    ((wlan_reg_is_freq_indoor(pm_ctx->pdev, sap_ch_freq) &&
+		    WLAN_REG_IS_24GHZ_CH_FREQ(*intf_ch_freq)) ||
+		    (wlan_reg_is_freq_indoor(pm_ctx->pdev, *intf_ch_freq) &&
+		     WLAN_REG_IS_24GHZ_CH_FREQ(sap_ch_freq)))) {
 			status = policy_mgr_get_sap_mandatory_channel(
 							psoc, sap_ch_freq,
 							intf_ch_freq);
@@ -4032,6 +4039,17 @@ void policy_mgr_check_scc_sbs_channel(struct wlan_objmgr_psoc *psoc,
 			policy_mgr_err("No mandatory channels");
 		}
 
+		if (WLAN_REG_IS_24GHZ_CH_FREQ(sap_ch_freq) &&
+		    !WLAN_REG_IS_24GHZ_CH_FREQ(pm_ctx->user_config_sap_ch_freq) &&
+		    (wlan_reg_get_channel_state_for_freq(pm_ctx->pdev,
+							 *intf_ch_freq) == CHANNEL_STATE_ENABLE)) {
+			status = policy_mgr_get_sap_mandatory_channel(
+							psoc, sap_ch_freq,
+							intf_ch_freq);
+			if (QDF_IS_STATUS_SUCCESS(status))
+				return;
+		}
+
 		if (policy_mgr_is_current_hwmode_sbs(psoc) || sbs_mlo_present)
 			goto sbs_check;
 		/*

+ 0 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -3181,7 +3181,6 @@ static void policy_mgr_update_sta_scc_info_for_later_check(
 		    (pm_conc_connection_list[conn_index].mode == PM_SAP_MODE ||
 		    pm_conc_connection_list[conn_index].mode ==
 		    PM_P2P_GO_MODE)) {
-			pm_ctx->do_sap_unsafe_ch_check = true;
 			pm_ctx->last_disconn_sta_freq = sta_freq;
 			break;
 		}

+ 0 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -355,7 +355,6 @@ struct policy_mgr_psoc_priv_obj {
 	struct policy_mgr_conc_cbacks conc_cbacks;
 	uint32_t sap_mandatory_channels[NUM_CHANNELS];
 	uint32_t sap_mandatory_channels_len;
-	bool do_sap_unsafe_ch_check;
 	qdf_freq_t last_disconn_sta_freq;
 	uint32_t concurrency_mode;
 	uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];

+ 53 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c

@@ -2486,6 +2486,34 @@ bool policy_mgr_is_sap_mandatory_channel_set(struct wlan_objmgr_psoc *psoc)
 		return false;
 }
 
+static inline
+uint32_t policy_mgr_is_sta_on_indoor_channel(struct wlan_objmgr_psoc *psoc)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	uint32_t conn_index;
+	uint32_t freq = INVALID_CHANNEL_ID;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return freq;
+	}
+	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
+	for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
+	     conn_index++) {
+		if (pm_conc_connection_list[conn_index].mode == PM_STA_MODE &&
+		    wlan_reg_is_freq_indoor(pm_ctx->pdev,
+				pm_conc_connection_list[conn_index].freq) &&
+				pm_conc_connection_list[conn_index].in_use) {
+			freq = pm_conc_connection_list[conn_index].freq;
+			break;
+		}
+	}
+	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
+
+	return freq;
+}
+
 QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel(
 		struct wlan_objmgr_psoc *psoc, uint32_t *pcl_list_org,
 		uint8_t *weight_list_org, uint32_t *pcl_len_org)
@@ -2493,6 +2521,9 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel(
 	uint32_t i, j, pcl_len = 0;
 	bool found;
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	uint32_t indoor_sta_freq = INVALID_CHANNEL_ID;
+	bool scc_on_indoor =
+		 policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(psoc);
 
 	pm_ctx = policy_mgr_get_context(psoc);
 	if (!pm_ctx) {
@@ -2509,10 +2540,14 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel(
 		return QDF_STATUS_E_FAILURE;
 	}
 
+
 	for (i = 0; i < pm_ctx->sap_mandatory_channels_len; i++)
 		policy_mgr_debug("fav chan:%d",
 			pm_ctx->sap_mandatory_channels[i]);
 
+	if (scc_on_indoor)
+		indoor_sta_freq = policy_mgr_is_sta_on_indoor_channel(psoc);
+
 	for (i = 0; i < *pcl_len_org; i++) {
 		found = false;
 		if (i >= NUM_CHANNELS) {
@@ -2521,7 +2556,9 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel(
 		}
 		for (j = 0; j < pm_ctx->sap_mandatory_channels_len; j++) {
 			if (pcl_list_org[i] ==
-			    pm_ctx->sap_mandatory_channels[j]) {
+			    pm_ctx->sap_mandatory_channels[j] ||
+			    (scc_on_indoor &&
+			     pcl_list_org[i] == indoor_sta_freq)) {
 				found = true;
 				break;
 			}
@@ -2546,6 +2583,8 @@ policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc,
 	struct policy_mgr_pcl_list pcl;
 	uint32_t i;
 	uint32_t sap_new_freq;
+	bool sta_sap_scc_on_indoor_channel =
+		 policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(psoc);
 
 	pm_ctx = policy_mgr_get_context(psoc);
 	if (!pm_ctx) {
@@ -2630,6 +2669,19 @@ policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc,
 
 	sap_new_freq = pcl.pcl_list[0];
 	for (i = 0; i < pcl.pcl_len; i++) {
+		/* When sta_sap_scc_on_indoor_channel is enabled,
+		 * and if pcl contains SCC channel, then STA must
+		 * exist on the concurrent session. Therefore, choose
+		 * Indoor channel to restart SAP in SCC.
+		 */
+		if (wlan_reg_is_freq_indoor(pm_ctx->pdev, pcl.pcl_list[i]) &&
+		    sta_sap_scc_on_indoor_channel) {
+			sap_new_freq = pcl.pcl_list[i];
+			policy_mgr_debug("Choose Indoor channel from PCL list %d sap_new_freq %d",
+					 *intf_ch_freq, sap_new_freq);
+			goto update_freq;
+		}
+
 		if (pcl.pcl_list[i] ==  pm_ctx->user_config_sap_ch_freq) {
 			sap_new_freq = pcl.pcl_list[i];
 			policy_mgr_debug("Prefer starting SAP on user configured channel:%d",