The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Himangi Saraogi <himangi774@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	James Morris <jmorris@namei.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Patrick McHardy <kaber@trash.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH] net/udp_offload: Drop unnecessary continue
Date: Wed, 13 Aug 2014 10:06:45 -0700	[thread overview]
Message-ID: <20140813170644.GA13556@its-macbook-pro.westell.com> (raw)
In-Reply-To: <1407941291.6804.7.camel@edumazet-glaptop2.roam.corp.google.com>

On Wed, Aug 13, 2014 at 07:48:11AM -0700, Eric Dumazet wrote:
> On Wed, 2014-08-13 at 14:46 +0530, Himangi Saraogi wrote:
> > Continue is not needed at the bottom of a loop.
> > 
> > The Coccinelle semantic patch implementing this change is:
> > 
> > @@
> > @@
> > 
> > for (...;...;...) {
> >   ...
> >   if (...) {
> >     ...
> > -   continue;
> >   }
> > }
> > 
> > Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> > Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> > ---
> >  net/ipv4/udp_offload.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
> > index 59035bc..62d5b9b 100644
> > --- a/net/ipv4/udp_offload.c
> > +++ b/net/ipv4/udp_offload.c
> > @@ -269,10 +269,8 @@ unflush:
> >  			continue;
> >  
> >  		uh2 = (struct udphdr   *)(p->data + off);
> > -		if ((*(u32 *)&uh->source != *(u32 *)&uh2->source)) {
> > +		if ((*(u32 *)&uh->source != *(u32 *)&uh2->source))
> >  			NAPI_GRO_CB(p)->same_flow = 0;
> > -			continue;
> > -		}
> >  	}
> >  
> >  	skb_gro_pull(skb, sizeof(struct udphdr)); /* pull encapsulating udp header */
> 
> 
> Please do not do that.
> 
> If we add another check later, we'll miss that the 'continue;' needs to
> be put back.
> 
> GRO stack is quite difficult to maintain, I prefer we keep this as is
> for consistency and code readability.

+1
this code as-is is definitely more readable


      reply	other threads:[~2014-08-13 17:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13  9:16 [PATCH] net/udp_offload: Drop unnecessary continue Himangi Saraogi
2014-08-13 14:48 ` Eric Dumazet
2014-08-13 17:06   ` Alexei Starovoitov [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=20140813170644.GA13556@its-macbook-pro.westell.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=himangi774@gmail.com \
    --cc=jmorris@namei.org \
    --cc=julia.lawall@lip6.fr \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --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