浏览代码

qcacmn: Txrx statistics for Lithium datapath

Introduce a new iwpriv command txrx_stats to
print host and firmware statistics for lithium
chipset

Change-Id: Ib048c64f903c7a97508f8b03bebe7f7c1d9e6c05
CRs-Fixed: 2017426
Venkata Sharath Chandra Manchala 8 年之前
父节点
当前提交
a77da0da85
共有 4 个文件被更改,包括 145 次插入2 次删除
  1. 20 0
      dp/inc/cdp_txrx_cmn.h
  2. 38 1
      dp/inc/cdp_txrx_cmn_struct.h
  3. 2 0
      dp/inc/cdp_txrx_ops.h
  4. 85 1
      dp/wifi3.0/dp_main.c

+ 20 - 0
dp/inc/cdp_txrx_cmn.h

@@ -36,6 +36,7 @@
 #include "qdf_nbuf.h"
 #include "cdp_txrx_ops.h"
 #include "cdp_txrx_handle.h"
+#include "cdp_txrx_cmn_struct.h"
 /******************************************************************************
  *
  * Common Data Path Header File
@@ -435,4 +436,23 @@ static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,
 	}
 	return;
 }
+
+/**
+ * cdp_txrx_stats(): function to map to host and firmware statistics
+ * @soc: soc handle
+ * @vdev: virtual device
+ * @req: statistics request handle
+ * @stats: statistics option
+ *
+ * return: status
+ */
+static inline
+int cdp_txrx_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
+		struct ol_txrx_stats_req *req, enum cdp_stats stats)
+{
+	if (soc->ops->cmn_drv_ops->txrx_stats)
+		return soc->ops->cmn_drv_ops->txrx_stats(vdev, req, stats);
+	return 0;
+}
+
 #endif /* _CDP_TXRX_CMN_H_ */

+ 38 - 1
dp/inc/cdp_txrx_cmn_struct.h

@@ -102,13 +102,15 @@ enum htt_cmn_dbg_stats_type {
 
 /*
  * cdp_host_txrx_stats: Different types of host stats
+ * @TXRX_HOST_STATS_INVALID: Invalid option
  * @TXRX_RX_RATE_STATS: Rx rate info
  * @TXRX_TX_RATE_STATS: Tx rate info
  * @TXRX_TX_HOST_STATS: Print Tx stats
  * @TXRX_RX_HOST_STATS: Print host Rx stats
  * @TXRX_CLEAR_STATS: clear all host stats
- */
+*/
 enum cdp_host_txrx_stats {
+	TXRX_HOST_STATS_INVALID  = -1,
 	TXRX_RX_RATE_STATS  = 0,
 	TXRX_TX_RATE_STATS  = 1,
 	TXRX_TX_HOST_STATS  = 2,
@@ -431,6 +433,41 @@ struct cdp_soc_t {
 #define PER_RADIO_FW_STATS_REQUEST 0
 #define PER_VDEV_FW_STATS_REQUEST 1
 
+/*
+ * cdp_stats - options for host and firmware
+ * statistics
+*/
+enum cdp_stats {
+	CDP_TXRX_STATS_0  = 0,
+	CDP_TXRX_STATS_1,
+	CDP_TXRX_STATS_2,
+	CDP_TXRX_STATS_3,
+	CDP_TXRX_STATS_4,
+	CDP_TXRX_STATS_5,
+	CDP_TXRX_STATS_6,
+	CDP_TXRX_STATS_7,
+	CDP_TXRX_STATS_8,
+	CDP_TXRX_STATS_9,
+	CDP_TXRX_STATS_10,
+	CDP_TXRX_STATS_11,
+	CDP_TXRX_STATS_12,
+	CDP_TXRX_STATS_13,
+	CDP_TXRX_STATS_14,
+	CDP_TXRX_STATS_15,
+	CDP_TXRX_STATS_16,
+	CDP_TXRX_STATS_17,
+	CDP_TXRX_STATS_18,
+	CDP_TXRX_STATS_19,
+	CDP_TXRX_STATS_20,
+	CDP_TXRX_STATS_21,
+	CDP_TXRX_STATS_22,
+	CDP_TXRX_STATS_23,
+	CDP_TXRX_STATS_24,
+	CDP_TXRX_STATS_25,
+	CDP_TXRX_STATS_26,
+	CDP_TXRX_STATS_27,
+	CDP_TXRX_MAX_STATS,
+};
 
 /* Different Packet Types */
 enum cdp_packet_type {

+ 2 - 0
dp/inc/cdp_txrx_ops.h

@@ -193,6 +193,8 @@ struct cdp_cmn_ops {
 	void (*set_pdev_dscp_tid_map)(struct cdp_pdev *pdev, uint8_t map_id,
 			uint8_t tos, uint8_t tid);
 
+	A_STATUS(*txrx_stats)(struct cdp_vdev *vdev,
+		struct ol_txrx_stats_req *req, enum cdp_stats stats);
 };
 
 struct cdp_ctrl_ops {

+ 85 - 1
dp/wifi3.0/dp_main.c

@@ -65,6 +65,58 @@ static uint8_t default_dscp_tid_map[DSCP_TID_MAP_MAX] = {
 	6, 6, 6, 6, 6, 6, 6, 6,
 };
 
+/**
+ * @brief Select the type of statistics
+ */
+enum dp_stats_type {
+	STATS_FW   = 0,
+	STATS_HOST = 1,
+	STATS_TYPE_MAX  = 2,
+};
+
+/**
+ * @brief General Firmware statistics options
+ *
+ */
+enum dp_fw_stats {
+	TXRX_FW_STATS_INVALID	= -1,
+};
+
+/**
+ * @brief Firmware and Host statistics
+ * currently supported
+ */
+const int dp_stats_mapping_table[][STATS_TYPE_MAX] = {
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_RX_RATE_STATS},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_TX_RATE_STATS},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_TX_HOST_STATS},
+	{TXRX_FW_STATS_INVALID, TXRX_CLEAR_STATS},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID},
+	{TXRX_FW_STATS_INVALID, TXRX_RX_HOST_STATS},
+};
+
 /**
  * dp_setup_srng - Internal function to setup SRNG rings used by data path
  */
@@ -2793,6 +2845,38 @@ static void dp_set_pdev_dscp_tid_map_wifi3(struct cdp_pdev *pdev_handle,
 	return;
 }
 
+/*
+ * dp_txrx_stats() - function to map to firmware and host stats
+ * @vdev: virtual handle
+ * @req: statistics request handle
+ * @stats: type of statistics requested
+ *
+ * Return: integer
+ */
+static int dp_txrx_stats(struct cdp_vdev *vdev,
+			struct ol_txrx_stats_req *req, enum cdp_stats stats)
+{
+	int host_stats;
+	int fw_stats;
+
+	if (stats >= CDP_TXRX_MAX_STATS)
+		return 0;
+
+	fw_stats = dp_stats_mapping_table[stats][STATS_FW];
+	host_stats = dp_stats_mapping_table[stats][STATS_HOST];
+
+	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
+		 "stats: %u fw_stats_type: %d host_stats_type: %d",
+		  stats, fw_stats, host_stats);
+
+	/* TODO: Firmware Mapping not implemented */
+
+	if (host_stats != TXRX_HOST_STATS_INVALID)
+		return dp_print_host_stats(vdev, req, host_stats);
+
+	return 0;
+}
+
 static struct cdp_cmn_ops dp_ops_cmn = {
 	.txrx_soc_attach_target = dp_soc_attach_target_wifi3,
 	.txrx_vdev_attach = dp_vdev_attach_wifi3,
@@ -2815,6 +2899,7 @@ static struct cdp_cmn_ops dp_ops_cmn = {
 	/* TODO: get API's for dscp-tid need to be added*/
 	.set_vdev_dscp_tid_map = dp_set_vdev_dscp_tid_map_wifi3,
 	.set_pdev_dscp_tid_map = dp_set_pdev_dscp_tid_map_wifi3,
+	.txrx_stats = dp_txrx_stats,
 	/* TODO: Add other functions */
 };
 
@@ -2918,7 +3003,6 @@ static struct cdp_throttle_ops dp_ops_throttle = {
 };
 
 static struct cdp_mob_stats_ops dp_ops_mob_stats = {
-	/* WIFI 3.0 DP NOT IMPLEMENTED YET */
 };
 
 static struct cdp_cfg_ops dp_ops_cfg = {