Ver Fonte

qcacld-3.0: Fix unsafe check failure for SAP

With MACRO FEATURE_WLAN_CH_AVOID_EXT enabled,
"restriction_mask" can only be checked if
coex_unsafe_chan_nb_user_prefer = 1. If the INI
coex_unsafe_chan_nb_user_prefer = 0, do not need to check
"restriction_mask". It will remain uninitialized 0.

Change-Id: If7bd1223ee3779b72fadb40e622f682db03f4ea5
CRs-Fixed: 3287634
Liangwei Dong há 2 anos atrás
pai
commit
be5cc24258

+ 2 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -1563,7 +1563,8 @@ bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc,
 		(unsigned long)policy_mgr_get_freq_restriction_mask(pm_ctx);
 	for (j = 0; j < pm_ctx->unsafe_channel_count; j++) {
 		if ((ch_freq == pm_ctx->unsafe_channel_list[j]) &&
-		    (qdf_test_bit(QDF_SAP_MODE, &restriction_mask))) {
+		    (qdf_test_bit(QDF_SAP_MODE, &restriction_mask) ||
+		     !wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(psoc))) {
 			is_safe = false;
 			policy_mgr_warn("Freq %d is not safe, restriction mask %lu", ch_freq, restriction_mask);
 			break;

+ 20 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -291,6 +291,26 @@ wlan_mlme_get_wlm_multi_client_ll_caps(struct wlan_objmgr_psoc *psoc)
 }
 #endif
 
+#ifdef FEATURE_WLAN_CH_AVOID_EXT
+/**
+ * wlan_mlme_get_coex_unsafe_chan_nb_user_prefer() - get coex unsafe nb
+ * support
+ * @psoc:   pointer to psoc object
+ * @value:  pointer to the value which will be filled for the caller
+ *
+ * Return: coex_unsafe_chan_nb_user_prefer
+ */
+bool wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(
+		struct wlan_objmgr_psoc *psoc);
+#else
+static inline
+bool wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(
+		struct wlan_objmgr_psoc *psoc)
+{
+	return false;
+}
+#endif
+
 /**
  * wlan_mlme_set_band_capability() - Set the Band capability config
  * @psoc: pointer to psoc object

+ 15 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -216,6 +216,21 @@ bool wlan_mlme_get_wlm_multi_client_ll_caps(struct wlan_objmgr_psoc *psoc)
 }
 #endif
 
+#ifdef FEATURE_WLAN_CH_AVOID_EXT
+bool wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(
+		struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj) {
+		mlme_legacy_err("Failed to get MLME Obj");
+		return cfg_default(CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER);
+	}
+	return mlme_obj->cfg.reg.coex_unsafe_chan_nb_user_prefer;
+}
+#endif
+
 QDF_STATUS wlan_mlme_get_band_capability(struct wlan_objmgr_psoc *psoc,
 					 uint32_t *band_capability)
 {

+ 1 - 8
components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c

@@ -1821,14 +1821,7 @@ bool ucfg_mlme_validate_scan_period(struct wlan_objmgr_psoc *psoc,
 bool ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer(
 		struct wlan_objmgr_psoc *psoc)
 {
-	struct wlan_mlme_psoc_ext_obj *mlme_obj;
-
-	mlme_obj = mlme_get_psoc_ext_obj(psoc);
-	if (!mlme_obj) {
-		mlme_legacy_err("Failed to get MLME Obj");
-		return cfg_default(CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER);
-	}
-	return mlme_obj->cfg.reg.coex_unsafe_chan_nb_user_prefer;
+	return wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(psoc);
 }
 
 bool ucfg_mlme_get_coex_unsafe_chan_reg_disable(

+ 2 - 2
core/sap/src/sap_fsm.c

@@ -1175,8 +1175,8 @@ validation_done:
 	sap_debug("for configured channel, Ch_freq = %d",
 		  sap_context->chan_freq);
 
-	if (!policy_mgr_is_safe_channel(mac_ctx->psoc,
-					sap_context->chan_freq)) {
+	if (!policy_mgr_is_sap_freq_allowed(mac_ctx->psoc,
+					    sap_context->chan_freq)) {
 		sap_warn("Abort SAP start due to unsafe channel");
 		return QDF_STATUS_E_ABORTED;
 	}