Patch "net: dsa: felix: don't drop PTP frames with tag_8021q when RX timestamping is disabled" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: dsa: felix: don't drop PTP frames with tag_8021q when RX timestamping is disabled

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-dsa-felix-don-t-drop-ptp-frames-with-tag_8021q-w.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f480e8b3437f17949221f0ded7bba5a9fd796339
Author: Vladimir Oltean <vladimir.oltean@xxxxxxx>
Date:   Tue Jun 27 19:31:14 2023 +0300

    net: dsa: felix: don't drop PTP frames with tag_8021q when RX timestamping is disabled
    
    [ Upstream commit 2edcfcbb3c5946609be1d8875473a240b170673b ]
    
    The driver implements a workaround for the fact that it doesn't have an
    IRQ source to tell it whether PTP frames are available through the
    extraction registers, for those frames to be processed and passed
    towards the network stack. That workaround is to configure the switch,
    through felix_hwtstamp_set() -> felix_update_trapping_destinations(),
    to create two copies of PTP packets: one sent over Ethernet to the DSA
    master, and one to be consumed through the aforementioned CPU extraction
    queue registers.
    
    The reason why we want PTP packets to be consumed through the CPU
    extraction registers in the first place is because we want to see their
    hardware RX timestamp. With tag_8021q, that is only visible that way,
    and it isn't visible with the copy of the packet that's transmitted over
    Ethernet.
    
    The problem with the workaround implementation is that it drops the
    packet received over Ethernet, in expectation of its copy being present
    in the CPU extraction registers. However, if felix_hwtstamp_set() hasn't
    run (aka PTP RX timestamping is disabled), the driver will drop the
    original PTP frame and there will be no copy of it in the CPU extraction
    registers. So, the network stack will simply not see any PTP frame.
    
    Look at the port's trapping configuration to see whether the driver has
    previously enabled the CPU extraction registers. If it hasn't, just
    don't RX timestamp the frame and let it be passed up the stack by DSA,
    which is perfectly fine.
    
    Fixes: 0a6f17c6ae21 ("net: dsa: tag_ocelot_8021q: add support for PTP timestamping")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 80861ac090ae3..70c0e2b1936b3 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1725,6 +1725,18 @@ static bool felix_rxtstamp(struct dsa_switch *ds, int port,
 	u32 tstamp_hi;
 	u64 tstamp;
 
+	switch (type & PTP_CLASS_PMASK) {
+	case PTP_CLASS_L2:
+		if (!(ocelot->ports[port]->trap_proto & OCELOT_PROTO_PTP_L2))
+			return false;
+		break;
+	case PTP_CLASS_IPV4:
+	case PTP_CLASS_IPV6:
+		if (!(ocelot->ports[port]->trap_proto & OCELOT_PROTO_PTP_L4))
+			return false;
+		break;
+	}
+
 	/* 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux