From: Florian Westphal <fw@strlen.de>
To: Tom Herbert <tom@herbertland.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, jiri@resnulli.us
Subject: Re: [PATCH net-next 1/7] net: Add skb_get_hash_perturb
Date: Wed, 29 Apr 2015 09:59:47 +0200 [thread overview]
Message-ID: <20150429075947.GB30392@breakpoint.cc> (raw)
In-Reply-To: <1430281661-2271966-2-git-send-email-tom@herbertland.com>
Tom Herbert <tom@herbertland.com> wrote:
> This is used to get the skb->hash and then perturb it for a local use.
>
> Signed-off-by: Tom Herbert <tom@herbertland.com>
> ---
> include/linux/skbuff.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 66e374d..b706889 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>
> @@ -927,6 +928,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);
Whats this perturb for?
perturb is supposed to make sure that if you have
flow1, flow2 where hash(flow1, perturb) == hash(flow2, perturb)
the collision will be temporary and go away once perturb changes.
If you perturb after hashing, such collision is permanent.
So I think this either should flow_dissect + hash in software,
or just use skb_get_hash without perturb.
next prev parent reply other threads:[~2015-04-29 7:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 4:27 [PATCH net-next 0/7] net: Eliminate calls to flow_dissector and introduce flow_keys_digest Tom Herbert
2015-04-29 4:27 ` [PATCH net-next 1/7] net: Add skb_get_hash_perturb Tom Herbert
2015-04-29 7:59 ` Florian Westphal [this message]
2015-04-29 11:19 ` Eric Dumazet
2015-04-29 19:51 ` Tom Herbert
2015-04-29 4:27 ` [PATCH net-next 2/7] sched: Eliminate use of flow_keys in sch_fq_codel Tom Herbert
2015-04-29 4:27 ` [PATCH net-next 3/7] sched: Eliminate use of flow_keys in sch_hhf Tom Herbert
2015-04-29 4:27 ` [PATCH net-next 4/7] sched: Eliminate use of flow_keys in sch_sfb Tom Herbert
2015-04-29 4:27 ` [PATCH net-next 5/7] sched: Eliminate use of flow_keys in sch_sfq Tom Herbert
2015-04-29 4:27 ` [PATCH net-next 6/7] net: Add flow_keys digest Tom Herbert
2015-04-29 5:15 ` Eric Dumazet
2015-04-29 4:27 ` [PATCH net-next 7/7] sch_choke: Use flow_keys_digest 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=20150429075947.GB30392@breakpoint.cc \
--to=fw@strlen.de \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=tom@herbertland.com \
/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).