• Danielle Ratson's avatar
    mlxsw: spectrum: Support time stamping on Spectrum-2 · 382ad0d9
    Danielle Ratson authored
    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: default avatarDanielle Ratson <danieller@nvidia.com>
    Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
    Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    382ad0d9
spectrum_ptp.c 39.3 KB