netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <therbert@google.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH net-next 3/6] flow_dissector: Add hash_extra field to flow_keys struct
Date: Fri, 27 Feb 2015 19:11:46 -0800	[thread overview]
Message-ID: <1425093109-1077-4-git-send-email-therbert@google.com> (raw)
In-Reply-To: <1425093109-1077-1-git-send-email-therbert@google.com>

This will be used for additional input into the hash computation
such as VLAN ID or GRE keyid.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 include/net/flow_keys.h   | 1 +
 include/net/sch_generic.h | 2 +-
 net/core/flow_dissector.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index dc8fd81..d498ee8 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -24,6 +24,7 @@ struct flow_keys {
 	};
 	u16	thoff;
 	__be16	n_proto;
+	__be32	hash_extra;
 	u8	ip_proto;
 };
 
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c605d30..d41a034 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -252,7 +252,7 @@ struct qdisc_skb_cb {
 	unsigned int		pkt_len;
 	u16			slave_dev_queue_mapping;
 	u16			_pad;
-#define QDISC_CB_PRIV_LEN 20
+#define QDISC_CB_PRIV_LEN 24
 	unsigned char		data[QDISC_CB_PRIV_LEN];
 };
 
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index f73a248..84bb794 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -286,7 +286,7 @@ static inline u32 __flow_hash_from_keys(struct flow_keys *keys)
 		swap(keys->port16[0], keys->port16[1]);
 	}
 
-	extra = keys->ip_proto;
+	extra = keys->ip_proto ^ keys->hash_extra;
 	hash = __flow_hash_3words((__force u32)keys->dst ^ extra,
 				  (__force u32)keys->src,
 				  (__force u32)keys->ports);
-- 
2.2.0.rc0.207.ga3a616c

  parent reply	other threads:[~2015-02-28  3:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28  3:11 [PATCH net-next 0/6] net: Strengthen TX and RX hashes Tom Herbert
2015-02-28  3:11 ` [PATCH net-next 1/6] net: initialize sk_txhash using random value Tom Herbert
2015-02-28  3:11 ` [PATCH net-next 2/6] flow_dissector: Include ip_proto in hash computation Tom Herbert
2015-02-28  3:11 ` Tom Herbert [this message]
2015-02-28  7:37   ` [PATCH net-next 3/6] flow_dissector: Add hash_extra field to flow_keys struct Eric Dumazet
2015-02-28 20:31     ` Florian Westphal
2015-02-28 20:46       ` Dave Taht
2015-03-01 18:16         ` Tom Herbert
2015-03-01 20:09           ` Dave Taht
2015-03-01 17:55       ` Tom Herbert
2015-03-01 18:24         ` Florian Westphal
2015-03-01 19:17           ` Tom Herbert
2015-03-01 19:43             ` Florian Westphal
2015-03-01 19:57           ` Dave Taht
2015-03-01 21:27         ` Eric Dumazet
2015-02-28  3:11 ` [PATCH net-next 4/6] flow_dissector: Include VLAN ID in hash computation Tom Herbert
2015-02-28  3:11 ` [PATCH net-next 5/6] flow_dissector: Include GRE keyid " Tom Herbert
2015-02-28  3:11 ` [PATCH net-next 6/6] flow_dissector: Include MPLS entropy label " 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=1425093109-1077-4-git-send-email-therbert@google.com \
    --to=therbert@google.com \
    --cc=davem@davemloft.net \
    --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).