diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 59f130c0e5ad..b588fc5522a2 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -368,8 +368,10 @@ QDF_STATUS wlan_mlme_get_auto_channel_weight(struct wlan_objmgr_psoc *psoc, { struct wlan_mlme_psoc_obj *mlme_obj = mlme_get_psoc_obj(psoc); - if (!mlme_obj) + if (!mlme_obj) { + *value = cfg_default(CFG_AUTO_CHANNEL_SELECT_WEIGHT); return QDF_STATUS_E_FAILURE; + } *value = mlme_obj->cfg.acs.auto_channel_select_weight; return QDF_STATUS_SUCCESS; @@ -1787,8 +1789,10 @@ QDF_STATUS wlan_mlme_get_sap_reduced_beacon_interval(struct wlan_objmgr_psoc struct wlan_mlme_psoc_obj *mlme_obj; mlme_obj = mlme_get_psoc_obj(psoc); - if (!mlme_obj) + if (!mlme_obj) { + *value = cfg_default(CFG_REDUCED_BEACON_INTERVAL); return QDF_STATUS_E_FAILURE; + } *value = mlme_obj->cfg.sap_cfg.reduced_beacon_interval; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 72b914360d0e..eb5f44d4a2e0 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -2541,8 +2541,6 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, enum policy_mgr_con_mode pm_mode; QDF_STATUS qdf_status; bool skip_etsi13_srd_chan = false; - uint32_t auto_channel_select_weight = - cfg_default(CFG_AUTO_CHANNEL_SELECT_WEIGHT); bool is_vendor_acs_support = cfg_default(CFG_USER_AUTO_CHANNEL_SELECTION); bool is_external_acs_policy = @@ -2855,16 +2853,6 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, sap_config->acs_cfg.start_ch, sap_config->acs_cfg.end_ch); - qdf_status = - ucfg_mlme_get_auto_channel_weight(hdd_ctx->psoc, - &auto_channel_select_weight); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) - hdd_err("get_auto_channel_weight failed"); - - if (auto_channel_select_weight) - sap_config->auto_channel_select_weight = - auto_channel_select_weight; - sap_config->acs_cfg.is_ht_enabled = ht_enabled; sap_config->acs_cfg.is_vht_enabled = vht_enabled; diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 287dab8f940c..35a438cf3aea 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4899,10 +4899,6 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, bool ignore_cac = 0; uint8_t is_overlap_enable = 0, scc_on_dfs_chan = 0; uint8_t beacon_fixed_len, indoor_chnl_marking = 0; - int value; - uint32_t auto_channel_select_weight = - cfg_default(CFG_AUTO_CHANNEL_SELECT_WEIGHT); - uint8_t pref_chan_location = 0; bool sap_force_11n_for_11ac = 0; bool go_force_11n_for_11ac = 0; bool bval = false; @@ -5022,26 +5018,14 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, config->beacon_int = mgmt_frame->u.beacon.beacon_int; config->dfs_cac_offload = hdd_ctx->dfs_cac_offload; - status = ucfg_mlme_get_auto_channel_weight(hdd_ctx->psoc, - &auto_channel_select_weight); - if (!QDF_IS_STATUS_SUCCESS(status)) - hdd_err("ucfg_mlme_get_auto_channel_weight failed, set def"); - - config->auto_channel_select_weight = auto_channel_select_weight; - status = ucfg_policy_mgr_get_enable_overlap_chnl(hdd_ctx->psoc, &is_overlap_enable); if (!QDF_IS_STATUS_SUCCESS(status)) hdd_err("can't get overlap channel INI value, using default"); config->enOverLapCh = is_overlap_enable; - status = ucfg_mlme_get_sap_reduces_beacon_interval(hdd_ctx->psoc, - &value); - if (!QDF_IS_STATUS_SUCCESS(status)) - hdd_err("ucfg_mlme_get_sap_reduces_beacon_interval fail"); config->dtim_period = beacon->dtim_period; - config->reduced_beacon_interval = value; hdd_debug("acs_mode %d", config->acs_cfg.acs_mode); if (config->acs_cfg.acs_mode == true) { @@ -5130,10 +5114,9 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, ignore_cac = 1; wlansap_set_dfs_ignore_cac(mac_handle, ignore_cac); - ucfg_mlme_get_pref_chan_location(hdd_ctx->psoc, - &pref_chan_location); - wlansap_set_dfs_preferred_channel_location(mac_handle, - pref_chan_location); + + wlansap_set_dfs_preferred_channel_location(mac_handle); + wlan_hdd_set_sap_mcc_chnl_avoid(hdd_ctx); } else if (adapter->device_mode == QDF_P2P_GO_MODE) { config->countryCode[0] = hdd_ctx->reg.alpha2[0]; diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 91ac669b9ecf..5dea9b6a35c7 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -504,7 +504,6 @@ struct sap_config { #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH uint8_t cc_switch_mode; #endif - uint32_t auto_channel_select_weight; struct sap_acs_cfg acs_cfg; uint16_t probeRespIEsBufferLen; /* buffer for addn ies comes from hostapd */ @@ -527,7 +526,6 @@ struct sap_config { struct hdd_channel_info *channel_info; uint32_t channel_info_count; bool dfs_cac_offload; - uint16_t reduced_beacon_interval; }; #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE @@ -1132,8 +1130,22 @@ wlan_sap_set_channel_avoidance(mac_handle_t mac_handle, bool sap_channel_avoidance); #endif -QDF_STATUS wlansap_set_dfs_preferred_channel_location(mac_handle_t mac_handle, - uint8_t dfs_Preferred_Channels_location); +/** + * wlansap_set_dfs_preferred_channel_location() - set dfs preferred channel + * @mac_handle: Opaque handle to the global MAC context + * + * This API is used to set sap preferred channels location + * to resetrict the DFS random channel selection algorithm + * either Indoor/Outdoor channels only. + * dfs_Preferred_Channels_location : + * 0 - Indicates No preferred channel location restrictions + * 1 - Indicates SAP Indoor Channels operation only. + * 2 - Indicates SAP Outdoor Channels operation only. + * + * Return: The QDF_STATUS code associated with performing the operation + * QDF_STATUS_SUCCESS: Success and error code otherwise. + */ +QDF_STATUS wlansap_set_dfs_preferred_channel_location(mac_handle_t mac_handle); /** * wlansap_set_dfs_target_chnl() - Set target channel diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index fac3c0fb2ee1..485942e6bdf0 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -52,6 +52,7 @@ #include #include #include +#include "cfg_ucfg_api.h" #include "wlan_mlme_ucfg_api.h" #define SAP_DEBUG @@ -519,6 +520,7 @@ wlansap_set_scan_acs_channel_params(struct sap_config *config, { struct mac_context *mac; QDF_STATUS status = QDF_STATUS_SUCCESS; + uint32_t auto_channel_select_weight; if (!config) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, @@ -532,14 +534,29 @@ wlansap_set_scan_acs_channel_params(struct sap_config *config, return QDF_STATUS_E_FAULT; } + mac = sap_get_mac_context(); + if (!mac) { + sap_err("Invalid MAC context"); + return QDF_STATUS_E_INVAL; + } + /* Channel selection is auto or configured */ psap_ctx->channel = config->channel; psap_ctx->dfs_mode = config->acs_dfs_mode; #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH psap_ctx->cc_switch_mode = config->cc_switch_mode; #endif - psap_ctx->auto_channel_select_weight = - config->auto_channel_select_weight; + status = ucfg_mlme_get_auto_channel_weight( + mac->psoc, + &auto_channel_select_weight); + + if (!QDF_IS_STATUS_SUCCESS(status)) + sap_err("get_auto_channel_weight failed"); + + psap_ctx->auto_channel_select_weight = auto_channel_select_weight; + sap_debug("auto_channel_select_weight %d", + psap_ctx->auto_channel_select_weight); + psap_ctx->user_context = pusr_context; psap_ctx->enableOverLapCh = config->enOverLapCh; psap_ctx->acs_cfg = &config->acs_cfg; @@ -559,12 +576,6 @@ wlansap_set_scan_acs_channel_params(struct sap_config *config, qdf_mem_copy(psap_ctx->self_mac_addr, config->self_macaddr.bytes, QDF_MAC_ADDR_SIZE); - mac = sap_get_mac_context(); - if (!mac) { - QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid MAC context"); - return QDF_STATUS_E_FAULT; - } - return status; } @@ -668,6 +679,9 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, { struct sap_sm_event sap_event; /* State machine event */ QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; + uint32_t auto_channel_select_weight = + cfg_default(CFG_AUTO_CHANNEL_SELECT_WEIGHT); + int reduced_beacon_interval; struct mac_context *pmac = NULL; int sap_chanswitch_beacon_cnt; bool sap_chanswitch_mode; @@ -681,6 +695,14 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, __func__); return QDF_STATUS_E_FAULT; } + + pmac = sap_get_mac_context(); + if (!pmac) { + sap_err("Invalid MAC context"); + qdf_status = QDF_STATUS_E_INVAL; + goto fail; + } + sap_ctx->fsm_state = SAP_INIT; /* Channel selection is auto or configured */ @@ -697,8 +719,17 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH sap_ctx->cc_switch_mode = config->cc_switch_mode; #endif - sap_ctx->auto_channel_select_weight = - config->auto_channel_select_weight; + + qdf_status = ucfg_mlme_get_auto_channel_weight( + pmac->psoc, + &auto_channel_select_weight); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) + sap_err("get_auto_channel_weight failed"); + + sap_ctx->auto_channel_select_weight = auto_channel_select_weight; + sap_debug("auto_channel_select_weight %d", + sap_ctx->auto_channel_select_weight); + sap_ctx->user_context = user_context; sap_ctx->enableOverLapCh = config->enOverLapCh; sap_ctx->acs_cfg = &config->acs_cfg; @@ -722,12 +753,6 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, /* copy the configuration items to csrProfile */ sapconvert_to_csr_profile(config, eCSR_BSS_TYPE_INFRA_AP, &sap_ctx->csr_roamProfile); - pmac = sap_get_mac_context(); - if (!pmac) { - sap_err("Invalid MAC context"); - qdf_status = QDF_STATUS_E_FAULT; - goto fail; - } /* * Set the DFS Test Mode setting @@ -756,8 +781,16 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, pmac->sap.sapCtxList[sap_ctx->sessionId].sap_context = sap_ctx; pmac->sap.sapCtxList[sap_ctx->sessionId].sapPersona = sap_ctx->csr_roamProfile.csrPersona; + + qdf_status = ucfg_mlme_get_sap_reduces_beacon_interval( + pmac->psoc, + &reduced_beacon_interval); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) + sap_err("ucfg_mlme_get_sap_reduces_beacon_interval fail"); + pmac->sap.SapDfsInfo.reduced_beacon_interval = - config->reduced_beacon_interval; + reduced_beacon_interval; + sap_debug("reduced_beacon_interval %d", reduced_beacon_interval); /* Copy MAC filtering settings to sap context */ sap_ctx->eSapMacAddrAclMode = config->SapMacaddr_acl; @@ -1959,29 +1992,13 @@ wlan_sap_set_channel_avoidance(mac_handle_t mac_handle, } #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ -/** - * wlansap_set_dfs_preferred_channel_location() - set dfs preferred channel - * @mac_handle: Opaque handle to the global MAC context - * @dfs_Preferred_Channels_location : - * 0 - Indicates No preferred channel location restrictions - * 1 - Indicates SAP Indoor Channels operation only. - * 2 - Indicates SAP Outdoor Channels operation only. - * - * This API is used to set sap preferred channels location - * to resetrict the DFS random channel selection algorithm - * either Indoor/Outdoor channels only. - * - * Return: The QDF_STATUS code associated with performing the operation - * QDF_STATUS_SUCCESS: Success and error code otherwise. - */ QDF_STATUS -wlansap_set_dfs_preferred_channel_location(mac_handle_t mac_handle, - uint8_t - dfs_Preferred_Channels_location) +wlansap_set_dfs_preferred_channel_location(mac_handle_t mac_handle) { struct mac_context *mac = NULL; QDF_STATUS status; enum dfs_reg dfs_region; + uint8_t dfs_preferred_channels_location = 0; if (mac_handle) { mac = MAC_CONTEXT(mac_handle); @@ -1998,9 +2015,14 @@ wlansap_set_dfs_preferred_channel_location(mac_handle_t mac_handle, * restriction is currently enforeced only for * JAPAN regulatory domain. */ + ucfg_mlme_get_pref_chan_location(mac->psoc, + &dfs_preferred_channels_location); + sap_debug("dfs_preferred_channels_location %d", + dfs_preferred_channels_location); + if (DFS_MKK_REGION == dfs_region) { mac->sap.SapDfsInfo.sap_operating_chan_preferred_location = - dfs_Preferred_Channels_location; + dfs_preferred_channels_location; QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_LOW, FL