From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <jiri@resnulli.us>, <netdev@vger.kernel.org>
Subject: [PATCH v4 net-next 11/11] mpls: Add MPLS entropy label in flow_keys
Date: Thu, 21 May 2015 17:11:46 -0700 [thread overview]
Message-ID: <1432253506-3646977-12-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1432253506-3646977-1-git-send-email-tom@herbertland.com>
In flow dissector if an MPLS header contains an entropy label this is
saved in the new keyid field of flow_keys. The entropy label is
then represented in the flow hash function input.
Signed-off-by: Tom Herbert <tom@herbertland.com>
---
include/net/flow_dissector.h | 1 +
net/core/flow_dissector.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index f9a3084..65db4eb 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -118,6 +118,7 @@ enum flow_dissector_key_id {
FLOW_DISSECTOR_KEY_VLANID, /* struct flow_dissector_key_flow_tags */
FLOW_DISSECTOR_KEY_FLOW_LABEL, /* struct flow_dissector_key_flow_label */
FLOW_DISSECTOR_KEY_GRE_KEYID, /* struct flow_dissector_key_keyid */
+ FLOW_DISSECTOR_KEY_MPLS_ENTROPY, /* struct flow_dissector_key_keyid */
FLOW_DISSECTOR_KEY_MAX,
};
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 20ce55d..da4e895 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -15,6 +15,7 @@
#include <linux/ppp_defs.h>
#include <linux/stddef.h>
#include <linux/if_ether.h>
+#include <linux/mpls.h>
#include <net/flow_dissector.h>
#include <scsi/fc/fc_fcoe.h>
@@ -286,6 +287,39 @@ ipv6:
}
return true;
}
+
+ case htons(ETH_P_MPLS_UC):
+ case htons(ETH_P_MPLS_MC): {
+ struct mpls_label *hdr, _hdr[2];
+mpls:
+ hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data,
+ hlen, &_hdr);
+ if (!hdr)
+ return false;
+
+ if ((ntohl(hdr[0].entry) & MPLS_LS_LABEL_MASK) ==
+ MPLS_LABEL_ENTROPY) {
+ if (skb_flow_dissector_uses_key(
+ flow_dissector,
+ FLOW_DISSECTOR_KEY_MPLS_ENTROPY)) {
+ key_keyid = skb_flow_dissector_target(
+ flow_dissector,
+ FLOW_DISSECTOR_KEY_MPLS_ENTROPY,
+ target_container);
+ key_keyid->keyid = ntohl(hdr[1].entry) &
+ MPLS_LS_LABEL_MASK;
+ }
+
+ key_basic->n_proto = proto;
+ key_basic->ip_proto = ip_proto;
+ key_control->thoff = (u16)nhoff;
+
+ return true;
+ }
+
+ return true;
+ }
+
case htons(ETH_P_FCOE):
key_control->thoff = (u16)(nhoff + FCOE_HEADER_LEN);
/* fall through */
@@ -356,6 +390,9 @@ ipv6:
case IPPROTO_IPV6:
proto = htons(ETH_P_IPV6);
goto ipv6;
+ case IPPROTO_MPLS:
+ proto = htons(ETH_P_MPLS_UC);
+ goto mpls;
default:
break;
}
--
1.8.1
next prev parent reply other threads:[~2015-05-22 0:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 0:11 [PATCH v4 net-next 00/11] net: Increase inputs to flow_keys hashing Tom Herbert
2015-05-22 0:11 ` [PATCH v4 net-next 01/11] net: Simplify GRE case in flow_dissector Tom Herbert
2015-05-22 6:36 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 02/11] mpls: Add definition for IPPROTO_MPLS Tom Herbert
2015-05-22 6:37 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 03/11] net: Remove superfluous setting of key_basic Tom Herbert
2015-05-22 6:37 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 04/11] net: Get skb hash over flow_keys structure Tom Herbert
2015-05-22 6:52 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 05/11] net: Add full IPv6 addresses to flow_keys Tom Herbert
2015-05-22 4:16 ` Cong Wang
2015-05-22 7:57 ` Jiri Pirko
2015-05-22 15:08 ` Tom Herbert
2015-05-22 0:11 ` [PATCH v4 net-next 06/11] net: Add keys for TIPC address Tom Herbert
2015-05-22 8:05 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 07/11] net: Get rid of IPv6 hash addresses flow keys Tom Herbert
2015-05-22 8:08 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 08/11] net: Add VLAN ID to flow_keys Tom Herbert
2015-05-22 0:11 ` [PATCH v4 net-next 09/11] net: Add IPv6 flow label " Tom Herbert
2015-05-22 8:14 ` Jiri Pirko
2015-05-22 15:14 ` Tom Herbert
2015-05-22 15:22 ` Jiri Pirko
2015-05-22 20:12 ` Tom Herbert
2015-05-22 0:11 ` [PATCH v4 net-next 10/11] net: Add GRE keyid in flow_keys Tom Herbert
2015-05-22 0:11 ` Tom Herbert [this message]
2015-05-22 8:19 ` [PATCH v4 net-next 11/11] mpls: Add MPLS entropy label " Jiri Pirko
-- strict thread matches above, loose matches on Subject: below --
2015-05-28 18:18 [PATCH v4 net-next 00/11] net: Increase inputs to flow_keys hashing Tom Herbert
2015-05-28 18:19 ` [PATCH v4 net-next 11/11] mpls: Add MPLS entropy label in flow_keys 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=1432253506-3646977-12-git-send-email-tom@herbertland.com \
--to=tom@herbertland.com \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--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).