From d5e8fb116ee3b71fe90ac43c10dd00686fe73a11 Mon Sep 17 00:00:00 2001 From: Amruta Kulkarni Date: Wed, 28 Oct 2020 14:13:03 -0700 Subject: [PATCH] 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 --- core/mac/inc/sir_api.h | 3 +++ core/mac/inc/sir_mac_prot_def.h | 1 - core/mac/src/cfg/cfgUtil/dot11f.frms | 2 +- core/mac/src/include/dot11f.h | 4 ++-- .../src/pe/lim/lim_send_management_frames.c | 12 ++++++------ core/mac/src/pe/rrm/rrm_api.c | 18 +++++++++++++++--- core/wma/inc/wma.h | 2 -- core/wma/src/wma_mgmt.c | 4 ++-- 8 files changed, 29 insertions(+), 17 deletions(-) diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 102b746f6e54..36343584a3f3 100644 --- a/core/mac/inc/sir_api.h +++ b/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; /** diff --git a/core/mac/inc/sir_mac_prot_def.h b/core/mac/inc/sir_mac_prot_def.h index 7a884cfcfd63..b070ba43b327 100644 --- a/core/mac/inc/sir_mac_prot_def.h +++ b/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; diff --git a/core/mac/src/cfg/cfgUtil/dot11f.frms b/core/mac/src/cfg/cfgUtil/dot11f.frms index 92e7f37e4845..e6f562074629 100644 --- a/core/mac/src/cfg/cfgUtil/dot11f.frms +++ b/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 diff --git a/core/mac/src/include/dot11f.h b/core/mac/src/include/dot11f.h index bb66262a4e4b..18b5b8a2ca9d 100644 --- a/core/mac/src/include/dot11f.h +++ b/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) diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index 2045b7e2970f..83685ed0153d 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/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; diff --git a/core/mac/src/pe/rrm/rrm_api.c b/core/mac/src/pe/rrm/rrm_api.c index 8f0aebfce117..2367fd00c47d 100644 --- a/core/mac/src/pe/rrm/rrm_api.c +++ b/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; diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index ad41c11a2061..606c95f645df 100644 --- a/core/wma/inc/wma.h +++ b/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 diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index 09a3bba207c1..4dbda06cc4ca 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -3163,7 +3163,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); @@ -3435,7 +3435,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));