[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25bb06eb-bd2a-de85-9903-19215703363a@gmail.com>
Date: Sun, 16 Jun 2019 19:27:13 -0600
From: David Ahern <dsahern@...il.com>
To: Ido Schimmel <idosch@...sch.org>, netdev@...r.kernel.org
Cc: davem@...emloft.net, jiri@...lanox.com, alexpe@...lanox.com,
mlxsw@...lanox.com, Ido Schimmel <idosch@...lanox.com>
Subject: Re: [PATCH net-next 08/17] netdevsim: Adjust accounting for IPv6
multipath notifications
On 6/15/19 8:07 AM, Ido Schimmel wrote:
> diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c
> index 83ba5113210d..6e5498ef3855 100644
> --- a/drivers/net/netdevsim/fib.c
> +++ b/drivers/net/netdevsim/fib.c
> @@ -137,19 +137,20 @@ static int nsim_fib_rule_event(struct nsim_fib_data *data,
> }
>
> static int nsim_fib_account(struct nsim_fib_entry *entry, bool add,
> + unsigned int num_rt,
> struct netlink_ext_ack *extack)
> {
> int err = 0;
>
> if (add) {
> - if (entry->num < entry->max) {
> - entry->num++;
> + if (entry->num + num_rt < entry->max) {
> + entry->num += num_rt;
> } else {
> err = -ENOSPC;
> NL_SET_ERR_MSG_MOD(extack, "Exceeded number of supported fib entries");
> }
> } else {
> - entry->num--;
> + entry->num -= num_rt;
> }
>
> return err;
> @@ -159,14 +160,20 @@ static int nsim_fib_event(struct nsim_fib_data *data,
> struct fib_notifier_info *info, bool add)
> {
> struct netlink_ext_ack *extack = info->extack;
> + struct fib6_entry_notifier_info *fen6_info;
> + unsigned int num_rt = 1;
> int err = 0;
>
> switch (info->family) {
> case AF_INET:
> - err = nsim_fib_account(&data->ipv4.fib, add, extack);
> + err = nsim_fib_account(&data->ipv4.fib, add, num_rt, extack);
> break;
> case AF_INET6:
> - err = nsim_fib_account(&data->ipv6.fib, add, extack);
> + fen6_info = container_of(info, struct fib6_entry_notifier_info,
> + info);
> + if (fen6_info->multipath_rt)
> + num_rt = fen6_info->nsiblings + 1;
> + err = nsim_fib_account(&data->ipv6.fib, add, num_rt, extack);
The intention of the original patch was to account for a multipath route
as 1 entry, not N where N is the number of paths.
Powered by blists - more mailing lists