浏览代码

qcacmn: Trace del reg write, ce tasklet latency, tx, and rx pkts

Use the tracepoints to trace delayed register write, ce
tasklet scheduling latency, tx, and rx packets.

Change-Id: I63a89276177a9d0466dcb0c831eeb8e938a2bf79
CRs-Fixed: 3081870
Yeshwanth Sriram Guntuka 3 年之前
父节点
当前提交
de814c9b16

+ 13 - 0
dp/wifi3.0/dp_rx.h

@@ -23,6 +23,7 @@
 #include "hal_rx.h"
 #include "dp_peer.h"
 #include "dp_internal.h"
+#include <qdf_tracepoint.h>
 
 #ifdef RXDMA_OPTIMIZATION
 #ifndef RX_DATA_BUFFER_ALIGNMENT
@@ -2078,4 +2079,16 @@ void dp_rx_desc_pool_deinit_generic(struct dp_soc *soc,
 				  struct rx_desc_pool *rx_desc_pool,
 				  uint32_t pool_id);
 
+/**
+ * dp_rx_pkt_tracepoints_enabled() - Get the state of rx pkt tracepoint
+ *
+ * Return: True if any rx pkt tracepoint is enabled else false
+ */
+static inline
+bool dp_rx_pkt_tracepoints_enabled(void)
+{
+	return (qdf_trace_dp_rx_tcp_pkt_enabled() ||
+		qdf_trace_dp_rx_udp_pkt_enabled() ||
+		qdf_trace_dp_rx_pkt_enabled());
+}
 #endif /* _DP_RX_H */

+ 6 - 0
dp/wifi3.0/dp_tx.c

@@ -3859,6 +3859,12 @@ dp_tx_comp_process_desc(struct dp_soc *soc,
 
 	dp_send_completion_to_pkt_capture(soc, desc, ts);
 
+	if (dp_tx_pkt_tracepoints_enabled())
+		qdf_trace_dp_packet(desc->nbuf, QDF_TX,
+				    desc->msdu_ext_desc ?
+				    desc->msdu_ext_desc->tso_desc : NULL,
+				    desc->timestamp);
+
 	if (!(desc->msdu_ext_desc)) {
 		dp_tx_enh_unmap(soc, desc);
 

+ 13 - 0
dp/wifi3.0/dp_tx.h

@@ -27,6 +27,7 @@
 #endif
 #include "dp_internal.h"
 #include "hal_tx.h"
+#include <qdf_tracepoint.h>
 
 #define DP_INVALID_VDEV_ID 0xFF
 
@@ -841,4 +842,16 @@ QDF_STATUS dp_get_uplink_delay(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
 			       uint32_t *val);
 #endif /* WLAN_FEATURE_TSF_UPLINK_TSF */
 
+/**
+ * dp_tx_pkt_tracepoints_enabled() - Get the state of tx pkt tracepoint
+ *
+ * Return: True if any tx pkt tracepoint is enabled else false
+ */
+static inline
+bool dp_tx_pkt_tracepoints_enabled(void)
+{
+	return (qdf_trace_dp_tx_comp_tcp_pkt_enabled() ||
+		qdf_trace_dp_tx_comp_udp_pkt_enabled() ||
+		qdf_trace_dp_tx_comp_pkt_enabled());
+}
 #endif

+ 2 - 1
dp/wifi3.0/li/dp_li_rx.c

@@ -664,7 +664,8 @@ done:
 		DP_RX_TID_SAVE(nbuf, tid);
 		if (qdf_unlikely(rx_pdev->delay_stats_flag) ||
 		    qdf_unlikely(wlan_cfg_is_peer_ext_stats_enabled(
-				 soc->wlan_cfg_ctx)))
+				 soc->wlan_cfg_ctx)) ||
+		    dp_rx_pkt_tracepoints_enabled())
 			qdf_nbuf_set_timestamp(nbuf);
 
 		tid_stats =

+ 3 - 1
dp/wifi3.0/li/dp_li_tx.c

@@ -215,7 +215,9 @@ dp_tx_hw_enqueue_li(struct dp_soc *soc, struct dp_vdev *vdev,
 		hal_tx_desc_set_mesh_en(soc->hal_soc, hal_tx_desc_cached, 1);
 
 	if (qdf_unlikely(vdev->pdev->delay_stats_flag) ||
-	    qdf_unlikely(wlan_cfg_is_peer_ext_stats_enabled(soc->wlan_cfg_ctx)))
+	    qdf_unlikely(
+		       wlan_cfg_is_peer_ext_stats_enabled(soc->wlan_cfg_ctx)) ||
+	    dp_tx_pkt_tracepoints_enabled())
 		tx_desc->timestamp = qdf_ktime_to_ms(qdf_ktime_real_get());
 
 	dp_verbose_debug("length:%d , type = %d, dma_addr %llx, offset %d desc id %u",

+ 6 - 0
hal/wifi3.0/hal_srng.c

@@ -23,6 +23,7 @@
 #include "target_type.h"
 #include "qdf_module.h"
 #include "wcss_version.h"
+#include <qdf_tracepoint.h>
 
 #ifdef QCA_WIFI_QCA8074
 void hal_qca6290_attach(struct hal_soc *hal);
@@ -778,6 +779,11 @@ static void hal_reg_write_work(void *arg)
 		hal_verbose_debug("read_idx %u srng 0x%x, addr 0x%pK dequeue_val %u sched delay %llu us",
 				  hal->read_idx, ring_id, addr, write_val, delta_us);
 
+		qdf_trace_dp_del_reg_write(ring_id, q_elem->enqueue_val,
+					   q_elem->dequeue_val,
+					   q_elem->enqueue_time,
+					   q_elem->dequeue_time);
+
 		num_processed++;
 		hal->read_idx = (hal->read_idx + 1) &
 					(HAL_REG_WRITE_QUEUE_LEN - 1);

+ 5 - 0
hif/src/ce/ce_internal.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -153,6 +154,10 @@ struct CE_state {
 	qdf_lro_ctx_t lro_data;
 
 	void (*service)(struct hif_softc *scn, int CE_id);
+#ifdef WLAN_TRACEPOINTS
+	/* CE tasklet sched time in nanoseconds */
+	unsigned long long ce_tasklet_sched_time;
+#endif
 };
 
 /* Descriptor rings must be aligned to this boundary */

+ 26 - 0
hif/src/ce/ce_service.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -28,6 +29,7 @@
 #include "hif_debug.h"
 #include "hif_napi.h"
 #include "qdf_module.h"
+#include <qdf_tracepoint.h>
 
 #ifdef IPA_OFFLOAD
 #ifdef QCA_WIFI_3_0
@@ -1149,6 +1151,28 @@ more_watermarks:
 	qdf_atomic_set(&CE_state->rx_pending, 0);
 }
 
+#ifdef WLAN_TRACEPOINTS
+/**
+ * ce_trace_tasklet_sched_latency() - Trace ce tasklet scheduling
+ *  latency
+ * @ce_state: CE context
+ *
+ * Return: None
+ */
+static inline
+void ce_trace_tasklet_sched_latency(struct CE_state *ce_state)
+{
+	qdf_trace_dp_ce_tasklet_sched_latency(ce_state->id,
+					      ce_state->ce_service_start_time -
+					      ce_state->ce_tasklet_sched_time);
+}
+#else
+static inline
+void ce_trace_tasklet_sched_latency(struct CE_state *ce_state)
+{
+}
+#endif
+
 /*
  * Guts of interrupt handler for per-engine interrupts on a particular CE.
  *
@@ -1178,6 +1202,8 @@ int ce_per_engine_service(struct hif_softc *scn, unsigned int CE_id)
 		hif_get_ce_service_max_yield_time(
 			(struct hif_opaque_softc *)scn);
 
+	ce_trace_tasklet_sched_latency(CE_state);
+
 	qdf_spin_lock(&CE_state->ce_index_lock);
 
 	CE_state->service(scn, CE_id);

+ 26 - 0
hif/src/ce/ce_tasklet.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -647,6 +648,29 @@ void hif_clear_ce_stats(struct HIF_CE_state *hif_ce_state)
 	qdf_mem_zero(&hif_ce_state->stats, sizeof(struct ce_stats));
 }
 
+#ifdef WLAN_TRACEPOINTS
+/**
+ * hif_set_ce_tasklet_sched_time() - Set tasklet schedule time for
+ *  CE with matching ce_id
+ * @scn: hif context
+ * @ce_id: CE id
+ *
+ * Return: None
+ */
+static inline
+void hif_set_ce_tasklet_sched_time(struct hif_softc *scn, uint8_t ce_id)
+{
+	struct CE_state *ce_state = scn->ce_id_to_state[ce_id];
+
+	ce_state->ce_tasklet_sched_time = qdf_time_sched_clock();
+}
+#else
+static inline
+void hif_set_ce_tasklet_sched_time(struct hif_softc *scn, uint8_t ce_id)
+{
+}
+#endif
+
 /**
  * hif_tasklet_schedule() - schedule tasklet
  * @hif_ctx: hif context
@@ -664,6 +688,8 @@ static inline bool hif_tasklet_schedule(struct hif_opaque_softc *hif_ctx,
 		qdf_atomic_dec(&scn->active_tasklet_cnt);
 		return false;
 	}
+
+	hif_set_ce_tasklet_sched_time(scn, tasklet_entry->ce_id);
 	/* keep it before tasklet_schedule, this is to happy whunt.
 	 * in whunt, tasklet may run before finished hif_tasklet_schedule.
 	 */