Skip to content

ice: improve Tx timestamp corner cases

Jacob Keller intel-wired-lan 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest15 patches 2 repliesIn review
  2. v215 patches 15 repliesSuperseded
  3. v115 patches 15 repliesSuperseded

Changes in v3 from the cover letter

* Dropped incorrect/useless locking around init in ice_ptp_tx_tstamp
* Added patch to call sychronize_irq during teardown of Tx tracker
* Renamed and refactored "ts_handled" into "more_timestamps" for clarity
* Moved all initialization of Tx tracker to before spin_lock_init

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15ice: Use more generic names for ice_ptp_tx fieldsdrivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp.h+19 -180 replies
2/15ice: Remove the E822 vernier "bypass" logicdrivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp_hw.c drivers/net/ethernet/intel/ice/ice_ptp_hw.h+14 -1450 replies
3/15ice: Reset TS memory for all quadsdrivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp_hw.c drivers/net/ethernet/intel/ice/ice_ptp_hw.h+42 -270 replies
4/15ice: fix misuse of "link err" with "link status"drivers/net/ethernet/intel/ice/ice_ptp.c+1 -10 replies
5/15ice: always call ice_ptp_link_change and make it voiddrivers/net/ethernet/intel/ice/ice_main.c drivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp.h+19 -210 replies
6/15ice: handle discarding old Tx requests in ice_ptp_tx_tstampdrivers/net/ethernet/intel/ice/ice_ptp.c+48 -630 replies
7/15ice: check Tx timestamp memory register for ready timestampsdrivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp.h drivers/net/ethernet/intel/ice/ice_ptp_hw.c +1 more+126 -120 replies
8/15ice: synchronize the misc IRQ when tearing down Tx trackerdrivers/net/ethernet/intel/ice/ice_ptp.c+6 -41 reply
9/15ice: protect init and calibrating check in ice_ptp_request_tsdrivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp.h+33 -71 reply
10/15ice: disable Tx timestamps while link is downdrivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp.h+12 -10 replies
11/15ice: cleanup allocations in ice_ptp_alloc_tx_trackerdrivers/net/ethernet/intel/ice/ice_ptp.c+11 -70 replies
12/15ice: handle flushing stale Tx timestamps in ice_ptp_tx_tstampdrivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp.h+69 -350 replies
13/15ice: only check set bits in ice_ptp_flush_tx_trackerdrivers/net/ethernet/intel/ice/ice_ptp.c+29 -90 replies
14/15ice: make Tx and Rx vernier offset calibration independentdrivers/net/ethernet/intel/ice/ice_ptp.c drivers/net/ethernet/intel/ice/ice_ptp_hw.c drivers/net/ethernet/intel/ice/ice_ptp_hw.h+91 -1730 replies
15/15ice: reschedule ice_ptp_wait_for_offset_valid during resetdrivers/net/ethernet/intel/ice/ice_ptp.c+6 -10 replies

Reviews trailers per patch

None of the 15 patches has a Reviewed-by or Acked-by.

PatchGurucharan G
1/15T-b
2/15T-b
3/15T-b
4/15T-b
5/15T-b
6/15T-b
7/15T-b
8/15T-b
9/15T-b
10/15T-b
11/15T-b
12/15T-b
13/15T-b
14/15T-b
15/15T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [Intel-wired-lan] [PATCH net-next v3 00/15] ice: improve Tx timestamp corner cases

v1 was posted at https://lore.kernel.org/intel-wired-lan/[email protected]/
v2 was posted at https://lore.kernel.org/intel-wired-lan/[email protected]/
v2 was also published to netdev as https://lore.kernel.org/netdev/[email protected]/

Changes since v1:
* Dropped ETH56G reference
* Fixed commit messages which used e8<NN> instead of E8<NN> when describing device families
* Dropped an unnecessary else statement
* Switched an ice_is_e810 check to a flag in ice_ptp_tx
* Fixed checkpatch errors
* Fixed kdoc comments

Changes since v2:
* Dropped incorrect/useless locking around init in ice_ptp_tx_tstamp
* Added patch to call sychronize_irq during teardown of Tx tracker
* Renamed and refactored "ts_handled" into "more_timestamps" for clarity
* Moved all initialization of Tx tracker to before spin_lock_init

Summary
-------

This series of patches primarily consists of changes to fix some corner cases that can cause Tx timestamp failures. The issues were discovered and reported by Siddaraju DH and primarily affect E822 hardware, though this series also includes some improvements that affect E810 hardware as well.

The primary issue is regarding the way that E822 determines when to generate timestamp interrupts. If the driver reads timestamp indexes which do not have a valid timestamp, the E822 interrupt tracking logic can get stuck. This is due to the way that E822 hardware tracks timestamp index reads internally. I was previously unaware of this behavior as it is significantly different in E810 hardware.

Most of the fixes target refactors to ensure that the ice driver does not read timestamp indexes which are not valid on E822 hardware. This is done by using the Tx timestamp ready bitmap register from the PHY. This register indicates what timestamp indexes have outstanding timestamps waiting to be captured.

Care must be taken in all cases where we read the timestamp registers, and thus all flows which might have read these registers are refactored. The ice_ptp_tx_tstamp function is modified to consolidate as much of the logic relating to these registers as possible. It now handles discarding stale timestamps which are old or which occurred after a PHC time update. This replaces previously standalone thread functions like the periodic work function and the ice_ptp_flush_tx_tracker function.

In addition, some minor cleanups noticed while writing these refactors are included.

The remaining patches refactor the E822 implementation to remove the "bypass" mode for timestamps. The E822 hardware has the ability to provide a more precise timestamp by making use of measurements of the precise way that packets flow through the hardware pipeline. These measurements are known as "Vernier" calibration. The "bypass" mode disables many of these measurements in favor of a faster start up time for Tx and Rx timestamping. Instead, once these measurements were captured, the driver tries to reconfigure the PHY to enable the vernier calibrations.

Unfortunately this recalibration does not work. Testing indicates that the PHY simply remains in bypass mode without the increased timestamp precision. Remove the attempt at recalibration and always use vernier mode. This has one disadvantage that Tx and Rx timestamps cannot begin until after at least one packet of that type goes through the hardware pipeline. Because of this, further refactor the driver to separate Tx and Rx vernier calibration. Complete the Tx and Rx independently, enabling the appropriate type of timestamp as soon as the relevant packet has traversed the hardware pipeline. This was reported by Milena Olech.

Note that although these might be considered "bug fixes", the required changes in order to appropriately resolve these issues is large. Thus it does not feel suitable to send this series to net.

Jacob Keller (11):
ice: fix misuse of "link err" with "link status"
ice: always call ice_ptp_link_change and make it void
ice: handle discarding old Tx requests in ice_ptp_tx_tstamp
ice: check Tx timestamp memory register for ready timestamps
ice: synchronize the misc IRQ when tearing down Tx tracker
ice: protect init and calibrating check in ice_ptp_request_ts
ice: disable Tx timestamps while link is down
ice: cleanup allocations in ice_ptp_alloc_tx_tracker
ice: handle flushing stale Tx timestamps in ice_ptp_tx_tstamp
ice: only check set bits in ice_ptp_flush_tx_tracker
ice: reschedule ice_ptp_wait_for_offset_valid during reset

Karol Kolacinski (1):
ice: Reset TS memory for all quads

Milena Olech (1):
ice: Remove the E822 vernier "bypass" logic

Sergey Temerkhanov (1):
ice: Use more generic names for ice_ptp_tx fields

Siddaraju DH (1):
ice: make Tx and Rx vernier offset calibration independent

 drivers/net/ethernet/intel/ice/ice_main.c   |   9 +-
 drivers/net/ethernet/intel/ice/ice_ptp.c    | 556 ++++++++++----------
 drivers/net/ethernet/intel/ice/ice_ptp.h    |  41 +-
 drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 336 ++++++------
 drivers/net/ethernet/intel/ice/ice_ptp_hw.h |   8 +-
 5 files changed, 476 insertions(+), 474 deletions(-)

base-commit: 343a5d358e4ab5597e90e1eafa7eba55eb42e96b

Signature · 6 lines
2.38.1.420.g319605f8f00e

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan