diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index 2dd78c2012..e836b1b908 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -1395,13 +1395,8 @@ void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc, * * Return: void */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) static inline void cdp_ath_getstats(ol_txrx_soc_handle soc, - struct cdp_pdev *pdev, struct net_device_stats *stats) -#else -static inline void cdp_ath_getstats(ol_txrx_soc_handle soc, - struct cdp_pdev *pdev, struct rtnl_link_stats64 *stats) -#endif + struct cdp_pdev *pdev, struct cdp_dev_stats *stats) { if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats) soc->ops->cmn_drv_ops->txrx_ath_getstats(pdev, stats); diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index 42e05b7bb9..078a1ea5b4 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -968,6 +968,24 @@ struct cdp_tx_completion_ppdu { struct cdp_tx_completion_ppdu_user user[CDP_MU_MAX_USERS]; }; +/** + * struct cdp_dev_stats - Network device stats structure + * @tx_packets: Tx total packets transmitted + * @tx_bytes : Tx total bytes transmitted + * @tx_errors : Tx error due to FW tx failure, Ring failure DMA etc + * @tx_dropped: Tx dropped is same as tx errors as above + * @rx_packets: Rx total packets transmitted + * @rx_bytes : Rx total bytes transmitted + */ +struct cdp_dev_stats { + uint32_t tx_packets; + uint32_t tx_bytes; + uint32_t tx_errors; + uint32_t tx_dropped; + uint32_t rx_packets; + uint32_t rx_bytes; +}; + /** * struct cdp_rate_stats - Tx/Rx Rate statistics * @bw: Indicates the BW of the upcoming transmission - diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index ff0c77c703..e3446524c6 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -138,11 +138,7 @@ struct cdp_cmn_ops { void (*txrx_vdev_tx_unlock)(struct cdp_vdev *vdev); void (*txrx_ath_getstats)(struct cdp_pdev *pdev, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - struct rtnl_link_stats64 *stats); -#else - struct net_device_stats *stats); -#endif + struct cdp_dev_stats *stats); void (*txrx_set_gid_flag)(struct cdp_pdev *pdev, u_int8_t *mem_status, u_int8_t *user_position); diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 43a15131f0..a21bdfd2ad 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -4743,6 +4743,33 @@ static inline void dp_aggregate_pdev_stats(struct dp_pdev *pdev) } +/** + * dp_pdev_getstats() - get pdev packet level stats + * @pdev_handle: Datapath PDEV handle + * @stats: cdp network device stats structure + * + * Return: void + */ +static void dp_pdev_getstats(struct cdp_pdev *pdev_handle, + struct cdp_dev_stats *stats) +{ + struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; + + dp_aggregate_pdev_stats(pdev); + + stats->tx_packets = pdev->stats.tx_i.rcvd.num; + stats->tx_bytes = pdev->stats.tx_i.rcvd.bytes; + + stats->tx_errors = pdev->stats.tx.tx_failed + + pdev->stats.tx_i.dropped.dropped_pkt.num; + stats->tx_dropped = stats->tx_errors; + + stats->rx_packets = pdev->stats.rx.unicast.num + + pdev->stats.rx.multicast.num; + stats->rx_bytes = pdev->stats.rx.unicast.bytes + + pdev->stats.rx.multicast.bytes; +} + /** * dp_print_pdev_tx_stats(): Print Pdev level TX stats * @pdev: DP_PDEV Handle @@ -4952,8 +4979,6 @@ dp_print_soc_tx_stats(struct dp_soc *soc) soc->stats.tx.tcl_ring_full[2]); } - - /** * dp_print_soc_rx_stats: Print SOC level Rx stats * @soc: DP_SOC Handle @@ -6617,6 +6642,7 @@ static struct cdp_cmn_ops dp_ops_cmn = { .txrx_get_vdev_mac_addr = dp_get_vdev_mac_addr_wifi3, .txrx_get_vdev_from_vdev_id = dp_get_vdev_from_vdev_id_wifi3, .txrx_get_ctrl_pdev_from_vdev = dp_get_ctrl_pdev_from_vdev_wifi3, + .txrx_ath_getstats = dp_pdev_getstats, .addba_requestprocess = dp_addba_requestprocess_wifi3, .addba_responsesetup = dp_addba_responsesetup_wifi3, .delba_process = dp_delba_process_wifi3,