From 90bb6f12fd26e167cb4daca972da2c34021ef8a0 Mon Sep 17 00:00:00 2001 From: Krishna Kumaar Natarajan Date: Fri, 3 Mar 2017 21:05:52 -0800 Subject: [PATCH] qcacld-3.0: [11AX] Add INI parameters related to 11AX Add INI parameters to enable/disable ul_ofdma and ul_mimo. Change-Id: Iaeac86db11593002bdbf3d6a92029657c3352e94 CRs-Fixed: 1073481 --- core/hdd/inc/wlan_hdd_cfg.h | 61 ++++++++++++++++++++++++--- core/hdd/inc/wlan_hdd_he.h | 18 ++++++++ core/hdd/src/wlan_hdd_cfg.c | 24 +++++++++++ core/hdd/src/wlan_hdd_he.c | 73 +++++++++++++++++++++++++++++++-- core/sme/inc/csr_api.h | 4 ++ core/sme/inc/csr_internal.h | 4 ++ core/sme/src/csr/csr_api_roam.c | 43 +++++++++++++++++++ 7 files changed, 219 insertions(+), 8 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 1b44b37b4f44..b0d1a6fde6a2 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -8923,7 +8923,6 @@ enum hdd_wext_control { #define CFG_EXTWOW_TCP_RX_TIMEOUT_DEFAULT (200) #endif - /* * * gper_roam_enabled - To enabled/disable PER based roaming in FW @@ -9080,10 +9079,6 @@ enum hdd_wext_control { #define CFG_ENABLE_BCAST_PROBE_RESP_MAX (1) #define CFG_ENABLE_BCAST_PROBE_RESP_DEFAULT (0) -/* - * Type declarations - */ - /* * * gActiveBpfMode - Control active BPF mode @@ -9108,6 +9103,58 @@ enum hdd_wext_control { #define CFG_ACTIVE_BPF_MODE_MAX (ACTIVE_BPF_MODE_COUNT - 1) #define CFG_ACTIVE_BPF_MODE_DEFAULT (ACTIVE_BPF_DISABLED) +#ifdef WLAN_FEATURE_11AX +/* 11AX related INI configuration */ +/* + * + * enable_ul_mimo- Enable UL MIMO. + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to enable or disable UL MIMO. + * + * Related: NA + * + * Supported Feature: 11AX + * + * Usage: External + * + * + */ + +#define CFG_ENABLE_UL_MIMO_NAME "enable_ul_mimo" +#define CFG_ENABLE_UL_MIMO_MIN (0) +#define CFG_ENABLE_UL_MIMO_MAX (1) +#define CFG_ENABLE_UL_MIMO_DEFAULT (0) + +/* + * + * enable_ul_ofdma- Enable UL OFDMA. + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to enable or disable UL OFDMA. + * + * Related: NA + * + * Supported Feature: 11AX + * + * Usage: External + * + * + */ +#define CFG_ENABLE_UL_OFDMA_NAME "enable_ul_ofdma" +#define CFG_ENABLE_UL_OFDMA_MIN (0) +#define CFG_ENABLE_UL_OFDMA_MAX (1) +#define CFG_ENABLE_UL_OFDMA_DEFAULT (0) + +#endif /* WLAN_FEATURE_11AX */ + +/* + * Type declarations + */ struct hdd_config { /* Bitmap to track what is explicitly configured */ DECLARE_BITMAP(bExplicitCfg, MAX_CFG_INI_ITEMS); @@ -9815,6 +9862,10 @@ struct hdd_config { uint32_t per_roam_mon_time; enum active_bpf_mode active_bpf_mode; bool enable_bcast_probe_rsp; +#ifdef WLAN_FEATURE_11AX + bool enable_ul_mimo; + bool enable_ul_ofdma; +#endif }; #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var)) diff --git a/core/hdd/inc/wlan_hdd_he.h b/core/hdd/inc/wlan_hdd_he.h index b04698110a72..aa7edf3570d5 100644 --- a/core/hdd/inc/wlan_hdd_he.h +++ b/core/hdd/inc/wlan_hdd_he.h @@ -39,6 +39,10 @@ void hdd_update_tgt_he_cap(struct hdd_context_s *hdd_ctx, struct wma_tgt_cfg *cfg); void wlan_hdd_check_11ax_support(struct beacon_data_s *beacon, struct sap_Config *config); +void hdd_he_print_ini_config(hdd_context_t *hdd_ctx); +int hdd_update_he_cap_in_cfg(hdd_context_t *hdd_ctx); +void hdd_he_set_sme_config(tSmeConfigParams *sme_config, + struct hdd_config *config); #else static inline void hdd_update_tgt_he_cap(struct hdd_context_s *hdd_ctx, struct wma_tgt_cfg *cfg) @@ -49,5 +53,19 @@ static inline void wlan_hdd_check_11ax_support(struct beacon_data_s *beacon, struct sap_Config *config) { } + +static inline void hdd_he_print_ini_config(hdd_context_t *hdd_ctx) +{ +} + +static inline int hdd_update_he_cap_in_cfg(hdd_context_t *hdd_ctx) +{ + return 0; +} + +static inline void hdd_he_set_sme_config(tSmeConfigParams *sme_config, + struct hdd_config *config) +{ +} #endif #endif /* if !defined(WLAN_HDD_HE_H)*/ diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 2a707696bdd6..3682f2efadfb 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4263,6 +4263,21 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_ENABLE_BCAST_PROBE_RESP_DEFAULT, CFG_ENABLE_BCAST_PROBE_RESP_MIN, CFG_ENABLE_BCAST_PROBE_RESP_MAX), +#ifdef WLAN_FEATURE_11AX + REG_VARIABLE(CFG_ENABLE_UL_MIMO_NAME, WLAN_PARAM_Integer, + struct hdd_config, enable_ul_mimo, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ENABLE_UL_MIMO_DEFAULT, + CFG_ENABLE_UL_MIMO_MIN, + CFG_ENABLE_UL_MIMO_MAX), + + REG_VARIABLE(CFG_ENABLE_UL_OFDMA_NAME, WLAN_PARAM_Integer, + struct hdd_config, enable_ul_ofdma, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ENABLE_UL_OFDMA_DEFAULT, + CFG_ENABLE_UL_OFDMA_MIN, + CFG_ENABLE_UL_OFDMA_MAX), +#endif }; /** @@ -5740,6 +5755,7 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) CFG_SAP_INTERNAL_RESTART_NAME, pHddCtx->config->sap_internal_restart); hdd_per_roam_print_ini_config(pHddCtx); + hdd_he_print_ini_config(pHddCtx); } @@ -6446,6 +6462,11 @@ bool hdd_update_config_cfg(hdd_context_t *hdd_ctx) hdd_err("Couldn't set VHT CAP in cfg"); } + if (0 != hdd_update_he_cap_in_cfg(hdd_ctx)) { + status = false; + hdd_err("Couldn't set HE CAP in cfg"); + } + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_FIXED_RATE, config->TxRate) == QDF_STATUS_E_FAILURE) { status = false; @@ -6864,6 +6885,7 @@ bool hdd_update_config_cfg(hdd_context_t *hdd_ctx) return status; } + #ifdef FEATURE_WLAN_SCAN_PNO /** * hdd_set_pno_channel_prediction_config() - Set PNO configuration @@ -7302,6 +7324,8 @@ QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx) smeConfig->csrConfig.enable_bcast_probe_rsp = pHddCtx->config->enable_bcast_probe_rsp; + hdd_he_set_sme_config(smeConfig, pConfig); + status = sme_update_config(pHddCtx->hHal, smeConfig); if (!QDF_IS_STATUS_SUCCESS(status)) { hdd_err("sme_update_config() return failure %d", diff --git a/core/hdd/src/wlan_hdd_he.c b/core/hdd/src/wlan_hdd_he.c index 0a039f8b24f5..05b5a21fbffb 100644 --- a/core/hdd/src/wlan_hdd_he.c +++ b/core/hdd/src/wlan_hdd_he.c @@ -113,16 +113,18 @@ static const char *hdd_he_wni_cfg_to_string(uint16_t cfg_id) * * Update WNI CFG with the value passed. * - * Return: None + * Return: 0 on success and errno on failure */ -static void hdd_he_set_wni_cfg(struct hdd_context_s *hdd_ctx, - uint16_t cfg_id, uint32_t new_value) +static int hdd_he_set_wni_cfg(struct hdd_context_s *hdd_ctx, + uint16_t cfg_id, uint32_t new_value) { QDF_STATUS status; status = sme_cfg_set_int(hdd_ctx->hHal, cfg_id, new_value); if (QDF_IS_STATUS_ERROR(status)) hdd_err("could not set %s", hdd_he_wni_cfg_to_string(cfg_id)); + + return qdf_status_to_os_return(status); } /** @@ -269,3 +271,68 @@ void wlan_hdd_check_11ax_support(beacon_data_t *beacon, tsap_Config_t *config) if (ie) config->SapHw_mode = eCSR_DOT11_MODE_11ax; } + +/** + * hdd_he_print_ini_config()- Print 11AX(HE) specific INI configuration + * @hdd_ctx: handle to hdd context + * + * Return: None + */ +void hdd_he_print_ini_config(hdd_context_t *hdd_ctx) +{ + hdd_info("Name = [%s] Value = [%d]", CFG_ENABLE_UL_MIMO_NAME, + hdd_ctx->config->enable_ul_mimo); + hdd_info("Name = [%s] Value = [%d]", CFG_ENABLE_UL_OFDMA_NAME, + hdd_ctx->config->enable_ul_ofdma); +} + +/** + * hdd_update_he_cap_in_cfg() - update HE cap in global CFG + * @hdd_ctx: pointer to hdd context + * + * This API will update the HE config in CFG after taking intersection + * of INI and firmware capabilities provided reading CFG + * + * Return: 0 on success and errno on failure + */ +int hdd_update_he_cap_in_cfg(hdd_context_t *hdd_ctx) +{ + uint32_t val, val1 = 0; + QDF_STATUS status; + int ret; + struct hdd_config *config = hdd_ctx->config; + + status = sme_cfg_get_int(hdd_ctx->hHal, WNI_CFG_HE_UL_MUMIMO, &val); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("could not get WNI_CFG_HE_UL_MUMIMO"); + return qdf_status_to_os_return(status); + } + + /* In val, + * Bit 1 - corresponds to UL MIMO + * Bit 2 - corresponds to UL OFDMA + */ + if (val & 0x1) + val1 = config->enable_ul_mimo & 0x1; + + if ((val >> 1) & 0x1) + val1 |= ((config->enable_ul_ofdma & 0x1) << 1); + + ret = hdd_he_set_wni_cfg(hdd_ctx, WNI_CFG_HE_UL_MUMIMO, val1); + + return ret; +} + +/** + * hdd_he_set_sme_config() - set HE related SME config param + * @sme_config: pointer to SME config + * @config: pointer to INI config + * + * Return: None + */ +void hdd_he_set_sme_config(tSmeConfigParams *sme_config, + struct hdd_config *config) +{ + sme_config->csrConfig.enable_ul_ofdma = config->enable_ul_ofdma; + sme_config->csrConfig.enable_ul_mimo = config->enable_ul_mimo; +} diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 61a2b6450181..0fe1f108855c 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -1311,6 +1311,10 @@ typedef struct tagCsrConfigParam { uint32_t rx_aggregation_size; struct wmi_per_roam_config per_roam_config; bool enable_bcast_probe_rsp; +#ifdef WLAN_FEATURE_11AX + bool enable_ul_ofdma; + bool enable_ul_mimo; +#endif } tCsrConfigParam; /* Tush */ diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index f79e222210d4..9393ba3d6da9 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -639,6 +639,10 @@ typedef struct tagCsrConfig { uint32_t rx_aggregation_size; struct wmi_per_roam_config per_roam_config; bool enable_bcast_probe_rsp; +#ifdef WLAN_FEATURE_11AX + bool enable_ul_ofdma; + bool enable_ul_mimo; +#endif } tCsrConfig; typedef struct tagCsrChannelPowerInfo { diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index c2f388dd18e5..7240d2f21a7c 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -2167,6 +2167,46 @@ uint32_t csr_convert_phy_cb_state_to_ini_value(ePhyChanBondState phyCbState) return cbIniValue; } +#ifdef WLAN_FEATURE_11AX +/** + * csr_update_he_config_param() - Update MAC context with HE config param + * @mac_ctx: pointer to MAC context + * @param: pointer to CSR config params + * + * Return: None + */ +static void csr_update_he_config_param(tpAniSirGlobal mac_ctx, + tCsrConfigParam *param) +{ + mac_ctx->roam.configParam.enable_ul_ofdma = param->enable_ul_ofdma; + mac_ctx->roam.configParam.enable_ul_mimo = param->enable_ul_mimo; +} + +/** + * csr_get_he_config_param() - Get HE config param from MAC context + * @param: pointer to CSR config params + * @mac_ctx: pointer to MAC context + * + * Return: None + */ +static void csr_get_he_config_param(tCsrConfigParam *param, + tpAniSirGlobal mac_ctx) +{ + param->enable_ul_ofdma = mac_ctx->roam.configParam.enable_ul_ofdma; + param->enable_ul_mimo = mac_ctx->roam.configParam.enable_ul_mimo; +} +#else +static inline void csr_update_he_config_param(tpAniSirGlobal mac_ctx, + tCsrConfigParam *param) +{ +} + +static inline void csr_get_he_config_param(tCsrConfigParam *param, + tpAniSirGlobal mac_ctx) +{ +} +#endif + QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam) { @@ -2624,6 +2664,7 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, pMac->roam.configParam.enable_bcast_probe_rsp = pParam->enable_bcast_probe_rsp; + csr_update_he_config_param(pMac, pParam); } return status; } @@ -2860,6 +2901,8 @@ QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->enable_bcast_probe_rsp = pMac->roam.configParam.enable_bcast_probe_rsp; + csr_get_he_config_param(pParam, pMac); + return QDF_STATUS_SUCCESS; }