[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220727062328.3134613-1-idosch@nvidia.com>
Date: Wed, 27 Jul 2022 09:23:19 +0300
From: Ido Schimmel <idosch@...dia.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, richardcochran@...il.com, petrm@...dia.com,
amcohen@...dia.com, danieller@...dia.com, mlxsw@...dia.com,
Ido Schimmel <idosch@...dia.com>
Subject: [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(-)
--
2.36.1
Powered by blists - more mailing lists