mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Himangi Saraogi <himangi774@gmail.com>
Cc: "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 07:48:11 -0700	[thread overview]
Message-ID: <1407941291.6804.7.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <20140813091605.GA2947@himangi-Dell>

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.

Every time we clear same_flow, we use the "continue;" construct.

 if (...) {
     NAPI_GRO_CB(p)->same_flow = 0;
     continue;
 }

<here we can eventually add some other check>

Compiler generates the same code anyway.




  reply	other threads:[~2014-08-13 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13  9:16 Himangi Saraogi
2014-08-13 14:48 ` Eric Dumazet [this message]
2014-08-13 17:06   ` Alexei Starovoitov

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=1407941291.6804.7.camel@edumazet-glaptop2.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --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

all inboxes | Powered by JetHome®