Browse Source

qcacld-3.0: Do not limit the number of scan results to 4 for Beacon Report

Currently the number of scan entries populated from the scan results
of RRM issued scan for beacon report is limited to 4 entries in
sme_rrm_send_scan_result API. This is inspite of the fact that the
API sme_rrm_send_beacon_report_xmit_ind can handle more than 4 results
and will do the fragmentation of 4 results per frame before sending
it to the RRM.

Remove the limit of 4 entries in sme_rrm_send_scan_result and send
all the valid scan result entries to RRM.

Change-Id: I32448616a9e5f19ee816d60db8fef6e6c2f8908b
CRs-Fixed: 2321077
Vignesh Viswanathan 6 years ago
parent
commit
1824d50480
1 changed files with 28 additions and 6 deletions
  1. 28 6
      core/sme/src/rrm/sme_rrm.c

+ 28 - 6
core/sme/src/rrm/sme_rrm.c

@@ -220,6 +220,8 @@ sme_rrm_send_beacon_report_xmit_ind(tpAniSirGlobal mac_ctx,
 			beacon_rep->numBssDesc++;
 			if (++i >= SIR_BCN_REPORT_MAX_BSS_DESC)
 				break;
+			if (i + j >= bss_count)
+				break;
 			cur_result =
 				result_arr[j + i];
 		}
@@ -357,6 +359,8 @@ static QDF_STATUS sme_ese_send_beacon_req_scan_results(
 			bcn_report->numBss++;
 			if (++j >= SIR_BCN_REPORT_MAX_BSS_DESC)
 				break;
+			if (j >= bss_count)
+				break;
 			cur_result = result_arr[j];
 		}
 
@@ -412,9 +416,10 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 	tCsrScanResultFilter filter;
 	tScanResultHandle result_handle;
 	tCsrScanResultInfo *scan_results, *next_result;
-	tCsrScanResultInfo *scanresults_arr[SIR_BCN_REPORT_MAX_BSS_DESC];
+	tCsrScanResultInfo **scanresults_arr = NULL;
+	struct scan_result_list *result_list;
 	QDF_STATUS status;
-	uint8_t counter = 0;
+	uint8_t num_scan_results, counter = 0;
 	tpRrmSMEContext rrm_ctx = &mac_ctx->rrm.rrmSmeContext;
 	uint32_t session_id;
 	struct csr_roam_info *roam_info;
@@ -422,8 +427,6 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 	struct csr_roam_session *session;
 
 	qdf_mem_zero(&filter, sizeof(filter));
-	qdf_mem_zero(scanresults_arr,
-			sizeof(next_result) * SIR_BCN_REPORT_MAX_BSS_DESC);
 	filter.BSSIDs.numOfBSSIDs = 1;
 	filter.BSSIDs.bssid = (struct qdf_mac_addr *)&rrm_ctx->bssId;
 
@@ -507,7 +510,23 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 			status = sme_rrm_send_beacon_report_xmit_ind(mac_ctx,
 						NULL, measurementdone, 0);
 	}
-	counter = 0;
+
+	result_list = (struct scan_result_list *)result_handle;
+	num_scan_results = csr_ll_count(&result_list->List);
+	if (!num_scan_results) {
+		sme_err("num_scan_results is %d", num_scan_results);
+		status = QDF_STATUS_E_FAILURE;
+		goto rrm_send_scan_results_done;
+	}
+
+	sme_debug("num_scan_results %d", num_scan_results);
+	scanresults_arr = qdf_mem_malloc(num_scan_results *
+					 sizeof(next_result));
+	if (!scanresults_arr) {
+		sme_err("Failed to allocate scanresults_arr");
+		status = QDF_STATUS_E_NOMEM;
+		goto rrm_send_scan_results_done;
+	}
 
 	roam_info = qdf_mem_malloc(sizeof(*roam_info));
 	if (NULL == roam_info) {
@@ -562,7 +581,7 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 			scanresults_arr[counter++] = scan_results;
 		}
 		scan_results = next_result;
-		if (counter >= SIR_BCN_REPORT_MAX_BSS_DESC)
+		if (counter >= num_scan_results)
 			break;
 	}
 	qdf_mem_free(roam_info);
@@ -592,7 +611,10 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 	}
 
 rrm_send_scan_results_done:
+	if (scanresults_arr)
+		qdf_mem_free(scanresults_arr);
 	sme_scan_result_purge(result_handle);
+
 	return status;
 }