aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2016-08-15 19:16:32 +0200
committerDave Barach <openvpp@barachs.net>2016-08-16 19:01:41 +0000
commitf4691cd7befd4cf31a63adffc204d71b1f1548e1 (patch)
tree9c6c7ca5d02429496983b4ad6db7d92ef12498e8 /vnet
parentadeb749d13cbb750bcb25dac15314b80032fe024 (diff)
VPP-330 Track pending map-requests with a fifo
Change-Id: Icc64abb91047f756c955c880f6f85b26faef666a Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/lisp-cp/control.c19
-rw-r--r--vnet/vnet/lisp-cp/control.h2
2 files changed, 12 insertions, 9 deletions
diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c
index 1b129d25821..a6f20030653 100644
--- a/vnet/vnet/lisp-cp/control.c
+++ b/vnet/vnet/lisp-cp/control.c
@@ -2700,15 +2700,16 @@ _send_encapsulated_map_request (lisp_cp_main_t *lcm,
if (duplicate_pmr)
/* if there is a pending request already update it */
{
- if (vec_len (duplicate_pmr->nonces) >= PENDING_MREQ_QUEUE_LEN)
+ if (clib_fifo_elts(duplicate_pmr->nonces) >= PENDING_MREQ_QUEUE_LEN)
{
/* remove the oldest nonce */
- u64 * nonce_del = vec_elt_at_index (duplicate_pmr->nonces, 0);
+ u64 CLIB_UNUSED(tmp), * nonce_del;
+ nonce_del = clib_fifo_head(duplicate_pmr->nonces);
hash_unset (lcm->pending_map_requests_by_nonce, nonce_del[0]);
- vec_del1 (duplicate_pmr->nonces, 0);
+ clib_fifo_sub1 (duplicate_pmr->nonces, tmp);
}
- vec_add1 (duplicate_pmr->nonces, nonce);
+ clib_fifo_add1 (duplicate_pmr->nonces, nonce);
hash_set (lcm->pending_map_requests_by_nonce, nonce,
duplicate_pmr - lcm->pending_map_requests_pool);
}
@@ -2719,7 +2720,7 @@ _send_encapsulated_map_request (lisp_cp_main_t *lcm,
memset (pmr, 0, sizeof (*pmr));
gid_address_copy (&pmr->src, seid);
gid_address_copy (&pmr->dst, deid);
- vec_add1 (pmr->nonces, nonce);
+ clib_fifo_add1 (pmr->nonces, nonce);
pmr->is_smr_invoked = is_smr_invoked;
reset_pending_mr_counters (pmr);
hash_set (lcm->pending_map_requests_by_nonce, nonce,
@@ -3079,9 +3080,10 @@ process_map_reply (void * arg)
}
/* remove pending map request entry */
- vec_foreach (noncep, pmr->nonces)
+ clib_fifo_foreach (noncep, pmr->nonces, ({
hash_unset(lcm->pending_map_requests_by_nonce, noncep[0]);
- vec_free(pmr->nonces);
+ }));
+ clib_fifo_free(pmr->nonces);
pool_put(lcm->pending_map_requests_pool, pmr);
done:
@@ -3366,8 +3368,9 @@ remove_dead_pending_map_requests (lisp_cp_main_t * lcm)
({
if (pmr->to_be_removed)
{
- vec_foreach (nonce, pmr->nonces)
+ clib_fifo_foreach (nonce, pmr->nonces, ({
hash_unset (lcm->pending_map_requests_by_nonce, nonce[0]);
+ }));
vec_add1 (to_be_removed, pmr - lcm->pending_map_requests_pool);
}
diff --git a/vnet/vnet/lisp-cp/control.h b/vnet/vnet/lisp-cp/control.h
index 0dad64bc432..0193661ada7 100644
--- a/vnet/vnet/lisp-cp/control.h
+++ b/vnet/vnet/lisp-cp/control.h
@@ -22,7 +22,7 @@
#define NUMBER_OF_RETRIES 1
#define PENDING_MREQ_EXPIRATION_TIME 3.0 /* seconds */
-#define PENDING_MREQ_QUEUE_LEN 2
+#define PENDING_MREQ_QUEUE_LEN 5
typedef struct
{