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.
36 #include "test_order_common.h"
38 /* See http://dpdk.org/doc/guides/tools/testeventdev.html for test details */
42 order_queue_eventdev_setup(struct evt_test *test, struct evt_options *opt)
46 const uint8_t nb_workers = evt_nr_active_lcores(opt->wlcores);
47 /* number of active worker cores + 1 producer */
48 const uint8_t nb_ports = nb_workers + 1;
50 const struct rte_event_dev_config config = {
51 .nb_event_queues = NB_QUEUES,/* q0 ordered, q1 atomic */
52 .nb_event_ports = nb_ports,
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 /* q0 (ordered queue) configuration */
66 struct rte_event_queue_conf q0_ordered_conf = {
67 .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
68 .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ORDERED_ONLY,
69 .nb_atomic_flows = opt->nb_flows,
70 .nb_atomic_order_sequences = opt->nb_flows,
72 ret = rte_event_queue_setup(opt->dev_id, 0, &q0_ordered_conf);
74 evt_err("failed to setup queue0 eventdev %d", opt->dev_id);
78 /* q1 (atomic queue) configuration */
79 struct rte_event_queue_conf q1_atomic_conf = {
80 .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
81 .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY,
82 .nb_atomic_flows = opt->nb_flows,
83 .nb_atomic_order_sequences = opt->nb_flows,
85 ret = rte_event_queue_setup(opt->dev_id, 1, &q1_atomic_conf);
87 evt_err("failed to setup queue1 eventdev %d", opt->dev_id);
91 /* setup one port per worker, linking to all queues */
92 ret = order_event_dev_port_setup(test, opt, nb_workers, NB_QUEUES);
96 ret = rte_event_dev_start(opt->dev_id);
98 evt_err("failed to start eventdev %d", opt->dev_id);
106 order_queue_opt_dump(struct evt_options *opt)
109 evt_dump("nb_evdev_queues", "%d", NB_QUEUES);
113 order_queue_capability_check(struct evt_options *opt)
115 struct rte_event_dev_info dev_info;
117 rte_event_dev_info_get(opt->dev_id, &dev_info);
118 if (dev_info.max_event_queues < NB_QUEUES || dev_info.max_event_ports <
119 order_nb_event_ports(opt)) {
120 evt_err("not enough eventdev queues=%d/%d or ports=%d/%d",
121 NB_QUEUES, dev_info.max_event_queues,
122 order_nb_event_ports(opt), dev_info.max_event_ports);
129 static const struct evt_test_ops order_queue = {
130 .cap_check = order_queue_capability_check,
131 .opt_check = order_opt_check,
132 .opt_dump = order_queue_opt_dump,
133 .test_setup = order_test_setup,
134 .mempool_setup = order_mempool_setup,
135 .eventdev_setup = order_queue_eventdev_setup,
136 .eventdev_destroy = order_eventdev_destroy,
137 .mempool_destroy = order_mempool_destroy,
138 .test_result = order_test_result,
139 .test_destroy = order_test_destroy,
142 EVT_TEST_REGISTER(order_queue);