diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 5cfc263e66b0..e6ddf263d980 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4883,9 +4883,9 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, struct ieee80211_mgmt *mgmt_frame; struct ieee80211_mgmt mgmt; const uint8_t *ie = NULL; - uint16_t capab_info, ap_prot = cfg_default(CFG_AP_PROTECTION_MODE); eCsrEncryptionType rsn_encrypt_type; eCsrEncryptionType mc_rsn_encrypt_type; + uint16_t capab_info; int status = QDF_STATUS_SUCCESS, ret; int qdf_status = QDF_STATUS_SUCCESS; sap_event_cb sap_event_callback; @@ -4904,14 +4904,12 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, uint8_t is_overlap_enable = 0, scc_on_dfs_chan = 0; uint8_t beacon_fixed_len, indoor_chnl_marking = 0; int value; - bool val; - uint32_t tx_leakage_threshold = 0; 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, ap_obss_prot = false, sap_uapsd = true; + bool bval = false; bool enable_dfs_scan = true; hdd_enter(); @@ -5034,33 +5032,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, hdd_err("ucfg_mlme_get_auto_channel_weight failed, set def"); config->auto_channel_select_weight = auto_channel_select_weight; - status = ucfg_mlme_get_sap_chn_switch_bcn_count(hdd_ctx->psoc, &value); - if (!QDF_IS_STATUS_SUCCESS(status)) - hdd_err("ucfg_mlme_get_sap_chn_switch_bcn_count fail, set def"); - config->sap_chanswitch_beacon_cnt = value; - status = ucfg_mlme_get_sap_channel_switch_mode(hdd_ctx->psoc, &val); - if (!QDF_IS_STATUS_SUCCESS(status)) - hdd_err("ucfg_mlme_get_sap_channel_switch_mode, set def"); - config->sap_chanswitch_mode = val; - /* channel is already set in the set_channel Call back */ - /* config->channel = pCommitConfig->channel; */ - - /* Protection parameter to enable or disable */ - config->protEnabled = ucfg_mlme_is_ap_prot_enabled(hdd_ctx->psoc); - - status = ucfg_mlme_get_sap_chan_switch_rate_enabled(hdd_ctx->psoc, - &val); - if (!QDF_IS_STATUS_SUCCESS(status)) - hdd_err("ucfg_mlme_get_sap_chan_switch_rate_enabled, set def"); - config->chan_switch_hostapd_rate_enabled = val; - - if (QDF_STATUS_SUCCESS == - ucfg_policy_mgr_get_mcc_scc_switch(hdd_ctx->psoc, - &mcc_to_scc_switch)) { - if (mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) - config->chan_switch_hostapd_rate_enabled = false; - } status = ucfg_policy_mgr_get_enable_overlap_chnl(hdd_ctx->psoc, &is_overlap_enable); if (!QDF_IS_STATUS_SUCCESS(status)) @@ -5154,6 +5126,8 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, if (!QDF_IS_STATUS_SUCCESS(status)) hdd_err("can't get sta-sap scc on dfs chnl, use def"); + ucfg_policy_mgr_get_mcc_scc_switch(hdd_ctx->psoc, + &mcc_to_scc_switch); if (ignore_cac || ((mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) && scc_on_dfs_chan)) @@ -5173,9 +5147,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, config->ieee80211d = 0; } - ucfg_mlme_get_sap_tx_leakage_threshold(hdd_ctx->psoc, - &tx_leakage_threshold); - tgt_dfs_set_tx_leakage_threshold(hdd_ctx->pdev, tx_leakage_threshold); + tgt_dfs_set_tx_leakage_threshold(hdd_ctx->pdev); capab_info = mgmt_frame->u.beacon.capab_info; @@ -5493,31 +5465,11 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, wlan_reg_set_channel_params(hdd_ctx->pdev, config->channel, config->sec_ch, &config->ch_params); - /* ht_capab is not what the name conveys, - * this is used for protection bitmap - */ - qdf_status = ucfg_mlme_get_ap_protection_mode(hdd_ctx->psoc, &ap_prot); - if (QDF_IS_STATUS_ERROR(qdf_status)) - hdd_debug("Get ap protection mode failed using default value"); - config->ht_capab = ap_prot; - if (0 != wlan_hdd_cfg80211_update_apies(adapter)) { hdd_err("SAP Not able to set AP IEs"); ret = -EINVAL; goto error; } - /* Uapsd Enabled Bit */ - qdf_status = ucfg_mlme_is_sap_uapsd_enabled(hdd_ctx->psoc, &sap_uapsd); - if (QDF_IS_STATUS_ERROR(qdf_status)) - hdd_debug("Get ap UAPSD enabled/disabled failed"); - config->UapsdEnable = sap_uapsd; - - /* Enable OBSS protection */ - qdf_status = ucfg_mlme_is_ap_obss_prot_enabled(hdd_ctx->psoc, - &ap_obss_prot); - if (QDF_IS_STATUS_ERROR(qdf_status)) - hdd_debug("Get ap obss protection failed"); - config->obssProtEnabled = ap_obss_prot; #ifdef WLAN_FEATURE_11W config->mfpCapable = mfp_capable; @@ -5533,12 +5485,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, (int)config->channel); hdd_debug("hw_mode=%x, privacy=%d, authType=%d", config->SapHw_mode, config->privacy, config->authType); - hdd_debug("RSN/WPALen=%d, Uapsd = %d", - (int)config->RSNWPAReqIELength, config->UapsdEnable); - hdd_debug("ProtEnabled = %d, OBSSProtEnabled = %d", - config->protEnabled, config->obssProtEnabled); - hdd_debug("ChanSwitchHostapdRateEnabled = %d", - config->chan_switch_hostapd_rate_enabled); + hdd_debug("RSN/WPALen=%d", (int)config->RSNWPAReqIELength); mutex_lock(&hdd_ctx->sap_lock); if (cds_is_driver_unloading()) { diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index c267df49d495..91ac669b9ecf 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -471,9 +471,6 @@ struct sap_config { eSapMacAddrACL SapMacaddr_acl; struct qdf_mac_addr accept_mac[MAX_ACL_MAC_ADDRESS]; /* MAC filtering */ bool ieee80211d; /* Specify if 11D is enabled or disabled */ - bool protEnabled; /* Specify if protection is enabled or disabled */ - /* Specify if OBSS protection is enabled or disabled */ - bool obssProtEnabled; struct qdf_mac_addr deny_mac[MAX_ACL_MAC_ADDRESS]; /* MAC filtering */ struct qdf_mac_addr self_macaddr; /* self macaddress or BSSID */ uint8_t channel; /* Operation channel */ @@ -493,11 +490,9 @@ struct sap_config { eSapAuthType authType; tCsrAuthList akm_list; bool privacy; - bool UapsdEnable; bool fwdWPSPBCProbeReq; /* 0 - disabled, 1 - not configured , 2 - configured */ uint8_t wps_state; - uint16_t ht_capab; uint16_t RSNWPAReqIELength; /* The byte count in the pWPAReqIE */ uint32_t beacon_int; /* Beacon Interval */ enum QDF_OPMODE persona; /* Tells us which persona, GO or AP */ @@ -532,10 +527,6 @@ struct sap_config { struct hdd_channel_info *channel_info; uint32_t channel_info_count; bool dfs_cac_offload; - /* beacon count before channel switch */ - uint8_t sap_chanswitch_beacon_cnt; - uint8_t sap_chanswitch_mode; - bool chan_switch_hostapd_rate_enabled; uint16_t reduced_beacon_interval; }; diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index f04873c7e812..cbcbd3cca940 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -54,6 +54,9 @@ #include #include #include "wlan_reg_services_api.h" +#include "wlan_mlme_ucfg_api.h" +#include "wlan_policy_mgr_ucfg.h" +#include "cfg_ucfg_api.h" /*---------------------------------------------------------------------------- * Preprocessor Definitions and Constants @@ -2948,6 +2951,19 @@ eSapStatus sapconvert_to_csr_profile(struct sap_config *config, eCsrRoamBssType bssType, struct csr_roam_profile *profile) { + int qdf_status = QDF_STATUS_SUCCESS; + bool sap_uapsd = true, chan_switch_hostapd_rate_enabled = true; + bool ap_obss_prot = false; + uint16_t ap_prot = cfg_default(CFG_AP_PROTECTION_MODE); + struct mac_context *mac_ctx; + uint8_t mcc_to_scc_switch = 0; + + mac_ctx = sap_get_mac_context(); + if (!mac_ctx) { + sap_err("Invalid MAC context"); + return eSAP_STATUS_FAILURE; + } + /* Create Roam profile for SoftAP to connect */ profile->BSSType = eCSR_BSS_TYPE_INFRA_AP; profile->SSIDs.numOfSSIDs = 1; @@ -3041,13 +3057,31 @@ sapconvert_to_csr_profile(struct sap_config *config, eCsrRoamBssType bssType, profile->dtimPeriod = config->dtim_period; /* set Uapsd enable bit */ - profile->ApUapsdEnable = config->UapsdEnable; + qdf_status = ucfg_mlme_is_sap_uapsd_enabled(mac_ctx->psoc, &sap_uapsd); + if (QDF_IS_STATUS_ERROR(qdf_status)) + sap_err("Get ap UAPSD enabled/disabled failed"); + profile->ApUapsdEnable = sap_uapsd; + sap_debug("Uapsd %d", sap_uapsd); /* Enable protection parameters */ - profile->protEnabled = config->protEnabled; - profile->obssProtEnabled = config->obssProtEnabled; - profile->cfg_protection = config->ht_capab; + profile->protEnabled = ucfg_mlme_is_ap_prot_enabled(mac_ctx->psoc); + /* Enable OBSS protection */ + qdf_status = ucfg_mlme_is_ap_obss_prot_enabled(mac_ctx->psoc, + &ap_obss_prot); + if (QDF_IS_STATUS_ERROR(qdf_status)) + sap_err("Get ap obss protection failed"); + profile->obssProtEnabled = ap_obss_prot; + + sap_debug("ProtEnabled = %d", profile->protEnabled); + sap_debug("OBSSProtEnabled = %d", profile->obssProtEnabled); + + qdf_status = ucfg_mlme_get_ap_protection_mode(mac_ctx->psoc, &ap_prot); + if (QDF_IS_STATUS_ERROR(qdf_status)) + sap_err("Get ap protection mode failed using default value"); + profile->cfg_protection = ap_prot; + + sap_debug("cfg_protection = %d", profile->cfg_protection); /* country code */ if (config->countryCode[0]) qdf_mem_copy(profile->countryCode, config->countryCode, @@ -3111,10 +3145,23 @@ sapconvert_to_csr_profile(struct sap_config *config, eCsrRoamBssType bssType, config->extended_rates.numRates; } - profile->chan_switch_hostapd_rate_enabled = - config->chan_switch_hostapd_rate_enabled; + qdf_status = ucfg_mlme_get_sap_chan_switch_rate_enabled( + mac_ctx->psoc, + &chan_switch_hostapd_rate_enabled); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) + sap_err("ucfg_mlme_get_sap_chan_switch_rate_enabled, set def"); - return eSAP_STATUS_SUCCESS; /* Success. */ + profile->chan_switch_hostapd_rate_enabled = + chan_switch_hostapd_rate_enabled; + if (QDF_STATUS_SUCCESS == + ucfg_policy_mgr_get_mcc_scc_switch(mac_ctx->psoc, + &mcc_to_scc_switch)) { + if (mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) + profile->chan_switch_hostapd_rate_enabled = false; + } + sap_debug("rate_enabled %d", profile->chan_switch_hostapd_rate_enabled); + + return eSAP_STATUS_SUCCESS; } void sap_free_roam_profile(struct csr_roam_profile *profile) diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index 5a66bdb8ee87..03bbff42311a 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -50,6 +50,31 @@ #define SAP_CHAN_PREFERRED_INDOOR 1 #define SAP_CHAN_PREFERRED_OUTDOOR 2 +/*SAP Specific logging*/ + +#define sap_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_SAP, params) +#define sap_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, params) +#define sap_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_SAP, params) +#define sap_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_SAP, params) +#define sap_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_SAP, params) + +#define sap_nofl_alert(params...) \ + QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_SAP, params) +#define sap_nofl_err(params...) \ + QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_SAP, params) +#define sap_nofl_warn(params...) \ + QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_SAP, params) +#define sap_nofl_info(params...) \ + QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_SAP, params) +#define sap_nofl_debug(params...) \ + QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_SAP, params) + +#define sap_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_SAP, params) +#define sap_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_SAP, params) +#define sap_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_SAP, params) +#define sap_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_SAP, params) +#define sap_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_SAP, params) + /*---------------------------------------------------------------------------- * Typedefs * -------------------------------------------------------------------------*/ diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index ec67fbebc128..fac3c0fb2ee1 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -52,6 +52,7 @@ #include #include #include +#include "wlan_mlme_ucfg_api.h" #define SAP_DEBUG static struct sap_context *gp_sap_ctx[SAP_MAX_NUM_SESSION]; @@ -668,6 +669,8 @@ 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; struct mac_context *pmac = NULL; + int sap_chanswitch_beacon_cnt; + bool sap_chanswitch_mode; QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, FL("sap_ctx=%pK"), sap_ctx); @@ -721,19 +724,34 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, &sap_ctx->csr_roamProfile); pmac = sap_get_mac_context(); if (!pmac) { - QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid MAC context"); + sap_err("Invalid MAC context"); qdf_status = QDF_STATUS_E_FAULT; goto fail; } /* - * Copy the DFS Test Mode setting to pmac for - * access in lower layers + * Set the DFS Test Mode setting + * Set beacon channel count before chanel switch */ + qdf_status = ucfg_mlme_get_sap_chn_switch_bcn_count( + pmac->psoc, + &sap_chanswitch_beacon_cnt); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) + sap_err("ucfg_mlme_get_sap_chn_switch_bcn_count fail, set def"); + pmac->sap.SapDfsInfo.sap_ch_switch_beacon_cnt = - config->sap_chanswitch_beacon_cnt; + sap_chanswitch_beacon_cnt; pmac->sap.SapDfsInfo.sap_ch_switch_mode = - config->sap_chanswitch_mode; + sap_chanswitch_beacon_cnt; + sap_debug("sap_chanswitch_beacon_cnt:%d", sap_chanswitch_beacon_cnt); + + qdf_status = ucfg_mlme_get_sap_channel_switch_mode( + pmac->psoc, + &sap_chanswitch_mode); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) + sap_err("ucfg_mlme_get_sap_channel_switch_mode, set def"); + pmac->sap.SapDfsInfo.sap_ch_switch_mode = sap_chanswitch_mode; + sap_debug("sap_chanswitch_mode:%d", sap_chanswitch_mode); pmac->sap.sapCtxList[sap_ctx->sessionId].sap_context = sap_ctx; pmac->sap.sapCtxList[sap_ctx->sessionId].sapPersona =