From f97cc11a708d0730da53c3eb33c1862d09d74ede Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Wed, 3 Oct 2018 19:17:07 +0530 Subject: [PATCH] qcacld-3.0: Update band_capability INI usage with MLME CFG Replace all usage of band_capability INI from HDD config to MLME CFG Change-Id: I406a8fb9965fe98a47cc6309d31f5bced529577b CRs-Fixed: 2327023 --- components/mlme/core/src/wlan_mlme_main.c | 1 + .../mlme/dispatcher/inc/wlan_mlme_api.h | 20 +++++ .../mlme/dispatcher/inc/wlan_mlme_ucfg_api.h | 28 ++++++ .../mlme/dispatcher/src/wlan_mlme_api.c | 33 +++++++ core/hdd/inc/wlan_hdd_cfg.h | 26 ------ core/hdd/src/wlan_hdd_cfg.c | 16 +--- core/hdd/src/wlan_hdd_cfg80211.c | 87 ++++++++++++------- core/hdd/src/wlan_hdd_main.c | 48 +++++++--- core/hdd/src/wlan_hdd_oemdata.c | 10 ++- core/hdd/src/wlan_hdd_regulatory.c | 26 ++++-- core/hdd/src/wlan_hdd_wext.c | 23 +++-- core/mac/src/pe/lim/lim_process_tdls.c | 6 +- core/sme/inc/csr_api.h | 2 - core/sme/src/csr/csr_api_roam.c | 31 ++++--- core/sme/src/csr/csr_util.c | 4 +- core/wma/src/wma_main.c | 8 +- 16 files changed, 244 insertions(+), 125 deletions(-) diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index 9713d08863..7595215afb 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -161,6 +161,7 @@ static void mlme_init_generic_cfg(struct wlan_objmgr_psoc *psoc, gen->rtt3_enabled = cfg_default(CFG_RTT3_ENABLE); gen->band_capability = cfg_get(psoc, CFG_BAND_CAPABILITY); + gen->band = gen->band_capability; gen->select_5ghz_margin = cfg_get(psoc, CFG_SELECT_5GHZ_MARGIN); gen->sub_20_chan_width = diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 65242c4c6e..e834d8e5df 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -177,6 +177,26 @@ QDF_STATUS wlan_mlme_set_ht_cap_info(struct wlan_objmgr_psoc *psoc, struct mlme_ht_capabilities_info ht_cap_info); +/** + * wlan_mlme_get_band_capability() - Get the Band capability config + * @psoc: pointer to psoc object + * @band_capability: Pointer to the variable from caller + * + * Return: QDF Status + */ +QDF_STATUS wlan_mlme_get_band_capability(struct wlan_objmgr_psoc *psoc, + uint8_t *band_capability); + +/** + * wlan_mlme_set_band_capability() - Set the Band capability config + * @psoc: pointer to psoc object + * @band_capability: Value to be set from the caller + * + * Return: QDF Status + */ +QDF_STATUS wlan_mlme_set_band_capability(struct wlan_objmgr_psoc *psoc, + uint8_t band_capability); + /** * wlan_mlme_get_acs_with_more_param() - Get the acs_with_more_param flag * @psoc: pointer to psoc object diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index 86db89a374..42fbabe4e9 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -149,6 +149,34 @@ 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_band_capability() - Get the Band capability config + * @psoc: pointer to psoc object + * @band_capability: Pointer to the variable from caller + * + * Return: QDF Status + */ +static inline +QDF_STATUS ucfg_mlme_get_band_capability(struct wlan_objmgr_psoc *psoc, + uint8_t *band_capability) +{ + return wlan_mlme_get_band_capability(psoc, band_capability); +} + +/** + * ucfg_mlme_set_band_capability() - Set the Band capability config + * @psoc: pointer to psoc object + * @band_capability: Value to be set from the caller + * + * Return: QDF Status + */ +static inline +QDF_STATUS ucfg_mlme_set_band_capability(struct wlan_objmgr_psoc *psoc, + uint8_t band_capability) +{ + return wlan_mlme_set_band_capability(psoc, band_capability); +} + /** * ucfg_mlme_get_acs_with_more_param() - Get the flag for acs with * more param diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 21fc10840a..53c3934f3a 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -90,6 +90,39 @@ QDF_STATUS wlan_mlme_set_ht_cap_info(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS wlan_mlme_get_band_capability(struct wlan_objmgr_psoc *psoc, + uint8_t *band_capability) +{ + struct wlan_mlme_psoc_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_obj(psoc); + if (!mlme_obj) { + mlme_err("Failed to get MLME Obj"); + return QDF_STATUS_E_FAILURE; + } + + *band_capability = mlme_obj->cfg.gen.band_capability; + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_mlme_set_band_capability(struct wlan_objmgr_psoc *psoc, + uint8_t band_capability) + +{ + struct wlan_mlme_psoc_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_obj(psoc); + if (!mlme_obj) { + mlme_err("Failed to get MLME Obj"); + return QDF_STATUS_E_FAILURE; + } + + mlme_obj->cfg.gen.band_capability = band_capability; + + return QDF_STATUS_SUCCESS; +} + void wlan_mlme_get_sap_inactivity_override(struct wlan_objmgr_psoc *psoc, bool *val) { diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 8ccdb63bd3..f075b9c43a 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -3562,30 +3562,6 @@ enum station_keepalive_method { #define CFG_HW_FILTER_MODE_BITMAP_MAX (3) #define CFG_HW_FILTER_MODE_BITMAP_DEFAULT (1) -/* - * - * BandCapability - Preferred band (0: Both, 1: 2.4G only, 2: 5G only) - * @Min: 0 - * @Max: 2 - * @Default: 0 - * - * This ini is used to set default band capability - * (0: Both, 1: 2.4G only, 2: 5G only) - * - * Related: None - * - * Supported Feature: STA - * - * Usage: Internal/External - * - * - */ - -#define CFG_BAND_CAPABILITY_NAME "BandCapability" -#define CFG_BAND_CAPABILITY_MIN (0) -#define CFG_BAND_CAPABILITY_MAX (2) -#define CFG_BAND_CAPABILITY_DEFAULT (0) - #define CFG_ENABLE_BYPASS_11D_NAME "gEnableBypass11d" #define CFG_ENABLE_BYPASS_11D_MIN (0) #define CFG_ENABLE_BYPASS_11D_MAX (1) @@ -9194,8 +9170,6 @@ struct hdd_config { bool AddTSWhenACMIsOff; - uint8_t nBandCapability; - /* QDF Trace Control*/ uint16_t qdf_trace_enable_wdi; uint16_t qdf_trace_enable_hdd; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 9a904a67a5..64991adbed 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -1299,13 +1299,6 @@ struct reg_table_entry g_registry_table[] = { CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_MIN, CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_MAX), - REG_VARIABLE(CFG_BAND_CAPABILITY_NAME, WLAN_PARAM_Integer, - struct hdd_config, nBandCapability, - VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, - CFG_BAND_CAPABILITY_DEFAULT, - CFG_BAND_CAPABILITY_MIN, - CFG_BAND_CAPABILITY_MAX), - /* CFG_QDF_TRACE_ENABLE Parameters */ REG_VARIABLE(CFG_QDF_TRACE_ENABLE_WDI_NAME, WLAN_PARAM_Integer, struct hdd_config, qdf_trace_enable_wdi, @@ -5241,14 +5234,7 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) smeConfig->csrConfig.AdHocChannel24 = pConfig->AdHocChannel24G; smeConfig->csrConfig.ProprietaryRatesEnabled = 0; smeConfig->csrConfig.HeartbeatThresh50 = 40; - smeConfig->csrConfig.bandCapability = pConfig->nBandCapability; - if (pConfig->nBandCapability == BAND_2G) { - smeConfig->csrConfig.Is11hSupportEnabled = 0; - } else { - smeConfig->csrConfig.Is11hSupportEnabled = - pConfig->Is11hSupportEnabled; - } - smeConfig->csrConfig.eBand = pConfig->nBandCapability; + smeConfig->csrConfig.Is11hSupportEnabled = pConfig->Is11hSupportEnabled; smeConfig->csrConfig.nTxPowerCap = pConfig->nTxPowerCap; smeConfig->csrConfig.allow_tpc_from_ap = pConfig->allow_tpc_from_ap; smeConfig->csrConfig.fEnableBypass11d = pConfig->enableBypass11d; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 0c9963dd2f..f57ea6aae3 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -12119,7 +12119,6 @@ wlan_hdd_populate_srd_chan_info(struct hdd_context *hdd_ctx, uint32_t index) int wlan_hdd_cfg80211_init(struct device *dev, struct wiphy *wiphy, struct hdd_config *pCfg) { - int i, j; struct hdd_context *hdd_ctx = wiphy_priv(wiphy); int len_5g_ch = 0, num_ch, ch_arr_size; int num_dsrc_ch, len_dsrc_ch, num_srd_ch, len_srd_ch; @@ -12258,37 +12257,6 @@ int wlan_hdd_cfg80211_init(struct device *dev, len_5g_ch, len_srd_ch); } - for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) { - - if (NULL == wiphy->bands[i]) - continue; - - for (j = 0; j < wiphy->bands[i]->n_channels; j++) { - struct ieee80211_supported_band *band = wiphy->bands[i]; - - if (HDD_NL80211_BAND_2GHZ == i && - BAND_5G == pCfg->nBandCapability) { - /* 5G only */ -#ifdef WLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY - /* Enable social channels for P2P */ - if (WLAN_HDD_IS_SOCIAL_CHANNEL - (band->channels[j].center_freq)) - band->channels[j].flags &= - ~IEEE80211_CHAN_DISABLED; - else -#endif - band->channels[j].flags |= - IEEE80211_CHAN_DISABLED; - continue; - } else if (HDD_NL80211_BAND_5GHZ == i && - BAND_2G == pCfg->nBandCapability) { - /* 2G only */ - band->channels[j].flags |= - IEEE80211_CHAN_DISABLED; - continue; - } - } - } /*Initialise the supported cipher suite details */ if (pCfg->gcmp_enabled) { cipher_suites = qdf_mem_malloc(sizeof(hdd_cipher_suites) + @@ -12437,6 +12405,60 @@ static void wlan_hdd_update_ht_cap(struct hdd_context *hdd_ctx) wlan_hdd_band_5_ghz.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; } +/** + * wlan_hdd_update_band_cap_in_wiphy() - update channel flags based on band cap + * @hdd_ctx: HDD context + * + * This function updates the channel flags based on the band capability set + * in the MLME CFG + * + * Return: void + */ +static void wlan_hdd_update_band_cap_in_wiphy(struct hdd_context *hdd_ctx) +{ + int i, j; + uint8_t band_capability; + QDF_STATUS status; + struct ieee80211_supported_band *band; + + status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to get MLME Band Capability"); + return; + } + + for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) { + if (NULL == hdd_ctx->wiphy->bands[i]) + continue; + + for (j = 0; j < hdd_ctx->wiphy->bands[i]->n_channels; j++) { + band = hdd_ctx->wiphy->bands[i]; + + if (HDD_NL80211_BAND_2GHZ == i && + BAND_5G == band_capability) { + /* 5G only */ +#ifdef WLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY + /* Enable social channels for P2P */ + if (WLAN_HDD_IS_SOCIAL_CHANNEL + (band->channels[j].center_freq)) + band->channels[j].flags &= + ~IEEE80211_CHAN_DISABLED; + else +#endif + band->channels[j].flags |= + IEEE80211_CHAN_DISABLED; + continue; + } else if (HDD_NL80211_BAND_5GHZ == i && + BAND_2G == band_capability) { + /* 2G only */ + band->channels[j].flags |= + IEEE80211_CHAN_DISABLED; + continue; + } + } + } +} + /* * In this function, wiphy structure is updated after QDF * initialization. In wlan_hdd_cfg80211_init, only the @@ -12452,6 +12474,7 @@ void wlan_hdd_update_wiphy(struct hdd_context *hdd_ctx) ucfg_mlme_get_sap_max_peers(hdd_ctx->psoc, &value); hdd_ctx->wiphy->max_ap_assoc_sta = value; wlan_hdd_update_ht_cap(hdd_ctx); + wlan_hdd_update_band_cap_in_wiphy(hdd_ctx); fils_enabled = 0; status = ucfg_mlme_get_fils_enabled_info(hdd_ctx->psoc, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index b265d25a61..ba393ce02f 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1928,7 +1928,7 @@ void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) { int ret; struct hdd_context *hdd_ctx = hdd_handle_to_context(hdd_handle); - uint8_t temp_band_cap; + uint8_t temp_band_cap, band_capability; struct cds_config_info *cds_cfg = cds_get_ini_config(); uint8_t antenna_mode; QDF_STATUS status; @@ -1992,10 +1992,16 @@ void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) } } - /* first store the INI band capability */ - temp_band_cap = hdd_ctx->config->nBandCapability; + status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to get MLME band capability"); + return; + } - hdd_ctx->config->nBandCapability = cfg->band_cap; + /* first store the INI band capability */ + temp_band_cap = band_capability; + + band_capability = cfg->band_cap; hdd_ctx->is_fils_roaming_supported = cfg->services.is_fils_roaming_supported; @@ -2006,17 +2012,22 @@ void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) * now overwrite the target band capability with INI * setting if INI setting is a subset */ - - if ((hdd_ctx->config->nBandCapability == BAND_ALL) && + if ((band_capability == BAND_ALL) && (temp_band_cap != BAND_ALL)) - hdd_ctx->config->nBandCapability = temp_band_cap; - else if ((hdd_ctx->config->nBandCapability != BAND_ALL) && + band_capability = temp_band_cap; + else if ((band_capability != BAND_ALL) && (temp_band_cap != BAND_ALL) && - (hdd_ctx->config->nBandCapability != temp_band_cap)) { + (band_capability != temp_band_cap)) { hdd_warn("ini BandCapability not supported by the target"); } - hdd_ctx->curr_band = hdd_ctx->config->nBandCapability; + status = ucfg_mlme_set_band_capability(hdd_ctx->psoc, band_capability); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to set MLME Band Capability"); + return; + } + + hdd_ctx->curr_band = band_capability; if (!cds_is_driver_recovering() || cds_is_driver_in_bad_state()) { hdd_ctx->reg.reg_domain = cfg->reg_domain; @@ -9651,6 +9662,8 @@ static int hdd_update_cds_config(struct hdd_context *hdd_ctx) { struct cds_config_info *cds_cfg; int value; + uint8_t band_capability; + QDF_STATUS status; cds_cfg = (struct cds_config_info *)qdf_mem_malloc(sizeof(*cds_cfg)); if (!cds_cfg) { @@ -9742,7 +9755,12 @@ static int hdd_update_cds_config(struct hdd_context *hdd_ctx) cds_cfg->active_mc_bc_apf_mode = hdd_ctx->config->active_mc_bc_apf_mode; cds_cfg->ito_repeat_count = hdd_ctx->config->ito_repeat_count; - cds_cfg->bandcapability = hdd_ctx->config->nBandCapability; + + status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) + goto exit; + + cds_cfg->bandcapability = band_capability; cds_cfg->delay_before_vdev_stop = hdd_ctx->config->delay_before_vdev_stop; cds_cfg->num_vdevs = hdd_ctx->config->num_vdevs; @@ -9769,6 +9787,12 @@ static int hdd_update_user_config(struct hdd_context *hdd_ctx) { struct wlan_objmgr_psoc_user_config *user_config; bool skip_dfs_in_p2p_search = false; + uint8_t band_capability; + QDF_STATUS status; + + status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) + return -EIO; user_config = qdf_mem_malloc(sizeof(*user_config)); if (user_config == NULL) { @@ -9790,7 +9814,7 @@ static int hdd_update_user_config(struct hdd_context *hdd_ctx) cfg_p2p_get_skip_dfs_channel_p2p_search(hdd_ctx->psoc, &skip_dfs_in_p2p_search); user_config->skip_dfs_chnl_in_p2p_search = skip_dfs_in_p2p_search; - user_config->band_capability = hdd_ctx->config->nBandCapability; + user_config->band_capability = band_capability; wlan_objmgr_psoc_set_user_config(hdd_ctx->psoc, user_config); qdf_mem_free(user_config); diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c index 40f32e20f3..367eab31b0 100644 --- a/core/hdd/src/wlan_hdd_oemdata.c +++ b/core/hdd/src/wlan_hdd_oemdata.c @@ -58,6 +58,7 @@ static int populate_oem_data_cap(struct hdd_adapter *adapter, struct hdd_config *config; uint32_t num_chan; uint8_t *chan_list; + uint8_t band_capability; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); config = hdd_ctx->config; @@ -65,6 +66,13 @@ static int populate_oem_data_cap(struct hdd_adapter *adapter, hdd_err("HDD configuration is null"); return -EINVAL; } + + status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to get MLME band capability"); + return -EIO; + } + chan_list = qdf_mem_malloc(sizeof(uint8_t) * OEM_CAP_MAX_NUM_CHANNELS); if (NULL == chan_list) { hdd_err("Memory allocation failed"); @@ -87,7 +95,7 @@ static int populate_oem_data_cap(struct hdd_adapter *adapter, data_cap->curr_dwell_time_max = sme_get_neighbor_scan_max_chan_time(hdd_ctx->mac_handle, adapter->session_id); - data_cap->supported_bands = config->nBandCapability; + data_cap->supported_bands = band_capability; /* request for max num of channels */ num_chan = OEM_CAP_MAX_NUM_CHANNELS; diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 918cfe856a..b60a1b5ff4 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -207,6 +207,13 @@ void hdd_reset_global_reg_params(void) static void reg_program_config_vars(struct hdd_context *hdd_ctx, struct reg_config_vars *config_vars) { + uint8_t band_capability = 0; + QDF_STATUS status; + + status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) + hdd_err("Failed to get MLME band cap, defaulting to BAND_ALL"); + config_vars->enable_11d_support = hdd_ctx->config->Is11dSupportEnabled; config_vars->scan_11d_interval = hdd_ctx->config->scan_11d_interval; config_vars->userspace_ctry_priority = @@ -216,7 +223,7 @@ static void reg_program_config_vars(struct hdd_context *hdd_ctx, hdd_ctx->config->indoor_channel_support; config_vars->force_ssc_disable_indoor_channel = hdd_ctx->config->force_ssc_disable_indoor_channel; - config_vars->band_capability = hdd_ctx->config->nBandCapability; + config_vars->band_capability = band_capability; config_vars->restart_beaconing = hdd_ctx->config-> restart_beaconing_on_chan_avoid_event; config_vars->enable_srd_chan_in_master_mode = @@ -709,6 +716,7 @@ int hdd_reg_set_band(struct net_device *dev, u8 ui_band) enum band_info currBand; enum band_info connectedBand; long lrc; + uint8_t band_capability; hdd_ctx = WLAN_HDD_GET_CTX(adapter); @@ -729,18 +737,22 @@ int hdd_reg_set_band(struct net_device *dev, u8 ui_band) hdd_debug("change band to %u", band); - if ((band == BAND_2G && hdd_ctx->config->nBandCapability == 2) || - (band == BAND_5G && hdd_ctx->config->nBandCapability == 1) || - (band == BAND_ALL && hdd_ctx->config->nBandCapability != 0)) { + status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) + return -EIO; + + if ((band == BAND_2G && band_capability == 2) || + (band == BAND_5G && band_capability == 1) || + (band == BAND_ALL && band_capability != 0)) { hdd_err("band value %u violate INI settings %u", - band, hdd_ctx->config->nBandCapability); + band, band_capability); return -EIO; } if (band == BAND_ALL) { hdd_debug("Auto band received. Setting band same as ini value %d", - hdd_ctx->config->nBandCapability); - band = hdd_ctx->config->nBandCapability; + band_capability); + band = band_capability; } if (ucfg_reg_get_curr_band(hdd_ctx->pdev, &currBand) != diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index b7abdbcf34..71aae66108 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -3687,6 +3687,8 @@ int wlan_hdd_update_phymode(struct net_device *net, mac_handle_t mac_handle, enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode; enum band_info curr_band = BAND_ALL; int retval = 0; + uint8_t band_capability; + QDF_STATUS status; old_phymode = sme_get_phy_mode(mac_handle); @@ -3700,11 +3702,17 @@ int wlan_hdd_update_phymode(struct net_device *net, mac_handle_t mac_handle, nChannelBondingMode5GHz)) ch_bond5g = true; - if (phddctx->config->nBandCapability == BAND_ALL) + status = wlan_mlme_get_band_capability(phddctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to get MLME Band capability"); + return -EIO; + } + + if (band_capability == BAND_ALL) band_24 = band_5g = true; - else if (phddctx->config->nBandCapability == BAND_2G) + else if (band_capability == BAND_2G) band_24 = true; - else if (phddctx->config->nBandCapability == BAND_5G) + else if (band_capability == BAND_5G) band_5g = true; vhtchanwidth = phddctx->config->vhtChannelWidth; @@ -3928,8 +3936,13 @@ int wlan_hdd_update_phymode(struct net_device *net, mac_handle_t mac_handle, } } #endif - sme_config->csrConfig.eBand = curr_band; - sme_config->csrConfig.bandCapability = curr_band; + status = ucfg_mlme_set_band_capability(phddctx->psoc, + curr_band); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("failed to set MLME band capability"); + goto free; + } + if (curr_band == BAND_2G) sme_config->csrConfig.Is11hSupportEnabled = 0; else diff --git a/core/mac/src/pe/lim/lim_process_tdls.c b/core/mac/src/pe/lim/lim_process_tdls.c index 11a58b2522..bc9b803ebb 100644 --- a/core/mac/src/pe/lim/lim_process_tdls.c +++ b/core/mac/src/pe/lim/lim_process_tdls.c @@ -878,7 +878,7 @@ static QDF_STATUS lim_send_tdls_dis_rsp_frame(tpAniSirGlobal pMac, &tdlsDisRsp.SuppChannels, &tdlsDisRsp. SuppOperatingClasses); - if (pMac->roam.configParam.bandCapability != BAND_2G) { + if (pMac->mlme_cfg->gen.band_capability != BAND_2G) { tdlsDisRsp.ht2040_bss_coexistence.present = 1; tdlsDisRsp.ht2040_bss_coexistence.info_request = 1; } @@ -1243,7 +1243,7 @@ QDF_STATUS lim_send_tdls_link_setup_req_frame(tpAniSirGlobal pMac, &tdlsSetupReq.SuppChannels, &tdlsSetupReq. SuppOperatingClasses); - if (pMac->roam.configParam.bandCapability != BAND_2G) { + if (pMac->mlme_cfg->gen.band_capability != BAND_2G) { tdlsSetupReq.ht2040_bss_coexistence.present = 1; tdlsSetupReq.ht2040_bss_coexistence.info_request = 1; } @@ -1694,7 +1694,7 @@ static QDF_STATUS lim_send_tdls_setup_rsp_frame(tpAniSirGlobal pMac, &tdlsSetupRsp.SuppChannels, &tdlsSetupRsp. SuppOperatingClasses); - if (pMac->roam.configParam.bandCapability != BAND_2G) { + if (pMac->mlme_cfg->gen.band_capability != BAND_2G) { tdlsSetupRsp.ht2040_bss_coexistence.present = 1; tdlsSetupRsp.ht2040_bss_coexistence.info_request = 1; } diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 7f0eab1dd9..ebbd6937be 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -1046,9 +1046,7 @@ typedef struct tagCsrConfigParam { uint32_t channelBondingMode24GHz; uint32_t channelBondingMode5GHz; eCsrPhyMode phyMode; - enum band_info eBand; uint32_t HeartbeatThresh50; - enum band_info bandCapability; /* indicate hw capability */ eCsrRoamWmmUserModeType WMMSupportMode; bool Is11eSupportEnabled; bool Is11dSupportEnabled; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 51f6a029d1..e242d6871f 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -1680,7 +1680,6 @@ static void init_config_param(tpAniSirGlobal pMac) WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_AUTO; - pMac->roam.configParam.eBand = BAND_ALL; pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO; pMac->roam.configParam.HeartbeatThresh24 = 40; pMac->roam.configParam.HeartbeatThresh50 = 40; @@ -1760,7 +1759,7 @@ enum band_info csr_get_current_band(tHalHandle hHal) { tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - return pMac->roam.configParam.bandCapability; + return pMac->mlme_cfg->gen.band_capability; } /* This function flushes the roam scan cache */ @@ -2277,8 +2276,8 @@ QDF_STATUS csr_set_band(tHalHandle hHal, uint8_t sessionId, } QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, "Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)", eBand); - pMac->roam.configParam.eBand = eBand; - pMac->roam.configParam.bandCapability = eBand; + pMac->mlme_cfg->gen.band_capability = eBand; + pMac->mlme_cfg->gen.band = eBand; status = csr_get_channel_and_power_list(pMac); if (QDF_STATUS_SUCCESS == status) @@ -2778,8 +2777,12 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, pParam->Is11eSupportEnabled; pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; - pMac->roam.configParam.Is11hSupportEnabled = - pParam->Is11hSupportEnabled; + + if (pMac->mlme_cfg->gen.band_capability == BAND_2G) + pMac->roam.configParam.Is11hSupportEnabled = 0; + else + pMac->roam.configParam.Is11hSupportEnabled = + pParam->Is11hSupportEnabled; pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; pMac->roam.configParam.mcc_rts_cts_prot_enable = @@ -2818,7 +2821,6 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, pParam->ProprietaryRatesEnabled; pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; - pMac->roam.configParam.bandCapability = pParam->bandCapability; pMac->roam.configParam.wep_tkip_in_he = pParam->wep_tkip_in_he; pMac->roam.configParam.neighborRoamConfig. delay_before_vdev_stop = @@ -2867,7 +2869,6 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, pParam->min_rest_time_conc; pMac->roam.configParam.idle_time_conc = pParam->idle_time_conc; - pMac->roam.configParam.eBand = pParam->eBand; pMac->roam.configParam.uCfgDot11Mode = csr_get_cfg_dot11_mode_from_csr_phy_mode(NULL, pMac->roam.configParam. @@ -3209,7 +3210,6 @@ QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->ProprietaryRatesEnabled = cfg_params->ProprietaryRatesEnabled; pParam->AdHocChannel24 = cfg_params->AdHocChannel24; pParam->AdHocChannel5G = cfg_params->AdHocChannel5G; - pParam->bandCapability = cfg_params->bandCapability; pParam->nActiveMaxChnTime = cfg_params->nActiveMaxChnTime; pParam->nPassiveMaxChnTime = cfg_params->nPassiveMaxChnTime; pParam->nActiveMaxChnTimeConc = cfg_params->nActiveMaxChnTimeConc; @@ -3219,7 +3219,6 @@ QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->nRestTimeConc = cfg_params->nRestTimeConc; pParam->min_rest_time_conc = cfg_params->min_rest_time_conc; pParam->idle_time_conc = cfg_params->idle_time_conc; - pParam->eBand = cfg_params->eBand; pParam->nScanResultAgeCount = cfg_params->agingCount; pParam->bCatRssiOffset = cfg_params->bCatRssiOffset; pParam->fSupplicantCountryCodeHasPriority = @@ -3464,7 +3463,7 @@ QDF_STATUS csr_set_phy_mode(tHalHandle hHal, uint32_t phyMode, /* Done validating */ status = QDF_STATUS_SUCCESS; /* Now we need to check whether a restart is needed. */ - if (eBand != pMac->roam.configParam.eBand) { + if (eBand != pMac->mlme_cfg->gen.band) { fRestartNeeded = true; goto end; } @@ -3474,7 +3473,7 @@ QDF_STATUS csr_set_phy_mode(tHalHandle hHal, uint32_t phyMode, } end: if (QDF_IS_STATUS_SUCCESS(status)) { - pMac->roam.configParam.eBand = eBand; + pMac->mlme_cfg->gen.band = eBand; pMac->roam.configParam.phyMode = newPhyMode; if (pfRestartNeeded) *pfRestartNeeded = fRestartNeeded; @@ -4709,7 +4708,7 @@ QDF_STATUS csr_roam_prepare_bss_config_from_profile( pProfile->EncryptionType.encryptionType[0]) pBssConfig->BssCap.privacy = 1; - pBssConfig->eBand = pMac->roam.configParam.eBand; + pBssConfig->eBand = pMac->mlme_cfg->gen.band; /* phymode */ if (pProfile->ChannelInfo.ChannelList) operationChannel = pProfile->ChannelInfo.ChannelList[0]; @@ -13209,7 +13208,7 @@ csr_compute_mode_and_band(tpAniSirGlobal mac_ctx, * to determine the Mode setting. */ if (eCSR_OPERATING_CHANNEL_AUTO == opr_ch) { - *band = mac_ctx->roam.configParam.eBand; + *band = mac_ctx->mlme_cfg->gen.band; if (BAND_2G == *band) { /* * See reason in else if ( WLAN_REG_IS_24GHZ_CH @@ -13294,7 +13293,7 @@ enum csr_cfgdot11mode curr_mode = mac_ctx->roam.configParam.uCfgDot11Mode; /* dot11 mode is set, lets pick the band */ if (eCSR_OPERATING_CHANNEL_AUTO == opr_chn) { /* channel is Auto also. */ - band = mac_ctx->roam.configParam.eBand; + band = mac_ctx->mlme_cfg->gen.band; if (BAND_ALL == band) { /* prefer 5GHz */ band = BAND_5G; @@ -18299,7 +18298,7 @@ csr_fetch_ch_lst_from_ini(tpAniSirGlobal mac_ctx, * The INI channels need to be filtered with respect to the current band * that is supported. */ - band = mac_ctx->roam.configParam.bandCapability; + band = mac_ctx->mlme_cfg->gen.band_capability; if ((BAND_2G != band) && (BAND_5G != band) && (BAND_ALL != band)) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index 3bcc71fdb4..1579b74644 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -1793,7 +1793,7 @@ uint32_t csr_translate_to_wni_cfg_dot11_mode(tpAniSirGlobal pMac, break; default: sme_warn("doesn't expect %d as csrDo11Mode", csrDot11Mode); - if (BAND_2G == pMac->roam.configParam.eBand) + if (BAND_2G == pMac->mlme_cfg->gen.band) ret = WNI_CFG_DOT11_MODE_11G; else ret = WNI_CFG_DOT11_MODE_11A; @@ -2162,7 +2162,7 @@ enum csr_cfgdot11mode csr_find_best_phy_mode(tpAniSirGlobal pMac, uint32_t phyMode) { enum csr_cfgdot11mode cfgDot11ModeToUse; - enum band_info eBand = pMac->roam.configParam.eBand; + enum band_info eBand = pMac->mlme_cfg->gen.band; if ((0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 16bae864f4..1e980532e7 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -1538,9 +1538,9 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma, break; case WMI_PDEV_PARAM_TXPOWER_LIMIT2G: wma->pdevconfig.txpow2g = privcmd->param_value; - if ((pMac->roam.configParam.bandCapability == + if ((pMac->mlme_cfg->gen.band_capability == BAND_ALL) || - (pMac->roam.configParam.bandCapability == + (pMac->mlme_cfg->gen.band_capability == BAND_2G)) { if (cfg_set_int(pMac, WNI_CFG_CURRENT_TX_POWER_LEVEL, @@ -1554,9 +1554,9 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma, break; case WMI_PDEV_PARAM_TXPOWER_LIMIT5G: wma->pdevconfig.txpow5g = privcmd->param_value; - if ((pMac->roam.configParam.bandCapability == + if ((pMac->mlme_cfg->gen.band_capability == BAND_ALL) || - (pMac->roam.configParam.bandCapability == + (pMac->mlme_cfg->gen.band_capability == BAND_5G)) { if (cfg_set_int(pMac, WNI_CFG_CURRENT_TX_POWER_LEVEL,