netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net: Use IPv6 flow label in flow_dissector
@ 2014-04-26 23:00 Tom Herbert
  2014-04-27 20:55 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Herbert @ 2014-04-26 23:00 UTC (permalink / raw)
  To: davem, netdev

This implements the receive side to support RFC6438 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>
---
 net/core/flow_dissector.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 107ed12..1c37d7b 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -80,6 +80,8 @@ ip:
 	case htons(ETH_P_IPV6): {
 		const struct ipv6hdr *iph;
 		struct ipv6hdr _iph;
+		__be32 flow_label;
+
 ipv6:
 		iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
 		if (!iph)
@@ -89,6 +91,20 @@ ipv6:
 		flow->src = (__force __be32)ipv6_addr_hash(&iph->saddr);
 		flow->dst = (__force __be32)ipv6_addr_hash(&iph->daddr);
 		nhoff += sizeof(struct ipv6hdr);
+
+		if ((flow_label = ip6_flowlabel(iph))) {
+			/*
+			 * Awesome, IPv6 packet has a flow label so we can
+			 * use that to represent the ports without any
+			 * further dissection.
+			 */
+			flow->ip_proto = ip_proto;
+			flow->ports = flow_label;
+			flow->thoff = (u16)nhoff;
+
+			return true;
+		}
+
 		break;
 	}
 	case htons(ETH_P_8021AD):
-- 
1.9.1.423.g4596e3a

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] net: Use IPv6 flow label in flow_dissector
  2014-04-26 23:00 [PATCH 1/2] net: Use IPv6 flow label in flow_dissector Tom Herbert
@ 2014-04-27 20:55 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2014-04-27 20:55 UTC (permalink / raw)
  To: Tom Herbert, davem, netdev

Hello.

On 04/27/2014 03:00 AM, Tom Herbert wrote:

> This implements the receive side to support RFC6438 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>
> ---
>   net/core/flow_dissector.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)

> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 107ed12..1c37d7b 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
[...]
> @@ -89,6 +91,20 @@ ipv6:
>   		flow->src = (__force __be32)ipv6_addr_hash(&iph->saddr);
>   		flow->dst = (__force __be32)ipv6_addr_hash(&iph->daddr);
>   		nhoff += sizeof(struct ipv6hdr);
> +
> +		if ((flow_label = ip6_flowlabel(iph))) {

    This wouldn't pass scripts/checkpatch.pl -- assignments shouldn't be 
enclosed into the *if* statement's parens.

> +			/*
> +			 * Awesome, IPv6 packet has a flow label so we can
> +			 * use that to represent the ports without any
> +			 * further dissection.
> +			 */

    Multi-line comments in the networking code should look this way:

/* bla
  * bla
  */

This is also an issue that scripts/checkpatch.pl would complain about...

WBR, Sergei

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-27 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-26 23:00 [PATCH 1/2] net: Use IPv6 flow label in flow_dissector Tom Herbert
2014-04-27 20:55 ` Sergei Shtylyov

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).