net: mscc: ocelot: avoid overflowing the PTP timestamp FIFO
PTP packets with 2-step TX timestamp requests are matched to packets based on the egress port number and a 6-bit timestamp identifier. All PTP timestamps are held in a common FIFO that is 128 entry deep. This patch ensures that back-to-back timestamping requests cannot exceed the hardware FIFO capacity. If that happens, simply send the packets without requesting a TX timestamp to be taken (in the case of felix, since the DSA API has a void return code in ds->ops->port_txtstamp) or drop them (in the case of ocelot). I've moved the ts_id_lock from a per-port basis to a per-switch basis, because we need separate accounting for both numbers of PTP frames in flight. And since we need locking to inc/dec the per-switch counter, that also offers protection for the per-port counter and hence there is no reason to have a per-port counter anymore. Fixes: 4e3b0468 ("net: mscc: PTP Hardware Clock (PHC) support") Signed-off-by:Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by:
Jakub Kicinski <kuba@kernel.org>
Showing
- drivers/net/dsa/ocelot/felix.c 5 additions, 1 deletiondrivers/net/dsa/ocelot/felix.c
- drivers/net/ethernet/mscc/ocelot.c 30 additions, 7 deletionsdrivers/net/ethernet/mscc/ocelot.c
- include/soc/mscc/ocelot.h 4 additions, 1 deletioninclude/soc/mscc/ocelot.h
- include/soc/mscc/ocelot_ptp.h 1 addition, 0 deletionsinclude/soc/mscc/ocelot_ptp.h
Loading
Please register or sign in to comment