Explorar o código

qcacmn: Fix partner link updation

Fix partner link updation in scan entry when AP MLD has more than one
partner link.

Change-Id: I981f16c9de819390d6830ffe7a5b1e438a4f8403
CRs-Fixed: 3125861
Venkateswara Swamy Bandaru %!s(int64=3) %!d(string=hai) anos
pai
achega
fb75228fd8

+ 4 - 0
umac/scan/dispatcher/inc/wlan_scan_public_structs.h

@@ -419,6 +419,7 @@ struct rnr_mld_info {
  * @short_ssid: short ssid
  * @bss_params: BSS parameters
  * @psd_20mhz: 20MHz power spectral density
+ * @mld_info_valid: valid MLD info
  * @mld_info: MLD information
  */
 struct rnr_bss_info {
@@ -430,6 +431,7 @@ struct rnr_bss_info {
 	uint8_t bss_params;
 	uint8_t psd_20mhz;
 #ifdef WLAN_FEATURE_11BE_MLO
+	bool mld_info_valid;
 	struct rnr_mld_info mld_info;
 #endif
 };
@@ -499,9 +501,11 @@ enum tbtt_information_field {
 
 /**
  * struct reduced_neighbor_report - Reduced Neighbor Report
+ * @count: number of RNR info
  * @bss_info: RNR BSS Information
  */
 struct reduced_neighbor_report {
+	uint8_t count;
 	struct rnr_bss_info bss_info[MAX_RNR_BSS];
 };
 

+ 2 - 3
umac/scan/dispatcher/inc/wlan_scan_utils_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -765,8 +765,7 @@ util_scan_get_ml_partner_info(struct scan_cache_entry *scan_entry,
 		return QDF_STATUS_E_FAILURE;
 
 	partner_info->num_partner_links =
-			qdf_min((uint8_t)WLAN_UMAC_MLO_MAX_VDEVS - 1,
-				scan_entry->ml_info.num_links - 1);
+				scan_entry->ml_info.num_links;
 	/* TODO: Make sure that scan_entry->ml_info->link_info is a sorted
 	 * list */
 	for (i = 0; i < partner_info->num_partner_links; i++) {

+ 27 - 9
umac/scan/dispatcher/src/wlan_scan_utils_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -781,6 +781,8 @@ util_scan_update_rnr_mld(struct rnr_bss_info *rnr,
 		mld_info_present = true;
 		break;
 	};
+
+	rnr->mld_info_valid = mld_info_present;
 }
 #else
 static void
@@ -879,7 +881,7 @@ util_scan_parse_rnr_ie(struct scan_cache_entry *scan_entry,
 		       struct ie_header *ie)
 {
 	uint32_t rnr_ie_len;
-	uint16_t tbtt_count, tbtt_length, i, fieldtype;
+	uint16_t tbtt_count, tbtt_length, i, fieldtype, idx = 0;
 	uint8_t *data;
 	struct neighbor_ap_info_field *neighbor_ap_info;
 
@@ -903,15 +905,17 @@ util_scan_parse_rnr_ie(struct scan_cache_entry *scan_entry,
 
 		for (i = 0; i < (tbtt_count + 1) &&
 		     data < ((uint8_t *)ie + rnr_ie_len + 2); i++) {
-			if (i < MAX_RNR_BSS)
+			if (i < MAX_RNR_BSS || idx < MAX_RNR_BSS)
 				util_scan_update_rnr(
-					&scan_entry->rnr.bss_info[i],
+					&scan_entry->rnr.bss_info[idx++],
 					neighbor_ap_info,
 					data);
 			data += tbtt_length;
 		}
 	}
 
+	scan_entry->rnr.count = idx;
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -1859,14 +1863,28 @@ static void util_get_partner_link_info(struct scan_cache_entry *scan_entry)
 	uint8_t perstaprof_len = 0;
 	struct partner_link_info *link_info = NULL;
 	uint8_t eid = 0;
+	uint8_t link_idx = 0;
+	uint8_t rnr_idx = 0;
+	struct rnr_bss_info *rnr = NULL;
 
 	/* Update partner info  from RNR IE */
-	qdf_mem_copy(&scan_entry->ml_info.link_info[0].link_addr,
-		     &scan_entry->rnr.bss_info[0].bssid, 6);
+	while ((rnr_idx < MAX_RNR_BSS) && (rnr_idx < scan_entry->rnr.count)) {
+		if (link_idx >= (MLD_MAX_LINKS - 1))
+			break;
+		rnr = &scan_entry->rnr.bss_info[rnr_idx];
+		if (rnr->mld_info_valid && !rnr->mld_info.mld_id) {
+			link_info = &scan_entry->ml_info.link_info[link_idx];
+			qdf_mem_copy(&link_info->link_addr,
+				     &rnr->bssid, QDF_MAC_ADDR_SIZE);
 
-	scan_entry->ml_info.link_info[0].link_id =
-				scan_entry->rnr.bss_info[0].mld_info.link_id;
+			link_info->link_id = rnr->mld_info.link_id;
+
+			link_idx++;
+		}
+		rnr_idx++;
+	}
 
+	scan_entry->ml_info.num_links = link_idx;
 	if (!offset)
 		return;
 
@@ -1935,7 +1953,7 @@ static void util_scan_update_ml_info(struct scan_cache_entry *scan_entry)
 	}
 
 	/* TODO: Decode it from ML IE */
-	scan_entry->ml_info.num_links = 2;
+	scan_entry->ml_info.num_links = 0;
 
 	/**
 	 * Copy Link ID & MAC address of the scan cache entry as first entry