Skip to content

igc: TX timestamping fixes

Vinicius Costa Gomes intel-wired-lan 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 4 repliesIn review
  2. v34 patches 3 repliesSuperseded
  3. v24 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v15 patches8 repliesSuperseded

Changes in v4 from the cover letter

- Improved commit message, added more details about how to trigger the hardware issue, and more details about the alternative workaround to the cover letter (Paul Menzel);

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4igc: Fix race condition in PTP tx codedrivers/net/ethernet/intel/igc/igc.h drivers/net/ethernet/intel/igc/igc_main.c drivers/net/ethernet/intel/igc/igc_ptp.c+43 -321 reply
2/4igc: Check if hardware TX timestamping is enabled earlierdrivers/net/ethernet/intel/igc/igc.h drivers/net/ethernet/intel/igc/igc_main.c drivers/net/ethernet/intel/igc/igc_ptp.c+43 -51 reply
3/4igc: Retrieve TX timestamp during interrupt handlingdrivers/net/ethernet/intel/igc/igc.h drivers/net/ethernet/intel/igc/igc_main.c drivers/net/ethernet/intel/igc/igc_ptp.c+7 -121 reply
4/4igc: Work around HW bug causing missing timestampsdrivers/net/ethernet/intel/igc/igc_ptp.c+37 -111 reply

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchKurt KanzenbachNaama Meir
1/4R-b T-b
2/4T-b
3/4R-b T-b
4/4T-b

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

Read the v4 thread

Cover letter [Intel-wired-lan] [PATCH iwl-net v4 0/4] igc: TX timestamping fixes

Hi,

Changes from v3:
- Improved commit message, added more details about how to trigger the hardware issue, and more details about the alternative workaround to the cover letter (Paul Menzel);

Changes from v2:
- Fixed possible race condition when disabling TX timestamping, added a per queue flag, should make the hot path (no timestamps enabled) a bit nicer (Jakub Kicinski);
- Renamed the igc_ptp_tx_work() to something more sensible (it's no longer called in a workqueue) (Marc Kleine-Budde);
- Added some numbers, from the cover letter, to the commit message itself (Paul Menzel);

Changes from v1:
- Squashed 3/5 into 1/5 (from v1), into 2/4 (v2) (Tony Nguyen);
- Improved the commit message of 1/4 (Kurt Kanzenbach);
- Added "Reviewed-by:" tags;

v1 link:
https://lore.kernel.org/intel-wired-lan/[email protected]/

Changes from the "for-next-queue" version:
- As this is intended for the iwl/net-queue tree, removed adding support for adding the "extra" tstamp registers;
- Added "Fixes:" tags to the appropriate patches (Vladimir Oltean);
- Improved the check to catch the case that the skb has the SKBTX_HW_TSTAMP flag, but TX timestamping is not enabled (Vladimir Oltean);
- Ony check for timestamping timeouts if TX timestamping is enabled (Vladimir Oltean);

for-next-queue version link:
https://lore.kernel.org/intel-wired-lan/[email protected]/

This is the fixes part of the series intended to add support for using the 4 timestamp registers present in i225/i226.

Moving the timestamp handling to be inline with the interrupt handling has the advantage of improving the TX timestamping retrieval latency, here are some numbers using ntpperf:

Before:

$ sudo ./ntpperf -i enp3s0 -m 10:22:22:22:22:21 -d 192.168.1.3 -s 172.18.0.0/16 -I -H -o -37
               |          responses            |     TX timestamp offset (ns)
rate   clients |  lost invalid   basic  xleave |    min    mean     max stddev
1000       100   0.00%   0.00%   0.00% 100.00%      -56      +9     +52     19
1500       150   0.00%   0.00%   0.00% 100.00%      -40     +30     +75     22
2250       225   0.00%   0.00%   0.00% 100.00%      -11     +29     +72     15
3375       337   0.00%   0.00%   0.00% 100.00%      -18     +40     +88     22
5062       506   0.00%   0.00%   0.00% 100.00%      -19     +23     +77     15
7593       759   0.00%   0.00%   0.00% 100.00%       +7     +47   +5168     43
11389     1138   0.00%   0.00%   0.00% 100.00%      -11     +41   +5240     39
17083     1708   0.00%   0.00%   0.00% 100.00%      +19     +60   +5288     50
25624     2562   0.00%   0.00%   0.00% 100.00%       +1     +56   +5368     58
38436     3843   0.00%   0.00%   0.00% 100.00%      -84     +12   +8847     66
57654     5765   0.00%   0.00% 100.00%   0.00%
86481     8648   0.00%   0.00% 100.00%   0.00%
129721   12972   0.00%   0.00% 100.00%   0.00%
194581   16384   0.00%   0.00% 100.00%   0.00%
291871   16384  27.35%   0.00%  72.65%   0.00%
437806   16384  50.05%   0.00%  49.95%   0.00%

After:

$ sudo ./ntpperf -i enp3s0 -m 10:22:22:22:22:21 -d 192.168.1.3 -s 172.18.0.0/16 -I -H -o -37
               |          responses            |     TX timestamp offset (ns)
rate   clients |  lost invalid   basic  xleave |    min    mean     max stddev
1000       100   0.00%   0.00%   0.00% 100.00%      -44      +0     +61     19
1500       150   0.00%   0.00%   0.00% 100.00%       -6     +39     +81     16
2250       225   0.00%   0.00%   0.00% 100.00%      -22     +25     +69     15
3375       337   0.00%   0.00%   0.00% 100.00%      -28     +15     +56     14
5062       506   0.00%   0.00%   0.00% 100.00%       +7     +78    +143     27
7593       759   0.00%   0.00%   0.00% 100.00%      -54     +24    +144     47
11389     1138   0.00%   0.00%   0.00% 100.00%      -90     -33     +28     21
17083     1708   0.00%   0.00%   0.00% 100.00%      -50      -2     +35     14
25624     2562   0.00%   0.00%   0.00% 100.00%      -62      +7     +66     23
38436     3843   0.00%   0.00%   0.00% 100.00%      -33     +30   +5395     36
57654     5765   0.00%   0.00% 100.00%   0.00%
86481     8648   0.00%   0.00% 100.00%   0.00%
129721   12972   0.00%   0.00% 100.00%   0.00%
194581   16384  19.50%   0.00%  80.50%   0.00%
291871   16384  35.81%   0.00%  64.19%   0.00%
437806   16384  55.40%   0.00%  44.60%   0.00%

During this series, and to show that as is always the case, things are never easy as they should be, a hardware issue was found, and it took some time to find the workaround(s). The bug and workaround are better explained in patch 5/5.

Note: the workaround has an alternative, we could use the first set of timestamp registers (TXSTMP{H/L}_0) as *only* a way to clear the interrupt, and the problem won't manifest. But that means that we would only have 3 sets of "useful" registers to store timestamps, wasting the first set. Support for these extra registers is going to added in a later series. My impression is that wasting these resources is not a good a idea, as it is already easy to request more timestamps than what can be serviced by the hardware.

Also, as Marc Kleine-Budde suggested, after some consensus is reached on this series, most parts of it will be proposed for igb.

Vinicius Costa Gomes (4):
igc: Fix race condition in PTP tx code
igc: Check if hardware TX timestamping is enabled earlier
igc: Retrieve TX timestamp during interrupt handling
igc: Work around HW bug causing missing timestamps

 drivers/net/ethernet/intel/igc/igc.h      |   8 +-
 drivers/net/ethernet/intel/igc/igc_main.c |  14 ++-
 drivers/net/ethernet/intel/igc/igc_ptp.c  | 146 +++++++++++++++-------
 3 files changed, 119 insertions(+), 49 deletions(-)
Signature · 6 lines
2.40.1

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