Browse Source

qcacld-3.0: Remove legacy scan and ap protection related ini items

Remove the following scan and ap protection related ini items:
CFG_AP_ENABLE_PROTECTION_MODE_NAME
CFG_ENABLE_MAC_ADDR_SPOOFING
CFG_SCAN_AGING_PARAM_NAME

Replace the corresponding hdd_config variables and replace
these variable callers with ucfg api from corresponding module.

Change-Id: I99a2659e2151ad285e9451b9e9cc036a199581a3
CRs-Fixed: 2378991
Pragaspathi Thilagaraj 6 years ago
parent
commit
f37f393792

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

@@ -926,6 +926,8 @@ static void mlme_init_sap_protection_cfg(struct wlan_objmgr_psoc *psoc,
 				cfg_get(psoc, CFG_IGNORE_PEER_HT_MODE);
 	sap_protection_params->enable_ap_obss_protection =
 				cfg_get(psoc, CFG_AP_OBSS_PROTECTION_ENABLE);
+	sap_protection_params->is_ap_prot_enabled =
+				cfg_get(psoc, CFG_AP_ENABLE_PROTECTION_MODE);
 	sap_protection_params->ap_protection_mode =
 				cfg_get(psoc, CFG_AP_PROTECTION_MODE);
 }

+ 26 - 3
components/mlme/dispatcher/inc/cfg_sap_protection.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019 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
@@ -58,9 +58,31 @@
  */
 #define CFG_IGNORE_PEER_HT_MODE CFG_INI_BOOL( \
 		"gignore_peer_ht_opmode", \
-		0, \
+		false, \
 		"ignore the peer ht mode")
 
+/*
+ * <ini>
+ * gEnableApProt - Enable/Disable AP protection
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * This ini is used to enable/disable AP protection
+ *
+ * Related: None.
+ *
+ * Supported Feature: SAP
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_AP_ENABLE_PROTECTION_MODE CFG_INI_BOOL( \
+		"gEnableApProt", \
+		true, \
+		"enable protection on sap")
+
 /*
  * <ini>
  * gApProtection - Set AP protection parameter
@@ -113,13 +135,14 @@
  */
 #define CFG_AP_OBSS_PROTECTION_ENABLE CFG_INI_BOOL( \
 		"gEnableApOBSSProt", \
-		0, \
+		false, \
 		"Enable/Disable AP OBSS protection")
 
 #define CFG_SAP_PROTECTION_ALL \
 	CFG(CFG_PROTECTION_ENABLED) \
 	CFG(CFG_FORCE_POLICY_PROTECTION) \
 	CFG(CFG_IGNORE_PEER_HT_MODE) \
+	CFG(CFG_AP_ENABLE_PROTECTION_MODE) \
 	CFG(CFG_AP_PROTECTION_MODE) \
 	CFG(CFG_AP_OBSS_PROTECTION_ENABLE)
 

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

@@ -762,6 +762,14 @@ QDF_STATUS mlme_update_tgt_he_caps_in_cfg(struct wlan_objmgr_psoc *psoc,
 					  struct wma_tgt_cfg *cfg);
 #endif
 
+/**
+ * wlan_mlme_is_ap_prot_enabled() - check if sap protection is enabled
+ * @psoc: pointer to psoc object
+ *
+ * Return: is_ap_prot_enabled flag
+ */
+bool wlan_mlme_is_ap_prot_enabled(struct wlan_objmgr_psoc *psoc);
+
 /**
  * wlan_mlme_get_ap_protection_mode() - Get ap_protection_mode value
  * @psoc: pointer to psoc object

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

@@ -924,6 +924,7 @@ struct wlan_mlme_feature_flag {
  * @ignore_peer_ht_opmode:     Ignore the ht opmode of the peer. Dynamic via INI
  * @enable_ap_obss_protection: enable/disable AP OBSS protection
  * @protection_force_policy:   Protection force policy. Static via cfg
+ * @is_ap_prot_enabled:        Enable/disable SAP protection
  * @ap_protection_mode:        AP protection bitmap
  * @protection_enabled:        Force enable protection. static via cfg
  */
@@ -931,6 +932,7 @@ struct wlan_mlme_sap_protection {
 	bool ignore_peer_ht_opmode;
 	bool enable_ap_obss_protection;
 	uint8_t protection_force_policy;
+	bool is_ap_prot_enabled;
 	uint16_t ap_protection_mode;
 	uint32_t protection_enabled;
 };

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

@@ -1648,6 +1648,21 @@ QDF_STATUS ucfg_mlme_get_oce_sap_enabled_info(struct wlan_objmgr_psoc *psoc,
 	return wlan_mlme_get_oce_sap_enabled_info(psoc, value);
 }
 
+/**
+ * ucfg_mlme_is_ap_prot_enabled() - Check if sap is enabled
+ * @psoc: pointer to psoc object
+ *
+ * Inline UCFG API to be used by HDD/OSIF callers to get the
+ * sap protection enabled/disabled
+ *
+ * Return: QDF_STATUS_SUCCESS or QDF_STATUS_FAILURE
+ */
+static inline
+bool ucfg_mlme_is_ap_prot_enabled(struct wlan_objmgr_psoc *psoc)
+{
+	return wlan_mlme_is_ap_prot_enabled(psoc);
+}
+
 /**
  * ucfg_mlme_get_ap_protection_mode() - Get ap protection mode info
  * @psoc: pointer to psoc object

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

@@ -1793,6 +1793,17 @@ QDF_STATUS wlan_mlme_get_oce_sap_enabled_info(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+bool wlan_mlme_is_ap_prot_enabled(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj)
+		return false;
+
+	return mlme_obj->cfg.sap_protection_cfg.is_ap_prot_enabled;
+}
+
 QDF_STATUS wlan_mlme_get_ap_protection_mode(struct wlan_objmgr_psoc *psoc,
 					    uint16_t *value)
 {

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

@@ -115,34 +115,6 @@ enum hdd_dot11_mode {
 	eHDD_DOT11_MODE_11ax,
 };
 
-/*
- * <ini>
- * gScanAgingTime - Set scan aging time
- * @Min: 0
- * @Max: 200
- * @Default: 30
- *
- * This ini is used to set scan aging timeout value
- * in secs. For example after 30 secs the bss results
- * greater than 30secs age will be flushed.
- *
- * Related: None
- *
- * Supported Feature: Scan
- *
- * Usage: External
- *
- * </ini>
- */
-#define CFG_SCAN_AGING_PARAM_NAME          "gScanAgingTime"
-#define CFG_SCAN_AGING_PARAM_MIN           (0)
-#define CFG_SCAN_AGING_PARAM_MAX           (200)
-#ifdef QCA_WIFI_NAPIER_EMULATION
-#define CFG_SCAN_AGING_PARAM_DEFAULT       (90)
-#else
-#define CFG_SCAN_AGING_PARAM_DEFAULT       (30)
-#endif
-
 /*
  * <ini>
  * extscan_adaptive_dwell_mode - Enable adaptive dwell mode
@@ -196,28 +168,6 @@ enum hdd_dot11_mode {
 #define CFG_DOT11_MODE_DEFAULT                 eHDD_DOT11_MODE_11ax
 #define CFG_DOT11_MODE_MAX                     eHDD_DOT11_MODE_11ax
 
-/*
- * <ini>
- * gEnableApProt - Enable/Disable AP protection
- * @Min: 0
- * @Max: 1
- * @Default: 1
- *
- * This ini is used to enable/disable AP protection
- *
- * Related: None.
- *
- * Supported Feature: SAP
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_AP_ENABLE_PROTECTION_MODE_NAME            "gEnableApProt"
-#define CFG_AP_ENABLE_PROTECTION_MODE_MIN             (0)
-#define CFG_AP_ENABLE_PROTECTION_MODE_MAX             (1)
-#define CFG_AP_ENABLE_PROTECTION_MODE_DEFAULT         (1)
-
 /* WMM configuration */
 /*
  * <ini>
@@ -268,11 +218,6 @@ enum hdd_dot11_mode {
 #define CFG_DHCP_SERVER_IP_DEFAULT  ""
 #endif /* DHCP_SERVER_OFFLOAD */
 
-#define CFG_ENABLE_MAC_ADDR_SPOOFING                "gEnableMacAddrSpoof"
-#define CFG_ENABLE_MAC_ADDR_SPOOFING_MIN            (0)
-#define CFG_ENABLE_MAC_ADDR_SPOOFING_MAX            (1)
-#define CFG_ENABLE_MAC_ADDR_SPOOFING_DEFAULT        (1)
-
 /*
  * <ini>
  * gSAP11ACOverride - Override bw to 11ac for SAP in driver even if supplicant
@@ -410,7 +355,6 @@ struct hdd_config {
 	/* Config parameters */
 	bool enable_connected_scan;
 	enum hdd_dot11_mode dot11Mode;
-	bool apProtEnabled;
 
 #ifdef FEATURE_WLAN_DYNAMIC_CVM
 	/* Bitmap for operating voltage corner mode */
@@ -422,13 +366,11 @@ struct hdd_config {
 	bool enable_mtrace;
 #endif
 	bool prevent_link_down;
-	uint8_t scanAgingTimeout;
 	bool fEnableSNRMonitoring;
 	bool advertiseConcurrentOperation;
 #ifdef DHCP_SERVER_OFFLOAD
 	uint8_t dhcpServerIP[IPADDR_STRING_LENGTH];
 #endif /* DHCP_SERVER_OFFLOAD */
-	bool enable_mac_spoofing;
 	uint8_t sap_11ac_override;
 	uint8_t go_11ac_override;
 	bool apf_enabled;

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

@@ -63,13 +63,6 @@ struct reg_table_entry g_registry_table[] = {
 		     CFG_DOT11_MODE_MIN,
 		     CFG_DOT11_MODE_MAX),
 
-	REG_VARIABLE(CFG_AP_ENABLE_PROTECTION_MODE_NAME, WLAN_PARAM_Integer,
-		     struct hdd_config, apProtEnabled,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_AP_ENABLE_PROTECTION_MODE_DEFAULT,
-		     CFG_AP_ENABLE_PROTECTION_MODE_MIN,
-		     CFG_AP_ENABLE_PROTECTION_MODE_MAX),
-
 	REG_VARIABLE(CFG_TL_DELAYED_TRGR_FRM_INT_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, DelayedTriggerFrmInt,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -77,13 +70,6 @@ struct reg_table_entry g_registry_table[] = {
 		     CFG_TL_DELAYED_TRGR_FRM_INT_MIN,
 		     CFG_TL_DELAYED_TRGR_FRM_INT_MAX),
 
-	REG_VARIABLE(CFG_SCAN_AGING_PARAM_NAME, WLAN_PARAM_Integer,
-		     struct hdd_config, scanAgingTimeout,
-		     VAR_FLAGS_OPTIONAL,
-		     CFG_SCAN_AGING_PARAM_DEFAULT,
-		     CFG_SCAN_AGING_PARAM_MIN,
-		     CFG_SCAN_AGING_PARAM_MAX),
-
 	REG_VARIABLE(CFG_ENABLE_SNR_MONITORING_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, fEnableSNRMonitoring,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK,
@@ -98,13 +84,6 @@ struct reg_table_entry g_registry_table[] = {
 			    (void *)CFG_DHCP_SERVER_IP_DEFAULT),
 #endif /* DHCP_SERVER_OFFLOAD */
 
-	REG_VARIABLE(CFG_ENABLE_MAC_ADDR_SPOOFING, WLAN_PARAM_Integer,
-		     struct hdd_config, enable_mac_spoofing,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_ENABLE_MAC_ADDR_SPOOFING_DEFAULT,
-		     CFG_ENABLE_MAC_ADDR_SPOOFING_MIN,
-		     CFG_ENABLE_MAC_ADDR_SPOOFING_MAX),
-
 	REG_VARIABLE(CFG_SAP_11AC_OVERRIDE_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, sap_11ac_override,
 		     VAR_FLAGS_OPTIONAL |

+ 9 - 14
core/hdd/src/wlan_hdd_cfg80211.c

@@ -3291,11 +3291,11 @@ __wlan_hdd_cfg80211_set_scanning_mac_oui(struct wiphy *wiphy,
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1];
 	QDF_STATUS status;
-	int ret;
-	int len;
+	int ret, len;
 	struct net_device *ndev = wdev->netdev;
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
 	mac_handle_t mac_handle;
+	bool mac_spoofing_enabled;
 
 	hdd_enter_dev(wdev->netdev);
 
@@ -3308,7 +3308,8 @@ __wlan_hdd_cfg80211_set_scanning_mac_oui(struct wiphy *wiphy,
 	if (ret)
 		return ret;
 
-	if (!hdd_ctx->config->enable_mac_spoofing) {
+	mac_spoofing_enabled = ucfg_scan_is_mac_spoofing_enabled(hdd_ctx->psoc);
+	if (!mac_spoofing_enabled) {
 		hdd_debug("MAC address spoofing is not enabled");
 		return -ENOTSUPP;
 	}
@@ -12448,16 +12449,8 @@ int wlan_hdd_cfg80211_update_band(struct hdd_context *hdd_ctx, struct wiphy *wip
 	(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
 static void wlan_hdd_cfg80211_scan_randomization_init(struct wiphy *wiphy)
 {
-	struct hdd_context *hdd_ctx;
-
-	hdd_ctx = wiphy_priv(wiphy);
-
-	if (false == hdd_ctx->config->enable_mac_spoofing) {
-		hdd_warn("MAC address spoofing is not enabled");
-	} else {
-		wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
-		wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR;
-	}
+	wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
+	wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR;
 }
 #else
 static void wlan_hdd_cfg80211_scan_randomization_init(struct wiphy *wiphy)
@@ -12658,6 +12651,7 @@ int wlan_hdd_cfg80211_init(struct device *dev,
 	int num_dsrc_ch, len_dsrc_ch, num_srd_ch, len_srd_ch;
 	uint32_t *cipher_suites;
 	uint8_t allow_mcc_go_diff_bi = 0, enable_mcc = 0;
+	bool mac_spoofing_enabled;
 
 	hdd_enter();
 
@@ -12837,7 +12831,8 @@ int wlan_hdd_cfg80211_init(struct device *dev,
 
 	hdd_add_channel_switch_support(&wiphy->flags);
 	wiphy->max_num_csa_counters = WLAN_HDD_MAX_NUM_CSA_COUNTERS;
-	if (pCfg->enable_mac_spoofing)
+	mac_spoofing_enabled = ucfg_scan_is_mac_spoofing_enabled(hdd_ctx->psoc);
+	if (mac_spoofing_enabled)
 		wlan_hdd_cfg80211_scan_randomization_init(wiphy);
 	wlan_hdd_cfg80211_action_frame_randomization_init(wiphy);
 

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

@@ -4906,7 +4906,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	/* pConfig->channel = pCommitConfig->channel; */
 
 	/* Protection parameter to enable or disable */
-	pConfig->protEnabled = iniConfig->apProtEnabled;
+	pConfig->protEnabled = ucfg_mlme_is_ap_prot_enabled(hdd_ctx->psoc);
 
 	status = ucfg_mlme_get_sap_chan_switch_rate_enabled(hdd_ctx->psoc,
 							    &val);

+ 0 - 4
core/hdd/src/wlan_hdd_main.c

@@ -14545,11 +14545,7 @@ static int hdd_update_scan_config(struct hdd_context *hdd_ctx)
 	QDF_STATUS status;
 	uint32_t mcast_mcc_rest_time = 0;
 
-	/* convert to ms */
-	scan_cfg.scan_cache_aging_time =
-		cfg->scanAgingTimeout * 1000;
 	scan_cfg.is_snr_monitoring_enabled = cfg->fEnableSNRMonitoring;
-	scan_cfg.enable_mac_spoofing = cfg->enable_mac_spoofing;
 	status = ucfg_mlme_get_sta_miracast_mcc_rest_time(hdd_ctx->psoc,
 							  &mcast_mcc_rest_time);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {