aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2014-07-02 00:33:01 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-08 00:14:21 -0400
commit19469a873bafd4e65daef3597db2bd724c1b03c9 (patch)
treec413b1130aaf9e5c70a7d378508684f5c72e3320
parent535fb8d006bc6a96d59558181a9a6f267be382c5 (diff)
flow_dissector: Use IPv6 flow label in flow_dissector
This patch implements the receive side to support RFC 6438 which is to use the flow label as an ECMP hash. If an IPv6 flow label is set in a packet we can use this as input for computing an L4-hash. There should be no need to parse any transport headers in this case. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/flow_dissector.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 62d1cb624f53..c5f3912dad4c 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -80,6 +80,8 @@ ip:
80 case htons(ETH_P_IPV6): { 80 case htons(ETH_P_IPV6): {
81 const struct ipv6hdr *iph; 81 const struct ipv6hdr *iph;
82 struct ipv6hdr _iph; 82 struct ipv6hdr _iph;
83 __be32 flow_label;
84
83ipv6: 85ipv6:
84 iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); 86 iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
85 if (!iph) 87 if (!iph)
@@ -89,6 +91,21 @@ ipv6:
89 flow->src = (__force __be32)ipv6_addr_hash(&iph->saddr); 91 flow->src = (__force __be32)ipv6_addr_hash(&iph->saddr);
90 flow->dst = (__force __be32)ipv6_addr_hash(&iph->daddr); 92 flow->dst = (__force __be32)ipv6_addr_hash(&iph->daddr);
91 nhoff += sizeof(struct ipv6hdr); 93 nhoff += sizeof(struct ipv6hdr);
94
95 flow_label = ip6_flowlabel(iph);
96 if (flow_label) {
97 /* Awesome, IPv6 packet has a flow label so we can
98 * use that to represent the ports without any
99 * further dissection.
100 */
101 flow->n_proto = proto;
102 flow->ip_proto = ip_proto;
103 flow->ports = flow_label;
104 flow->thoff = (u16)nhoff;
105
106 return true;
107 }
108
92 break; 109 break;
93 } 110 }
94 case htons(ETH_P_8021AD): 111 case htons(ETH_P_8021AD):