• Petr Machata's avatar
    mlxsw: spectrum: PTP: Support timestamping on Spectrum-1 · d92e4e6e
    Petr Machata authored
    On Spectrum-1, timestamps arrive through a pair of dedicated events:
    MLXSW_TRAP_ID_PTP_ING_FIFO and _EGR_FIFO. The payload delivered with
    those traps is contents of the timestamp FIFO at a given port in a given
    direction. Add a Spectrum-1-specific handler for these two events which
    decodes the timestamps and forwards them to the PTP module.
    
    Add a function that parses a packet, dispatching to ptp_classify_raw(),
    and decodes PTP message type, domain number, and sequence ID. Add a new
    mlxsw dependency on the PTP classifier.
    
    Add helpers that can store and retrieve unmatched timestamps and SKBs to
    the hash table added in a preceding patch.
    
    Add the matching code itself: upon arrival of a timestamp or a packet,
    look up the corresponding unmatched entry, and match it up. If there is
    none, add a new unmatched entry. This logic is the same on ingress as on
    egress.
    
    Packets and timestamps that never matched need to be eventually disposed
    of. A garbage collector added in a follow-up patch will take care of
    that. Since currently all this code is turned off, no crud will
    accumulate in the hash table.
    Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
    Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d92e4e6e
spectrum.c 176 KB