Adding timer dyn timeout config in timer profile. 41/35741/2
authorDeepak S <deepak.s@linux.intel.com>
Fri, 2 Jun 2017 06:55:53 +0000 (12:25 +0530)
committerDeepak S <deepak.s@linux.intel.com>
Tue, 6 Jun 2017 08:40:59 +0000 (08:40 +0000)
This patch enabled dynamic tune of timer timeout
[PIPELINE2]
type = TIMER
core = 2
timer_dyn_timeout = 20 #-- new config to change dyn timer timeout
n_flows = 1048576

Change-Id: I614cf73a7fc1afd9050580286c9a968aacb619fa
Signed-off-by: Deepak S <deepak.s@linux.intel.com>
VNFs/vCGNAPT/pipeline/pipeline_timer_be.c

index ed1c587..bfe8f5c 100644 (file)
@@ -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",