diff options
-rw-r--r-- | VNFs/vCGNAPT/pipeline/pipeline_timer_be.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/VNFs/vCGNAPT/pipeline/pipeline_timer_be.c b/VNFs/vCGNAPT/pipeline/pipeline_timer_be.c index ed1c5875..bfe8f5c4 100644 --- a/VNFs/vCGNAPT/pipeline/pipeline_timer_be.c +++ b/VNFs/vCGNAPT/pipeline/pipeline_timer_be.c @@ -59,6 +59,7 @@ struct rte_mempool *timer_mempool; struct rte_mempool *timer_key_mempool; static int timer_objs_mempool_count; static int timer_ring_alloc_cnt; +static uint32_t timer_dyn_timeout = 30; uint64_t cgnapt_timeout; uint32_t timer_lcore; @@ -312,6 +313,7 @@ pipeline_cgnapt_parse_args(struct pipeline_timer *p, { uint32_t dequeue_loop_cnt_present = 0; uint32_t n_flows_present = 0; + uint32_t timer_dyn_timeout_present = 0; struct pipeline_timer *p_timer = (struct pipeline_timer *)p; uint32_t i; @@ -340,6 +342,16 @@ pipeline_cgnapt_parse_args(struct pipeline_timer *p, continue; } + if (strcmp(arg_name, "timer_dyn_timeout") == 0) { + if (timer_dyn_timeout_present) + return -1; + timer_dyn_timeout_present = 1; + + timer_dyn_timeout = atoi(arg_value); + printf("cgnapt dyn timeout: %d\n", timer_dyn_timeout); + continue; + } + if (strcmp(arg_name, "n_flows") == 0) { if(n_flows_present) return -1; @@ -403,14 +415,15 @@ static void *pipeline_timer_init(struct pipeline_params *params, void *arg) return NULL; p_timer->dequeue_loop_cnt = 100; - cgnapt_timeout = rte_get_tsc_hz() * CGNAPT_DYN_TIMEOUT; - printf("cgnapt_timerout%" PRIu64 "", cgnapt_timeout); timer_lcore = rte_lcore_id(); if (pipeline_cgnapt_parse_args(p_timer, params)) return NULL; + cgnapt_timeout = rte_get_tsc_hz() * timer_dyn_timeout; + printf("cgnapt_timerout%" PRIu64 "\n", cgnapt_timeout); + /* Create port alloc buffer */ timer_mempool = rte_mempool_create("timer_mempool", |