On 2/1/21 12:47 PM, Ido Schimmel wrote:
> From: Amit Cohen <amco...@nvidia.com>
> 
> When route is added/deleted, the appropriate counter is increased/decreased
> to maintain number of routes.
> 
> User can limit the number of routes and then according to the appropriate
> counter, adding more routes than the limitation is forbidden.
> 
> Currently, there is one lock which protects hashtable, list and accounting.
> 
> Handling the counters will be performed from both atomic context and
> non-atomic context, while the hashtable and the list will be used only from
> non-atomic context and therefore will be protected by a separate lock.
> 
> Protect accounting by using an atomic variable, so lock is not needed.
> 
> v2:
> * Use atomic64_sub() in nsim_nexthop_account()'s error path
> 
> Signed-off-by: Amit Cohen <amco...@nvidia.com>
> Signed-off-by: Ido Schimmel <ido...@nvidia.com>
> ---
>  drivers/net/netdevsim/fib.c | 55 ++++++++++++++++++-------------------
>  1 file changed, 27 insertions(+), 28 deletions(-)
> 

Reviewed-by: David Ahern <dsah...@kernel.org>


Reply via email to