Add ice_rx_hwtstamp trace event to help debug PTP rx timestamp issues. The trace captures cached_time, ts_high, and the extended ts_ns value in ice_ptp_get_rx_hwts(). Enable with: echo 1 > /sys/kernel/debug/tracing/events/ice/ice_rx_hwtstamp/enable cat /sys/kernel/debug/tracing/trace_pipe Signed-off-by: Przemyslaw Korba --- drivers/net/ethernet/intel/ice/ice_ptp.c | 2 ++ drivers/net/ethernet/intel/ice/ice_trace.h | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 691f05c62d4e..07e621813ff5 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -2333,6 +2333,8 @@ u64 ice_ptp_get_rx_hwts(const union ice_32b_rx_flex_desc *rx_desc, ts_high = le32_to_cpu(rx_desc->wb.flex_ts.ts_high); ts_ns = ice_ptp_extend_32b_ts(cached_time, ts_high); + ice_trace(rx_hwtstamp, cached_time, ts_high, ts_ns); + return ts_ns; } diff --git a/drivers/net/ethernet/intel/ice/ice_trace.h b/drivers/net/ethernet/intel/ice/ice_trace.h index 4f35ef8d6b29..3cb8c6ea03cf 100644 --- a/drivers/net/ethernet/intel/ice/ice_trace.h +++ b/drivers/net/ethernet/intel/ice/ice_trace.h @@ -241,6 +241,24 @@ DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_fw_req); DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_fw_done); DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_complete); +/* Trace event for Rx timestamp */ +TRACE_EVENT(ice_rx_hwtstamp, + TP_PROTO(u64 cached_time, u32 ts_high, u64 ts_ns), + + TP_ARGS(cached_time, ts_high, ts_ns), + + TP_STRUCT__entry(__field(u64, cached_time) + __field(u32, ts_high) + __field(u64, ts_ns)), + + TP_fast_assign(__entry->cached_time = cached_time; + __entry->ts_high = ts_high; + __entry->ts_ns = ts_ns;), + + TP_printk("cached_time=%llu ts_high=%u ts_ns=%llu", + __entry->cached_time, __entry->ts_high, __entry->ts_ns) +); + DECLARE_EVENT_CLASS(ice_esw_br_fdb_template, TP_PROTO(struct ice_esw_br_fdb_entry *fdb), TP_ARGS(fdb), base-commit: 5c0d2ac5900d689d422a31cd45073175150c0a39 -- 2.43.0