All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/9] Simplify IPv4 route offload API
@ 2019-12-10 17:23 Ido Schimmel
  2019-12-10 17:23 ` [PATCH net-next 1/9] net: fib_notifier: Add temporary events to the FIB notification chain Ido Schimmel
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Ido Schimmel @ 2019-12-10 17:23 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, dsahern, roopa, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

Motivation
==========

The aim of this patch set is to simplify the IPv4 route offload API by
making the stack a bit smarter about the notifications it is generating.
This allows driver authors to focus on programming the underlying device
instead of having to duplicate the IPv4 route insertion logic in their
driver, which is error-prone.

This is the first patch set out of a series of four. Subsequent patch
sets will simplify the IPv6 API, add offload/trap indication to routes
and add tests for all the code paths (including error paths). Available
here [1].

Details
=======

Today, whenever an IPv4 route is added or deleted a notification is sent
in the FIB notification chain and it is up to offload drivers to decide
if the route should be programmed to the hardware or not. This is not an
easy task as in hardware routes are keyed by {prefix, prefix length,
table id}, whereas the kernel can store multiple such routes that only
differ in metric / TOS / nexthop info.

This series makes sure that only routes that are actually used in the
data path are notified to offload drivers. This greatly simplifies the
work these drivers need to do, as they are now only concerned with
programming the hardware and do not need to replicate the IPv4 route
insertion logic and store multiple identical routes.

The route that is notified is the first FIB alias in the FIB node with
the given {prefix, prefix length, table ID}. In case the route is
deleted and there is another route with the same key, a replace
notification is emitted. Otherwise, a delete notification is emitted.

The above means that in the case of multiple routes with the same key,
but different TOS, only the route with the highest TOS is notified.
While the kernel can route a packet based on its TOS, this is not
supported by any hardware devices I am familiar with. Moreover, this is
not supported by IPv6 nor by BIRD/FRR from what I could see. Offload
drivers should therefore use the presence of a non-zero TOS as an
indication to trap packets matching the route and let the kernel route
them instead. mlxsw has been doing it for the past two years.

Testing
=======

To ensure there is no degradation in route insertion rates, I averaged
the insertion rate of 512k routes (/24 and /32) over 50 runs. Did not
observe any degradation.

Functional tests are available here [1]. They rely on route trap
indication, which is only added in the last patch set.

In addition, I have been running syzkaller for the past week with all
four patch sets and debug options enabled. Did not observe any problems.

Patch set overview
==================

Patches #1-#7 gradually introduce the new FIB notifications
Patch #8 converts mlxsw to use the new notifications
Patch #9 converts the remaining listeners and removes the old
notifications

RFC: https://patchwork.ozlabs.org/cover/1170530/

[1] https://github.com/idosch/linux/tree/fib-notifier

Ido Schimmel (9):
  net: fib_notifier: Add temporary events to the FIB notification chain
  ipv4: Notify route after insertion to the routing table
  ipv4: Notify route if replacing currently offloaded one
  ipv4: Notify newly added route if should be offloaded
  ipv4: Handle route deletion notification
  ipv4: Handle route deletion notification during flush
  ipv4: Only Replay routes of interest to new listeners
  mlxsw: spectrum_router: Start using new IPv4 route notifications
  ipv4: Remove old route notifications and convert listeners

 .../net/ethernet/mellanox/mlx5/core/lag_mp.c  |   4 -
 .../ethernet/mellanox/mlxsw/spectrum_router.c | 136 +++---------------
 drivers/net/ethernet/rocker/rocker_main.c     |   4 +-
 drivers/net/netdevsim/fib.c                   |   4 +-
 net/ipv4/fib_trie.c                           | 131 ++++++++++++-----
 5 files changed, 117 insertions(+), 162 deletions(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH net-next 0/9] Simplify IPv6 route offload API
@ 2019-12-23 13:28 Ido Schimmel
  2019-12-23 13:28 ` [PATCH net-next 1/9] net: fib_notifier: Add temporary events to the FIB notification chain Ido Schimmel
  0 siblings, 1 reply; 21+ messages in thread
From: Ido Schimmel @ 2019-12-23 13:28 UTC (permalink / raw)
  To: netdev; +Cc: davem, dsahern, roopa, jakub.kicinski, jiri, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

Motivation
==========

This is the IPv6 counterpart of "Simplify IPv4 route offload API" [1].
The aim of this patch set is to simplify the IPv6 route offload API by
making the stack a bit smarter about the notifications it is generating.
This allows driver authors to focus on programming the underlying device
instead of having to duplicate the IPv6 route insertion logic in their
driver, which is error-prone.

Details
=======

Today, whenever an IPv6 route is added or deleted a notification is sent
in the FIB notification chain and it is up to offload drivers to decide
if the route should be programmed to the hardware or not. This is not an
easy task as in hardware routes are keyed by {prefix, prefix length,
table id}, whereas the kernel can store multiple such routes that only
differ in metric / nexthop info.

This series makes sure that only routes that are actually used in the
data path are notified to offload drivers. This greatly simplifies the
work these drivers need to do, as they are now only concerned with
programming the hardware and do not need to replicate the IPv6 route
insertion logic and store multiple identical routes.

The route that is notified is the first route in the IPv6 FIB node,
which represents a single prefix and length in a given table. In case
the route is deleted and there is another route with the same key, a
replace notification is emitted. Otherwise, a delete notification is
emitted.

Unlike IPv4, in IPv6 it is possible to append individual nexthops to an
existing multipath route. Therefore, in addition to the replace and
delete notifications present in IPv4, an append notification is also
used.

Testing
=======

To ensure there is no degradation in route insertion rates, I averaged
the insertion rate of 512k routes (/64 and /128) over 50 runs. Did not
observe any degradation.

Functional tests are available here [2]. They rely on route trap
indication, which is added in a subsequent patch set.

In addition, I have been running syzkaller for the past couple of weeks
with debug options enabled. Did not observe any problems.

Patch set overview
==================

Patches #1-#7 gradually introduce the new FIB notifications
Patch #8 converts mlxsw to use the new notifications
Patch #9 remove the old notifications

[1] https://patchwork.ozlabs.org/cover/1209738/
[2] https://github.com/idosch/linux/tree/fib-notifier

Ido Schimmel (9):
  net: fib_notifier: Add temporary events to the FIB notification chain
  ipv6: Notify newly added route if should be offloaded
  ipv6: Notify route if replacing currently offloaded one
  ipv6: Notify multipath route if should be offloaded
  ipv6: Only Replay routes of interest to new listeners
  ipv6: Handle route deletion notification
  ipv6: Handle multipath route deletion notification
  mlxsw: spectrum_router: Start using new IPv6 route notifications
  ipv6: Remove old route notifications and convert listeners

 .../ethernet/mellanox/mlxsw/spectrum_router.c | 218 ++++++------------
 drivers/net/netdevsim/fib.c                   |   1 -
 include/net/ip6_fib.h                         |   1 +
 net/ipv6/ip6_fib.c                            | 108 +++++++--
 net/ipv6/route.c                              |  86 +++++--
 5 files changed, 238 insertions(+), 176 deletions(-)

-- 
2.24.1


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

end of thread, other threads:[~2019-12-24 16:40 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 17:23 [PATCH net-next 0/9] Simplify IPv4 route offload API Ido Schimmel
2019-12-10 17:23 ` [PATCH net-next 1/9] net: fib_notifier: Add temporary events to the FIB notification chain Ido Schimmel
2019-12-10 17:23 ` [PATCH net-next 2/9] ipv4: Notify route after insertion to the routing table Ido Schimmel
2019-12-11 17:34   ` David Ahern
2019-12-10 17:23 ` [PATCH net-next 3/9] ipv4: Notify route if replacing currently offloaded one Ido Schimmel
2019-12-11 17:40   ` David Ahern
2019-12-11 19:47     ` Ido Schimmel
2019-12-10 17:23 ` [PATCH net-next 4/9] ipv4: Notify newly added route if should be offloaded Ido Schimmel
2019-12-10 17:23 ` [PATCH net-next 5/9] ipv4: Handle route deletion notification Ido Schimmel
2019-12-11 17:44   ` David Ahern
2019-12-10 17:23 ` [PATCH net-next 6/9] ipv4: Handle route deletion notification during flush Ido Schimmel
2019-12-11 17:46   ` David Ahern
2019-12-11 17:52     ` David Ahern
2019-12-11 17:52   ` David Ahern
2019-12-10 17:24 ` [PATCH net-next 7/9] ipv4: Only Replay routes of interest to new listeners Ido Schimmel
2019-12-11 17:57   ` David Ahern
2019-12-10 17:24 ` [PATCH net-next 8/9] mlxsw: spectrum_router: Start using new IPv4 route notifications Ido Schimmel
2019-12-11 17:58   ` David Ahern
2019-12-10 17:24 ` [PATCH net-next 9/9] ipv4: Remove old route notifications and convert listeners Ido Schimmel
2019-12-23 13:28 [PATCH net-next 0/9] Simplify IPv6 route offload API Ido Schimmel
2019-12-23 13:28 ` [PATCH net-next 1/9] net: fib_notifier: Add temporary events to the FIB notification chain Ido Schimmel
2019-12-24 16:40   ` David Ahern

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.