4 * Copyright (C) Cavium 2017.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Cavium nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "test_perf_common.h"
35 /* See http://dpdk.org/doc/guides/tools/testeventdev.html for test details */
38 atq_nb_event_queues(struct evt_options *opt)
40 /* nb_queues = number of producers */
41 return evt_nr_active_lcores(opt->plcores);
45 perf_atq_eventdev_setup(struct evt_test *test, struct evt_options *opt)
50 const struct rte_event_dev_config config = {
51 .nb_event_queues = atq_nb_event_queues(opt),
52 .nb_event_ports = perf_nb_event_ports(opt),
53 .nb_events_limit = 4096,
54 .nb_event_queue_flows = opt->nb_flows,
55 .nb_event_port_dequeue_depth = 128,
56 .nb_event_port_enqueue_depth = 128,
59 ret = rte_event_dev_configure(opt->dev_id, &config);
61 evt_err("failed to configure eventdev %d", opt->dev_id);
65 struct rte_event_queue_conf q_conf = {
66 .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
67 .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ALL_TYPES,
68 .nb_atomic_flows = opt->nb_flows,
69 .nb_atomic_order_sequences = opt->nb_flows,
71 /* queue configurations */
72 for (queue = 0; queue < atq_nb_event_queues(opt); queue++) {
73 ret = rte_event_queue_setup(opt->dev_id, queue, &q_conf);
75 evt_err("failed to setup queue=%d", queue);
80 ret = perf_event_dev_port_setup(test, opt, 1 /* stride */,
81 atq_nb_event_queues(opt));
85 ret = rte_event_dev_start(opt->dev_id);
87 evt_err("failed to start eventdev %d", opt->dev_id);
95 perf_atq_opt_dump(struct evt_options *opt)
97 perf_opt_dump(opt, atq_nb_event_queues(opt));
101 perf_atq_opt_check(struct evt_options *opt)
103 return perf_opt_check(opt, atq_nb_event_queues(opt));
107 perf_atq_capability_check(struct evt_options *opt)
109 struct rte_event_dev_info dev_info;
111 rte_event_dev_info_get(opt->dev_id, &dev_info);
112 if (dev_info.max_event_queues < atq_nb_event_queues(opt) ||
113 dev_info.max_event_ports < perf_nb_event_ports(opt)) {
114 evt_err("not enough eventdev queues=%d/%d or ports=%d/%d",
115 atq_nb_event_queues(opt), dev_info.max_event_queues,
116 perf_nb_event_ports(opt), dev_info.max_event_ports);
118 if (!evt_has_all_types_queue(opt->dev_id))
124 static const struct evt_test_ops perf_atq = {
125 .cap_check = perf_atq_capability_check,
126 .opt_check = perf_atq_opt_check,
127 .opt_dump = perf_atq_opt_dump,
128 .test_setup = perf_test_setup,
129 .mempool_setup = perf_mempool_setup,
130 .eventdev_setup = perf_atq_eventdev_setup,
131 .eventdev_destroy = perf_eventdev_destroy,
132 .mempool_destroy = perf_mempool_destroy,
133 .test_result = perf_test_result,
134 .test_destroy = perf_test_destroy,
137 EVT_TEST_REGISTER(perf_atq);