[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1503041004-105572-1-git-send-email-gfree.wind@vip.163.com>
Date: Fri, 18 Aug 2017 15:23:24 +0800
From: gfree.wind@....163.com
To: davem@...emloft.net, netdev@...r.kernel.org
Cc: Gao Feng <gfree.wind@....163.com>
Subject: [PATCH net-next] net: sched: Add the invalid handle check in qdisc_class_find
From: Gao Feng <gfree.wind@....163.com>
Add the invalid handle "0" check to avoid unnecessary search, because
the qdisc uses the skb->priority as the handle value to look up, and
it is "0" usually.
Signed-off-by: Gao Feng <gfree.wind@....163.com>
---
include/net/sch_generic.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 5865db9..107c524 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -393,6 +393,9 @@ static inline unsigned int qdisc_class_hash(u32 id, u32 mask)
struct Qdisc_class_common *cl;
unsigned int h;
+ if (!id)
+ return NULL;
+
h = qdisc_class_hash(id, hash->hashmask);
hlist_for_each_entry(cl, &hash->hash[h], hnode) {
if (cl->classid == id)
--
1.9.1
Powered by blists - more mailing lists