From: Tom Herbert <therbert@google.com>
To: davem@davemloft.net, netdev@vger.kernel.org,
eric.dumazet@gmail.com, fw@strlen.de
Subject: [PATCH net-next 1/6] net: Add skb_get_hash_perturb
Date: Sun, 1 Mar 2015 14:09:44 -0800 [thread overview]
Message-ID: <1425247789-21211-2-git-send-email-therbert@google.com> (raw)
In-Reply-To: <1425247789-21211-1-git-send-email-therbert@google.com>
This is used to get the skb->hash and then perturb it for a local use.
Signed-off-by: Tom Herbert <therbert@google.com>
---
include/linux/skbuff.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d898b32..48c1978 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -17,6 +17,7 @@
#include <linux/kernel.h>
#include <linux/kmemcheck.h>
#include <linux/compiler.h>
+#include <linux/jhash.h>
#include <linux/time.h>
#include <linux/bug.h>
#include <linux/cache.h>
@@ -922,6 +923,20 @@ static inline __u32 skb_get_hash(struct sk_buff *skb)
return skb->hash;
}
+static inline __u32 skb_get_hash_perturb(struct sk_buff *skb,
+ u32 perturb)
+{
+ u32 hash = skb_get_hash(skb);
+
+ if (likely(hash)) {
+ hash = jhash_1word((__force __u32) hash, perturb);
+ if (unlikely(!hash))
+ hash = 1;
+ }
+
+ return hash;
+}
+
static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
{
return skb->hash;
--
2.2.0.rc0.207.ga3a616c
next prev parent reply other threads:[~2015-03-01 22:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-01 22:09 [PATCH RFC net-next 0/6] net: Call skb_get_hash in net/sched Tom Herbert
2015-03-01 22:09 ` Tom Herbert [this message]
2015-03-01 22:09 ` [PATCH net-next 2/6] sched: Eliminate use of flow_keys in sch_choke Tom Herbert
2015-03-01 22:09 ` [PATCH net-next 3/6] sched: Eliminate use of flow_keys in sch_fq_codel Tom Herbert
2015-03-01 22:09 ` [PATCH net-next 4/6] sched: Eliminate use of flow_keys in sch_hhf Tom Herbert
2015-03-01 22:09 ` [PATCH net-next 5/6] sched: Eliminate use of flow_keys in sch_sfb Tom Herbert
2015-03-01 22:09 ` [PATCH net-next 6/6] sched: Eliminate use of flow_keys in sch_sfq Tom Herbert
2015-03-02 0:58 ` Eric Dumazet
2015-03-02 4:06 ` David Miller
2015-03-02 15:31 ` Tom Herbert
2015-03-02 16:25 ` Tom Herbert
2015-03-02 19:28 ` Eric Dumazet
2015-03-02 19:34 ` Tom Herbert
2015-03-02 19:43 ` Eric Dumazet
2015-03-02 19:51 ` Tom Herbert
2015-03-02 20:02 ` Eric Dumazet
2015-03-02 19:24 ` Eric Dumazet
2015-03-03 21:00 ` Tom Herbert
-- strict thread matches above, loose matches on Subject: below --
2015-03-04 18:39 [PATCH net-next 0/6] net: Call skb_get_hash in qdiscs Tom Herbert
2015-03-04 18:39 ` [PATCH net-next 1/6] net: Add skb_get_hash_perturb Tom Herbert
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=1425247789-21211-2-git-send-email-therbert@google.com \
--to=therbert@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).