diff --git a/dp/inc/cdp_txrx_stats_struct.h b/dp/inc/cdp_txrx_stats_struct.h index 8aec2acba8..78ee970547 100644 --- a/dp/inc/cdp_txrx_stats_struct.h +++ b/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]; diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index b033e3416d..625049a61c 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -5898,6 +5898,31 @@ dp_txrx_host_stats_clr(struct dp_vdev *vdev) UPDATE_VDEV_STATS); } +/** + * 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_common_rates_info(struct cdp_pkt_type *pkt_type_array) +{ + uint8_t mcs, pkt_type; + + for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { + 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, + pkt_type_array[pkt_type].mcs_count[mcs]); + } + + DP_PRINT_STATS("\n"); + } +} + /** * dp_print_rx_rates(): Print Rx rate stats * @vdev: DP_VDEV handle @@ -5908,26 +5933,13 @@ static inline void dp_print_rx_rates(struct dp_vdev *vdev) { struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; - uint8_t i, mcs, pkt_type; + 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); - 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_PRINT_STATS("\n"); - } 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++) {