Commit cd7f7328 authored by Christopher S M Hall's avatar Christopher S M Hall Committed by Tony Nguyen
Browse files

igc: move ktime snapshot into PTM retry loop



Move ktime_get_snapshot() into the loop. If a retry does occur, a more
recent snapshot will result in a more accurate cross-timestamp.

Fixes: a90ec848 ("igc: Add support for PTP getcrosststamp()")
Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: default avatarMor Bar-Gabay <morx.bar.gabay@intel.com>
Tested-by: default avatarAvigail Dahan <avigailx.dahan@intel.com>
Signed-off-by: default avatarChristopher S M Hall <christopher.s.hall@intel.com>
Reviewed-by: default avatarCorinna Vinschen <vinschen@redhat.com>
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Acked-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 714cd033
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -1011,16 +1011,16 @@ static int igc_phc_get_syncdevicetime(ktime_t *device,
	int err, count = 100;
	ktime_t t1, t2_curr;

	/* Get a snapshot of system clocks to use as historic value. */
	ktime_get_snapshot(&adapter->snapshot);

	do {
	/* Doing this in a loop because in the event of a
	 * badly timed (ha!) system clock adjustment, we may
	 * get PTM errors from the PCI root, but these errors
	 * are transitory. Repeating the process returns valid
	 * data eventually.
	 */
	do {
		/* Get a snapshot of system clocks to use as historic value. */
		ktime_get_snapshot(&adapter->snapshot);

		igc_ptm_trigger(hw);

		err = readx_poll_timeout(rd32, IGC_PTM_STAT, stat,