Эх сурвалжийг харах

qcacmn: CDP interface support for Tx Capture Stats

Add CDP interface structure and ops functions for getting Tx Capture
stats.

Change-Id: I5b01e2ab21aec566848eee805d6a702da150d328
CRs-Fixed: 3111860
Subrat Mishra 3 жил өмнө
parent
commit
1e5ee08ad6

+ 58 - 0
dp/inc/cdp_txrx_host_stats.h

@@ -846,4 +846,62 @@ cdp_mon_pdev_get_rx_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
 
 	return soc->ops->mon_ops->get_mon_pdev_rx_stats(soc, pdev_id, stats);
 }
+
+#ifdef WLAN_TX_PKT_CAPTURE_ENH
+/**
+ * cdp_get_peer_tx_capture_stats() - Call to get peer tx capture stats
+ * @soc: soc handle
+ * @vdev_id: id of dp_vdev handle
+ * @peer_mac: peer mac address
+ * @stats: pointer to peer tx capture stats
+ *
+ * return: status Success/Failure
+ */
+static inline QDF_STATUS
+cdp_get_peer_tx_capture_stats(ol_txrx_soc_handle soc,
+			      uint8_t vdev_id,
+			      uint8_t *peer_mac,
+			      struct cdp_peer_tx_capture_stats *stats)
+{
+	if (!soc || !soc->ops) {
+		dp_cdp_debug("Invalid Instance");
+		QDF_BUG(0);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!soc->ops->host_stats_ops ||
+	    !soc->ops->host_stats_ops->get_peer_tx_capture_stats)
+		return QDF_STATUS_E_FAILURE;
+
+	return soc->ops->host_stats_ops->get_peer_tx_capture_stats(soc, vdev_id,
+								   peer_mac,
+								   stats);
+}
+
+/**
+ * cdp_get_pdev_tx_capture_stats() - Call to get pdev tx capture stats
+ * @soc: soc handle
+ * @pdev_id: id of dp_pdev handle
+ * @stats: pointer to pdev tx capture stats
+ *
+ * return: status Success/Failure
+ */
+static inline QDF_STATUS
+cdp_get_pdev_tx_capture_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
+			      struct cdp_pdev_tx_capture_stats *stats)
+{
+	if (!soc || !soc->ops) {
+		dp_cdp_debug("Invalid Instance");
+		QDF_BUG(0);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!soc->ops->host_stats_ops ||
+	    !soc->ops->host_stats_ops->get_pdev_tx_capture_stats)
+		return QDF_STATUS_E_FAILURE;
+
+	return soc->ops->host_stats_ops->get_pdev_tx_capture_stats(soc, pdev_id,
+								   stats);
+}
+#endif /* WLAN_TX_PKT_CAPTURE_ENH */
 #endif /* _CDP_TXRX_HOST_STATS_H_ */

+ 11 - 0
dp/inc/cdp_txrx_ops.h

@@ -1053,6 +1053,17 @@ struct cdp_host_stats_ops {
 
 	void (*txrx_reset_vdev_stats_id)(struct cdp_soc_t *soc,
 					 uint8_t vdev_stats_id);
+
+#ifdef WLAN_TX_PKT_CAPTURE_ENH
+	QDF_STATUS
+	(*get_peer_tx_capture_stats)(struct cdp_soc_t *soc, uint8_t vdev_id,
+				     uint8_t *peer_mac,
+				     struct cdp_peer_tx_capture_stats *stats);
+
+	QDF_STATUS
+	(*get_pdev_tx_capture_stats)(struct cdp_soc_t *soc, uint8_t pdev_id,
+				     struct cdp_pdev_tx_capture_stats *stats);
+#endif /* WLAN_TX_PKT_CAPTURE_ENH */
 };
 
 struct cdp_wds_ops {

+ 88 - 0
dp/inc/cdp_txrx_stats_struct.h

@@ -2714,4 +2714,92 @@ enum _dp_param_t {
 #endif
 /* Bitmasks for stats that can block */
 #define EXT_TXRX_FW_STATS		0x0001
+
+#define CDP_TX_CAP_HTT_MAX_FTYPE 19
+#define CDP_FC0_TYPE_SHIFT 2
+#define CDP_FC0_SUBTYPE_SHIFT 4
+#define CDP_FC0_TYPE_DATA 0x08
+#define CDP_FC0_SUBTYPE_MASK 0xf0
+
+#define CDP_TXCAP_MAX_TYPE \
+	((CDP_FC0_TYPE_DATA >> CDP_FC0_TYPE_SHIFT) + 1)
+#define CDP_TXCAP_MAX_SUBTYPE \
+	((CDP_FC0_SUBTYPE_MASK >> CDP_FC0_SUBTYPE_SHIFT) + 1)
+
+enum CDP_PEER_MSDU_DESC {
+	PEER_MSDU_SUCC,
+	PEER_MSDU_ENQ,
+	PEER_MSDU_DEQ,
+	PEER_MSDU_FLUSH,
+	PEER_MSDU_DROP,
+	PEER_MSDU_XRETRY,
+	PEER_MSDU_DESC_MAX,
+};
+
+enum CDP_PEER_MPDU_DESC {
+	PEER_MPDU_TRI,
+	PEER_MPDU_SUCC,
+	PEER_MPDU_RESTITCH,
+	PEER_MPDU_ARR,
+	PEER_MPDU_CLONE,
+	PEER_MPDU_TO_STACK,
+	PEER_MPDU_DESC_MAX,
+};
+
+/**
+ * struct cdp_tid_q_len - Structure to hold consolidated queue length
+ * @defer_msdu_len: Defered MSDU queue length
+ * @tasklet_msdu_len: MSDU complete queue length
+ * @pending_q_len: MSDU pending queue length
+ */
+struct cdp_tid_q_len {
+	uint64_t defer_msdu_len;
+	uint64_t tasklet_msdu_len;
+	uint64_t pending_q_len;
+};
+
+/**
+ * struct cdp_peer_tx_capture_stats - Structure to hold peer tx capture stats
+ * @len_stats: Per TID defered, pending and completed msdu queue length
+ * @mpdu: Mpdu success and restich count
+ * @msdu: Msdu success and restich count
+ */
+struct cdp_peer_tx_capture_stats {
+	struct cdp_tid_q_len len_stats[CDP_MAX_TIDS];
+#ifdef WLAN_TX_PKT_CAPTURE_ENH_DEBUG
+	uint32_t mpdu[PEER_MPDU_DESC_MAX];
+	uint32_t msdu[PEER_MSDU_DESC_MAX];
+#endif
+};
+
+/**
+ * struct cdp_pdev_tx_capture_stats - Structure to hold pdev tx capture stats
+ * @peer_mismatch: Peer mismatched
+ * @last_rcv_ppdu: Last received PPDU stats in ms
+ * @ppdu_stats_queue_depth: PPDU stats queue depth
+ * @ppdu_stats_defer_queue_depth: PPDU stats defered queue depth
+ * @ppdu_dropped: PPDU dropped count
+ * @pend_ppdu_dropped: Pending PPDU dropped count
+ * @ppdu_flush_count: PPDU flush count
+ * @msdu_threshold_drop: MSDU threshold drop count
+ * @ctl_mgmt_q_len: Control management queue length
+ * @retries_ctl_mgmt_q_len: Control management retries queue length
+ * @htt_frame_type: HTT frame type
+ * @len_stats: Consolidated msdu, ppdu and pending queue length
+ */
+struct cdp_pdev_tx_capture_stats {
+	uint64_t peer_mismatch;
+	uint32_t last_rcv_ppdu;
+	uint32_t ppdu_stats_queue_depth;
+	uint32_t ppdu_stats_defer_queue_depth;
+	uint32_t ppdu_dropped;
+	uint32_t pend_ppdu_dropped;
+	uint32_t ppdu_flush_count;
+	uint32_t msdu_threshold_drop;
+	unsigned int ctl_mgmt_q_len[CDP_TXCAP_MAX_TYPE][CDP_TXCAP_MAX_SUBTYPE];
+	unsigned int retries_ctl_mgmt_q_len[CDP_TXCAP_MAX_TYPE]
+					   [CDP_TXCAP_MAX_SUBTYPE];
+	uint32_t htt_frame_type[CDP_TX_CAP_HTT_MAX_FTYPE];
+	struct cdp_tid_q_len len_stats;
+};
 #endif

+ 39 - 0
dp/wifi3.0/dp_internal.h

@@ -614,6 +614,20 @@ void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
 						      bool val)
 {
 }
+
+static inline QDF_STATUS
+dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
+				     struct cdp_peer_tx_capture_stats *stats)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+
+static inline QDF_STATUS
+dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
+				     struct cdp_pdev_tx_capture_stats *stats)
+{
+	return QDF_STATUS_E_FAILURE;
+}
 #endif
 
 /**
@@ -2953,4 +2967,29 @@ dp_txrx_get_peer_jitter_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 			      uint8_t vdev_id, uint8_t *peer_mac,
 			      struct cdp_peer_tid_stats *tid_stats);
 
+/* dp_peer_get_tx_capture_stats - to get peer Tx Capture stats
+ * @soc_hdl: soc handle
+ * @vdev_id: id of vdev handle
+ * @peer_mac: mac of DP_PEER handle
+ * @stats: pointer to peer tx capture stats
+ *
+ * Return: QDF_STATUS_SUCCESS: Success
+ *         QDF_STATUS_E_FAILURE: Error
+ */
+QDF_STATUS
+dp_peer_get_tx_capture_stats(struct cdp_soc_t *soc_hdl,
+			     uint8_t vdev_id, uint8_t *peer_mac,
+			     struct cdp_peer_tx_capture_stats *stats);
+
+/* dp_pdev_get_tx_capture_stats - to get pdev Tx Capture stats
+ * @soc_hdl: soc handle
+ * @pdev_id: id of pdev handle
+ * @stats: pointer to pdev tx capture stats
+ *
+ * Return: QDF_STATUS_SUCCESS: Success
+ *         QDF_STATUS_E_FAILURE: Error
+ */
+QDF_STATUS
+dp_pdev_get_tx_capture_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			     struct cdp_pdev_tx_capture_stats *stats);
 #endif /* #ifndef _DP_INTERNAL_H_ */

+ 4 - 0
dp/wifi3.0/dp_main.c

@@ -11972,6 +11972,10 @@ static struct cdp_host_stats_ops dp_ops_host_stats = {
 	.txrx_alloc_vdev_stats_id = dp_txrx_alloc_vdev_stats_id,
 	.txrx_reset_vdev_stats_id = dp_txrx_reset_vdev_stats_id,
 #endif
+#ifdef WLAN_TX_PKT_CAPTURE_ENH
+	.get_peer_tx_capture_stats = dp_peer_get_tx_capture_stats,
+	.get_pdev_tx_capture_stats = dp_pdev_get_tx_capture_stats,
+#endif /* WLAN_TX_PKT_CAPTURE_ENH */
 	/* TODO */
 };
 

+ 49 - 0
dp/wifi3.0/dp_stats.c

@@ -7816,3 +7816,52 @@ dp_txrx_get_peer_jitter_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 	return QDF_STATUS_E_FAILURE;
 }
 #endif /* WLAN_PEER_JITTER */
+
+#ifdef WLAN_TX_PKT_CAPTURE_ENH
+QDF_STATUS
+dp_peer_get_tx_capture_stats(struct cdp_soc_t *soc_hdl,
+			     uint8_t vdev_id, uint8_t *peer_mac,
+			     struct cdp_peer_tx_capture_stats *stats)
+{
+	struct dp_soc *soc = (struct dp_soc *)soc_hdl;
+	struct dp_peer *peer = dp_peer_find_hash_find(soc, peer_mac, 0, vdev_id,
+						      DP_MOD_ID_TX_CAPTURE);
+	QDF_STATUS status;
+
+	if (!peer)
+		return QDF_STATUS_E_FAILURE;
+
+	status = dp_monitor_peer_tx_capture_get_stats(soc, peer, stats);
+	dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
+
+	return status;
+}
+
+QDF_STATUS
+dp_pdev_get_tx_capture_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			     struct cdp_pdev_tx_capture_stats *stats)
+{
+	struct dp_soc *soc = (struct dp_soc *)soc_hdl;
+	struct dp_pdev *pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+
+	if (!pdev)
+		return QDF_STATUS_E_FAILURE;
+
+	return dp_monitor_pdev_tx_capture_get_stats(soc, pdev, stats);
+}
+#else /* WLAN_TX_PKT_CAPTURE_ENH */
+QDF_STATUS
+dp_peer_get_tx_capture_stats(struct cdp_soc_t *soc_hdl,
+			     uint8_t vdev_id, uint8_t *peer_mac,
+			     struct cdp_peer_tx_capture_stats *stats)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS
+dp_pdev_get_tx_capture_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			     struct cdp_pdev_tx_capture_stats *stats)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+#endif /* WLAN_TX_PKT_CAPTURE_ENH */

+ 2 - 0
dp/wifi3.0/monitor/1.0/dp_mon_1.0.c

@@ -889,6 +889,8 @@ dp_mon_register_feature_ops_1_0(struct dp_soc *soc)
 	mon_ops->mon_print_pdev_tx_capture_stats =
 				dp_print_pdev_tx_capture_stats;
 	mon_ops->mon_config_enh_tx_capture = dp_config_enh_tx_capture;
+	mon_ops->mon_peer_tx_capture_get_stats = dp_get_peer_tx_capture_stats;
+	mon_ops->mon_pdev_tx_capture_get_stats = dp_get_pdev_tx_capture_stats;
 #endif
 #if defined(WDI_EVENT_ENABLE) &&\
 	(defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))

+ 105 - 0
dp/wifi3.0/monitor/dp_mon.h

@@ -474,6 +474,12 @@ struct dp_mon_ops {
 					      struct dp_peer *peer,
 					      struct hal_tx_completion_status *ts,
 					      qdf_nbuf_t netbuf);
+	QDF_STATUS
+	(*mon_peer_tx_capture_get_stats)(struct dp_peer *peer,
+					 struct cdp_peer_tx_capture_stats *sts);
+	QDF_STATUS
+	(*mon_pdev_tx_capture_get_stats)(struct dp_pdev *pdev,
+					 struct cdp_pdev_tx_capture_stats *sts);
 #endif
 #if defined(WDI_EVENT_ENABLE) &&\
 	(defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
@@ -1028,6 +1034,34 @@ QDF_STATUS dp_tx_capture_debugfs_init(struct dp_pdev *pdev)
 {
 	return QDF_STATUS_E_FAILURE;
 }
+
+/**
+ * dp_get_peer_tx_capture_stats: to get peer tx capture stats
+ * @peer: DP PEER handle
+ * @stats: pointor to peer tx capture stats
+ *
+ * return: QDF_STATUS
+ */
+static inline QDF_STATUS
+dp_get_peer_tx_capture_stats(struct dp_peer *peer,
+			     struct cdp_peer_tx_capture_stats *stats)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * dp_get_pdev_tx_capture_stats: to get pdev tx capture stats
+ * @pdev: DP PDEV handle
+ * @stats: pointor to pdev tx capture stats
+ *
+ * return: QDF_STATUS
+ */
+static inline QDF_STATUS
+dp_get_pdev_tx_capture_stats(struct dp_pdev *pdev,
+			     struct cdp_pdev_tx_capture_stats *stats)
+{
+	return QDF_STATUS_E_FAILURE;
+}
 #endif
 
 #ifdef WLAN_TX_PKT_CAPTURE_ENH
@@ -2277,6 +2311,63 @@ QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
 						    peer, ts, netbuf);
 }
 
+/*
+ * dp_monitor_peer_tx_capture_get_stats - to get Peer Tx Capture stats
+ * @soc: DP SOC handle
+ * @peer: DP PEER handle
+ * @stats: Pointer Peer tx capture stats
+ *
+ * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS
+ */
+static inline QDF_STATUS
+dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
+				     struct cdp_peer_tx_capture_stats *stats)
+{
+	struct dp_mon_ops *monitor_ops;
+	struct dp_mon_soc *mon_soc = soc->monitor_soc;
+
+	if (!mon_soc) {
+		dp_mon_debug("monitor soc is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	monitor_ops = mon_soc->mon_ops;
+	if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_get_stats) {
+		dp_mon_debug("callback not registered");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return monitor_ops->mon_peer_tx_capture_get_stats(peer, stats);
+}
+
+/*
+ * dp_monitor_pdev_tx_capture_get_stats - to get pdev tx capture stats
+ * @soc: DP SOC handle
+ * @pdev: DP PDEV handle
+ * @stats: Pointer to pdev tx capture stats
+ *
+ * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS
+ */
+static inline QDF_STATUS
+dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
+				     struct cdp_pdev_tx_capture_stats *stats)
+{
+	struct dp_mon_ops *monitor_ops;
+	struct dp_mon_soc *mon_soc = soc->monitor_soc;
+
+	if (!mon_soc) {
+		dp_mon_debug("monitor soc is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	monitor_ops = mon_soc->mon_ops;
+	if (!monitor_ops || !monitor_ops->mon_pdev_tx_capture_get_stats) {
+		dp_mon_debug("callback not registered");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return monitor_ops->mon_pdev_tx_capture_get_stats(pdev, stats);
+}
 #else
 static inline
 void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
@@ -2322,6 +2413,20 @@ QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
 {
 	return QDF_STATUS_E_FAILURE;
 }
+
+static inline QDF_STATUS
+dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
+				     struct cdp_peer_tx_capture_stats *stats)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+
+static inline QDF_STATUS
+dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
+				     struct cdp_pdev_tx_capture_stats *stats)
+{
+	return QDF_STATUS_E_FAILURE;
+}
 #endif
 
 /*