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 #include <rte_service.h> 23 #include <rte_service_component.h> 24 25 #include "evt_common.h" 26 #include "evt_options.h" 27 #include "evt_test.h" 28 29 struct test_pipeline; 30 31 struct worker_data { 32 uint64_t processed_pkts; 33 uint8_t dev_id; 34 uint8_t port_id; 35 struct test_pipeline *t; 36 } __rte_cache_aligned; 37 38 struct tx_service_data { 39 uint8_t dev_id; 40 uint8_t queue_id; 41 uint8_t port_id; 42 uint32_t service_id; 43 uint64_t processed_pkts; 44 uint16_t nb_ethports; 45 struct rte_eth_dev_tx_buffer *tx_buf[RTE_MAX_ETHPORTS]; 46 struct test_pipeline *t; 47 } __rte_cache_aligned; 48 49 struct test_pipeline { 50 /* Don't change the offset of "done". Signal handler use this memory 51 * to terminate all lcores work. 52 */ 53 int done; 54 uint8_t nb_workers; 55 uint8_t mt_unsafe; 56 enum evt_test_result result; 57 uint32_t nb_flows; 58 uint64_t outstand_pkts; 59 struct rte_mempool *pool; 60 struct worker_data worker[EVT_MAX_PORTS]; 61 struct tx_service_data tx_service; 62 struct evt_options *opt; 63 uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned; 64 } __rte_cache_aligned; 65 66 #define BURST_SIZE 16 67 68 static inline int 69 pipeline_nb_event_ports(struct evt_options *opt) 70 { 71 return evt_nr_active_lcores(opt->wlcores); 72 } 73 74 int pipeline_test_result(struct evt_test *test, struct evt_options *opt); 75 int pipeline_opt_check(struct evt_options *opt, uint64_t nb_queues); 76 int pipeline_test_setup(struct evt_test *test, struct evt_options *opt); 77 int pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt); 78 int pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, 79 struct rte_event_port_conf prod_conf); 80 int pipeline_event_tx_service_setup(struct evt_test *test, 81 struct evt_options *opt, uint8_t tx_queue_id, 82 uint8_t tx_port_id, const struct rte_event_port_conf p_conf); 83 int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt); 84 int pipeline_event_port_setup(struct evt_test *test, struct evt_options *opt, 85 uint8_t *queue_arr, uint8_t nb_queues, 86 const struct rte_event_port_conf p_conf); 87 void pipeline_opt_dump(struct evt_options *opt, uint8_t nb_queues); 88 void pipeline_test_destroy(struct evt_test *test, struct evt_options *opt); 89 void pipeline_eventdev_destroy(struct evt_test *test, struct evt_options *opt); 90 void pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt); 91 void pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt); 92 93 #endif /* _TEST_PIPELINE_COMMON_ */ 94