Skip to content

Commit

Permalink
igc: Move ktime snapshot into PTM retry loop
Browse files Browse the repository at this point in the history
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: a90ec84 ("igc: Add support for PTP getcrosststamp()")
Signed-off-by: Christopher S M Hall <[email protected]>
  • Loading branch information
christopher-s-hall authored and Kishor408 committed Sep 25, 2024
1 parent 6289221 commit ff0b0c5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions drivers/net/ethernet/intel/igc/igc_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,16 +1079,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);

/* 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 {
/* 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.
*/
/* 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,
Expand Down

0 comments on commit ff0b0c5

Please sign in to comment.