From: David Ahern <dsahern@gmail.com>
To: Ido Schimmel <idosch@idosch.org>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com,
roopa@nvidia.com, nikolay@nvidia.com, ssuryaextr@gmail.com,
mlxsw@nvidia.com, Ido Schimmel <idosch@nvidia.com>
Subject: Re: [RFC PATCH net-next 02/10] ipv4: Add a sysctl to control multipath hash fields
Date: Mon, 3 May 2021 20:33:40 -0600 [thread overview]
Message-ID: <3664a338-40ad-9379-0a4c-ec2bd99681dd@gmail.com> (raw)
In-Reply-To: <20210502162257.3472453-3-idosch@idosch.org>
On 5/2/21 10:22 AM, Ido Schimmel wrote:
> From: Ido Schimmel <idosch@nvidia.com>
>
> 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 bitmap 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=0-2,4-5
> net.ipv4.fib_multipath_hash_fields = 0-2,4-5
>
> More fields can be added in the future, if needed.
>
> The 'need_outer' and 'need_inner' variables are set in the control path
> to indicate whether dissection of the outer or inner flow is needed.
> They will be used by a subsequent patch to allow the data path to avoid
> dissection of the outer or inner flow when not needed.
>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
> Documentation/networking/ip-sysctl.rst | 29 ++++++++++++++++
> include/net/ip_fib.h | 46 ++++++++++++++++++++++++++
> include/net/netns/ipv4.h | 4 +++
> net/ipv4/fib_frontend.c | 24 ++++++++++++++
> net/ipv4/sysctl_net_ipv4.c | 32 ++++++++++++++++++
> 5 files changed, 135 insertions(+)
>
> diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
> index c2ecc9894fd0..8ab61f4edf02 100644
> --- a/Documentation/networking/ip-sysctl.rst
> +++ b/Documentation/networking/ip-sysctl.rst
> @@ -100,6 +100,35 @@ fib_multipath_hash_policy - INTEGER
> - 1 - Layer 4
> - 2 - Layer 3 or inner Layer 3 if present
>
> +fib_multipath_hash_fields - list of comma separated ranges
> + When fib_multipath_hash_policy is set to 3 (custom multipath hash), the
> + fields used for multipath hash calculation are determined by this
> + sysctl.
> +
> + The format used for both input and output is a comma separated list of
> + ranges (e.g., "0-2" for source IP, destination IP and IP protocol).
> + Writing to the file will clear all previous ranges and update the
> + current list with the input.
> +
> + Possible fields are:
> +
> + == ============================
> + 0 Source IP address
> + 1 Destination IP address
> + 2 IP protocol
> + 3 Unused
> + 4 Source port
> + 5 Destination port
> + 6 Inner source IP address
> + 7 Inner destination IP address
> + 8 Inner IP protocol
> + 9 Inner Flow Label
> + 10 Inner source port
> + 11 Inner destination port
> + == ============================
> +
> + Default: 0-2 (source IP, destination IP and IP protocol)
since you are already requiring a name to id conversion, why not just
use a bitmask here as the input? if the value is a 32-bit bitmask do you
need bitmap_zalloc and its overhead?
Also, you could implement the current default using this scheme since
you have the default fields as the current L3 policy.
next prev parent reply other threads:[~2021-05-04 2:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-02 16:22 [RFC PATCH net-next 00/10] Add support for custom multipath hash Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 01/10] ipv4: Calculate multipath hash inside switch statement Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 02/10] ipv4: Add a sysctl to control multipath hash fields Ido Schimmel
2021-05-04 2:33 ` David Ahern [this message]
2021-05-05 7:48 ` Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 03/10] ipv4: Add custom multipath hash policy Ido Schimmel
2021-05-04 2:38 ` David Ahern
2021-05-04 2:40 ` David Ahern
2021-05-05 8:45 ` Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 04/10] ipv6: Use a more suitable label name Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 05/10] ipv6: Calculate multipath hash inside switch statement Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 06/10] ipv6: Add a sysctl to control multipath hash fields Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 07/10] ipv6: Add custom multipath hash policy Ido Schimmel
2021-05-04 2:46 ` David Ahern
2021-05-05 8:50 ` Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 08/10] selftests: forwarding: Add test for custom multipath hash Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 09/10] selftests: forwarding: Add test for custom multipath hash with IPv4 GRE Ido Schimmel
2021-05-02 16:22 ` [RFC PATCH net-next 10/10] selftests: forwarding: Add test for custom multipath hash with IPv6 GRE Ido Schimmel
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=3664a338-40ad-9379-0a4c-ec2bd99681dd@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=idosch@idosch.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=petrm@nvidia.com \
--cc=roopa@nvidia.com \
--cc=ssuryaextr@gmail.com \
/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).