Thread (25 messages) flat view 25 messages, 3 authors, 2021-02-15

Re: [RFC PATCH 04/13] nexthop: Add implementation of resilient next-hop groups

From: Ido Schimmel <hidden>
Date: 2021-02-13 20:21:40

On Sat, Feb 13, 2021 at 12:38:47PM -0700, David Ahern wrote:
On 2/8/21 1:42 PM, Petr Machata wrote:
quoted
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)
quoted
 	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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help