X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-eventdev%2Ftest_pipeline_common.h;h=6e73c6ab26e09953ea3b5edae94684980b52a0a4;hb=c6c267a00a9227d7e8ade7338ad1ddb10fbefcf8;hp=0a8d66ae9b2bc67a9fbf7fce900ddb2ac67d8722;hpb=38f842bc39f975db85cfbb8388fed2c329c4e131;p=dpdk.git diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h index 0a8d66ae9b..6e73c6ab26 100644 --- a/app/test-eventdev/test_pipeline_common.h +++ b/app/test-eventdev/test_pipeline_common.h @@ -14,11 +14,14 @@ #include #include #include +#include #include #include #include #include #include +#include +#include #include "evt_common.h" #include "evt_options.h" @@ -39,18 +42,108 @@ struct test_pipeline { */ int done; uint8_t nb_workers; - uint8_t mt_unsafe; + uint8_t internal_port; + uint8_t tx_evqueue_id[RTE_MAX_ETHPORTS]; enum evt_test_result result; uint32_t nb_flows; uint64_t outstand_pkts; struct rte_mempool *pool; struct worker_data worker[EVT_MAX_PORTS]; - struct rte_eth_dev_tx_buffer *tx_buf[RTE_MAX_ETHPORTS]; - rte_spinlock_t tx_lk[RTE_MAX_ETHPORTS]; struct evt_options *opt; uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned; } __rte_cache_aligned; +#define BURST_SIZE 16 + +#define PIPELINE_WORKER_SINGLE_STAGE_INIT \ + struct worker_data *w = arg; \ + struct test_pipeline *t = w->t; \ + const uint8_t dev = w->dev_id; \ + const uint8_t port = w->port_id; \ + struct rte_event ev __rte_cache_aligned + +#define PIPELINE_WORKER_SINGLE_STAGE_BURST_INIT \ + int i; \ + struct worker_data *w = arg; \ + struct test_pipeline *t = w->t; \ + const uint8_t dev = w->dev_id; \ + const uint8_t port = w->port_id; \ + struct rte_event ev[BURST_SIZE + 1] __rte_cache_aligned + +#define PIPELINE_WORKER_MULTI_STAGE_INIT \ + struct worker_data *w = arg; \ + struct test_pipeline *t = w->t; \ + uint8_t cq_id; \ + const uint8_t dev = w->dev_id; \ + const uint8_t port = w->port_id; \ + const uint8_t last_queue = t->opt->nb_stages - 1; \ + uint8_t *const sched_type_list = &t->sched_type_list[0]; \ + const uint8_t nb_stages = t->opt->nb_stages + 1; \ + struct rte_event ev __rte_cache_aligned + +#define PIPELINE_WORKER_MULTI_STAGE_BURST_INIT \ + int i; \ + struct worker_data *w = arg; \ + struct test_pipeline *t = w->t; \ + uint8_t cq_id; \ + const uint8_t dev = w->dev_id; \ + const uint8_t port = w->port_id; \ + const uint8_t last_queue = t->opt->nb_stages - 1; \ + uint8_t *const sched_type_list = &t->sched_type_list[0]; \ + const uint8_t nb_stages = t->opt->nb_stages + 1; \ + struct rte_event ev[BURST_SIZE + 1] __rte_cache_aligned + +static __rte_always_inline void +pipeline_fwd_event(struct rte_event *ev, uint8_t sched) +{ + ev->event_type = RTE_EVENT_TYPE_CPU; + ev->op = RTE_EVENT_OP_FORWARD; + ev->sched_type = sched; +} + +static __rte_always_inline void +pipeline_event_tx(const uint8_t dev, const uint8_t port, + struct rte_event * const ev) +{ + rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0); + while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0)) + rte_pause(); +} + +static __rte_always_inline void +pipeline_event_tx_burst(const uint8_t dev, const uint8_t port, + struct rte_event *ev, const uint16_t nb_rx) +{ + uint16_t enq; + + enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0); + while (enq < nb_rx) { + enq += rte_event_eth_tx_adapter_enqueue(dev, port, + ev + enq, nb_rx - enq, 0); + } +} + +static __rte_always_inline void +pipeline_event_enqueue(const uint8_t dev, const uint8_t port, + struct rte_event *ev) +{ + while (rte_event_enqueue_burst(dev, port, ev, 1) != 1) + rte_pause(); +} + +static __rte_always_inline void +pipeline_event_enqueue_burst(const uint8_t dev, const uint8_t port, + struct rte_event *ev, const uint16_t nb_rx) +{ + uint16_t enq; + + enq = rte_event_enqueue_burst(dev, port, ev, nb_rx); + while (enq < nb_rx) { + enq += rte_event_enqueue_burst(dev, port, + ev + enq, nb_rx - enq); + } +} + static inline int pipeline_nb_event_ports(struct evt_options *opt) { @@ -60,9 +153,21 @@ pipeline_nb_event_ports(struct evt_options *opt) int pipeline_test_result(struct evt_test *test, struct evt_options *opt); int pipeline_opt_check(struct evt_options *opt, uint64_t nb_queues); int pipeline_test_setup(struct evt_test *test, struct evt_options *opt); +int pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt); +int pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, + struct rte_event_port_conf prod_conf); +int pipeline_event_tx_adapter_setup(struct evt_options *opt, + struct rte_event_port_conf prod_conf); int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt); +int pipeline_event_port_setup(struct evt_test *test, struct evt_options *opt, + uint8_t *queue_arr, uint8_t nb_queues, + const struct rte_event_port_conf p_conf); +int pipeline_launch_lcores(struct evt_test *test, struct evt_options *opt, + int (*worker)(void *)); void pipeline_opt_dump(struct evt_options *opt, uint8_t nb_queues); void pipeline_test_destroy(struct evt_test *test, struct evt_options *opt); +void pipeline_eventdev_destroy(struct evt_test *test, struct evt_options *opt); +void pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt); void pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt); #endif /* _TEST_PIPELINE_COMMON_ */