ipv4: Add a sysctl to control multipath hash fields
authorIdo Schimmel <idosch@OSS.NVIDIA.COM>
Mon, 17 May 2021 18:15:18 +0000 (21:15 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 May 2021 20:27:32 +0000 (13:27 -0700)
commitce5c9c20d364f156c885efed8c71fca2945db00f
treebb4858afb789ab04d7330dc3bff07f999814bbff
parent2e68ea92684181412b73979baf1af7d04619c52c
ipv4: Add a sysctl to control multipath hash fields

A subsequent patch will add a new multipath hash policy where the packet
fields used for multipath hash calculation are determined by user space.
This patch adds a sysctl that allows user space to set these fields.

The packet fields are represented using a bitmask and are common between
IPv4 and IPv6 to allow user space to use the same numbering across both
protocols. For example, to hash based on standard 5-tuple:

 # sysctl -w net.ipv4.fib_multipath_hash_fields=0x0037
 net.ipv4.fib_multipath_hash_fields = 0x0037

The kernel rejects unknown fields, for example:

 # sysctl -w net.ipv4.fib_multipath_hash_fields=0x1000
 sysctl: setting key "net.ipv4.fib_multipath_hash_fields": Invalid argument

More fields can be added in the future, if needed.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/ip-sysctl.rst
include/net/ip_fib.h
include/net/netns/ipv4.h
net/ipv4/fib_frontend.c
net/ipv4/sysctl_net_ipv4.c