• Petr Machata's avatar
    mlxsw: spectrum: PTP: Garbage-collect unmatched entries · 5d23e415
    Petr Machata authored
    On Spectrum-1, timestamped PTP packets and the corresponding timestamps
    need to be kept in caches until both are available, at which point they are
    matched up and packets forwarded as appropriate. However, not all packets
    will ever see their timestamp, and not all timestamps will ever see their
    packet. It is therefore necessary to dispose of such abandoned entries.
    
    To that end, introduce a garbage collector to collect entries that have
    not had their counterpart turn up within about a second. The GC
    maintains a monotonously-increasing value of GC cycle. Every entry that
    is put to the hash table is annotated with the GC cycle at which it
    should be collected. When the GC runs, it walks the hash table, and
    collects the objects according to their GC cycle annotation.
    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>
    5d23e415
spectrum_ptp.c 20.6 KB