diff --git a/hif/inc/hif.h b/hif/inc/hif.h index f8b7087421..82d7e6f7a6 100644 --- a/hif/inc/hif.h +++ b/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 diff --git a/hif/src/hif_exec.c b/hif/src/hif_exec.c index 97272ba957..1ef58fbe11 100644 --- a/hif/src/hif_exec.c +++ b/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; } diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index a6508414db..8339c85d22 100644 --- a/hif/src/hif_main.h +++ b/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) diff --git a/qdf/inc/qdf_time.h b/qdf/inc/qdf_time.h index 3dfbfcc9a1..ab7d984aa2 100644 --- a/qdf/inc/qdf_time.h +++ b/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) diff --git a/qdf/linux/src/i_qdf_time.h b/qdf/linux/src/i_qdf_time.h index 4ae4bf7713..70d8a13dbd 100644 --- a/qdf/linux/src/i_qdf_time.h +++ b/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 #include #include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) +#include +#else +#include +#endif #include #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) #include @@ -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