examples/ip_pipeline: remove infra code
authorJasvinder Singh <jasvinder.singh@intel.com>
Thu, 29 Mar 2018 18:31:39 +0000 (19:31 +0100)
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>
Thu, 5 Apr 2018 16:23:41 +0000 (18:23 +0200)
All the actions associated with application pipelines
tables and ports are now implemented using the new action
APIs. Therefore, thousands of lines of code are eliminated
from the application. The reduced code size is easier to
maintain and extend.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
16 files changed:
examples/ip_pipeline/Makefile
examples/ip_pipeline/app.h [deleted file]
examples/ip_pipeline/config_check.c [deleted file]
examples/ip_pipeline/config_parse.c [deleted file]
examples/ip_pipeline/config_parse_tm.c [deleted file]
examples/ip_pipeline/cpu_core_map.c [deleted file]
examples/ip_pipeline/cpu_core_map.h [deleted file]
examples/ip_pipeline/init.c [deleted file]
examples/ip_pipeline/main.c
examples/ip_pipeline/meson.build
examples/ip_pipeline/parser.c
examples/ip_pipeline/parser.h
examples/ip_pipeline/pipeline.h [deleted file]
examples/ip_pipeline/pipeline_be.h [deleted file]
examples/ip_pipeline/thread.c [deleted file]
examples/ip_pipeline/thread.h [deleted file]

index 8ba7887..981c4f7 100644 (file)
@@ -1,18 +1,13 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2010-2018 Intel Corporation
 
 # binary name
 APP = ip_pipeline
 
 # all source are stored in SRCS-y
 SRCS-y := main.c
-SRCS-y += config_parse.c
 SRCS-y += parser.c
-SRCS-y += config_parse_tm.c
-SRCS-y += config_check.c
-SRCS-y += init.c
-SRCS-y += thread.c
-SRCS-y += cpu_core_map.c
+#SRCS-y += thread.c
 
 # Build using pkg-config variables if possible
 $(shell pkg-config --exists libdpdk)
@@ -30,9 +25,7 @@ CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
 LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
 LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
 
-VPATH += pipeline
-CFLAGS += -I. -I./pipeline/
-CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -I.
 
 OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
 
@@ -59,21 +52,18 @@ ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
 
-VPATH += $(SRCDIR)/pipeline
-
 # Default target, can be overridden by command line or environment
 RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-INC += $(sort $(wildcard *.h)) $(sort $(wildcard pipeline/*.h))
+INC += $(sort $(wildcard *.h))
 
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y)
 
-CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline
+CFLAGS += -I$(SRCDIR)
 CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable
-CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += $(WERROR_FLAGS)
 
 include $(RTE_SDK)/mk/rte.extapp.mk
 
diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h
deleted file mode 100644 (file)
index dadaf2b..0000000
+++ /dev/null
@@ -1,1389 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2016 Intel Corporation
- */
-
-#ifndef __INCLUDE_APP_H__
-#define __INCLUDE_APP_H__
-
-#include <stdint.h>
-#include <string.h>
-
-#include <rte_common.h>
-#include <rte_mempool.h>
-#include <rte_ring.h>
-#include <rte_sched.h>
-#include <cmdline_parse.h>
-
-#include <rte_ethdev.h>
-#ifdef RTE_LIBRTE_KNI
-#include <rte_kni.h>
-#endif
-
-#include "cpu_core_map.h"
-#include "pipeline.h"
-
-#define APP_PARAM_NAME_SIZE                      PIPELINE_NAME_SIZE
-#define APP_LINK_PCI_BDF_SIZE                    16
-
-#ifndef APP_LINK_MAX_HWQ_IN
-#define APP_LINK_MAX_HWQ_IN                      128
-#endif
-
-#ifndef APP_LINK_MAX_HWQ_OUT
-#define APP_LINK_MAX_HWQ_OUT                     128
-#endif
-
-struct app_mempool_params {
-       char *name;
-       uint32_t parsed;
-       uint32_t buffer_size;
-       uint32_t pool_size;
-       uint32_t cache_size;
-       uint32_t cpu_socket_id;
-};
-
-struct app_link_params {
-       char *name;
-       uint32_t parsed;
-       uint32_t pmd_id; /* Generated based on port mask */
-       uint32_t arp_q; /* 0 = Disabled (packets go to default queue 0) */
-       uint32_t tcp_syn_q; /* 0 = Disabled (pkts go to default queue) */
-       uint32_t ip_local_q; /* 0 = Disabled (pkts go to default queue 0) */
-       uint32_t tcp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
-       uint32_t udp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
-       uint32_t sctp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
-       uint32_t rss_qs[APP_LINK_MAX_HWQ_IN];
-       uint32_t n_rss_qs;
-       uint64_t rss_proto_ipv4;
-       uint64_t rss_proto_ipv6;
-       uint64_t rss_proto_l2;
-       uint32_t promisc;
-       uint32_t state; /* DOWN = 0, UP = 1 */
-       uint32_t ip; /* 0 = Invalid */
-       uint32_t depth; /* Valid only when IP is valid */
-       uint64_t mac_addr; /* Read from HW */
-       char pci_bdf[APP_LINK_PCI_BDF_SIZE];
-
-       struct rte_eth_conf conf;
-};
-
-struct app_pktq_hwq_in_params {
-       char *name;
-       uint32_t parsed;
-       uint32_t mempool_id; /* Position in the app->mempool_params */
-       uint32_t size;
-       uint32_t burst;
-
-       struct rte_eth_rxconf conf;
-};
-
-struct app_pktq_hwq_out_params {
-       char *name;
-       uint32_t parsed;
-       uint32_t size;
-       uint32_t burst;
-       uint32_t dropless;
-       uint64_t n_retries;
-       struct rte_eth_txconf conf;
-};
-
-struct app_pktq_swq_params {
-       char *name;
-       uint32_t parsed;
-       uint32_t size;
-       uint32_t burst_read;
-       uint32_t burst_write;
-       uint32_t dropless;
-       uint64_t n_retries;
-       uint32_t cpu_socket_id;
-       uint32_t ipv4_frag;
-       uint32_t ipv6_frag;
-       uint32_t ipv4_ras;
-       uint32_t ipv6_ras;
-       uint32_t mtu;
-       uint32_t metadata_size;
-       uint32_t mempool_direct_id;
-       uint32_t mempool_indirect_id;
-};
-
-struct app_pktq_kni_params {
-       char *name;
-       uint32_t parsed;
-
-       uint32_t socket_id;
-       uint32_t core_id;
-       uint32_t hyper_th_id;
-       uint32_t force_bind;
-
-       uint32_t mempool_id; /* Position in the app->mempool_params */
-       uint32_t burst_read;
-       uint32_t burst_write;
-       uint32_t dropless;
-       uint64_t n_retries;
-};
-
-#ifndef APP_FILE_NAME_SIZE
-#define APP_FILE_NAME_SIZE                       256
-#endif
-
-#ifndef APP_MAX_SCHED_SUBPORTS
-#define APP_MAX_SCHED_SUBPORTS                   8
-#endif
-
-#ifndef APP_MAX_SCHED_PIPES
-#define APP_MAX_SCHED_PIPES                      4096
-#endif
-
-struct app_pktq_tm_params {
-       char *name;
-       uint32_t parsed;
-       const char *file_name;
-       struct rte_sched_port_params sched_port_params;
-       struct rte_sched_subport_params
-               sched_subport_params[APP_MAX_SCHED_SUBPORTS];
-       struct rte_sched_pipe_params
-               sched_pipe_profiles[RTE_SCHED_PIPE_PROFILES_PER_PORT];
-       int sched_pipe_to_profile[APP_MAX_SCHED_SUBPORTS * APP_MAX_SCHED_PIPES];
-       uint32_t burst_read;
-       uint32_t burst_write;
-};
-
-struct app_pktq_tap_params {
-       char *name;
-       uint32_t parsed;
-       uint32_t burst_read;
-       uint32_t burst_write;
-       uint32_t dropless;
-       uint64_t n_retries;
-       uint32_t mempool_id; /* Position in the app->mempool_params */
-};
-
-struct app_pktq_source_params {
-       char *name;
-       uint32_t parsed;
-       uint32_t mempool_id; /* Position in the app->mempool_params array */
-       uint32_t burst;
-       const char *file_name; /* Full path of PCAP file to be copied to mbufs */
-       uint32_t n_bytes_per_pkt;
-};
-
-struct app_pktq_sink_params {
-       char *name;
-       uint8_t parsed;
-       const char *file_name; /* Full path of PCAP file to be copied to mbufs */
-       uint32_t n_pkts_to_dump;
-};
-
-struct app_msgq_params {
-       char *name;
-       uint32_t parsed;
-       uint32_t size;
-       uint32_t cpu_socket_id;
-};
-
-enum app_pktq_in_type {
-       APP_PKTQ_IN_HWQ,
-       APP_PKTQ_IN_SWQ,
-       APP_PKTQ_IN_TM,
-       APP_PKTQ_IN_TAP,
-       APP_PKTQ_IN_KNI,
-       APP_PKTQ_IN_SOURCE,
-};
-
-struct app_pktq_in_params {
-       enum app_pktq_in_type type;
-       uint32_t id; /* Position in the appropriate app array */
-};
-
-enum app_pktq_out_type {
-       APP_PKTQ_OUT_HWQ,
-       APP_PKTQ_OUT_SWQ,
-       APP_PKTQ_OUT_TM,
-       APP_PKTQ_OUT_TAP,
-       APP_PKTQ_OUT_KNI,
-       APP_PKTQ_OUT_SINK,
-};
-
-struct app_pktq_out_params {
-       enum app_pktq_out_type type;
-       uint32_t id; /* Position in the appropriate app array */
-};
-
-#define APP_PIPELINE_TYPE_SIZE                   PIPELINE_TYPE_SIZE
-
-#define APP_MAX_PIPELINE_PKTQ_IN                 PIPELINE_MAX_PORT_IN
-#define APP_MAX_PIPELINE_PKTQ_OUT                PIPELINE_MAX_PORT_OUT
-#define APP_MAX_PIPELINE_MSGQ_IN                 PIPELINE_MAX_MSGQ_IN
-#define APP_MAX_PIPELINE_MSGQ_OUT                PIPELINE_MAX_MSGQ_OUT
-
-#define APP_MAX_PIPELINE_ARGS                    PIPELINE_MAX_ARGS
-
-struct app_pipeline_params {
-       char *name;
-       uint8_t parsed;
-
-       char type[APP_PIPELINE_TYPE_SIZE];
-
-       uint32_t socket_id;
-       uint32_t core_id;
-       uint32_t hyper_th_id;
-
-       struct app_pktq_in_params pktq_in[APP_MAX_PIPELINE_PKTQ_IN];
-       struct app_pktq_out_params pktq_out[APP_MAX_PIPELINE_PKTQ_OUT];
-       uint32_t msgq_in[APP_MAX_PIPELINE_MSGQ_IN];
-       uint32_t msgq_out[APP_MAX_PIPELINE_MSGQ_OUT];
-
-       uint32_t n_pktq_in;
-       uint32_t n_pktq_out;
-       uint32_t n_msgq_in;
-       uint32_t n_msgq_out;
-
-       uint32_t timer_period;
-
-       char *args_name[APP_MAX_PIPELINE_ARGS];
-       char *args_value[APP_MAX_PIPELINE_ARGS];
-       uint32_t n_args;
-};
-
-struct app_params;
-
-typedef void (*app_link_op)(struct app_params *app,
-       uint32_t link_id,
-       uint32_t up,
-       void *arg);
-
-#ifndef APP_MAX_PIPELINES
-#define APP_MAX_PIPELINES                        64
-#endif
-
-struct app_link_data {
-       app_link_op f_link[APP_MAX_PIPELINES];
-       void *arg[APP_MAX_PIPELINES];
-};
-
-struct app_pipeline_data {
-       void *be;
-       void *fe;
-       struct pipeline_type *ptype;
-       uint64_t timer_period;
-       uint32_t enabled;
-};
-
-struct app_thread_pipeline_data {
-       uint32_t pipeline_id;
-       void *be;
-       pipeline_be_op_run f_run;
-       pipeline_be_op_timer f_timer;
-       uint64_t timer_period;
-       uint64_t deadline;
-};
-
-#ifndef APP_MAX_THREAD_PIPELINES
-#define APP_MAX_THREAD_PIPELINES                 64
-#endif
-
-#ifndef APP_THREAD_TIMER_PERIOD
-#define APP_THREAD_TIMER_PERIOD                  1
-#endif
-
-struct app_thread_data {
-       struct app_thread_pipeline_data regular[APP_MAX_THREAD_PIPELINES];
-       struct app_thread_pipeline_data custom[APP_MAX_THREAD_PIPELINES];
-
-       uint32_t n_regular;
-       uint32_t n_custom;
-
-       uint64_t timer_period;
-       uint64_t thread_req_deadline;
-
-       uint64_t deadline;
-
-       struct rte_ring *msgq_in;
-       struct rte_ring *msgq_out;
-
-       uint64_t headroom_time;
-       uint64_t headroom_cycles;
-       double headroom_ratio;
-} __rte_cache_aligned;
-
-#ifndef APP_MAX_LINKS
-#define APP_MAX_LINKS                            16
-#endif
-
-struct app_eal_params {
-       /* Map lcore set to physical cpu set */
-       char *coremap;
-
-       /* Core ID that is used as master */
-       uint32_t master_lcore_present;
-       uint32_t master_lcore;
-
-       /* Number of memory channels */
-       uint32_t channels_present;
-       uint32_t channels;
-
-       /* Memory to allocate (see also --socket-mem) */
-       uint32_t memory_present;
-       uint32_t memory;
-
-       /* Force number of memory ranks (don't detect) */
-       uint32_t ranks_present;
-       uint32_t ranks;
-
-       /* Add a PCI device in black list. */
-       char *pci_blacklist[APP_MAX_LINKS];
-
-       /* Add a PCI device in white list. */
-       char *pci_whitelist[APP_MAX_LINKS];
-
-       /* Add a virtual device. */
-       char *vdev[APP_MAX_LINKS];
-
-        /* Use VMware TSC map instead of native RDTSC */
-       uint32_t vmware_tsc_map_present;
-       int vmware_tsc_map;
-
-        /* Type of this process (primary|secondary|auto) */
-       char *proc_type;
-
-        /* Set syslog facility */
-       char *syslog;
-
-       /* Set default log level */
-       uint32_t log_level_present;
-       uint32_t log_level;
-
-       /* Display version information on startup */
-       uint32_t version_present;
-       int version;
-
-       /* This help */
-       uint32_t help_present;
-       int help;
-
-        /* Use malloc instead of hugetlbfs */
-       uint32_t no_huge_present;
-       int no_huge;
-
-       /* Disable PCI */
-       uint32_t no_pci_present;
-       int no_pci;
-
-       /* Disable HPET */
-       uint32_t no_hpet_present;
-       int no_hpet;
-
-       /* No shared config (mmap'd files) */
-       uint32_t no_shconf_present;
-       int no_shconf;
-
-       /* Add driver */
-       char *add_driver;
-
-       /*  Memory to allocate on sockets (comma separated values)*/
-       char *socket_mem;
-
-       /* Directory where hugetlbfs is mounted */
-       char *huge_dir;
-
-       /* Prefix for hugepage filenames */
-       char *file_prefix;
-
-       /* Base virtual address */
-       char *base_virtaddr;
-
-       /* Create /dev/uioX (usually done by hotplug) */
-       uint32_t create_uio_dev_present;
-       int create_uio_dev;
-
-       /* Interrupt mode for VFIO (legacy|msi|msix) */
-       char *vfio_intr;
-
-       uint32_t parsed;
-};
-
-#ifndef APP_APPNAME_SIZE
-#define APP_APPNAME_SIZE                         256
-#endif
-
-#ifndef APP_MAX_MEMPOOLS
-#define APP_MAX_MEMPOOLS                         8
-#endif
-
-#define APP_MAX_HWQ_IN                  (APP_MAX_LINKS * APP_LINK_MAX_HWQ_IN)
-
-#define APP_MAX_HWQ_OUT                 (APP_MAX_LINKS * APP_LINK_MAX_HWQ_OUT)
-
-#ifndef APP_MAX_PKTQ_SWQ
-#define APP_MAX_PKTQ_SWQ                         256
-#endif
-
-#define APP_MAX_PKTQ_TM                          APP_MAX_LINKS
-
-#ifndef APP_MAX_PKTQ_TAP
-#define APP_MAX_PKTQ_TAP                         APP_MAX_LINKS
-#endif
-
-#define APP_MAX_PKTQ_KNI                         APP_MAX_LINKS
-
-#ifndef APP_MAX_PKTQ_SOURCE
-#define APP_MAX_PKTQ_SOURCE                      64
-#endif
-
-#ifndef APP_MAX_PKTQ_SINK
-#define APP_MAX_PKTQ_SINK                        64
-#endif
-
-#ifndef APP_MAX_MSGQ
-#define APP_MAX_MSGQ                             256
-#endif
-
-#ifndef APP_EAL_ARGC
-#define APP_EAL_ARGC                             64
-#endif
-
-#ifndef APP_MAX_PIPELINE_TYPES
-#define APP_MAX_PIPELINE_TYPES                   64
-#endif
-
-#ifndef APP_MAX_THREADS
-#define APP_MAX_THREADS                          RTE_MAX_LCORE
-#endif
-
-#ifndef APP_MAX_CMDS
-#define APP_MAX_CMDS                             64
-#endif
-
-#ifndef APP_THREAD_HEADROOM_STATS_COLLECT
-#define APP_THREAD_HEADROOM_STATS_COLLECT        1
-#endif
-
-#define APP_CORE_MASK_SIZE                                     \
-       (RTE_MAX_LCORE / 64 + ((RTE_MAX_LCORE % 64) ? 1 : 0))
-
-struct app_params {
-       /* Config */
-       char app_name[APP_APPNAME_SIZE];
-       const char *config_file;
-       const char *script_file;
-       const char *parser_file;
-       const char *output_file;
-       const char *preproc;
-       const char *preproc_args;
-       uint64_t port_mask;
-       uint32_t log_level;
-
-       struct app_eal_params eal_params;
-       struct app_mempool_params mempool_params[APP_MAX_MEMPOOLS];
-       struct app_link_params link_params[APP_MAX_LINKS];
-       struct app_pktq_hwq_in_params hwq_in_params[APP_MAX_HWQ_IN];
-       struct app_pktq_hwq_out_params hwq_out_params[APP_MAX_HWQ_OUT];
-       struct app_pktq_swq_params swq_params[APP_MAX_PKTQ_SWQ];
-       struct app_pktq_tm_params tm_params[APP_MAX_PKTQ_TM];
-       struct app_pktq_tap_params tap_params[APP_MAX_PKTQ_TAP];
-       struct app_pktq_kni_params kni_params[APP_MAX_PKTQ_KNI];
-       struct app_pktq_source_params source_params[APP_MAX_PKTQ_SOURCE];
-       struct app_pktq_sink_params sink_params[APP_MAX_PKTQ_SINK];
-       struct app_msgq_params msgq_params[APP_MAX_MSGQ];
-       struct app_pipeline_params pipeline_params[APP_MAX_PIPELINES];
-
-       uint32_t n_mempools;
-       uint32_t n_links;
-       uint32_t n_pktq_hwq_in;
-       uint32_t n_pktq_hwq_out;
-       uint32_t n_pktq_swq;
-       uint32_t n_pktq_tm;
-       uint32_t n_pktq_tap;
-       uint32_t n_pktq_kni;
-       uint32_t n_pktq_source;
-       uint32_t n_pktq_sink;
-       uint32_t n_msgq;
-       uint32_t n_pipelines;
-
-       /* Init */
-       char *eal_argv[1 + APP_EAL_ARGC];
-       struct cpu_core_map *core_map;
-       uint64_t core_mask[APP_CORE_MASK_SIZE];
-       struct rte_mempool *mempool[APP_MAX_MEMPOOLS];
-       struct app_link_data link_data[APP_MAX_LINKS];
-       struct rte_ring *swq[APP_MAX_PKTQ_SWQ];
-       struct rte_sched_port *tm[APP_MAX_PKTQ_TM];
-       int tap[APP_MAX_PKTQ_TAP];
-#ifdef RTE_LIBRTE_KNI
-       struct rte_kni *kni[APP_MAX_PKTQ_KNI];
-#endif /* RTE_LIBRTE_KNI */
-       struct rte_ring *msgq[APP_MAX_MSGQ];
-       struct pipeline_type pipeline_type[APP_MAX_PIPELINE_TYPES];
-       struct app_pipeline_data pipeline_data[APP_MAX_PIPELINES];
-       struct app_thread_data thread_data[APP_MAX_THREADS];
-       cmdline_parse_ctx_t cmds[APP_MAX_CMDS + 1];
-
-       int eal_argc;
-       uint32_t n_pipeline_types;
-       uint32_t n_cmds;
-};
-
-#define APP_PARAM_VALID(obj) ((obj)->name != NULL)
-
-#define APP_PARAM_COUNT(obj_array, n_objs)                             \
-{                                                                      \
-       size_t i;                                                       \
-                                                                       \
-       n_objs = 0;                                                     \
-       for (i = 0; i < RTE_DIM(obj_array); i++)                        \
-               if (APP_PARAM_VALID(&((obj_array)[i])))                 \
-                       n_objs++;                                       \
-}
-
-#define APP_PARAM_FIND(obj_array, key)                                 \
-({                                                                     \
-       ssize_t obj_idx;                                                \
-       const ssize_t obj_count = RTE_DIM(obj_array);                   \
-                                                                       \
-       for (obj_idx = 0; obj_idx < obj_count; obj_idx++) {             \
-               if (!APP_PARAM_VALID(&((obj_array)[obj_idx])))          \
-                       continue;                                       \
-                                                                       \
-               if (strcmp(key, (obj_array)[obj_idx].name) == 0)        \
-                       break;                                          \
-       }                                                               \
-       obj_idx < obj_count ? obj_idx : -ENOENT;                        \
-})
-
-#define APP_PARAM_FIND_BY_ID(obj_array, prefix, id, obj)               \
-do {                                                                   \
-       char name[APP_PARAM_NAME_SIZE];                                 \
-       ssize_t pos;                                                    \
-                                                                       \
-       sprintf(name, prefix "%" PRIu32, id);                           \
-       pos = APP_PARAM_FIND(obj_array, name);                          \
-       obj = (pos < 0) ? NULL : &((obj_array)[pos]);                   \
-} while (0)
-
-#define APP_PARAM_GET_ID(obj, prefix, id)                              \
-do                                                                     \
-       sscanf(obj->name, prefix "%" SCNu32, &id);                              \
-while (0)                                                              \
-
-#define        APP_CHECK(exp, fmt, ...)                                        \
-do {                                                                   \
-       if (!(exp)) {                                                   \
-               fprintf(stderr, fmt "\n", ## __VA_ARGS__);              \
-               abort();                                                \
-       }                                                               \
-} while (0)
-
-enum app_log_level {
-       APP_LOG_LEVEL_HIGH = 1,
-       APP_LOG_LEVEL_LOW,
-       APP_LOG_LEVELS
-};
-
-#define APP_LOG(app, level, fmt, ...)                                  \
-do {                                                                   \
-       if (app->log_level >= APP_LOG_LEVEL_ ## level)                  \
-               fprintf(stdout, "[APP] " fmt "\n", ## __VA_ARGS__);     \
-} while (0)
-
-static inline uint32_t
-app_link_get_n_rxq(struct app_params *app, struct app_link_params *link)
-{
-       uint32_t n_rxq = 0, link_id, i;
-       uint32_t n_pktq_hwq_in = RTE_MIN(app->n_pktq_hwq_in,
-               RTE_DIM(app->hwq_in_params));
-
-       APP_PARAM_GET_ID(link, "LINK", link_id);
-
-       for (i = 0; i < n_pktq_hwq_in; i++) {
-               struct app_pktq_hwq_in_params *p = &app->hwq_in_params[i];
-               uint32_t rxq_link_id, rxq_queue_id;
-
-               sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
-                       &rxq_link_id, &rxq_queue_id);
-               if (rxq_link_id == link_id)
-                       n_rxq++;
-       }
-
-       return n_rxq;
-}
-
-static inline uint32_t
-app_link_get_n_txq(struct app_params *app, struct app_link_params *link)
-{
-       uint32_t n_txq = 0, link_id, i;
-       uint32_t n_pktq_hwq_out = RTE_MIN(app->n_pktq_hwq_out,
-               RTE_DIM(app->hwq_out_params));
-
-       APP_PARAM_GET_ID(link, "LINK", link_id);
-
-       for (i = 0; i < n_pktq_hwq_out; i++) {
-               struct app_pktq_hwq_out_params *p = &app->hwq_out_params[i];
-               uint32_t txq_link_id, txq_queue_id;
-
-               sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
-                       &txq_link_id, &txq_queue_id);
-               if (txq_link_id == link_id)
-                       n_txq++;
-       }
-
-       return n_txq;
-}
-
-static inline uint32_t
-app_rxq_get_readers(struct app_params *app, struct app_pktq_hwq_in_params *rxq)
-{
-       uint32_t pos = rxq - app->hwq_in_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_HWQ) &&
-                               (pktq->id == pos))
-                               n_readers++;
-               }
-       }
-
-       return n_readers;
-}
-
-static inline uint32_t
-app_swq_get_readers(struct app_params *app, struct app_pktq_swq_params *swq)
-{
-       uint32_t pos = swq - app->swq_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_SWQ) &&
-                               (pktq->id == pos))
-                               n_readers++;
-               }
-       }
-
-       return n_readers;
-}
-
-static inline struct app_pipeline_params *
-app_swq_get_reader(struct app_params *app,
-       struct app_pktq_swq_params *swq,
-       uint32_t *pktq_in_id)
-{
-       struct app_pipeline_params *reader = NULL;
-       uint32_t pos = swq - app->swq_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, id = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_SWQ) &&
-                               (pktq->id == pos)) {
-                               n_readers++;
-                               reader = p;
-                               id = j;
-                       }
-               }
-       }
-
-       if (n_readers != 1)
-               return NULL;
-
-       *pktq_in_id = id;
-       return reader;
-}
-
-static inline uint32_t
-app_tm_get_readers(struct app_params *app, struct app_pktq_tm_params *tm)
-{
-       uint32_t pos = tm - app->tm_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_TM) &&
-                               (pktq->id == pos))
-                               n_readers++;
-               }
-       }
-
-       return n_readers;
-}
-
-static inline struct app_pipeline_params *
-app_tm_get_reader(struct app_params *app,
-       struct app_pktq_tm_params *tm,
-       uint32_t *pktq_in_id)
-{
-       struct app_pipeline_params *reader = NULL;
-       uint32_t pos = tm - app->tm_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, id = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_TM) &&
-                               (pktq->id == pos)) {
-                               n_readers++;
-                               reader = p;
-                               id = j;
-                       }
-               }
-       }
-
-       if (n_readers != 1)
-               return NULL;
-
-       *pktq_in_id = id;
-       return reader;
-}
-
-static inline uint32_t
-app_tap_get_readers(struct app_params *app, struct app_pktq_tap_params *tap)
-{
-       uint32_t pos = tap - app->tap_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_TAP) &&
-                               (pktq->id == pos))
-                               n_readers++;
-               }
-       }
-
-       return n_readers;
-}
-
-static inline struct app_pipeline_params *
-app_tap_get_reader(struct app_params *app,
-       struct app_pktq_tap_params *tap,
-       uint32_t *pktq_in_id)
-{
-       struct app_pipeline_params *reader = NULL;
-       uint32_t pos = tap - app->tap_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, id = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_TAP) &&
-                               (pktq->id == pos)) {
-                               n_readers++;
-                               reader = p;
-                               id = j;
-                       }
-               }
-       }
-
-       if (n_readers != 1)
-               return NULL;
-
-       *pktq_in_id = id;
-       return reader;
-}
-
-static inline uint32_t
-app_kni_get_readers(struct app_params *app, struct app_pktq_kni_params *kni)
-{
-       uint32_t pos = kni - app->kni_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_KNI) &&
-                               (pktq->id == pos))
-                               n_readers++;
-               }
-       }
-
-       return n_readers;
-}
-
-static inline struct app_pipeline_params *
-app_kni_get_reader(struct app_params *app,
-                                 struct app_pktq_kni_params *kni,
-                                 uint32_t *pktq_in_id)
-{
-       struct app_pipeline_params *reader = NULL;
-       uint32_t pos = kni - app->kni_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, id = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_KNI) &&
-                               (pktq->id == pos)) {
-                               n_readers++;
-                               reader = p;
-                               id = j;
-                       }
-               }
-       }
-
-       if (n_readers != 1)
-               return NULL;
-
-       *pktq_in_id = id;
-       return reader;
-}
-
-static inline uint32_t
-app_source_get_readers(struct app_params *app,
-struct app_pktq_source_params *source)
-{
-       uint32_t pos = source - app->source_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_in; j++) {
-                       struct app_pktq_in_params *pktq = &p->pktq_in[j];
-
-                       if ((pktq->type == APP_PKTQ_IN_SOURCE) &&
-                               (pktq->id == pos))
-                               n_readers++;
-               }
-       }
-
-       return n_readers;
-}
-
-static inline uint32_t
-app_msgq_get_readers(struct app_params *app, struct app_msgq_params *msgq)
-{
-       uint32_t pos = msgq - app->msgq_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_readers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_msgq_in = RTE_MIN(p->n_msgq_in, RTE_DIM(p->msgq_in));
-               uint32_t j;
-
-               for (j = 0; j < n_msgq_in; j++)
-                       if (p->msgq_in[j] == pos)
-                               n_readers++;
-       }
-
-       return n_readers;
-}
-
-static inline uint32_t
-app_txq_get_writers(struct app_params *app, struct app_pktq_hwq_out_params *txq)
-{
-       uint32_t pos = txq - app->hwq_out_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_HWQ) &&
-                               (pktq->id == pos))
-                               n_writers++;
-               }
-       }
-
-       return n_writers;
-}
-
-static inline uint32_t
-app_swq_get_writers(struct app_params *app, struct app_pktq_swq_params *swq)
-{
-       uint32_t pos = swq - app->swq_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_SWQ) &&
-                               (pktq->id == pos))
-                               n_writers++;
-               }
-       }
-
-       return n_writers;
-}
-
-static inline struct app_pipeline_params *
-app_swq_get_writer(struct app_params *app,
-       struct app_pktq_swq_params *swq,
-       uint32_t *pktq_out_id)
-{
-       struct app_pipeline_params *writer = NULL;
-       uint32_t pos = swq - app->swq_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, id = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_SWQ) &&
-                               (pktq->id == pos)) {
-                               n_writers++;
-                               writer = p;
-                               id = j;
-                       }
-               }
-       }
-
-       if (n_writers != 1)
-               return NULL;
-
-       *pktq_out_id = id;
-       return writer;
-}
-
-static inline uint32_t
-app_tm_get_writers(struct app_params *app, struct app_pktq_tm_params *tm)
-{
-       uint32_t pos = tm - app->tm_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_TM) &&
-                               (pktq->id == pos))
-                               n_writers++;
-               }
-       }
-
-       return n_writers;
-}
-
-static inline struct app_pipeline_params *
-app_tm_get_writer(struct app_params *app,
-       struct app_pktq_tm_params *tm,
-       uint32_t *pktq_out_id)
-{
-       struct app_pipeline_params *writer = NULL;
-       uint32_t pos = tm - app->tm_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, id = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_TM) &&
-                               (pktq->id == pos)) {
-                               n_writers++;
-                               writer = p;
-                               id = j;
-                       }
-               }
-       }
-
-       if (n_writers != 1)
-               return NULL;
-
-       *pktq_out_id = id;
-       return writer;
-}
-
-static inline uint32_t
-app_tap_get_writers(struct app_params *app, struct app_pktq_tap_params *tap)
-{
-       uint32_t pos = tap - app->tap_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-               if ((pktq->type == APP_PKTQ_OUT_TAP) &&
-                       (pktq->id == pos))
-                       n_writers++;
-               }
-       }
-
-       return n_writers;
-}
-
-static inline struct app_pipeline_params *
-app_tap_get_writer(struct app_params *app,
-       struct app_pktq_tap_params *tap,
-       uint32_t *pktq_out_id)
-{
-       struct app_pipeline_params *writer = NULL;
-       uint32_t pos = tap - app->tap_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, id = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_TAP) &&
-                               (pktq->id == pos)) {
-                               n_writers++;
-                               writer = p;
-                               id = j;
-                       }
-               }
-       }
-
-       if (n_writers != 1)
-               return NULL;
-
-       *pktq_out_id = id;
-       return writer;
-}
-
-static inline uint32_t
-app_kni_get_writers(struct app_params *app, struct app_pktq_kni_params *kni)
-{
-       uint32_t pos = kni - app->kni_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_KNI) &&
-                               (pktq->id == pos))
-                               n_writers++;
-               }
-       }
-
-       return n_writers;
-}
-
-static inline struct app_pipeline_params *
-app_kni_get_writer(struct app_params *app,
-                                 struct app_pktq_kni_params *kni,
-                                 uint32_t *pktq_out_id)
-{
-       struct app_pipeline_params *writer = NULL;
-       uint32_t pos = kni - app->kni_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, id = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_KNI) &&
-                               (pktq->id == pos)) {
-                               n_writers++;
-                               writer = p;
-                               id = j;
-                       }
-               }
-       }
-
-       if (n_writers != 1)
-               return NULL;
-
-       *pktq_out_id = id;
-       return writer;
-}
-
-static inline uint32_t
-app_sink_get_writers(struct app_params *app, struct app_pktq_sink_params *sink)
-{
-       uint32_t pos = sink - app->sink_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
-                       RTE_DIM(p->pktq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_pktq_out; j++) {
-                       struct app_pktq_out_params *pktq = &p->pktq_out[j];
-
-                       if ((pktq->type == APP_PKTQ_OUT_SINK) &&
-                               (pktq->id == pos))
-                               n_writers++;
-               }
-       }
-
-       return n_writers;
-}
-
-static inline uint32_t
-app_msgq_get_writers(struct app_params *app, struct app_msgq_params *msgq)
-{
-       uint32_t pos = msgq - app->msgq_params;
-       uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
-               RTE_DIM(app->pipeline_params));
-       uint32_t n_writers = 0, i;
-
-       for (i = 0; i < n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               uint32_t n_msgq_out = RTE_MIN(p->n_msgq_out,
-                       RTE_DIM(p->msgq_out));
-               uint32_t j;
-
-               for (j = 0; j < n_msgq_out; j++)
-                       if (p->msgq_out[j] == pos)
-                               n_writers++;
-       }
-
-       return n_writers;
-}
-
-static inline struct app_link_params *
-app_get_link_for_rxq(struct app_params *app, struct app_pktq_hwq_in_params *p)
-{
-       char link_name[APP_PARAM_NAME_SIZE];
-       ssize_t link_param_idx;
-       uint32_t rxq_link_id, rxq_queue_id;
-
-       sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
-               &rxq_link_id, &rxq_queue_id);
-       sprintf(link_name, "LINK%" PRIu32, rxq_link_id);
-       link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
-       APP_CHECK((link_param_idx >= 0),
-               "Cannot find %s for %s", link_name, p->name);
-
-       return &app->link_params[link_param_idx];
-}
-
-static inline struct app_link_params *
-app_get_link_for_txq(struct app_params *app, struct app_pktq_hwq_out_params *p)
-{
-       char link_name[APP_PARAM_NAME_SIZE];
-       ssize_t link_param_idx;
-       uint32_t txq_link_id, txq_queue_id;
-
-       sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
-               &txq_link_id, &txq_queue_id);
-       sprintf(link_name, "LINK%" PRIu32, txq_link_id);
-       link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
-       APP_CHECK((link_param_idx >= 0),
-               "Cannot find %s for %s", link_name, p->name);
-
-       return &app->link_params[link_param_idx];
-}
-
-static inline struct app_link_params *
-app_get_link_for_tm(struct app_params *app, struct app_pktq_tm_params *p_tm)
-{
-       char link_name[APP_PARAM_NAME_SIZE];
-       uint32_t link_id;
-       ssize_t link_param_idx;
-
-       sscanf(p_tm->name, "TM%" PRIu32, &link_id);
-       sprintf(link_name, "LINK%" PRIu32, link_id);
-       link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
-       APP_CHECK((link_param_idx >= 0),
-               "Cannot find %s for %s", link_name, p_tm->name);
-
-       return &app->link_params[link_param_idx];
-}
-
-static inline struct app_link_params *
-app_get_link_for_kni(struct app_params *app, struct app_pktq_kni_params *p_kni)
-{
-       char link_name[APP_PARAM_NAME_SIZE];
-       uint32_t link_id;
-       ssize_t link_param_idx;
-
-       sscanf(p_kni->name, "KNI%" PRIu32, &link_id);
-       sprintf(link_name, "LINK%" PRIu32, link_id);
-       link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
-       APP_CHECK((link_param_idx >= 0),
-                         "Cannot find %s for %s", link_name, p_kni->name);
-
-       return &app->link_params[link_param_idx];
-}
-
-static inline uint32_t
-app_core_is_enabled(struct app_params *app, uint32_t lcore_id)
-{
-       return(app->core_mask[lcore_id / 64] &
-               (1LLU << (lcore_id % 64)));
-}
-
-static inline void
-app_core_enable_in_core_mask(struct app_params *app, int lcore_id)
-{
-       app->core_mask[lcore_id / 64] |= 1LLU << (lcore_id % 64);
-
-}
-
-static inline void
-app_core_build_core_mask_string(struct app_params *app, char *mask_buffer)
-{
-       int i;
-
-       mask_buffer[0] = '\0';
-       for (i = (int)RTE_DIM(app->core_mask); i > 0; i--) {
-               /* For Hex representation of bits in uint64_t */
-               char buffer[(64 / 8) * 2 + 1];
-               memset(buffer, 0, sizeof(buffer));
-               snprintf(buffer, sizeof(buffer), "%016" PRIx64,
-                        app->core_mask[i-1]);
-               strcat(mask_buffer, buffer);
-       }
-}
-
-int app_config_init(struct app_params *app);
-
-int app_config_args(struct app_params *app,
-       int argc, char **argv);
-
-int app_config_preproc(struct app_params *app);
-
-int app_config_parse(struct app_params *app,
-       const char *file_name);
-
-int app_config_parse_tm(struct app_params *app);
-
-void app_config_save(struct app_params *app,
-       const char *file_name);
-
-int app_config_check(struct app_params *app);
-
-int app_init(struct app_params *app);
-
-int app_thread(void *arg);
-
-void app_link_up_internal(struct app_params *app,
-       struct app_link_params *cp);
-
-void app_link_down_internal(struct app_params *app,
-       struct app_link_params *cp);
-
-#endif
diff --git a/examples/ip_pipeline/config_check.c b/examples/ip_pipeline/config_check.c
deleted file mode 100644 (file)
index 86d1191..0000000
+++ /dev/null
@@ -1,488 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2016 Intel Corporation
- */
-
-#include <stdio.h>
-
-#include <rte_ip.h>
-
-#include "app.h"
-
-static void
-check_mempools(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_mempools; i++) {
-               struct app_mempool_params *p = &app->mempool_params[i];
-
-               APP_CHECK((p->pool_size > 0),
-                       "Mempool %s size is 0\n", p->name);
-
-               APP_CHECK((p->cache_size > 0),
-                       "Mempool %s cache size is 0\n", p->name);
-
-               APP_CHECK(rte_is_power_of_2(p->cache_size),
-                       "Mempool %s cache size not a power of 2\n", p->name);
-       }
-}
-
-static inline uint32_t
-link_rxq_used(struct app_link_params *link, uint32_t q_id)
-{
-       uint32_t i;
-
-       if ((link->arp_q == q_id) ||
-               (link->tcp_syn_q == q_id) ||
-               (link->ip_local_q == q_id) ||
-               (link->tcp_local_q == q_id) ||
-               (link->udp_local_q == q_id) ||
-               (link->sctp_local_q == q_id))
-               return 1;
-
-       for (i = 0; i < link->n_rss_qs; i++)
-               if (link->rss_qs[i] == q_id)
-                       return 1;
-
-       return 0;
-}
-
-static void
-check_links(struct app_params *app)
-{
-       uint32_t i;
-
-       /* Check that number of links matches the port mask */
-       if (app->port_mask) {
-               uint32_t n_links_port_mask =
-                       __builtin_popcountll(app->port_mask);
-
-               APP_CHECK((app->n_links == n_links_port_mask),
-                       "Not enough links provided in the PORT_MASK\n");
-       }
-
-       for (i = 0; i < app->n_links; i++) {
-               struct app_link_params *link = &app->link_params[i];
-               uint32_t rxq_max, n_rxq, n_txq, link_id, i;
-
-               APP_PARAM_GET_ID(link, "LINK", link_id);
-
-               /* Check that link RXQs are contiguous */
-               rxq_max = 0;
-               if (link->arp_q > rxq_max)
-                       rxq_max = link->arp_q;
-               if (link->tcp_syn_q > rxq_max)
-                       rxq_max = link->tcp_syn_q;
-               if (link->ip_local_q > rxq_max)
-                       rxq_max = link->ip_local_q;
-               if (link->tcp_local_q > rxq_max)
-                       rxq_max = link->tcp_local_q;
-               if (link->udp_local_q > rxq_max)
-                       rxq_max = link->udp_local_q;
-               if (link->sctp_local_q > rxq_max)
-                       rxq_max = link->sctp_local_q;
-               for (i = 0; i < link->n_rss_qs; i++)
-                       if (link->rss_qs[i] > rxq_max)
-                               rxq_max = link->rss_qs[i];
-
-               for (i = 1; i <= rxq_max; i++)
-                       APP_CHECK((link_rxq_used(link, i)),
-                               "%s RXQs are not contiguous (A)\n", link->name);
-
-               n_rxq = app_link_get_n_rxq(app, link);
-
-               APP_CHECK((n_rxq), "%s does not have any RXQ\n", link->name);
-
-               APP_CHECK((n_rxq == rxq_max + 1),
-                       "%s RXQs are not contiguous (B)\n", link->name);
-
-               for (i = 0; i < n_rxq; i++) {
-                       char name[APP_PARAM_NAME_SIZE];
-                       int pos;
-
-                       sprintf(name, "RXQ%" PRIu32 ".%" PRIu32,
-                               link_id, i);
-                       pos = APP_PARAM_FIND(app->hwq_in_params, name);
-                       APP_CHECK((pos >= 0),
-                               "%s RXQs are not contiguous (C)\n", link->name);
-               }
-
-               /* Check that link TXQs are contiguous */
-               n_txq = app_link_get_n_txq(app, link);
-
-               APP_CHECK((n_txq),  "%s does not have any TXQ\n", link->name);
-
-               for (i = 0; i < n_txq; i++) {
-                       char name[APP_PARAM_NAME_SIZE];
-                       int pos;
-
-                       sprintf(name, "TXQ%" PRIu32 ".%" PRIu32,
-                               link_id, i);
-                       pos = APP_PARAM_FIND(app->hwq_out_params, name);
-                       APP_CHECK((pos >= 0),
-                               "%s TXQs are not contiguous\n", link->name);
-               }
-       }
-}
-
-static void
-check_rxqs(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_hwq_in; i++) {
-               struct app_pktq_hwq_in_params *p = &app->hwq_in_params[i];
-               uint32_t n_readers = app_rxq_get_readers(app, p);
-
-               APP_CHECK((p->size > 0),
-                       "%s size is 0\n", p->name);
-
-               APP_CHECK((rte_is_power_of_2(p->size)),
-                       "%s size is not a power of 2\n", p->name);
-
-               APP_CHECK((p->burst > 0),
-                       "%s burst size is 0\n", p->name);
-
-               APP_CHECK((p->burst <= p->size),
-                       "%s burst size is bigger than its size\n", p->name);
-
-               APP_CHECK((n_readers != 0),
-                       "%s has no reader\n", p->name);
-
-               APP_CHECK((n_readers == 1),
-                       "%s has more than one reader\n", p->name);
-       }
-}
-
-static void
-check_txqs(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_hwq_out; i++) {
-               struct app_pktq_hwq_out_params *p = &app->hwq_out_params[i];
-               uint32_t n_writers = app_txq_get_writers(app, p);
-
-               APP_CHECK((p->size > 0),
-                       "%s size is 0\n", p->name);
-
-               APP_CHECK((rte_is_power_of_2(p->size)),
-                       "%s size is not a power of 2\n", p->name);
-
-               APP_CHECK((p->burst > 0),
-                       "%s burst size is 0\n", p->name);
-
-               APP_CHECK((p->burst <= p->size),
-                       "%s burst size is bigger than its size\n", p->name);
-
-               APP_CHECK((n_writers != 0),
-                       "%s has no writer\n", p->name);
-
-               APP_CHECK((n_writers == 1),
-                       "%s has more than one writer\n", p->name);
-       }
-}
-
-static void
-check_swqs(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_swq; i++) {
-               struct app_pktq_swq_params *p = &app->swq_params[i];
-               uint32_t n_readers = app_swq_get_readers(app, p);
-               uint32_t n_writers = app_swq_get_writers(app, p);
-               uint32_t n_flags;
-
-               APP_CHECK((p->size > 0),
-                       "%s size is 0\n", p->name);
-
-               APP_CHECK((rte_is_power_of_2(p->size)),
-                       "%s size is not a power of 2\n", p->name);
-
-               APP_CHECK((p->burst_read > 0),
-                       "%s read burst size is 0\n", p->name);
-
-               APP_CHECK((p->burst_read <= p->size),
-                       "%s read burst size is bigger than its size\n",
-                       p->name);
-
-               APP_CHECK((p->burst_write > 0),
-                       "%s write burst size is 0\n", p->name);
-
-               APP_CHECK((p->burst_write <= p->size),
-                       "%s write burst size is bigger than its size\n",
-                       p->name);
-
-               APP_CHECK((n_readers != 0),
-                       "%s has no reader\n", p->name);
-
-               if (n_readers > 1)
-                       APP_LOG(app, LOW, "%s has more than one reader", p->name);
-
-               APP_CHECK((n_writers != 0),
-                       "%s has no writer\n", p->name);
-
-               if (n_writers > 1)
-                       APP_LOG(app, LOW, "%s has more than one writer", p->name);
-
-               n_flags = p->ipv4_frag + p->ipv6_frag + p->ipv4_ras + p->ipv6_ras;
-
-               APP_CHECK((n_flags < 2),
-                       "%s has more than one fragmentation or reassembly mode enabled\n",
-                       p->name);
-
-               APP_CHECK((!((n_readers > 1) && (n_flags == 1))),
-                       "%s has more than one reader when fragmentation or reassembly"
-                       " mode enabled\n",
-                       p->name);
-
-               APP_CHECK((!((n_writers > 1) && (n_flags == 1))),
-                       "%s has more than one writer when fragmentation or reassembly"
-                       " mode enabled\n",
-                       p->name);
-
-               n_flags = p->ipv4_ras + p->ipv6_ras;
-
-               APP_CHECK((!((p->dropless == 1) && (n_flags == 1))),
-                       "%s has dropless when reassembly mode enabled\n", p->name);
-
-               n_flags = p->ipv4_frag + p->ipv6_frag;
-
-               if (n_flags == 1) {
-                       uint16_t ip_hdr_size = (p->ipv4_frag) ? sizeof(struct ipv4_hdr) :
-                               sizeof(struct ipv6_hdr);
-
-                       APP_CHECK((p->mtu > ip_hdr_size),
-                               "%s mtu size is smaller than ip header\n", p->name);
-
-                       APP_CHECK((!((p->mtu - ip_hdr_size) % 8)),
-                               "%s mtu size is incorrect\n", p->name);
-               }
-       }
-}
-
-static void
-check_tms(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_tm; i++) {
-               struct app_pktq_tm_params *p = &app->tm_params[i];
-               uint32_t n_readers = app_tm_get_readers(app, p);
-               uint32_t n_writers = app_tm_get_writers(app, p);
-
-               APP_CHECK((n_readers != 0),
-                       "%s has no reader\n", p->name);
-
-               APP_CHECK((n_readers == 1),
-                       "%s has more than one reader\n", p->name);
-
-               APP_CHECK((n_writers != 0),
-                       "%s has no writer\n", p->name);
-
-               APP_CHECK((n_writers == 1),
-                       "%s has more than one writer\n", p->name);
-       }
-}
-
-static void
-check_taps(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_tap; i++) {
-               struct app_pktq_tap_params *p = &app->tap_params[i];
-               uint32_t n_readers = app_tap_get_readers(app, p);
-               uint32_t n_writers = app_tap_get_writers(app, p);
-
-               APP_CHECK((n_readers != 0),
-                       "%s has no reader\n", p->name);
-
-               APP_CHECK((n_readers == 1),
-                       "%s has more than one reader\n", p->name);
-
-               APP_CHECK((n_writers != 0),
-                       "%s has no writer\n", p->name);
-
-               APP_CHECK((n_writers == 1),
-                       "%s has more than one writer\n", p->name);
-
-               APP_CHECK((p->burst_read > 0),
-                       "%s read burst size is 0\n", p->name);
-
-               APP_CHECK((p->burst_write > 0),
-                       "%s write burst size is 0\n", p->name);
-       }
-}
-
-static void
-check_knis(struct app_params *app) {
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_kni; i++) {
-               struct app_pktq_kni_params *p = &app->kni_params[i];
-               uint32_t n_readers = app_kni_get_readers(app, p);
-               uint32_t n_writers = app_kni_get_writers(app, p);
-
-               APP_CHECK((n_readers != 0),
-                       "%s has no reader\n", p->name);
-
-               APP_CHECK((n_readers == 1),
-                       "%s has more than one reader\n", p->name);
-
-               APP_CHECK((n_writers != 0),
-                       "%s has no writer\n", p->name);
-
-               APP_CHECK((n_writers == 1),
-                       "%s has more than one writer\n", p->name);
-       }
-}
-
-static void
-check_sources(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_source; i++) {
-               struct app_pktq_source_params *p = &app->source_params[i];
-               uint32_t n_readers = app_source_get_readers(app, p);
-
-               APP_CHECK((n_readers != 0),
-                       "%s has no reader\n", p->name);
-
-               APP_CHECK((n_readers == 1),
-                       "%s has more than one reader\n", p->name);
-       }
-}
-
-static void
-check_sinks(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_sink; i++) {
-               struct app_pktq_sink_params *p = &app->sink_params[i];
-               uint32_t n_writers = app_sink_get_writers(app, p);
-
-               APP_CHECK((n_writers != 0),
-                       "%s has no writer\n", p->name);
-
-               APP_CHECK((n_writers == 1),
-                       "%s has more than one writer\n", p->name);
-       }
-}
-
-static void
-check_msgqs(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_msgq; i++) {
-               struct app_msgq_params *p = &app->msgq_params[i];
-               uint32_t n_readers = app_msgq_get_readers(app, p);
-               uint32_t n_writers = app_msgq_get_writers(app, p);
-               uint32_t msgq_req_pipeline, msgq_rsp_pipeline;
-               uint32_t msgq_req_core, msgq_rsp_core;
-
-               APP_CHECK((p->size > 0),
-                       "%s size is 0\n", p->name);
-
-               APP_CHECK((rte_is_power_of_2(p->size)),
-                       "%s size is not a power of 2\n", p->name);
-
-               msgq_req_pipeline = (strncmp(p->name, "MSGQ-REQ-PIPELINE",
-                       strlen("MSGQ-REQ-PIPELINE")) == 0);
-
-               msgq_rsp_pipeline = (strncmp(p->name, "MSGQ-RSP-PIPELINE",
-                       strlen("MSGQ-RSP-PIPELINE")) == 0);
-
-               msgq_req_core = (strncmp(p->name, "MSGQ-REQ-CORE",
-                       strlen("MSGQ-REQ-CORE")) == 0);
-
-               msgq_rsp_core = (strncmp(p->name, "MSGQ-RSP-CORE",
-                       strlen("MSGQ-RSP-CORE")) == 0);
-
-               if ((msgq_req_pipeline == 0) &&
-                       (msgq_rsp_pipeline == 0) &&
-                       (msgq_req_core == 0) &&
-                       (msgq_rsp_core == 0)) {
-                       APP_CHECK((n_readers != 0),
-                               "%s has no reader\n", p->name);
-
-                       APP_CHECK((n_readers == 1),
-                               "%s has more than one reader\n", p->name);
-
-                       APP_CHECK((n_writers != 0),
-                               "%s has no writer\n", p->name);
-
-                       APP_CHECK((n_writers == 1),
-                               "%s has more than one writer\n", p->name);
-               }
-
-               if (msgq_req_pipeline) {
-                       struct app_pipeline_params *pipeline;
-                       uint32_t pipeline_id;
-
-                       APP_PARAM_GET_ID(p, "MSGQ-REQ-PIPELINE", pipeline_id);
-
-                       APP_PARAM_FIND_BY_ID(app->pipeline_params,
-                               "PIPELINE",
-                               pipeline_id,
-                               pipeline);
-
-                       APP_CHECK((pipeline != NULL),
-                               "%s is not associated with a valid pipeline\n",
-                               p->name);
-               }
-
-               if (msgq_rsp_pipeline) {
-                       struct app_pipeline_params *pipeline;
-                       uint32_t pipeline_id;
-
-                       APP_PARAM_GET_ID(p, "MSGQ-RSP-PIPELINE", pipeline_id);
-
-                       APP_PARAM_FIND_BY_ID(app->pipeline_params,
-                               "PIPELINE",
-                               pipeline_id,
-                               pipeline);
-
-                       APP_CHECK((pipeline != NULL),
-                               "%s is not associated with a valid pipeline\n",
-                               p->name);
-               }
-       }
-}
-
-static void
-check_pipelines(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-
-               APP_CHECK((p->n_msgq_in == p->n_msgq_out),
-                       "%s number of input MSGQs does not match "
-                       "the number of output MSGQs\n", p->name);
-       }
-}
-
-int
-app_config_check(struct app_params *app)
-{
-       check_mempools(app);
-       check_links(app);
-       check_rxqs(app);
-       check_txqs(app);
-       check_swqs(app);
-       check_tms(app);
-       check_taps(app);
-       check_knis(app);
-       check_sources(app);
-       check_sinks(app);
-       check_msgqs(app);
-       check_pipelines(app);
-
-       return 0;
-}
diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c
deleted file mode 100644 (file)
index e90499e..0000000
+++ /dev/null
@@ -1,3395 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2016 Intel Corporation
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <getopt.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <string.h>
-#include <libgen.h>
-#include <unistd.h>
-#include <sys/wait.h>
-
-#include <rte_errno.h>
-#include <rte_cfgfile.h>
-#include <rte_string_fns.h>
-
-#include "app.h"
-#include "parser.h"
-
-/**
- * Default config values
- **/
-
-static struct app_params app_params_default = {
-       .config_file = "./config/ip_pipeline.cfg",
-       .log_level = APP_LOG_LEVEL_HIGH,
-       .port_mask = 0,
-
-       .eal_params = {
-               .channels = 4,
-       },
-};
-
-static const struct app_mempool_params mempool_params_default = {
-       .parsed = 0,
-       .buffer_size = 2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM,
-       .pool_size = 32 * 1024,
-       .cache_size = 256,
-       .cpu_socket_id = 0,
-};
-
-static const struct app_link_params link_params_default = {
-       .parsed = 0,
-       .pmd_id = 0,
-       .arp_q = 0,
-       .tcp_syn_q = 0,
-       .ip_local_q = 0,
-       .tcp_local_q = 0,
-       .udp_local_q = 0,
-       .sctp_local_q = 0,
-       .rss_qs = {0},
-       .n_rss_qs = 0,
-       .rss_proto_ipv4 = ETH_RSS_IPV4,
-       .rss_proto_ipv6 = ETH_RSS_IPV6,
-       .rss_proto_l2 = 0,
-       .state = 0,
-       .ip = 0,
-       .depth = 0,
-       .mac_addr = 0,
-       .pci_bdf = {0},
-
-       .conf = {
-               .link_speeds = 0,
-               .rxmode = {
-                       .mq_mode = ETH_MQ_RX_NONE,
-
-                       .ignore_offload_bitfield = 1,
-                       .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
-
-                       .max_rx_pkt_len = 9000, /* Jumbo frame max packet len */
-                       .split_hdr_size = 0, /* Header split buffer size */
-               },
-               .rx_adv_conf = {
-                       .rss_conf = {
-                               .rss_key = NULL,
-                               .rss_key_len = 40,
-                               .rss_hf = 0,
-                       },
-               },
-               .txmode = {
-                       .mq_mode = ETH_MQ_TX_NONE,
-               },
-               .lpbk_mode = 0,
-       },
-
-       .promisc = 1,
-};
-
-static const struct app_pktq_hwq_in_params default_hwq_in_params = {
-       .parsed = 0,
-       .mempool_id = 0,
-       .size = 128,
-       .burst = 32,
-
-       .conf = {
-               .rx_thresh = {
-                               .pthresh = 8,
-                               .hthresh = 8,
-                               .wthresh = 4,
-               },
-               .rx_free_thresh = 64,
-               .rx_drop_en = 0,
-               .rx_deferred_start = 0,
-       }
-};
-
-static const struct app_pktq_hwq_out_params default_hwq_out_params = {
-       .parsed = 0,
-       .size = 512,
-       .burst = 32,
-       .dropless = 0,
-       .n_retries = 0,
-
-       .conf = {
-               .tx_thresh = {
-                       .pthresh = 36,
-                       .hthresh = 0,
-                       .wthresh = 0,
-               },
-               .tx_rs_thresh = 0,
-               .tx_free_thresh = 0,
-               .txq_flags = ETH_TXQ_FLAGS_IGNORE,
-               .tx_deferred_start = 0,
-       }
-};
-
-static const struct app_pktq_swq_params default_swq_params = {
-       .parsed = 0,
-       .size = 256,
-       .burst_read = 32,
-       .burst_write = 32,
-       .dropless = 0,
-       .n_retries = 0,
-       .cpu_socket_id = 0,
-       .ipv4_frag = 0,
-       .ipv6_frag = 0,
-       .ipv4_ras = 0,
-       .ipv6_ras = 0,
-       .mtu = 0,
-       .metadata_size = 0,
-       .mempool_direct_id = 0,
-       .mempool_indirect_id = 0,
-};
-
-struct app_pktq_tm_params default_tm_params = {
-       .parsed = 0,
-       .file_name = "./config/tm_profile.cfg",
-       .burst_read = 24,
-       .burst_write = 32,
-};
-
-struct app_pktq_tap_params default_tap_params = {
-       .parsed = 0,
-       .burst_read = 32,
-       .burst_write = 32,
-       .dropless = 0,
-       .n_retries = 0,
-       .mempool_id = 0,
-};
-
-struct app_pktq_kni_params default_kni_params = {
-       .parsed = 0,
-       .socket_id = 0,
-       .core_id = 0,
-       .hyper_th_id = 0,
-       .force_bind = 0,
-
-       .mempool_id = 0,
-       .burst_read = 32,
-       .burst_write = 32,
-       .dropless = 0,
-       .n_retries = 0,
-};
-
-struct app_pktq_source_params default_source_params = {
-       .parsed = 0,
-       .mempool_id = 0,
-       .burst = 32,
-       .file_name = "./config/packets.pcap",
-       .n_bytes_per_pkt = 0,
-};
-
-struct app_pktq_sink_params default_sink_params = {
-       .parsed = 0,
-       .file_name = NULL,
-       .n_pkts_to_dump = 0,
-};
-
-struct app_msgq_params default_msgq_params = {
-       .parsed = 0,
-       .size = 64,
-       .cpu_socket_id = 0,
-};
-
-struct app_pipeline_params default_pipeline_params = {
-       .parsed = 0,
-       .socket_id = 0,
-       .core_id = 0,
-       .hyper_th_id = 0,
-       .n_pktq_in = 0,
-       .n_pktq_out = 0,
-       .n_msgq_in = 0,
-       .n_msgq_out = 0,
-       .timer_period = 1,
-       .n_args = 0,
-};
-
-static const char app_usage[] =
-       "Usage: %s [-f CONFIG_FILE] [-s SCRIPT_FILE] [-p PORT_MASK] "
-       "[-l LOG_LEVEL] [--preproc PREPROCESSOR] [--preproc-args ARGS]\n"
-       "\n"
-       "Arguments:\n"
-       "\t-f CONFIG_FILE: Default config file is %s\n"
-       "\t-p PORT_MASK: Mask of NIC port IDs in hex format (generated from "
-               "config file when not provided)\n"
-       "\t-s SCRIPT_FILE: No CLI script file is run when not specified\n"
-       "\t-l LOG_LEVEL: 0 = NONE, 1 = HIGH PRIO (default), 2 = LOW PRIO\n"
-       "\t--preproc PREPROCESSOR: Configuration file pre-processor\n"
-       "\t--preproc-args ARGS: Arguments to be passed to pre-processor\n"
-       "\n";
-
-static void
-app_print_usage(char *prgname)
-{
-       rte_exit(0, app_usage, prgname, app_params_default.config_file);
-}
-
-#define APP_PARAM_ADD(set, key)                                                \
-({                                                                     \
-       ssize_t pos = APP_PARAM_FIND(set, key);                         \
-       ssize_t size = RTE_DIM(set);                                    \
-                                                                       \
-       if (pos < 0) {                                                  \
-               for (pos = 0; pos < size; pos++) {                      \
-                       if (!APP_PARAM_VALID(&((set)[pos])))            \
-                               break;                                  \
-               }                                                       \
-                                                                       \
-               APP_CHECK((pos < size),                                 \
-                       "Parse error: size of %s is limited to %u elements",\
-                       #set, (uint32_t) size);                         \
-                                                                       \
-               (set)[pos].name = strdup(key);                          \
-               APP_CHECK(((set)[pos].name),                            \
-                       "Parse error: no free memory");                 \
-       }                                                               \
-       pos;                                                            \
-})
-
-#define APP_PARAM_ADD_LINK_FOR_RXQ(app, rxq_name)                      \
-({                                                                     \
-       char link_name[APP_PARAM_NAME_SIZE];                            \
-       ssize_t link_param_pos;                                         \
-       uint32_t link_id, queue_id;                             \
-                                                                       \
-       sscanf((rxq_name), "RXQ%" SCNu32 ".%" SCNu32, &link_id, &queue_id);\
-       sprintf(link_name, "LINK%" PRIu32, link_id);                    \
-       link_param_pos = APP_PARAM_ADD((app)->link_params, link_name);  \
-       link_param_pos;                                                 \
-})
-
-#define APP_PARAM_ADD_LINK_FOR_TXQ(app, txq_name)                      \
-({                                                                     \
-       char link_name[APP_PARAM_NAME_SIZE];                            \
-       ssize_t link_param_pos;                                         \
-       uint32_t link_id, queue_id;                                     \
-                                                                       \
-       sscanf((txq_name), "TXQ%" SCNu32 ".%" SCNu32, &link_id, &queue_id);\
-       sprintf(link_name, "LINK%" PRIu32, link_id);                    \
-       link_param_pos = APP_PARAM_ADD((app)->link_params, link_name);  \
-       link_param_pos;                                                 \
-})
-
-#define APP_PARAM_ADD_LINK_FOR_TM(app, tm_name)                                \
-({                                                                     \
-       char link_name[APP_PARAM_NAME_SIZE];                            \
-       ssize_t link_param_pos;                                         \
-       uint32_t link_id;                                               \
-                                                                       \
-       sscanf((tm_name), "TM%" SCNu32, &link_id);                      \
-       sprintf(link_name, "LINK%" PRIu32, link_id);                    \
-       link_param_pos = APP_PARAM_ADD((app)->link_params, link_name);  \
-       link_param_pos;                                                 \
-})
-
-#define APP_PARAM_ADD_LINK_FOR_KNI(app, kni_name)                      \
-({                                                                     \
-       char link_name[APP_PARAM_NAME_SIZE];                            \
-       ssize_t link_param_pos;                                         \
-       uint32_t link_id;                                               \
-                                                                       \
-       sscanf((kni_name), "KNI%" SCNu32, &link_id);            \
-       sprintf(link_name, "LINK%" PRIu32, link_id);                    \
-       link_param_pos = APP_PARAM_ADD((app)->link_params, link_name);  \
-       link_param_pos;                                                 \
-})
-
-#define PARSE_CHECK_DUPLICATE_SECTION(obj)                             \
-do {                                                                   \
-       APP_CHECK(((obj)->parsed == 0),                                 \
-               "Parse error: duplicate \"%s\" section", (obj)->name);  \
-       (obj)->parsed++;                                        \
-} while (0)
-
-#define PARSE_CHECK_DUPLICATE_SECTION_EAL(obj)                         \
-do {                                                                   \
-       APP_CHECK(((obj)->parsed == 0),                                 \
-               "Parse error: duplicate \"%s\" section", "EAL");        \
-       (obj)->parsed++;                                        \
-} while (0)
-
-#define PARSE_ERROR(exp, section, entry)                               \
-APP_CHECK(exp, "Parse error in section \"%s\": entry \"%s\"", section, entry)
-
-#define PARSE_ERROR_MESSAGE(exp, section, entry, message)              \
-APP_CHECK(exp, "Parse error in section \"%s\", entry \"%s\": %s",      \
-       section, entry, message)
-
-#define PARSE_ERROR_NO_ELEMENTS(exp, section, entry)                   \
-APP_CHECK(exp, "Parse error in section \"%s\", entry \"%s\": "         \
-       "no elements detected",                                         \
-       section, entry)
-
-#define PARSE_ERROR_TOO_MANY_ELEMENTS(exp, section, entry, max)                \
-APP_CHECK(exp, "Parse error in section \"%s\", entry \"%s\": "         \
-       "maximum number of elements allowed is %u",                     \
-       section, entry, max)
-
-#define PARSE_ERROR_INVALID_ELEMENT(exp, section, entry, value)                \
-APP_CHECK(exp, "Parse error in section \"%s\", entry \"%s\": "         \
-       "Invalid element value \"%s\"",                                 \
-       section, entry, value)
-
-#define PARSE_ERROR_MALLOC(exp)                                                \
-APP_CHECK(exp, "Parse error: no free memory")
-
-#define PARSE_ERROR_SECTION(exp, section)                              \
-APP_CHECK(exp, "Parse error in section \"%s\"", section)
-
-#define PARSE_ERROR_SECTION_NO_ENTRIES(exp, section)                   \
-APP_CHECK(exp, "Parse error in section \"%s\": no entries", section)
-
-#define PARSE_WARNING_IGNORED(exp, section, entry)                     \
-do                                                                     \
-if (!(exp))                                                            \
-       fprintf(stderr, "Parse warning in section \"%s\": "             \
-               "entry \"%s\" is ignored", section, entry);             \
-while (0)
-
-#define PARSE_ERROR_INVALID(exp, section, entry)                       \
-APP_CHECK(exp, "Parse error in section \"%s\": unrecognized entry \"%s\"",\
-       section, entry)
-
-#define PARSE_ERROR_DUPLICATE(exp, section, entry)                     \
-APP_CHECK(exp, "Parse error in section \"%s\": duplicate entry \"%s\"",        \
-       section, entry)
-
-static int
-validate_name(const char *name, const char *prefix, int num)
-{
-       size_t i, j;
-
-       for (i = 0; (name[i] != '\0') && (prefix[i] != '\0'); i++) {
-               if (name[i] != prefix[i])
-                       return -1;
-       }
-
-       if (prefix[i] != '\0')
-               return -1;
-
-       if (!num) {
-               if (name[i] != '\0')
-                       return -1;
-               else
-                       return 0;
-       }
-
-       if (num == 2) {
-               j = skip_digits(&name[i]);
-               i += j;
-               if ((j == 0) || (name[i] != '.'))
-                       return -1;
-               i++;
-       }
-
-       if (num == 1) {
-               j = skip_digits(&name[i]);
-               i += j;
-               if ((j == 0) || (name[i] != '\0'))
-                       return -1;
-       }
-
-       return 0;
-}
-
-static void
-parse_eal(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_eal_params *p = &app->eal_params;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       PARSE_CHECK_DUPLICATE_SECTION_EAL(p);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *entry = &entries[i];
-
-               /* coremask */
-               if (strcmp(entry->name, "c") == 0) {
-                       PARSE_WARNING_IGNORED(0, section_name, entry->name);
-                       continue;
-               }
-
-               /* corelist */
-               if (strcmp(entry->name, "l") == 0) {
-                       PARSE_WARNING_IGNORED(0, section_name, entry->name);
-                       continue;
-               }
-
-               /* coremap */
-               if (strcmp(entry->name, "lcores") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->coremap == NULL),
-                               section_name,
-                               entry->name);
-                       p->coremap = strdup(entry->value);
-                       continue;
-               }
-
-               /* master_lcore */
-               if (strcmp(entry->name, "master_lcore") == 0) {
-                       int status;
-
-                       PARSE_ERROR_DUPLICATE((p->master_lcore_present == 0),
-                               section_name,
-                               entry->name);
-                       p->master_lcore_present = 1;
-
-                       status = parser_read_uint32(&p->master_lcore,
-                               entry->value);
-                       PARSE_ERROR((status == 0), section_name, entry->name);
-                       continue;
-               }
-
-               /* channels */
-               if (strcmp(entry->name, "n") == 0) {
-                       int status;
-
-                       PARSE_ERROR_DUPLICATE((p->channels_present == 0),
-                               section_name,
-                               entry->name);
-                       p->channels_present = 1;
-
-                       status = parser_read_uint32(&p->channels, entry->value);
-                       PARSE_ERROR((status == 0), section_name, entry->name);
-                       continue;
-               }
-
-               /* memory */
-               if (strcmp(entry->name, "m") == 0) {
-                       int status;
-
-                       PARSE_ERROR_DUPLICATE((p->memory_present == 0),
-                               section_name,
-                               entry->name);
-                       p->memory_present = 1;
-
-                       status = parser_read_uint32(&p->memory, entry->value);
-                       PARSE_ERROR((status == 0), section_name, entry->name);
-                       continue;
-               }
-
-               /* ranks */
-               if (strcmp(entry->name, "r") == 0) {
-                       int status;
-
-                       PARSE_ERROR_DUPLICATE((p->ranks_present == 0),
-                               section_name,
-                               entry->name);
-                       p->ranks_present = 1;
-
-                       status = parser_read_uint32(&p->ranks, entry->value);
-                       PARSE_ERROR((status == 0), section_name, entry->name);
-                       continue;
-               }
-
-               /* pci_blacklist */
-               if ((strcmp(entry->name, "pci_blacklist") == 0) ||
-                       (strcmp(entry->name, "b") == 0)) {
-                       uint32_t i;
-
-                       for (i = 0; i < APP_MAX_LINKS; i++) {
-                               if (p->pci_blacklist[i])
-                                       continue;
-
-                               p->pci_blacklist[i] =
-                                       strdup(entry->value);
-                               PARSE_ERROR_MALLOC(p->pci_blacklist[i]);
-
-                               break;
-                       }
-
-                       PARSE_ERROR_MESSAGE((i < APP_MAX_LINKS),
-                               section_name, entry->name,
-                               "too many elements");
-                       continue;
-               }
-
-               /* pci_whitelist */
-               if ((strcmp(entry->name, "pci_whitelist") == 0) ||
-                       (strcmp(entry->name, "w") == 0)) {
-                       uint32_t i;
-
-                       PARSE_ERROR_MESSAGE((app->port_mask != 0),
-                               section_name, entry->name, "entry to be "
-                               "generated by the application (port_mask "
-                               "not provided)");
-
-                       for (i = 0; i < APP_MAX_LINKS; i++) {
-                               if (p->pci_whitelist[i])
-                                       continue;
-
-                               p->pci_whitelist[i] = strdup(entry->value);
-                               PARSE_ERROR_MALLOC(p->pci_whitelist[i]);
-
-                               break;
-                       }
-
-                       PARSE_ERROR_MESSAGE((i < APP_MAX_LINKS),
-                               section_name, entry->name,
-                               "too many elements");
-                       continue;
-               }
-
-               /* vdev */
-               if (strcmp(entry->name, "vdev") == 0) {
-                       uint32_t i;
-
-                       for (i = 0; i < APP_MAX_LINKS; i++) {
-                               if (p->vdev[i])
-                                       continue;
-
-                               p->vdev[i] = strdup(entry->value);
-                               PARSE_ERROR_MALLOC(p->vdev[i]);
-
-                               break;
-                       }
-
-                       PARSE_ERROR_MESSAGE((i < APP_MAX_LINKS),
-                               section_name, entry->name,
-                               "too many elements");
-                       continue;
-               }
-
-               /* vmware_tsc_map */
-               if (strcmp(entry->name, "vmware_tsc_map") == 0) {
-                       int val;
-
-                       PARSE_ERROR_DUPLICATE((p->vmware_tsc_map_present == 0),
-                               section_name,
-                               entry->name);
-                       p->vmware_tsc_map_present = 1;
-
-                       val = parser_read_arg_bool(entry->value);
-                       PARSE_ERROR((val >= 0), section_name, entry->name);
-                       p->vmware_tsc_map = val;
-                       continue;
-               }
-
-               /* proc_type */
-               if (strcmp(entry->name, "proc_type") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->proc_type == NULL),
-                               section_name,
-                               entry->name);
-                       p->proc_type = strdup(entry->value);
-                       continue;
-               }
-
-               /* syslog */
-               if (strcmp(entry->name, "syslog") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->syslog == NULL),
-                               section_name,
-                               entry->name);
-                       p->syslog = strdup(entry->value);
-                       continue;
-               }
-
-               /* log_level */
-               if (strcmp(entry->name, "log_level") == 0) {
-                       int status;
-
-                       PARSE_ERROR_DUPLICATE((p->log_level_present == 0),
-                               section_name,
-                               entry->name);
-                       p->log_level_present = 1;
-
-                       status = parser_read_uint32(&p->log_level,
-                               entry->value);
-                       PARSE_ERROR((status == 0), section_name, entry->name);
-                       continue;
-               }
-
-               /* version */
-               if (strcmp(entry->name, "v") == 0) {
-                       int val;
-
-                       PARSE_ERROR_DUPLICATE((p->version_present == 0),
-                               section_name,
-                               entry->name);
-                       p->version_present = 1;
-
-                       val = parser_read_arg_bool(entry->value);
-                       PARSE_ERROR((val >= 0), section_name, entry->name);
-                       p->version = val;
-                       continue;
-               }
-
-               /* help */
-               if ((strcmp(entry->name, "help") == 0) ||
-                       (strcmp(entry->name, "h") == 0)) {
-                       int val;
-
-                       PARSE_ERROR_DUPLICATE((p->help_present == 0),
-                               section_name,
-                               entry->name);
-                       p->help_present = 1;
-
-                       val = parser_read_arg_bool(entry->value);
-                       PARSE_ERROR((val >= 0), section_name, entry->name);
-                       p->help = val;
-                       continue;
-               }
-
-               /* no_huge */
-               if (strcmp(entry->name, "no_huge") == 0) {
-                       int val;
-
-                       PARSE_ERROR_DUPLICATE((p->no_huge_present == 0),
-                               section_name,
-                               entry->name);
-                       p->no_huge_present = 1;
-
-                       val = parser_read_arg_bool(entry->value);
-                       PARSE_ERROR((val >= 0), section_name, entry->name);
-                       p->no_huge = val;
-                       continue;
-               }
-
-               /* no_pci */
-               if (strcmp(entry->name, "no_pci") == 0) {
-                       int val;
-
-                       PARSE_ERROR_DUPLICATE((p->no_pci_present == 0),
-                               section_name,
-                               entry->name);
-                       p->no_pci_present = 1;
-
-                       val = parser_read_arg_bool(entry->value);
-                       PARSE_ERROR((val >= 0), section_name, entry->name);
-                       p->no_pci = val;
-                       continue;
-               }
-
-               /* no_hpet */
-               if (strcmp(entry->name, "no_hpet") == 0) {
-                       int val;
-
-                       PARSE_ERROR_DUPLICATE((p->no_hpet_present == 0),
-                               section_name,
-                               entry->name);
-                       p->no_hpet_present = 1;
-
-                       val = parser_read_arg_bool(entry->value);
-                       PARSE_ERROR((val >= 0), section_name, entry->name);
-                       p->no_hpet = val;
-                       continue;
-               }
-
-               /* no_shconf */
-               if (strcmp(entry->name, "no_shconf") == 0) {
-                       int val;
-
-                       PARSE_ERROR_DUPLICATE((p->no_shconf_present == 0),
-                               section_name,
-                               entry->name);
-                       p->no_shconf_present = 1;
-
-                       val = parser_read_arg_bool(entry->value);
-                       PARSE_ERROR((val >= 0), section_name, entry->name);
-                       p->no_shconf = val;
-                       continue;
-               }
-
-               /* add_driver */
-               if (strcmp(entry->name, "d") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->add_driver == NULL),
-                               section_name,
-                               entry->name);
-                       p->add_driver = strdup(entry->value);
-                       continue;
-               }
-
-               /* socket_mem */
-               if (strcmp(entry->name, "socket_mem") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->socket_mem == NULL),
-                               section_name,
-                               entry->name);
-                       p->socket_mem = strdup(entry->value);
-                       continue;
-               }
-
-               /* huge_dir */
-               if (strcmp(entry->name, "huge_dir") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->huge_dir == NULL),
-                               section_name,
-                               entry->name);
-                       p->huge_dir = strdup(entry->value);
-                       continue;
-               }
-
-               /* file_prefix */
-               if (strcmp(entry->name, "file_prefix") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->file_prefix == NULL),
-                               section_name,
-                               entry->name);
-                       p->file_prefix = strdup(entry->value);
-                       continue;
-               }
-
-               /* base_virtaddr */
-               if (strcmp(entry->name, "base_virtaddr") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->base_virtaddr == NULL),
-                               section_name,
-                               entry->name);
-                       p->base_virtaddr = strdup(entry->value);
-                       continue;
-               }
-
-               /* create_uio_dev */
-               if (strcmp(entry->name, "create_uio_dev") == 0) {
-                       int val;
-
-                       PARSE_ERROR_DUPLICATE((p->create_uio_dev_present == 0),
-                               section_name,
-                               entry->name);
-                       p->create_uio_dev_present = 1;
-
-                       val = parser_read_arg_bool(entry->value);
-                       PARSE_ERROR((val >= 0), section_name, entry->name);
-                       p->create_uio_dev = val;
-                       continue;
-               }
-
-               /* vfio_intr */
-               if (strcmp(entry->name, "vfio_intr") == 0) {
-                       PARSE_ERROR_DUPLICATE((p->vfio_intr == NULL),
-                               section_name,
-                               entry->name);
-                       p->vfio_intr = strdup(entry->value);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, entry->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_pipeline_pktq_in(struct app_params *app,
-       struct app_pipeline_params *p,
-       char *value)
-{
-       p->n_pktq_in = 0;
-
-       while (1) {
-               enum app_pktq_in_type type;
-               int id;
-               char *name = strtok_r(value, PARSE_DELIMITER, &value);
-
-               if (name == NULL)
-                       break;
-
-               PARSE_ERROR_TOO_MANY_ELEMENTS(
-                       (p->n_pktq_in < RTE_DIM(p->pktq_in)),
-                       p->name, "pktq_in", (uint32_t)RTE_DIM(p->pktq_in));
-
-               if (validate_name(name, "RXQ", 2) == 0) {
-                       type = APP_PKTQ_IN_HWQ;
-                       id = APP_PARAM_ADD(app->hwq_in_params, name);
-                       APP_PARAM_ADD_LINK_FOR_RXQ(app, name);
-               } else if (validate_name(name, "SWQ", 1) == 0) {
-                       type = APP_PKTQ_IN_SWQ;
-                       id = APP_PARAM_ADD(app->swq_params, name);
-               } else if (validate_name(name, "TM", 1) == 0) {
-                       type = APP_PKTQ_IN_TM;
-                       id = APP_PARAM_ADD(app->tm_params, name);
-                       APP_PARAM_ADD_LINK_FOR_TM(app, name);
-               } else if (validate_name(name, "TAP", 1) == 0) {
-                       type = APP_PKTQ_IN_TAP;
-                       id = APP_PARAM_ADD(app->tap_params, name);
-               } else if (validate_name(name, "KNI", 1) == 0) {
-                       type = APP_PKTQ_IN_KNI;
-                       id = APP_PARAM_ADD(app->kni_params, name);
-                       APP_PARAM_ADD_LINK_FOR_KNI(app, name);
-               } else if (validate_name(name, "SOURCE", 1) == 0) {
-                       type = APP_PKTQ_IN_SOURCE;
-                       id = APP_PARAM_ADD(app->source_params, name);
-               } else
-                       PARSE_ERROR_INVALID_ELEMENT(0,
-                               p->name, "pktq_in", name);
-
-               p->pktq_in[p->n_pktq_in].type = type;
-               p->pktq_in[p->n_pktq_in].id = (uint32_t) id;
-               p->n_pktq_in++;
-       }
-
-       PARSE_ERROR_NO_ELEMENTS((p->n_pktq_in > 0), p->name, "pktq_in");
-}
-
-static void
-parse_pipeline_pktq_out(struct app_params *app,
-       struct app_pipeline_params *p,
-       char *value)
-{
-       p->n_pktq_out = 0;
-
-       while (1) {
-               enum app_pktq_out_type type;
-               int id;
-               char *name = strtok_r(value, PARSE_DELIMITER, &value);
-
-               if (name == NULL)
-                       break;
-
-               PARSE_ERROR_TOO_MANY_ELEMENTS(
-                       (p->n_pktq_out < RTE_DIM(p->pktq_out)),
-                       p->name, "pktq_out", (uint32_t)RTE_DIM(p->pktq_out));
-
-               if (validate_name(name, "TXQ", 2) == 0) {
-                       type = APP_PKTQ_OUT_HWQ;
-                       id = APP_PARAM_ADD(app->hwq_out_params, name);
-                       APP_PARAM_ADD_LINK_FOR_TXQ(app, name);
-               } else if (validate_name(name, "SWQ", 1) == 0) {
-                       type = APP_PKTQ_OUT_SWQ;
-                       id = APP_PARAM_ADD(app->swq_params, name);
-               } else if (validate_name(name, "TM", 1) == 0) {
-                       type = APP_PKTQ_OUT_TM;
-                       id = APP_PARAM_ADD(app->tm_params, name);
-                       APP_PARAM_ADD_LINK_FOR_TM(app, name);
-               } else if (validate_name(name, "TAP", 1) == 0) {
-                       type = APP_PKTQ_OUT_TAP;
-                       id = APP_PARAM_ADD(app->tap_params, name);
-               } else if (validate_name(name, "KNI", 1) == 0) {
-                       type = APP_PKTQ_OUT_KNI;
-                       id = APP_PARAM_ADD(app->kni_params, name);
-                       APP_PARAM_ADD_LINK_FOR_KNI(app, name);
-               } else if (validate_name(name, "SINK", 1) == 0) {
-                       type = APP_PKTQ_OUT_SINK;
-                       id = APP_PARAM_ADD(app->sink_params, name);
-               } else
-                       PARSE_ERROR_INVALID_ELEMENT(0,
-                               p->name, "pktq_out", name);
-
-               p->pktq_out[p->n_pktq_out].type = type;
-               p->pktq_out[p->n_pktq_out].id = id;
-               p->n_pktq_out++;
-       }
-
-       PARSE_ERROR_NO_ELEMENTS((p->n_pktq_out > 0), p->name, "pktq_out");
-}
-
-static void
-parse_pipeline_msgq_in(struct app_params *app,
-       struct app_pipeline_params *p,
-       char *value)
-{
-       p->n_msgq_in = 0;
-
-       while (1) {
-               int idx;
-               char *name = strtok_r(value, PARSE_DELIMITER, &value);
-
-               if (name == NULL)
-                       break;
-
-               PARSE_ERROR_TOO_MANY_ELEMENTS(
-                       (p->n_msgq_in < RTE_DIM(p->msgq_in)),
-                       p->name, "msgq_in", (uint32_t)(RTE_DIM(p->msgq_in)));
-
-               PARSE_ERROR_INVALID_ELEMENT(
-                       (validate_name(name, "MSGQ", 1) == 0),
-                       p->name, "msgq_in", name);
-
-               idx = APP_PARAM_ADD(app->msgq_params, name);
-               p->msgq_in[p->n_msgq_in] = idx;
-               p->n_msgq_in++;
-       }
-
-       PARSE_ERROR_NO_ELEMENTS((p->n_msgq_in > 0), p->name, "msgq_in");
-}
-
-static void
-parse_pipeline_msgq_out(struct app_params *app,
-       struct app_pipeline_params *p,
-       char *value)
-{
-       p->n_msgq_out = 0;
-
-       while (1) {
-               int idx;
-               char *name = strtok_r(value, PARSE_DELIMITER, &value);
-
-               if (name == NULL)
-                       break;
-
-               PARSE_ERROR_TOO_MANY_ELEMENTS(
-                       (p->n_msgq_out < RTE_DIM(p->msgq_out)),
-                       p->name, "msgq_out", (uint32_t)RTE_DIM(p->msgq_out));
-
-               PARSE_ERROR_INVALID_ELEMENT(
-                       (validate_name(name, "MSGQ", 1) == 0),
-                       p->name, "msgq_out", name);
-
-               idx = APP_PARAM_ADD(app->msgq_params, name);
-               p->msgq_out[p->n_msgq_out] = idx;
-               p->n_msgq_out++;
-       }
-
-       PARSE_ERROR_NO_ELEMENTS((p->n_msgq_out > 0), p->name, "msgq_out");
-}
-
-static void
-parse_pipeline(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       char name[CFG_NAME_LEN];
-       struct app_pipeline_params *param;
-       struct rte_cfgfile_entry *entries;
-       ssize_t param_idx;
-       int n_entries, i;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->pipeline_params, section_name);
-       param = &app->pipeline_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "type") == 0) {
-                       int w_size = snprintf(param->type, RTE_DIM(param->type),
-                                       "%s", ent->value);
-
-                       PARSE_ERROR(((w_size > 0) &&
-                               (w_size < (int)RTE_DIM(param->type))),
-                               section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "core") == 0) {
-                       int status = parse_pipeline_core(
-                               &param->socket_id, &param->core_id,
-                               &param->hyper_th_id, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "pktq_in") == 0) {
-                       parse_pipeline_pktq_in(app, param, ent->value);
-
-                       continue;
-               }
-
-               if (strcmp(ent->name, "pktq_out") == 0) {
-                       parse_pipeline_pktq_out(app, param, ent->value);
-
-                       continue;
-               }
-
-               if (strcmp(ent->name, "msgq_in") == 0) {
-                       parse_pipeline_msgq_in(app, param, ent->value);
-
-                       continue;
-               }
-
-               if (strcmp(ent->name, "msgq_out") == 0) {
-                       parse_pipeline_msgq_out(app, param, ent->value);
-
-                       continue;
-               }
-
-               if (strcmp(ent->name, "timer_period") == 0) {
-                       int status = parser_read_uint32(
-                               &param->timer_period,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               /* pipeline type specific items */
-               APP_CHECK((param->n_args < APP_MAX_PIPELINE_ARGS),
-                       "Parse error in section \"%s\": too many "
-                       "pipeline specified parameters", section_name);
-
-               param->args_name[param->n_args] = strdup(ent->name);
-               param->args_value[param->n_args] = strdup(ent->value);
-
-               APP_CHECK((param->args_name[param->n_args] != NULL) &&
-                       (param->args_value[param->n_args] != NULL),
-                       "Parse error: no free memory");
-
-               param->n_args++;
-       }
-
-       snprintf(name, sizeof(name), "MSGQ-REQ-%s", section_name);
-       param_idx = APP_PARAM_ADD(app->msgq_params, name);
-       app->msgq_params[param_idx].cpu_socket_id = param->socket_id;
-       param->msgq_in[param->n_msgq_in++] = param_idx;
-
-       snprintf(name, sizeof(name), "MSGQ-RSP-%s", section_name);
-       param_idx = APP_PARAM_ADD(app->msgq_params, name);
-       app->msgq_params[param_idx].cpu_socket_id = param->socket_id;
-       param->msgq_out[param->n_msgq_out++] = param_idx;
-
-       snprintf(name, sizeof(name), "MSGQ-REQ-CORE-s%" PRIu32 "c%" PRIu32 "%s",
-               param->socket_id,
-               param->core_id,
-               (param->hyper_th_id) ? "h" : "");
-       param_idx = APP_PARAM_ADD(app->msgq_params, name);
-       app->msgq_params[param_idx].cpu_socket_id = param->socket_id;
-
-       snprintf(name, sizeof(name), "MSGQ-RSP-CORE-s%" PRIu32 "c%" PRIu32 "%s",
-               param->socket_id,
-               param->core_id,
-               (param->hyper_th_id) ? "h" : "");
-       param_idx = APP_PARAM_ADD(app->msgq_params, name);
-       app->msgq_params[param_idx].cpu_socket_id = param->socket_id;
-
-       free(entries);
-}
-
-static void
-parse_mempool(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_mempool_params *param;
-       struct rte_cfgfile_entry *entries;
-       ssize_t param_idx;
-       int n_entries, i;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->mempool_params, section_name);
-       param = &app->mempool_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "buffer_size") == 0) {
-                       int status = parser_read_uint32(
-                               &param->buffer_size, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "pool_size") == 0) {
-                       int status = parser_read_uint32(
-                               &param->pool_size, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "cache_size") == 0) {
-                       int status = parser_read_uint32(
-                               &param->cache_size, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "cpu") == 0) {
-                       int status = parser_read_uint32(
-                               &param->cpu_socket_id, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static int
-parse_link_rss_qs(struct app_link_params *p,
-       char *value)
-{
-       p->n_rss_qs = 0;
-
-       while (1) {
-               char *token = strtok_r(value, PARSE_DELIMITER, &value);
-
-               if (token == NULL)
-                       break;
-
-               if (p->n_rss_qs == RTE_DIM(p->rss_qs))
-                       return -ENOMEM;
-
-               if (parser_read_uint32(&p->rss_qs[p->n_rss_qs++], token))
-                       return -EINVAL;
-       }
-
-       return 0;
-}
-
-static int
-parse_link_rss_proto_ipv4(struct app_link_params *p,
-       char *value)
-{
-       uint64_t mask = 0;
-
-       while (1) {
-               char *token = strtok_r(value, PARSE_DELIMITER, &value);
-
-               if (token == NULL)
-                       break;
-
-               if (strcmp(token, "IP") == 0) {
-                       mask |= ETH_RSS_IPV4;
-                       continue;
-               }
-               if (strcmp(token, "FRAG") == 0) {
-                       mask |= ETH_RSS_FRAG_IPV4;
-                       continue;
-               }
-               if (strcmp(token, "TCP") == 0) {
-                       mask |= ETH_RSS_NONFRAG_IPV4_TCP;
-                       continue;
-               }
-               if (strcmp(token, "UDP") == 0) {
-                       mask |= ETH_RSS_NONFRAG_IPV4_UDP;
-                       continue;
-               }
-               if (strcmp(token, "SCTP") == 0) {
-                       mask |= ETH_RSS_NONFRAG_IPV4_SCTP;
-                       continue;
-               }
-               if (strcmp(token, "OTHER") == 0) {
-                       mask |= ETH_RSS_NONFRAG_IPV4_OTHER;
-                       continue;
-               }
-               return -EINVAL;
-       }
-
-       p->rss_proto_ipv4 = mask;
-       return 0;
-}
-
-static int
-parse_link_rss_proto_ipv6(struct app_link_params *p,
-       char *value)
-{
-       uint64_t mask = 0;
-
-       while (1) {
-               char *token = strtok_r(value, PARSE_DELIMITER, &value);
-
-               if (token == NULL)
-                       break;
-
-               if (strcmp(token, "IP") == 0) {
-                       mask |= ETH_RSS_IPV6;
-                       continue;
-               }
-               if (strcmp(token, "FRAG") == 0) {
-                       mask |= ETH_RSS_FRAG_IPV6;
-                       continue;
-               }
-               if (strcmp(token, "TCP") == 0) {
-                       mask |= ETH_RSS_NONFRAG_IPV6_TCP;
-                       continue;
-               }
-               if (strcmp(token, "UDP") == 0) {
-                       mask |= ETH_RSS_NONFRAG_IPV6_UDP;
-                       continue;
-               }
-               if (strcmp(token, "SCTP") == 0) {
-                       mask |= ETH_RSS_NONFRAG_IPV6_SCTP;
-                       continue;
-               }
-               if (strcmp(token, "OTHER") == 0) {
-                       mask |= ETH_RSS_NONFRAG_IPV6_OTHER;
-                       continue;
-               }
-               if (strcmp(token, "IP_EX") == 0) {
-                       mask |= ETH_RSS_IPV6_EX;
-                       continue;
-               }
-               if (strcmp(token, "TCP_EX") == 0) {
-                       mask |= ETH_RSS_IPV6_TCP_EX;
-                       continue;
-               }
-               if (strcmp(token, "UDP_EX") == 0) {
-                       mask |= ETH_RSS_IPV6_UDP_EX;
-                       continue;
-               }
-               return -EINVAL;
-       }
-
-       p->rss_proto_ipv6 = mask;
-       return 0;
-}
-
-static int
-parse_link_rss_proto_l2(struct app_link_params *p,
-       char *value)
-{
-       uint64_t mask = 0;
-
-       while (1) {
-               char *token = strtok_r(value, PARSE_DELIMITER, &value);
-
-               if (token == NULL)
-                       break;
-
-               if (strcmp(token, "L2") == 0) {
-                       mask |= ETH_RSS_L2_PAYLOAD;
-                       continue;
-               }
-               return -EINVAL;
-       }
-
-       p->rss_proto_l2 = mask;
-       return 0;
-}
-
-static void
-parse_link(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_link_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       int rss_qs_present = 0;
-       int rss_proto_ipv4_present = 0;
-       int rss_proto_ipv6_present = 0;
-       int rss_proto_l2_present = 0;
-       int pci_bdf_present = 0;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->link_params, section_name);
-       param = &app->link_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "promisc") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       param->promisc = status;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "arp_q") == 0) {
-                       int status = parser_read_uint32(&param->arp_q,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "tcp_syn_q") == 0) {
-                       int status = parser_read_uint32(
-                               &param->tcp_syn_q, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name, ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "ip_local_q") == 0) {
-                       int status = parser_read_uint32(
-                               &param->ip_local_q, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "tcp_local_q") == 0) {
-                       int status = parser_read_uint32(
-                               &param->tcp_local_q, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "udp_local_q") == 0) {
-                       int status = parser_read_uint32(
-                               &param->udp_local_q, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "sctp_local_q") == 0) {
-                       int status = parser_read_uint32(
-                               &param->sctp_local_q, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "rss_qs") == 0) {
-                       int status = parse_link_rss_qs(param, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       rss_qs_present = 1;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "rss_proto_ipv4") == 0) {
-                       int status =
-                               parse_link_rss_proto_ipv4(param, ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       rss_proto_ipv4_present = 1;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "rss_proto_ipv6") == 0) {
-                       int status =
-                               parse_link_rss_proto_ipv6(param, ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       rss_proto_ipv6_present = 1;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "rss_proto_l2") == 0) {
-                       int status = parse_link_rss_proto_l2(param, ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       rss_proto_l2_present = 1;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "pci_bdf") == 0) {
-                       PARSE_ERROR_DUPLICATE((pci_bdf_present == 0),
-                               section_name, ent->name);
-
-                       snprintf(param->pci_bdf, APP_LINK_PCI_BDF_SIZE,
-                               "%s", ent->value);
-                       pci_bdf_present = 1;
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       /* Check for mandatory fields */
-       if (app->port_mask)
-               PARSE_ERROR_MESSAGE((pci_bdf_present == 0),
-                       section_name, "pci_bdf",
-                       "entry not allowed (port_mask is provided)");
-       else
-               PARSE_ERROR_MESSAGE((pci_bdf_present),
-                       section_name, "pci_bdf",
-                       "this entry is mandatory (port_mask is not "
-                       "provided)");
-
-       if (rss_proto_ipv4_present)
-               PARSE_ERROR_MESSAGE((rss_qs_present),
-                       section_name, "rss_proto_ipv4",
-                       "entry not allowed (rss_qs entry is not provided)");
-       if (rss_proto_ipv6_present)
-               PARSE_ERROR_MESSAGE((rss_qs_present),
-                       section_name, "rss_proto_ipv6",
-                       "entry not allowed (rss_qs entry is not provided)");
-       if (rss_proto_l2_present)
-               PARSE_ERROR_MESSAGE((rss_qs_present),
-                       section_name, "rss_proto_l2",
-                       "entry not allowed (rss_qs entry is not provided)");
-       if (rss_proto_ipv4_present |
-               rss_proto_ipv6_present |
-               rss_proto_l2_present){
-               if (rss_proto_ipv4_present == 0)
-                       param->rss_proto_ipv4 = 0;
-               if (rss_proto_ipv6_present == 0)
-                       param->rss_proto_ipv6 = 0;
-               if (rss_proto_l2_present == 0)
-                       param->rss_proto_l2 = 0;
-       }
-
-       free(entries);
-}
-
-static void
-parse_rxq(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_pktq_hwq_in_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->hwq_in_params, section_name);
-       param = &app->hwq_in_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       APP_PARAM_ADD_LINK_FOR_RXQ(app, section_name);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "mempool") == 0) {
-                       int status = validate_name(ent->value,
-                               "MEMPOOL", 1);
-                       ssize_t idx;
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-
-                       idx = APP_PARAM_ADD(app->mempool_params, ent->value);
-                       param->mempool_id = idx;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "size") == 0) {
-                       int status = parser_read_uint32(&param->size,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst") == 0) {
-                       int status = parser_read_uint32(&param->burst,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_txq(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_pktq_hwq_out_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->hwq_out_params, section_name);
-       param = &app->hwq_out_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       APP_PARAM_ADD_LINK_FOR_TXQ(app, section_name);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "size") == 0) {
-                       int status = parser_read_uint32(&param->size,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst") == 0) {
-                       int status = parser_read_uint32(&param->burst,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "dropless") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       param->dropless = status;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "n_retries") == 0) {
-                       int status = parser_read_uint64(&param->n_retries,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_swq(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_pktq_swq_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       uint32_t mtu_present = 0;
-       uint32_t metadata_size_present = 0;
-       uint32_t mempool_direct_present = 0;
-       uint32_t mempool_indirect_present = 0;
-
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->swq_params, section_name);
-       param = &app->swq_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "size") == 0) {
-                       int status = parser_read_uint32(&param->size,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst_read") == 0) {
-                       int status = parser_read_uint32(&
-                               param->burst_read, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst_write") == 0) {
-                       int status = parser_read_uint32(
-                               &param->burst_write, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "dropless") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       param->dropless = status;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "n_retries") == 0) {
-                       int status = parser_read_uint64(&param->n_retries,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "cpu") == 0) {
-                       int status = parser_read_uint32(
-                               &param->cpu_socket_id, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name, ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "ipv4_frag") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-
-                       param->ipv4_frag = status;
-                       if (param->mtu == 0)
-                               param->mtu = 1500;
-
-                       continue;
-               }
-
-               if (strcmp(ent->name, "ipv6_frag") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       param->ipv6_frag = status;
-                       if (param->mtu == 0)
-                               param->mtu = 1320;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "ipv4_ras") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       param->ipv4_ras = status;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "ipv6_ras") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       param->ipv6_ras = status;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "mtu") == 0) {
-                       int status = parser_read_uint32(&param->mtu,
-                                       ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       mtu_present = 1;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "metadata_size") == 0) {
-                       int status = parser_read_uint32(
-                               &param->metadata_size, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       metadata_size_present = 1;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "mempool_direct") == 0) {
-                       int status = validate_name(ent->value,
-                               "MEMPOOL", 1);
-                       ssize_t idx;
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-
-                       idx = APP_PARAM_ADD(app->mempool_params, ent->value);
-                       param->mempool_direct_id = idx;
-
-                       mempool_direct_present = 1;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "mempool_indirect") == 0) {
-                       int status = validate_name(ent->value,
-                               "MEMPOOL", 1);
-                       ssize_t idx;
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-
-                       idx = APP_PARAM_ADD(app->mempool_params, ent->value);
-                       param->mempool_indirect_id = idx;
-
-                       mempool_indirect_present = 1;
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       APP_CHECK(((mtu_present == 0) ||
-               ((param->ipv4_frag == 1) || (param->ipv6_frag == 1))),
-               "Parse error in section \"%s\": IPv4/IPv6 fragmentation "
-               "is off, therefore entry \"mtu\" is not allowed",
-               section_name);
-
-       APP_CHECK(((metadata_size_present == 0) ||
-               ((param->ipv4_frag == 1) || (param->ipv6_frag == 1))),
-               "Parse error in section \"%s\": IPv4/IPv6 fragmentation "
-               "is off, therefore entry \"metadata_size\" is "
-               "not allowed", section_name);
-
-       APP_CHECK(((mempool_direct_present == 0) ||
-               ((param->ipv4_frag == 1) || (param->ipv6_frag == 1))),
-               "Parse error in section \"%s\": IPv4/IPv6 fragmentation "
-               "is off, therefore entry \"mempool_direct\" is "
-               "not allowed", section_name);
-
-       APP_CHECK(((mempool_indirect_present == 0) ||
-               ((param->ipv4_frag == 1) || (param->ipv6_frag == 1))),
-               "Parse error in section \"%s\": IPv4/IPv6 fragmentation "
-               "is off, therefore entry \"mempool_indirect\" is "
-               "not allowed", section_name);
-
-       free(entries);
-}
-
-static void
-parse_tm(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_pktq_tm_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->tm_params, section_name);
-       param = &app->tm_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       APP_PARAM_ADD_LINK_FOR_TM(app, section_name);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "cfg") == 0) {
-                       param->file_name = strdup(ent->value);
-                       PARSE_ERROR_MALLOC(param->file_name != NULL);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst_read") == 0) {
-                       int status = parser_read_uint32(
-                               &param->burst_read, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst_write") == 0) {
-                       int status = parser_read_uint32(
-                               &param->burst_write, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_tap(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_pktq_tap_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->tap_params, section_name);
-       param = &app->tap_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "burst_read") == 0) {
-                       int status = parser_read_uint32(
-                               &param->burst_read, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst_write") == 0) {
-                       int status = parser_read_uint32(
-                               &param->burst_write, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "dropless") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                               ent->name);
-                       param->dropless = status;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "n_retries") == 0) {
-                       int status = parser_read_uint64(&param->n_retries,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "mempool") == 0) {
-                       int status = validate_name(ent->value,
-                               "MEMPOOL", 1);
-                       ssize_t idx;
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-
-                       idx = APP_PARAM_ADD(app->mempool_params, ent->value);
-                       param->mempool_id = idx;
-
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_kni(struct app_params *app,
-                 const char *section_name,
-                 struct rte_cfgfile *cfg)
-{
-       struct app_pktq_kni_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->kni_params, section_name);
-       param = &app->kni_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       APP_PARAM_ADD_LINK_FOR_KNI(app, section_name);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "core") == 0) {
-                       int status = parse_pipeline_core(
-                                       &param->socket_id,
-                                       &param->core_id,
-                                       &param->hyper_th_id,
-                                       ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                                               ent->name);
-                       param->force_bind = 1;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "mempool") == 0) {
-                       int status = validate_name(ent->value,
-                               "MEMPOOL", 1);
-                       ssize_t idx;
-
-                       PARSE_ERROR((status == 0), section_name,
-                                               ent->name);
-
-                       idx = APP_PARAM_ADD(app->mempool_params, ent->value);
-                       param->mempool_id = idx;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst_read") == 0) {
-                       int status = parser_read_uint32(&param->burst_read,
-                                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst_write") == 0) {
-                       int status = parser_read_uint32(&param->burst_write,
-                                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "dropless") == 0) {
-                       int status = parser_read_arg_bool(ent->value);
-
-                       PARSE_ERROR((status != -EINVAL), section_name,
-                                               ent->name);
-                       param->dropless = status;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "n_retries") == 0) {
-                       int status = parser_read_uint64(&param->n_retries,
-                                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                                               ent->name);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_source(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_pktq_source_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-       uint32_t pcap_file_present = 0;
-       uint32_t pcap_size_present = 0;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->source_params, section_name);
-       param = &app->source_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "mempool") == 0) {
-                       int status = validate_name(ent->value,
-                               "MEMPOOL", 1);
-                       ssize_t idx;
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-
-                       idx = APP_PARAM_ADD(app->mempool_params, ent->value);
-                       param->mempool_id = idx;
-                       continue;
-               }
-
-               if (strcmp(ent->name, "burst") == 0) {
-                       int status = parser_read_uint32(&param->burst,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "pcap_file_rd") == 0) {
-                       PARSE_ERROR_DUPLICATE((pcap_file_present == 0),
-                               section_name, ent->name);
-
-                       param->file_name = strdup(ent->value);
-
-                       PARSE_ERROR_MALLOC(param->file_name != NULL);
-                       pcap_file_present = 1;
-
-                       continue;
-               }
-
-               if (strcmp(ent->name, "pcap_bytes_rd_per_pkt") == 0) {
-                       int status;
-
-                       PARSE_ERROR_DUPLICATE((pcap_size_present == 0),
-                               section_name, ent->name);
-
-                       status = parser_read_uint32(
-                               &param->n_bytes_per_pkt, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       pcap_size_present = 1;
-
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_sink(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_pktq_sink_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-       uint32_t pcap_file_present = 0;
-       uint32_t pcap_n_pkt_present = 0;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->sink_params, section_name);
-       param = &app->sink_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "pcap_file_wr") == 0) {
-                       PARSE_ERROR_DUPLICATE((pcap_file_present == 0),
-                               section_name, ent->name);
-
-                       param->file_name = strdup(ent->value);
-
-                       PARSE_ERROR_MALLOC((param->file_name != NULL));
-
-                       continue;
-               }
-
-               if (strcmp(ent->name, "pcap_n_pkt_wr") == 0) {
-                       int status;
-
-                       PARSE_ERROR_DUPLICATE((pcap_n_pkt_present == 0),
-                               section_name, ent->name);
-
-                       status = parser_read_uint32(
-                               &param->n_pkts_to_dump, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_msgq_req_pipeline(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_msgq_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->msgq_params, section_name);
-       param = &app->msgq_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "size") == 0) {
-                       int status = parser_read_uint32(&param->size,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_msgq_rsp_pipeline(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_msgq_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->msgq_params, section_name);
-       param = &app->msgq_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "size") == 0) {
-                       int status = parser_read_uint32(&param->size,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-static void
-parse_msgq(struct app_params *app,
-       const char *section_name,
-       struct rte_cfgfile *cfg)
-{
-       struct app_msgq_params *param;
-       struct rte_cfgfile_entry *entries;
-       int n_entries, i;
-       ssize_t param_idx;
-
-       n_entries = rte_cfgfile_section_num_entries(cfg, section_name);
-       PARSE_ERROR_SECTION_NO_ENTRIES((n_entries > 0), section_name);
-
-       entries = malloc(n_entries * sizeof(struct rte_cfgfile_entry));
-       PARSE_ERROR_MALLOC(entries != NULL);
-
-       rte_cfgfile_section_entries(cfg, section_name, entries, n_entries);
-
-       param_idx = APP_PARAM_ADD(app->msgq_params, section_name);
-       param = &app->msgq_params[param_idx];
-       PARSE_CHECK_DUPLICATE_SECTION(param);
-
-       for (i = 0; i < n_entries; i++) {
-               struct rte_cfgfile_entry *ent = &entries[i];
-
-               if (strcmp(ent->name, "size") == 0) {
-                       int status = parser_read_uint32(&param->size,
-                               ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               if (strcmp(ent->name, "cpu") == 0) {
-                       int status = parser_read_uint32(
-                               &param->cpu_socket_id, ent->value);
-
-                       PARSE_ERROR((status == 0), section_name,
-                               ent->name);
-                       continue;
-               }
-
-               /* unrecognized */
-               PARSE_ERROR_INVALID(0, section_name, ent->name);
-       }
-
-       free(entries);
-}
-
-typedef void (*config_section_load)(struct app_params *p,
-       const char *section_name,
-       struct rte_cfgfile *cfg);
-
-struct config_section {
-       const char prefix[CFG_NAME_LEN];
-       int numbers;
-       config_section_load load;
-};
-
-static const struct config_section cfg_file_scheme[] = {
-       {"EAL", 0, parse_eal},
-       {"PIPELINE", 1, parse_pipeline},
-       {"MEMPOOL", 1, parse_mempool},
-       {"LINK", 1, parse_link},
-       {"RXQ", 2, parse_rxq},
-       {"TXQ", 2, parse_txq},
-       {"SWQ", 1, parse_swq},
-       {"TM", 1, parse_tm},
-       {"TAP", 1, parse_tap},
-       {"KNI", 1, parse_kni},
-       {"SOURCE", 1, parse_source},
-       {"SINK", 1, parse_sink},
-       {"MSGQ-REQ-PIPELINE", 1, parse_msgq_req_pipeline},
-       {"MSGQ-RSP-PIPELINE", 1, parse_msgq_rsp_pipeline},
-       {"MSGQ", 1, parse_msgq},
-};
-
-static void
-create_implicit_mempools(struct app_params *app)
-{
-       APP_PARAM_ADD(app->mempool_params, "MEMPOOL0");
-}
-
-static void
-create_implicit_links_from_port_mask(struct app_params *app,
-       uint64_t port_mask)
-{
-       uint32_t pmd_id, link_id;
-
-       link_id = 0;
-       for (pmd_id = 0; pmd_id < RTE_MAX_ETHPORTS; pmd_id++) {
-               char name[APP_PARAM_NAME_SIZE];
-               ssize_t idx;
-
-               if ((port_mask & (1LLU << pmd_id)) == 0)
-                       continue;
-
-               snprintf(name, sizeof(name), "LINK%" PRIu32, link_id);
-               idx = APP_PARAM_ADD(app->link_params, name);
-
-               app->link_params[idx].pmd_id = pmd_id;
-               link_id++;
-       }
-}
-
-static void
-assign_link_pmd_id_from_pci_bdf(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_links; i++) {
-               struct app_link_params *link = &app->link_params[i];
-
-               APP_CHECK((strlen(link->pci_bdf)),
-                       "Parse error: %s pci_bdf is not configured "
-                       "(port_mask is not provided)",
-                       link->name);
-
-               link->pmd_id = i;
-       }
-}
-
-int
-app_config_parse(struct app_params *app, const char *file_name)
-{
-       struct rte_cfgfile *cfg;
-       char **section_names;
-       int i, j, sect_count;
-
-       /* Implicit mempools */
-       create_implicit_mempools(app);
-
-       /* Port mask */
-       if (app->port_mask)
-               create_implicit_links_from_port_mask(app, app->port_mask);
-
-       /* Load application configuration file */
-       cfg = rte_cfgfile_load(file_name, 0);
-       APP_CHECK((cfg != NULL), "Parse error: Unable to load config "
-               "file %s", file_name);
-
-       sect_count = rte_cfgfile_num_sections(cfg, NULL, 0);
-       APP_CHECK((sect_count > 0), "Parse error: number of sections "
-               "in file \"%s\" return %d", file_name,
-               sect_count);
-
-       section_names = malloc(sect_count * sizeof(char *));
-       PARSE_ERROR_MALLOC(section_names != NULL);
-
-       for (i = 0; i < sect_count; i++)
-               section_names[i] = malloc(CFG_NAME_LEN);
-
-       rte_cfgfile_sections(cfg, section_names, sect_count);
-
-       for (i = 0; i < sect_count; i++) {
-               const struct config_section *sch_s;
-               int len, cfg_name_len;
-
-               cfg_name_len = strlen(section_names[i]);
-
-               /* Find section type */
-               for (j = 0; j < (int)RTE_DIM(cfg_file_scheme); j++) {
-                       sch_s = &cfg_file_scheme[j];
-                       len = strlen(sch_s->prefix);
-
-                       if (cfg_name_len < len)
-                               continue;
-
-                       /* After section name we expect only '\0' or digit or
-                        * digit dot digit, so protect against false matching,
-                        * for example: "ABC" should match section name
-                        * "ABC0.0", but it should not match section_name
-                        * "ABCDEF".
-                        */
-                       if ((section_names[i][len] != '\0') &&
-                               !isdigit(section_names[i][len]))
-                               continue;
-
-                       if (strncmp(sch_s->prefix, section_names[i], len) == 0)
-                               break;
-               }
-
-               APP_CHECK(j < (int)RTE_DIM(cfg_file_scheme),
-                       "Parse error: unknown section %s",
-                       section_names[i]);
-
-               APP_CHECK(validate_name(section_names[i],
-                       sch_s->prefix,
-                       sch_s->numbers) == 0,
-                       "Parse error: invalid section name \"%s\"",
-                       section_names[i]);
-
-               sch_s->load(app, section_names[i], cfg);
-       }
-
-       for (i = 0; i < sect_count; i++)
-               free(section_names[i]);
-
-       free(section_names);
-
-       rte_cfgfile_close(cfg);
-
-       APP_PARAM_COUNT(app->mempool_params, app->n_mempools);
-       APP_PARAM_COUNT(app->link_params, app->n_links);
-       APP_PARAM_COUNT(app->hwq_in_params, app->n_pktq_hwq_in);
-       APP_PARAM_COUNT(app->hwq_out_params, app->n_pktq_hwq_out);
-       APP_PARAM_COUNT(app->swq_params, app->n_pktq_swq);
-       APP_PARAM_COUNT(app->tm_params, app->n_pktq_tm);
-       APP_PARAM_COUNT(app->tap_params, app->n_pktq_tap);
-       APP_PARAM_COUNT(app->kni_params, app->n_pktq_kni);
-       APP_PARAM_COUNT(app->source_params, app->n_pktq_source);
-       APP_PARAM_COUNT(app->sink_params, app->n_pktq_sink);
-       APP_PARAM_COUNT(app->msgq_params, app->n_msgq);
-       APP_PARAM_COUNT(app->pipeline_params, app->n_pipelines);
-
-       if (app->port_mask == 0)
-               assign_link_pmd_id_from_pci_bdf(app);
-
-       /* Save configuration to output file */
-       app_config_save(app, app->output_file);
-
-       /* Load TM configuration files */
-       app_config_parse_tm(app);
-
-       return 0;
-}
-
-static void
-save_eal_params(struct app_params *app, FILE *f)
-{
-       struct app_eal_params *p = &app->eal_params;
-       uint32_t i;
-
-       fprintf(f, "[EAL]\n");
-
-       if (p->coremap)
-               fprintf(f, "%s = %s\n", "lcores", p->coremap);
-
-       if (p->master_lcore_present)
-               fprintf(f, "%s = %" PRIu32 "\n",
-                       "master_lcore", p->master_lcore);
-
-       fprintf(f, "%s = %" PRIu32 "\n", "n", p->channels);
-
-       if (p->memory_present)
-               fprintf(f, "%s = %" PRIu32 "\n", "m", p->memory);
-
-       if (p->ranks_present)
-               fprintf(f, "%s = %" PRIu32 "\n", "r", p->ranks);
-
-       for (i = 0; i < APP_MAX_LINKS; i++) {
-               if (p->pci_blacklist[i] == NULL)
-                       break;
-
-               fprintf(f, "%s = %s\n", "pci_blacklist",
-                       p->pci_blacklist[i]);
-       }
-
-       for (i = 0; i < APP_MAX_LINKS; i++) {
-               if (p->pci_whitelist[i] == NULL)
-                       break;
-
-               fprintf(f, "%s = %s\n", "pci_whitelist",
-                       p->pci_whitelist[i]);
-       }
-
-       for (i = 0; i < APP_MAX_LINKS; i++) {
-               if (p->vdev[i] == NULL)
-                       break;
-
-               fprintf(f, "%s = %s\n", "vdev",
-                       p->vdev[i]);
-       }
-
-       if (p->vmware_tsc_map_present)
-               fprintf(f, "%s = %s\n", "vmware_tsc_map",
-                       (p->vmware_tsc_map) ? "yes" : "no");
-
-       if (p->proc_type)
-               fprintf(f, "%s = %s\n", "proc_type", p->proc_type);
-
-       if (p->syslog)
-               fprintf(f, "%s = %s\n", "syslog", p->syslog);
-
-       if (p->log_level_present)
-               fprintf(f, "%s = %" PRIu32 "\n", "log_level", p->log_level);
-
-       if (p->version_present)
-               fprintf(f, "%s = %s\n", "v", (p->version) ? "yes" : "no");
-
-       if (p->help_present)
-               fprintf(f, "%s = %s\n", "help", (p->help) ? "yes" : "no");
-
-       if (p->no_huge_present)
-               fprintf(f, "%s = %s\n", "no_huge", (p->no_huge) ? "yes" : "no");
-
-       if (p->no_pci_present)
-               fprintf(f, "%s = %s\n", "no_pci", (p->no_pci) ? "yes" : "no");
-
-       if (p->no_hpet_present)
-               fprintf(f, "%s = %s\n", "no_hpet", (p->no_hpet) ? "yes" : "no");
-
-       if (p->no_shconf_present)
-               fprintf(f, "%s = %s\n", "no_shconf",
-                       (p->no_shconf) ? "yes" : "no");
-
-       if (p->add_driver)
-               fprintf(f, "%s = %s\n", "d", p->add_driver);
-
-       if (p->socket_mem)
-               fprintf(f, "%s = %s\n", "socket_mem", p->socket_mem);
-
-       if (p->huge_dir)
-               fprintf(f, "%s = %s\n", "huge_dir", p->huge_dir);
-
-       if (p->file_prefix)
-               fprintf(f, "%s = %s\n", "file_prefix", p->file_prefix);
-
-       if (p->base_virtaddr)
-               fprintf(f, "%s = %s\n", "base_virtaddr", p->base_virtaddr);
-
-       if (p->create_uio_dev_present)
-               fprintf(f, "%s = %s\n", "create_uio_dev",
-                       (p->create_uio_dev) ? "yes" : "no");
-
-       if (p->vfio_intr)
-               fprintf(f, "%s = %s\n", "vfio_intr", p->vfio_intr);
-
-       fputc('\n', f);
-}
-
-static void
-save_mempool_params(struct app_params *app, FILE *f)
-{
-       struct app_mempool_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->mempool_params);
-       for (i = 0; i < count; i++) {
-               p = &app->mempool_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %" PRIu32 "\n", "buffer_size", p->buffer_size);
-               fprintf(f, "%s = %" PRIu32 "\n", "pool_size", p->pool_size);
-               fprintf(f, "%s = %" PRIu32 "\n", "cache_size", p->cache_size);
-               fprintf(f, "%s = %" PRIu32 "\n", "cpu", p->cpu_socket_id);
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_links_params(struct app_params *app, FILE *f)
-{
-       struct app_link_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->link_params);
-       for (i = 0; i < count; i++) {
-               p = &app->link_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "; %s = %" PRIu32 "\n", "pmd_id", p->pmd_id);
-               fprintf(f, "%s = %s\n", "promisc", p->promisc ? "yes" : "no");
-               fprintf(f, "%s = %" PRIu32 "\n", "arp_q", p->arp_q);
-               fprintf(f, "%s = %" PRIu32 "\n", "tcp_syn_q",
-                       p->tcp_syn_q);
-               fprintf(f, "%s = %" PRIu32 "\n", "ip_local_q", p->ip_local_q);
-               fprintf(f, "%s = %" PRIu32 "\n", "tcp_local_q", p->tcp_local_q);
-               fprintf(f, "%s = %" PRIu32 "\n", "udp_local_q", p->udp_local_q);
-               fprintf(f, "%s = %" PRIu32 "\n", "sctp_local_q",
-                       p->sctp_local_q);
-
-               if (p->n_rss_qs) {
-                       uint32_t j;
-
-                       /* rss_qs */
-                       fprintf(f, "rss_qs = ");
-                       for (j = 0; j < p->n_rss_qs; j++)
-                               fprintf(f, "%" PRIu32 " ",      p->rss_qs[j]);
-                       fputc('\n', f);
-
-                       /* rss_proto_ipv4 */
-                       if (p->rss_proto_ipv4) {
-                               fprintf(f, "rss_proto_ipv4 = ");
-                               if (p->rss_proto_ipv4 & ETH_RSS_IPV4)
-                                       fprintf(f, "IP ");
-                               if (p->rss_proto_ipv4 & ETH_RSS_FRAG_IPV4)
-                                       fprintf(f, "FRAG ");
-                               if (p->rss_proto_ipv4 &
-                                       ETH_RSS_NONFRAG_IPV4_TCP)
-                                       fprintf(f, "TCP ");
-                               if (p->rss_proto_ipv4 &
-                                       ETH_RSS_NONFRAG_IPV4_UDP)
-                                       fprintf(f, "UDP ");
-                               if (p->rss_proto_ipv4 &
-                                       ETH_RSS_NONFRAG_IPV4_SCTP)
-                                       fprintf(f, "SCTP ");
-                               if (p->rss_proto_ipv4 &
-                                       ETH_RSS_NONFRAG_IPV4_OTHER)
-                                       fprintf(f, "OTHER ");
-                               fprintf(f, "\n");
-                       } else
-                               fprintf(f, "; rss_proto_ipv4 = <NONE>\n");
-
-                       /* rss_proto_ipv6 */
-                       if (p->rss_proto_ipv6) {
-                               fprintf(f, "rss_proto_ipv6 = ");
-                               if (p->rss_proto_ipv6 & ETH_RSS_IPV6)
-                                       fprintf(f, "IP ");
-                               if (p->rss_proto_ipv6 & ETH_RSS_FRAG_IPV6)
-                                       fprintf(f, "FRAG ");
-                               if (p->rss_proto_ipv6 &
-                                       ETH_RSS_NONFRAG_IPV6_TCP)
-                                       fprintf(f, "TCP ");
-                               if (p->rss_proto_ipv6 &
-                                       ETH_RSS_NONFRAG_IPV6_UDP)
-                                       fprintf(f, "UDP ");
-                               if (p->rss_proto_ipv6 &
-                                       ETH_RSS_NONFRAG_IPV6_SCTP)
-                                       fprintf(f, "SCTP ");
-                               if (p->rss_proto_ipv6 &
-                                       ETH_RSS_NONFRAG_IPV6_OTHER)
-                                       fprintf(f, "OTHER ");
-                               if (p->rss_proto_ipv6 & ETH_RSS_IPV6_EX)
-                                       fprintf(f, "IP_EX ");
-                               if (p->rss_proto_ipv6 &
-                                       ETH_RSS_IPV6_TCP_EX)
-                                       fprintf(f, "TCP_EX ");
-                               if (p->rss_proto_ipv6 &
-                                       ETH_RSS_IPV6_UDP_EX)
-                                       fprintf(f, "UDP_EX ");
-                               fprintf(f, "\n");
-                       } else
-                               fprintf(f, "; rss_proto_ipv6 = <NONE>\n");
-
-                       /* rss_proto_l2 */
-                       if (p->rss_proto_l2) {
-                               fprintf(f, "rss_proto_l2 = ");
-                               if (p->rss_proto_l2 & ETH_RSS_L2_PAYLOAD)
-                                       fprintf(f, "L2 ");
-                               fprintf(f, "\n");
-                       } else
-                               fprintf(f, "; rss_proto_l2 = <NONE>\n");
-               } else {
-                       fprintf(f, "; rss_qs = <NONE>\n");
-                       fprintf(f, "; rss_proto_ipv4 = <NONE>\n");
-                       fprintf(f, "; rss_proto_ipv6 = <NONE>\n");
-                       fprintf(f, "; rss_proto_l2 = <NONE>\n");
-               }
-
-               if (strlen(p->pci_bdf))
-                       fprintf(f, "%s = %s\n", "pci_bdf", p->pci_bdf);
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_rxq_params(struct app_params *app, FILE *f)
-{
-       struct app_pktq_hwq_in_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->hwq_in_params);
-       for (i = 0; i < count; i++) {
-               p = &app->hwq_in_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %s\n",
-                       "mempool",
-                       app->mempool_params[p->mempool_id].name);
-               fprintf(f, "%s = %" PRIu32 "\n", "size", p->size);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst", p->burst);
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_txq_params(struct app_params *app, FILE *f)
-{
-       struct app_pktq_hwq_out_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->hwq_out_params);
-       for (i = 0; i < count; i++) {
-               p = &app->hwq_out_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %" PRIu32 "\n", "size", p->size);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst", p->burst);
-               fprintf(f, "%s = %s\n",
-                       "dropless",
-                       p->dropless ? "yes" : "no");
-               fprintf(f, "%s = %" PRIu64 "\n", "n_retries", p->n_retries);
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_swq_params(struct app_params *app, FILE *f)
-{
-       struct app_pktq_swq_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->swq_params);
-       for (i = 0; i < count; i++) {
-               p = &app->swq_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %" PRIu32 "\n", "size", p->size);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst_read", p->burst_read);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst_write", p->burst_write);
-               fprintf(f, "%s = %s\n", "dropless", p->dropless ? "yes" : "no");
-               fprintf(f, "%s = %" PRIu64 "\n", "n_retries", p->n_retries);
-               fprintf(f, "%s = %" PRIu32 "\n", "cpu", p->cpu_socket_id);
-               fprintf(f, "%s = %s\n", "ipv4_frag", p->ipv4_frag ? "yes" : "no");
-               fprintf(f, "%s = %s\n", "ipv6_frag", p->ipv6_frag ? "yes" : "no");
-               fprintf(f, "%s = %s\n", "ipv4_ras", p->ipv4_ras ? "yes" : "no");
-               fprintf(f, "%s = %s\n", "ipv6_ras", p->ipv6_ras ? "yes" : "no");
-               if ((p->ipv4_frag == 1) || (p->ipv6_frag == 1)) {
-                       fprintf(f, "%s = %" PRIu32 "\n", "mtu", p->mtu);
-                       fprintf(f, "%s = %" PRIu32 "\n", "metadata_size", p->metadata_size);
-                       fprintf(f, "%s = %s\n",
-                               "mempool_direct",
-                               app->mempool_params[p->mempool_direct_id].name);
-                       fprintf(f, "%s = %s\n",
-                               "mempool_indirect",
-                               app->mempool_params[p->mempool_indirect_id].name);
-               }
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_tm_params(struct app_params *app, FILE *f)
-{
-       struct app_pktq_tm_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->tm_params);
-       for (i = 0; i < count; i++) {
-               p = &app->tm_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %s\n", "cfg", p->file_name);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst_read", p->burst_read);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst_write", p->burst_write);
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_tap_params(struct app_params *app, FILE *f)
-{
-       struct app_pktq_tap_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->tap_params);
-       for (i = 0; i < count; i++) {
-               p = &app->tap_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst_read", p->burst_read);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst_write", p->burst_write);
-               fprintf(f, "%s = %s\n", "dropless", p->dropless ? "yes" : "no");
-               fprintf(f, "%s = %" PRIu64 "\n", "n_retries", p->n_retries);
-               fprintf(f, "%s = %s\n", "mempool",
-                       app->mempool_params[p->mempool_id].name);
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_kni_params(struct app_params *app, FILE *f)
-{
-       struct app_pktq_kni_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->kni_params);
-       for (i = 0; i < count; i++) {
-               p = &app->kni_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               /* section name */
-               fprintf(f, "[%s]\n", p->name);
-
-               /* core */
-               if (p->force_bind) {
-                       fprintf(f, "; force_bind = 1\n");
-                       fprintf(f, "core = s%" PRIu32 "c%" PRIu32 "%s\n",
-                                       p->socket_id,
-                                       p->core_id,
-                                       (p->hyper_th_id) ? "h" : "");
-               } else
-                       fprintf(f, "; force_bind = 0\n");
-
-               /* mempool */
-               fprintf(f, "%s = %s\n", "mempool",
-                               app->mempool_params[p->mempool_id].name);
-
-               /* burst_read */
-               fprintf(f, "%s = %" PRIu32 "\n", "burst_read", p->burst_read);
-
-               /* burst_write */
-               fprintf(f, "%s = %" PRIu32 "\n", "burst_write", p->burst_write);
-
-               /* dropless */
-               fprintf(f, "%s = %s\n",
-                               "dropless",
-                               p->dropless ? "yes" : "no");
-
-               /* n_retries */
-               fprintf(f, "%s = %" PRIu64 "\n", "n_retries", p->n_retries);
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_source_params(struct app_params *app, FILE *f)
-{
-       struct app_pktq_source_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->source_params);
-       for (i = 0; i < count; i++) {
-               p = &app->source_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %s\n",
-                       "mempool",
-                       app->mempool_params[p->mempool_id].name);
-               fprintf(f, "%s = %" PRIu32 "\n", "burst", p->burst);
-               fprintf(f, "%s = %s\n", "pcap_file_rd", p->file_name);
-               fprintf(f, "%s = %" PRIu32 "\n", "pcap_bytes_rd_per_pkt",
-                       p->n_bytes_per_pkt);
-               fputc('\n', f);
-       }
-}
-
-static void
-save_sink_params(struct app_params *app, FILE *f)
-{
-       struct app_pktq_sink_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->sink_params);
-       for (i = 0; i < count; i++) {
-               p = &app->sink_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %s\n", "pcap_file_wr", p->file_name);
-               fprintf(f, "%s = %" PRIu32 "\n",
-                               "pcap_n_pkt_wr", p->n_pkts_to_dump);
-               fputc('\n', f);
-       }
-}
-
-static void
-save_msgq_params(struct app_params *app, FILE *f)
-{
-       struct app_msgq_params *p;
-       size_t i, count;
-
-       count = RTE_DIM(app->msgq_params);
-       for (i = 0; i < count; i++) {
-               p = &app->msgq_params[i];
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               fprintf(f, "[%s]\n", p->name);
-               fprintf(f, "%s = %" PRIu32 "\n", "size", p->size);
-               fprintf(f, "%s = %" PRIu32 "\n", "cpu", p->cpu_socket_id);
-
-               fputc('\n', f);
-       }
-}
-
-static void
-save_pipeline_params(struct app_params *app, FILE *f)
-{
-       size_t i, count;
-
-       count = RTE_DIM(app->pipeline_params);
-       for (i = 0; i < count; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-
-               if (!APP_PARAM_VALID(p))
-                       continue;
-
-               /* section name */
-               fprintf(f, "[%s]\n", p->name);
-
-               /* type */
-               fprintf(f, "type = %s\n", p->type);
-
-               /* core */
-               fprintf(f, "core = s%" PRIu32 "c%" PRIu32 "%s\n",
-                       p->socket_id,
-                       p->core_id,
-                       (p->hyper_th_id) ? "h" : "");
-
-               /* pktq_in */
-               if (p->n_pktq_in) {
-                       uint32_t j;
-
-                       fprintf(f, "pktq_in =");
-                       for (j = 0; j < p->n_pktq_in; j++) {
-                               struct app_pktq_in_params *pp = &p->pktq_in[j];
-                               char *name;
-
-                               switch (pp->type) {
-                               case APP_PKTQ_IN_HWQ:
-                                       name = app->hwq_in_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_IN_SWQ:
-                                       name = app->swq_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_IN_TM:
-                                       name = app->tm_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_IN_TAP:
-                                       name = app->tap_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_IN_KNI:
-                                       name = app->kni_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_IN_SOURCE:
-                                       name = app->source_params[pp->id].name;
-                                       break;
-                               default:
-                                       APP_CHECK(0, "System error "
-                                               "occurred while saving "
-                                               "parameter to file");
-                               }
-
-                               fprintf(f, " %s", name);
-                       }
-                       fprintf(f, "\n");
-               }
-
-               /* pktq_in */
-               if (p->n_pktq_out) {
-                       uint32_t j;
-
-                       fprintf(f, "pktq_out =");
-                       for (j = 0; j < p->n_pktq_out; j++) {
-                               struct app_pktq_out_params *pp =
-                                       &p->pktq_out[j];
-                               char *name;
-
-                               switch (pp->type) {
-                               case APP_PKTQ_OUT_HWQ:
-                                       name = app->hwq_out_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_OUT_SWQ:
-                                       name = app->swq_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_OUT_TM:
-                                       name = app->tm_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_OUT_TAP:
-                                       name = app->tap_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_OUT_KNI:
-                                       name = app->kni_params[pp->id].name;
-                                       break;
-                               case APP_PKTQ_OUT_SINK:
-                                       name = app->sink_params[pp->id].name;
-                                       break;
-                               default:
-                                       APP_CHECK(0, "System error "
-                                               "occurred while saving "
-                                               "parameter to file");
-                               }
-
-                               fprintf(f, " %s", name);
-                       }
-                       fprintf(f, "\n");
-               }
-
-               /* msgq_in */
-               if (p->n_msgq_in) {
-                       uint32_t j;
-
-                       fprintf(f, "msgq_in =");
-                       for (j = 0; j < p->n_msgq_in; j++) {
-                               uint32_t id = p->msgq_in[j];
-                               char *name = app->msgq_params[id].name;
-
-                               fprintf(f, " %s", name);
-                       }
-                       fprintf(f, "\n");
-               }
-
-               /* msgq_out */
-               if (p->n_msgq_out) {
-                       uint32_t j;
-
-                       fprintf(f, "msgq_out =");
-                       for (j = 0; j < p->n_msgq_out; j++) {
-                               uint32_t id = p->msgq_out[j];
-                               char *name = app->msgq_params[id].name;
-
-                               fprintf(f, " %s", name);
-                       }
-                       fprintf(f, "\n");
-               }
-
-               /* timer_period */
-               fprintf(f, "timer_period = %" PRIu32 "\n", p->timer_period);
-
-               /* args */
-               if (p->n_args) {
-                       uint32_t j;
-
-                       for (j = 0; j < p->n_args; j++)
-                               fprintf(f, "%s = %s\n", p->args_name[j],
-                                       p->args_value[j]);
-               }
-
-               fprintf(f, "\n");
-       }
-}
-
-void
-app_config_save(struct app_params *app, const char *file_name)
-{
-       FILE *file;
-       char *name, *dir_name;
-       int status;
-
-       name = strdup(file_name);
-       dir_name = dirname(name);
-       status = access(dir_name, W_OK);
-       APP_CHECK((status == 0),
-               "Error: need write access privilege to directory "
-               "\"%s\" to save configuration\n", dir_name);
-
-       file = fopen(file_name, "w");
-       APP_CHECK((file != NULL),
-               "Error: failed to save configuration to file \"%s\"",
-               file_name);
-
-       save_eal_params(app, file);
-       save_pipeline_params(app, file);
-       save_mempool_params(app, file);
-       save_links_params(app, file);
-       save_rxq_params(app, file);
-       save_txq_params(app, file);
-       save_swq_params(app, file);
-       save_tm_params(app, file);
-       save_tap_params(app, file);
-       save_kni_params(app, file);
-       save_source_params(app, file);
-       save_sink_params(app, file);
-       save_msgq_params(app, file);
-
-       fclose(file);
-       free(name);
-}
-
-int
-app_config_init(struct app_params *app)
-{
-       size_t i;
-
-       memcpy(app, &app_params_default, sizeof(struct app_params));
-
-       for (i = 0; i < RTE_DIM(app->mempool_params); i++)
-               memcpy(&app->mempool_params[i],
-                       &mempool_params_default,
-                       sizeof(struct app_mempool_params));
-
-       for (i = 0; i < RTE_DIM(app->link_params); i++)
-               memcpy(&app->link_params[i],
-                       &link_params_default,
-                       sizeof(struct app_link_params));
-
-       for (i = 0; i < RTE_DIM(app->hwq_in_params); i++)
-               memcpy(&app->hwq_in_params[i],
-                       &default_hwq_in_params,
-                       sizeof(default_hwq_in_params));
-
-       for (i = 0; i < RTE_DIM(app->hwq_out_params); i++)
-               memcpy(&app->hwq_out_params[i],
-                       &default_hwq_out_params,
-                       sizeof(default_hwq_out_params));
-
-       for (i = 0; i < RTE_DIM(app->swq_params); i++)
-               memcpy(&app->swq_params[i],
-                       &default_swq_params,
-                       sizeof(default_swq_params));
-
-       for (i = 0; i < RTE_DIM(app->tm_params); i++)
-               memcpy(&app->tm_params[i],
-                       &default_tm_params,
-                       sizeof(default_tm_params));
-
-       for (i = 0; i < RTE_DIM(app->tap_params); i++)
-               memcpy(&app->tap_params[i],
-                       &default_tap_params,
-                       sizeof(default_tap_params));
-
-       for (i = 0; i < RTE_DIM(app->kni_params); i++)
-               memcpy(&app->kni_params[i],
-                          &default_kni_params,
-                          sizeof(default_kni_params));
-
-       for (i = 0; i < RTE_DIM(app->source_params); i++)
-               memcpy(&app->source_params[i],
-                       &default_source_params,
-                       sizeof(default_source_params));
-
-       for (i = 0; i < RTE_DIM(app->sink_params); i++)
-               memcpy(&app->sink_params[i],
-                       &default_sink_params,
-                       sizeof(default_sink_params));
-
-       for (i = 0; i < RTE_DIM(app->msgq_params); i++)
-               memcpy(&app->msgq_params[i],
-                       &default_msgq_params,
-                       sizeof(default_msgq_params));
-
-       for (i = 0; i < RTE_DIM(app->pipeline_params); i++)
-               memcpy(&app->pipeline_params[i],
-                       &default_pipeline_params,
-                       sizeof(default_pipeline_params));
-
-       return 0;
-}
-
-static char *
-filenamedup(const char *filename, const char *suffix)
-{
-       char *s = malloc(strlen(filename) + strlen(suffix) + 1);
-
-       if (!s)
-               return NULL;
-
-       sprintf(s, "%s%s", filename, suffix);
-       return s;
-}
-
-int
-app_config_args(struct app_params *app, int argc, char **argv)
-{
-       const char *optname;
-       int opt, option_index;
-       int f_present, s_present, p_present, l_present;
-       int preproc_present, preproc_params_present;
-       int scaned = 0;
-
-       static struct option lgopts[] = {
-               { "preproc", 1, 0, 0 },
-               { "preproc-args", 1, 0, 0 },
-               { NULL,  0, 0, 0 }
-       };
-
-       /* Copy application name */
-       strncpy(app->app_name, argv[0], APP_APPNAME_SIZE - 1);
-
-       f_present = 0;
-       s_present = 0;
-       p_present = 0;
-       l_present = 0;
-       preproc_present = 0;
-       preproc_params_present = 0;
-
-       while ((opt = getopt_long(argc, argv, "f:s:p:l:", lgopts,
-                       &option_index)) != EOF)
-               switch (opt) {
-               case 'f':
-                       if (f_present)
-                               rte_panic("Error: Config file is provided "
-                                       "more than once\n");
-                       f_present = 1;
-
-                       if (!strlen(optarg))
-                               rte_panic("Error: Config file name is null\n");
-
-                       app->config_file = strdup(optarg);
-                       if (app->config_file == NULL)
-                               rte_panic("Error: Memory allocation failure\n");
-
-                       break;
-
-               case 's':
-                       if (s_present)
-                               rte_panic("Error: Script file is provided "
-                                       "more than once\n");
-                       s_present = 1;
-
-                       if (!strlen(optarg))
-                               rte_panic("Error: Script file name is null\n");
-
-                       app->script_file = strdup(optarg);
-                       if (app->script_file == NULL)
-                               rte_panic("Error: Memory allocation failure\n");
-
-                       break;
-
-               case 'p':
-                       if (p_present)
-                               rte_panic("Error: PORT_MASK is provided "
-                                       "more than once\n");
-                       p_present = 1;
-
-                       if ((sscanf(optarg, "%" SCNx64 "%n", &app->port_mask,
-                               &scaned) != 1) ||
-                               ((size_t) scaned != strlen(optarg)))
-                               rte_panic("Error: PORT_MASK is not "
-                                       "a hexadecimal integer\n");
-
-                       if (app->port_mask == 0)
-                               rte_panic("Error: PORT_MASK is null\n");
-
-                       break;
-
-               case 'l':
-                       if (l_present)
-                               rte_panic("Error: LOG_LEVEL is provided "
-                                       "more than once\n");
-                       l_present = 1;
-
-                       if ((sscanf(optarg, "%" SCNu32 "%n", &app->log_level,
-                               &scaned) != 1) ||
-                               ((size_t) scaned != strlen(optarg)) ||
-                               (app->log_level >= APP_LOG_LEVELS))
-                               rte_panic("Error: LOG_LEVEL invalid value\n");
-
-                       break;
-
-               case 0:
-                       optname = lgopts[option_index].name;
-
-                       if (strcmp(optname, "preproc") == 0) {
-                               if (preproc_present)
-                                       rte_panic("Error: Preprocessor argument "
-                                               "is provided more than once\n");
-                               preproc_present = 1;
-
-                               app->preproc = strdup(optarg);
-                               break;
-                       }
-
-                       if (strcmp(optname, "preproc-args") == 0) {
-                               if (preproc_params_present)
-                                       rte_panic("Error: Preprocessor args "
-                                               "are provided more than once\n");
-                               preproc_params_present = 1;
-
-                               app->preproc_args = strdup(optarg);
-                               break;
-                       }
-
-                       app_print_usage(argv[0]);
-                       break;
-
-               default:
-                       app_print_usage(argv[0]);
-               }
-
-       optind = 1; /* reset getopt lib */
-
-       /* Check dependencies between args */
-       if (preproc_params_present && (preproc_present == 0))
-               rte_panic("Error: Preprocessor args specified while "
-                       "preprocessor is not defined\n");
-
-       app->parser_file = preproc_present ?
-               filenamedup(app->config_file, ".preproc") :
-               strdup(app->config_file);
-       app->output_file = filenamedup(app->config_file, ".out");
-
-       return 0;
-}
-
-int
-app_config_preproc(struct app_params *app)
-{
-       char buffer[256];
-       int status;
-
-       if (app->preproc == NULL)
-               return 0;
-
-       status = access(app->config_file, F_OK | R_OK);
-       APP_CHECK((status == 0), "Error: Unable to open file %s",
-               app->config_file);
-
-       snprintf(buffer, sizeof(buffer), "%s %s %s > %s",
-               app->preproc,
-               app->preproc_args ? app->preproc_args : "",
-               app->config_file,
-               app->parser_file);
-
-       status = system(buffer);
-       APP_CHECK((WIFEXITED(status) && (WEXITSTATUS(status) == 0)),
-               "Error occurred while pre-processing file \"%s\"\n",
-               app->config_file);
-
-       return status;
-}
diff --git a/examples/ip_pipeline/config_parse_tm.c b/examples/ip_pipeline/config_parse_tm.c
deleted file mode 100644 (file)
index 6edd2ca..0000000
+++ /dev/null
@@ -1,419 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <getopt.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <string.h>
-#include <libgen.h>
-#include <unistd.h>
-
-#include <rte_errno.h>
-#include <rte_cfgfile.h>
-#include <rte_string_fns.h>
-
-#include "app.h"
-
-static int
-tm_cfgfile_load_sched_port(
-       struct rte_cfgfile *file,
-       struct rte_sched_port_params *port_params)
-{
-       const char *entry;
-       int j;
-
-       entry = rte_cfgfile_get_entry(file, "port", "frame overhead");
-       if (entry)
-               port_params->frame_overhead = (uint32_t)atoi(entry);
-
-       entry = rte_cfgfile_get_entry(file, "port", "mtu");
-       if (entry)
-               port_params->mtu = (uint32_t)atoi(entry);
-
-       entry = rte_cfgfile_get_entry(file,
-               "port",
-               "number of subports per port");
-       if (entry)
-               port_params->n_subports_per_port = (uint32_t) atoi(entry);
-
-       entry = rte_cfgfile_get_entry(file,
-               "port",
-               "number of pipes per subport");
-       if (entry)
-               port_params->n_pipes_per_subport = (uint32_t) atoi(entry);
-
-       entry = rte_cfgfile_get_entry(file, "port", "queue sizes");
-       if (entry) {
-               char *next;
-
-               for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) {
-                       port_params->qsize[j] = (uint16_t)
-                               strtol(entry, &next, 10);
-                       if (next == NULL)
-                               break;
-                       entry = next;
-               }
-       }
-
-#ifdef RTE_SCHED_RED
-       for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) {
-               char str[32];
-
-               /* Parse WRED min thresholds */
-               snprintf(str, sizeof(str), "tc %" PRId32 " wred min", j);
-               entry = rte_cfgfile_get_entry(file, "red", str);
-               if (entry) {
-                       char *next;
-                       int k;
-
-                       /* for each packet colour (green, yellow, red) */
-                       for (k = 0; k < e_RTE_METER_COLORS; k++) {
-                               port_params->red_params[j][k].min_th
-                                       = (uint16_t)strtol(entry, &next, 10);
-                               if (next == NULL)
-                                       break;
-                               entry = next;
-                       }
-               }
-
-               /* Parse WRED max thresholds */
-               snprintf(str, sizeof(str), "tc %" PRId32 " wred max", j);
-               entry = rte_cfgfile_get_entry(file, "red", str);
-               if (entry) {
-                       char *next;
-                       int k;
-
-                       /* for each packet colour (green, yellow, red) */
-                       for (k = 0; k < e_RTE_METER_COLORS; k++) {
-                               port_params->red_params[j][k].max_th
-                                       = (uint16_t)strtol(entry, &next, 10);
-                               if (next == NULL)
-                                       break;
-                               entry = next;
-                       }
-               }
-
-               /* Parse WRED inverse mark probabilities */
-               snprintf(str, sizeof(str), "tc %" PRId32 " wred inv prob", j);
-               entry = rte_cfgfile_get_entry(file, "red", str);
-               if (entry) {
-                       char *next;
-                       int k;
-
-                       /* for each packet colour (green, yellow, red) */
-                       for (k = 0; k < e_RTE_METER_COLORS; k++) {
-                               port_params->red_params[j][k].maxp_inv
-                                       = (uint8_t)strtol(entry, &next, 10);
-
-                               if (next == NULL)
-                                       break;
-                               entry = next;
-                       }
-               }
-
-               /* Parse WRED EWMA filter weights */
-               snprintf(str, sizeof(str), "tc %" PRId32 " wred weight", j);
-               entry = rte_cfgfile_get_entry(file, "red", str);
-               if (entry) {
-                       char *next;
-                       int k;
-
-                       /* for each packet colour (green, yellow, red) */
-                       for (k = 0; k < e_RTE_METER_COLORS; k++) {
-                               port_params->red_params[j][k].wq_log2
-                                       = (uint8_t)strtol(entry, &next, 10);
-                               if (next == NULL)
-                                       break;
-                               entry = next;
-                       }
-               }
-       }
-#endif /* RTE_SCHED_RED */
-
-       return 0;
-}
-
-static int
-tm_cfgfile_load_sched_pipe(
-       struct rte_cfgfile *file,
-       struct rte_sched_port_params *port_params,
-       struct rte_sched_pipe_params *pipe_params)
-{
-       int i, j;
-       char *next;
-       const char *entry;
-       int profiles;
-
-       profiles = rte_cfgfile_num_sections(file,
-               "pipe profile", sizeof("pipe profile") - 1);
-       port_params->n_pipe_profiles = profiles;
-
-       for (j = 0; j < profiles; j++) {
-               char pipe_name[32];
-
-               snprintf(pipe_name, sizeof(pipe_name),
-                       "pipe profile %" PRId32, j);
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tb rate");
-               if (entry)
-                       pipe_params[j].tb_rate = (uint32_t) atoi(entry);
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tb size");
-               if (entry)
-                       pipe_params[j].tb_size = (uint32_t) atoi(entry);
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tc period");
-               if (entry)
-                       pipe_params[j].tc_period = (uint32_t) atoi(entry);
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tc 0 rate");
-               if (entry)
-                       pipe_params[j].tc_rate[0] = (uint32_t) atoi(entry);
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tc 1 rate");
-               if (entry)
-                       pipe_params[j].tc_rate[1] = (uint32_t) atoi(entry);
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tc 2 rate");
-               if (entry)
-                       pipe_params[j].tc_rate[2] = (uint32_t) atoi(entry);
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tc 3 rate");
-               if (entry)
-                       pipe_params[j].tc_rate[3] = (uint32_t) atoi(entry);
-
-#ifdef RTE_SCHED_SUBPORT_TC_OV
-               entry = rte_cfgfile_get_entry(file, pipe_name,
-                       "tc 3 oversubscription weight");
-               if (entry)
-                       pipe_params[j].tc_ov_weight = (uint8_t)atoi(entry);
-#endif
-
-               entry = rte_cfgfile_get_entry(file,
-                       pipe_name,
-                       "tc 0 wrr weights");
-               if (entry)
-                       for (i = 0; i < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; i++) {
-                               pipe_params[j].wrr_weights[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE*0 + i] =
-                                       (uint8_t) strtol(entry, &next, 10);
-                               if (next == NULL)
-                                       break;
-                               entry = next;
-                       }
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tc 1 wrr weights");
-               if (entry)
-                       for (i = 0; i < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; i++) {
-                               pipe_params[j].wrr_weights[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE*1 + i] =
-                                       (uint8_t) strtol(entry, &next, 10);
-                               if (next == NULL)
-                                       break;
-                               entry = next;
-                       }
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tc 2 wrr weights");
-               if (entry)
-                       for (i = 0; i < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; i++) {
-                               pipe_params[j].wrr_weights[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE*2 + i] =
-                                       (uint8_t) strtol(entry, &next, 10);
-                               if (next == NULL)
-                                       break;
-                               entry = next;
-                       }
-
-               entry = rte_cfgfile_get_entry(file, pipe_name, "tc 3 wrr weights");
-               if (entry)
-                       for (i = 0; i < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; i++) {
-                               pipe_params[j].wrr_weights[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE*3 + i] =
-                                       (uint8_t) strtol(entry, &next, 10);
-                               if (next == NULL)
-                                       break;
-                               entry = next;
-                       }
-       }
-       return 0;
-}
-
-static int
-tm_cfgfile_load_sched_subport(
-       struct rte_cfgfile *file,
-       struct rte_sched_subport_params *subport_params,
-       int *pipe_to_profile)
-{
-       const char *entry;
-       int i, j, k;
-
-       for (i = 0; i < APP_MAX_SCHED_SUBPORTS; i++) {
-               char sec_name[CFG_NAME_LEN];
-
-               snprintf(sec_name, sizeof(sec_name),
-                       "subport %" PRId32, i);
-
-               if (rte_cfgfile_has_section(file, sec_name)) {
-                       entry = rte_cfgfile_get_entry(file,
-                               sec_name,
-                               "tb rate");
-                       if (entry)
-                               subport_params[i].tb_rate =
-                                       (uint32_t) atoi(entry);
-
-                       entry = rte_cfgfile_get_entry(file,
-                               sec_name,
-                               "tb size");
-                       if (entry)
-                               subport_params[i].tb_size =
-                                       (uint32_t) atoi(entry);
-
-                       entry = rte_cfgfile_get_entry(file,
-                               sec_name,
-                               "tc period");
-                       if (entry)
-                               subport_params[i].tc_period =
-                                       (uint32_t) atoi(entry);
-
-                       entry = rte_cfgfile_get_entry(file,
-                               sec_name,
-                               "tc 0 rate");
-                       if (entry)
-                               subport_params[i].tc_rate[0] =
-                                       (uint32_t) atoi(entry);
-
-                       entry = rte_cfgfile_get_entry(file,
-                               sec_name,
-                               "tc 1 rate");
-                       if (entry)
-                               subport_params[i].tc_rate[1] =
-                                       (uint32_t) atoi(entry);
-
-                       entry = rte_cfgfile_get_entry(file,
-                               sec_name,
-                               "tc 2 rate");
-                       if (entry)
-                               subport_params[i].tc_rate[2] =
-                                       (uint32_t) atoi(entry);
-
-                       entry = rte_cfgfile_get_entry(file,
-                               sec_name,
-                               "tc 3 rate");
-                       if (entry)
-                               subport_params[i].tc_rate[3] =
-                                       (uint32_t) atoi(entry);
-
-                       int n_entries = rte_cfgfile_section_num_entries(file,
-                               sec_name);
-                       struct rte_cfgfile_entry entries[n_entries];
-
-                       rte_cfgfile_section_entries(file,
-                               sec_name,
-                               entries,
-                               n_entries);
-
-                       for (j = 0; j < n_entries; j++)
-                               if (strncmp("pipe",
-                                       entries[j].name,
-                                       sizeof("pipe") - 1) == 0) {
-                                       int profile;
-                                       char *tokens[2] = {NULL, NULL};
-                                       int n_tokens;
-                                       int begin, end;
-                                       char name[CFG_NAME_LEN + 1];
-
-                                       profile = atoi(entries[j].value);
-                                       strncpy(name,
-                                               entries[j].name,
-                                               sizeof(name));
-                                       n_tokens = rte_strsplit(
-                                               &name[sizeof("pipe")],
-                                               strnlen(name, CFG_NAME_LEN),
-                                                       tokens, 2, '-');
-
-                                       begin =  atoi(tokens[0]);
-                                       if (n_tokens == 2)
-                                               end = atoi(tokens[1]);
-                                       else
-                                               end = begin;
-
-                                       if ((end >= APP_MAX_SCHED_PIPES) ||
-                                               (begin > end))
-                                               return -1;
-
-                                       for (k = begin; k <= end; k++) {
-                                               char profile_name[CFG_NAME_LEN];
-
-                                               snprintf(profile_name,
-                                                       sizeof(profile_name),
-                                                       "pipe profile %" PRId32,
-                                                       profile);
-                                               if (rte_cfgfile_has_section(file, profile_name))
-                                                       pipe_to_profile[i * APP_MAX_SCHED_PIPES + k] = profile;
-                                               else
-                                                       rte_exit(EXIT_FAILURE,
-                                                               "Wrong pipe profile %s\n",
-                                                               entries[j].value);
-                                       }
-                               }
-               }
-       }
-
-       return 0;
-}
-
-static int
-tm_cfgfile_load(struct app_pktq_tm_params *tm)
-{
-       struct rte_cfgfile *file;
-       uint32_t i;
-
-       memset(tm->sched_subport_params, 0, sizeof(tm->sched_subport_params));
-       memset(tm->sched_pipe_profiles, 0, sizeof(tm->sched_pipe_profiles));
-       memset(&tm->sched_port_params, 0, sizeof(tm->sched_port_params));
-       for (i = 0; i < APP_MAX_SCHED_SUBPORTS * APP_MAX_SCHED_PIPES; i++)
-               tm->sched_pipe_to_profile[i] = -1;
-
-       tm->sched_port_params.pipe_profiles = &tm->sched_pipe_profiles[0];
-
-       if (tm->file_name[0] == '\0')
-               return -1;
-
-       file = rte_cfgfile_load(tm->file_name, 0);
-       if (file == NULL)
-               return -1;
-
-       tm_cfgfile_load_sched_port(file,
-               &tm->sched_port_params);
-       tm_cfgfile_load_sched_subport(file,
-               tm->sched_subport_params,
-               tm->sched_pipe_to_profile);
-       tm_cfgfile_load_sched_pipe(file,
-               &tm->sched_port_params,
-               tm->sched_pipe_profiles);
-
-       rte_cfgfile_close(file);
-       return 0;
-}
-
-int
-app_config_parse_tm(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < RTE_DIM(app->tm_params); i++) {
-               struct app_pktq_tm_params *p = &app->tm_params[i];
-               int status;
-
-               if (!APP_PARAM_VALID(p))
-                       break;
-
-               status = tm_cfgfile_load(p);
-               APP_CHECK(status == 0,
-                       "Parse error for %s configuration file \"%s\"\n",
-                       p->name,
-                       p->file_name);
-       }
-
-       return 0;
-}
diff --git a/examples/ip_pipeline/cpu_core_map.c b/examples/ip_pipeline/cpu_core_map.c
deleted file mode 100644 (file)
index 231f38e..0000000
+++ /dev/null
@@ -1,471 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <rte_lcore.h>
-
-#include "cpu_core_map.h"
-
-struct cpu_core_map {
-       uint32_t n_max_sockets;
-       uint32_t n_max_cores_per_socket;
-       uint32_t n_max_ht_per_core;
-       uint32_t n_sockets;
-       uint32_t n_cores_per_socket;
-       uint32_t n_ht_per_core;
-       int map[0];
-};
-
-static inline uint32_t
-cpu_core_map_pos(struct cpu_core_map *map,
-       uint32_t socket_id,
-       uint32_t core_id,
-       uint32_t ht_id)
-{
-       return (socket_id * map->n_max_cores_per_socket + core_id) *
-               map->n_max_ht_per_core + ht_id;
-}
-
-static int
-cpu_core_map_compute_eal(struct cpu_core_map *map);
-
-static int
-cpu_core_map_compute_linux(struct cpu_core_map *map);
-
-static int
-cpu_core_map_compute_and_check(struct cpu_core_map *map);
-
-struct cpu_core_map *
-cpu_core_map_init(uint32_t n_max_sockets,
-       uint32_t n_max_cores_per_socket,
-       uint32_t n_max_ht_per_core,
-       uint32_t eal_initialized)
-{
-       uint32_t map_size, map_mem_size, i;
-       struct cpu_core_map *map;
-       int status;
-
-       /* Check input arguments */
-       if ((n_max_sockets == 0) ||
-               (n_max_cores_per_socket == 0) ||
-               (n_max_ht_per_core == 0))
-               return NULL;
-
-       /* Memory allocation */
-       map_size = n_max_sockets * n_max_cores_per_socket * n_max_ht_per_core;
-       map_mem_size = sizeof(struct cpu_core_map) + map_size * sizeof(int);
-       map = (struct cpu_core_map *) malloc(map_mem_size);
-       if (map == NULL)
-               return NULL;
-
-       /* Initialization */
-       map->n_max_sockets = n_max_sockets;
-       map->n_max_cores_per_socket = n_max_cores_per_socket;
-       map->n_max_ht_per_core = n_max_ht_per_core;
-       map->n_sockets = 0;
-       map->n_cores_per_socket = 0;
-       map->n_ht_per_core = 0;
-
-       for (i = 0; i < map_size; i++)
-               map->map[i] = -1;
-
-       status = (eal_initialized) ?
-               cpu_core_map_compute_eal(map) :
-               cpu_core_map_compute_linux(map);
-
-       if (status) {
-               free(map);
-               return NULL;
-       }
-
-       status = cpu_core_map_compute_and_check(map);
-       if (status) {
-               free(map);
-               return NULL;
-       }
-
-       return map;
-}
-
-int
-cpu_core_map_compute_eal(struct cpu_core_map *map)
-{
-       uint32_t socket_id, core_id, ht_id;
-
-       /* Compute map */
-       for (socket_id = 0; socket_id < map->n_max_sockets; socket_id++) {
-               uint32_t n_detected, core_id_contig;
-               int lcore_id;
-
-               n_detected = 0;
-               for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
-                       struct lcore_config *p = &lcore_config[lcore_id];
-
-                       if ((p->detected) && (p->socket_id == socket_id))
-                               n_detected++;
-               }
-
-               core_id_contig = 0;
-
-               for (core_id = 0; n_detected ; core_id++) {
-                       ht_id = 0;
-
-                       for (lcore_id = 0;
-                               lcore_id < RTE_MAX_LCORE;
-                               lcore_id++) {
-                               struct lcore_config *p =
-                                       &lcore_config[lcore_id];
-
-                               if ((p->detected) &&
-                                       (p->socket_id == socket_id) &&
-                                       (p->core_id == core_id)) {
-                                       uint32_t pos = cpu_core_map_pos(map,
-                                               socket_id,
-                                               core_id_contig,
-                                               ht_id);
-
-                                       map->map[pos] = lcore_id;
-                                       ht_id++;
-                                       n_detected--;
-                               }
-                       }
-
-                       if (ht_id) {
-                               core_id_contig++;
-                               if (core_id_contig ==
-                                       map->n_max_cores_per_socket)
-                                       return -1;
-                       }
-               }
-       }
-
-       return 0;
-}
-
-int
-cpu_core_map_compute_and_check(struct cpu_core_map *map)
-{
-       uint32_t socket_id, core_id, ht_id;
-
-       /* Compute n_ht_per_core, n_cores_per_socket, n_sockets */
-       for (ht_id = 0; ht_id < map->n_max_ht_per_core; ht_id++) {
-               if (map->map[ht_id] == -1)
-                       break;
-
-               map->n_ht_per_core++;
-       }
-
-       if (map->n_ht_per_core == 0)
-               return -1;
-
-       for (core_id = 0; core_id < map->n_max_cores_per_socket; core_id++) {
-               uint32_t pos = core_id * map->n_max_ht_per_core;
-
-               if (map->map[pos] == -1)
-                       break;
-
-               map->n_cores_per_socket++;
-       }
-
-       if (map->n_cores_per_socket == 0)
-               return -1;
-
-       for (socket_id = 0; socket_id < map->n_max_sockets; socket_id++) {
-               uint32_t pos = socket_id * map->n_max_cores_per_socket *
-                       map->n_max_ht_per_core;
-
-               if (map->map[pos] == -1)
-                       break;
-
-               map->n_sockets++;
-       }
-
-       if (map->n_sockets == 0)
-               return -1;
-
-       /* Check that each socket has exactly the same number of cores
-       and that each core has exactly the same number of hyper-threads */
-       for (socket_id = 0; socket_id < map->n_sockets; socket_id++) {
-               for (core_id = 0; core_id < map->n_cores_per_socket; core_id++)
-                       for (ht_id = 0;
-                               ht_id < map->n_max_ht_per_core;
-                               ht_id++) {
-                               uint32_t pos = (socket_id *
-                                       map->n_max_cores_per_socket + core_id) *
-                                       map->n_max_ht_per_core + ht_id;
-
-                               if (((ht_id < map->n_ht_per_core) &&
-                                       (map->map[pos] == -1)) ||
-                                       ((ht_id >= map->n_ht_per_core) &&
-                                       (map->map[pos] != -1)))
-                                       return -1;
-                       }
-
-               for ( ; core_id < map->n_max_cores_per_socket; core_id++)
-                       for (ht_id = 0;
-                               ht_id < map->n_max_ht_per_core;
-                               ht_id++) {
-                               uint32_t pos = cpu_core_map_pos(map,
-                                       socket_id,
-                                       core_id,
-                                       ht_id);
-
-                               if (map->map[pos] != -1)
-                                       return -1;
-                       }
-       }
-
-       return 0;
-}
-
-#define FILE_LINUX_CPU_N_LCORES \
-       "/sys/devices/system/cpu/present"
-
-static int
-cpu_core_map_get_n_lcores_linux(void)
-{
-       char buffer[64], *string;
-       FILE *fd;
-
-       fd = fopen(FILE_LINUX_CPU_N_LCORES, "r");
-       if (fd == NULL)
-               return -1;
-
-       if (fgets(buffer, sizeof(buffer), fd) == NULL) {
-               fclose(fd);
-               return -1;
-       }
-
-       fclose(fd);
-
-       string = index(buffer, '-');
-       if (string == NULL)
-               return -1;
-
-       return atoi(++string) + 1;
-}
-
-#define FILE_LINUX_CPU_CORE_ID \
-       "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/core_id"
-
-static int
-cpu_core_map_get_core_id_linux(int lcore_id)
-{
-       char buffer[64];
-       FILE *fd;
-       int core_id;
-
-       snprintf(buffer, sizeof(buffer), FILE_LINUX_CPU_CORE_ID, lcore_id);
-       fd = fopen(buffer, "r");
-       if (fd == NULL)
-               return -1;
-
-       if (fgets(buffer, sizeof(buffer), fd) == NULL) {
-               fclose(fd);
-               return -1;
-       }
-
-       fclose(fd);
-
-       core_id = atoi(buffer);
-       return core_id;
-}
-
-#define FILE_LINUX_CPU_SOCKET_ID \
-       "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/physical_package_id"
-
-static int
-cpu_core_map_get_socket_id_linux(int lcore_id)
-{
-       char buffer[64];
-       FILE *fd;
-       int socket_id;
-
-       snprintf(buffer, sizeof(buffer), FILE_LINUX_CPU_SOCKET_ID, lcore_id);
-       fd = fopen(buffer, "r");
-       if (fd == NULL)
-               return -1;
-
-       if (fgets(buffer, sizeof(buffer), fd) == NULL) {
-               fclose(fd);
-               return -1;
-       }
-
-       fclose(fd);
-
-       socket_id = atoi(buffer);
-       return socket_id;
-}
-
-int
-cpu_core_map_compute_linux(struct cpu_core_map *map)
-{
-       uint32_t socket_id, core_id, ht_id;
-       int n_lcores;
-
-       n_lcores = cpu_core_map_get_n_lcores_linux();
-       if (n_lcores <= 0)
-               return -1;
-
-       /* Compute map */
-       for (socket_id = 0; socket_id < map->n_max_sockets; socket_id++) {
-               uint32_t n_detected, core_id_contig;
-               int lcore_id;
-
-               n_detected = 0;
-               for (lcore_id = 0; lcore_id < n_lcores; lcore_id++) {
-                       int lcore_socket_id =
-                               cpu_core_map_get_socket_id_linux(lcore_id);
-
-#if !defined(RTE_ARCH_PPC_64)
-                       if (lcore_socket_id < 0)
-                               return -1;
-#endif
-
-                       if (((uint32_t) lcore_socket_id) == socket_id)
-                               n_detected++;
-               }
-
-               core_id_contig = 0;
-
-               for (core_id = 0; n_detected ; core_id++) {
-                       ht_id = 0;
-
-                       for (lcore_id = 0; lcore_id < n_lcores; lcore_id++) {
-                               int lcore_socket_id =
-                                       cpu_core_map_get_socket_id_linux(
-                                       lcore_id);
-
-#if !defined(RTE_ARCH_PPC_64)
-                               if (lcore_socket_id < 0)
-                                       return -1;
-
-                               int lcore_core_id =
-                                       cpu_core_map_get_core_id_linux(
-                                               lcore_id);
-
-                               if (lcore_core_id < 0)
-                                       return -1;
-#endif
-
-#if !defined(RTE_ARCH_PPC_64)
-                               if (((uint32_t) lcore_socket_id == socket_id) &&
-                                       ((uint32_t) lcore_core_id == core_id)) {
-#else
-                               if (((uint32_t) lcore_socket_id == socket_id)) {
-#endif
-                                       uint32_t pos = cpu_core_map_pos(map,
-                                               socket_id,
-                                               core_id_contig,
-                                               ht_id);
-
-                                       map->map[pos] = lcore_id;
-                                       ht_id++;
-                                       n_detected--;
-                               }
-                       }
-
-                       if (ht_id) {
-                               core_id_contig++;
-                               if (core_id_contig ==
-                                       map->n_max_cores_per_socket)
-                                       return -1;
-                       }
-               }
-       }
-
-       return 0;
-}
-
-void
-cpu_core_map_print(struct cpu_core_map *map)
-{
-       uint32_t socket_id, core_id, ht_id;
-
-       if (map == NULL)
-               return;
-
-       for (socket_id = 0; socket_id < map->n_sockets; socket_id++) {
-               printf("Socket %" PRIu32 ":\n", socket_id);
-
-               for (core_id = 0;
-                       core_id < map->n_cores_per_socket;
-                       core_id++) {
-                       printf("[%" PRIu32 "] = [", core_id);
-
-                       for (ht_id = 0; ht_id < map->n_ht_per_core; ht_id++) {
-                               int lcore_id = cpu_core_map_get_lcore_id(map,
-                                       socket_id,
-                                       core_id,
-                                       ht_id);
-
-                               uint32_t core_id_noncontig =
-                                       cpu_core_map_get_core_id_linux(
-                                               lcore_id);
-
-                               printf(" %" PRId32 " (%" PRIu32 ") ",
-                                       lcore_id,
-                                       core_id_noncontig);
-                       }
-
-                       printf("]\n");
-               }
-       }
-}
-
-uint32_t
-cpu_core_map_get_n_sockets(struct cpu_core_map *map)
-{
-       if (map == NULL)
-               return 0;
-
-       return map->n_sockets;
-}
-
-uint32_t
-cpu_core_map_get_n_cores_per_socket(struct cpu_core_map *map)
-{
-       if (map == NULL)
-               return 0;
-
-       return map->n_cores_per_socket;
-}
-
-uint32_t
-cpu_core_map_get_n_ht_per_core(struct cpu_core_map *map)
-{
-       if (map == NULL)
-               return 0;
-
-       return map->n_ht_per_core;
-}
-
-int
-cpu_core_map_get_lcore_id(struct cpu_core_map *map,
-       uint32_t socket_id,
-       uint32_t core_id,
-       uint32_t ht_id)
-{
-       uint32_t pos;
-
-       if ((map == NULL) ||
-               (socket_id >= map->n_sockets) ||
-               (core_id >= map->n_cores_per_socket) ||
-               (ht_id >= map->n_ht_per_core))
-               return -1;
-
-       pos = cpu_core_map_pos(map, socket_id, core_id, ht_id);
-
-       return map->map[pos];
-}
-
-void
-cpu_core_map_free(struct cpu_core_map *map)
-{
-       free(map);
-}
diff --git a/examples/ip_pipeline/cpu_core_map.h b/examples/ip_pipeline/cpu_core_map.h
deleted file mode 100644 (file)
index 5e50f6e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-
-#ifndef __INCLUDE_CPU_CORE_MAP_H__
-#define __INCLUDE_CPU_CORE_MAP_H__
-
-#include <stdio.h>
-
-#include <rte_lcore.h>
-
-struct cpu_core_map;
-
-struct cpu_core_map *
-cpu_core_map_init(uint32_t n_max_sockets,
-       uint32_t n_max_cores_per_socket,
-       uint32_t n_max_ht_per_core,
-       uint32_t eal_initialized);
-
-uint32_t
-cpu_core_map_get_n_sockets(struct cpu_core_map *map);
-
-uint32_t
-cpu_core_map_get_n_cores_per_socket(struct cpu_core_map *map);
-
-uint32_t
-cpu_core_map_get_n_ht_per_core(struct cpu_core_map *map);
-
-int
-cpu_core_map_get_lcore_id(struct cpu_core_map *map,
-       uint32_t socket_id,
-       uint32_t core_id,
-       uint32_t ht_id);
-
-void cpu_core_map_print(struct cpu_core_map *map);
-
-void
-cpu_core_map_free(struct cpu_core_map *map);
-
-#endif
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
deleted file mode 100644 (file)
index 9430809..0000000
+++ /dev/null
@@ -1,1343 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2016 Intel Corporation
- */
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <netinet/in.h>
-#ifdef RTE_EXEC_ENV_LINUXAPP
-#include <linux/if.h>
-#include <linux/if_tun.h>
-#endif
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
-#include <rte_cycles.h>
-#include <rte_ethdev.h>
-#include <rte_ether.h>
-#include <rte_ip.h>
-#include <rte_eal.h>
-#include <rte_malloc.h>
-#include <rte_bus_pci.h>
-
-#include "app.h"
-#include "pipeline.h"
-
-#define APP_NAME_SIZE  32
-
-#define APP_RETA_SIZE_MAX     (ETH_RSS_RETA_SIZE_512 / RTE_RETA_GROUP_SIZE)
-
-static void
-app_init_core_map(struct app_params *app)
-{
-       APP_LOG(app, HIGH, "Initializing CPU core map ...");
-       app->core_map = cpu_core_map_init(RTE_MAX_NUMA_NODES, RTE_MAX_LCORE,
-                               4, 0);
-
-       if (app->core_map == NULL)
-               rte_panic("Cannot create CPU core map\n");
-
-       if (app->log_level >= APP_LOG_LEVEL_LOW)
-               cpu_core_map_print(app->core_map);
-}
-
-/* Core Mask String in Hex Representation */
-#define APP_CORE_MASK_STRING_SIZE ((64 * APP_CORE_MASK_SIZE) / 8 * 2 + 1)
-
-static void
-app_init_core_mask(struct app_params *app)
-{
-       uint32_t i;
-       char core_mask_str[APP_CORE_MASK_STRING_SIZE];
-
-       for (i = 0; i < app->n_pipelines; i++) {
-               struct app_pipeline_params *p = &app->pipeline_params[i];
-               int lcore_id;
-
-               lcore_id = cpu_core_map_get_lcore_id(app->core_map,
-                       p->socket_id,
-                       p->core_id,
-                       p->hyper_th_id);
-
-               if (lcore_id < 0)
-                       rte_panic("Cannot create CPU core mask\n");
-
-               app_core_enable_in_core_mask(app, lcore_id);
-       }
-
-       app_core_build_core_mask_string(app, core_mask_str);
-       APP_LOG(app, HIGH, "CPU core mask = 0x%s", core_mask_str);
-}
-
-static void
-app_init_eal(struct app_params *app)
-{
-       char buffer[256];
-       char core_mask_str[APP_CORE_MASK_STRING_SIZE];
-       struct app_eal_params *p = &app->eal_params;
-       uint32_t n_args = 0;
-       uint32_t i;
-       int status;
-
-       app->eal_argv[n_args++] = strdup(app->app_name);
-
-       app_core_build_core_mask_string(app, core_mask_str);
-       snprintf(buffer, sizeof(buffer), "-c%s", core_mask_str);
-       app->eal_argv[n_args++] = strdup(buffer);
-
-       if (p->coremap) {
-               snprintf(buffer, sizeof(buffer), "--lcores=%s", p->coremap);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->master_lcore_present) {
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--master-lcore=%" PRIu32,
-                       p->master_lcore);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       snprintf(buffer, sizeof(buffer), "-n%" PRIu32, p->channels);
-       app->eal_argv[n_args++] = strdup(buffer);
-
-       if (p->memory_present) {
-               snprintf(buffer, sizeof(buffer), "-m%" PRIu32, p->memory);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->ranks_present) {
-               snprintf(buffer, sizeof(buffer), "-r%" PRIu32, p->ranks);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       for (i = 0; i < APP_MAX_LINKS; i++) {
-               if (p->pci_blacklist[i] == NULL)
-                       break;
-
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--pci-blacklist=%s",
-                       p->pci_blacklist[i]);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (app->port_mask != 0)
-               for (i = 0; i < APP_MAX_LINKS; i++) {
-                       if (p->pci_whitelist[i] == NULL)
-                               break;
-
-                       snprintf(buffer,
-                               sizeof(buffer),
-                               "--pci-whitelist=%s",
-                               p->pci_whitelist[i]);
-                       app->eal_argv[n_args++] = strdup(buffer);
-               }
-       else
-               for (i = 0; i < app->n_links; i++) {
-                       char *pci_bdf = app->link_params[i].pci_bdf;
-
-                       snprintf(buffer,
-                               sizeof(buffer),
-                               "--pci-whitelist=%s",
-                               pci_bdf);
-                       app->eal_argv[n_args++] = strdup(buffer);
-               }
-
-       for (i = 0; i < APP_MAX_LINKS; i++) {
-               if (p->vdev[i] == NULL)
-                       break;
-
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--vdev=%s",
-                       p->vdev[i]);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if ((p->vmware_tsc_map_present) && p->vmware_tsc_map) {
-               snprintf(buffer, sizeof(buffer), "--vmware-tsc-map");
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->proc_type) {
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--proc-type=%s",
-                       p->proc_type);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->syslog) {
-               snprintf(buffer, sizeof(buffer), "--syslog=%s", p->syslog);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->log_level_present) {
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--log-level=%" PRIu32,
-                       p->log_level);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if ((p->version_present) && p->version) {
-               snprintf(buffer, sizeof(buffer), "-v");
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if ((p->help_present) && p->help) {
-               snprintf(buffer, sizeof(buffer), "--help");
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if ((p->no_huge_present) && p->no_huge) {
-               snprintf(buffer, sizeof(buffer), "--no-huge");
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if ((p->no_pci_present) && p->no_pci) {
-               snprintf(buffer, sizeof(buffer), "--no-pci");
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if ((p->no_hpet_present) && p->no_hpet) {
-               snprintf(buffer, sizeof(buffer), "--no-hpet");
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if ((p->no_shconf_present) && p->no_shconf) {
-               snprintf(buffer, sizeof(buffer), "--no-shconf");
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->add_driver) {
-               snprintf(buffer, sizeof(buffer), "-d%s", p->add_driver);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->socket_mem) {
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--socket-mem=%s",
-                       p->socket_mem);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->huge_dir) {
-               snprintf(buffer, sizeof(buffer), "--huge-dir=%s", p->huge_dir);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->file_prefix) {
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--file-prefix=%s",
-                       p->file_prefix);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->base_virtaddr) {
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--base-virtaddr=%s",
-                       p->base_virtaddr);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if ((p->create_uio_dev_present) && p->create_uio_dev) {
-               snprintf(buffer, sizeof(buffer), "--create-uio-dev");
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       if (p->vfio_intr) {
-               snprintf(buffer,
-                       sizeof(buffer),
-                       "--vfio-intr=%s",
-                       p->vfio_intr);
-               app->eal_argv[n_args++] = strdup(buffer);
-       }
-
-       snprintf(buffer, sizeof(buffer), "--");
-       app->eal_argv[n_args++] = strdup(buffer);
-
-       app->eal_argc = n_args;
-
-       APP_LOG(app, HIGH, "Initializing EAL ...");
-       if (app->log_level >= APP_LOG_LEVEL_LOW) {
-               int i;
-
-               fprintf(stdout, "[APP] EAL arguments: \"");
-               for (i = 1; i < app->eal_argc; i++)
-                       fprintf(stdout, "%s ", app->eal_argv[i]);
-               fprintf(stdout, "\"\n");
-       }
-
-       status = rte_eal_init(app->eal_argc, app->eal_argv);
-       if (status < 0)
-               rte_panic("EAL init error\n");
-}
-
-static void
-app_init_mempool(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_mempools; i++) {
-               struct app_mempool_params *p = &app->mempool_params[i];
-
-               APP_LOG(app, HIGH, "Initializing %s ...", p->name);
-               app->mempool[i] = rte_pktmbuf_pool_create(
-                       p->name,
-                       p->pool_size,
-                       p->cache_size,
-                       0, /* priv_size */
-                       p->buffer_size -
-                               sizeof(struct rte_mbuf), /* mbuf data size */
-                       p->cpu_socket_id);
-
-               if (app->mempool[i] == NULL)
-                       rte_panic("%s init error\n", p->name);
-       }
-}
-
-static inline int
-app_link_filter_arp_add(struct app_link_params *link)
-{
-       struct rte_eth_ethertype_filter filter = {
-               .ether_type = ETHER_TYPE_ARP,
-               .flags = 0,
-               .queue = link->arp_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(link->pmd_id,
-               RTE_ETH_FILTER_ETHERTYPE,
-               RTE_ETH_FILTER_ADD,
-               &filter);
-}
-
-static inline int
-app_link_filter_tcp_syn_add(struct app_link_params *link)
-{
-       struct rte_eth_syn_filter filter = {
-               .hig_pri = 1,
-               .queue = link->tcp_syn_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(link->pmd_id,
-               RTE_ETH_FILTER_SYN,
-               RTE_ETH_FILTER_ADD,
-               &filter);
-}
-
-static inline int
-app_link_filter_ip_add(struct app_link_params *l1, struct app_link_params *l2)
-{
-       struct rte_eth_ntuple_filter filter = {
-               .flags = RTE_5TUPLE_FLAGS,
-               .dst_ip = rte_bswap32(l2->ip),
-               .dst_ip_mask = UINT32_MAX, /* Enable */
-               .src_ip = 0,
-               .src_ip_mask = 0, /* Disable */
-               .dst_port = 0,
-               .dst_port_mask = 0, /* Disable */
-               .src_port = 0,
-               .src_port_mask = 0, /* Disable */
-               .proto = 0,
-               .proto_mask = 0, /* Disable */
-               .tcp_flags = 0,
-               .priority = 1, /* Lowest */
-               .queue = l1->ip_local_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(l1->pmd_id,
-               RTE_ETH_FILTER_NTUPLE,
-               RTE_ETH_FILTER_ADD,
-               &filter);
-}
-
-static inline int
-app_link_filter_ip_del(struct app_link_params *l1, struct app_link_params *l2)
-{
-       struct rte_eth_ntuple_filter filter = {
-               .flags = RTE_5TUPLE_FLAGS,
-               .dst_ip = rte_bswap32(l2->ip),
-               .dst_ip_mask = UINT32_MAX, /* Enable */
-               .src_ip = 0,
-               .src_ip_mask = 0, /* Disable */
-               .dst_port = 0,
-               .dst_port_mask = 0, /* Disable */
-               .src_port = 0,
-               .src_port_mask = 0, /* Disable */
-               .proto = 0,
-               .proto_mask = 0, /* Disable */
-               .tcp_flags = 0,
-               .priority = 1, /* Lowest */
-               .queue = l1->ip_local_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(l1->pmd_id,
-               RTE_ETH_FILTER_NTUPLE,
-               RTE_ETH_FILTER_DELETE,
-               &filter);
-}
-
-static inline int
-app_link_filter_tcp_add(struct app_link_params *l1, struct app_link_params *l2)
-{
-       struct rte_eth_ntuple_filter filter = {
-               .flags = RTE_5TUPLE_FLAGS,
-               .dst_ip = rte_bswap32(l2->ip),
-               .dst_ip_mask = UINT32_MAX, /* Enable */
-               .src_ip = 0,
-               .src_ip_mask = 0, /* Disable */
-               .dst_port = 0,
-               .dst_port_mask = 0, /* Disable */
-               .src_port = 0,
-               .src_port_mask = 0, /* Disable */
-               .proto = IPPROTO_TCP,
-               .proto_mask = UINT8_MAX, /* Enable */
-               .tcp_flags = 0,
-               .priority = 2, /* Higher priority than IP */
-               .queue = l1->tcp_local_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(l1->pmd_id,
-               RTE_ETH_FILTER_NTUPLE,
-               RTE_ETH_FILTER_ADD,
-               &filter);
-}
-
-static inline int
-app_link_filter_tcp_del(struct app_link_params *l1, struct app_link_params *l2)
-{
-       struct rte_eth_ntuple_filter filter = {
-               .flags = RTE_5TUPLE_FLAGS,
-               .dst_ip = rte_bswap32(l2->ip),
-               .dst_ip_mask = UINT32_MAX, /* Enable */
-               .src_ip = 0,
-               .src_ip_mask = 0, /* Disable */
-               .dst_port = 0,
-               .dst_port_mask = 0, /* Disable */
-               .src_port = 0,
-               .src_port_mask = 0, /* Disable */
-               .proto = IPPROTO_TCP,
-               .proto_mask = UINT8_MAX, /* Enable */
-               .tcp_flags = 0,
-               .priority = 2, /* Higher priority than IP */
-               .queue = l1->tcp_local_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(l1->pmd_id,
-               RTE_ETH_FILTER_NTUPLE,
-               RTE_ETH_FILTER_DELETE,
-               &filter);
-}
-
-static inline int
-app_link_filter_udp_add(struct app_link_params *l1, struct app_link_params *l2)
-{
-       struct rte_eth_ntuple_filter filter = {
-               .flags = RTE_5TUPLE_FLAGS,
-               .dst_ip = rte_bswap32(l2->ip),
-               .dst_ip_mask = UINT32_MAX, /* Enable */
-               .src_ip = 0,
-               .src_ip_mask = 0, /* Disable */
-               .dst_port = 0,
-               .dst_port_mask = 0, /* Disable */
-               .src_port = 0,
-               .src_port_mask = 0, /* Disable */
-               .proto = IPPROTO_UDP,
-               .proto_mask = UINT8_MAX, /* Enable */
-               .tcp_flags = 0,
-               .priority = 2, /* Higher priority than IP */
-               .queue = l1->udp_local_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(l1->pmd_id,
-               RTE_ETH_FILTER_NTUPLE,
-               RTE_ETH_FILTER_ADD,
-               &filter);
-}
-
-static inline int
-app_link_filter_udp_del(struct app_link_params *l1, struct app_link_params *l2)
-{
-       struct rte_eth_ntuple_filter filter = {
-               .flags = RTE_5TUPLE_FLAGS,
-               .dst_ip = rte_bswap32(l2->ip),
-               .dst_ip_mask = UINT32_MAX, /* Enable */
-               .src_ip = 0,
-               .src_ip_mask = 0, /* Disable */
-               .dst_port = 0,
-               .dst_port_mask = 0, /* Disable */
-               .src_port = 0,
-               .src_port_mask = 0, /* Disable */
-               .proto = IPPROTO_UDP,
-               .proto_mask = UINT8_MAX, /* Enable */
-               .tcp_flags = 0,
-               .priority = 2, /* Higher priority than IP */
-               .queue = l1->udp_local_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(l1->pmd_id,
-               RTE_ETH_FILTER_NTUPLE,
-               RTE_ETH_FILTER_DELETE,
-               &filter);
-}
-
-static inline int
-app_link_filter_sctp_add(struct app_link_params *l1, struct app_link_params *l2)
-{
-       struct rte_eth_ntuple_filter filter = {
-               .flags = RTE_5TUPLE_FLAGS,
-               .dst_ip = rte_bswap32(l2->ip),
-               .dst_ip_mask = UINT32_MAX, /* Enable */
-               .src_ip = 0,
-               .src_ip_mask = 0, /* Disable */
-               .dst_port = 0,
-               .dst_port_mask = 0, /* Disable */
-               .src_port = 0,
-               .src_port_mask = 0, /* Disable */
-               .proto = IPPROTO_SCTP,
-               .proto_mask = UINT8_MAX, /* Enable */
-               .tcp_flags = 0,
-               .priority = 2, /* Higher priority than IP */
-               .queue = l1->sctp_local_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(l1->pmd_id,
-               RTE_ETH_FILTER_NTUPLE,
-               RTE_ETH_FILTER_ADD,
-               &filter);
-}
-
-static inline int
-app_link_filter_sctp_del(struct app_link_params *l1, struct app_link_params *l2)
-{
-       struct rte_eth_ntuple_filter filter = {
-               .flags = RTE_5TUPLE_FLAGS,
-               .dst_ip = rte_bswap32(l2->ip),
-               .dst_ip_mask = UINT32_MAX, /* Enable */
-               .src_ip = 0,
-               .src_ip_mask = 0, /* Disable */
-               .dst_port = 0,
-               .dst_port_mask = 0, /* Disable */
-               .src_port = 0,
-               .src_port_mask = 0, /* Disable */
-               .proto = IPPROTO_SCTP,
-               .proto_mask = UINT8_MAX, /* Enable */
-               .tcp_flags = 0,
-               .priority = 2, /* Higher priority than IP */
-               .queue = l1->sctp_local_q,
-       };
-
-       return rte_eth_dev_filter_ctrl(l1->pmd_id,
-               RTE_ETH_FILTER_NTUPLE,
-               RTE_ETH_FILTER_DELETE,
-               &filter);
-}
-
-static void
-app_link_set_arp_filter(struct app_params *app, struct app_link_params *cp)
-{
-       if (cp->arp_q != 0) {
-               int status = app_link_filter_arp_add(cp);
-
-               APP_LOG(app, LOW, "%s (%" PRIu32 "): "
-                       "Adding ARP filter (queue = %" PRIu32 ")",
-                       cp->name, cp->pmd_id, cp->arp_q);
-
-               if (status)
-                       rte_panic("%s (%" PRIu32 "): "
-                               "Error adding ARP filter "
-                               "(queue = %" PRIu32 ") (%" PRId32 ")\n",
-                               cp->name, cp->pmd_id, cp->arp_q, status);
-       }
-}
-
-static void
-app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
-{
-       if (cp->tcp_syn_q != 0) {
-               int status = app_link_filter_tcp_syn_add(cp);
-
-               APP_LOG(app, LOW, "%s (%" PRIu32 "): "
-                       "Adding TCP SYN filter (queue = %" PRIu32 ")",
-                       cp->name, cp->pmd_id, cp->tcp_syn_q);
-
-               if (status)
-                       rte_panic("%s (%" PRIu32 "): "
-                               "Error adding TCP SYN filter "
-                               "(queue = %" PRIu32 ") (%" PRId32 ")\n",
-                               cp->name, cp->pmd_id, cp->tcp_syn_q,
-                               status);
-       }
-}
-
-void
-app_link_up_internal(struct app_params *app, struct app_link_params *cp)
-{
-       uint32_t i;
-       int status;
-
-       /* For each link, add filters for IP of current link */
-       if (cp->ip != 0) {
-               for (i = 0; i < app->n_links; i++) {
-                       struct app_link_params *p = &app->link_params[i];
-
-                       /* IP */
-                       if (p->ip_local_q != 0) {
-                               int status = app_link_filter_ip_add(p, cp);
-
-                               APP_LOG(app, LOW, "%s (%" PRIu32 "): "
-                                       "Adding IP filter (queue= %" PRIu32
-                                       ", IP = 0x%08" PRIx32 ")",
-                                       p->name, p->pmd_id, p->ip_local_q,
-                                       cp->ip);
-
-                               if (status)
-                                       rte_panic("%s (%" PRIu32 "): "
-                                               "Error adding IP "
-                                               "filter (queue= %" PRIu32 ", "
-                                               "IP = 0x%08" PRIx32
-                                               ") (%" PRId32 ")\n",
-                                               p->name, p->pmd_id,
-                                               p->ip_local_q, cp->ip, status);
-                       }
-
-                       /* TCP */
-                       if (p->tcp_local_q != 0) {
-                               int status = app_link_filter_tcp_add(p, cp);
-
-                               APP_LOG(app, LOW, "%s (%" PRIu32 "): "
-                                       "Adding TCP filter "
-                                       "(queue = %" PRIu32
-                                       ", IP = 0x%08" PRIx32 ")",
-                                       p->name, p->pmd_id, p->tcp_local_q,
-                                       cp->ip);
-
-                               if (status)
-                                       rte_panic("%s (%" PRIu32 "): "
-                                               "Error adding TCP "
-                                               "filter (queue = %" PRIu32 ", "
-                                               "IP = 0x%08" PRIx32
-                                               ") (%" PRId32 ")\n",
-                                               p->name, p->pmd_id,
-                                               p->tcp_local_q, cp->ip, status);
-                       }
-
-                       /* UDP */
-                       if (p->udp_local_q != 0) {
-                               int status = app_link_filter_udp_add(p, cp);
-
-                               APP_LOG(app, LOW, "%s (%" PRIu32 "): "
-                                       "Adding UDP filter "
-                                       "(queue = %" PRIu32
-                                       ", IP = 0x%08" PRIx32 ")",
-                                       p->name, p->pmd_id, p->udp_local_q,
-                                       cp->ip);
-
-                               if (status)
-                                       rte_panic("%s (%" PRIu32 "): "
-                                               "Error adding UDP "
-                                               "filter (queue = %" PRIu32 ", "
-                                               "IP = 0x%08" PRIx32
-                                               ") (%" PRId32 ")\n",
-                                               p->name, p->pmd_id,
-                                               p->udp_local_q, cp->ip, status);
-                       }
-
-                       /* SCTP */
-                       if (p->sctp_local_q != 0) {
-                               int status = app_link_filter_sctp_add(p, cp);
-
-                               APP_LOG(app, LOW, "%s (%" PRIu32
-                                       "): Adding SCTP filter "
-                                       "(queue = %" PRIu32
-                                       ", IP = 0x%08" PRIx32 ")",
-                                       p->name, p->pmd_id, p->sctp_local_q,
-                                       cp->ip);
-
-                               if (status)
-                                       rte_panic("%s (%" PRIu32 "): "
-                                               "Error adding SCTP "
-                                               "filter (queue = %" PRIu32 ", "
-                                               "IP = 0x%08" PRIx32
-                                               ") (%" PRId32 ")\n",
-                                               p->name, p->pmd_id,
-                                               p->sctp_local_q, cp->ip,
-                                               status);
-                       }
-               }
-       }
-
-       /* PMD link up */
-       status = rte_eth_dev_set_link_up(cp->pmd_id);
-       /* Do not panic if PMD does not provide link up functionality */
-       if (status < 0 && status != -ENOTSUP)
-               rte_panic("%s (%" PRIu32 "): PMD set link up error %"
-                       PRId32 "\n", cp->name, cp->pmd_id, status);
-
-       /* Mark link as UP */
-       cp->state = 1;
-}
-
-void
-app_link_down_internal(struct app_params *app, struct app_link_params *cp)
-{
-       uint32_t i;
-       int status;
-
-       /* PMD link down */
-       status = rte_eth_dev_set_link_down(cp->pmd_id);
-       /* Do not panic if PMD does not provide link down functionality */
-       if (status < 0 && status != -ENOTSUP)
-               rte_panic("%s (%" PRIu32 "): PMD set link down error %"
-                       PRId32 "\n", cp->name, cp->pmd_id, status);
-
-       /* Mark link as DOWN */
-       cp->state = 0;
-
-       /* Return if current link IP is not valid */
-       if (cp->ip == 0)
-               return;
-
-       /* For each link, remove filters for IP of current link */
-       for (i = 0; i < app->n_links; i++) {
-               struct app_link_params *p = &app->link_params[i];
-
-               /* IP */
-               if (p->ip_local_q != 0) {
-                       int status = app_link_filter_ip_del(p, cp);
-
-                       APP_LOG(app, LOW, "%s (%" PRIu32
-                               "): Deleting IP filter "
-                               "(queue = %" PRIu32 ", IP = 0x%" PRIx32 ")",
-                               p->name, p->pmd_id, p->ip_local_q, cp->ip);
-
-                       if (status)
-                               rte_panic("%s (%" PRIu32
-                                       "): Error deleting IP filter "
-                                       "(queue = %" PRIu32
-                                       ", IP = 0x%" PRIx32
-                                       ") (%" PRId32 ")\n",
-                                       p->name, p->pmd_id, p->ip_local_q,
-                                       cp->ip, status);
-               }
-
-               /* TCP */
-               if (p->tcp_local_q != 0) {
-                       int status = app_link_filter_tcp_del(p, cp);
-
-                       APP_LOG(app, LOW, "%s (%" PRIu32
-                               "): Deleting TCP filter "
-                               "(queue = %" PRIu32
-                               ", IP = 0x%" PRIx32 ")",
-                               p->name, p->pmd_id, p->tcp_local_q, cp->ip);
-
-                       if (status)
-                               rte_panic("%s (%" PRIu32
-                                       "): Error deleting TCP filter "
-                                       "(queue = %" PRIu32
-                                       ", IP = 0x%" PRIx32
-                                       ") (%" PRId32 ")\n",
-                                       p->name, p->pmd_id, p->tcp_local_q,
-                                       cp->ip, status);
-               }
-
-               /* UDP */
-               if (p->udp_local_q != 0) {
-                       int status = app_link_filter_udp_del(p, cp);
-
-                       APP_LOG(app, LOW, "%s (%" PRIu32
-                               "): Deleting UDP filter "
-                               "(queue = %" PRIu32 ", IP = 0x%" PRIx32 ")",
-                               p->name, p->pmd_id, p->udp_local_q, cp->ip);
-
-                       if (status)
-                               rte_panic("%s (%" PRIu32
-                                       "): Error deleting UDP filter "
-                                       "(queue = %" PRIu32
-                                       ", IP = 0x%" PRIx32
-                                       ") (%" PRId32 ")\n",
-                                       p->name, p->pmd_id, p->udp_local_q,
-                                       cp->ip, status);
-               }
-
-               /* SCTP */
-               if (p->sctp_local_q != 0) {
-                       int status = app_link_filter_sctp_del(p, cp);
-
-                       APP_LOG(app, LOW, "%s (%" PRIu32
-                               "): Deleting SCTP filter "
-                               "(queue = %" PRIu32
-                               ", IP = 0x%" PRIx32 ")",
-                               p->name, p->pmd_id, p->sctp_local_q, cp->ip);
-
-                       if (status)
-                               rte_panic("%s (%" PRIu32
-                                       "): Error deleting SCTP filter "
-                                       "(queue = %" PRIu32
-                                       ", IP = 0x%" PRIx32
-                                       ") (%" PRId32 ")\n",
-                                       p->name, p->pmd_id, p->sctp_local_q,
-                                       cp->ip, status);
-               }
-       }
-}
-
-static void
-app_check_link(struct app_params *app)
-{
-       uint32_t all_links_up, i;
-
-       all_links_up = 1;
-
-       for (i = 0; i < app->n_links; i++) {
-               struct app_link_params *p = &app->link_params[i];
-               struct rte_eth_link link_params;
-
-               memset(&link_params, 0, sizeof(link_params));
-               rte_eth_link_get(p->pmd_id, &link_params);
-
-               APP_LOG(app, HIGH, "%s (%" PRIu32 ") (%" PRIu32 " Gbps) %s",
-                       p->name,
-                       p->pmd_id,
-                       link_params.link_speed / 1000,
-                       link_params.link_status ? "UP" : "DOWN");
-
-               if (link_params.link_status == ETH_LINK_DOWN)
-                       all_links_up = 0;
-       }
-
-       if (all_links_up == 0)
-               rte_panic("Some links are DOWN\n");
-}
-
-static uint32_t
-is_any_swq_frag_or_ras(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_swq; i++) {
-               struct app_pktq_swq_params *p = &app->swq_params[i];
-
-               if ((p->ipv4_frag == 1) || (p->ipv6_frag == 1) ||
-                       (p->ipv4_ras == 1) || (p->ipv6_ras == 1))
-                       return 1;
-       }
-
-       return 0;
-}
-
-static void
-app_init_link_frag_ras(struct app_params *app)
-{
-       uint32_t i;
-
-       if (is_any_swq_frag_or_ras(app)) {
-               for (i = 0; i < app->n_links; i++) {
-                       struct app_link_params *p_link = &app->link_params[i];
-                               p_link->conf.txmode.offloads |=
-                                               DEV_TX_OFFLOAD_MULTI_SEGS;
-               }
-       }
-}
-
-static inline int
-app_get_cpu_socket_id(uint32_t pmd_id)
-{
-       int status = rte_eth_dev_socket_id(pmd_id);
-
-       return (status != SOCKET_ID_ANY) ? status : 0;
-}
-
-static inline int
-app_link_rss_enabled(struct app_link_params *cp)
-{
-       return (cp->n_rss_qs) ? 1 : 0;
-}
-
-static void
-app_link_rss_setup(struct app_link_params *cp)
-{
-       struct rte_eth_dev_info dev_info;
-       struct rte_eth_rss_reta_entry64 reta_conf[APP_RETA_SIZE_MAX];
-       uint32_t i;
-       int status;
-
-    /* Get RETA size */
-       memset(&dev_info, 0, sizeof(dev_info));
-       rte_eth_dev_info_get(cp->pmd_id, &dev_info);
-
-       if (dev_info.reta_size == 0)
-               rte_panic("%s (%u): RSS setup error (null RETA size)\n",
-                       cp->name, cp->pmd_id);
-
-       if (dev_info.reta_size > ETH_RSS_RETA_SIZE_512)
-               rte_panic("%s (%u): RSS setup error (RETA size too big)\n",
-                       cp->name, cp->pmd_id);
-
-       /* Setup RETA contents */
-       memset(reta_conf, 0, sizeof(reta_conf));
-
-       for (i = 0; i < dev_info.reta_size; i++)
-               reta_conf[i / RTE_RETA_GROUP_SIZE].mask = UINT64_MAX;
-
-       for (i = 0; i < dev_info.reta_size; i++) {
-               uint32_t reta_id = i / RTE_RETA_GROUP_SIZE;
-               uint32_t reta_pos = i % RTE_RETA_GROUP_SIZE;
-               uint32_t rss_qs_pos = i % cp->n_rss_qs;
-
-               reta_conf[reta_id].reta[reta_pos] =
-                       (uint16_t) cp->rss_qs[rss_qs_pos];
-       }
-
-       /* RETA update */
-       status = rte_eth_dev_rss_reta_update(cp->pmd_id,
-               reta_conf,
-               dev_info.reta_size);
-       if (status != 0)
-               rte_panic("%s (%u): RSS setup error (RETA update failed)\n",
-                       cp->name, cp->pmd_id);
-}
-
-static void
-app_init_link_set_config(struct app_link_params *p)
-{
-       if (p->n_rss_qs) {
-               p->conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
-               p->conf.rx_adv_conf.rss_conf.rss_hf = p->rss_proto_ipv4 |
-                       p->rss_proto_ipv6 |
-                       p->rss_proto_l2;
-       }
-}
-
-static void
-app_init_link(struct app_params *app)
-{
-       uint32_t i;
-
-       app_init_link_frag_ras(app);
-
-       for (i = 0; i < app->n_links; i++) {
-               struct app_link_params *p_link = &app->link_params[i];
-               struct rte_eth_dev_info dev_info;
-               uint32_t link_id, n_hwq_in, n_hwq_out, j;
-               int status;
-
-               sscanf(p_link->name, "LINK%" PRIu32, &link_id);
-               n_hwq_in = app_link_get_n_rxq(app, p_link);
-               n_hwq_out = app_link_get_n_txq(app, p_link);
-               app_init_link_set_config(p_link);
-
-               APP_LOG(app, HIGH, "Initializing %s (%" PRIu32") "
-                       "(%" PRIu32 " RXQ, %" PRIu32 " TXQ) ...",
-                       p_link->name,
-                       p_link->pmd_id,
-                       n_hwq_in,
-                       n_hwq_out);
-
-               /* LINK */
-               rte_eth_dev_info_get(p_link->pmd_id, &dev_info);
-               if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
-                       p_link->conf.txmode.offloads |=
-                               DEV_TX_OFFLOAD_MBUF_FAST_FREE;
-               status = rte_eth_dev_configure(
-                       p_link->pmd_id,
-                       n_hwq_in,
-                       n_hwq_out,
-                       &p_link->conf);
-               if (status < 0)
-                       rte_panic("%s (%" PRId32 "): "
-                               "init error (%" PRId32 ")\n",
-                               p_link->name, p_link->pmd_id, status);
-
-               rte_eth_macaddr_get(p_link->pmd_id,
-                       (struct ether_addr *) &p_link->mac_addr);
-
-               if (p_link->promisc)
-                       rte_eth_promiscuous_enable(p_link->pmd_id);
-
-               /* RXQ */
-               for (j = 0; j < app->n_pktq_hwq_in; j++) {
-                       struct app_pktq_hwq_in_params *p_rxq =
-                               &app->hwq_in_params[j];
-                       uint32_t rxq_link_id, rxq_queue_id;
-                       uint16_t nb_rxd = p_rxq->size;
-
-                       sscanf(p_rxq->name, "RXQ%" PRIu32 ".%" PRIu32,
-                               &rxq_link_id, &rxq_queue_id);
-                       if (rxq_link_id != link_id)
-                               continue;
-
-                       status = rte_eth_dev_adjust_nb_rx_tx_desc(
-                               p_link->pmd_id,
-                               &nb_rxd,
-                               NULL);
-                       if (status < 0)
-                               rte_panic("%s (%" PRIu32 "): "
-                                       "%s adjust number of Rx descriptors "
-                                       "error (%" PRId32 ")\n",
-                                       p_link->name,
-                                       p_link->pmd_id,
-                                       p_rxq->name,
-                                       status);
-
-                       p_rxq->conf.offloads = p_link->conf.rxmode.offloads;
-                       status = rte_eth_rx_queue_setup(
-                               p_link->pmd_id,
-                               rxq_queue_id,
-                               nb_rxd,
-                               app_get_cpu_socket_id(p_link->pmd_id),
-                               &p_rxq->conf,
-                               app->mempool[p_rxq->mempool_id]);
-                       if (status < 0)
-                               rte_panic("%s (%" PRIu32 "): "
-                                       "%s init error (%" PRId32 ")\n",
-                                       p_link->name,
-                                       p_link->pmd_id,
-                                       p_rxq->name,
-                                       status);
-               }
-
-               /* TXQ */
-               for (j = 0; j < app->n_pktq_hwq_out; j++) {
-                       struct app_pktq_hwq_out_params *p_txq =
-                               &app->hwq_out_params[j];
-                       uint32_t txq_link_id, txq_queue_id;
-                       uint16_t nb_txd = p_txq->size;
-
-                       sscanf(p_txq->name, "TXQ%" PRIu32 ".%" PRIu32,
-                               &txq_link_id, &txq_queue_id);
-                       if (txq_link_id != link_id)
-                               continue;
-
-                       status = rte_eth_dev_adjust_nb_rx_tx_desc(
-                               p_link->pmd_id,
-                               NULL,
-                               &nb_txd);
-                       if (status < 0)
-                               rte_panic("%s (%" PRIu32 "): "
-                                       "%s adjust number of Tx descriptors "
-                                       "error (%" PRId32 ")\n",
-                                       p_link->name,
-                                       p_link->pmd_id,
-                                       p_txq->name,
-                                       status);
-
-                       p_txq->conf.offloads = p_link->conf.txmode.offloads;
-                       status = rte_eth_tx_queue_setup(
-                               p_link->pmd_id,
-                               txq_queue_id,
-                               nb_txd,
-                               app_get_cpu_socket_id(p_link->pmd_id),
-                               &p_txq->conf);
-                       if (status < 0)
-                               rte_panic("%s (%" PRIu32 "): "
-                                       "%s init error (%" PRId32 ")\n",
-                                       p_link->name,
-                                       p_link->pmd_id,
-                                       p_txq->name,
-                                       status);
-               }
-
-               /* LINK START */
-               status = rte_eth_dev_start(p_link->pmd_id);
-               if (status < 0)
-                       rte_panic("Cannot start %s (error %" PRId32 ")\n",
-                               p_link->name, status);
-
-               /* LINK FILTERS */
-               app_link_set_arp_filter(app, p_link);
-               app_link_set_tcp_syn_filter(app, p_link);
-               if (app_link_rss_enabled(p_link))
-                       app_link_rss_setup(p_link);
-
-               /* LINK UP */
-               app_link_up_internal(app, p_link);
-       }
-
-       app_check_link(app);
-}
-
-static void
-app_init_swq(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_swq; i++) {
-               struct app_pktq_swq_params *p = &app->swq_params[i];
-               unsigned flags = 0;
-
-               if (app_swq_get_readers(app, p) == 1)
-                       flags |= RING_F_SC_DEQ;
-               if (app_swq_get_writers(app, p) == 1)
-                       flags |= RING_F_SP_ENQ;
-
-               APP_LOG(app, HIGH, "Initializing %s...", p->name);
-               app->swq[i] = rte_ring_create(
-                               p->name,
-                               p->size,
-                               p->cpu_socket_id,
-                               flags);
-
-               if (app->swq[i] == NULL)
-                       rte_panic("%s init error\n", p->name);
-       }
-}
-
-static void
-app_init_tm(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_tm; i++) {
-               struct app_pktq_tm_params *p_tm = &app->tm_params[i];
-               struct app_link_params *p_link;
-               struct rte_eth_link link_eth_params;
-               struct rte_sched_port *sched;
-               uint32_t n_subports, subport_id;
-               int status;
-
-               p_link = app_get_link_for_tm(app, p_tm);
-               /* LINK */
-               rte_eth_link_get(p_link->pmd_id, &link_eth_params);
-
-               /* TM */
-               p_tm->sched_port_params.name = p_tm->name;
-               p_tm->sched_port_params.socket =
-                       app_get_cpu_socket_id(p_link->pmd_id);
-               p_tm->sched_port_params.rate =
-                       (uint64_t) link_eth_params.link_speed * 1000 * 1000 / 8;
-
-               APP_LOG(app, HIGH, "Initializing %s ...", p_tm->name);
-               sched = rte_sched_port_config(&p_tm->sched_port_params);
-               if (sched == NULL)
-                       rte_panic("%s init error\n", p_tm->name);
-               app->tm[i] = sched;
-
-               /* Subport */
-               n_subports = p_tm->sched_port_params.n_subports_per_port;
-               for (subport_id = 0; subport_id < n_subports; subport_id++) {
-                       uint32_t n_pipes_per_subport, pipe_id;
-
-                       status = rte_sched_subport_config(sched,
-                               subport_id,
-                               &p_tm->sched_subport_params[subport_id]);
-                       if (status)
-                               rte_panic("%s subport %" PRIu32
-                                       " init error (%" PRId32 ")\n",
-                                       p_tm->name, subport_id, status);
-
-                       /* Pipe */
-                       n_pipes_per_subport =
-                               p_tm->sched_port_params.n_pipes_per_subport;
-                       for (pipe_id = 0;
-                               pipe_id < n_pipes_per_subport;
-                               pipe_id++) {
-                               int profile_id = p_tm->sched_pipe_to_profile[
-                                       subport_id * APP_MAX_SCHED_PIPES +
-                                       pipe_id];
-
-                               if (profile_id == -1)
-                                       continue;
-
-                               status = rte_sched_pipe_config(sched,
-                                       subport_id,
-                                       pipe_id,
-                                       profile_id);
-                               if (status)
-                                       rte_panic("%s subport %" PRIu32
-                                               " pipe %" PRIu32
-                                               " (profile %" PRId32 ") "
-                                               "init error (% " PRId32 ")\n",
-                                               p_tm->name, subport_id, pipe_id,
-                                               profile_id, status);
-                       }
-               }
-       }
-}
-
-#ifndef RTE_EXEC_ENV_LINUXAPP
-static void
-app_init_tap(struct app_params *app) {
-       if (app->n_pktq_tap == 0)
-               return;
-
-       rte_panic("TAP device not supported.\n");
-}
-#else
-static void
-app_init_tap(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_pktq_tap; i++) {
-               struct app_pktq_tap_params *p_tap = &app->tap_params[i];
-               struct ifreq ifr;
-               int fd, status;
-
-               APP_LOG(app, HIGH, "Initializing %s ...", p_tap->name);
-
-               fd = open("/dev/net/tun", O_RDWR | O_NONBLOCK);
-               if (fd < 0)
-                       rte_panic("Cannot open file /dev/net/tun\n");
-
-               memset(&ifr, 0, sizeof(ifr));
-               ifr.ifr_flags = IFF_TAP | IFF_NO_PI; /* No packet information */
-               snprintf(ifr.ifr_name, IFNAMSIZ, "%s", p_tap->name);
-
-               status = ioctl(fd, TUNSETIFF, (void *) &ifr);
-               if (status < 0)
-                       rte_panic("TAP setup error\n");
-
-               app->tap[i] = fd;
-       }
-}
-#endif
-
-#ifdef RTE_LIBRTE_KNI
-static int
-kni_config_network_interface(uint16_t port_id, uint8_t if_up) {
-       int ret = 0;
-
-       if (port_id >= rte_eth_dev_count())
-               return -EINVAL;
-
-       ret = (if_up) ?
-               rte_eth_dev_set_link_up(port_id) :
-               rte_eth_dev_set_link_down(port_id);
-
-       return ret;
-}
-
-static int
-kni_change_mtu(uint16_t port_id, unsigned int new_mtu) {
-       int ret;
-
-       if (port_id >= rte_eth_dev_count())
-               return -EINVAL;
-
-       if (new_mtu > ETHER_MAX_LEN)
-               return -EINVAL;
-
-       /* Set new MTU */
-       ret = rte_eth_dev_set_mtu(port_id, new_mtu);
-       if (ret < 0)
-               return ret;
-
-       return 0;
-}
-#endif /* RTE_LIBRTE_KNI */
-
-#ifndef RTE_LIBRTE_KNI
-static void
-app_init_kni(struct app_params *app) {
-       if (app->n_pktq_kni == 0)
-               return;
-
-       rte_panic("Can not init KNI without librte_kni support.\n");
-}
-#else
-static void
-app_init_kni(struct app_params *app) {
-       uint32_t i;
-
-       if (app->n_pktq_kni == 0)
-               return;
-
-       rte_kni_init(app->n_pktq_kni);
-
-       for (i = 0; i < app->n_pktq_kni; i++) {
-               struct app_pktq_kni_params *p_kni = &app->kni_params[i];
-               struct app_link_params *p_link;
-               struct rte_eth_dev_info dev_info;
-               struct app_mempool_params *mempool_params;
-               struct rte_mempool *mempool;
-               struct rte_kni_conf conf;
-               struct rte_kni_ops ops;
-
-               /* LINK */
-               p_link = app_get_link_for_kni(app, p_kni);
-               memset(&dev_info, 0, sizeof(dev_info));
-               rte_eth_dev_info_get(p_link->pmd_id, &dev_info);
-
-               /* MEMPOOL */
-               mempool_params = &app->mempool_params[p_kni->mempool_id];
-               mempool = app->mempool[p_kni->mempool_id];
-
-               /* KNI */
-               memset(&conf, 0, sizeof(conf));
-               snprintf(conf.name, RTE_KNI_NAMESIZE, "%s", p_kni->name);
-               conf.force_bind = p_kni->force_bind;
-               if (conf.force_bind) {
-                       int lcore_id;
-
-                       lcore_id = cpu_core_map_get_lcore_id(app->core_map,
-                               p_kni->socket_id,
-                               p_kni->core_id,
-                               p_kni->hyper_th_id);
-
-                       if (lcore_id < 0)
-                               rte_panic("%s invalid CPU core\n", p_kni->name);
-
-                       conf.core_id = (uint32_t) lcore_id;
-               }
-               conf.group_id = p_link->pmd_id;
-               conf.mbuf_size = mempool_params->buffer_size;
-               conf.addr = dev_info.pci_dev->addr;
-               conf.id = dev_info.pci_dev->id;
-
-               memset(&ops, 0, sizeof(ops));
-               ops.port_id = (uint8_t) p_link->pmd_id;
-               ops.change_mtu = kni_change_mtu;
-               ops.config_network_if = kni_config_network_interface;
-
-               APP_LOG(app, HIGH, "Initializing %s ...", p_kni->name);
-               app->kni[i] = rte_kni_alloc(mempool, &conf, &ops);
-               if (!app->kni[i])
-                       rte_panic("%s init error\n", p_kni->name);
-       }
-}
-#endif /* RTE_LIBRTE_KNI */
-
-static void
-app_init_msgq(struct app_params *app)
-{
-       uint32_t i;
-
-       for (i = 0; i < app->n_msgq; i++) {
-               struct app_msgq_params *p = &app->msgq_params[i];
-
-               APP_LOG(app, HIGH, "Initializing %s ...", p->name);
-               app->msgq[i] = rte_ring_create(
-                               p->name,
-                               p->size,
-                               p->cpu_socket_id,
-                               RING_F_SP_ENQ | RING_F_SC_DEQ);
-
-               if (app->msgq[i] == NULL)
-                       rte_panic("%s init error\n", p->name);
-       }
-}
-
-int app_init(struct app_params *app)
-{
-       app_init_core_map(app);
-       app_init_core_mask(app);
-
-       app_init_eal(app);
-       app_init_mempool(app);
-       app_init_link(app);
-       app_init_swq(app);
-       app_init_tm(app);
-       app_init_tap(app);
-       app_init_kni(app);
-       app_init_msgq(app);
-
-       return 0;
-}
index a44cf9a..1696e36 100644 (file)
@@ -2,34 +2,24 @@
  * Copyright(c) 2010-2015 Intel Corporation
  */
 
-#include "app.h"
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <getopt.h>
 
-static struct app_params app;
+#include <rte_eal.h>
 
 int
 main(int argc, char **argv)
 {
-       rte_openlog_stream(stderr);
+       int status;
 
-       /* Config */
-       app_config_init(&app);
+       /* EAL */
+       status = rte_eal_init(argc, argv);
+       if (status < 0) {
+               printf("Error: EAL initialization failed (%d)\n", status);
+               return status;
+       };
 
-       app_config_args(&app, argc, argv);
-
-       app_config_preproc(&app);
-
-       app_config_parse(&app, app.parser_file);
-
-       app_config_check(&app);
-
-       /* Init */
-       app_init(&app);
-
-       /* Run-time */
-       rte_eal_mp_remote_launch(
-               app_thread,
-               (void *) &app,
-               CALL_MASTER);
-
-       return 0;
 }
index be3f3e5..063865c 100644 (file)
@@ -1,19 +1,13 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2018 Intel Corporation
 
 # meson file, for building this example as part of a main DPDK build.
 #
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-deps += ['cfgfile', 'bus_pci']
+deps += ['pipeline', 'bus_pci']
 sources = files(
-       'config_check.c',
-       'config_parse.c',
-       'config_parse_tm.c',
-       'cpu_core_map.c',
-       'init.c',
        'main.c',
        'parser.c',
-       'thread.c',
 )
index 0901e9c..ffcdeb3 100644 (file)
 #include <sys/wait.h>
 
 #include <rte_errno.h>
-#include <rte_cfgfile.h>
 #include <rte_string_fns.h>
 
-#include "app.h"
 #include "parser.h"
 
 static uint32_t
@@ -596,10 +594,8 @@ parse_mac_addr(const char *token, struct ether_addr *addr)
 }
 
 int
-parse_pipeline_core(uint32_t *socket,
-       uint32_t *core,
-       uint32_t *ht,
-       const char *entry)
+parse_cpu_core(const char *entry,
+       struct cpu_core_params *p)
 {
        size_t num_len;
        char num[8];
@@ -609,6 +605,9 @@ parse_pipeline_core(uint32_t *socket,
        const char *next = skip_white_spaces(entry);
        char type;
 
+       if (p == NULL)
+               return -EINVAL;
+
        /* Expect <CORE> or [sX][cY][h]. At least one parameter is required. */
        while (*next != '\0') {
                /* If everything parsed nothing should left */
@@ -682,8 +681,8 @@ parse_pipeline_core(uint32_t *socket,
                }
        }
 
-       *socket = s;
-       *core = c;
-       *ht = h;
+       p->socket_id = s;
+       p->core_id = c;
+       p->thread_id = h;
        return 0;
 }
index 5c421d2..261a8c8 100644 (file)
@@ -50,6 +50,14 @@ int parse_ipv6_addr(const char *token, struct in6_addr *ipv6);
 int parse_mac_addr(const char *token, struct ether_addr *addr);
 int parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels);
 
+struct cpu_core_params {
+       uint32_t socket_id;
+       uint32_t core_id;
+       uint32_t thread_id;
+};
+
+int parse_cpu_core(const char *entry, struct cpu_core_params *p);
+
 int parse_tokenize_string(char *string, char *tokens[], uint32_t *n_tokens);
 
 #endif
diff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h
deleted file mode 100644 (file)
index 7ca9cad..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-
-#ifndef __INCLUDE_PIPELINE_H__
-#define __INCLUDE_PIPELINE_H__
-
-#include <cmdline_parse.h>
-
-#include "pipeline_be.h"
-
-/*
- * Pipeline type front-end operations
- */
-
-typedef void* (*pipeline_fe_op_init)(struct pipeline_params *params,
-       void *arg);
-
-typedef int (*pipeline_fe_op_post_init)(void *pipeline);
-
-typedef int (*pipeline_fe_op_free)(void *pipeline);
-
-typedef int (*pipeline_fe_op_track)(struct pipeline_params *params,
-       uint32_t port_in,
-       uint32_t *port_out);
-
-struct pipeline_fe_ops {
-       pipeline_fe_op_init f_init;
-       pipeline_fe_op_post_init f_post_init;
-       pipeline_fe_op_free f_free;
-       pipeline_fe_op_track f_track;
-       cmdline_parse_ctx_t *cmds;
-};
-
-/*
- * Pipeline type
- */
-
-struct pipeline_type {
-       const char *name;
-
-       /* pipeline back-end */
-       struct pipeline_be_ops *be_ops;
-
-       /* pipeline front-end */
-       struct pipeline_fe_ops *fe_ops;
-};
-
-static inline uint32_t
-pipeline_type_cmds_count(struct pipeline_type *ptype)
-{
-       cmdline_parse_ctx_t *cmds;
-       uint32_t n_cmds;
-
-       if (ptype->fe_ops == NULL)
-               return 0;
-
-       cmds = ptype->fe_ops->cmds;
-       if (cmds == NULL)
-               return 0;
-
-       for (n_cmds = 0; cmds[n_cmds]; n_cmds++);
-
-       return n_cmds;
-}
-
-int
-parse_pipeline_core(uint32_t *socket,
-       uint32_t *core,
-       uint32_t *ht,
-       const char *entry);
-
-#endif
diff --git a/examples/ip_pipeline/pipeline_be.h b/examples/ip_pipeline/pipeline_be.h
deleted file mode 100644 (file)
index 6c0c97a..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2016 Intel Corporation
- */
-
-#ifndef __INCLUDE_PIPELINE_BE_H__
-#define __INCLUDE_PIPELINE_BE_H__
-
-#include <rte_port_ethdev.h>
-#include <rte_port_ring.h>
-#include <rte_port_frag.h>
-#include <rte_port_ras.h>
-#include <rte_port_sched.h>
-#include <rte_port_fd.h>
-#include <rte_port_source_sink.h>
-#ifdef RTE_LIBRTE_KNI
-#include <rte_port_kni.h>
-#endif
-#include <rte_pipeline.h>
-
-enum pipeline_port_in_type {
-       PIPELINE_PORT_IN_ETHDEV_READER,
-       PIPELINE_PORT_IN_RING_READER,
-       PIPELINE_PORT_IN_RING_MULTI_READER,
-       PIPELINE_PORT_IN_RING_READER_IPV4_FRAG,
-       PIPELINE_PORT_IN_RING_READER_IPV6_FRAG,
-       PIPELINE_PORT_IN_SCHED_READER,
-       PIPELINE_PORT_IN_FD_READER,
-       PIPELINE_PORT_IN_KNI_READER,
-       PIPELINE_PORT_IN_SOURCE,
-};
-
-struct pipeline_port_in_params {
-       enum pipeline_port_in_type type;
-       union {
-               struct rte_port_ethdev_reader_params ethdev;
-               struct rte_port_ring_reader_params ring;
-               struct rte_port_ring_multi_reader_params ring_multi;
-               struct rte_port_ring_reader_ipv4_frag_params ring_ipv4_frag;
-               struct rte_port_ring_reader_ipv6_frag_params ring_ipv6_frag;
-               struct rte_port_sched_reader_params sched;
-               struct rte_port_fd_reader_params fd;
-#ifdef RTE_LIBRTE_KNI
-               struct rte_port_kni_reader_params kni;
-#endif
-               struct rte_port_source_params source;
-       } params;
-       uint32_t burst_size;
-};
-
-static inline void *
-pipeline_port_in_params_convert(struct pipeline_port_in_params  *p)
-{
-       switch (p->type) {
-       case PIPELINE_PORT_IN_ETHDEV_READER:
-               return (void *) &p->params.ethdev;
-       case PIPELINE_PORT_IN_RING_READER:
-               return (void *) &p->params.ring;
-       case PIPELINE_PORT_IN_RING_MULTI_READER:
-               return (void *) &p->params.ring_multi;
-       case PIPELINE_PORT_IN_RING_READER_IPV4_FRAG:
-               return (void *) &p->params.ring_ipv4_frag;
-       case PIPELINE_PORT_IN_RING_READER_IPV6_FRAG:
-               return (void *) &p->params.ring_ipv6_frag;
-       case PIPELINE_PORT_IN_SCHED_READER:
-               return (void *) &p->params.sched;
-       case PIPELINE_PORT_IN_FD_READER:
-               return (void *) &p->params.fd;
-#ifdef RTE_LIBRTE_KNI
-       case PIPELINE_PORT_IN_KNI_READER:
-               return (void *) &p->params.kni;
-#endif
-       case PIPELINE_PORT_IN_SOURCE:
-               return (void *) &p->params.source;
-       default:
-               return NULL;
-       }
-}
-
-static inline struct rte_port_in_ops *
-pipeline_port_in_params_get_ops(struct pipeline_port_in_params  *p)
-{
-       switch (p->type) {
-       case PIPELINE_PORT_IN_ETHDEV_READER:
-               return &rte_port_ethdev_reader_ops;
-       case PIPELINE_PORT_IN_RING_READER:
-               return &rte_port_ring_reader_ops;
-       case PIPELINE_PORT_IN_RING_MULTI_READER:
-               return &rte_port_ring_multi_reader_ops;
-       case PIPELINE_PORT_IN_RING_READER_IPV4_FRAG:
-               return &rte_port_ring_reader_ipv4_frag_ops;
-       case PIPELINE_PORT_IN_RING_READER_IPV6_FRAG:
-               return &rte_port_ring_reader_ipv6_frag_ops;
-       case PIPELINE_PORT_IN_SCHED_READER:
-               return &rte_port_sched_reader_ops;
-       case PIPELINE_PORT_IN_FD_READER:
-               return &rte_port_fd_reader_ops;
-#ifdef RTE_LIBRTE_KNI
-       case PIPELINE_PORT_IN_KNI_READER:
-               return &rte_port_kni_reader_ops;
-#endif
-       case PIPELINE_PORT_IN_SOURCE:
-               return &rte_port_source_ops;
-       default:
-               return NULL;
-       }
-}
-
-enum pipeline_port_out_type {
-       PIPELINE_PORT_OUT_ETHDEV_WRITER,
-       PIPELINE_PORT_OUT_ETHDEV_WRITER_NODROP,
-       PIPELINE_PORT_OUT_RING_WRITER,
-       PIPELINE_PORT_OUT_RING_MULTI_WRITER,
-       PIPELINE_PORT_OUT_RING_WRITER_NODROP,
-       PIPELINE_PORT_OUT_RING_MULTI_WRITER_NODROP,
-       PIPELINE_PORT_OUT_RING_WRITER_IPV4_RAS,
-       PIPELINE_PORT_OUT_RING_WRITER_IPV6_RAS,
-       PIPELINE_PORT_OUT_SCHED_WRITER,
-       PIPELINE_PORT_OUT_FD_WRITER,
-       PIPELINE_PORT_OUT_KNI_WRITER,
-       PIPELINE_PORT_OUT_KNI_WRITER_NODROP,
-       PIPELINE_PORT_OUT_SINK,
-};
-
-struct pipeline_port_out_params {
-       enum pipeline_port_out_type type;
-       union {
-               struct rte_port_ethdev_writer_params ethdev;
-               struct rte_port_ethdev_writer_nodrop_params ethdev_nodrop;
-               struct rte_port_ring_writer_params ring;
-               struct rte_port_ring_multi_writer_params ring_multi;
-               struct rte_port_ring_writer_nodrop_params ring_nodrop;
-               struct rte_port_ring_multi_writer_nodrop_params ring_multi_nodrop;
-               struct rte_port_ring_writer_ipv4_ras_params ring_ipv4_ras;
-               struct rte_port_ring_writer_ipv6_ras_params ring_ipv6_ras;
-               struct rte_port_sched_writer_params sched;
-               struct rte_port_fd_writer_params fd;
-#ifdef RTE_LIBRTE_KNI
-               struct rte_port_kni_writer_params kni;
-               struct rte_port_kni_writer_nodrop_params kni_nodrop;
-#endif
-               struct rte_port_sink_params sink;
-       } params;
-};
-
-static inline void *
-pipeline_port_out_params_convert(struct pipeline_port_out_params  *p)
-{
-       switch (p->type) {
-       case PIPELINE_PORT_OUT_ETHDEV_WRITER:
-               return (void *) &p->params.ethdev;
-       case PIPELINE_PORT_OUT_ETHDEV_WRITER_NODROP:
-               return (void *) &p->params.ethdev_nodrop;
-       case PIPELINE_PORT_OUT_RING_WRITER:
-               return (void *) &p->params.ring;
-       case PIPELINE_PORT_OUT_RING_MULTI_WRITER:
-               return (void *) &p->params.ring_multi;
-       case PIPELINE_PORT_OUT_RING_WRITER_NODROP:
-               return (void *) &p->params.ring_nodrop;
-       case PIPELINE_PORT_OUT_RING_MULTI_WRITER_NODROP:
-               return (void *) &p->params.ring_multi_nodrop;
-       case PIPELINE_PORT_OUT_RING_WRITER_IPV4_RAS:
-               return (void *) &p->params.ring_ipv4_ras;
-       case PIPELINE_PORT_OUT_RING_WRITER_IPV6_RAS:
-               return (void *) &p->params.ring_ipv6_ras;
-       case PIPELINE_PORT_OUT_SCHED_WRITER:
-               return (void *) &p->params.sched;
-       case PIPELINE_PORT_OUT_FD_WRITER:
-               return (void *) &p->params.fd;
-#ifdef RTE_LIBRTE_KNI
-       case PIPELINE_PORT_OUT_KNI_WRITER:
-               return (void *) &p->params.kni;
-       case PIPELINE_PORT_OUT_KNI_WRITER_NODROP:
-               return (void *) &p->params.kni_nodrop;
-#endif
-       case PIPELINE_PORT_OUT_SINK:
-               return (void *) &p->params.sink;
-       default:
-               return NULL;
-       }
-}
-
-static inline void *
-pipeline_port_out_params_get_ops(struct pipeline_port_out_params  *p)
-{
-       switch (p->type) {
-       case PIPELINE_PORT_OUT_ETHDEV_WRITER:
-               return &rte_port_ethdev_writer_ops;
-       case PIPELINE_PORT_OUT_ETHDEV_WRITER_NODROP:
-               return &rte_port_ethdev_writer_nodrop_ops;
-       case PIPELINE_PORT_OUT_RING_WRITER:
-               return &rte_port_ring_writer_ops;
-       case PIPELINE_PORT_OUT_RING_MULTI_WRITER:
-               return &rte_port_ring_multi_writer_ops;
-       case PIPELINE_PORT_OUT_RING_WRITER_NODROP:
-               return &rte_port_ring_writer_nodrop_ops;
-       case PIPELINE_PORT_OUT_RING_MULTI_WRITER_NODROP:
-               return &rte_port_ring_multi_writer_nodrop_ops;
-       case PIPELINE_PORT_OUT_RING_WRITER_IPV4_RAS:
-               return &rte_port_ring_writer_ipv4_ras_ops;
-       case PIPELINE_PORT_OUT_RING_WRITER_IPV6_RAS:
-               return &rte_port_ring_writer_ipv6_ras_ops;
-       case PIPELINE_PORT_OUT_SCHED_WRITER:
-               return &rte_port_sched_writer_ops;
-       case PIPELINE_PORT_OUT_FD_WRITER:
-               return &rte_port_fd_writer_ops;
-#ifdef RTE_LIBRTE_KNI
-       case PIPELINE_PORT_OUT_KNI_WRITER:
-               return &rte_port_kni_writer_ops;
-       case PIPELINE_PORT_OUT_KNI_WRITER_NODROP:
-               return &rte_port_kni_writer_nodrop_ops;
-#endif
-       case PIPELINE_PORT_OUT_SINK:
-               return &rte_port_sink_ops;
-       default:
-               return NULL;
-       }
-}
-
-#ifndef PIPELINE_NAME_SIZE
-#define PIPELINE_NAME_SIZE                       64
-#endif
-
-#ifndef PIPELINE_TYPE_SIZE
-#define PIPELINE_TYPE_SIZE                       64
-#endif
-
-#ifndef PIPELINE_MAX_PORT_IN
-#define PIPELINE_MAX_PORT_IN                     64
-#endif
-
-#ifndef PIPELINE_MAX_PORT_OUT
-#define PIPELINE_MAX_PORT_OUT                    64
-#endif
-
-#ifndef PIPELINE_MAX_TABLES
-#define PIPELINE_MAX_TABLES                      16
-#endif
-
-#ifndef PIPELINE_MAX_MSGQ_IN
-#define PIPELINE_MAX_MSGQ_IN                     16
-#endif
-
-#ifndef PIPELINE_MAX_MSGQ_OUT
-#define PIPELINE_MAX_MSGQ_OUT                    16
-#endif
-
-#ifndef PIPELINE_MAX_ARGS
-#define PIPELINE_MAX_ARGS                        64
-#endif
-
-struct pipeline_params {
-       char name[PIPELINE_NAME_SIZE];
-       char type[PIPELINE_TYPE_SIZE];
-
-       struct pipeline_port_in_params port_in[PIPELINE_MAX_PORT_IN];
-       struct pipeline_port_out_params port_out[PIPELINE_MAX_PORT_OUT];
-       struct rte_ring *msgq_in[PIPELINE_MAX_MSGQ_IN];
-       struct rte_ring *msgq_out[PIPELINE_MAX_MSGQ_OUT];
-
-       uint32_t n_ports_in;
-       uint32_t n_ports_out;
-       uint32_t n_msgq;
-
-       int socket_id;
-
-       char *args_name[PIPELINE_MAX_ARGS];
-       char *args_value[PIPELINE_MAX_ARGS];
-       uint32_t n_args;
-
-       uint32_t log_level;
-};
-
-/*
- * Pipeline type back-end operations
- */
-
-typedef void* (*pipeline_be_op_init)(struct pipeline_params *params,
-       void *arg);
-
-typedef int (*pipeline_be_op_free)(void *pipeline);
-
-typedef int (*pipeline_be_op_run)(void *pipeline);
-
-typedef int (*pipeline_be_op_timer)(void *pipeline);
-
-struct pipeline_be_ops {
-       pipeline_be_op_init f_init;
-       pipeline_be_op_free f_free;
-       pipeline_be_op_run f_run;
-       pipeline_be_op_timer f_timer;
-};
-
-/* Pipeline specific config parse error messages */
-#define PIPELINE_ARG_CHECK(exp, fmt, ...)                              \
-do {                                                                   \
-       if (!(exp)) {                                                   \
-               fprintf(stderr, fmt "\n", ## __VA_ARGS__);              \
-               return -1;                                              \
-       }                                                               \
-} while (0)
-
-#define PIPELINE_PARSE_ERR_INV_VAL(exp, section, entry, val)           \
-PIPELINE_ARG_CHECK(exp, "Parse error in section \"%s\": entry \"%s\" " \
-       "has invalid value (\"%s\")", section, entry, val)
-
-#define PIPELINE_PARSE_ERR_OUT_RNG(exp, section, entry, val)           \
-PIPELINE_ARG_CHECK(exp, "Parse error in section \"%s\": entry \"%s\" " \
-       "value is out of range (\"%s\")", section, entry, val)
-
-#define PIPELINE_PARSE_ERR_DUPLICATE(exp, section, entry)              \
-PIPELINE_ARG_CHECK(exp, "Parse error in section \"%s\": duplicated "   \
-       "entry \"%s\"", section, entry)
-
-#define PIPELINE_PARSE_ERR_INV_ENT(exp, section, entry)                        \
-PIPELINE_ARG_CHECK(exp, "Parse error in section \"%s\": invalid entry "        \
-       "\"%s\"", section, entry)
-
-#define PIPELINE_PARSE_ERR_MANDATORY(exp, section, entry)              \
-PIPELINE_ARG_CHECK(exp, "Parse error in section \"%s\": mandatory "    \
-       "entry \"%s\" is missing", section, entry)
-
-#endif
diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c
deleted file mode 100644 (file)
index a36bf92..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-
-#include <rte_common.h>
-#include <rte_cycles.h>
-#include <rte_pipeline.h>
-
-#include "app.h"
-#include "thread.h"
-
-static inline void *
-thread_msg_recv(struct rte_ring *r)
-{
-       void *msg;
-       int status = rte_ring_sc_dequeue(r, &msg);
-
-       if (status != 0)
-               return NULL;
-
-       return msg;
-}
-
-static inline void
-thread_msg_send(struct rte_ring *r,
-       void *msg)
-{
-       int status;
-
-       do {
-               status = rte_ring_sp_enqueue(r, msg);
-       } while (status == -ENOBUFS);
-}
-
-static int
-thread_pipeline_enable(struct app_thread_data *t,
-               struct thread_pipeline_enable_msg_req *req)
-{
-       struct app_thread_pipeline_data *p;
-
-       if (req->f_run == NULL) {
-               if (t->n_regular >= APP_MAX_THREAD_PIPELINES)
-                       return -1;
-       } else {
-               if (t->n_custom >= APP_MAX_THREAD_PIPELINES)
-                       return -1;
-       }
-
-       p = (req->f_run == NULL) ?
-               &t->regular[t->n_regular] :
-               &t->custom[t->n_custom];
-
-       p->pipeline_id = req->pipeline_id;
-       p->be = req->be;
-       p->f_run = req->f_run;
-       p->f_timer = req->f_timer;
-       p->timer_period = req->timer_period;
-       p->deadline = 0;
-
-       if (req->f_run == NULL)
-               t->n_regular++;
-       else
-               t->n_custom++;
-
-       return 0;
-}
-
-static int
-thread_pipeline_disable(struct app_thread_data *t,
-               struct thread_pipeline_disable_msg_req *req)
-{
-       uint32_t n_regular = RTE_MIN(t->n_regular, RTE_DIM(t->regular));
-       uint32_t n_custom = RTE_MIN(t->n_custom, RTE_DIM(t->custom));
-       uint32_t i;
-
-       /* search regular pipelines of current thread */
-       for (i = 0; i < n_regular; i++) {
-               if (t->regular[i].pipeline_id != req->pipeline_id)
-                       continue;
-
-               if (i < n_regular - 1)
-                       memcpy(&t->regular[i],
-                         &t->regular[i+1],
-                         (n_regular - 1 - i) * sizeof(struct app_thread_pipeline_data));
-
-               n_regular--;
-               t->n_regular = n_regular;
-
-               return 0;
-       }
-
-       /* search custom pipelines of current thread */
-       for (i = 0; i < n_custom; i++) {
-               if (t->custom[i].pipeline_id != req->pipeline_id)
-                       continue;
-
-               if (i < n_custom - 1)
-                       memcpy(&t->custom[i],
-                         &t->custom[i+1],
-                         (n_custom - 1 - i) * sizeof(struct app_thread_pipeline_data));
-
-               n_custom--;
-               t->n_custom = n_custom;
-
-               return 0;
-       }
-
-       /* return if pipeline not found */
-       return -1;
-}
-
-static int
-thread_msg_req_handle(struct app_thread_data *t)
-{
-       void *msg_ptr;
-       struct thread_msg_req *req;
-       struct thread_msg_rsp *rsp;
-
-       msg_ptr = thread_msg_recv(t->msgq_in);
-       req = msg_ptr;
-       rsp = msg_ptr;
-
-       if (req != NULL)
-               switch (req->type) {
-               case THREAD_MSG_REQ_PIPELINE_ENABLE: {
-                       rsp->status = thread_pipeline_enable(t,
-                                       (struct thread_pipeline_enable_msg_req *) req);
-                       thread_msg_send(t->msgq_out, rsp);
-                       break;
-               }
-
-               case THREAD_MSG_REQ_PIPELINE_DISABLE: {
-                       rsp->status = thread_pipeline_disable(t,
-                                       (struct thread_pipeline_disable_msg_req *) req);
-                       thread_msg_send(t->msgq_out, rsp);
-                       break;
-               }
-
-               case THREAD_MSG_REQ_HEADROOM_READ: {
-                       struct thread_headroom_read_msg_rsp *rsp =
-                               (struct thread_headroom_read_msg_rsp *)
-                               req;
-
-                       rsp->headroom_ratio = t->headroom_ratio;
-                       rsp->status = 0;
-                       thread_msg_send(t->msgq_out, rsp);
-                       break;
-               }
-               default:
-                       break;
-               }
-
-       return 0;
-}
-
-static void
-thread_headroom_update(struct app_thread_data *t, uint64_t time)
-{
-       uint64_t time_diff = time - t->headroom_time;
-
-       t->headroom_ratio =
-               ((double) t->headroom_cycles) / ((double) time_diff);
-
-       t->headroom_cycles = 0;
-       t->headroom_time = rte_rdtsc_precise();
-}
-
-int
-app_thread(void *arg)
-{
-       struct app_params *app = (struct app_params *) arg;
-       uint32_t core_id = rte_lcore_id(), i, j;
-       struct app_thread_data *t = &app->thread_data[core_id];
-
-       for (i = 0; ; i++) {
-               uint32_t n_regular = RTE_MIN(t->n_regular, RTE_DIM(t->regular));
-               uint32_t n_custom = RTE_MIN(t->n_custom, RTE_DIM(t->custom));
-
-               /* Timer */
-               if ((i & 0xF) == 0) {
-                       uint64_t time = rte_get_tsc_cycles();
-                       uint64_t t_deadline = UINT64_MAX;
-
-                       if (time < t->deadline)
-                               continue;
-
-                       /* Timer for regular pipelines */
-                       for (j = 0; j < n_regular; j++) {
-                               struct app_thread_pipeline_data *data =
-                                       &t->regular[j];
-                               uint64_t p_deadline = data->deadline;
-
-                               if (p_deadline <= time) {
-                                       data->f_timer(data->be);
-                                       p_deadline = time + data->timer_period;
-                                       data->deadline = p_deadline;
-                               }
-
-                               if (p_deadline < t_deadline)
-                                       t_deadline = p_deadline;
-                       }
-
-                       /* Timer for custom pipelines */
-                       for (j = 0; j < n_custom; j++) {
-                               struct app_thread_pipeline_data *data =
-                                       &t->custom[j];
-                               uint64_t p_deadline = data->deadline;
-
-                               if (p_deadline <= time) {
-                                       data->f_timer(data->be);
-                                       p_deadline = time + data->timer_period;
-                                       data->deadline = p_deadline;
-                               }
-
-                               if (p_deadline < t_deadline)
-                                       t_deadline = p_deadline;
-                       }
-
-                       /* Timer for thread message request */
-                       {
-                               uint64_t deadline = t->thread_req_deadline;
-
-                               if (deadline <= time) {
-                                       thread_msg_req_handle(t);
-                                       thread_headroom_update(t, time);
-                                       deadline = time + t->timer_period;
-                                       t->thread_req_deadline = deadline;
-                               }
-
-                               if (deadline < t_deadline)
-                                       t_deadline = deadline;
-                       }
-
-
-                       t->deadline = t_deadline;
-               }
-       }
-
-       return 0;
-}
diff --git a/examples/ip_pipeline/thread.h b/examples/ip_pipeline/thread.h
deleted file mode 100644 (file)
index 2c4fb6a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-
-#ifndef THREAD_H_
-#define THREAD_H_
-
-#include "app.h"
-#include "pipeline_be.h"
-
-enum thread_msg_req_type {
-       THREAD_MSG_REQ_PIPELINE_ENABLE = 0,
-       THREAD_MSG_REQ_PIPELINE_DISABLE,
-       THREAD_MSG_REQ_HEADROOM_READ,
-       THREAD_MSG_REQS
-};
-
-struct thread_msg_req {
-       enum thread_msg_req_type type;
-};
-
-struct thread_msg_rsp {
-       int status;
-};
-
-/*
- * PIPELINE ENABLE
- */
-struct thread_pipeline_enable_msg_req {
-       enum thread_msg_req_type type;
-
-       uint32_t pipeline_id;
-       void *be;
-       pipeline_be_op_run f_run;
-       pipeline_be_op_timer f_timer;
-       uint64_t timer_period;
-};
-
-struct thread_pipeline_enable_msg_rsp {
-       int status;
-};
-
-/*
- * PIPELINE DISABLE
- */
-struct thread_pipeline_disable_msg_req {
-       enum thread_msg_req_type type;
-
-       uint32_t pipeline_id;
-};
-
-struct thread_pipeline_disable_msg_rsp {
-       int status;
-};
-
-/*
- * THREAD HEADROOM
- */
-struct thread_headroom_read_msg_req {
-       enum thread_msg_req_type type;
-};
-
-struct thread_headroom_read_msg_rsp {
-       int status;
-
-       double headroom_ratio;
-};
-
-#endif /* THREAD_H_ */