netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <dborkman@redhat.com>
To: davem@davemloft.net
Cc: jiri@resnulli.us, netdev@vger.kernel.org, Thomas Graf <tgraf@suug.ch>
Subject: [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get
Date: Thu, 22 Jan 2015 10:58:18 +0100	[thread overview]
Message-ID: <1421920699-26556-2-git-send-email-dborkman@redhat.com> (raw)
In-Reply-To: <1421920699-26556-1-git-send-email-dborkman@redhat.com>

As soon as we've found a matching handle in basic_get(), we can
return it. There's no need to continue walking until the end of
a filter chain, since they are unique anyway.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Cc: Thomas Graf <tgraf@suug.ch>
---
 net/sched/cls_basic.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 5aed341..fc399db 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -65,9 +65,12 @@ static unsigned long basic_get(struct tcf_proto *tp, u32 handle)
 	if (head == NULL)
 		return 0UL;
 
-	list_for_each_entry(f, &head->flist, link)
-		if (f->handle == handle)
+	list_for_each_entry(f, &head->flist, link) {
+		if (f->handle == handle) {
 			l = (unsigned long) f;
+			break;
+		}
+	}
 
 	return l;
 }
-- 
1.7.11.7

  reply	other threads:[~2015-01-22  9:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22  9:58 [PATCH net-next 0/2] Minor cls_basic, act_bpf update Daniel Borkmann
2015-01-22  9:58 ` Daniel Borkmann [this message]
2015-01-22 10:01   ` [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get Thomas Graf
2015-01-22  9:58 ` [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation Daniel Borkmann
2015-01-22 16:44   ` Alexei Starovoitov
2015-01-27  0:09 ` [PATCH net-next 0/2] Minor cls_basic, act_bpf update David Miller

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=1421920699-26556-2-git-send-email-dborkman@redhat.com \
    --to=dborkman@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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;
as well as URLs for NNTP newsgroup(s).