summaryrefslogtreecommitdiff
path: root/lib/nexthop.h
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2019-08-12 11:27:09 -0400
committerStephen Worley <sworley@cumulusnetworks.com>2019-10-25 11:13:42 -0400
commit73a381871edd64e841ee6040423cfaca25117b1f (patch)
tree2b96cb1127f490daab4b404350c2963febc4fcb3 /lib/nexthop.h
parent62991a11679da8912815c763980a505d1ad37ed7 (diff)
lib: Add nexthop quick hash api
Add a nexthop hashing api for only hashing on word-sized attributes. Calling the jhash/jhash2 function is quite slow in scaled envrionments but sometimes you do need a more granular hash. The tradeoff here is that hashtable buckets using this hash might be more full. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'lib/nexthop.h')
-rw-r--r--lib/nexthop.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/nexthop.h b/lib/nexthop.h
index dfb30a1bce..480c4cc3dd 100644
--- a/lib/nexthop.h
+++ b/lib/nexthop.h
@@ -137,6 +137,14 @@ void nexthop_del_labels(struct nexthop *);
* 32-bit hash of nexthop
*/
uint32_t nexthop_hash(const struct nexthop *nexthop);
+/*
+ * Hash a nexthop only on word-sized attributes:
+ * - vrf_id
+ * - ifindex
+ * - type
+ * - (some) flags
+ */
+uint32_t nexthop_hash_quick(const struct nexthop *nexthop);
extern bool nexthop_same(const struct nexthop *nh1, const struct nexthop *nh2);
extern bool nexthop_same_no_labels(const struct nexthop *nh1,