[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221129134120.3084527-1-alexandr.lobakin@intel.com>
Date: Tue, 29 Nov 2022 14:41:20 +0100
From: Alexander Lobakin <alexandr.lobakin@...el.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Alexander Lobakin <alexandr.lobakin@...el.com>,
Coco Li <lixiaoyan@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Michael Chan <michael.chan@...adcom.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/2] IPv6/GRO: generic helper to remove temporary HBH/jumbo header in driver
From: Paolo Abeni <pabeni@...hat.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
Powered by blists - more mailing lists