From: Ido Schimmel <idosch@idosch.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, dsahern@gmail.com,
yoshfuji@linux-ipv6.org, jiri@nvidia.com, amcohen@nvidia.com,
roopa@nvidia.com, bpoirier@nvidia.com, sharpd@nvidia.com,
mlxsw@nvidia.com, Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next v2 00/10] Add notifications when route hardware flags change
Date: Mon, 1 Feb 2021 21:47:47 +0200 [thread overview]
Message-ID: <20210201194757.3463461-1-idosch@idosch.org> (raw)
From: Ido Schimmel <idosch@nvidia.com>
Routes installed to the kernel can be programmed to capable devices, in
which case they are marked with one of two flags. RTM_F_OFFLOAD for
routes that offload traffic from the kernel and RTM_F_TRAP for routes
that trap packets to the kernel for processing (e.g., host routes).
These flags are of interest to routing daemons since they would like to
delay advertisement of routes until they are installed in hardware. This
allows them to avoid packet loss or misrouted packets. Currently,
routing daemons do not receive any notifications when these flags are
changed, requiring them to poll the kernel tables for changes which is
inefficient.
This series addresses the issue by having the kernel emit RTM_NEWROUTE
notifications whenever these flags change. The behavior is controlled by
two sysctls (net.ipv4.fib_notify_on_flag_change and
net.ipv6.fib_notify_on_flag_change) that default to 0 (no
notifications).
Note that even if route installation in hardware is improved to be more
synchronous, these notifications are still of interest. For example, a
multipath route can change from RTM_F_OFFLOAD to RTM_F_TRAP if its
neighbours become invalid. A routing daemon can choose to withdraw /
replace the route in that case. In addition, the deletion of a route
from the kernel can prompt the installation of an identical route
(already in kernel, with an higher metric) to hardware.
For testing purposes, netdevsim is aligned to simulate a "real" driver
that programs routes to hardware.
Series overview:
Patches #1-#2 align netdevsim to perform route programming in a
non-atomic context
Patches #3-#5 add sysctl to control IPv4 notifications
Patches #6-#8 add sysctl to control IPv6 notifications
Patch #9 extends existing fib tests to set sysctls before running tests
Patch #10 adds test for fib notifications over netdevsim
v2:
* Patch #1: Use atomic64_sub() in nsim_nexthop_account()'s error path
Amit Cohen (10):
netdevsim: fib: Convert the current occupancy to an atomic variable
netdevsim: fib: Perform the route programming in a non-atomic context
net: ipv4: Pass fib_rt_info as const to fib_dump_info()
net: ipv4: Publish fib_nlmsg_size()
net: ipv4: Emit notification when fib hardware flags are changed
net: Pass 'net' struct as first argument to fib6_info_hw_flags_set()
net: Do not call fib6_info_hw_flags_set() when IPv6 is disabled
net: ipv6: Emit notification when fib hardware flags are changed
selftests: Extend fib tests to run with and without flags
notifications
selftests: netdevsim: Add fib_notifications test
Documentation/networking/ip-sysctl.rst | 40 ++
.../ethernet/mellanox/mlxsw/spectrum_router.c | 23 +-
drivers/net/netdevsim/fib.c | 534 ++++++++++++------
include/net/ip6_fib.h | 9 +-
include/net/netns/ipv4.h | 2 +
include/net/netns/ipv6.h | 1 +
net/ipv4/af_inet.c | 2 +
net/ipv4/fib_lookup.h | 3 +-
net/ipv4/fib_semantics.c | 4 +-
net/ipv4/fib_trie.c | 27 +
net/ipv4/sysctl_net_ipv4.c | 9 +
net/ipv6/af_inet6.c | 1 +
net/ipv6/route.c | 44 ++
net/ipv6/sysctl_net_ipv6.c | 9 +
.../selftests/drivers/net/mlxsw/fib.sh | 14 +
.../selftests/drivers/net/netdevsim/fib.sh | 14 +
.../net/netdevsim/fib_notifications.sh | 300 ++++++++++
17 files changed, 854 insertions(+), 182 deletions(-)
create mode 100755 tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh
--
2.29.2
next reply other threads:[~2021-02-01 19:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 19:47 Ido Schimmel [this message]
2021-02-01 19:47 ` [PATCH net-next v2 01/10] netdevsim: fib: Convert the current occupancy to an atomic variable Ido Schimmel
2021-02-02 1:49 ` David Ahern
2021-02-01 19:47 ` [PATCH net-next v2 02/10] netdevsim: fib: Perform the route programming in a non-atomic context Ido Schimmel
2021-02-01 19:47 ` [PATCH net-next v2 03/10] net: ipv4: Pass fib_rt_info as const to fib_dump_info() Ido Schimmel
2021-02-01 19:47 ` [PATCH net-next v2 04/10] net: ipv4: Publish fib_nlmsg_size() Ido Schimmel
2021-02-01 19:47 ` [PATCH net-next v2 05/10] net: ipv4: Emit notification when fib hardware flags are changed Ido Schimmel
2021-02-01 19:47 ` [PATCH net-next v2 06/10] net: Pass 'net' struct as first argument to fib6_info_hw_flags_set() Ido Schimmel
2021-02-01 19:47 ` [PATCH net-next v2 07/10] net: Do not call fib6_info_hw_flags_set() when IPv6 is disabled Ido Schimmel
2021-02-01 19:47 ` [PATCH net-next v2 08/10] net: ipv6: Emit notification when fib hardware flags are changed Ido Schimmel
2021-02-01 19:47 ` [PATCH net-next v2 09/10] selftests: Extend fib tests to run with and without flags notifications Ido Schimmel
2021-02-01 19:47 ` [PATCH net-next v2 10/10] selftests: netdevsim: Add fib_notifications test Ido Schimmel
2021-02-03 2:00 ` [PATCH net-next v2 00/10] Add notifications when route hardware flags change patchwork-bot+netdevbpf
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=20210201194757.3463461-1-idosch@idosch.org \
--to=idosch@idosch.org \
--cc=amcohen@nvidia.com \
--cc=bpoirier@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=idosch@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@nvidia.com \
--cc=sharpd@nvidia.com \
--cc=yoshfuji@linux-ipv6.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.