[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <505125ef-522b-4beb-270f-25b6614f88ed@gmail.com>
Date: Tue, 26 Jan 2021 21:36:12 -0700
From: David Ahern <dsahern@...il.com>
To: Ido Schimmel <idosch@...sch.org>, netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, amcohen@...dia.com,
roopa@...dia.com, sharpd@...dia.com, bpoirier@...dia.com,
mlxsw@...dia.com, Ido Schimmel <idosch@...dia.com>
Subject: Re: [PATCH net-next 02/10] netdevsim: fib: Perform the route
programming in a non-atomic context
On 1/26/21 6:23 AM, Ido Schimmel wrote:
> From: Amit Cohen <amcohen@...dia.com>
>
> Currently, netdevsim implements dummy FIB offload and marks notified
> routes with RTM_F_TRAP flag. netdevsim does not defer route notifications
> to a work queue because it does not need to program any hardware.
>
> Given that netdevsim's purpose is to both give an example implementation
> and allow developers to test their code, align netdevsim to a "real"
> hardware device driver like mlxsw and have it also perform the route
> "programming" in a non-atomic context.
>
> It will be used to test route flags notifications which will be added in
> the next patches.
>
> The following changes are needed when route handling is performed in WQ:
> - Handle the accounting in the main context, to be able to return an
> error for adding route when all the routes are used.
> For FIB_EVENT_ENTRY_REPLACE increase the counter before scheduling
> the delayed work, and in case that this event replaces an existing route,
> decrease the counter as part of the delayed work.
>
> - For IPv6, cannot use fen6_info->rt->fib6_siblings list because it
> might be changed during handling the delayed work.
> Save an array with the nexthops as part of fib6_event struct, and take
> a reference for each nexthop to prevent them from being freed while
> event is queued.
>
> - Change GFP_ATOMIC allocations to GFP_KERNEL.
>
> - Use single work item that is handling a list of ordered routes.
> Handling routes must be processed in the order they were submitted to
> avoid logical errors that could lead to unexpected failures.
>
> Signed-off-by: Amit Cohen <amcohen@...dia.com>
> Signed-off-by: Ido Schimmel <idosch@...dia.com>
> ---
> drivers/net/netdevsim/fib.c | 467 +++++++++++++++++++++++++-----------
> 1 file changed, 327 insertions(+), 140 deletions(-)
>
Acked-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists