Re: [PATCH net 3/3] net: dsa: felix: don't drop PTP frames with tag_8021q when RX timestamping is disabled

From: Vladimir Oltean
Date: Tue Jun 27 2023 - 11:12:32 EST


On Mon, Jun 26, 2023 at 06:40:03PM +0300, Vladimir Oltean wrote:
> drivers/net/dsa/ocelot/felix.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
> index 80861ac090ae..7b494d975073 100644
> --- a/drivers/net/dsa/ocelot/felix.c
> +++ b/drivers/net/dsa/ocelot/felix.c
> @@ -1725,6 +1725,9 @@ static bool felix_rxtstamp(struct dsa_switch *ds, int port,
> u32 tstamp_hi;
> u64 tstamp;
>
> + if (ocelot->ports[port]->ptp_rx_filter == HWTSTAMP_FILTER_NONE)
> + return false;
> +
> /* If the "no XTR IRQ" workaround is in use, tell DSA to defer this skb
> * for RX timestamping. Then free it, and poll for its copy through
> * MMIO in the CPU port module, and inject that into the stack from
> --
> 2.34.1
>
>

This is still not as good as I had wanted it, because simply checking
for HWTSTAMP_FILTER_NONE does not distinguish between L2 and L4
timestamping filters, and a port configured just with L2 traps will
still drop L4 PTP packets.

Preparing a v2.