Przeglądaj źródła

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
Amrit 2 lat temu
rodzic
commit
cbc05e67fe
2 zmienionych plików z 9 dodań i 4 usunięć
  1. 1 1
      dp/inc/cdp_txrx_cmn_struct.h
  2. 8 3
      dp/wifi3.0/monitor/dp_rx_mon.c

+ 1 - 1
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[];
 };
 
 /**

+ 8 - 3
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);