netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Ido Schimmel <idosch@idosch.org>, netdev@vger.kernel.org
Cc: davem@davemloft.net, jiri@mellanox.com, alexpe@mellanox.com,
	mlxsw@mellanox.com, Ido Schimmel <idosch@mellanox.com>
Subject: Re: [PATCH net-next 08/17] netdevsim: Adjust accounting for IPv6 multipath notifications
Date: Sun, 16 Jun 2019 19:27:13 -0600	[thread overview]
Message-ID: <25bb06eb-bd2a-de85-9903-19215703363a@gmail.com> (raw)
In-Reply-To: <20190615140751.17661-9-idosch@idosch.org>

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.

  reply	other threads:[~2019-06-17  1:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15 14:07 [PATCH net-next 00/17] mlxsw: Improve IPv6 route insertion rate Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 01/17] netlink: Document all fields of 'struct nl_info' Ido Schimmel
2019-06-17  1:16   ` David Ahern
2019-06-15 14:07 ` [PATCH net-next 02/17] netlink: Add field to skip in-kernel notifications Ido Schimmel
2019-06-17  1:17   ` David Ahern
2019-06-17  6:37     ` Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 03/17] ipv6: Extend notifier info for multipath routes Ido Schimmel
2019-06-17  1:22   ` David Ahern
2019-06-17  6:46     ` Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 04/17] mlxsw: spectrum_router: Ignore IPv6 multipath notifications Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 05/17] netdevsim: " Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 06/17] ipv6: Add IPv6 multipath notifications for add / replace Ido Schimmel
2019-06-17 13:01   ` David Ahern
2019-06-15 14:07 ` [PATCH net-next 07/17] ipv6: Add IPv6 multipath notification for route delete Ido Schimmel
2019-06-17 13:03   ` David Ahern
2019-06-15 14:07 ` [PATCH net-next 08/17] netdevsim: Adjust accounting for IPv6 multipath notifications Ido Schimmel
2019-06-17  1:27   ` David Ahern [this message]
2019-06-17  6:49     ` Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 09/17] mlxsw: spectrum_router: Remove processing of IPv6 append notifications Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 10/17] mlxsw: spectrum_router: Prepare function to return errors Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 11/17] mlxsw: spectrum_router: Pass multiple routes to work item Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 12/17] mlxsw: spectrum_router: Adjust IPv6 replace logic to new notifications Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 13/17] mlxsw: spectrum_router: Pass array of routes to route handling functions Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 14/17] mlxsw: spectrum_router: Add / delete multiple IPv6 nexthops Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 15/17] mlxsw: spectrum_router: Create IPv6 multipath routes in one go Ido Schimmel
2019-06-15 14:07 ` [PATCH net-next 16/17] ipv6: Stop sending in-kernel notifications for each nexthop Ido Schimmel
2019-06-17 13:06   ` David Ahern
2019-06-15 14:07 ` [PATCH net-next 17/17] selftests: mlxsw: Add a test for FIB offload indication Ido Schimmel
2019-06-16 21:04 ` [PATCH net-next 00/17] mlxsw: Improve IPv6 route insertion rate David Miller

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=25bb06eb-bd2a-de85-9903-19215703363a@gmail.com \
    --to=dsahern@gmail.com \
    --cc=alexpe@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=idosch@idosch.org \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).