Explorar el Código

qcacld-3.0: Choose best candidate at first connection

Best candidate at first connection is a mechanism
to select best possible candidate for making Wi-Fi
connection based on the scan results provided.
Driver use Scan results to calculate score for each
BSS and select the best candidate to connect.
This enhances the user experience by connection
to better AP, based on certain parameters.

Change-Id: I3f88fa8c67f4cf830f05faf2c1d3f3491eee9a72
CRs-Fixed: 2018585
Abhishek Singh hace 7 años
padre
commit
b58164af41

+ 25 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -12049,6 +12049,30 @@ enum hdd_external_acs_freq_band {
 #define CFG_SCAN_11D_INTERVAL_DEFAULT   (3600000)
 #define CFG_SCAN_11D_INTERVAL_MIN       (1000)
 #define CFG_SCAN_11D_INTERVAL_MAX       (36000000)
+/*
+ * <ini>
+ * is_bssid_hint_priority - Set priority for connection with bssid_hint
+ * BSSID.
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * This ini is used to give priority to BSS for connection which comes
+ * as part of bssid_hint
+ *
+ * Related: None
+ *
+ * Supported Feature: STA
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_IS_BSSID_HINT_PRIORITY_NAME    "is_bssid_hint_priority"
+#define CFG_IS_BSSID_HINT_PRIORITY_DEFAULT (1)
+#define CFG_IS_BSSID_HINT_PRIORITY_MIN     (0)
+#define CFG_IS_BSSID_HINT_PRIORITY_MAX     (1)
 
 /*
  * <ini>
@@ -12986,6 +13010,7 @@ struct hdd_config {
 	bool is_ndi_mac_randomized;
 	uint32_t scan_11d_interval;
 	bool chan_switch_hostapd_rate_enabled;
+	bool is_bssid_hint_priority;
 	/* mbo related thresholds */
 	int8_t mbo_candidate_rssi_thres;
 	int8_t mbo_current_rssi_thres;

+ 10 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -4877,6 +4877,13 @@ struct reg_table_entry g_registry_table[] = {
 		CFG_CHAN_SWITCH_HOSTAPD_RATE_ENABLED_MIN,
 		CFG_CHAN_SWITCH_HOSTAPD_RATE_ENABLED_MAX),
 
+	REG_VARIABLE(CFG_IS_BSSID_HINT_PRIORITY_NAME, WLAN_PARAM_Integer,
+		struct hdd_config, is_bssid_hint_priority,
+		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		CFG_IS_BSSID_HINT_PRIORITY_DEFAULT,
+		CFG_IS_BSSID_HINT_PRIORITY_MIN,
+		CFG_IS_BSSID_HINT_PRIORITY_MAX),
+
 	REG_VARIABLE(CFG_MBO_CANDIDATE_RSSI_THRESHOLD_NAME,
 		WLAN_PARAM_SignedInteger, struct hdd_config,
 		mbo_candidate_rssi_thres,
@@ -6580,6 +6587,9 @@ void hdd_cfg_print(struct hdd_context *hdd_ctx)
 	hdd_debug("Name = [%s] value = [%u]",
 		CFG_CHAN_SWITCH_HOSTAPD_RATE_ENABLED_NAME,
 		hdd_ctx->config->chan_switch_hostapd_rate_enabled);
+	hdd_debug("Name = [%s] value = [%u]",
+		CFG_IS_BSSID_HINT_PRIORITY_NAME,
+		hdd_ctx->config->is_bssid_hint_priority);
 }
 
 

+ 1 - 0
core/hdd/src/wlan_hdd_main.c

@@ -12025,6 +12025,7 @@ static int hdd_update_scan_config(struct hdd_context *hdd_ctx)
 	scan_cfg.rssi_cat_gap = cfg->nRssiCatGap;
 	scan_cfg.scan_dwell_time_mode = cfg->scan_adaptive_dwell_mode;
 	scan_cfg.is_snr_monitoring_enabled = cfg->fEnableSNRMonitoring;
+	scan_cfg.is_bssid_hint_priority = cfg->is_bssid_hint_priority;
 
 	hdd_update_pno_config(&scan_cfg.pno_cfg, cfg);
 	hdd_update_ie_whitelist_attr(&scan_cfg.ie_whitelist, cfg);

+ 30 - 0
core/sme/src/csr/csr_api_roam.c

@@ -8238,6 +8238,35 @@ static bool csr_is_fils_connection(tCsrRoamProfile *pProfile)
 }
 #endif
 
+/**
+ * csr_roam_print_candidate_aps() - print all candidate AP in sorted
+ * score.
+ * @results: scan result
+ *
+ * Return : void
+ */
+static void csr_roam_print_candidate_aps(tScanResultHandle results)
+{
+	tListElem *entry;
+	struct tag_csrscan_result *bss_desc = NULL;
+	struct scan_result_list *bss_list = NULL;
+
+	if (!results)
+		return;
+	bss_list = (struct scan_result_list *)results;
+	entry = csr_ll_peek_head(&bss_list->List, LL_ACCESS_NOLOCK);
+	while (entry) {
+		bss_desc = GET_BASE_ADDR(entry,
+				struct tag_csrscan_result, Link);
+		sme_debug("BSSID" MAC_ADDRESS_STR "score is %d",
+			  MAC_ADDR_ARRAY(bss_desc->Result.BssDescriptor.bssId),
+			  bss_desc->bss_score);
+
+		entry = csr_ll_next(&bss_list->List, entry,
+				LL_ACCESS_NOLOCK);
+	}
+}
+
 QDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId,
 		tCsrRoamProfile *pProfile,
 		uint32_t *pRoamId)
@@ -8354,6 +8383,7 @@ QDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId,
 	}
 	status = csr_scan_get_result(pMac, pScanFilter, &hBSSList);
 	sme_debug("csr_scan_get_result Status: %d", status);
+	csr_roam_print_candidate_aps(hBSSList);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
 		/* check if set hw mode needs to be done */
 		if ((pScanFilter->csrPersona == QDF_STA_MODE) ||

+ 5 - 2
core/sme/src/csr/csr_api_scan.c

@@ -5159,7 +5159,6 @@ static QDF_STATUS csr_prepare_scan_filter(tpAniSirGlobal mac_ctx,
 	uint32_t len = 0;
 	QDF_STATUS status;
 	enum policy_mgr_con_mode new_mode;
-	uint8_t weight_list[QDF_MAX_NUM_CHAN];
 
 	filter->num_of_bssid = pFilter->BSSIDs.numOfBSSIDs;
 	if (filter->num_of_bssid > WLAN_SCAN_FILTER_NUM_BSSID)
@@ -5250,10 +5249,13 @@ static QDF_STATUS csr_prepare_scan_filter(tpAniSirGlobal mac_ctx,
 		   &pFilter->csrPersona, &new_mode)) {
 			status = policy_mgr_get_pcl(mac_ctx->psoc, new_mode,
 				filter->pcl_channel_list, &len,
-				weight_list, QDF_ARRAY_SIZE(weight_list));
+				filter->pcl_weight_list, QDF_MAX_NUM_CHAN);
 			filter->num_of_pcl_channels = (uint8_t)len;
 		}
 	}
+	qdf_mem_copy(filter->bssid_hint.bytes,
+			pFilter->bssid_hint.bytes,
+			QDF_MAC_ADDR_SIZE);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -5343,6 +5345,7 @@ static QDF_STATUS csr_fill_bss_from_scan_entry(tpAniSirGlobal mac_ctx,
 		csr_covert_enc_type_old(scan_entry->neg_sec_info.mc_enc);
 	bss->authType =
 		csr_covert_auth_type_old(scan_entry->neg_sec_info.auth_type);
+	bss->bss_score = scan_entry->bss_score;
 
 	result_info = &bss->Result;
 	result_info->ssId.length = scan_entry->ssid.length;

+ 1 - 0
core/sme/src/csr/csr_inside_api.h

@@ -172,6 +172,7 @@ struct tag_csrscan_result {
 	eCsrEncryptionType mcEncryptionType;
 	/* Preferred auth type that matched with the profile. */
 	eCsrAuthType authType;
+	int  bss_score;
 
 	tCsrScanResultInfo Result;
 	/*