summaryrefslogtreecommitdiffstats
path: root/src/vnet/vxlan/decap.c
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2018-08-01 10:25:50 +0300
committerJohn Lo <loj@cisco.com>2018-08-01 18:37:57 +0000
commite126cc53317fcc38970d244bea2ddaf11e47702f (patch)
tree38b550f5473d6db65a584281d0a23c092d15c1b3 /src/vnet/vxlan/decap.c
parent5f21e1bd613b372ea6f8be6423894548dae59bdc (diff)
vxlan:optimize cached entry compare
the bihash key compare was doing the extra step of loading both keys into vector regs and comparing those - instead of using the temporary values created. Change-Id: Ic557bfa56cd6aa60c71e7f28c880f85e1eb1e6ec Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src/vnet/vxlan/decap.c')
-rw-r--r--src/vnet/vxlan/decap.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/vnet/vxlan/decap.c b/src/vnet/vxlan/decap.c
index a4cbd4a4f41..ad23f0aa35a 100644
--- a/src/vnet/vxlan/decap.c
+++ b/src/vnet/vxlan/decap.c
@@ -66,16 +66,13 @@ vxlan4_find_tunnel (vxlan_main_t * vxm, last_tunnel_cache4 * cache,
vxlan_header_t * vxlan0, vxlan_tunnel_t ** stats_t0)
{
/* Make sure VXLAN tunnel exist according to packet SIP and VNI */
- vxlan4_tunnel_key_t key4 = {
- .key = {
- [0] = ip4_0->src_address.as_u32,
- [1] = (((u64) fib_index) << 32) | vxlan0->vni_reserved,
- }
- };
+ vxlan4_tunnel_key_t key4;
+ key4.key[1] = ((u64) fib_index << 32) | vxlan0->vni_reserved;
- if (PREDICT_FALSE
- (clib_bihash_key_compare_16_8 (key4.key, cache->key) == 0))
+ if (PREDICT_FALSE (key4.key[1] != cache->key[1] ||
+ ip4_0->src_address.as_u32 != (u32) cache->key[0]))
{
+ key4.key[0] = ip4_0->src_address.as_u32;
int rv =
clib_bihash_search_inline_16_8 (&vxm->vxlan4_tunnel_by_key, &key4);
if (PREDICT_FALSE (rv != 0))
@@ -115,7 +112,6 @@ vxlan6_find_tunnel (vxlan_main_t * vxm, last_tunnel_cache6 * cache,
vxlan_header_t * vxlan0, vxlan_tunnel_t ** stats_t0)
{
/* Make sure VXLAN tunnel exist according to packet SIP and VNI */
-
vxlan6_tunnel_key_t key6 = {
.key = {
[0] = ip6_0->src_address.as_u64[0],