Browse Source

qcacld-3.0: Change RRM Beacon Reporting logic

Previous logic:
While reporting beacon reports a maxmium of
7 Dot11fIEMeasurementReports are sent in one
mgmt frame.

New logic:
Calculate the max number of frames that can fit
in one mgmt frame and add them to the report.

Change-Id: Ic413c94ea1f012a647dfd7cd21b13bc123ebfd97
CRs-Fixed: 2809395
Amruta Kulkarni 4 years ago
parent
commit
4aa99209f9

+ 3 - 0
core/mac/inc/sir_api.h

@@ -142,6 +142,9 @@ typedef uint8_t tSirVersionString[SIR_VERSION_STRING_LEN];
 
 #endif
 
+/* Maximum management packet data unit length */
+#define MAX_MGMT_MPDU_LEN 2304
+
 struct scheduler_msg;
 
 /**

+ 0 - 1
core/mac/inc/sir_mac_prot_def.h

@@ -1368,7 +1368,6 @@ typedef struct sSirMacBeaconReport {
 
 } tSirMacBeaconReport, *tpSirMacBeaconReport;
 
-#define RADIO_REPORTS_MAX_IN_A_FRAME 7
 typedef struct sSirMacRadioMeasureReport {
 	uint8_t token;
 	uint8_t refused;

+ 1 - 1
core/mac/src/cfg/cfgUtil/dot11f.frms

@@ -4230,7 +4230,7 @@ FRAME RadioMeasurementReport
    FF   Action;
    FF   DialogToken;
    //Measurement Report elements.
-   MANDIE MeasurementReport[1..7];
+   MANDIE MeasurementReport[1];
 }
 
 FRAME LinkMeasurementRequest

+ 2 - 2
core/mac/src/include/dot11f.h

@@ -26,7 +26,7 @@
  *
  *
  * This file was automatically generated by 'framesc'
- * Fri Oct  9 22:48:44 2020 from the following file(s):
+ * Tue Oct 27 21:57:51 2020 from the following file(s):
  *
  * dot11f.frms
  *
@@ -10926,7 +10926,7 @@ typedef struct sDot11fRadioMeasurementReport{
 	tDot11fFfAction                   Action;
 	tDot11fFfDialogToken              DialogToken;
 	uint16_t                          num_MeasurementReport;
-	tDot11fIEMeasurementReport        MeasurementReport[7];
+	tDot11fIEMeasurementReport        MeasurementReport[1];
 } tDot11fRadioMeasurementReport;
 
 #define DOT11F_RADIOMEASUREMENTREPORT (24)

+ 6 - 6
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -4801,8 +4801,12 @@ lim_send_radio_measure_report_action_frame(struct mac_context *mac,
 	uint8_t smeSessionId = 0;
 	bool is_last_report = false;
 
+	/* Malloc size of (tDot11fIEMeasurementReport) * (num_report - 1)
+	 * as memory for one Dot11fIEMeasurementReport is already calculated.
+	 */
 	tDot11fRadioMeasurementReport *frm =
-		qdf_mem_malloc(sizeof(tDot11fRadioMeasurementReport));
+		qdf_mem_malloc(sizeof(tDot11fRadioMeasurementReport) +
+		(sizeof(tDot11fIEMeasurementReport) * (num_report - 1)));
 	if (!frm)
 		return QDF_STATUS_E_NOMEM;
 
@@ -4814,15 +4818,11 @@ lim_send_radio_measure_report_action_frame(struct mac_context *mac,
 
 	smeSessionId = pe_session->smeSessionId;
 
-
 	frm->Category.category = ACTION_CATEGORY_RRM;
 	frm->Action.action = RRM_RADIO_MEASURE_RPT;
 	frm->DialogToken.token = dialog_token;
 
-	frm->num_MeasurementReport =
-		(num_report >
-		 RADIO_REPORTS_MAX_IN_A_FRAME) ? RADIO_REPORTS_MAX_IN_A_FRAME :
-		num_report;
+	frm->num_MeasurementReport = num_report;
 
 	for (i = 0; i < frm->num_MeasurementReport; i++) {
 		frm->MeasurementReport[i].type = pRRMReport[i].type;

+ 15 - 3
core/mac/src/pe/rrm/rrm_api.c

@@ -938,6 +938,9 @@ rrm_process_beacon_report_xmit(struct mac_context *mac_ctx,
 	uint16_t offset = 0;
 	uint8_t frag_id = 0;
 	uint8_t num_frames, num_reports_in_frame, final_measurement_index;
+	uint32_t populated_beacon_report_size = 0;
+	uint32_t max_reports_in_frame = 0;
+	uint32_t radio_meas_rpt_size = 0, dot11_meas_rpt_size = 0;
 	bool is_last_measurement_frame;
 
 
@@ -1113,13 +1116,22 @@ rrm_process_beacon_report_xmit(struct mac_context *mac_ctx,
 		pe_debug("TX: [802.11 BCN_RPT] Total reports filled %d, last bcn_rpt ind:%d",
 			 i , curr_req->request.Beacon.last_beacon_report_indication);
 
-		num_frames = i / RADIO_REPORTS_MAX_IN_A_FRAME;
-		if (i % RADIO_REPORTS_MAX_IN_A_FRAME)
+		/* Calculate size of populated beacon reports */
+		radio_meas_rpt_size =  sizeof(tSirMacRadioMeasureReport);
+		populated_beacon_report_size = (i * radio_meas_rpt_size);
+
+		/* Calculate num of mgmt frames to send */
+		num_frames = populated_beacon_report_size / MAX_MGMT_MPDU_LEN;
+		if (populated_beacon_report_size % MAX_MGMT_MPDU_LEN)
 			num_frames++;
 
+		/* Calculate num of maximum mgmt reports per frame */
+		dot11_meas_rpt_size = sizeof(tDot11fRadioMeasurementReport);
+		max_reports_in_frame = MAX_MGMT_MPDU_LEN / dot11_meas_rpt_size;
+
 		for (j = 0; j < num_frames; j++) {
 			num_reports_in_frame = QDF_MIN((i - report_index),
-						RADIO_REPORTS_MAX_IN_A_FRAME);
+						max_reports_in_frame);
 
 			final_measurement_index =
 				mac_ctx->rrm.rrmPEContext.num_active_request;

+ 0 - 2
core/wma/inc/wma.h

@@ -68,8 +68,6 @@
 #define WMA_MAC_TO_PDEV_MAP(x) ((x) + (1))
 #define WMA_PDEV_TO_MAC_MAP(x) ((x) - (1))
 
-#define WMA_MAX_MGMT_MPDU_LEN 2000
-
 #define MAX_PRINT_FAILURE_CNT 50
 
 #define WMA_INVALID_VDEV_ID                             0xFF

+ 2 - 2
core/wma/src/wma_mgmt.c

@@ -3162,7 +3162,7 @@ int wma_process_rmf_frame(tp_wma_handle wma_handle,
 			return -EINVAL;
 		}
 
-		if (rx_pkt->pkt_meta.mpdu_data_len > WMA_MAX_MGMT_MPDU_LEN) {
+		if (rx_pkt->pkt_meta.mpdu_data_len > MAX_MGMT_MPDU_LEN) {
 			wma_err("Data Len %d greater than max, dropping frame",
 				rx_pkt->pkt_meta.mpdu_data_len);
 			cds_pkt_return_packet(rx_pkt);
@@ -3434,7 +3434,7 @@ int wma_form_rx_packet(qdf_nbuf_t buf,
 	/*
 	 * If the mpdu_data_len is greater than Max (2k), drop the frame
 	 */
-	if (rx_pkt->pkt_meta.mpdu_data_len > WMA_MAX_MGMT_MPDU_LEN) {
+	if (rx_pkt->pkt_meta.mpdu_data_len > MAX_MGMT_MPDU_LEN) {
 		wma_err("Data Len %d greater than max, dropping frame from "QDF_MAC_ADDR_FMT,
 			 rx_pkt->pkt_meta.mpdu_data_len,
 			 QDF_MAC_ADDR_REF(wh->i_addr3));