From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>,
Coco Li <lixiaoyan@google.com>,
"David S. Miller" <davem@davemloft.net>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Michael Chan <michael.chan@broadcom.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/2] IPv6/GRO: generic helper to remove temporary HBH/jumbo header in driver
Date: Tue, 29 Nov 2022 14:41:20 +0100 [thread overview]
Message-ID: <20221129134120.3084527-1-alexandr.lobakin@intel.com> (raw)
In-Reply-To: <9480856d183c88a205fd79d9dbc156a7fd3ea0d3.camel@redhat.com>
From: Paolo Abeni <pabeni@redhat.com>
Date: Tue, 29 Nov 2022 10:33:59 +0100
> Hello,
>
> Only a couple of minor things below, reporting them as this is still a
> RFC, right ? ;)
>
> On Wed, 2022-11-23 at 11:16 -0800, Coco Li wrote:
[...]
> > +static inline int ipv6_hopopt_jumbo_remove(struct sk_buff *skb)
I thinks it's relatively small and inlineable enough to not make it
an external function, right? I'd keep it inline just how the author
does it, the compiler then will decide.
> > +{
> > + const int hophdr_len = sizeof(struct hop_jumbo_hdr);
> > + int nexthdr = ipv6_has_hopopt_jumbo(skb);
> > + struct ipv6hdr *h6;
> > + int err = 0;
> > +
> > + if (!nexthdr)
> > + return err;
>
> You can help a bit the compiler avoiding err initialization:
>
> int err;
>
> if (!nexthdr)
> return 0;
Same with the end of the function, @err is unused after
skb_cow_head() and always equal 0, so the end return could be just
`return 0`.
>
> > +
> > + err = skb_cow_head(skb, 0);
> > + if (err)
> > + return err;
> > +
> > + /* Remove the HBH header.
> > + * Layout: [Ethernet header][IPv6 header][HBH][L4 Header]
> > + */
> > + memmove(skb_mac_header(skb) + hophdr_len, skb_mac_header(skb),
> > + skb_network_header(skb) - skb_mac_header(skb) +
>
> The have could be:
>
> skb_mac_header_len(skb)
>
> which is IMHO a little more clear.
>
> Thanks!
>
> Paolo
Thanks,
Olek
prev parent reply other threads:[~2022-11-29 13:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 19:16 Coco Li
2022-11-23 19:16 ` [RFC net-next v2 2/2] bnxt: Use generic HBH removal helper in tx path Coco Li
2022-11-23 19:42 ` Michael Chan
2022-11-23 20:42 ` Michael Chan
2022-11-29 8:58 ` Michael Chan
2022-11-29 17:29 ` Coco Li
2022-11-29 17:50 ` Michael Chan
2022-11-29 9:33 ` [PATCH net-next v2 1/2] IPv6/GRO: generic helper to remove temporary HBH/jumbo header in driver Paolo Abeni
2022-11-29 13:41 ` Alexander Lobakin [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=20221129134120.3084527-1-alexandr.lobakin@intel.com \
--to=alexandr.lobakin@intel.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lixiaoyan@google.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yoshfuji@linux-ipv6.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
all inboxes | Powered by JetHome®