netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Subject: [PATCH v2 net-next 5/5] net: Add GRE keyid in flow_keys
Date: Mon, 11 May 2015 20:26:44 -0700	[thread overview]
Message-ID: <1431401204-731380-6-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1431401204-731380-1-git-send-email-tom@herbertland.com>

In flow dissector if a GRE header contains a keyid this is saved in the
new extra entropy field of flow_keys. The GRE keyid is then represented
in the flow hash function input.

Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 include/net/flow_keys.h   |  1 +
 net/core/flow_dissector.c | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index 906d47a..779e42f 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -28,6 +28,7 @@ struct flow_keys {
 	u8	padding;
 	u32	vlan_id:12,
 		flow_label:20;
+	u32	extra_entropy;
 
 	union {
 		__be32 ports;
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index de71e42..025b91f 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -195,8 +195,21 @@ ipv6:
 			nhoff += 4;
 			if (hdr->flags & GRE_CSUM)
 				nhoff += 4;
-			if (hdr->flags & GRE_KEY)
+			if (hdr->flags & GRE_KEY) {
+				const __be32 *keyid;
+				__be32 _keyid;
+
+				keyid = __skb_header_pointer(skb, nhoff,
+							     sizeof(_keyid),
+							     data, hlen,
+							     &_keyid);
+				if (!keyid)
+					return false;
+
+				flow->extra_entropy ^= *keyid;
+
 				nhoff += 4;
+			}
 			if (hdr->flags & GRE_SEQ)
 				nhoff += 4;
 			if (proto == htons(ETH_P_TEB)) {
-- 
1.8.1

  parent reply	other threads:[~2015-05-12  3:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12  3:26 [PATCH v2 net-next 0/5] net: Increase inputs to flow_keys hashing Tom Herbert
2015-05-12  3:26 ` [PATCH v2 net-next 1/5] net: Get skb hash over flow_keys structure Tom Herbert
2015-05-12  4:56   ` Eric Dumazet
2015-05-12 14:30     ` David Miller
2015-05-12  3:26 ` [PATCH v2 net-next 2/5] net: Add full IPv6 addresses to flow_keys Tom Herbert
2015-05-12  3:26 ` [PATCH v2 net-next 3/5] net: Add VLAN ID " Tom Herbert
2015-05-12  3:26 ` [PATCH v2 net-next 4/5] net: Add IPv6 flow label " Tom Herbert
2015-05-12  3:26 ` Tom Herbert [this message]
2015-05-12  4:33   ` [PATCH v2 net-next 5/5] net: Add GRE keyid in flow_keys Eric Dumazet
2015-05-12  4:50     ` Eric Dumazet
2015-05-12 14:51       ` Tom Herbert
2015-05-12 16:06         ` Eric Dumazet
2015-05-15 12:48           ` [PATCH net-next] net: fix two sparse errors Eric Dumazet
2015-05-15 14:35             ` Sabrina Dubroca
2015-05-15 14:52               ` Eric Dumazet
2015-05-15 15:23                 ` Sabrina Dubroca
2015-05-15 16:14                   ` Eric Dumazet
2015-05-15 15:27               ` Tom Herbert
2015-05-15 15:54                 ` Sabrina Dubroca
2015-05-15 16:19                   ` David Miller
2015-05-15 16:26                     ` Sabrina Dubroca
2015-05-15 15:11             ` Tom Herbert
2015-05-17 18:11             ` 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=1431401204-731380-6-git-send-email-tom@herbertland.com \
    --to=tom@herbertland.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).