From 3c9910e266b8d93244aabc05680169274417a791 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Fri, 6 Jan 2017 17:56:47 +0530 Subject: [PATCH] qcacld-3.0: Prioritize the bssid_hint and if fails try with other BSS qcacld-2.0 to qcacld-3.0 propagation If connect request has bssid_hint the behaviour is same as when connect request has bssid present. So driver only try to connect to BSSID present in the bssid_hint. With this change if bssid_hint is provided in connect request driver will prioritize connection to the BSSID provided and if it fails to connect to bssid_hint, driver will try to connect to other APs with same profile. Change-Id: Ie7fd29cdfb2013aca1d4944272da6b3c29a16ab3 CRs-Fixed: 1107816 --- core/hdd/src/wlan_hdd_cfg80211.c | 15 ++++++++------- core/hdd/src/wlan_hdd_wext.c | 3 +++ core/sme/inc/csr_api.h | 2 ++ core/sme/src/csr/csr_api_roam.c | 2 ++ core/sme/src/csr/csr_api_scan.c | 18 ++++++++++++++++++ 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index d8a420586a..241d7b6819 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11910,6 +11910,12 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter, ssid, ssid_len); pRoamProfile->do_not_roam = !pAdapter->fast_roaming_allowed; + /* cleanup bssid hint */ + qdf_mem_zero(pRoamProfile->bssid_hint.bytes, + QDF_MAC_ADDR_SIZE); + qdf_mem_zero((void *)(pRoamProfile->BSSIDs.bssid), + QDF_MAC_ADDR_SIZE); + if (bssid) { pRoamProfile->BSSIDs.numOfBSSIDs = 1; pRoamProfile->do_not_roam = true; @@ -11925,9 +11931,8 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter, bssid, QDF_MAC_ADDR_SIZE); hdd_info("bssid is given by upper layer %pM", bssid); } else if (bssid_hint) { - pRoamProfile->BSSIDs.numOfBSSIDs = 1; - qdf_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), - bssid_hint, QDF_MAC_ADDR_SIZE); + qdf_mem_copy(pRoamProfile->bssid_hint.bytes, + bssid_hint, QDF_MAC_ADDR_SIZE); /* * Save BSSID in a separate variable as * pRoamProfile's BSSID is getting zeroed out in the @@ -11938,10 +11943,6 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter, bssid_hint, QDF_MAC_ADDR_SIZE); hdd_info("bssid_hint is given by upper layer %pM", bssid_hint); - } else { - qdf_mem_zero((void *)(pRoamProfile->BSSIDs.bssid), - QDF_MAC_ADDR_SIZE); - hdd_info("no bssid given by upper layer"); } hdd_notice("Connect to SSID: %.*s operating Channel: %u", diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index cd8036c3f7..95a299e848 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -2175,6 +2175,9 @@ void hdd_clear_roam_profile_ie(hdd_adapter_t *pAdapter) pWextState->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; + qdf_mem_zero(pWextState->roamProfile.bssid_hint.bytes, + QDF_MAC_ADDR_SIZE); + #ifdef WLAN_FEATURE_11W pWextState->roamProfile.MFPEnabled = false; pWextState->roamProfile.MFPRequired = 0; diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 0b4222bf97..435168a491 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -392,6 +392,7 @@ typedef struct tagCsrScanResultFilter { */ uint8_t scan_filter_for_roam; struct sCsrChannel_ pcl_channels; + struct qdf_mac_addr bssid_hint; enum tQDF_ADAPTER_MODE csrPersona; } tCsrScanResultFilter; @@ -970,6 +971,7 @@ typedef struct tagCsrRoamProfile { uint8_t beacon_tx_rate; tSirMacRateSet supported_rates; tSirMacRateSet extended_rates; + struct qdf_mac_addr bssid_hint; bool do_not_roam; } tCsrRoamProfile; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 6de6c33abf..2293d0a96e 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -10217,6 +10217,8 @@ csr_roam_prepare_filter_from_profile(tpAniSirGlobal mac_ctx, scan_fltr->MDID.mdiePresent = 1; scan_fltr->MDID.mobilityDomain = profile->MDID.mobilityDomain; } + qdf_mem_copy(scan_fltr->bssid_hint.bytes, + profile->bssid_hint.bytes, QDF_MAC_ADDR_SIZE); #ifdef WLAN_FEATURE_11W /* Management Frame Protection */ diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 17b44f078f..f58c626d18 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -1956,10 +1956,28 @@ csr_save_scan_entry(tpAniSirGlobal pMac, (*count)++; return status; } + if (pFilter && + !qdf_mem_cmp(pResult->Result.BssDescriptor.bssId, + pFilter->bssid_hint.bytes, QDF_MAC_ADDR_SIZE)) { + /* bssid hint AP should be on head */ + csr_ll_insert_head(&pRetList->List, + &pResult->Link, LL_ACCESS_NOLOCK); + (*count)++; + return status; + } pTmpEntry = csr_ll_peek_head(&pRetList->List, LL_ACCESS_NOLOCK); while (pTmpEntry) { pTmpResult = GET_BASE_ADDR(pTmpEntry, tCsrScanResult, Link); + + /* Skip the bssid hint AP, as it should be on head */ + if (pFilter && + !qdf_mem_cmp(pTmpResult->Result.BssDescriptor.bssId, + pFilter->bssid_hint.bytes, QDF_MAC_ADDR_SIZE)) { + pTmpEntry = csr_ll_next(&pRetList->List, + pTmpEntry, LL_ACCESS_NOLOCK); + continue; + } if (csr_is_better_bss(pMac, pResult, pTmpResult)) { csr_ll_insert_entry(&pRetList->List, pTmpEntry, &pResult->Link, LL_ACCESS_NOLOCK);