net: lan966x: Fix 1-step timestamping over ipv4 or ipv6
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Wed, 21 May 2025 12:41:59 +0000 (14:41 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Mon, 26 May 2025 19:44:15 +0000 (21:44 +0200)
commit57ee9584fd8606deef66d7b65fa4dcf94f6843aa
treed8e99e5a7f5af7116fe368106695fc883c14f47b
parent45ca7e9f0730ae36fc610e675b990e9cc9ca0714
net: lan966x: Fix 1-step timestamping over ipv4 or ipv6

When enabling 1-step timestamping for ptp frames that are over udpv4 or
udpv6 then the inserted timestamp is added at the wrong offset in the
frame, meaning that will modify the frame at the wrong place, so the
frame will be malformed.
To fix this, the HW needs to know which kind of frame it is to know
where to insert the timestamp. For that there is a field in the IFH that
says the PDU_TYPE, which can be NONE  which is the default value,
IPV4 or IPV6. Therefore make sure to set the PDU_TYPE so the HW knows
where to insert the timestamp.
Like I mention before the issue is not seen with L2 frames because by
default the PDU_TYPE has a value of 0, which represents the L2 frames.

Fixes: 77eecf25bd9d2f ("net: lan966x: Update extraction/injection for timestamping")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://patch.msgid.link/20250521124159.2713525-1-horatiu.vultur@microchip.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/microchip/lan966x/lan966x_main.c
drivers/net/ethernet/microchip/lan966x/lan966x_main.h
drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c