]> git.dujemihanovic.xyz Git - linux.git/commit
igc: Work around HW bug causing missing timestamps
authorVinicius Costa Gomes <vinicius.gomes@intel.com>
Wed, 7 Jun 2023 21:32:32 +0000 (14:32 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 22 Jun 2023 15:22:35 +0000 (08:22 -0700)
commitc789ad7cbebcac5d5f417296c140a1252c689524
tree2e1f8e7f12b946233e912b9254cb0371e8912854
parentafa141583d82725f682b2fa762cb36a07f58b3f3
igc: Work around HW bug causing missing timestamps

There's an hardware issue that can cause missing timestamps. The bug
is that the interrupt is only cleared if the IGC_TXSTMPH_0 register is
read.

The bug can cause a race condition if a timestamp is captured at the
wrong time, and we will miss that timestamp. To reduce the time window
that the problem is able to happen, in case no timestamp was ready, we
read the "previous" value of the timestamp registers, and we compare
with the "current" one, if it didn't change we can be reasonably sure
that no timestamp was captured. If they are different, we use the new
value as the captured timestamp.

The HW bug is not easy to reproduce, got to reproduce it when smashing
the NIC with timestamping requests from multiple applications (e.g.
multiple ntpperf instances + ptp4l), after 10s of minutes.

This workaround has more impact when multiple timestamp registers are
used, and the IGC_TXSTMPH_0 register always need to be read, so the
interrupt is cleared.

Fixes: 2c344ae24501 ("igc: Add support for TX timestamping")
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/igc/igc_ptp.c