aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher S M Hall <[email protected]>2025-04-01 23:35:31 +0000
committerTony Nguyen <[email protected]>2025-04-11 16:13:28 +0000
commitcd7f7328d691937102732f39f97ead35b15bf803 (patch)
tree3b6e166b1e0dafa3d0077a5ac0e2d24db5436e4e
parentigc: increase wait time before retrying PTM (diff)
downloadkernel-cd7f7328d691937102732f39f97ead35b15bf803.tar.gz
kernel-cd7f7328d691937102732f39f97ead35b15bf803.zip
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: a90ec8483732 ("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]>
-rw-r--r--drivers/net/ethernet/intel/igc/igc_ptp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c
index c640e346342b..516abe7405de 100644
--- a/drivers/net/ethernet/intel/igc/igc_ptp.c
+++ b/drivers/net/ethernet/intel/igc/igc_ptp.c
@@ -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);
-
+ /* 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,