3 * Copyright(c) 2016 Cavium networks. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
15 * * Neither the name of Cavium networks nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _RTE_EVENTDEV_PMD_H_
33 #define _RTE_EVENTDEV_PMD_H_
39 * These API are from event PMD only and user applications should not call
47 #include "rte_eventdev.h"
50 * Definitions of all functions exported by a driver through the
51 * the generic structure of type *event_dev_ops* supplied in the
52 * *rte_eventdev* structure associated with a device.
56 * Get device information of a device.
59 * Event device pointer
61 * Event device information structure
64 * Returns 0 on success
66 typedef void (*eventdev_info_get_t)(struct rte_eventdev *dev,
67 struct rte_event_dev_info *dev_info);
73 * Event device pointer
76 * Returns 0 on success
78 typedef int (*eventdev_configure_t)(const struct rte_eventdev *dev);
81 * Start a configured device.
84 * Event device pointer
87 * Returns 0 on success
89 typedef int (*eventdev_start_t)(struct rte_eventdev *dev);
92 * Stop a configured device.
95 * Event device pointer
97 typedef void (*eventdev_stop_t)(struct rte_eventdev *dev);
100 * Close a configured device.
103 * Event device pointer
107 * - (-EAGAIN) if can't close as device is busy
109 typedef int (*eventdev_close_t)(struct rte_eventdev *dev);
112 * Retrieve the default event queue configuration.
115 * Event device pointer
118 * @param[out] queue_conf
119 * Event queue configuration structure
122 typedef void (*eventdev_queue_default_conf_get_t)(struct rte_eventdev *dev,
123 uint8_t queue_id, struct rte_event_queue_conf *queue_conf);
126 * Setup an event queue.
129 * Event device pointer
133 * Event queue configuration structure
136 * Returns 0 on success.
138 typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
140 const struct rte_event_queue_conf *queue_conf);
143 * Release resources allocated by given event queue.
146 * Event device pointer
151 typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
155 * Retrieve the default event port configuration.
158 * Event device pointer
161 * @param[out] port_conf
162 * Event port configuration structure
165 typedef void (*eventdev_port_default_conf_get_t)(struct rte_eventdev *dev,
166 uint8_t port_id, struct rte_event_port_conf *port_conf);
169 * Setup an event port.
172 * Event device pointer
176 * Event port configuration structure
179 * Returns 0 on success.
181 typedef int (*eventdev_port_setup_t)(struct rte_eventdev *dev,
183 const struct rte_event_port_conf *port_conf);
186 * Release memory resources allocated by given event port.
192 typedef void (*eventdev_port_release_t)(void *port);
195 * Link multiple source event queues to destination event port.
200 * Points to an array of *nb_links* event queues to be linked
203 * Points to an array of *nb_links* service priorities associated with each
204 * event queue link to event port.
206 * The number of links to establish
209 * Returns 0 on success.
212 typedef int (*eventdev_port_link_t)(void *port,
213 const uint8_t queues[], const uint8_t priorities[],
217 * Unlink multiple source event queues from destination event port.
222 * An array of *nb_unlinks* event queues to be unlinked from the event port.
224 * The number of unlinks to establish
227 * Returns 0 on success.
230 typedef int (*eventdev_port_unlink_t)(void *port,
231 uint8_t queues[], uint16_t nb_unlinks);
234 * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue()
237 * Event device pointer
239 * Wait time in nanosecond
240 * @param[out] timeout_ticks
241 * Value for the *timeout_ticks* parameter in rte_event_dequeue() function
244 typedef void (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev,
245 uint64_t ns, uint64_t *timeout_ticks);
248 * Dump internal information
251 * Event device pointer
253 * A pointer to a file for output
256 typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
258 /** Event device operations function pointer table */
259 struct rte_eventdev_ops {
260 eventdev_info_get_t dev_infos_get; /**< Get device info. */
261 eventdev_configure_t dev_configure; /**< Configure device. */
262 eventdev_start_t dev_start; /**< Start device. */
263 eventdev_stop_t dev_stop; /**< Stop device. */
264 eventdev_close_t dev_close; /**< Close device. */
266 eventdev_queue_default_conf_get_t queue_def_conf;
267 /**< Get default queue configuration. */
268 eventdev_queue_setup_t queue_setup;
269 /**< Set up an event queue. */
270 eventdev_queue_release_t queue_release;
271 /**< Release an event queue. */
273 eventdev_port_default_conf_get_t port_def_conf;
274 /**< Get default port configuration. */
275 eventdev_port_setup_t port_setup;
276 /**< Set up an event port. */
277 eventdev_port_release_t port_release;
278 /**< Release an event port. */
280 eventdev_port_link_t port_link;
281 /**< Link event queues to an event port. */
282 eventdev_port_unlink_t port_unlink;
283 /**< Unlink event queues from an event port. */
284 eventdev_dequeue_timeout_ticks_t timeout_ticks;
285 /**< Converts ns to *timeout_ticks* value for rte_event_dequeue() */
286 eventdev_dump_t dump;
287 /* Dump internal information */
294 #endif /* _RTE_EVENTDEV_PMD_H_ */