Initial support for DPDK 18.05
[samplevnf.git] / VNFs / DPPD-PROX / commands.c
index 93acc62..6c715c2 100644 (file)
@@ -84,9 +84,14 @@ static void warn_inactive_cores(uint32_t *cores, int count, const char *prefix)
 static inline int wait_command_handled(struct lcore_cfg *lconf)
 {
        uint64_t t1 = rte_rdtsc(), t2;
+       int max_time = 5;
+
+       if (lconf->msg.type == LCONF_MSG_STOP)
+               max_time = 30;
+
        while (lconf_is_req(lconf)) {
                t2 = rte_rdtsc();
-               if (t2 - t1 > 5 * rte_get_tsc_hz()) {
+               if (t2 - t1 > max_time * rte_get_tsc_hz()) {
                        // Failed to handle command ...
                        for (uint8_t task_id = 0; task_id < lconf->n_tasks_all; ++task_id) {
                                struct task_args *targs = &lconf->targs[task_id];
@@ -101,10 +106,22 @@ static inline int wait_command_handled(struct lcore_cfg *lconf)
        }
        return 0;
 }
+
+static inline void start_l3(struct task_args *targ)
+{
+       if (!task_is_master(targ)) {
+               if ((targ->nb_txrings != 0) || (targ->nb_txports != 0)) {
+                       if (targ->flags & TASK_ARG_L3)
+                               task_start_l3(targ->tbase, targ);
+               }
+       }
+}
+
 void start_cores(uint32_t *cores, int count, int task_id)
 {
        int n_started_cores = 0;
        uint32_t started_cores[RTE_MAX_LCORE];
+       struct task_args *targ;
 
        warn_inactive_cores(cores, count, "Can't start core");
 
@@ -112,7 +129,15 @@ void start_cores(uint32_t *cores, int count, int task_id)
                struct lcore_cfg *lconf = &lcore_cfg[cores[i]];
 
                if (lconf->n_tasks_run != lconf->n_tasks_all) {
-
+                       if (task_id == -1) {
+                               for (uint8_t tid = 0; tid < lconf->n_tasks_all; ++tid) {
+                                       targ = &lconf->targs[tid];
+                                       start_l3(targ);
+                               }
+                       } else {
+                               targ = &lconf->targs[task_id];
+                               start_l3(targ);
+                       }
                        lconf->msg.type = LCONF_MSG_START;
                        lconf->msg.task_id = task_id;
                        lconf_set_req(lconf);
@@ -236,6 +261,7 @@ void cmd_mem_stats(void)
 
 void cmd_mem_layout(void)
 {
+#if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0)
        const struct rte_memseg* memseg = rte_eal_get_physmem_layout();
 
        plog_info("Memory layout:\n");
@@ -262,6 +288,10 @@ void cmd_mem_layout(void)
                          memseg[i].addr,
                          memseg[i].len/memseg[i].hugepage_sz, sz_str);
        }
+#else
+       plog_info("Memory layout: command not supported in this DPDK version\n");
+       // TODO DPDK1805
+#endif
 }
 
 void cmd_dump(uint8_t lcore_id, uint8_t task_id, uint32_t nb_packets, struct input *input, int rx, int tx)