examples/ip_pipeline: clean up configuration parser
[dpdk.git] / examples / ip_pipeline / app.h
index d8a1717..05d608b 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,7 @@
 #include "pipeline.h"
 
 #define APP_PARAM_NAME_SIZE                      PIPELINE_NAME_SIZE
+#define APP_LINK_PCI_BDF_SIZE                    16
 
 struct app_mempool_params {
        char *name;
@@ -64,7 +65,7 @@ struct app_link_params {
        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_local_q; /* 0 = Disabled (pkts go to default queue) */
+       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) */
@@ -73,6 +74,7 @@ struct app_link_params {
        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;
        uint8_t promisc;
@@ -148,11 +150,15 @@ struct app_pktq_source_params {
        uint32_t parsed;
        uint32_t mempool_id; /* Position in the app->mempool_params array */
        uint32_t burst;
+       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;
+       char *file_name; /* Full path of PCAP file to be copied to mbufs */
+       uint32_t n_pkts_to_dump;
 };
 
 struct app_msgq_params {
@@ -227,6 +233,7 @@ struct app_pipeline_params {
 struct app_pipeline_data {
        void *be;
        void *fe;
+       struct pipeline_type *ptype;
        uint64_t timer_period;
        uint32_t enabled;
 };
@@ -262,8 +269,16 @@ struct app_thread_data {
 
        struct rte_ring *msgq_in;
        struct rte_ring *msgq_out;
+
+       uint64_t headroom_time;
+       uint64_t headroom_cycles;
+       double headroom_ratio;
 };
 
+#ifndef APP_MAX_LINKS
+#define APP_MAX_LINKS                            16
+#endif
+
 struct app_eal_params {
        /* Map lcore set to physical cpu set */
        char *coremap;
@@ -285,13 +300,13 @@ struct app_eal_params {
        uint32_t ranks;
 
        /* Add a PCI device in black list. */
-       char *pci_blacklist;
+       char *pci_blacklist[APP_MAX_LINKS];
 
        /* Add a PCI device in white list. */
-       char *pci_whitelist;
+       char *pci_whitelist[APP_MAX_LINKS];
 
        /* Add a virtual device. */
-       char *vdev;
+       char *vdev[APP_MAX_LINKS];
 
         /* Use VMware TSC map instead of native RDTSC */
        uint32_t vmware_tsc_map_present;
@@ -356,6 +371,8 @@ struct app_eal_params {
        /* Support running on Xen dom0 without hugetlbfs */
        uint32_t xen_dom0_present;
        int xen_dom0;
+
+       uint32_t parsed;
 };
 
 #ifndef APP_APPNAME_SIZE
@@ -366,10 +383,6 @@ struct app_eal_params {
 #define APP_MAX_MEMPOOLS                         8
 #endif
 
-#ifndef APP_MAX_LINKS
-#define APP_MAX_LINKS                            16
-#endif
-
 #ifndef APP_LINK_MAX_HWQ_IN
 #define APP_LINK_MAX_HWQ_IN                      64
 #endif
@@ -405,7 +418,7 @@ struct app_eal_params {
 #endif
 
 #ifndef APP_EAL_ARGC
-#define APP_EAL_ARGC                             32
+#define APP_EAL_ARGC                             64
 #endif
 
 #ifndef APP_MAX_PIPELINE_TYPES
@@ -420,6 +433,10 @@ struct app_eal_params {
 #define APP_MAX_CMDS                             64
 #endif
 
+#ifndef APP_THREAD_HEADROOM_STATS_COLLECT
+#define APP_THREAD_HEADROOM_STATS_COLLECT        1
+#endif
+
 struct app_params {
        /* Config */
        char app_name[APP_APPNAME_SIZE];
@@ -515,28 +532,6 @@ do                                                                 \
        sscanf(obj->name, prefix "%" SCNu32, &id);                              \
 while (0)                                                              \
 
-#define APP_PARAM_ADD(obj_array, obj_name)                             \
-({                                                                     \
-       ssize_t obj_idx;                                                \
-       const ssize_t obj_count = RTE_DIM(obj_array);                   \
-                                                                       \
-       obj_idx = APP_PARAM_FIND(obj_array, obj_name);                  \
-       if (obj_idx < 0) {                                              \
-               for (obj_idx = 0; obj_idx < obj_count; obj_idx++) {     \
-                       if (!APP_PARAM_VALID(&((obj_array)[obj_idx])))  \
-                               break;                                  \
-               }                                                       \
-                                                                       \
-               if (obj_idx < obj_count) {                              \
-                       (obj_array)[obj_idx].name = strdup(obj_name);   \
-                       if ((obj_array)[obj_idx].name == NULL)          \
-                               obj_idx = -EINVAL;                      \
-               } else                                                  \
-                       obj_idx = -ENOMEM;                              \
-       }                                                               \
-       obj_idx;                                                        \
-})
-
 #define        APP_CHECK(exp, fmt, ...)                                        \
 do {                                                                   \
        if (!(exp)) {                                                   \