2 * SPDX-License-Identifier: BSD-3-Clause
3 * Copyright 2017 Cavium, Inc.
6 #include "test_pipeline_common.h"
9 pipeline_test_result(struct evt_test *test, struct evt_options *opt)
14 struct test_pipeline *t = evt_test_priv(test);
16 printf("Packet distribution across worker cores :\n");
17 for (i = 0; i < t->nb_workers; i++)
18 total += t->worker[i].processed_pkts;
19 for (i = 0; i < t->nb_workers; i++)
20 printf("Worker %d packets: "CLGRN"%"PRIx64" "CLNRM"percentage:"
21 CLGRN" %3.2f\n"CLNRM, i,
22 t->worker[i].processed_pkts,
23 (((double)t->worker[i].processed_pkts)/total)
29 pipeline_opt_dump(struct evt_options *opt, uint8_t nb_queues)
31 evt_dump("nb_worker_lcores", "%d", evt_nr_active_lcores(opt->wlcores));
32 evt_dump_worker_lcores(opt);
33 evt_dump_nb_stages(opt);
34 evt_dump("nb_evdev_ports", "%d", pipeline_nb_event_ports(opt));
35 evt_dump("nb_evdev_queues", "%d", nb_queues);
36 evt_dump_queue_priority(opt);
37 evt_dump_sched_type_list(opt);
38 evt_dump_producer_type(opt);
42 pipeline_opt_check(struct evt_options *opt, uint64_t nb_queues)
50 if (!rte_eth_dev_count()) {
51 evt_err("test needs minimum 1 ethernet dev");
55 if (rte_lcore_count() < lcores) {
56 evt_err("test need minimum %d lcores", lcores);
60 /* Validate worker lcores */
61 if (evt_lcores_has_overlap(opt->wlcores, rte_get_master_lcore())) {
62 evt_err("worker lcores overlaps with master lcore");
65 if (evt_has_disabled_lcore(opt->wlcores)) {
66 evt_err("one or more workers lcores are not enabled");
69 if (!evt_has_active_lcore(opt->wlcores)) {
70 evt_err("minimum one worker is required");
74 if (nb_queues > EVT_MAX_QUEUES) {
75 evt_err("number of queues exceeds %d", EVT_MAX_QUEUES);
78 if (pipeline_nb_event_ports(opt) > EVT_MAX_PORTS) {
79 evt_err("number of ports exceeds %d", EVT_MAX_PORTS);
83 if (evt_has_invalid_stage(opt))
86 if (evt_has_invalid_sched_type(opt))
93 pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
95 struct test_pipeline *t = evt_test_priv(test);
97 t->pool = rte_pktmbuf_pool_create(test->name, /* mempool name */
98 opt->pool_sz, /* number of elements*/
101 RTE_MBUF_DEFAULT_BUF_SIZE,
102 opt->socket_id); /* flags */
104 if (t->pool == NULL) {
105 evt_err("failed to create mempool");
113 pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt)
116 struct test_pipeline *t = evt_test_priv(test);
118 rte_mempool_free(t->pool);
122 pipeline_test_setup(struct evt_test *test, struct evt_options *opt)
126 test_pipeline = rte_zmalloc_socket(test->name,
127 sizeof(struct test_pipeline), RTE_CACHE_LINE_SIZE,
129 if (test_pipeline == NULL) {
130 evt_err("failed to allocate test_pipeline memory");
133 test->test_priv = test_pipeline;
135 struct test_pipeline *t = evt_test_priv(test);
137 t->nb_workers = evt_nr_active_lcores(opt->wlcores);
138 t->outstand_pkts = opt->nb_pkts * evt_nr_active_lcores(opt->wlcores);
140 t->nb_flows = opt->nb_flows;
141 t->result = EVT_TEST_FAILED;
143 opt->prod_type = EVT_PROD_TYPE_ETH_RX_ADPTR;
144 memcpy(t->sched_type_list, opt->sched_type_list,
145 sizeof(opt->sched_type_list));
152 pipeline_test_destroy(struct evt_test *test, struct evt_options *opt)
156 rte_free(test->test_priv);