[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbq=X485QuFvdd8Q=pPE0Hy4CduBbRZH7mdqag=mQw0ag@mail.gmail.com>
Date: Tue, 19 Dec 2023 00:41:59 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Hans Ulli Kroll <ulli.kroll@...glemail.com>, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net v2 2/2] net: ethernet: cortina: Bypass checksumming
engine of alien ethertypes
On Mon, Dec 18, 2023 at 3:50 PM Eric Dumazet <edumazet@...gle.com> wrote:
> On Sat, Dec 16, 2023 at 8:36 PM Linus Walleij <linus.walleij@...aro.org> wrote:
> > + /* Dig out the the ethertype actually in the buffer and not what the
> > + * protocol claims to be. This is the raw data that the checksumming
> > + * offload engine will have to deal with.
> > + */
> > + p = (__be16 *)(skb->data + 2 * ETH_ALEN);
> > + ethertype = ntohs(*p);
> > + if (ethertype == ETH_P_8021Q) {
> > + p += 2; /* +2 sizeof(__be16) */
> > + ethertype = ntohs(*p);
> > + }
>
> Presumably all you need is to call vlan_get_protocol() ?
Sadly no. As the comment says: we want the ethertype that is actually in the
skb, not what is in skb->protocol, and the code in vlan_get_protocol() just
trusts skb->protocol to be the ethertype in the frame, especially if vlan
is not used.
This is often what we want: DSA switches will "wash" custom ethertypes
before they go out, but in this case the custom ethertype upsets the
ethernet checksum engine used as conduit interface toward the DSA
switch.
Yours,
Linus Walleij
Powered by blists - more mailing lists