diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index a158827f1d8f..7457641f8dfb 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -117,6 +117,18 @@ static void mlme_update_rates_in_cfg(struct wlan_objmgr_psoc *psoc, CFG_INI_DISABLE_HIGH_HT_RX_MCS_2x2); } +static void mlme_update_sap_protection_cfg(struct wlan_objmgr_psoc *psoc, + struct wlan_mlme_sap_protection + *sap_protection_params) +{ + sap_protection_params->protection_enabled = + cfg_default(CFG_PROTECTION_ENABLED); + sap_protection_params->protection_force_policy = + cfg_default(CFG_FORCE_POLICY_PROTECTION); + sap_protection_params->ignore_peer_ht_mode = + cfg_get(psoc, CFG_IGNORE_PEER_HT_MODE); +} + QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc) { struct wlan_mlme_psoc_obj *mlme_obj; @@ -132,6 +144,7 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc) mlme_cfg = &mlme_obj->cfg; mlme_update_ht_cap_in_cfg(psoc, &mlme_cfg->ht_caps.ht_cap_info); mlme_update_rates_in_cfg(psoc, &mlme_cfg->rates); + mlme_update_sap_protection_cfg(psoc, &mlme_cfg->sap_protection_cfg); return status; } diff --git a/components/mlme/dispatcher/inc/cfg_mlme.h b/components/mlme/dispatcher/inc/cfg_mlme.h index a3ed947fe71e..41fed81d6bce 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme.h +++ b/components/mlme/dispatcher/inc/cfg_mlme.h @@ -26,11 +26,13 @@ #include "cfg_mlme_ht_caps.h" #include "cfg_mlme_vht_caps.h" #include "cfg_mlme_rates.h" +#include "cfg_sap_protection.h" #define CFG_MLME_ALL \ CFG_HT_CAPS_ALL \ CFG_VHT_CAPS_ALL \ - CFG_RATES_ALL + CFG_RATES_ALL \ + CFG_SAP_PROTECTION_ALL #endif /* __CFG_MLME_H */ diff --git a/components/mlme/dispatcher/inc/cfg_sap_protection.h b/components/mlme/dispatcher/inc/cfg_sap_protection.h new file mode 100644 index 000000000000..e80034f182b9 --- /dev/null +++ b/components/mlme/dispatcher/inc/cfg_sap_protection.h @@ -0,0 +1,69 @@ +/* + * 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 sap erp protection related + * converged configurations. + */ + +#ifndef __CFG_MLME_SAP_PROTECTION_H +#define __CFG_MLME_SAP_PROTECTION_H + +#define CFG_PROTECTION_ENABLED CFG_UINT( \ + "protection_enabled", \ + 0, \ + 65535, \ + 65535, \ + CFG_VALUE_OR_DEFAULT, \ + "sap protection enabled") + +#define CFG_FORCE_POLICY_PROTECTION CFG_UINT( \ + "protection_force_policy", \ + 0, \ + 5, \ + 5, \ + CFG_VALUE_OR_DEFAULT, \ + "force policy protection") + +/* + * + * gignore_peer_ht_opmode + * + * @min 0 + * @max 1 + * @default 1 + * + * Enabling gignore_peer_ht_opmode will enable 11g + * protection only when there is a 11g AP in vicinity. + * + * Related: None + * + * Supported Feature: SAP Protection + * + */ +#define CFG_IGNORE_PEER_HT_MODE CFG_INI_BOOL( \ + "gignore_peer_ht_opmode", \ + 0, \ + "ignore the peer ht mode") + +#define CFG_SAP_PROTECTION_ALL \ + CFG(CFG_PROTECTION_ENABLED) \ + CFG(CFG_FORCE_POLICY_PROTECTION) \ + CFG(CFG_IGNORE_PEER_HT_MODE) + +#endif /* __CFG_MLME_SAP_PROTECTION_H */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 5237eef866db..1c1f85622475 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -47,4 +47,14 @@ QDF_STATUS wlan_mlme_get_ht_cap_info(struct wlan_objmgr_psoc *psoc, QDF_STATUS wlan_mlme_set_ht_cap_info(struct wlan_objmgr_psoc *psoc, struct mlme_ht_capabilities_info ht_cap_info); + +/** + * wlan_mlme_get_ignore_peer_ht_mode() - Get the ignore peer ht opmode flag + * @psoc: pointer to psoc object + * @value: Value that needs to be set from the caller + * + * Return: QDF Status + */ +QDF_STATUS wlan_mlme_get_ignore_peer_ht_mode(struct wlan_objmgr_psoc *psoc, + bool *value); #endif /* _WLAN_MLME_API_H_ */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 5df2e4ca74d0..d10e7cf09ca2 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -108,16 +108,33 @@ struct wlan_mlme_rates { uint8_t disable_high_ht_mcs_2x2; }; +/* + * struct wlan_mlme_sap_protection_cfg - SAP erp protection config items + * + * @protection_enabled - Force enable protection. static via cfg + * @protection_always_11g - Force protection enable for 11g. Static via cfg + * @protection_force_policy - Protection force policy. Static via cfg + * @ignore_peer_ht_mode - ignore the ht opmode of the peer. Dynamic via INI. + * + */ +struct wlan_mlme_sap_protection { + uint32_t protection_enabled; + uint8_t protection_force_policy; + bool ignore_peer_ht_mode; +}; + /** * struct wlan_mlme_cfg - MLME config items * @ht_cfg: HT related CFG Items * @vht_cfg: VHT related CFG Items * @rates: Rates related cfg items + * @sap_protection_cfg: SAP erp protection related CFG items */ struct wlan_mlme_cfg { struct wlan_mlme_ht_caps ht_caps; struct wlan_mlme_vht_caps vht_caps; struct wlan_mlme_rates rates; + struct wlan_mlme_sap_protection sap_protection_cfg; }; #endif diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index e639db4a602f..598525c877b8 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -99,4 +99,22 @@ QDF_STATUS ucfg_mlme_set_ht_cap_info(struct wlan_objmgr_psoc *psoc, { return wlan_mlme_set_ht_cap_info(psoc, ht_cap_info); } + +/** + * ucfg_mlme_get_ignore_peer_ht_mode() - Get the ignore peer ht mode flag + * + * @psoc: pointer to psoc object + * @value: Value that needs to be set + * + * Inline UCFG API to be used by HDD/OSIF callers to get the + * ignore_peer_ht_opmode flag value + * + * Return: QDF_STATUS_SUCCESS or QDF_STATUS_FAILURE + */ +static inline +QDF_STATUS ucfg_mlme_get_ignore_peer_ht_mode(struct wlan_objmgr_psoc *psoc, + bool *value) +{ + return wlan_mlme_get_ignore_peer_ht_mode(psoc, value); +} #endif /* _WLAN_MLME_UCFG_API_H_ */ diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 1d4a2c051cd6..7630cb38298d 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -56,3 +56,17 @@ QDF_STATUS wlan_mlme_set_ht_cap_info(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } + +QDF_STATUS wlan_mlme_get_ignore_peer_ht_mode(struct wlan_objmgr_psoc *psoc, + bool *value) +{ + struct wlan_mlme_psoc_obj *mlme_obj = mlme_get_psoc_obj(psoc); + + if (!mlme_obj) { + mlme_err("Failed to get MLME Obj"); + return QDF_STATUS_E_FAILURE; + } + + *value = mlme_obj->cfg.sap_protection_cfg.ignore_peer_ht_mode; + return QDF_STATUS_SUCCESS; +} diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 66fd609a62b5..534d0150d56a 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -8555,15 +8555,6 @@ enum dot11p_mode { #define CFG_USER_ACS_DFS_LTE_ENABLE (1) #define CFG_USER_ACS_DFS_LTE_DEFAULT (0) -/* - * Enabling gignore_peer_ht_opmode will enable 11g - * protection only when there is a 11g AP in vicinity. - */ -#define CFG_IGNORE_PEER_HT_MODE_NAME "gignore_peer_ht_opmode" -#define CFG_IGNORE_PEER_HT_MODE_MIN (0) -#define CFG_IGNORE_PEER_HT_MODE_MAX (1) -#define CFG_IGNORE_PEER_HT_MODE_DEFAULT (0) - /* * Enable/Disable to initiate BUG report in case of fatal event * Default: Enable @@ -14525,7 +14516,6 @@ struct hdd_config { #endif uint32_t roam_dense_traffic_thresh; uint32_t roam_dense_rssi_thresh_offset; - bool ignore_peer_ht_opmode; uint32_t roam_dense_min_aps; int8_t roam_bg_scan_bad_rssi_thresh; uint8_t roam_bad_rssi_thresh_offset_2g; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index dfbd2b307b2e..ef6169286e5f 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -3556,14 +3556,6 @@ struct reg_table_entry g_registry_table[] = { CFG_ROAM_DENSE_RSSI_THRE_OFFSET_MIN, CFG_ROAM_DENSE_RSSI_THRE_OFFSET_MAX), - REG_VARIABLE(CFG_IGNORE_PEER_HT_MODE_NAME, WLAN_PARAM_Integer, - struct hdd_config, ignore_peer_ht_opmode, - VAR_FLAGS_OPTIONAL | - VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, - CFG_IGNORE_PEER_HT_MODE_DEFAULT, - CFG_IGNORE_PEER_HT_MODE_MIN, - CFG_IGNORE_PEER_HT_MODE_MAX), - REG_VARIABLE(CFG_ROAM_DENSE_MIN_APS, WLAN_PARAM_Integer, struct hdd_config, roam_dense_min_aps, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -7183,6 +7175,7 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) QDF_STATUS status = QDF_STATUS_SUCCESS; tSmeConfigParams *smeConfig; uint8_t rrm_capab_len, val; + bool ignore_peer_ht_mode; mac_handle_t mac_handle = hdd_ctx->mac_handle; struct hdd_config *pConfig = hdd_ctx->config; @@ -7504,8 +7497,15 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) hdd_ctx->config->obss_active_dwelltime; smeConfig->csrConfig.obss_passive_dwelltime = hdd_ctx->config->obss_passive_dwelltime; - smeConfig->csrConfig.ignore_peer_ht_opmode = - pConfig->ignore_peer_ht_opmode; + + status = ucfg_mlme_get_ignore_peer_ht_mode(hdd_ctx->hdd_psoc, + &ignore_peer_ht_mode); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("Get ignore_peer_ht_mode failed"); + goto error; + } + smeConfig->csrConfig.ignore_peer_ht_opmode = ignore_peer_ht_mode; + smeConfig->csrConfig.enable_fatal_event = pConfig->enable_fatal_event; smeConfig->csrConfig.scan_adaptive_dwell_mode = @@ -7655,7 +7655,7 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) status = sme_update_config(mac_handle, smeConfig); if (!QDF_IS_STATUS_SUCCESS(status)) hdd_err("sme_update_config() failure: %d", status); - +error: qdf_mem_free(smeConfig); return status; } diff --git a/core/mac/src/pe/lim/lim_process_cfg_updates.c b/core/mac/src/pe/lim/lim_process_cfg_updates.c index a5726594cbbb..e421c93443b7 100644 --- a/core/mac/src/pe/lim/lim_process_cfg_updates.c +++ b/core/mac/src/pe/lim/lim_process_cfg_updates.c @@ -48,6 +48,7 @@ static void lim_update_config(tpAniSirGlobal pMac, tpPESession psessionEntry); void lim_set_cfg_protection(tpAniSirGlobal pMac, tpPESession pesessionEntry) { uint32_t val = 0; + struct wlan_mlme_cfg *mlme_cfg = pMac->mlme_cfg; if (pesessionEntry != NULL && LIM_IS_AP_ROLE(pesessionEntry)) { if (pesessionEntry->gLimProtectionControl == @@ -68,24 +69,17 @@ void lim_set_cfg_protection(tpAniSirGlobal pMac, tpPESession pesessionEntry) pesessionEntry->cfgProtection.obss); } } else { - if (wlan_cfg_get_int(pMac, WNI_CFG_FORCE_POLICY_PROTECTION, &val) - != QDF_STATUS_SUCCESS) { - pe_err("reading WNI_CFG_FORCE_POLICY_PROTECTION cfg failed"); - return; - } else - pMac->lim.gLimProtectionControl = (uint8_t) val; + pMac->lim.gLimProtectionControl = + mlme_cfg->sap_protection_cfg.protection_force_policy; - if (wlan_cfg_get_int(pMac, WNI_CFG_PROTECTION_ENABLED, &val) != - QDF_STATUS_SUCCESS) { - pe_err("reading protection cfg failed"); - return; - } if (pMac->lim.gLimProtectionControl == WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) qdf_mem_set((void *)&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0); else { + val = mlme_cfg->sap_protection_cfg.protection_enabled; + pMac->lim.cfgProtection.fromlla = (val >> WNI_CFG_PROTECTION_ENABLED_FROM_llA) & 1; pMac->lim.cfgProtection.fromllb = diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index e7f463b4eec8..9d64f9c96c2a 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -487,7 +487,6 @@ QDF_STATUS populate_dot11f_erp_info(tpAniSirGlobal pMac, tDot11fIEERPInfo *pDot11f, tpPESession psessionEntry) { - QDF_STATUS nSirStatus; uint32_t val; enum band_info rfBand = BAND_UNKNOWN; @@ -518,14 +517,6 @@ populate_dot11f_erp_info(tpAniSirGlobal pMac, pDot11f->barker_preamble = 1; } - /* if protection always flag is set, advertise protection enabled */ - /* regardless of legacy stations presence */ - CFG_GET_INT(nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, - val); - - if (val) { - pDot11f->use_prot = 1; - } } return QDF_STATUS_SUCCESS;