diff options
| author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-08-12 11:07:53 -0400 | 
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-10-25 11:13:42 -0400 | 
| commit | cba6a409cfea9bf79ffb1088a1a15736cdd4db1a (patch) | |
| tree | 523d26477fce67c7f1a554c80bc4adc0088b33d0 /lib/nexthop.c | |
| parent | 0ad40d16159ff61febd1d884d035dfd8fa47873b (diff) | |
lib: Nexthop hash onlink and ifindex with one call
In the nexthop hashing function, lets reduce the hash calls as
much as possible. So, reduce the onlink and infindex to one
call to jhash_2words().
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'lib/nexthop.c')
| -rw-r--r-- | lib/nexthop.c | 16 | 
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index 3ab7284492..3f6d9ad711 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -435,19 +435,9 @@ uint32_t nexthop_hash(const struct nexthop *nexthop)  			key = jhash_1word(nexthop->nh_label->label[i], key);  	} -	switch (nexthop->type) { -	case NEXTHOP_TYPE_IPV4_IFINDEX: -	case NEXTHOP_TYPE_IPV6_IFINDEX: -	case NEXTHOP_TYPE_IFINDEX: -		key = jhash_1word(nexthop->ifindex, key); -		break; -	case NEXTHOP_TYPE_BLACKHOLE: -	case NEXTHOP_TYPE_IPV4: -	case NEXTHOP_TYPE_IPV6: -		break; -	} - -	key = jhash_1word(CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK), key); +	key = jhash_2words(nexthop->ifindex, +			   CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK), +			   key);  	return key;  }  | 
