[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACKFLim_KBajprWKRsk2pT3uEXR=1CfHKngSQH5o4AyBnjf3og@mail.gmail.com>
Date: Sat, 24 Apr 2021 16:28:51 -0700
From: Michael Chan <michael.chan@...adcom.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: David Miller <davem@...emloft.net>,
Netdev <netdev@...r.kernel.org>,
Andrew Gospodarek <gospo@...adcom.com>
Subject: Re: [PATCH net-next 10/10] bnxt_en: Implement .ndo_features_check().
On Sat, Apr 24, 2021 at 2:52 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Sat, 24 Apr 2021 16:14:31 -0400 Michael Chan wrote:
> > + features = vlan_features_check(skb, features);
> > + if (!skb->encapsulation)
> > + return features;
> > +
> > + switch (vlan_get_protocol(skb)) {
> > + case htons(ETH_P_IP):
> > + l4_proto = ip_hdr(skb)->protocol;
> > + break;
> > + case htons(ETH_P_IPV6):
> > + l4_proto = ipv6_hdr(skb)->nexthdr;
> > + break;
> > + default:
> > + return features;
> > + }
> > +
> > + /* For UDP, we can only handle 1 Vxlan port and 1 Geneve port. */
> > + if (l4_proto == IPPROTO_UDP) {
> > + struct bnxt *bp = netdev_priv(dev);
> > + __be16 udp_port = udp_hdr(skb)->dest;
> > +
> > + if (udp_port != bp->vxlan_port && udp_port != bp->nge_port)
> > + return features & ~(NETIF_F_CSUM_MASK |
> > + NETIF_F_GSO_MASK);
> > + }
> > + return features;
>
> This is still written a little too much like a block list.
>
> What if, for example it's a UDP tunnel but with extension headers?
> Is there any particular case that is served by not writing it as:
>
> if (l4_proto == UDP && (port == bp->vxl_port ||
> port == bp->nge_port))
> return features;
> return features & ~(CSUM | GSO);
> ?
Sure, I can change it to check for port == instead of port != to make
it more straight forward.
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4209 bytes)
Powered by blists - more mailing lists