ice: retry acquiring hardware semaphore during cross-timestamp request
authorKarol Kolacinski <karol.kolacinski@intel.com>
Tue, 25 Jul 2023 21:50:47 +0000 (14:50 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 18 Sep 2023 17:39:09 +0000 (10:39 -0700)
commit097c317afe0a582cfbf04506f368ee3a3ad0ae74
tree757615038f89e76f16a86113b99a55442dd14aad
parent40326b2b4296052039ef1f71330f920063ca1096
ice: retry acquiring hardware semaphore during cross-timestamp request

The hardware for performing a cross-timestamp on E822 uses a hardware
semaphore which we must acquire before initiating the cross-timestamp
operation.

The current implementation only attempts to acquire the semaphore once, and
assumes that it will succeed. If the semaphore is busy for any reason, the
cross-timestamp operation fails with -EFAULT.

Instead of immediately failing, try the acquire the lock a few times with a
small sleep between attempts. This ensures that most requests will go
through without issue.

Additionally, return -EBUSY instead of -EFAULT if the operation can't
continue due to the semaphore being busy.

Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_ptp.c