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

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

flat view

From: David Ahern <hidden>
Date: 2021-02-13 19:39:51

On 2/8/21 1:42 PM, Petr Machata wrote:
quoted hunk ↗ jump to hunk
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 hunk ↗ jump to hunk
 	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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help