diff options
| author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-08-12 11:27:09 -0400 | 
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-10-25 11:13:42 -0400 | 
| commit | 73a381871edd64e841ee6040423cfaca25117b1f (patch) | |
| tree | 2b96cb1127f490daab4b404350c2963febc4fcb3 /lib/nexthop.h | |
| parent | 62991a11679da8912815c763980a505d1ad37ed7 (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.h | 8 | 
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,  | 
