]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ice/ptp: Use provided clock ID for history snapshot
authorThomas Gleixner <tglx@kernel.org>
Fri, 29 May 2026 20:00:40 +0000 (22:00 +0200)
committerThomas Gleixner <tglx@kernel.org>
Thu, 4 Jun 2026 09:04:16 +0000 (11:04 +0200)
The PTP core indicates in system_device_crosststamp::clock_id the clock ID
for which then system time stamp should be taken. That allows to utilize
hardware timestamps with e.g. AUX clocks.

Save the provided clock ID and use it in ice_capture_crosststamp() for
taking the history snapshot.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Arthur Kiyanovski <akiyano@amazon.com>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260529195557.587226681@kernel.org
drivers/net/ethernet/intel/ice/ice_ptp.c

index 36df742c326c77dff6813797f13483ef8660f66c..f9e4ec6f7ebb69dd18431a1f511cf9edc786aa21 100644 (file)
@@ -2065,11 +2065,13 @@ static const struct ice_crosststamp_cfg ice_crosststamp_cfg_e830 = {
 /**
  * struct ice_crosststamp_ctx - Device cross timestamp context
  * @snapshot: snapshot of system clocks for historic interpolation
+ * @snapshot_clock_id: System clock ID for @snapshot
  * @pf: pointer to the PF private structure
  * @cfg: pointer to hardware configuration for cross timestamp
  */
 struct ice_crosststamp_ctx {
        struct system_time_snapshot snapshot;
+       clockid_t snapshot_clock_id;
        struct ice_pf *pf;
        const struct ice_crosststamp_cfg *cfg;
 };
@@ -2115,7 +2117,7 @@ static int ice_capture_crosststamp(ktime_t *device,
        }
 
        /* Snapshot system time for historic interpolation */
-       ktime_get_snapshot(&ctx->snapshot);
+       ktime_get_snapshot_id(ctx->snapshot_clock_id, &ctx->snapshot);
 
        /* Program cmd to master timer */
        ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
@@ -2176,6 +2178,7 @@ static int ice_ptp_getcrosststamp(struct ptp_clock_info *info,
 {
        struct ice_pf *pf = ptp_info_to_pf(info);
        struct ice_crosststamp_ctx ctx = {
+               .snapshot_clock_id = cts->clock_id,
                .pf = pf,
        };