diff --git a/mlme/core/src/wlan_mlme_main.c b/mlme/core/src/wlan_mlme_main.c index a158827f1d..7457641f8d 100644 --- a/mlme/core/src/wlan_mlme_main.c +++ b/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/mlme/dispatcher/inc/cfg_mlme.h b/mlme/dispatcher/inc/cfg_mlme.h index a3ed947fe7..41fed81d6b 100644 --- a/mlme/dispatcher/inc/cfg_mlme.h +++ b/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/mlme/dispatcher/inc/cfg_sap_protection.h b/mlme/dispatcher/inc/cfg_sap_protection.h new file mode 100644 index 0000000000..e80034f182 --- /dev/null +++ b/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/mlme/dispatcher/inc/wlan_mlme_api.h b/mlme/dispatcher/inc/wlan_mlme_api.h index 5237eef866..1c1f856224 100644 --- a/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/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/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 5df2e4ca74..d10e7cf09c 100644 --- a/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/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/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index e639db4a60..598525c877 100644 --- a/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/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/mlme/dispatcher/src/wlan_mlme_api.c b/mlme/dispatcher/src/wlan_mlme_api.c index 1d4a2c051c..7630cb3829 100644 --- a/mlme/dispatcher/src/wlan_mlme_api.c +++ b/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; +}