netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel
@ 2019-06-13 18:38 Stephen Suryaputra
  2019-06-14 10:55 ` Nikolay Aleksandrov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stephen Suryaputra @ 2019-06-13 18:38 UTC (permalink / raw)
  To: netdev; +Cc: nikolay, Stephen Suryaputra

Multipath hash policy value of 0 isn't distributing since the outer IP
dest and src aren't varied eventhough the inner ones are. Since the flow
is on the inner ones in the case of tunneled traffic, hashing on them is
desired.

This is done mainly for IP over GRE, hence only tested for that. But
anything else supported by flow dissection should work.

v2: Use skb_flow_dissect_flow_keys() directly so that other tunneling
    can be supported through flow dissection (per Nikolay Aleksandrov).
v3: Remove accidental inclusion of ports in the hash keys and clarify
    the documentation (Nikolay Alexandrov).
Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
---
 Documentation/networking/ip-sysctl.txt |  1 +
 net/ipv4/route.c                       | 17 +++++++++++++++++
 net/ipv4/sysctl_net_ipv4.c             |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 5eedc6941ce5..f2ee426f13ad 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -80,6 +80,7 @@ fib_multipath_hash_policy - INTEGER
 	Possible values:
 	0 - Layer 3
 	1 - Layer 4
+	2 - Layer 3 or inner Layer 3 if present
 
 fib_sync_mem - UNSIGNED INTEGER
 	Amount of dirty memory from fib entries that can be backlogged before
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 14c7fdacaa72..7ad96121ed8e 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1872,6 +1872,23 @@ int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
 			hash_keys.basic.ip_proto = fl4->flowi4_proto;
 		}
 		break;
+	case 2:
+		memset(&hash_keys, 0, sizeof(hash_keys));
+		hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
+		/* skb is currently provided only when forwarding */
+		if (skb) {
+			struct flow_keys keys;
+
+			skb_flow_dissect_flow_keys(skb, &keys, 0);
+
+			hash_keys.addrs.v4addrs.src = keys.addrs.v4addrs.src;
+			hash_keys.addrs.v4addrs.dst = keys.addrs.v4addrs.dst;
+		} else {
+			/* Same as case 0 */
+			hash_keys.addrs.v4addrs.src = fl4->saddr;
+			hash_keys.addrs.v4addrs.dst = fl4->daddr;
+		}
+		break;
 	}
 	mhash = flow_hash_from_keys(&hash_keys);
 
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 2316c08e9591..e1efc2e62d21 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -960,7 +960,7 @@ static struct ctl_table ipv4_net_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_fib_multipath_hash_policy,
 		.extra1		= &zero,
-		.extra2		= &one,
+		.extra2		= &two,
 	},
 #endif
 	{
-- 
2.17.1


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

* Re: [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel
  2019-06-13 18:38 [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel Stephen Suryaputra
@ 2019-06-14 10:55 ` Nikolay Aleksandrov
  2019-06-15  2:43 ` David Miller
  2019-06-17 14:39 ` Ido Schimmel
  2 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2019-06-14 10:55 UTC (permalink / raw)
  To: Stephen Suryaputra, netdev

On 13/06/2019 21:38, Stephen Suryaputra wrote:
> Multipath hash policy value of 0 isn't distributing since the outer IP
> dest and src aren't varied eventhough the inner ones are. Since the flow
> is on the inner ones in the case of tunneled traffic, hashing on them is
> desired.
> 
> This is done mainly for IP over GRE, hence only tested for that. But
> anything else supported by flow dissection should work.
> 
> v2: Use skb_flow_dissect_flow_keys() directly so that other tunneling
>     can be supported through flow dissection (per Nikolay Aleksandrov).
> v3: Remove accidental inclusion of ports in the hash keys and clarify
>     the documentation (Nikolay Alexandrov).
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
> ---
>  Documentation/networking/ip-sysctl.txt |  1 +
>  net/ipv4/route.c                       | 17 +++++++++++++++++
>  net/ipv4/sysctl_net_ipv4.c             |  2 +-
>  3 files changed, 19 insertions(+), 1 deletion(-)
> 

Looks good to me,
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>



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

* Re: [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel
  2019-06-13 18:38 [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel Stephen Suryaputra
  2019-06-14 10:55 ` Nikolay Aleksandrov
@ 2019-06-15  2:43 ` David Miller
  2019-06-17 14:39 ` Ido Schimmel
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-06-15  2:43 UTC (permalink / raw)
  To: ssuryaextr; +Cc: netdev, nikolay

From: Stephen Suryaputra <ssuryaextr@gmail.com>
Date: Thu, 13 Jun 2019 14:38:58 -0400

> Multipath hash policy value of 0 isn't distributing since the outer IP
> dest and src aren't varied eventhough the inner ones are. Since the flow
> is on the inner ones in the case of tunneled traffic, hashing on them is
> desired.
> 
> This is done mainly for IP over GRE, hence only tested for that. But
> anything else supported by flow dissection should work.
> 
> v2: Use skb_flow_dissect_flow_keys() directly so that other tunneling
>     can be supported through flow dissection (per Nikolay Aleksandrov).
> v3: Remove accidental inclusion of ports in the hash keys and clarify
>     the documentation (Nikolay Alexandrov).
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>

Applied.

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

* Re: [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel
  2019-06-13 18:38 [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel Stephen Suryaputra
  2019-06-14 10:55 ` Nikolay Aleksandrov
  2019-06-15  2:43 ` David Miller
@ 2019-06-17 14:39 ` Ido Schimmel
  2019-06-17 15:53   ` David Ahern
  2 siblings, 1 reply; 6+ messages in thread
From: Ido Schimmel @ 2019-06-17 14:39 UTC (permalink / raw)
  To: Stephen Suryaputra; +Cc: netdev, nikolay, dsahern

On Thu, Jun 13, 2019 at 02:38:58PM -0400, Stephen Suryaputra wrote:
> Multipath hash policy value of 0 isn't distributing since the outer IP
> dest and src aren't varied eventhough the inner ones are. Since the flow
> is on the inner ones in the case of tunneled traffic, hashing on them is
> desired.
> 
> This is done mainly for IP over GRE, hence only tested for that. But
> anything else supported by flow dissection should work.
> 
> v2: Use skb_flow_dissect_flow_keys() directly so that other tunneling
>     can be supported through flow dissection (per Nikolay Aleksandrov).
> v3: Remove accidental inclusion of ports in the hash keys and clarify
>     the documentation (Nikolay Alexandrov).
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>

Hi,

Do you plan to add IPv6 support? Would be good to have the same features
in both stacks.

Also, we have tests for these sysctls under
tools/testing/selftests/net/forwarding/router_multipath.sh

Can you add a test for this change as well? You'll probably need to
create a new file given the topology created by router_multipath.sh does
not include tunnels.

Thanks

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

* Re: [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel
  2019-06-17 14:39 ` Ido Schimmel
@ 2019-06-17 15:53   ` David Ahern
  2019-06-17 17:08     ` Stephen Suryaputra
  0 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2019-06-17 15:53 UTC (permalink / raw)
  To: Ido Schimmel, Stephen Suryaputra; +Cc: netdev, nikolay

On 6/17/19 8:39 AM, Ido Schimmel wrote:
> 
> Do you plan to add IPv6 support? Would be good to have the same features
> in both stacks.

we really should be mandating equal support for all new changes like this.

> 
> Also, we have tests for these sysctls under
> tools/testing/selftests/net/forwarding/router_multipath.sh
> 
> Can you add a test for this change as well? You'll probably need to
> create a new file given the topology created by router_multipath.sh does
> not include tunnels.
> 
> Thanks
> 


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

* Re: [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel
  2019-06-17 15:53   ` David Ahern
@ 2019-06-17 17:08     ` Stephen Suryaputra
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Suryaputra @ 2019-06-17 17:08 UTC (permalink / raw)
  To: David Ahern; +Cc: Ido Schimmel, netdev, nikolay

On Mon, Jun 17, 2019 at 09:53:06AM -0600, David Ahern wrote:
> On 6/17/19 8:39 AM, Ido Schimmel wrote:
> > 
> > Do you plan to add IPv6 support? Would be good to have the same features
> > in both stacks.
> 
> we really should be mandating equal support for all new changes like this.
> 
I will add that.
> > 
> > Also, we have tests for these sysctls under
> > tools/testing/selftests/net/forwarding/router_multipath.sh
> > 
> > Can you add a test for this change as well? You'll probably need to
> > create a new file given the topology created by router_multipath.sh does
> > not include tunnels.

I never looked at the selftests scripts, but will attempt.

Stephen.

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

end of thread, other threads:[~2019-06-17 17:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 18:38 [PATCH net-next v3] ipv4: Support multipath hashing on inner IP pkts for GRE tunnel Stephen Suryaputra
2019-06-14 10:55 ` Nikolay Aleksandrov
2019-06-15  2:43 ` David Miller
2019-06-17 14:39 ` Ido Schimmel
2019-06-17 15:53   ` David Ahern
2019-06-17 17:08     ` Stephen Suryaputra

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