Skip to content

igc: Fix PTM timeout

Christopher S M Hall intel-wired-lan netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 6 repliesIn review
  2. v24 patches 8 repliesSuperseded
  3. v15 patches 9 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6igc: Ensure the PTM cycle is reliably triggereddrivers/net/ethernet/intel/igc/igc_defines.h drivers/net/ethernet/intel/igc/igc_ptp.c+42 -290 replies
2/6igc: Lengthen the hardware retry time to prevent timeoutsdrivers/net/ethernet/intel/igc/igc_defines.h+1 -14 replies
3/6igc: Move ktime snapshot into PTM retry loopdrivers/net/ethernet/intel/igc/igc_ptp.c+9 -90 replies
4/6igc: Handle the IGC_PTP_ENABLED flag correctlydrivers/net/ethernet/intel/igc/igc_ptp.c+7 -00 replies
5/6igc: Cleanup PTP module if probe failsdrivers/net/ethernet/intel/igc/igc_main.c+1 -00 replies
6/6igc: Add lock preventing multiple simultaneous PTM transactionsdrivers/net/ethernet/intel/igc/igc.h drivers/net/ethernet/intel/igc/igc_ptp.c+19 -20 replies

Reviews trailers per patch

3 of 6 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMichal SwiatkowskiMor Bar-GabayAvigail DahanCorinna Vinschen
SeriesR-b
1/6R-b T-b T-b
2/6R-b T-b T-b
3/6R-b T-b T-b
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH iwl-net v3 0/6] igc: Fix PTM timeout

There have been sporadic reports of PTM timeouts using i225/i226 devices

These timeouts have been root caused to:

1) Manipulating the PTM status register while PTM is enabled and triggered
2) The hardware retrying too quickly when an inappropriate response is received from the upstream device

The issue can be reproduced with the following:

$ sudo phc2sys -R 1000 -O 0 -i tsn0 -m

Note: 1000 Hz (-R 1000) is unrealistically large, but provides a way to quickly reproduce the issue.

PHC2SYS exits with:

"ioctl PTP_OFFSET_PRECISE: Connection timed out" when the PTM transaction
fails

Additional problem description tested by:
Corinna Vinschen <[email protected]>

This patch also fixes a hang in igc_probe() when loading the igc driver in the kdump kernel on systems supporting PTM.

The igc driver running in the base kernel enables PTM trigger in igc_probe(). Therefore the driver is always in PTM trigger mode, except in brief periods when manually triggering a PTM cycle.

When a crash occurs, the NIC is reset while PTM trigger is enabled. Due to a hardware problem, the NIC is subsequently in a bad busmaster state and doesn't handle register reads/writes. When running igc_probe() in the kdump kernel, the first register access to a NIC register hangs driver probing and ultimately breaks kdump.

With this patch, igc has PTM trigger disabled most of the time, and the trigger is only enabled for very brief (10 - 100 us) periods when manually triggering a PTM cycle. Chances that a crash occurs during a PTM trigger are not zero, but extremly reduced.

Changelog:

v1 -> v2: -Removed patch modifying PTM retry loop count
-Moved PTM mutex initialization from igc_reset() to igc_ptp_init()
called once in igc_probe()
v2 -> v3: -Added mutex_destroy() to clean up PTM lock
-Added missing checks for PTP enabled flag called from igc_main.c -Cleanup PTP module if probe fails
-Wrap all access to PTM registers with PTM lock/unlock

Christopher S M Hall (6):
igc: Ensure the PTM cycle is reliably triggered
igc: Lengthen the hardware retry time to prevent timeouts
igc: Move ktime snapshot into PTM retry loop
igc: Handle the IGC_PTP_ENABLED flag correctly
igc: Cleanup PTP module if probe fails
igc: Add lock preventing multiple simultaneous PTM transactions

 drivers/net/ethernet/intel/igc/igc.h         |   1 +
 drivers/net/ethernet/intel/igc/igc_defines.h |   3 +-
 drivers/net/ethernet/intel/igc/igc_main.c    |   1 +
 drivers/net/ethernet/intel/igc/igc_ptp.c     | 113 ++++++++++++-------
 4 files changed, 78 insertions(+), 40 deletions(-)
Signature · 1 line
2.34.1