Kaynağa Gözat

qcacld-3.0: Add logic to force SCC in SAP+STA concurrency - Part 2

If STA is up on a a DFS or passive or LTE unsafe channel & SAP is
comings up that causes MCC, move SAP to the other band if DBS
is supported. This logic is enabled only if gWlanMccToSccSwitchMode
is set to QDF_MCC_TO_SCC_SWITCH_FORCE_WITHOUT_DISCONNECTION.

Change-Id: I5d393a21301f3fa838f7cf38620fb1d57ae1d57a
CRs-Fixed: 2063060
Tushnim Bhattacharyya 7 yıl önce
ebeveyn
işleme
9a92999835

+ 7 - 6
core/hdd/src/wlan_hdd_cfg80211.c

@@ -14880,12 +14880,13 @@ static bool wlan_hdd_handle_sap_sta_dfs_conc(hdd_adapter_t *adapter,
 	}
 
 	/*
-	 * If channel is 0 or DFS then better to call pcl and find out the
-	 * best channel. If channel is non-dfs 5 GHz then better move SAP
-	 * to STA's channel to make scc, so we have room for 3port MCC
-	 * scenario.
+     * If channel is 0 or DFS or LTE unsafe then better to call pcl and
+	 * find out the best channel. If channel is non-dfs 5 GHz then
+	 * better move SAP to STA's channel to make scc, so we have room
+	 * for 3port MCC scenario.
 	 */
-	if ((0 == channel) || wlan_reg_is_dfs_ch(hdd_ctx->hdd_pdev, channel))
+	if ((0 == channel) || wlan_reg_is_dfs_ch(hdd_ctx->hdd_pdev, channel) ||
+		!policy_mgr_is_safe_channel(hdd_ctx->hdd_psoc, channel))
 		channel = policy_mgr_get_nondfs_preferred_channel(
 			hdd_ctx->hdd_psoc, PM_SAP_MODE, true);
 
@@ -14893,7 +14894,7 @@ static bool wlan_hdd_handle_sap_sta_dfs_conc(hdd_adapter_t *adapter,
 	qdf_event_reset(&hostapd_state->qdf_event);
 	status = wlansap_set_channel_change_with_csa(
 			WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter), channel,
-			hdd_ap_ctx->sapConfig.ch_width_orig);
+			hdd_ap_ctx->sapConfig.ch_width_orig, false);
 
 	if (QDF_STATUS_SUCCESS != status) {
 		hdd_err("Set channel with CSA IE failed, can't allow STA");

+ 1 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -2628,7 +2628,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_channel,
 	status = wlansap_set_channel_change_with_csa(
 		WLAN_HDD_GET_SAP_CTX_PTR(pHostapdAdapter),
 		(uint32_t)target_channel,
-		target_bw);
+		target_bw, true);
 
 	if (QDF_STATUS_SUCCESS != status) {
 		hdd_err("SAP set channel failed for channel: %d, bw: %d",

+ 1 - 1
core/sap/inc/sap_api.h

@@ -961,7 +961,7 @@ QDF_STATUS wlansap_disassoc_sta(void *p_cds_gctx,
 QDF_STATUS wlansap_deauth_sta(void *p_cds_gctx,
 			struct tagCsrDelStaParams *pDelStaParams);
 QDF_STATUS wlansap_set_channel_change_with_csa(void *p_cds_gctx,
-			uint32_t targetChannel, enum phy_ch_width target_bw);
+	uint32_t targetChannel, enum phy_ch_width target_bw, bool strict);
 QDF_STATUS wlansap_set_key_sta(void *p_cds_gctx,
 	tCsrRoamSetKey *pSetKeyInfo);
 QDF_STATUS wlansap_get_assoc_stations(void *p_cds_gctx,

+ 9 - 0
core/sap/src/sap_fsm.c

@@ -1668,6 +1668,15 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context,
 					sap_context->channel,
 					sap_context->csr_roamProfile.phyMode,
 					sap_context->cc_switch_mode);
+			if (QDF_IS_STATUS_ERROR(
+				policy_mgr_valid_sap_conc_channel_check(
+					mac_ctx->psoc, &con_ch,
+					sap_context->channel)))	{
+				QDF_TRACE(QDF_MODULE_ID_SAP,
+					QDF_TRACE_LEVEL_WARN,
+					FL("SAP can't start (no MCC)"));
+				return QDF_STATUS_E_ABORTED;
+			}
 			if (con_ch && !wlan_reg_is_dfs_ch(mac_ctx->pdev,
 						con_ch)) {
 				QDF_TRACE(QDF_MODULE_ID_SAP,

+ 8 - 1
core/sap/src/sap_module.c

@@ -1711,6 +1711,8 @@ static QDF_STATUS wlansap_update_csa_channel_params(ptSapContext sap_context,
  * @p_cds_gctx: Pointer to cds global context structure
  * @targetChannel: Target channel
  * @target_bw: Target bandwidth
+ * @strict: if true switch to the requested channel always, fail
+ *        otherwise
  *
  * This api function does a channel change to the target channel specified.
  * CSA IE is included in the beacons before doing a channel change.
@@ -1719,7 +1721,7 @@ static QDF_STATUS wlansap_update_csa_channel_params(ptSapContext sap_context,
  */
 QDF_STATUS
 wlansap_set_channel_change_with_csa(void *p_cds_gctx, uint32_t targetChannel,
-					enum phy_ch_width target_bw)
+					enum phy_ch_width target_bw, bool strict)
 {
 
 	ptSapContext sapContext = NULL;
@@ -1745,6 +1747,11 @@ wlansap_set_channel_change_with_csa(void *p_cds_gctx, uint32_t targetChannel,
 	}
 	pMac = PMAC_STRUCT(hHal);
 
+	if (strict && !policy_mgr_is_safe_channel(pMac->psoc, targetChannel)) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+			"%u is unsafe channel", targetChannel);
+		return QDF_STATUS_E_FAULT;
+	}
 	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
 		"%s: sap chan:%d target:%d conn on 5GHz:%d",
 		__func__, sapContext->channel, targetChannel,