diff --git a/dp/inc/cdp_txrx_host_stats.h b/dp/inc/cdp_txrx_host_stats.h index 2944527349d0..f4b7ad9533c5 100644 --- a/dp/inc/cdp_txrx_host_stats.h +++ b/dp/inc/cdp_txrx_host_stats.h @@ -404,6 +404,185 @@ static inline void cdp_get_dp_htt_stats(ol_txrx_soc_handle soc, return; } +/** + * @brief Update pdev host stats received from firmware + * (wmi_host_pdev_stats and wmi_host_pdev_ext_stats) into dp + * + * @param pdev - the physical device object + * @param data - pdev stats + * @return - void + */ +static inline void +cdp_update_pdev_host_stats(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, + void *data, + uint16_t stats_id) +{ + if (soc && soc->ops && soc->ops->host_stats_ops && + soc->ops->host_stats_ops->txrx_update_pdev_stats) + return soc->ops->host_stats_ops->txrx_update_pdev_stats + (pdev, data, stats_id); +} + +/** + * @brief Call to get peer stats + * + * @param peer - dp peer object + * @return - struct cdp_peer_stats + */ +static inline struct cdp_peer_stats * +cdp_host_get_peer_stats(ol_txrx_soc_handle soc, struct cdp_peer *peer) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return NULL; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_get_peer_stats) + return NULL; + + return soc->ops->host_stats_ops->txrx_get_peer_stats(peer); +} + +/** + * @brief Call to reset ald stats + * + * @param peer - dp peer object + * @return - void + */ +static inline void +cdp_host_reset_peer_ald_stats(ol_txrx_soc_handle soc, + struct cdp_peer *peer) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_reset_peer_ald_stats) + return; + + return soc->ops->host_stats_ops->txrx_reset_peer_ald_stats(peer); +} + +/** + * @brief Call to reset peer stats + * + * @param peer - dp peer object + * @return - void + */ +static inline void +cdp_host_reset_peer_stats(ol_txrx_soc_handle soc, + struct cdp_peer *peer) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_reset_peer_stats) + return; + + return soc->ops->host_stats_ops->txrx_reset_peer_stats(peer); +} + +/** + * @brief Call to get vdev stats + * + * @param vdev - dp vdev object + * @param buf - buffer + * @return - int + */ +static inline int +cdp_host_get_vdev_stats(ol_txrx_soc_handle soc, + struct cdp_vdev *vdev, + struct cdp_vdev_stats *buf, + bool is_aggregate) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_get_vdev_stats) + return 0; + + return soc->ops->host_stats_ops->txrx_get_vdev_stats(vdev, + buf, + is_aggregate); +} + +/** + * @brief Call to update vdev stats received from firmware + * (wmi_host_vdev_stats and wmi_host_vdev_extd_stats) into dp + * + * @param data - stats data to be updated + * @param size - size of stats data + * @param stats_id - stats id + * @return - int + */ +static inline int +cdp_update_host_vdev_stats(ol_txrx_soc_handle soc, + void *data, + uint32_t size, + uint32_t stats_id) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats) + return 0; + + return soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats + (soc, + data, + size, + stats_id); +} + +/** + * @brief Call to get vdev extd stats + * + * @param vdev - dp vdev object + * @param buf - buffer + * @return - int + */ +static inline int +cdp_get_vdev_extd_stats(ol_txrx_soc_handle soc, + struct cdp_vdev *vdev, + void *buf) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_get_vdev_extd_stats) + return 0; + + return soc->ops->host_stats_ops->txrx_get_vdev_extd_stats(vdev, buf); +} + /** * @brief Parse the stats header and get the payload from the message. * diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index d38015c2518d..3b7fb987a4c1 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -574,7 +574,7 @@ struct cdp_mon_ops { void (*txrx_monitor_set_filter_mcast_data) (struct cdp_pdev *, u_int8_t val); void (*txrx_monitor_set_filter_non_data) - (struct cdp_pdev *, u_int8_t val); + (struct cdp_pdev *, u_int8_t val); bool (*txrx_monitor_get_filter_ucast_data) (struct cdp_vdev *vdev_txrx_handle); @@ -662,6 +662,25 @@ struct cdp_host_stats_ops { void (*get_htt_stats)(struct cdp_pdev *pdev, void *data, uint32_t data_len); + void + (*txrx_update_pdev_stats)(struct cdp_pdev *pdev, void *data, + uint16_t stats_id); + struct cdp_peer_stats* + (*txrx_get_peer_stats)(struct cdp_peer *peer); + void + (*txrx_reset_peer_ald_stats)(struct cdp_peer *peer); + void + (*txrx_reset_peer_stats)(struct cdp_peer *peer); + int + (*txrx_get_vdev_stats)(struct cdp_vdev *vdev, void *buf, + bool is_aggregate); + int + (*txrx_process_wmi_host_vdev_stats)(ol_txrx_soc_handle soc, + void *data, uint32_t len, + uint32_t stats_id); + int + (*txrx_get_vdev_extd_stats)(struct cdp_vdev *vdev_handle, + void *buffer); }; struct cdp_wds_ops {