Преглед на файлове

qcacmn: Add DP event history in non debug mode

Enable DP event history for perf mode.

Change-Id: I1b8863928f956aa39488ea357d56e182613aad8d
CRs-Fixed: 2846844
Ananya Gupta преди 4 години
родител
ревизия
a3152f3104
променени са 5 файла, в които са добавени 54 реда и са изтрити 9 реда
  1. 21 1
      hif/inc/hif.h
  2. 4 4
      hif/src/hif_exec.c
  3. 2 2
      hif/src/hif_main.h
  4. 11 1
      qdf/inc/qdf_time.h
  5. 16 1
      qdf/linux/src/i_qdf_time.h

+ 21 - 1
hif/inc/hif.h

@@ -334,10 +334,30 @@ enum hif_event_type {
 
 #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
 
+#if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
 /* HIF_EVENT_HIST_MAX should always be power of 2 */
 #define HIF_EVENT_HIST_MAX		512
 #define HIF_NUM_INT_CONTEXTS		HIF_MAX_GROUP
-#define HIF_EVENT_HIST_DISABLE_MASK	0
+#define HIF_EVENT_HIST_ENABLE_MASK	0x3F
+
+static inline uint64_t hif_get_log_timestamp(void)
+{
+	return qdf_get_log_timestamp();
+}
+
+#else
+
+#define HIF_EVENT_HIST_MAX		32
+#define HIF_NUM_INT_CONTEXTS		HIF_MAX_GROUP
+/* Enable IRQ TRIGGER, NAPI SCHEDULE, SRNG ACCESS START */
+#define HIF_EVENT_HIST_ENABLE_MASK	0x19
+
+static inline uint64_t hif_get_log_timestamp(void)
+{
+	return qdf_sched_clock();
+}
+
+#endif
 
 /**
  * struct hif_event_record - an entry of the DP event history

+ 4 - 4
hif/src/hif_exec.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021 The Linux Foundation. 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
@@ -134,7 +134,7 @@ void hif_hist_record_event(struct hif_opaque_softc *hif_ctx,
 	struct hif_event_record *record;
 	int record_index;
 
-	if (scn->event_disable_mask & BIT(event->type))
+	if (!(scn->event_enable_mask & BIT(event->type)))
 		return;
 
 	if (qdf_unlikely(intr_grp_id >= HIF_NUM_INT_CONTEXTS)) {
@@ -156,14 +156,14 @@ void hif_hist_record_event(struct hif_opaque_softc *hif_ctx,
 
 	if (event->type == HIF_EVENT_IRQ_TRIGGER) {
 		hist_ev->misc.last_irq_index = record_index;
-		hist_ev->misc.last_irq_ts = qdf_get_log_timestamp();
+		hist_ev->misc.last_irq_ts = hif_get_log_timestamp();
 	}
 
 	record->hal_ring_id = event->hal_ring_id;
 	record->hp = event->hp;
 	record->tp = event->tp;
 	record->cpu_id = qdf_get_cpu();
-	record->timestamp = qdf_get_log_timestamp();
+	record->timestamp = hif_get_log_timestamp();
 	record->type = event->type;
 }
 

+ 2 - 2
hif/src/hif_main.h

@@ -186,7 +186,7 @@ struct hif_softc {
 	/* Packet statistics */
 	struct hif_ce_stats pkt_stats;
 	enum hif_target_status target_status;
-	uint64_t event_disable_mask;
+	uint64_t event_enable_mask;
 
 	struct targetdef_s *targetdef;
 	struct ce_reg_def *target_ce_def;
@@ -324,7 +324,7 @@ static inline void hif_set_event_hist_mask(struct hif_opaque_softc *hif_handle)
 {
 	struct hif_softc *scn = (struct hif_softc *)hif_handle;
 
-	scn->event_disable_mask = HIF_EVENT_HIST_DISABLE_MASK;
+	scn->event_enable_mask = HIF_EVENT_HIST_ENABLE_MASK;
 }
 #else
 static inline void hif_set_event_hist_mask(struct hif_opaque_softc *hif_handle)

+ 11 - 1
qdf/inc/qdf_time.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2021 The Linux Foundation. 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
@@ -249,6 +249,16 @@ static inline bool qdf_system_time_after_eq(qdf_time_t a, qdf_time_t b)
 	return __qdf_system_time_after_eq(a, b);
 }
 
+/**
+ * qdf_sched_clock() - use light weight timer to get timestamp for logging
+ *
+ * Return: timestamp in ns
+ */
+static inline uint64_t qdf_sched_clock(void)
+{
+	return __qdf_sched_clock();
+}
+
 /**
  * enum qdf_timestamp_unit - what unit the qdf timestamp is in
  * @KERNEL_LOG: boottime time in uS (micro seconds)

+ 16 - 1
qdf/linux/src/i_qdf_time.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2021 The Linux Foundation. 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
@@ -27,6 +27,11 @@
 #include <linux/version.h>
 #include <linux/jiffies.h>
 #include <linux/delay.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+#include <linux/sched/clock.h>
+#else
+#include <linux/sched.h>
+#endif
 #include <linux/ktime.h>
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
 #include <linux/timekeeping.h>
@@ -250,6 +255,16 @@ static inline bool __qdf_system_time_after_eq(__qdf_time_t a, __qdf_time_t b)
 	return (long)(a) - (long)(b) >= 0;
 }
 
+/**
+ * qdf_sched_clock() - use light weight timer to get timestamp
+ *
+ * Return: timestamp in ns
+ */
+static inline uint64_t __qdf_sched_clock(void)
+{
+	return sched_clock();
+}
+
 /**
  * __qdf_get_monotonic_boottime() - get monotonic kernel boot time
  * This API is similar to qdf_get_system_boottime but it includes