]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ice: add tracking of good transmit timestamps
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Fri, 17 Oct 2025 06:08:39 +0000 (23:08 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 21 Oct 2025 01:31:25 +0000 (18:31 -0700)
As a pre-requisite to implementing timestamp statistics, start tracking
successful PTP timestamps. There already existed a trace event, but
add a counter as well so it can be displayed by the next patch.

Good count is a u64 as it is much more likely to be incremented. The
existing error stats are all u32 as before, and are less likely so will
wrap less.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Rinitha S <sx.rinitha@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20251016-jk-iwl-next-2025-10-15-v2-10-ff3a390d9fc6@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_ptp.c
drivers/net/ethernet/intel/ice/ice_ptp.h

index fb0f6365a6d6f17c32dad0ee27111f068887ba24..4f50e952bfb57f756ca63a78ab1aca7792b80905 100644 (file)
@@ -500,6 +500,9 @@ void ice_ptp_complete_tx_single_tstamp(struct ice_ptp_tx *tx)
        if (tstamp) {
                shhwtstamps.hwtstamp = ns_to_ktime(tstamp);
                ice_trace(tx_tstamp_complete, skb, idx);
+
+               /* Count the number of Tx timestamps that succeeded */
+               pf->ptp.tx_hwtstamp_good++;
        }
 
        skb_tstamp_tx(skb, &shhwtstamps);
@@ -558,6 +561,7 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx)
 {
        struct ice_ptp_port *ptp_port;
        unsigned long flags;
+       u32 tstamp_good = 0;
        struct ice_pf *pf;
        struct ice_hw *hw;
        u64 tstamp_ready;
@@ -658,11 +662,16 @@ skip_ts_read:
                if (tstamp) {
                        shhwtstamps.hwtstamp = ns_to_ktime(tstamp);
                        ice_trace(tx_tstamp_complete, skb, idx);
+
+                       /* Count the number of Tx timestamps that succeeded */
+                       tstamp_good++;
                }
 
                skb_tstamp_tx(skb, &shhwtstamps);
                dev_kfree_skb_any(skb);
        }
+
+       pf->ptp.tx_hwtstamp_good += tstamp_good;
 }
 
 /**
index 137f2070a2d9917b6ef91c64d8095810879be291..27016aac4f1e8a751c880794deb1978517f1dbc4 100644 (file)
@@ -237,6 +237,7 @@ struct ice_ptp_pin_desc {
  * @clock: pointer to registered PTP clock device
  * @tstamp_config: hardware timestamping configuration
  * @reset_time: kernel time after clock stop on reset
+ * @tx_hwtstamp_good: number of completed Tx timestamp requests
  * @tx_hwtstamp_skipped: number of Tx time stamp requests skipped
  * @tx_hwtstamp_timeouts: number of Tx skbs discarded with no time stamp
  * @tx_hwtstamp_flushed: number of Tx skbs flushed due to interface closed
@@ -261,6 +262,7 @@ struct ice_ptp {
        struct ptp_clock *clock;
        struct kernel_hwtstamp_config tstamp_config;
        u64 reset_time;
+       u64 tx_hwtstamp_good;
        u32 tx_hwtstamp_skipped;
        u32 tx_hwtstamp_timeouts;
        u32 tx_hwtstamp_flushed;