]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum: Support time stamping on Spectrum-2
authorDanielle Ratson <danieller@nvidia.com>
Wed, 27 Jul 2022 06:23:26 +0000 (09:23 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Jul 2022 10:02:24 +0000 (11:02 +0100)
commita2eb8f3a11dca7c1ffdfe11046ab37eaf848befc
treeaa6ce18620eb090fb72cd5984c72303ae8ea9544
parent9478f836ad53c4fb67f11e0dcd478d0998461877
mlxsw: spectrum: Support time stamping on Spectrum-2

As opposed to Spectrum-1, in which time stamps arrive through a pair of
dedicated events into a queue and later are being matched to the
corresponding packets, in Spectrum-2 we are reading the time stamps
directly from the CQE. Software can get the time stamp in UTC format
using CQEv2.

Add a time stamp field to 'struct mlxsw_skb_cb'. In
mlxsw_pci_cqe_{rdq,sdq}_handle() extract the time stamp from the CQE into
the new time stamp field. Note that the time stamp in the CQE is
represented by 38 bits, which is a short representation of UTC time.
Software should create the full time stamp using the global UTC clock.
Read UTC clock from hardware only for PTP packets which were trapped to CPU
with PTP0 trap ID (event packets).

Use the time stamp from the SKB when packet is received or transmitted.

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.h
drivers/net/ethernet/mellanox/mlxsw/pci.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h