[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1396891830.2874.38.camel@joe-AO722>
Date: Mon, 07 Apr 2014 10:30:30 -0700
From: Joe Perches <joe@...ches.com>
To: David Miller <davem@...emloft.net>
Cc: therbert@...gle.com, netdev@...r.kernel.org
Subject: Re: [PATCH next-next 4/6] net: Call skb_checksum_init in IPv4
On Mon, 2014-04-07 at 13:13 -0400, David Miller wrote:
> From: Tom Herbert <therbert@...gle.com>
> Date: Fri, 4 Apr 2014 17:27:36 -0700 (PDT)
>
> > @@ -1454,6 +1454,13 @@ out_unlock:
> > return err;
> > }
> >
> > +__wsum inet_pseudo_compute(struct sk_buff *skb, int proto)
> > +{
> > + return csum_tcpudp_nofold(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
> > + skb->len, proto, 0);
> > +}
> > +EXPORT_SYMBOL(inet_pseudo_compute);
>
> This is just adjusting arguments passed into to another inline
> function, please put this in a header and make it an inline too.
as ip_hdr involves a calculation via
include/linux/ip.h:static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
include/linux/ip.h-{
include/linux/ip.h- return (struct iphdr *)skb_network_header(skb);
include/linux/ip.h-}
and
include/linux/skbuff.h:static inline unsigned char *skb_network_header(const struct sk_buff *skb)
include/linux/skbuff.h-{
include/linux/skbuff.h- return skb->head + skb->network_header;
include/linux/skbuff.h-}
I believe you could save an addition by using a temporary for ip_hdr
static inline __wsum inet_pseudo_compute(struct sk_buff *skb, int proto)
{
const struct iphdr *iph = ip_hdr(skb);
return csum_tcpudp_nofold(iph->saddr, iph->daddr, skb->len, proto, 0);
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists