netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: David Ahern <dsahern@gmail.com>
Cc: Petr Machata <petrm@nvidia.com>,
	netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>
Subject: Re: [RFC PATCH 04/13] nexthop: Add implementation of resilient next-hop groups
Date: Sat, 13 Feb 2021 22:20:39 +0200	[thread overview]
Message-ID: <20210213202039.GC401513@shredder.lan> (raw)
In-Reply-To: <b9a8fc9e-4e0c-7e7c-0b8a-da520c9dd837@gmail.com>

On Sat, Feb 13, 2021 at 12:38:47PM -0700, David Ahern wrote:
> On 2/8/21 1:42 PM, Petr Machata wrote:
> > diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
> > index 5d560d381070..4ce282b0a65f 100644
> > --- a/net/ipv4/nexthop.c
> > +++ b/net/ipv4/nexthop.c> @@ -734,6 +834,22 @@ static struct nexthop
> *nexthop_select_path_mp(struct nh_group *nhg, int hash)
> >  	return rc;
> >  }
> >  
> > +static struct nexthop *nexthop_select_path_res(struct nh_group *nhg, int hash)
> > +{
> > +	struct nh_res_table *res_table = rcu_dereference(nhg->res_table);
> > +	u32 bucket_index = hash % res_table->num_nh_buckets;
> 
> Have you considered requiring the number of buckets to be a power of 2
> to avoid the modulo in the hot path? Seems like those are the more
> likely size options.

We thought about it, but I think it is overly limiting. Even in Spectrum
(for some sizes) it does not have to be a power of 2.

  reply	other threads:[~2021-02-13 20:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 20:42 [RFC PATCH 00/13] nexthop: Resilient next-hop groups Petr Machata
2021-02-08 20:42 ` [RFC PATCH 01/13] nexthop: Pass nh_config to replace_nexthop() Petr Machata
2021-02-08 20:42 ` [RFC PATCH 02/13] nexthop: __nh_notifier_single_info_init(): Make nh_info an argument Petr Machata
2021-02-08 20:42 ` [RFC PATCH 03/13] nexthop: Add netlink defines and enumerators for resilient NH groups Petr Machata
2021-02-13 19:16   ` David Ahern
2021-02-13 20:17     ` Ido Schimmel
2021-02-15 11:43       ` Petr Machata
2021-02-08 20:42 ` [RFC PATCH 04/13] nexthop: Add implementation of resilient next-hop groups Petr Machata
2021-02-13 19:22   ` David Ahern
2021-02-15 11:44     ` Petr Machata
2021-02-13 19:38   ` David Ahern
2021-02-13 20:20     ` Ido Schimmel [this message]
2021-02-08 20:42 ` [RFC PATCH 05/13] nexthop: Add data structures for resilient group notifications Petr Machata
2021-02-08 20:42 ` [RFC PATCH 06/13] nexthop: Implement notifiers for resilient nexthop groups Petr Machata
2021-02-08 20:42 ` [RFC PATCH 07/13] nexthop: Allow setting "offload" and "trap" indication of nexthop buckets Petr Machata
2021-02-08 20:42 ` [RFC PATCH 08/13] nexthop: Allow reporting activity " Petr Machata
2021-02-08 20:42 ` [RFC PATCH 09/13] nexthop: Add netlink handlers for resilient nexthop groups Petr Machata
2021-02-08 20:42 ` [RFC PATCH 10/13] nexthop: Add netlink handlers for bucket dump Petr Machata
2021-02-08 20:42 ` [RFC PATCH 11/13] nexthop: Add netlink handlers for bucket get Petr Machata
2021-02-08 20:42 ` [RFC PATCH 12/13] nexthop: Notify userspace about bucket migrations Petr Machata
2021-02-08 20:42 ` [RFC PATCH 13/13] nexthop: Enable resilient next-hop groups Petr Machata
2021-02-13 18:57 ` [RFC PATCH 00/13] nexthop: Resilient " David Ahern
2021-02-13 19:16   ` Ido Schimmel
2021-02-13 19:17     ` David Ahern
2021-02-13 20:16       ` Ido Schimmel

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=20210213202039.GC401513@shredder.lan \
    --to=idosch@idosch.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    /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).