[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <13c4a8b2-89a8-428c-baad-a366ff6ab8b0@lunn.ch>
Date: Fri, 23 May 2025 14:59:05 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Horatiu Vultur <horatiu.vultur@...rochip.com>
Cc: hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
richardcochran@...il.com, kory.maincent@...tlin.com,
wintera@...ux.ibm.com, viro@...iv.linux.org.uk,
quentin.schulz@...tlin.com, atenart@...nel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: phy: mscc: Stop clearing the the UDPv4 checksum
for L2 frames
On Fri, May 23, 2025 at 10:27:16AM +0200, Horatiu Vultur wrote:
> We have noticed that when PHY timestamping is enabled, L2 frames seems
> to be modified by changing two 2 bytes with a value of 0. The place were
> these 2 bytes seems to be random(or I couldn't find a pattern). In most
> of the cases the userspace can ignore these frames but if for example
> those 2 bytes are in the correction field there is nothing to do. This
> seems to happen when configuring the HW for IPv4 even that the flow is
> not enabled.
> These 2 bytes correspond to the UDPv4 checksum and once we don't enable
> clearing the checksum when using L2 frames then the frame doesn't seem
> to be changed anymore.
>
> Fixes: 7d272e63e0979d ("net: phy: mscc: timestamping and PHC support")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@...rochip.com>
> ---
> drivers/net/phy/mscc/mscc_ptp.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_ptp.c
> index 6f96f2679f0bf..6b800081eed52 100644
> --- a/drivers/net/phy/mscc/mscc_ptp.c
> +++ b/drivers/net/phy/mscc/mscc_ptp.c
> @@ -946,7 +946,9 @@ static int vsc85xx_ip1_conf(struct phy_device *phydev, enum ts_blk blk,
> /* UDP checksum offset in IPv4 packet
> * according to: https://tools.ietf.org/html/rfc768
> */
> - val |= IP1_NXT_PROT_UDP_CHKSUM_OFF(26) | IP1_NXT_PROT_UDP_CHKSUM_CLEAR;
> + val |= IP1_NXT_PROT_UDP_CHKSUM_OFF(26);
> + if (enable)
> + val |= IP1_NXT_PROT_UDP_CHKSUM_CLEAR;
Is this towards the media, or received from the media? Have you tried
sending packets with deliberately broken UDPv4 checksum? Does the PHYs
PTP engine correctly ignore such packets?
I suppose the opposite could also be true. Do you see it ignoring
frames which are actually O.K? It could be looking in the wrong place
for the checksum, so the checksum fails.
Andrew
Powered by blists - more mailing lists