浏览代码

qcacmn: Add CDP api to fetch data rates

Add new CDP api to fetch data rates accordingly
from datapath

Change-Id: I1cf08d396e0f611c61a02c868c9c31759ef52a79
CRs-Fixed: 2394226
Surya Prakash Raajen 6 年之前
父节点
当前提交
3a01bdd783
共有 3 个文件被更改,包括 52 次插入0 次删除
  1. 30 0
      dp/inc/cdp_txrx_host_stats.h
  2. 3 0
      dp/inc/cdp_txrx_ops.h
  3. 19 0
      dp/wifi3.0/dp_main.c

+ 30 - 0
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

+ 3 - 0
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 {

+ 19 - 0
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 <cdp_txrx_handle.h>
 #include <wlan_cfg.h>
 #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 */
 };