netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Romain Gantois <romain.gantois@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	 Vladimir Oltean <olteanv@gmail.com>,
	 Alexandre Torgue <alexandre.torgue@foss.st.com>,
	 Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org,
	 Maxime Chevallier <maxime.chevallier@bootlin.com>,
	 Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 Linus Walleij <linus.walleij@linaro.org>
Subject: DSA tags seem to break checksum offloading on DWMAC100
Date: Fri, 15 Dec 2023 10:54:27 +0100 (CET)	[thread overview]
Message-ID: <c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com> (raw)


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

             reply	other threads:[~2023-12-15  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  9:54 Romain Gantois [this message]
2023-12-15 10:30 ` DSA tags seem to break checksum offloading on DWMAC100 Andrew Lunn
2023-12-15 13:45   ` Vladimir Oltean
2023-12-16  6:15 ` Richard Tresidder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com \
    --to=romain.gantois@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).