Subject: RE: [PATCH net-next v2] net: adjust skb_gso_segment() for calling in rx path

From: Cong Wang <[email-masked]>
Date: Wed, 06 Feb 2013 17:30:32 +0800

On Wed, 2013-02-06 at 09:23 +0000, David Laight wrote:
> > +/* openvswitch calls this on rx path, so we need a different check.
> > + */
> > +static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
> > +{
> > +	if (tx_path)
> > +		return skb->ip_summed != CHECKSUM_PARTIAL;
> > +	else
> > +		return skb->ip_summed == CHECKSUM_NONE;
> > +}
> > +
> 
> That code wants a lot of unlikely() added.
> 
> It seems wrong to be adding code a very common path for one
> obscure caller.

Its caller does:

+       if (unlikely(skb_needs_check(skb, tx_path))) {

> 
> Perhaps the caller should be modifying the ip_summed field
> (etc) to match the values expected for a tx skb.
> 

This is even uglier, you need to restore ip_summed after calling
skb_gso_segment().