Patch "net: ethernet: ti: am65-cpts: Fix PTPv1 message type on TX packets" has been added to the 6.1-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: ethernet: ti: am65-cpts: Fix PTPv1 message type on TX packets

to the 6.1-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-ethernet-ti-am65-cpts-fix-ptpv1-message-type-on-.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 96652801a60716058adc64521116655d0dcdfaf2
Author: Jason Reeder <jreeder@xxxxxx>
Date:   Wed Apr 24 12:46:26 2024 +0530

    net: ethernet: ti: am65-cpts: Fix PTPv1 message type on TX packets
    
    [ Upstream commit 1b9e743e923b256e353a9a644195372285e5a6c0 ]
    
    The CPTS, by design, captures the messageType (Sync, Delay_Req, etc.)
    field from the second nibble of the PTP header which is defined in the
    PTPv2 (1588-2008) specification. In the PTPv1 (1588-2002) specification
    the first two bytes of the PTP header are defined as the versionType
    which is always 0x0001. This means that any PTPv1 packets that are
    tagged for TX timestamping by the CPTS will have their messageType set
    to 0x0 which corresponds to a Sync message type. This causes issues
    when a PTPv1 stack is expecting a Delay_Req (messageType: 0x1)
    timestamp that never appears.
    
    Fix this by checking if the ptp_class of the timestamped TX packet is
    PTP_CLASS_V1 and then matching the PTP sequence ID to the stored
    sequence ID in the skb->cb data structure. If the sequence IDs match
    and the packet is of type PTPv1 then there is a chance that the
    messageType has been incorrectly stored by the CPTS so overwrite the
    messageType stored by the CPTS with the messageType from the skb->cb
    data structure. This allows the PTPv1 stack to receive TX timestamps
    for Delay_Req packets which are necessary to lock onto a PTP Leader.
    
    Signed-off-by: Jason Reeder <jreeder@xxxxxx>
    Signed-off-by: Ravi Gunasekaran <r-gunasekaran@xxxxxx>
    Tested-by: Ed Trexel <ed.trexel@xxxxxx>
    Fixes: f6bd59526ca5 ("net: ethernet: ti: introduce am654 common platform time sync driver")
    Link: https://lore.kernel.org/r/20240424071626.32558-1-r-gunasekaran@xxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/ti/am65-cpts.c b/drivers/net/ethernet/ti/am65-cpts.c
index 9948ac14e68db..c1bdf045e9815 100644
--- a/drivers/net/ethernet/ti/am65-cpts.c
+++ b/drivers/net/ethernet/ti/am65-cpts.c
@@ -649,6 +649,11 @@ static bool am65_cpts_match_tx_ts(struct am65_cpts *cpts,
 		struct am65_cpts_skb_cb_data *skb_cb =
 					(struct am65_cpts_skb_cb_data *)skb->cb;
 
+		if ((ptp_classify_raw(skb) & PTP_CLASS_V1) &&
+		    ((mtype_seqid & AM65_CPTS_EVENT_1_SEQUENCE_ID_MASK) ==
+		     (skb_cb->skb_mtype_seqid & AM65_CPTS_EVENT_1_SEQUENCE_ID_MASK)))
+			mtype_seqid = skb_cb->skb_mtype_seqid;
+
 		if (mtype_seqid == skb_cb->skb_mtype_seqid) {
 			u64 ns = event->timestamp;
 




[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