瀏覽代碼

qcacmn: Add new INI param for BSSID filter

Currently, driver only sorts the BSSID according to scoring algo.
But some customer need to prioritize the BSSID HINT and filter out
BSSID (except BSSID HINT) which have RSSI value lower than value
defined in INI parameter.
For this, add new INI parameter to configure RSSI value
and check this RSSI value for all BSSID expect BSSID HINT.

Change-Id: Ib942f32878b35cbdb20ba669808f4a5c8820ebd7
CRs-Fixed: 3378781
Rahul Gusain 2 年之前
父節點
當前提交
e140e6779e

+ 54 - 2
umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c

@@ -2241,6 +2241,51 @@ static void cm_list_insert_sorted(qdf_list_t *scan_list,
 		qdf_list_insert_back(scan_list, &scan_entry->node);
 }
 
+#ifdef CONN_MGR_ADV_FEATURE
+/**
+ * cm_is_bad_rssi_entry() - check the entry have rssi value, if rssi is lower
+ * than threshold limit, then it is considered ad bad rssi value.
+ * @scan_entry: pointer to scan cache entry
+ * @score_config: pointer to score config structure
+ * @bssid_hint: bssid hint
+ *
+ * Return: true if rssi is lower than threshold
+ */
+static
+bool cm_is_bad_rssi_entry(struct scan_cache_entry *scan_entry,
+			  struct scoring_cfg *score_config,
+			  struct qdf_mac_addr *bssid_hint)
+{
+	int8_t rssi_threshold =
+		score_config->rssi_score.con_non_hint_target_rssi_threshold;
+
+	 /* do not need to consider BSSID hint if it is invalid entry(zero) */
+	if (qdf_is_macaddr_zero(bssid_hint))
+		return false;
+
+	if (score_config->is_bssid_hint_priority &&
+	    !qdf_is_macaddr_equal(bssid_hint, &scan_entry->bssid) &&
+	    scan_entry->rssi_raw < rssi_threshold) {
+		mlme_nofl_debug("Candidate(  " QDF_MAC_ADDR_FMT "  freq %d): remove entry, rssi %d lower than rssi_threshold %d",
+				QDF_MAC_ADDR_REF(scan_entry->bssid.bytes),
+				scan_entry->channel.chan_freq,
+				scan_entry->rssi_raw, rssi_threshold);
+		return true;
+	}
+
+	return false;
+}
+#else
+static inline
+bool cm_is_bad_rssi_entry(struct scan_cache_entry *scan_entry,
+			  struct scoring_cfg *score_config,
+			  struct qdf_mac_addr *bssid_hint)
+
+{
+	return false;
+}
+#endif
+
 void wlan_cm_calculate_bss_score(struct wlan_objmgr_pdev *pdev,
 				 struct pcl_freq_weight_list *pcl_lst,
 				 qdf_list_t *scan_list,
@@ -2258,6 +2303,7 @@ void wlan_cm_calculate_bss_score(struct wlan_objmgr_pdev *pdev,
 	bool assoc_allowed;
 	struct scan_cache_node *force_connect_candidate = NULL;
 	bool are_all_candidate_denylisted = true;
+	bool is_rssi_bad = false;
 
 	psoc = wlan_pdev_get_psoc(pdev);
 
@@ -2296,10 +2342,13 @@ void wlan_cm_calculate_bss_score(struct wlan_objmgr_pdev *pdev,
 		scan_entry = qdf_container_of(cur_node, struct scan_cache_node,
 					      node);
 
+		is_rssi_bad = cm_is_bad_rssi_entry(scan_entry->entry,
+						   score_config, bssid_hint);
+
 		assoc_allowed = cm_is_assoc_allowed(mlme_psoc_obj,
 						    scan_entry->entry);
 
-		if (assoc_allowed)
+		if (assoc_allowed && !is_rssi_bad)
 			denylist_action = wlan_denylist_action_on_bssid(pdev,
 							scan_entry->entry);
 		else
@@ -2386,7 +2435,7 @@ void wlan_cm_calculate_bss_score(struct wlan_objmgr_pdev *pdev,
 		 */
 		if (denylist_action == CM_DLM_REMOVE ||
 		    denylist_action == CM_DLM_FORCE_REMOVE) {
-			if (assoc_allowed)
+			if (assoc_allowed && !is_rssi_bad)
 				mlme_nofl_debug("Candidate( " QDF_MAC_ADDR_FMT " freq %d): rssi %d, dlm action %d is in Denylist, remove entry",
 					QDF_MAC_ADDR_REF(scan_entry->entry->bssid.bytes),
 					scan_entry->entry->channel.chan_freq,
@@ -2907,6 +2956,9 @@ void wlan_cm_init_score_config(struct wlan_objmgr_psoc *psoc,
 	score_cfg->rssi_score.rssi_pref_5g_rssi_thresh =
 		cfg_get(psoc, CFG_SCORING_RSSI_PREF_5G_THRESHOLD);
 
+	score_cfg->rssi_score.con_non_hint_target_rssi_threshold =
+		cfg_get(psoc, CFG_CON_NON_HINT_TARGET_MIN_RSSI);
+
 	score_cfg->esp_qbss_scoring.num_slot =
 		cfg_get(psoc, CFG_SCORING_NUM_ESP_QBSS_SLOTS);
 	score_cfg->esp_qbss_scoring.score_pcnt3_to_0 =

+ 26 - 1
umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_score_params.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -633,6 +633,30 @@
 	CFG_VALUE_OR_DEFAULT, \
 	"RSSI Pref 5G Threshold")
 
+/*
+ * <ini>
+ * ConNonHint_TargetMinRSSI - min RSSI value for connection.
+ * @Min: -95
+ * @Max: -40
+ * @Default: -75
+ *
+ * This ini sets threshold for RSSI, below which BSSID is not considered for
+ * connection.
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_CON_NON_HINT_TARGET_MIN_RSSI CFG_INI_UINT(\
+			"ConNonHint_TargetMinRSSI",\
+			-95, \
+			-40,\
+			-75, \
+			CFG_VALUE_OR_DEFAULT, \
+			"Threshold RSSI value for connection")
+
 #ifdef WLAN_FEATURE_11BE
 /*
  * <ini>
@@ -1904,6 +1928,7 @@
 	CFG(CFG_SCORING_GOOD_RSSI_BUCKET_SIZE) \
 	CFG(CFG_SCORING_BAD_RSSI_BUCKET_SIZE) \
 	CFG(CFG_SCORING_RSSI_PREF_5G_THRESHOLD) \
+	CFG(CFG_CON_NON_HINT_TARGET_MIN_RSSI) \
 	CFG(CFG_SCORING_BW_WEIGHT_PER_IDX) \
 	CFG(CFG_SCORING_NSS_WEIGHT_PER_IDX) \
 	CFG(CFG_SCORING_BAND_WEIGHT_PER_IDX) \

+ 2 - 0
umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_bss_score_param.h

@@ -94,6 +94,7 @@ struct weight_cfg {
  * @good_rssi_bucket_size: Channel band weightage
  * @bad_rssi_bucket_size: NSS weightage
  * @rssi_pref_5g_rssi_thresh: Beamforming caps weightage
+ * @con_non_hint_target_rssi_threshold: RSSI threshold value
  */
 struct rssi_config_score  {
 	uint8_t best_rssi_threshold;
@@ -104,6 +105,7 @@ struct rssi_config_score  {
 	uint8_t good_rssi_bucket_size;
 	uint8_t bad_rssi_bucket_size;
 	uint8_t rssi_pref_5g_rssi_thresh;
+	int8_t con_non_hint_target_rssi_threshold;
 };
 
 /**