From cbc05e67fe10d8e3e08705fbde4fe44f4ce6a517 Mon Sep 17 00:00:00 2001 From: Amrit Date: Tue, 2 Aug 2022 22:33:48 +0530 Subject: [PATCH] qcacmn: Allocate memory according to num_users in rx path Allocating memory according to number of users in rx path Change-Id: I02ced1772ed04e67dfba5beb87737fcd874fd6da CRs-Fixed: 3264995 --- dp/inc/cdp_txrx_cmn_struct.h | 2 +- dp/wifi3.0/monitor/dp_rx_mon.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index 78c01b34b6..7cede84296 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -2458,7 +2458,6 @@ struct cdp_rx_indication_ppdu { struct cdp_rx_su_evm_info evm_info; uint32_t rx_antenna; uint8_t num_users; - struct cdp_rx_stats_ppdu_user user[CDP_MU_MAX_USERS]; uint32_t nf; uint8_t per_chain_rssi[MAX_CHAIN]; uint8_t is_mcast_bcast; @@ -2502,6 +2501,7 @@ struct cdp_rx_indication_ppdu { #endif uint8_t usr_nss_sum; uint32_t usr_ru_tones_sum; + struct cdp_rx_stats_ppdu_user user[]; }; /** diff --git a/dp/wifi3.0/monitor/dp_rx_mon.c b/dp/wifi3.0/monitor/dp_rx_mon.c index 6aa9bd942f..97f724baf5 100644 --- a/dp/wifi3.0/monitor/dp_rx_mon.c +++ b/dp/wifi3.0/monitor/dp_rx_mon.c @@ -1067,6 +1067,8 @@ dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, qdf_nbuf_t ppdu_nbuf; struct cdp_rx_indication_ppdu *cdp_rx_ppdu; struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev; + uint64_t size = 0; + uint8_t num_users = 0; /* * Do not allocate if fcs error, @@ -1123,14 +1125,17 @@ dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, QDF_STATUS_SUCCESS))) return; } - + num_users = ppdu_info->com_info.num_users; + qdf_assert_always(num_users <= CDP_MU_MAX_USERS); + size = sizeof(struct cdp_rx_indication_ppdu) + + num_users * sizeof(struct cdp_rx_stats_ppdu_user); ppdu_nbuf = qdf_nbuf_alloc(soc->osdev, - sizeof(struct cdp_rx_indication_ppdu), + size, 0, 0, FALSE); if (qdf_likely(ppdu_nbuf)) { cdp_rx_ppdu = (struct cdp_rx_indication_ppdu *)qdf_nbuf_data(ppdu_nbuf); - qdf_mem_zero(cdp_rx_ppdu, sizeof(struct cdp_rx_indication_ppdu)); + qdf_mem_zero(cdp_rx_ppdu, size); dp_rx_mon_populate_cfr_info(pdev, ppdu_info, cdp_rx_ppdu); dp_rx_populate_cdp_indication_ppdu(pdev, ppdu_info, cdp_rx_ppdu);