Explorar o código

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
Abhishek Singh %!s(int64=8) %!d(string=hai) anos
pai
achega
3c9910e266

+ 8 - 7
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",

+ 3 - 0
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;

+ 2 - 0
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;

+ 2 - 0
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 */

+ 18 - 0
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);