Skip to content

Commit 8058c89

Browse files
christopher-s-hallgregkh
authored andcommitted
igc: move ktime snapshot into PTM retry loop
[ Upstream commit cd7f732 ] 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()") Reviewed-by: Michal Swiatkowski <[email protected]> Tested-by: Mor Bar-Gabay <[email protected]> Tested-by: Avigail Dahan <[email protected]> Signed-off-by: Christopher S M Hall <[email protected]> Reviewed-by: Corinna Vinschen <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Acked-by: Vinicius Costa Gomes <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent b74137e commit 8058c89

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/net/ethernet/intel/igc/igc_ptp.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,16 +1011,16 @@ static int igc_phc_get_syncdevicetime(ktime_t *device,
10111011
int err, count = 100;
10121012
ktime_t t1, t2_curr;
10131013

1014-
/* Get a snapshot of system clocks to use as historic value. */
1015-
ktime_get_snapshot(&adapter->snapshot);
1016-
1014+
/* Doing this in a loop because in the event of a
1015+
* badly timed (ha!) system clock adjustment, we may
1016+
* get PTM errors from the PCI root, but these errors
1017+
* are transitory. Repeating the process returns valid
1018+
* data eventually.
1019+
*/
10171020
do {
1018-
/* Doing this in a loop because in the event of a
1019-
* badly timed (ha!) system clock adjustment, we may
1020-
* get PTM errors from the PCI root, but these errors
1021-
* are transitory. Repeating the process returns valid
1022-
* data eventually.
1023-
*/
1021+
/* Get a snapshot of system clocks to use as historic value. */
1022+
ktime_get_snapshot(&adapter->snapshot);
1023+
10241024
igc_ptm_trigger(hw);
10251025

10261026
err = readx_poll_timeout(rd32, IGC_PTM_STAT, stat,

0 commit comments

Comments
 (0)