From 5daa340d0a7967f9bc82adfa09ea23aacca8d013 Mon Sep 17 00:00:00 2001 From: Yingying Tang Date: Thu, 20 Oct 2016 13:44:55 +0800 Subject: qcacld-3.0: Add SAP TX leakage threshold into ini file Propagate from qcacld-2.0 to qcacld-3.0 Current value of SAP TX leakage threshold is a fixed value 310, since different product may need different threshold, add it into ini file now. Change-Id: I0df8ac14f5e9e812a8ec5e5127df21eff0a8502b CRs-Fixed: 955258 --- core/hdd/inc/wlan_hdd_cfg.h | 12 ++++++++++++ core/hdd/src/wlan_hdd_cfg.c | 8 ++++++++ core/hdd/src/wlan_hdd_hostapd.c | 3 +++ core/sap/inc/sap_api.h | 4 ++++ core/sap/src/sap_fsm.c | 12 +++++++++++- core/sap/src/sap_module.c | 29 ++++++++++++++++++++++++++++- 6 files changed, 66 insertions(+), 2 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 5d04a9ad9248..67aff5b20948 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -3564,6 +3564,17 @@ enum dot11p_mode { #define CFG_SAP_FORCE_11N_FOR_11AC_MAX (1) #define CFG_SAP_FORCE_11N_FOR_11AC_DEFAULT (0) +/* + * sap tx leakage threshold + * customer can set this value from 100 to 1000 which means + * sap tx leakage threshold is -10db to -100db + */ +#define CFG_SAP_TX_LEAKAGE_THRESHOLD_NAME "gsap_tx_leakage_threshold" +#define CFG_SAP_TX_LEAKAGE_THRESHOLD_MIN (100) +#define CFG_SAP_TX_LEAKAGE_THRESHOLD_MAX (1000) +#define CFG_SAP_TX_LEAKAGE_THRESHOLD_DEFAULT (310) + + /* * Enable filtering of replayed multicast packets * In a typical infrastructure setup, it is quite normal to receive @@ -4259,6 +4270,7 @@ struct hdd_config { bool indoor_channel_support; /* parameter to force sap into 11n */ bool sap_force_11n_for_11ac; + uint16_t sap_tx_leakage_threshold; bool multicast_replay_filter; /* parameter for indicating sifs burst duration to fw */ uint8_t sifs_burst_duration; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 8cd32e6a90d9..c10e5405989f 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -3979,6 +3979,14 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_INDOOR_CHANNEL_SUPPORT_MIN, CFG_INDOOR_CHANNEL_SUPPORT_MAX), + REG_VARIABLE(CFG_SAP_TX_LEAKAGE_THRESHOLD_NAME, + WLAN_PARAM_Integer, + struct hdd_config, sap_tx_leakage_threshold, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_SAP_TX_LEAKAGE_THRESHOLD_DEFAULT, + CFG_SAP_TX_LEAKAGE_THRESHOLD_MIN, + CFG_SAP_TX_LEAKAGE_THRESHOLD_MAX), + REG_VARIABLE(CFG_BUG_ON_REINIT_FAILURE_NAME, WLAN_PARAM_Integer, struct hdd_config, bug_on_reinit_failure, VAR_FLAGS_OPTIONAL | diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index aa568a4a2ddf..741054f2cd6b 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -7212,6 +7212,9 @@ int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, pConfig->ieee80211d = 0; } + wlansap_set_tx_leakage_threshold(hHal, + iniConfig->sap_tx_leakage_threshold); + capab_info = pMgmt_frame->u.beacon.capab_info; pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 3add3a0f1b8c..7812900ad903 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -708,6 +708,7 @@ typedef struct sSapDfsInfo { * channel switch is disabled. */ uint8_t disable_dfs_ch_switch; + uint16_t tx_leakage_threshold; } tSapDfsInfo; typedef struct tagSapCtxList { @@ -964,8 +965,11 @@ QDF_STATUS wlansap_acs_chselect(void *pvos_gctx, tpWLAN_SAPEventCB pacs_event_callback, tsap_Config_t *pconfig, void *pusr_context); + uint32_t wlansap_get_chan_width(void *cds_ctx); +QDF_STATUS wlansap_set_tx_leakage_threshold(tHalHandle hal, + uint16_t tx_leakage_threshold); #ifdef __cplusplus } #endif diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 9493d91a9c4f..ee4e4b384461 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -1007,6 +1007,16 @@ sap_mark_leaking_ch(ptSapContext sap_ctx, uint32_t j = 0; uint32_t k = 0; uint8_t dfs_nol_channel; + tHalHandle hal = CDS_GET_HAL_CB(sap_ctx->pvosGCtx); + tpAniSirGlobal mac; + + if (NULL == hal) { + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, + "%s: Invalid hal pointer", __func__); + return QDF_STATUS_E_FAULT; + } + + mac = PMAC_STRUCT(hal); /* traverse target_chan_matrix and */ @@ -1051,7 +1061,7 @@ sap_mark_leaking_ch(ptSapContext sap_ctx, * to NOL channel */ if (target_chan_matrix[k].leak_lvl <= - SAP_TX_LEAKAGE_THRES) { + mac->sap.SapDfsInfo.tx_leakage_threshold) { /* * candidate channel will have * bad leakage in NOL channel, diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index ba469312d551..1bdb2aa9a11b 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -3622,7 +3622,6 @@ void wlan_sap_enable_phy_error_logs(tHalHandle hal, bool enable_log) mac_ctx->sap.enable_dfs_phy_error_logs = enable_log; } - /** * wlansap_get_chan_width() - get sap channel width. * @cds_ctx: pointer of global cds context @@ -3638,3 +3637,31 @@ uint32_t wlansap_get_chan_width(void *cds_ctx) sapcontext = CDS_GET_SAP_CB(cds_ctx); return wlan_sap_get_vht_ch_width(sapcontext); } + +/** + * wlansap_set_tx_leakage_threshold() - set sap tx leakage threshold. + * @hal: HAL pointer + * @tx_leakage_threshold: sap tx leakage threshold + * + * This function set sap tx leakage threshold. + * + * Return: QDF_STATUS. + */ +QDF_STATUS wlansap_set_tx_leakage_threshold(tHalHandle hal, + uint16_t tx_leakage_threshold) +{ + tpAniSirGlobal mac; + + if (NULL == hal) { + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, + "%s: Invalid hal pointer", __func__); + return QDF_STATUS_E_FAULT; + } + + mac = PMAC_STRUCT(hal); + mac->sap.SapDfsInfo.tx_leakage_threshold = tx_leakage_threshold; + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, + "%s: leakage_threshold %d", __func__, + mac->sap.SapDfsInfo.tx_leakage_threshold); + return QDF_STATUS_SUCCESS; +} -- cgit v1.2.3