examples/eventdev: move common data into pipeline common
authorPavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Wed, 10 Jan 2018 11:10:00 +0000 (16:40 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 19 Jan 2018 15:09:56 +0000 (16:09 +0100)
Move common structures and functions into pipeline_common.h so that they
can be used by different kinds of pipelines.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
examples/eventdev_pipeline_sw_pmd/main.c
examples/eventdev_pipeline_sw_pmd/pipeline_common.h [new file with mode: 0644]

index f02e2fc..fc445a1 100644 (file)
@@ -7,73 +7,10 @@
 #include <stdio.h>
 #include <signal.h>
 #include <sched.h>
-#include <stdbool.h>
-
-#include <rte_eal.h>
-#include <rte_mempool.h>
-#include <rte_mbuf.h>
-#include <rte_launch.h>
-#include <rte_malloc.h>
-#include <rte_random.h>
-#include <rte_cycles.h>
-#include <rte_ethdev.h>
-#include <rte_eventdev.h>
-#include <rte_event_eth_rx_adapter.h>
-#include <rte_service.h>
-
-#define MAX_NUM_STAGES 8
-#define BATCH_SIZE 16
-#define MAX_NUM_CORE 64
-
-struct cons_data {
-       uint8_t dev_id;
-       uint8_t port_id;
-       uint8_t release;
-} __rte_cache_aligned;
-
-static struct cons_data cons_data;
-
-struct worker_data {
-       uint8_t dev_id;
-       uint8_t port_id;
-} __rte_cache_aligned;
-
-struct fastpath_data {
-       volatile int done;
-       uint32_t tx_lock;
-       uint32_t evdev_service_id;
-       uint32_t rxadptr_service_id;
-       bool rx_single;
-       bool tx_single;
-       bool sched_single;
-       unsigned int rx_core[MAX_NUM_CORE];
-       unsigned int tx_core[MAX_NUM_CORE];
-       unsigned int sched_core[MAX_NUM_CORE];
-       unsigned int worker_core[MAX_NUM_CORE];
-       struct rte_eth_dev_tx_buffer *tx_buf[RTE_MAX_ETHPORTS];
-};
 
-static struct fastpath_data *fdata;
-
-struct config_data {
-       unsigned int active_cores;
-       unsigned int num_workers;
-       int64_t num_packets;
-       unsigned int num_fids;
-       int queue_type;
-       int worker_cycles;
-       int enable_queue_priorities;
-       int quiet;
-       int dump_dev;
-       int dump_dev_signal;
-       unsigned int num_stages;
-       unsigned int worker_cq_depth;
-       int16_t next_qid[MAX_NUM_STAGES+2];
-       int16_t qid[MAX_NUM_STAGES];
-       uint8_t rx_adapter_id;
-};
+#include "pipeline_common.h"
 
-static struct config_data cdata = {
+struct config_data cdata = {
        .num_packets = (1L << 25), /* do ~32M packets */
        .num_fids = 512,
        .queue_type = RTE_SCHED_TYPE_ATOMIC,
diff --git a/examples/eventdev_pipeline_sw_pmd/pipeline_common.h b/examples/eventdev_pipeline_sw_pmd/pipeline_common.h
new file mode 100644 (file)
index 0000000..1dbc01f
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2016 Intel Corporation.
+ * Copyright 2017 Cavium, Inc.
+ */
+
+#include <stdbool.h>
+
+#include <rte_eal.h>
+#include <rte_mempool.h>
+#include <rte_mbuf.h>
+#include <rte_launch.h>
+#include <rte_malloc.h>
+#include <rte_random.h>
+#include <rte_cycles.h>
+#include <rte_ethdev.h>
+#include <rte_eventdev.h>
+#include <rte_event_eth_rx_adapter.h>
+#include <rte_service.h>
+#include <rte_service_component.h>
+
+#define MAX_NUM_STAGES 8
+#define BATCH_SIZE 16
+#define MAX_NUM_CORE 64
+
+struct cons_data {
+       uint8_t dev_id;
+       uint8_t port_id;
+       uint8_t release;
+} __rte_cache_aligned;
+
+struct worker_data {
+       uint8_t dev_id;
+       uint8_t port_id;
+} __rte_cache_aligned;
+
+struct fastpath_data {
+       volatile int done;
+       uint32_t tx_lock;
+       uint32_t evdev_service_id;
+       uint32_t rxadptr_service_id;
+       bool rx_single;
+       bool tx_single;
+       bool sched_single;
+       unsigned int rx_core[MAX_NUM_CORE];
+       unsigned int tx_core[MAX_NUM_CORE];
+       unsigned int sched_core[MAX_NUM_CORE];
+       unsigned int worker_core[MAX_NUM_CORE];
+       struct rte_eth_dev_tx_buffer *tx_buf[RTE_MAX_ETHPORTS];
+} __rte_cache_aligned;
+
+struct config_data {
+       unsigned int active_cores;
+       unsigned int num_workers;
+       int64_t num_packets;
+       unsigned int num_fids;
+       int queue_type;
+       int worker_cycles;
+       int enable_queue_priorities;
+       int quiet;
+       int dump_dev;
+       int dump_dev_signal;
+       unsigned int num_stages;
+       unsigned int worker_cq_depth;
+       int16_t next_qid[MAX_NUM_STAGES+2];
+       int16_t qid[MAX_NUM_STAGES];
+       uint8_t rx_adapter_id;
+};
+
+struct cons_data cons_data;
+
+struct fastpath_data *fdata;
+struct config_data cdata;