igc: move ktime snapshot into PTM retry loop
[ Upstream commit cd7f7328d691937102732f39f97ead35b15bf803 ]
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: a90ec84837
("igc: Add support for PTP getcrosststamp()")
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Mor Bar-Gabay <morx.bar.gabay@intel.com>
Tested-by: Avigail Dahan <avigailx.dahan@intel.com>
Signed-off-by: Christopher S M Hall <christopher.s.hall@intel.com>
Reviewed-by: Corinna Vinschen <vinschen@redhat.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b1f3e69dc9
commit
5262d34f5e
@@ -980,16 +980,16 @@ static int igc_phc_get_syncdevicetime(ktime_t *device,
|
|||||||
int err, count = 100;
|
int err, count = 100;
|
||||||
ktime_t t1, t2_curr;
|
ktime_t t1, t2_curr;
|
||||||
|
|
||||||
/* Get a snapshot of system clocks to use as historic value. */
|
/* Doing this in a loop because in the event of a
|
||||||
ktime_get_snapshot(&adapter->snapshot);
|
* 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 {
|
do {
|
||||||
/* Doing this in a loop because in the event of a
|
/* Get a snapshot of system clocks to use as historic value. */
|
||||||
* badly timed (ha!) system clock adjustment, we may
|
ktime_get_snapshot(&adapter->snapshot);
|
||||||
* get PTM errors from the PCI root, but these errors
|
|
||||||
* are transitory. Repeating the process returns valid
|
|
||||||
* data eventually.
|
|
||||||
*/
|
|
||||||
igc_ptm_trigger(hw);
|
igc_ptm_trigger(hw);
|
||||||
|
|
||||||
err = readx_poll_timeout(rd32, IGC_PTM_STAT, stat,
|
err = readx_poll_timeout(rd32, IGC_PTM_STAT, stat,
|
||||||
|
Reference in New Issue
Block a user