Skip to content

mlxsw: Add PTP support for Spectrum-2 and newer ASICs

Ido Schimmel netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 6 repliesApplied 9/9

Patches in v1 All 9 applied

#Subject and filesSizeRepliesApplied
1/9mlxsw: spectrum_ptp: Add helper functions to configure PTP trapsdrivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c+40 -220 repliesApplied
2/9mlxsw: Support CQEv2 for SDQ in Spectrum-2 and newer ASICsdrivers/net/ethernet/mellanox/mlxsw/core.c drivers/net/ethernet/mellanox/mlxsw/core.h drivers/net/ethernet/mellanox/mlxsw/pci.c +1 more+15 -20 repliesApplied
3/9mlxsw: spectrum_ptp: Add PTP initialization / finalization for Spectrum-2drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h+54 -70 repliesApplied
4/9mlxsw: Query UTC sec and nsec PCI offsets and valuesdrivers/net/ethernet/mellanox/mlxsw/core.c drivers/net/ethernet/mellanox/mlxsw/core.h drivers/net/ethernet/mellanox/mlxsw/pci.c+55 -00 repliesApplied
5/9mlxsw: spectrum_ptp: Add implementation for physical hardware clock operationsdrivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h+159 -70 repliesApplied
6/9mlxsw: Send PTP packets as data packets to overcome a limitationdrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +1 more+175 -100 repliesApplied
7/9mlxsw: spectrum: Support time stamping on Spectrum-2drivers/net/ethernet/mellanox/mlxsw/core.h drivers/net/ethernet/mellanox/mlxsw/pci.c drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +1 more+104 -100 repliesApplied
8/9mlxsw: spectrum_ptp: Support SIOCGHWTSTAMP, SIOCSHWTSTAMP ioctlsdrivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h+223 -90 repliesApplied
9/9mlxsw: spectrum: Support ethtool 'get_ts_info' callback in Spectrum-2drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h+28 -60 repliesApplied

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by.

PatchPetr Machata
1/9R-b
2/9R-b
3/9R-b
4/9R-b
5/9R-b
6/9R-b
7/9R-b
8/9R-b
9/9R-b

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

Read the v1 thread

Cover letter [PATCH net-next 0/9] mlxsw: Add PTP support for Spectrum-2 and newer ASICs

This patchset adds PTP support for Spectrum-{2,3,4} switch ASICs. They all act largely the same with respect to PTP except for a workaround implemented for Spectrum-{2,3} in patch #6.

Spectrum-2 and newer ASICs essentially implement a transparent clock between all the switch ports, including the CPU port. The hardware will generate the UTC time stamp for transmitted / received packets at the CPU port, but will compensate for forwarding delays in the ASIC by adjusting the correction field in the PTP header (for PTP events) at the ingress and egress ports.

Specifically, the hardware will subtract the current time stamp from the correction field at the ingress port and will add the current time stamp to the correction field at the egress port. For the purpose of an ordinary or boundary clock (this patchset), the correction field will always be adjusted between the CPU port and one of the front panel ports, but never between two front panel ports.

Patchset overview:

Patch #1 extracts a helper to configure traps for PTP packets (event and general messages). The helper is shared between all Spectrum generations.

Patch #2 transitions Spectrum-2 and newer ASICs to use a different format of Tx completions that includes the UTC time stamp of transmitted packets.

Patch #3 adds basic initialization required for Spectrum-2 PTP support. It mainly invokes the helper from patch #1.

Patch #4 adds helpers to read the UTC time (seconds and nanoseconds) from the device over memory-mapped I/O instead of going through firmware which is slower and therefore inaccurate. The helpers will be used to implement various PHC operations (e.g., gettimex64) and to construct the full UTC time stamp from the truncated one reported over Tx / Rx completions.

Patch #5 implements the various PHC operations.

Patch #6 implements the previously described workaround for Spectrum-{2,3}.

Patch #7 adds the ability to report a hardware time stamp for a received / transmitted packet based off the associated Rx / Tx completion that includes a truncated UTC time stamp.

Patches #8 and #9 implement support for the SIOCGHWTSTAMP / SIOCSHWTSTAMP ioctls and the get_ts_info ethtool callback, respectively.

Amit Cohen (1):
mlxsw: spectrum_ptp: Add helper functions to configure PTP traps

Danielle Ratson (8):
mlxsw: Support CQEv2 for SDQ in Spectrum-2 and newer ASICs
mlxsw: spectrum_ptp: Add PTP initialization / finalization for
Spectrum-2
mlxsw: Query UTC sec and nsec PCI offsets and values
mlxsw: spectrum_ptp: Add implementation for physical hardware clock
operations
mlxsw: Send PTP packets as data packets to overcome a limitation
mlxsw: spectrum: Support time stamping on Spectrum-2
mlxsw: spectrum_ptp: Support SIOCGHWTSTAMP, SIOCSHWTSTAMP ioctls
mlxsw: spectrum: Support ethtool 'get_ts_info' callback in Spectrum-2

 drivers/net/ethernet/mellanox/mlxsw/core.c    |  18 +
 drivers/net/ethernet/mellanox/mlxsw/core.h    |  14 +
 drivers/net/ethernet/mellanox/mlxsw/pci.c     |  64 +-
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 118 +++-
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |  10 +
 .../ethernet/mellanox/mlxsw/spectrum_ptp.c    | 576 +++++++++++++++++-
 .../ethernet/mellanox/mlxsw/spectrum_ptp.h    |  60 +-
 7 files changed, 820 insertions(+), 40 deletions(-)
Signature · 1 line
2.36.1