Pārlūkot izejas kodu

qcacld-3.0: Refactor CFG_ENABLE_DFS_MASTER_CAPABILITY cfg

Refactor CFG_ENABLE_DFS_MASTER_CAPABILITY cfg item.

Change-Id: I19b52c6848bd04feca4213aad64138d5c55b9a1f
CRs-Fixed: 2327917
Arif Hussain 6 gadi atpakaļ
vecāks
revīzija
88d1fddd0b

+ 8 - 0
components/mlme/core/src/wlan_mlme_main.c

@@ -549,6 +549,13 @@ static void mlme_init_rates_in_cfg(struct wlan_objmgr_psoc *psoc,
 					 CFG_INI_DISABLE_HIGH_HT_RX_MCS_2x2);
 }
 
+static void mlme_init_dfs_cfg(struct wlan_objmgr_psoc *psoc,
+			      struct wlan_mlme_dfs_cfg *dfs_cfg)
+{
+	dfs_cfg->dfs_master_capable = cfg_get(psoc,
+					      CFG_ENABLE_DFS_MASTER_CAPABILITY);
+}
+
 static void mlme_init_feature_flag_in_cfg(
 				struct wlan_objmgr_psoc *psoc,
 				struct wlan_mlme_feature_flag *feature_flags)
@@ -1169,6 +1176,7 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	mlme_init_mbo_cfg(psoc, &mlme_cfg->mbo_cfg);
 	mlme_init_qos_cfg(psoc, &mlme_cfg->qos_mlme_params);
 	mlme_init_rates_in_cfg(psoc, &mlme_cfg->rates);
+	mlme_init_dfs_cfg(psoc, &mlme_cfg->dfs_cfg);
 	mlme_init_sap_protection_cfg(psoc, &mlme_cfg->sap_protection_cfg);
 	mlme_init_vht_cap_cfg(psoc, &mlme_cfg->vht_caps.vht_cap_info);
 	mlme_init_chainmask_cfg(psoc, &mlme_cfg->chainmask_cfg);

+ 2 - 0
components/mlme/dispatcher/inc/cfg_mlme.h

@@ -31,6 +31,7 @@
 #include "cfg_mlme_he_caps.h"
 #include "cfg_mlme_lfr.h"
 #include "cfg_mlme_obss_ht40.h"
+#include "cfg_mlme_dfs.h"
 #include "cfg_mlme_mbo.h"
 #include "cfg_mlme_vht_caps.h"
 #include "cfg_qos.h"
@@ -51,6 +52,7 @@
 #define CFG_MLME_ALL \
 	CFG_ACS_ALL \
 	CFG_CHAINMASK_ALL \
+	CFG_DFS_ALL \
 	CFG_EDCA_PARAMS_ALL \
 	CFG_FEATURE_FLAG_ALL \
 	CFG_GENERIC_ALL \

+ 52 - 0
components/mlme/dispatcher/inc/cfg_mlme_dfs.h

@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: This file contains centralized definitions of converged configuration.
+ */
+
+#ifndef __CFG_MLME_DFS_H
+#define __CFG_MLME_DFS_H
+
+/*
+ * <ini>
+ * gEnableDFSMasterCap - Enable DFS master capability
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This ini is used to enable/disable the DFS master capability.
+ * Disabling it will cause driver to not advertise the spectrum
+ * management capability
+ * Related: NA.
+ *
+ * upported Feature: DFS
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_ENABLE_DFS_MASTER_CAPABILITY CFG_INI_BOOL( \
+			"gEnableDFSMasterCap", \
+			0, \
+			"DFS master mode capability")
+
+#define CFG_DFS_ALL \
+	CFG(CFG_ENABLE_DFS_MASTER_CAPABILITY)
+
+#endif /* __CFG_MLME_DFS_H */

+ 10 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -266,6 +266,14 @@ struct wlan_mlme_cfg_sap {
 	uint8_t reduced_beacon_interval;
 };
 
+/**
+ * struct wlan_mlme_dfs_cfg - DFS Capabilities related config items
+ * @dfs_master_capable: Is DFS master mode support enabled
+ */
+struct wlan_mlme_dfs_cfg {
+	bool dfs_master_capable;
+};
+
 /**
  * struct wlan_mlme_mbo - Multiband Operation related ini configs
  * @mbo_candidate_rssi_thres:
@@ -1096,6 +1104,7 @@ struct wlan_mlme_wep_cfg {
  * @qos_mlme_params: QOS CFG Items
  * @rates: Rates related cfg items
  * @product_details: product details related CFG Items
+ * @dfs_cfg: DFS related CFG Items
  * @sap_protection_cfg: SAP erp protection related CFG items
  * @sap_cfg: sap CFG items
  * @sta: sta CFG Items
@@ -1121,6 +1130,7 @@ struct wlan_mlme_cfg {
 	struct wlan_mlme_qos qos_mlme_params;
 	struct wlan_mlme_rates rates;
 	struct wlan_mlme_product_details_cfg product_details;
+	struct wlan_mlme_dfs_cfg dfs_cfg;
 	struct wlan_mlme_sap_protection sap_protection_cfg;
 	struct wlan_mlme_cfg_sap sap_cfg;
 	struct wlan_mlme_sta_cfg sta;

+ 11 - 0
components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h

@@ -524,6 +524,17 @@ QDF_STATUS
 ucfg_mlme_get_sta_keep_alive_period(struct wlan_objmgr_psoc *psoc,
 				    uint32_t *val);
 
+/*
+ * ucfg_mlme_get_dfs_master_capability() - Get the dfs master capability
+ * @psoc: pointer to psoc object
+ * @val:  Pointer to the value which will be filled for the caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_dfs_master_capability(struct wlan_objmgr_psoc *psoc,
+				    bool *val);
+
 /**
  * ucfg_mlme_get_pmkid_modes() - Get PMKID modes
  * @psoc: pointer to psoc object

+ 18 - 0
components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c

@@ -121,6 +121,24 @@ ucfg_mlme_get_sta_keep_alive_period(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+ucfg_mlme_get_dfs_master_capability(struct wlan_objmgr_psoc *psoc,
+				    bool *val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*val = cfg_default(CFG_ENABLE_DFS_MASTER_CAPABILITY);
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = mlme_obj->cfg.dfs_cfg.dfs_master_capable;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 ucfg_mlme_get_pmkid_modes(struct wlan_objmgr_psoc *psoc,
 			  uint32_t *val)

+ 0 - 24
core/hdd/inc/wlan_hdd_cfg.h

@@ -3705,29 +3705,6 @@ enum hdd_link_speed_rpt_type {
 #define CFG_DISABLE_DFS_CH_SWITCH_MAX             (1)
 #define CFG_DISABLE_DFS_CH_SWITCH_DEFAULT         (0)
 
-/*
- * <ini>
- * gEnableDFSMasterCap - Enable DFS master capability
- * @Min: 0
- * @Max: 1
- * @Default: 0
- *
- * This ini is used to enable/disable the DFS master capability.
- * Disabling it will cause driver to not advertise the spectrum
- * management capability
- * Related: NA.
- *
- * Supported Feature: DFS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_ENABLE_DFS_MASTER_CAPABILITY               "gEnableDFSMasterCap"
-#define CFG_ENABLE_DFS_MASTER_CAPABILITY_MIN           (0)
-#define CFG_ENABLE_DFS_MASTER_CAPABILITY_MAX           (1)
-#define CFG_ENABLE_DFS_MASTER_CAPABILITY_DEFAULT       (0)
-
 /*
  * <ini>
  * gSapPreferredChanLocation - Restrict channel switches between ondoor and
@@ -8942,7 +8919,6 @@ struct hdd_config {
 	uint32_t WlanMccToSccSwitchMode;
 #endif
 	uint8_t disableDFSChSwitch;
-	uint8_t enableDFSMasterCap;
 	uint32_t TxPower2g;
 	uint32_t TxPower5g;
 	bool fDfsPhyerrFilterOffload;

+ 0 - 14
core/hdd/src/wlan_hdd_cfg.c

@@ -1661,13 +1661,6 @@ struct reg_table_entry g_registry_table[] = {
 		     CFG_DISABLE_DFS_CH_SWITCH_MIN,
 		     CFG_DISABLE_DFS_CH_SWITCH_MAX),
 
-	REG_VARIABLE(CFG_ENABLE_DFS_MASTER_CAPABILITY, WLAN_PARAM_Integer,
-		     struct hdd_config, enableDFSMasterCap,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_ENABLE_DFS_MASTER_CAPABILITY_DEFAULT,
-		     CFG_ENABLE_DFS_MASTER_CAPABILITY_MIN,
-		     CFG_ENABLE_DFS_MASTER_CAPABILITY_MAX),
-
 	REG_DYNAMIC_VARIABLE(CFG_SAP_PREFERRED_CHANNEL_LOCATION,
 			     WLAN_PARAM_Integer,
 			     struct hdd_config, gSapPreferredChanLocation,
@@ -4857,13 +4850,6 @@ bool hdd_update_config_cfg(struct hdd_context *hdd_ctx)
 		hdd_err("Couldn't pass on WNI_CFG_11D_ENABLED to CFG");
 	}
 
-	if (sme_cfg_set_int(mac_handle, WNI_CFG_DFS_MASTER_ENABLED,
-			    config->enableDFSMasterCap) ==
-			QDF_STATUS_E_FAILURE) {
-		status = false;
-		hdd_err("Failure: Couldn't set value for WNI_CFG_DFS_MASTER_ENABLED");
-	}
-
 	if (sme_cfg_set_int(mac_handle, WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED,
 		    config->enableMCCAdaptiveScheduler) ==
 		    QDF_STATUS_E_FAILURE) {

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

@@ -12313,9 +12313,6 @@ int wlan_hdd_cfg80211_init(struct device *dev,
 				ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events);
 	}
 
-	if (pCfg->enableDFSMasterCap)
-		wlan_hdd_cfg80211_set_dfs_offload_feature(wiphy);
-
 #ifdef QCA_HT_2040_COEX
 	wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE;
 #endif
@@ -12484,6 +12481,7 @@ void wlan_hdd_update_wiphy(struct hdd_context *hdd_ctx)
 {
 	int value;
 	bool fils_enabled;
+	bool dfs_master_capable = true;
 	QDF_STATUS status;
 
 	ucfg_mlme_get_sap_max_peers(hdd_ctx->psoc, &value);
@@ -12498,6 +12496,11 @@ void wlan_hdd_update_wiphy(struct hdd_context *hdd_ctx)
 		hdd_err("could not get fils enabled info");
 	if (fils_enabled)
 		wlan_hdd_cfg80211_set_wiphy_fils_feature(hdd_ctx->wiphy);
+
+	status = ucfg_mlme_get_dfs_master_capability(hdd_ctx->psoc,
+						     &dfs_master_capable);
+	if (QDF_IS_STATUS_SUCCESS(status) && dfs_master_capable)
+		wlan_hdd_cfg80211_set_dfs_offload_feature(hdd_ctx->wiphy);
 }
 
 /**

+ 6 - 3
core/hdd/src/wlan_hdd_hostapd_wext.c

@@ -2000,9 +2000,12 @@ static int __iw_get_channel_list(struct net_device *dev,
 	if (hostapd_adapter->device_mode == QDF_STA_MODE &&
 	    hdd_ctx->config->enableDFSChnlScan) {
 		is_dfs_mode_enabled = true;
-	} else if (hostapd_adapter->device_mode == QDF_SAP_MODE &&
-		   hdd_ctx->config->enableDFSMasterCap) {
-		is_dfs_mode_enabled = true;
+	} else if (hostapd_adapter->device_mode == QDF_SAP_MODE) {
+		if (QDF_STATUS_SUCCESS != ucfg_mlme_get_dfs_master_capability(
+				hdd_ctx->psoc, &is_dfs_mode_enabled)) {
+			hdd_err("Fail to get dfs master mode capability");
+			return -EINVAL;
+		}
 	}
 
 	hdd_debug("curBand = %d, StartChannel = %hu, EndChannel = %hu is_dfs_mode_enabled  = %d ",

+ 8 - 1
core/hdd/src/wlan_hdd_sap_cond_chan_switch.c

@@ -420,6 +420,7 @@ __wlan_hdd_cfg80211_conditional_chan_switch(struct wiphy *wiphy,
 	uint32_t freq_len, i;
 	uint32_t *freq;
 	uint8_t chans[QDF_MAX_NUM_CHAN] = {0};
+	bool is_dfs_mode_enabled = false;
 
 	hdd_enter_dev(dev);
 
@@ -427,7 +428,13 @@ __wlan_hdd_cfg80211_conditional_chan_switch(struct wiphy *wiphy,
 	if (ret)
 		return ret;
 
-	if (!hdd_ctx->config->enableDFSMasterCap) {
+	if (QDF_STATUS_SUCCESS != ucfg_mlme_get_dfs_master_capability(
+				hdd_ctx->psoc, &is_dfs_mode_enabled)) {
+		hdd_err("Failed to get dfs master capability");
+		return -EINVAL;
+	}
+
+	if (!is_dfs_mode_enabled) {
 		hdd_err("DFS master capability is not present in the driver");
 		return -EINVAL;
 	}

+ 0 - 5
core/mac/inc/wni_cfg.h

@@ -117,7 +117,6 @@ enum {
 	WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,
 	WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY,
 	WNI_CFG_IBSS_ATIM_WIN_SIZE,
-	WNI_CFG_DFS_MASTER_ENABLED,
 	WNI_CFG_VHT_ENABLE_TXBF_20MHZ,
 	WNI_CFG_MAX_HT_MCS_TX_DATA,
 	WNI_CFG_DISABLE_ABG_RATE_FOR_TX_DATA,
@@ -899,10 +898,6 @@ enum {
 #define WNI_CFG_IBSS_ATIM_WIN_SIZE_STAMAX    100
 #define WNI_CFG_IBSS_ATIM_WIN_SIZE_STADEF    0
 
-#define WNI_CFG_DFS_MASTER_ENABLED_STAMIN    0
-#define WNI_CFG_DFS_MASTER_ENABLED_STAMAX    1
-#define WNI_CFG_DFS_MASTER_ENABLED_STADEF    0
-
 #define WNI_CFG_VHT_ENABLE_TXBF_20MHZ_STAMIN    0
 #define WNI_CFG_VHT_ENABLE_TXBF_20MHZ_STAMAX    1
 #define WNI_CFG_VHT_ENABLE_TXBF_20MHZ_STADEF    0

+ 0 - 1
core/mac/src/cfg/cfg_param_name.c

@@ -131,7 +131,6 @@ const char *cfg_get_string(uint16_t cfg_id)
 	CASE_RETURN_STRING(WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP);
 	CASE_RETURN_STRING(WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY);
 	CASE_RETURN_STRING(WNI_CFG_IBSS_ATIM_WIN_SIZE);
-	CASE_RETURN_STRING(WNI_CFG_DFS_MASTER_ENABLED);
 	CASE_RETURN_STRING(WNI_CFG_VHT_ENABLE_TXBF_20MHZ);
 	CASE_RETURN_STRING(WNI_CFG_MAX_HT_MCS_TX_DATA);
 	CASE_RETURN_STRING(WNI_CFG_DISABLE_ABG_RATE_FOR_TX_DATA);

+ 0 - 5
core/mac/src/cfg/cfg_proc_msg.c

@@ -525,11 +525,6 @@ cgstatic cfg_static[CFG_PARAM_MAX_NUM] = {
 	WNI_CFG_IBSS_ATIM_WIN_SIZE_STAMIN,
 	WNI_CFG_IBSS_ATIM_WIN_SIZE_STAMAX,
 	WNI_CFG_IBSS_ATIM_WIN_SIZE_STADEF},
-	{WNI_CFG_DFS_MASTER_ENABLED,
-	CFG_CTL_VALID |  CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
-	WNI_CFG_DFS_MASTER_ENABLED_STAMIN,
-	WNI_CFG_DFS_MASTER_ENABLED_STAMAX,
-	WNI_CFG_DFS_MASTER_ENABLED_STADEF},
 	{WNI_CFG_VHT_ENABLE_TXBF_20MHZ,
 	CFG_CTL_VALID |  CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
 	WNI_CFG_VHT_ENABLE_TXBF_20MHZ_STAMIN,

+ 3 - 8
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -1036,15 +1036,10 @@ __lim_handle_sme_start_bss_request(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
 			if (session->lim11hEnable &&
 				(eSIR_INFRA_AP_MODE ==
 					mlm_start_req->bssType)) {
-				qdf_status =
-					wlan_cfg_get_int(mac_ctx,
-						WNI_CFG_DFS_MASTER_ENABLED,
-						&val);
-				session->lim11hEnable = val;
+				session->lim11hEnable =
+					mac_ctx->mlme_cfg->
+					dfs_cfg.dfs_master_capable;
 			}
-			if (QDF_IS_STATUS_ERROR(qdf_status))
-				/* Failed get CFG WNI_CFG_DFS_MASTER_ENABLED */
-				pe_err("Get Fail, CFG DFS ENABLE");
 		}
 
 		if (!session->lim11hEnable) {

+ 3 - 13
core/sap/src/sap_ch_select.c

@@ -589,7 +589,6 @@ static bool sap_chan_sel_init(tHalHandle halHandle,
 #ifdef FEATURE_WLAN_CH_AVOID
 	uint16_t i;
 #endif
-	uint32_t dfs_master_cap_enabled;
 	bool include_dfs_ch = true;
 	uint8_t chan_num;
 	bool sta_sap_scc_on_dfs_chan =
@@ -622,9 +621,7 @@ static bool sap_chan_sel_init(tHalHandle halHandle,
 	if (sap_ctx->dfs_ch_disable == true)
 		include_dfs_ch = false;
 #endif
-	sme_cfg_get_int(halHandle, WNI_CFG_DFS_MASTER_ENABLED,
-			&dfs_master_cap_enabled);
-	if (dfs_master_cap_enabled == 0 ||
+	if (!pMac->mlme_cfg->dfs_cfg.dfs_master_capable ||
 	    ACS_DFS_MODE_DISABLE == sap_ctx->dfs_mode)
 		include_dfs_ch = false;
 
@@ -2559,7 +2556,6 @@ static uint8_t sap_select_channel_no_scan_result(tHalHandle hal,
 {
 	enum channel_state ch_type;
 	uint8_t i, first_safe_ch_in_range = SAP_CHANNEL_NOT_SELECTED;
-	uint32_t dfs_master_cap_enabled;
 	uint32_t start_ch_num = sap_ctx->acs_cfg->start_ch;
 	uint32_t end_ch_num = sap_ctx->acs_cfg->end_ch;
 	tpAniSirGlobal mac_ctx = NULL;
@@ -2569,12 +2565,6 @@ static uint8_t sap_select_channel_no_scan_result(tHalHandle hal,
 	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 		  FL("start - end: %d - %d"), start_ch_num, end_ch_num);
 
-	sme_cfg_get_int(hal, WNI_CFG_DFS_MASTER_ENABLED,
-				&dfs_master_cap_enabled);
-
-	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
-		"%s: dfs_master %x", __func__, dfs_master_cap_enabled);
-
 	/* get a channel in PCL and within the range */
 	for (i = 0; i < sap_ctx->acs_cfg->pcl_ch_count; i++) {
 		if ((sap_ctx->acs_cfg->pcl_channels[i] < start_ch_num) ||
@@ -2599,8 +2589,8 @@ static uint8_t sap_select_channel_no_scan_result(tHalHandle hal,
 		if ((ch_type == CHANNEL_STATE_DISABLE) ||
 			(ch_type == CHANNEL_STATE_INVALID))
 			continue;
-		if ((!dfs_master_cap_enabled) &&
-			(CHANNEL_STATE_DFS == ch_type)) {
+		if ((!mac_ctx->mlme_cfg->dfs_cfg.dfs_master_capable) &&
+		    (CHANNEL_STATE_DFS == ch_type)) {
 			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 				"%s: DFS master mode disabled. Skip DFS channel %d",
 				__func__, safe_channels[i].channelNumber);