public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Miller <davem@davemloft.net>
Cc: therbert@google.com, netdev@vger.kernel.org
Subject: Re: [PATCH next-next 4/6] net: Call skb_checksum_init in IPv4
Date: Mon, 07 Apr 2014 10:30:30 -0700	[thread overview]
Message-ID: <1396891830.2874.38.camel@joe-AO722> (raw)
In-Reply-To: <20140407.131356.1060173493402786873.davem@davemloft.net>

On Mon, 2014-04-07 at 13:13 -0400, David Miller wrote:
> From: Tom Herbert <therbert@google.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);
}

      reply	other threads:[~2014-04-07 17:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-05  0:27 [PATCH next-next 4/6] net: Call skb_checksum_init in IPv4 Tom Herbert
2014-04-07 17:13 ` David Miller
2014-04-07 17:30   ` Joe Perches [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=1396891830.2874.38.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    /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