aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-28 14:59:37 -0700
committerDamjan Marion <dmarion@me.com>2018-09-29 07:17:02 +0000
commit539663c401b087e4576e41af35144e73e1907c9d (patch)
treee915b2c17f083daab1765be2072b1e4f7237e516 /src/vcl
parent537b17ef954b68d09b6f559dc05672cf7acfbe7c (diff)
vcl: handle old events before blocking in epoll
Change-Id: I3e62c787882d93c3bfb398ed0d04ef56b3a60b2b Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vcl_test_server.c12
-rw-r--r--src/vcl/vppcom.c5
2 files changed, 14 insertions, 3 deletions
diff --git a/src/vcl/vcl_test_server.c b/src/vcl/vcl_test_server.c
index a184d995372..2913452ab10 100644
--- a/src/vcl/vcl_test_server.c
+++ b/src/vcl/vcl_test_server.c
@@ -112,8 +112,9 @@ conn_pool_expand (vcl_test_server_worker_t * wrk, size_t expand_size)
static inline vcl_test_server_conn_t *
conn_pool_alloc (vcl_test_server_worker_t * wrk)
{
- int i;
+ int i, expand = 0;
+again:
for (i = 0; i < wrk->conn_pool_size; i++)
{
if (!wrk->conn_pool[i].is_alloc)
@@ -124,6 +125,13 @@ conn_pool_alloc (vcl_test_server_worker_t * wrk)
}
}
+ if (expand == 0)
+ {
+ conn_pool_expand (wrk, 2 * wrk->conn_pool_size);
+ expand = 1;
+ goto again;
+ }
+ vtwrn ("Failed to allocate connection even after expand");
return 0;
}
@@ -530,7 +538,7 @@ vts_conn_expect_config (vcl_test_server_conn_t * conn)
return 1;
return (conn->stats.rx_bytes < 128
- || conn->stats.rx_bytes > conn->cfg.total_bytes);
+ || conn->stats.rx_bytes >= conn->cfg.total_bytes);
}
static sock_test_cfg_t *
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 7274749a93d..5423bb62f9e 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -2421,6 +2421,9 @@ vcl_epoll_wait_handle_mq (vcl_worker_t * wrk, svm_msg_q_t * mq,
session_event_t *e;
int i;
+ if (vec_len (wrk->mq_msg_vector) && svm_msg_q_is_empty (mq))
+ goto handle_dequeued;
+
svm_msg_q_lock (mq);
if (svm_msg_q_is_empty (mq))
{
@@ -2445,6 +2448,7 @@ vcl_epoll_wait_handle_mq (vcl_worker_t * wrk, svm_msg_q_t * mq,
vcl_mq_dequeue_batch (wrk, mq);
svm_msg_q_unlock (mq);
+handle_dequeued:
for (i = 0; i < vec_len (wrk->mq_msg_vector); i++)
{
msg = vec_elt_at_index (wrk->mq_msg_vector, i);
@@ -2457,7 +2461,6 @@ vcl_epoll_wait_handle_mq (vcl_worker_t * wrk, svm_msg_q_t * mq,
break;
}
}
-
vec_delete (wrk->mq_msg_vector, i, 0);
return *num_ev;