Просмотр исходного кода

qcacmn: Delete duplicated rate info code in statistics printing

Using common function to replace the duplicated rate info code in
statistics of data path for TX, RX and peer info printing.

Change-Id: I80d296001b95d7a5ff11d7ce538e16f86e7e67e8
CRs-Fixed: 2291395
chenguo 6 лет назад
Родитель
Сommit
4d877b8ea5
2 измененных файлов с 38 добавлено и 66 удалено
  1. 9 7
      dp/inc/cdp_txrx_stats_struct.h
  2. 29 59
      dp/wifi3.0/dp_main.c

+ 9 - 7
dp/inc/cdp_txrx_stats_struct.h

@@ -87,6 +87,13 @@ struct cdp_pkt_info {
 	uint64_t bytes;
 };
 
+/* struct cdp_pkt_type - packet type
+ * @mcs_count: Counter array for each MCS index
+ */
+struct cdp_pkt_type {
+	uint32_t mcs_count[MAX_MCS];
+};
+
 /* struct cdp_tx_stats - tx stats
  * @cdp_pkt_info comp_pkt: Pkt Info for which completions were received
  * @cdp_pkt_info ucast: Unicast Packet Count
@@ -178,10 +185,7 @@ struct cdp_tx_stats {
 	uint32_t tx_data_success_last;
 	uint32_t tx_byte_rate;
 	uint32_t tx_data_rate;
-	struct {
-		uint32_t mcs_count[MAX_MCS];
-	} pkt_type[DOT11_MAX];
-
+	struct cdp_pkt_type pkt_type[DOT11_MAX];
 	uint32_t sgi_count[MAX_GI];
 
 	uint32_t nss[SS_COUNT];
@@ -296,9 +300,7 @@ struct cdp_rx_stats {
 
 	uint32_t wme_ac_type[WME_AC_MAX];
 	uint32_t reception_type[MAX_RECEPTION_TYPES];
-	struct {
-		uint32_t mcs_count[MAX_MCS];
-	} pkt_type[DOT11_MAX];
+	struct cdp_pkt_type pkt_type[DOT11_MAX];
 	uint32_t sgi_count[MAX_GI];
 	uint32_t nss[SS_COUNT];
 	uint32_t bw[MAX_BW];

+ 29 - 59
dp/wifi3.0/dp_main.c

@@ -5899,35 +5899,47 @@ dp_txrx_host_stats_clr(struct dp_vdev *vdev)
 }
 
 /**
- * dp_print_rx_rates(): Print Rx rate stats
- * @vdev: DP_VDEV handle
+ * dp_print_common_rates_info(): Print common rate for tx or rx
+ * @pkt_type_array: rate type array contains rate info
  *
  * Return:void
  */
 static inline void
-dp_print_rx_rates(struct dp_vdev *vdev)
+dp_print_common_rates_info(struct cdp_pkt_type *pkt_type_array)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev;
-	uint8_t i, mcs, pkt_type;
-	uint8_t index = 0;
-	char nss[DP_NSS_LENGTH];
-
-	DP_PRINT_STATS("Rx Rate Info:\n");
+	uint8_t mcs, pkt_type;
 
 	for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) {
-		index = 0;
 		for (mcs = 0; mcs < MAX_MCS; mcs++) {
 			if (!dp_rate_string[pkt_type][mcs].valid)
 				continue;
 
 			DP_PRINT_STATS("	%s = %d",
-					dp_rate_string[pkt_type][mcs].mcs_type,
-					pdev->stats.rx.pkt_type[pkt_type].
-					mcs_count[mcs]);
+				       dp_rate_string[pkt_type][mcs].mcs_type,
+				       pkt_type_array[pkt_type].mcs_count[mcs]);
 		}
 
 		DP_PRINT_STATS("\n");
 	}
+}
+
+/**
+ * dp_print_rx_rates(): Print Rx rate stats
+ * @vdev: DP_VDEV handle
+ *
+ * Return:void
+ */
+static inline void
+dp_print_rx_rates(struct dp_vdev *vdev)
+{
+	struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev;
+	uint8_t i;
+	uint8_t index = 0;
+	char nss[DP_NSS_LENGTH];
+
+	DP_PRINT_STATS("Rx Rate Info:\n");
+	dp_print_common_rates_info(pdev->stats.rx.pkt_type);
+
 
 	index = 0;
 	for (i = 0; i < SS_COUNT; i++) {
@@ -5979,27 +5991,12 @@ static inline void
 dp_print_tx_rates(struct dp_vdev *vdev)
 {
 	struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev;
-	uint8_t mcs, pkt_type;
 	uint8_t index;
 	char nss[DP_NSS_LENGTH];
 	int nss_index;
 
 	DP_PRINT_STATS("Tx Rate Info:\n");
-
-	for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) {
-		index = 0;
-		for (mcs = 0; mcs < MAX_MCS; mcs++) {
-			if (!dp_rate_string[pkt_type][mcs].valid)
-				continue;
-
-			DP_PRINT_STATS("	%s = %d",
-					dp_rate_string[pkt_type][mcs].mcs_type,
-					pdev->stats.tx.pkt_type[pkt_type].
-					mcs_count[mcs]);
-		}
-
-		DP_PRINT_STATS("\n");
-	}
+	dp_print_common_rates_info(pdev->stats.tx.pkt_type);
 
 	DP_PRINT_STATS("SGI ="
 			" 0.8us %d"
@@ -6043,7 +6040,7 @@ dp_print_tx_rates(struct dp_vdev *vdev)
  */
 static inline void dp_print_peer_stats(struct dp_peer *peer)
 {
-	uint8_t i, mcs, pkt_type;
+	uint8_t i;
 	uint32_t index;
 	char nss[DP_NSS_LENGTH];
 	DP_PRINT_STATS("Node Tx Stats:\n");
@@ -6098,21 +6095,8 @@ static inline void dp_print_peer_stats(struct dp_peer *peer)
 			peer->stats.tx.nawds_mcast.bytes);
 
 	DP_PRINT_STATS("Rate Info:");
+	dp_print_common_rates_info(peer->stats.tx.pkt_type);
 
-	for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) {
-		index = 0;
-		for (mcs = 0; mcs < MAX_MCS; mcs++) {
-			if (!dp_rate_string[pkt_type][mcs].valid)
-				continue;
-
-			DP_PRINT_STATS("	%s = %d",
-					dp_rate_string[pkt_type][mcs].mcs_type,
-					peer->stats.tx.pkt_type[pkt_type].
-					mcs_count[mcs]);
-		}
-
-		DP_PRINT_STATS("\n");
-	}
 
 	DP_PRINT_STATS("SGI = "
 			" 0.8us %d"
@@ -6215,21 +6199,7 @@ static inline void dp_print_peer_stats(struct dp_peer *peer)
 			peer->stats.rx.reception_type[2],
 			peer->stats.rx.reception_type[3]);
 
-
-	for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) {
-		index = 0;
-		for (mcs = 0; mcs < MAX_MCS; mcs++) {
-			if (!dp_rate_string[pkt_type][mcs].valid)
-				continue;
-
-			DP_PRINT_STATS("	%s = %d",
-					dp_rate_string[pkt_type][mcs].mcs_type,
-					peer->stats.rx.pkt_type[pkt_type].
-					mcs_count[mcs]);
-		}
-
-		DP_PRINT_STATS("\n");
-	}
+	dp_print_common_rates_info(peer->stats.rx.pkt_type);
 
 	index = 0;
 	for (i = 0; i < SS_COUNT; i++) {