diff --git a/dp/inc/cdp_txrx_host_stats.h b/dp/inc/cdp_txrx_host_stats.h index f89a2ba09a3c..a5f864562d61 100644 --- a/dp/inc/cdp_txrx_host_stats.h +++ b/dp/inc/cdp_txrx_host_stats.h @@ -49,6 +49,36 @@ static inline int cdp_host_stats_get(ol_txrx_soc_handle soc, return soc->ops->host_stats_ops->txrx_host_stats_get(vdev, req); } +/** + * cdp_host_stats_get_ratekbps: cdp call to get rate in kbps + * @soc: SOC handle + * @preamb: Preamble + * @mcs: Modulation and Coding scheme index + * @htflag: Flag to identify HT or VHT + * @gintval: Gaurd Interval value + * + * return: 0 for Failure, Returns rate on Success + */ +static inline int cdp_host_stats_get_ratekbps(ol_txrx_soc_handle soc, + int preamb, int mcs, + int htflag, int gintval) +{ + 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_ratekbps) + return 0; + + return soc->ops->host_stats_ops->txrx_get_ratekbps(preamb, + mcs, htflag, + gintval); +} + /** * cdp_host_stats_clr: cdp call to clear host stats * @vdev: vdev handle diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 0178fc684f70..a3dfbe33c776 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -789,6 +789,9 @@ struct cdp_host_stats_ops { void *buf); struct cdp_pdev_stats* (*txrx_get_pdev_stats)(struct cdp_pdev *pdev); + int + (*txrx_get_ratekbps)(int preamb, int mcs, + int htflag, int gintval); }; struct cdp_wds_ops { diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index f844626cf76f..c69a4ba8e6bf 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -33,6 +33,9 @@ #include "dp_tx.h" #include "dp_tx_desc.h" #include "dp_rx.h" +#ifdef DP_RATETABLE_SUPPORT +#include "dp_ratetable.h" +#endif #include #include #include "cdp_txrx_cmn_struct.h" @@ -8098,6 +8101,21 @@ static void dp_set_vdev_dscp_tid_map_wifi3(struct cdp_vdev *vdev_handle, return; } +#ifdef DP_RATETABLE_SUPPORT +static int dp_txrx_get_ratekbps(int preamb, int mcs, + int htflag, int gintval) +{ + return dp_getrateindex((uint32_t)gintval, (uint16_t)mcs, 1, + (uint8_t)preamb, 1); +} +#else +static int dp_txrx_get_ratekbps(int preamb, int mcs, + int htflag, int gintval) +{ + return 0; +} +#endif + /* dp_txrx_get_pdev_stats - Returns cdp_pdev_stats * @peer_handle: DP pdev handle * @@ -9242,6 +9260,7 @@ static struct cdp_host_stats_ops dp_ops_host_stats = { .txrx_get_peer_stats = dp_txrx_get_peer_stats, .txrx_reset_peer_stats = dp_txrx_reset_peer_stats, .txrx_get_pdev_stats = dp_txrx_get_pdev_stats, + .txrx_get_ratekbps = dp_txrx_get_ratekbps, /* TODO */ };