]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum: PTP: Garbage-collect unmatched entries
authorPetr Machata <petrm@mellanox.com>
Sun, 30 Jun 2019 06:04:57 +0000 (09:04 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jul 2019 01:58:34 +0000 (18:58 -0700)
commit45a0b3506df6d18b8815c28620dd4343eb02e1c6
treec59dbd47b5805a282b89f5983b112baa1fb2c4e6
parentad67800afb9fcd4ccc5fbf7f212216957e355479
mlxsw: spectrum: PTP: Garbage-collect unmatched entries

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: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c