netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: David Miller <davem@davemloft.net>,
	Netdev <netdev@vger.kernel.org>,
	Andrew Gospodarek <gospo@broadcom.com>
Subject: Re: [PATCH net-next 10/10] bnxt_en: Implement .ndo_features_check().
Date: Sat, 24 Apr 2021 16:28:51 -0700	[thread overview]
Message-ID: <CACKFLim_KBajprWKRsk2pT3uEXR=1CfHKngSQH5o4AyBnjf3og@mail.gmail.com> (raw)
In-Reply-To: <20210424145205.1bfbdb06@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]

On Sat, Apr 24, 2021 at 2:52 PM Jakub Kicinski <kuba@kernel.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.

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

      reply	other threads:[~2021-04-24 23:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-24 20:14 [PATCH net-next 00/10] bnxt_en: Updates for net-next Michael Chan
2021-04-24 20:14 ` [PATCH net-next 01/10] bnxt_en: report signal mode in link up messages Michael Chan
2021-04-24 20:14 ` [PATCH net-next 02/10] bnxt_en: Add a new phy_flags field to the main driver structure Michael Chan
2021-04-24 20:14 ` [PATCH net-next 03/10] bnxt_en: Add support for fw managed link down feature Michael Chan
2021-04-24 20:14 ` [PATCH net-next 04/10] bnxt_en: allow promiscuous mode for trusted VFs Michael Chan
2021-04-24 20:14 ` [PATCH net-next 05/10] bnxt_en: allow VF config ops when PF is closed Michael Chan
2021-04-24 20:14 ` [PATCH net-next 06/10] bnxt_en: Move bnxt_approve_mac() Michael Chan
2021-04-24 20:14 ` [PATCH net-next 07/10] bnxt_en: Call bnxt_approve_mac() after the PF gives up control of the VF MAC Michael Chan
2021-04-24 20:14 ` [PATCH net-next 08/10] bnxt_en: Add PCI IDs for Hyper-V VF devices Michael Chan
2021-04-24 20:14 ` [PATCH net-next 09/10] bnxt_en: Support IFF_SUPP_NOFCS feature to transmit without ethernet FCS Michael Chan
2021-04-24 20:14 ` [PATCH net-next 10/10] bnxt_en: Implement .ndo_features_check() Michael Chan
2021-04-24 21:52   ` Jakub Kicinski
2021-04-24 23:28     ` Michael Chan [this message]

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='CACKFLim_KBajprWKRsk2pT3uEXR=1CfHKngSQH5o4AyBnjf3og@mail.gmail.com' \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=gospo@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).