From 87f00a48b4f41d5c8fdd016e63bfe1acac1b1e1e Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Mon, 6 Aug 2018 20:34:35 +0530 Subject: qcacld-3.0: Fix bss scoring params Currently the driver calculates the nss score based upon the mx capability of the AP, and not the hw_mde config which would be there after connection for example, the driver calculates the score for a 2x2 11n AP, and 1x1 VHT (11ac) AP, it connects to the 11n AP in 1x1 mode, if a concurrent connection is present, which affects throughput Fix is to check whether the current AP channel results in DBS or not, if yes then change the NSS to 1 instead of 2 Change-Id: I902393be5ea9cf88def9da6b3458bb6048655ce7 CRs-Fixed: 2288362 --- core/cds/inc/cds_concurrency.h | 2 ++ core/cds/src/cds_concurrency.c | 27 +++++++++++++++++++++++++++ core/sme/src/csr/csr_api_scan.c | 32 ++++++++++++++++++++++++++------ 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h index 68c1c393de42..78a161ae9de9 100644 --- a/core/cds/inc/cds_concurrency.h +++ b/core/cds/inc/cds_concurrency.h @@ -848,6 +848,8 @@ QDF_STATUS cds_pdev_set_hw_mode(uint32_t session_id, enum hw_mode_agile_dfs_capab dfs, enum hw_mode_sbs_capab sbs, enum sir_conn_update_reason reason); +bool cds_is_dbs_req_for_channel(uint8_t channel_id); + enum cds_conc_next_action cds_need_opportunistic_upgrade(void); QDF_STATUS cds_next_actions(uint32_t session_id, enum cds_conc_next_action action, diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index 5b997b87c918..0979b1dcadda 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -2894,6 +2894,33 @@ QDF_STATUS cds_pdev_set_hw_mode(uint32_t session_id, return QDF_STATUS_SUCCESS; } +bool cds_is_dbs_req_for_channel(uint8_t channel_id) +{ + cds_context_type *cds_ctx; + uint32_t conn_index; + bool dbs_req = 0; + cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); + if (!cds_ctx) { + cds_err("Invalid CDS Context"); + return 0; + } + if (wma_is_hw_dbs_capable() == false) { + cds_debug("driver isnt DBS capable"); + return 0; + } + qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock); + for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS; + conn_index++) { + if (!CDS_IS_SAME_BAND_CHANNELS(channel_id, + conc_connection_list[conn_index].chan)) { + dbs_req = true; + break; + } + } + qdf_mutex_release(&cds_ctx->qdf_conc_list_lock); + return dbs_req; + +} /** * cds_is_connection_in_progress() - check if connection is in progress * @session_id: session id diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 678f124b6483..b524cfeebddc 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -2350,6 +2350,23 @@ static int32_t _csr_calculate_bss_score(tpAniSirGlobal mac_ctx, return score; } +static uint8_t csr_sta_get_supported_nss(tpAniSirGlobal mac_ctx, + tSirBssDescription *bss_info) +{ + uint8_t supported_nss = 1; + + if (wma_is_hw_dbs_capable() && + cds_is_dbs_req_for_channel(bss_info->channelId)) + return supported_nss; + + if (mac_ctx->vdev_type_nss_2g.sta && + CDS_IS_CHANNEL_24GHZ(bss_info->channelId)) + supported_nss = mac_ctx->vdev_type_nss_2g.sta; + else if (mac_ctx->vdev_type_nss_5g.sta && + CDS_IS_CHANNEL_5GHZ(bss_info->channelId)) + supported_nss = mac_ctx->vdev_type_nss_5g.sta; + return supported_nss; +} /** * csr_calculate_bss_score() - Calculate candidate AP score for Best * candidate selection for connection @@ -2371,13 +2388,16 @@ static void csr_calculate_bss_score(tpAniSirGlobal pMac, tSirBssDescription *bss_info = &(pBss->Result.BssDescriptor); channel_id = cds_get_channel_enum(pBss->Result.BssDescriptor.channelId); - if (pMac->roam.configParam.enable2x2) - nss = 2; - - if (channel_id < NUM_CHANNELS) + if (channel_id < NUM_CHANNELS) { + nss = csr_sta_get_supported_nss(pMac, bss_info); + if (!nss) { + sme_err("scoring failed for BSSID:- "MAC_ADDRESS_STR"", + MAC_ADDR_ARRAY(bss_info->bssId)); + return; + } score = _csr_calculate_bss_score(pMac, bss_info, - pcl_chan_weight, nss); - + pcl_chan_weight, nss); + } pBss->bss_score = score; return; } -- cgit v1.2.3