Parcourir la source

qcacmn: Add band bitmap filter for mlo ap candidate

Get mlo partner link freq from RNR IE.

Use band bitmap to filter mlo AP by band.
Force link on 2 GHz: mlo_support_link_band=1
Force link on 5 GHz: mlo_support_link_band=2
Force link on 6 GHz: mlo_support_link_band=4

Change-Id: Ib11dee117bef6121bbc455b62a2803138881a72a
CRs-Fixed: 3211974
Jianmin Zhu il y a 3 ans
Parent
commit
3061409081

+ 22 - 0
umac/mlme/connection_mgr/core/src/wlan_cm_connect.c

@@ -1195,6 +1195,26 @@ static QDF_STATUS cm_is_scan_support(struct cm_connect_req *cm_req)
 }
 #endif
 
+#if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_FEATURE_11BE_MLO_ADV_FEATURE)
+static QDF_STATUS cm_update_mlo_filter(struct wlan_objmgr_pdev *pdev,
+				       struct scan_filter *filter)
+{
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	filter->band_bitmap = wlan_mlme_get_sta_mlo_conn_band_bmp(psoc);
+	mlme_debug("band bitmap: %d", filter->band_bitmap);
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static QDF_STATUS cm_update_mlo_filter(struct wlan_objmgr_pdev *pdev,
+				       struct scan_filter *filter)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 static QDF_STATUS cm_connect_get_candidates(struct wlan_objmgr_pdev *pdev,
 					    struct cnx_mgr *cm_ctx,
 					    struct cm_connect_req *cm_req)
@@ -1235,6 +1255,8 @@ static QDF_STATUS cm_connect_get_candidates(struct wlan_objmgr_pdev *pdev,
 	cm_connect_prepare_scan_filter(pdev, cm_ctx, cm_req, filter,
 				       security_valid_for_6ghz);
 
+	cm_update_mlo_filter(pdev, filter);
+
 	candidate_list = wlan_scan_get_result(pdev, filter);
 	if (candidate_list) {
 		num_bss = qdf_list_size(candidate_list);

+ 50 - 0
umac/scan/core/src/wlan_scan_filter.c

@@ -26,6 +26,7 @@
 #include <wlan_dfs_utils_api.h>
 #include "wlan_crypto_global_def.h"
 #include "wlan_crypto_global_api.h"
+#include "wlan_reg_services_api.h"
 
 /**
  * scm_check_open() - Check if scan entry support open authmode
@@ -639,6 +640,48 @@ static bool scm_check_dot11mode(struct scan_cache_entry *db_entry,
 	return true;
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static bool util_mlo_filter_match(struct scan_filter *filter,
+				  struct scan_cache_entry *db_entry)
+{
+	uint8_t i;
+	enum reg_wifi_band band;
+	struct partner_link_info *partner_link;
+
+	if (!db_entry->ie_list.multi_link)
+		return true;
+
+	if (!filter->band_bitmap)
+		return true;
+
+	band = wlan_reg_freq_to_band(db_entry->channel.chan_freq);
+	if (!(filter->band_bitmap & BIT(band))) {
+		scm_debug("bss freq %d not match band bitmap: %d",
+			  db_entry->channel.chan_freq,
+			  filter->band_bitmap);
+		return false;
+	}
+	for (i = 0; i < db_entry->ml_info.num_links; i++) {
+		partner_link = &db_entry->ml_info.link_info[i];
+		band = wlan_reg_freq_to_band(partner_link->freq);
+		if (filter->band_bitmap & BIT(band)) {
+			scm_debug("partner freq %d  match band bitmap: %d",
+				  partner_link->freq,
+				  filter->band_bitmap);
+			partner_link->is_valid_link = true;
+		}
+	}
+
+	return true;
+}
+#else
+static bool util_mlo_filter_match(struct scan_filter *filter,
+				  struct scan_cache_entry *db_entry)
+{
+	return true;
+}
+#endif
+
 bool scm_filter_match(struct wlan_objmgr_psoc *psoc,
 		      struct scan_cache_entry *db_entry,
 		      struct scan_filter *filter,
@@ -815,5 +858,12 @@ bool scm_filter_match(struct wlan_objmgr_psoc *psoc,
 			  QDF_MAC_ADDR_REF(db_entry->bssid.bytes));
 		return false;
 	}
+
+	if (!util_mlo_filter_match(filter, db_entry)) {
+		scm_debug(QDF_MAC_ADDR_FMT ": Ignore as mlo filter didn't match",
+			  QDF_MAC_ADDR_REF(db_entry->bssid.bytes));
+		return false;
+	}
+
 	return true;
 }

+ 6 - 2
umac/scan/dispatcher/inc/wlan_scan_public_structs.h

@@ -527,6 +527,7 @@ struct reduced_neighbor_report {
  * @csa_ie: Pointer to CSA IE
  * @ecsa_ie: Pointer to eCSA IE
  * @max_cst_ie: Pointer to Max Channel Switch Time IE
+ * @is_valid_link: The partner link can be used if true
  */
 struct partner_link_info {
 	struct qdf_mac_addr link_addr;
@@ -536,6 +537,7 @@ struct partner_link_info {
 	const uint8_t *csa_ie;
 	const uint8_t *ecsa_ie;
 	const uint8_t *max_cst_ie;
+	uint8_t  is_valid_link;
 };
 
 /**
@@ -716,7 +718,6 @@ enum dot11_mode_filter {
  * @bss_type: bss type IBSS or BSS or ANY
  * @pmf_cap: Pmf capability
  * @dot11mode: Filter APs based upon dot11mode
- * @band: to get specific band 2.4G, 5G or 4.9 G
  * @rssi_threshold: AP having RSSI greater than
  *                  rssi threasholed (ignored if set 0)
  * @mobility_domain: Mobility domain for 11r
@@ -734,6 +735,7 @@ enum dot11_mode_filter {
  * @match_security_func_arg: Function argument to custom security filter
  * @ccx_validate_bss: Function pointer to custom bssid filter
  * @ccx_validate_bss_arg: Function argument to custom bssid filter
+ * @band_bitmap: Allowed band bit map, BIT0: 2G, BIT1: 5G, BIT2: 6G
  */
 struct scan_filter {
 	uint8_t enable_adaptive_11r:1,
@@ -749,7 +751,6 @@ struct scan_filter {
 	enum wlan_bss_type bss_type;
 	enum wlan_pmf_cap pmf_cap;
 	enum dot11_mode_filter dot11mode;
-	enum wlan_band band;
 	uint8_t rssi_threshold;
 	uint32_t mobility_domain;
 	uint32_t authmodeset;
@@ -769,6 +770,9 @@ struct scan_filter {
 	bss_filter_arg_t match_security_func_arg;
 	bool (*ccx_validate_bss)(void *, struct scan_cache_entry *, int);
 	bss_filter_arg_t ccx_validate_bss_arg;
+#ifdef WLAN_FEATURE_11BE_MLO
+	uint32_t band_bitmap;
+#endif
 };
 
 /**

+ 4 - 1
umac/scan/dispatcher/src/wlan_scan_utils_api.c

@@ -1914,7 +1914,10 @@ static void util_get_partner_link_info(struct scan_cache_entry *scan_entry)
 				     &rnr->bssid, QDF_MAC_ADDR_SIZE);
 
 			link_info->link_id = rnr->mld_info.link_id;
-
+			link_info->freq =
+				wlan_reg_chan_opclass_to_freq(rnr->channel_number,
+							      rnr->operating_class,
+							      true);
 			link_idx++;
 		}
 		rnr_idx++;