WSL2-Linux-Kernel/drivers/net/ethernet/ti
Jason Reeder 0b289962c4 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@ti.com>
Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Tested-by: Ed Trexel <ed.trexel@hp.com>
Fixes: f6bd59526c ("net: ethernet: ti: introduce am654 common platform time sync driver")
Link: https://lore.kernel.org/r/20240424071626.32558-1-r-gunasekaran@ti.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-02 16:24:46 +02:00
..
Kconfig
Makefile
am65-cpsw-ethtool.c
am65-cpsw-nuss.c net: ethernet: ti: am65-cpsw-nuss: cleanup DMA Channels before using them 2024-04-27 17:05:25 +02:00
am65-cpsw-nuss.h
am65-cpsw-qos.c
am65-cpsw-qos.h
am65-cpsw-switchdev.c
am65-cpsw-switchdev.h
am65-cpts.c net: ethernet: ti: am65-cpts: Fix PTPv1 message type on TX packets 2024-05-02 16:24:46 +02:00
am65-cpts.h
cpmac.c
cpsw-common.c
cpsw-phy-sel.c
cpsw.c net: ethernet: ti: cpsw: enable mac_managed_pm to fix mdio 2024-02-23 08:55:09 +01:00
cpsw.h
cpsw_ale.c net: ethernet: ti: cpsw_ale: Fix cpsw_ale_get_field()/cpsw_ale_set_field() 2023-07-27 08:46:59 +02:00
cpsw_ale.h
cpsw_ethtool.c
cpsw_new.c net: ethernet: ti: cpsw_new: enable mac_managed_pm to fix mdio 2024-02-23 08:55:09 +01:00
cpsw_priv.c
cpsw_priv.h
cpsw_sl.c
cpsw_sl.h
cpsw_switchdev.c
cpsw_switchdev.h
cpts.c
cpts.h
davinci_cpdma.c
davinci_cpdma.h
davinci_emac.c eth: remove copies of the NAPI_POLL_WEIGHT define 2023-10-19 23:05:34 +02:00
davinci_mdio.c
k3-cppi-desc-pool.c
k3-cppi-desc-pool.h
netcp.h
netcp_core.c eth: remove copies of the NAPI_POLL_WEIGHT define 2023-10-19 23:05:34 +02:00
netcp_ethss.c
netcp_sgmii.c
netcp_xgbepcsr.c
tlan.c ethernet: constify references to netdev->dev_addr in drivers 2024-01-05 15:13:37 +01:00
tlan.h