app/eventdev: add mempool setup and destroy
[dpdk.git] / app / test-eventdev / test_pipeline_common.h
1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * Copyright 2017 Cavium, Inc.
4  */
5
6 #ifndef _TEST_PIPELINE_COMMON_
7 #define _TEST_PIPELINE_COMMON_
8
9 #include <stdio.h>
10 #include <stdbool.h>
11 #include <unistd.h>
12
13 #include <rte_cycles.h>
14 #include <rte_ethdev.h>
15 #include <rte_eventdev.h>
16 #include <rte_event_eth_rx_adapter.h>
17 #include <rte_lcore.h>
18 #include <rte_malloc.h>
19 #include <rte_mempool.h>
20 #include <rte_prefetch.h>
21 #include <rte_spinlock.h>
22
23 #include "evt_common.h"
24 #include "evt_options.h"
25 #include "evt_test.h"
26
27 struct test_pipeline;
28
29 struct worker_data {
30         uint64_t processed_pkts;
31         uint8_t dev_id;
32         uint8_t port_id;
33         struct test_pipeline *t;
34 } __rte_cache_aligned;
35
36 struct test_pipeline {
37         /* Don't change the offset of "done". Signal handler use this memory
38          * to terminate all lcores work.
39          */
40         int done;
41         uint8_t nb_workers;
42         uint8_t mt_unsafe;
43         enum evt_test_result result;
44         uint32_t nb_flows;
45         uint64_t outstand_pkts;
46         struct rte_mempool *pool;
47         struct worker_data worker[EVT_MAX_PORTS];
48         struct rte_eth_dev_tx_buffer *tx_buf[RTE_MAX_ETHPORTS];
49         rte_spinlock_t tx_lk[RTE_MAX_ETHPORTS];
50         struct evt_options *opt;
51         uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned;
52 } __rte_cache_aligned;
53
54 int pipeline_test_setup(struct evt_test *test, struct evt_options *opt);
55 int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt);
56 void pipeline_test_destroy(struct evt_test *test, struct evt_options *opt);
57 void pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt);
58
59 #endif /* _TEST_PIPELINE_COMMON_ */