netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* DSA tags seem to break checksum offloading on DWMAC100
@ 2023-12-15  9:54 Romain Gantois
  2023-12-15 10:30 ` Andrew Lunn
  2023-12-16  6:15 ` Richard Tresidder
  0 siblings, 2 replies; 4+ messages in thread
From: Romain Gantois @ 2023-12-15  9:54 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Vladimir Oltean, Alexandre Torgue,
	Jose Abreu
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, Maxime Chevallier, Thomas Petazzoni, Linus Walleij


A similar issue was just reported for a different MAC driver:

https://lore.kernel.org/netdev/20231215-new-gemini-ethernet-regression-v1-2-93033544be23@linaro.org/T/#u

Hello everyone,

I was rebasing on net-next an out-of-tree stmmac driver for the RZN1 GMAC
IP, and I noticed that something broke all TCP transmissions going through the
GMAC1 Ethernet controller. This MAC controller was connected to a 88E6352
Marvell switch through its CPU port. Further investigation revealed that
egressing packets had an invalid TCP checksum, which caused them to be dropped
at the receiving side's kernel.

A bisection on the transmitting side's kernel showed that the commit that caused
the bug was:

    6b2c6e4a938f (net: stmmac: propagate feature flags to vlan, 2023-04-17)

This stmmac patch makes it so that most of the feature flags of stmmac net
devices are copied to its vlan features. Some of these flags are then
transmitted to DSA user devices. The NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM flags 
that control checksum offloading, are responsible for the bug.

Relevant call chain: 
dsa_user_xmit -> ...[packet is tagged] -> __dev_queue_xmit \
-> validate_xmit_skb and stmmac_xmit

If checksum offloading is enabled, stmmac will set it in hardware at the
following location:

https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/stmicro/stmmac/enh_desc.c#L322

Then the hardware computes an incorrect checksum. I believe that this is caused
by the presence of DSA tags in the frames, although I can't be 100% sure of
this.

So it seems like a solution is needed to prevent checksum offloading by Ethernet
drivers when DSA tags are in used. I'm not sure how this would be done, since
DSA is purposefully kept quite separate from CPU port drivers. What are your
thoughts on this?

Best Regards,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-16  6:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15  9:54 DSA tags seem to break checksum offloading on DWMAC100 Romain Gantois
2023-12-15 10:30 ` Andrew Lunn
2023-12-15 13:45   ` Vladimir Oltean
2023-12-16  6:15 ` Richard Tresidder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).