1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016 Cavium, Inc
5 #ifndef _RTE_EVENTDEV_PMD_H_
6 #define _RTE_EVENTDEV_PMD_H_
12 * These API are from event PMD only and user applications should not call
18 #include <rte_common.h>
19 #include <rte_compat.h>
20 #include <rte_config.h>
23 #include <rte_malloc.h>
25 #include <rte_mbuf_dyn.h>
27 #include "event_timer_adapter_pmd.h"
28 #include "rte_eventdev.h"
31 #define RTE_EDEV_LOG_ERR(...) \
32 RTE_LOG(ERR, EVENTDEV, \
33 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
34 __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
36 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
37 #define RTE_EDEV_LOG_DEBUG(...) \
38 RTE_LOG(DEBUG, EVENTDEV, \
39 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
40 __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
42 #define RTE_EDEV_LOG_DEBUG(...) (void)0
45 /* Macros to check for valid device */
46 #define RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
47 if (!rte_event_pmd_is_valid_dev((dev_id))) { \
48 RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
53 #define RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, errno, retval) do { \
54 if (!rte_event_pmd_is_valid_dev((dev_id))) { \
55 RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
61 #define RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id) do { \
62 if (!rte_event_pmd_is_valid_dev((dev_id))) { \
63 RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
68 #define RTE_EVENT_ETH_RX_ADAPTER_SW_CAP \
69 ((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | \
70 (RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ) | \
71 (RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR))
73 #define RTE_EVENT_CRYPTO_ADAPTER_SW_CAP \
74 RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA
76 /**< Ethernet Rx adapter cap to return If the packet transfers from
77 * the ethdev to eventdev use a SW service function
80 #define RTE_EVENTDEV_DETACHED (0)
81 #define RTE_EVENTDEV_ATTACHED (1)
83 #define RTE_EVENTDEV_NAME_MAX_LEN (64)
84 /**< @internal Max length of name of event PMD */
88 /** Global structure used for maintaining state of allocated event devices */
89 struct rte_eventdev_global {
90 uint8_t nb_devs; /**< Number of devices found */
95 * The data part, with no function pointers, associated with each device.
97 * This structure is safe to place in shared memory to be common among
98 * different processes in a multi-process configuration.
100 struct rte_eventdev_data {
102 /**< Socket ID where memory is allocated */
104 /**< Device ID for this instance */
106 /**< Number of event queues. */
108 /**< Number of event ports. */
109 void *ports[RTE_EVENT_MAX_PORTS_PER_DEV];
110 /**< Array of pointers to ports. */
111 struct rte_event_port_conf ports_cfg[RTE_EVENT_MAX_PORTS_PER_DEV];
112 /**< Array of port configuration structures. */
113 struct rte_event_queue_conf queues_cfg[RTE_EVENT_MAX_QUEUES_PER_DEV];
114 /**< Array of queue configuration structures. */
115 uint16_t links_map[RTE_EVENT_MAX_PORTS_PER_DEV *
116 RTE_EVENT_MAX_QUEUES_PER_DEV];
117 /**< Memory to store queues to port connections. */
119 /**< PMD-specific private data */
120 uint32_t event_dev_cap;
121 /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
122 struct rte_event_dev_config dev_conf;
123 /**< Configuration applied to device. */
124 uint8_t service_inited;
125 /* Service initialization state */
128 void *dev_stop_flush_arg;
129 /**< User-provided argument for event flush function */
132 uint8_t dev_started : 1;
133 /**< Device state: STARTED(1)/STOPPED(0) */
135 char name[RTE_EVENTDEV_NAME_MAX_LEN];
136 /**< Unique identifier name */
138 uint64_t reserved_64s[4]; /**< Reserved for future fields */
139 void *reserved_ptrs[4]; /**< Reserved for future fields */
140 } __rte_cache_aligned;
142 /** @internal The data structure associated with each event device. */
143 struct rte_eventdev {
144 struct rte_eventdev_data *data;
145 /**< Pointer to device data */
146 struct eventdev_ops *dev_ops;
147 /**< Functions exported by PMD */
148 struct rte_device *dev;
149 /**< Device info. supplied by probing */
152 uint8_t attached : 1;
153 /**< Flag indicating the device is attached */
155 event_enqueue_t enqueue;
156 /**< Pointer to PMD enqueue function. */
157 event_enqueue_burst_t enqueue_burst;
158 /**< Pointer to PMD enqueue burst function. */
159 event_enqueue_burst_t enqueue_new_burst;
160 /**< Pointer to PMD enqueue burst function(op new variant) */
161 event_enqueue_burst_t enqueue_forward_burst;
162 /**< Pointer to PMD enqueue burst function(op forward variant) */
163 event_dequeue_t dequeue;
164 /**< Pointer to PMD dequeue function. */
165 event_dequeue_burst_t dequeue_burst;
166 /**< Pointer to PMD dequeue burst function. */
167 event_tx_adapter_enqueue_t txa_enqueue_same_dest;
168 /**< Pointer to PMD eth Tx adapter burst enqueue function with
169 * events destined to same Eth port & Tx queue.
171 event_tx_adapter_enqueue_t txa_enqueue;
172 /**< Pointer to PMD eth Tx adapter enqueue function. */
173 event_crypto_adapter_enqueue_t ca_enqueue;
175 uint64_t reserved_64s[4]; /**< Reserved for future fields */
176 void *reserved_ptrs[3]; /**< Reserved for future fields */
177 } __rte_cache_aligned;
179 extern struct rte_eventdev *rte_eventdevs;
180 /** @internal The pool of rte_eventdev structures. */
183 * Get the rte_eventdev structure device pointer for the named device.
186 * device name to select the device structure.
189 * - The rte_eventdev structure pointer for the given device ID.
192 static inline struct rte_eventdev *
193 rte_event_pmd_get_named_dev(const char *name)
195 struct rte_eventdev *dev;
201 for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) {
202 dev = &rte_eventdevs[i];
203 if ((dev->attached == RTE_EVENTDEV_ATTACHED) &&
204 (strcmp(dev->data->name, name) == 0))
212 * Validate if the event device index is valid attached event device.
215 * Event device index.
218 * - If the device index is valid (1) or not (0).
221 static inline unsigned
222 rte_event_pmd_is_valid_dev(uint8_t dev_id)
224 struct rte_eventdev *dev;
226 if (dev_id >= RTE_EVENT_MAX_DEVS)
229 dev = &rte_eventdevs[dev_id];
230 if (dev->attached != RTE_EVENTDEV_ATTACHED)
237 * Definitions of all functions exported by a driver through the
238 * the generic structure of type *event_dev_ops* supplied in the
239 * *rte_eventdev* structure associated with a device.
243 * Get device information of a device.
246 * Event device pointer
248 * Event device information structure
250 typedef void (*eventdev_info_get_t)(struct rte_eventdev *dev,
251 struct rte_event_dev_info *dev_info);
254 * Configure a device.
257 * Event device pointer
260 * Returns 0 on success
262 typedef int (*eventdev_configure_t)(const struct rte_eventdev *dev);
265 * Start a configured device.
268 * Event device pointer
271 * Returns 0 on success
273 typedef int (*eventdev_start_t)(struct rte_eventdev *dev);
276 * Stop a configured device.
279 * Event device pointer
281 typedef void (*eventdev_stop_t)(struct rte_eventdev *dev);
284 * Close a configured device.
287 * Event device pointer
291 * - (-EAGAIN) if can't close as device is busy
293 typedef int (*eventdev_close_t)(struct rte_eventdev *dev);
296 * Retrieve the default event queue configuration.
299 * Event device pointer
302 * @param[out] queue_conf
303 * Event queue configuration structure
306 typedef void (*eventdev_queue_default_conf_get_t)(struct rte_eventdev *dev,
307 uint8_t queue_id, struct rte_event_queue_conf *queue_conf);
310 * Setup an event queue.
313 * Event device pointer
317 * Event queue configuration structure
320 * Returns 0 on success.
322 typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
324 const struct rte_event_queue_conf *queue_conf);
327 * Release resources allocated by given event queue.
330 * Event device pointer
335 typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
339 * Retrieve the default event port configuration.
342 * Event device pointer
345 * @param[out] port_conf
346 * Event port configuration structure
349 typedef void (*eventdev_port_default_conf_get_t)(struct rte_eventdev *dev,
350 uint8_t port_id, struct rte_event_port_conf *port_conf);
353 * Setup an event port.
356 * Event device pointer
360 * Event port configuration structure
363 * Returns 0 on success.
365 typedef int (*eventdev_port_setup_t)(struct rte_eventdev *dev,
367 const struct rte_event_port_conf *port_conf);
370 * Release memory resources allocated by given event port.
376 typedef void (*eventdev_port_release_t)(void *port);
379 * Link multiple source event queues to destination event port.
382 * Event device pointer
386 * Points to an array of *nb_links* event queues to be linked
389 * Points to an array of *nb_links* service priorities associated with each
390 * event queue link to event port.
392 * The number of links to establish
395 * Returns 0 on success.
398 typedef int (*eventdev_port_link_t)(struct rte_eventdev *dev, void *port,
399 const uint8_t queues[], const uint8_t priorities[],
403 * Unlink multiple source event queues from destination event port.
406 * Event device pointer
410 * An array of *nb_unlinks* event queues to be unlinked from the event port.
412 * The number of unlinks to establish
415 * Returns 0 on success.
418 typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port,
419 uint8_t queues[], uint16_t nb_unlinks);
422 * Unlinks in progress. Returns number of unlinks that the PMD is currently
423 * performing, but have not yet been completed.
426 * Event device pointer
432 * Returns the number of in-progress unlinks. Zero is returned if none are
435 typedef int (*eventdev_port_unlinks_in_progress_t)(struct rte_eventdev *dev,
439 * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue()
442 * Event device pointer
444 * Wait time in nanosecond
445 * @param[out] timeout_ticks
446 * Value for the *timeout_ticks* parameter in rte_event_dequeue() function
449 * Returns 0 on success.
452 typedef int (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev,
453 uint64_t ns, uint64_t *timeout_ticks);
456 * Dump internal information
459 * Event device pointer
461 * A pointer to a file for output
464 typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
467 * Retrieve a set of statistics from device
470 * Event device pointer
472 * Level (device, port or queue)
473 * @param queue_port_id
474 * Queue or port number depending on mode
476 * The stat ids to retrieve
478 * The returned stat values
480 * The number of id values and entries in the values array
482 * The number of stat values successfully filled into the values array
484 typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
485 enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
486 const unsigned int ids[], uint64_t values[], unsigned int n);
489 * Resets the statistic values in xstats for the device, based on mode.
491 typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
492 enum rte_event_dev_xstats_mode mode,
493 int16_t queue_port_id,
494 const uint32_t ids[],
498 * Get names of extended stats of an event device
501 * Event device pointer
503 * Level (device, port or queue)
504 * @param queue_port_id
505 * Queue or port number depending on mode
506 * @param xstats_names
507 * Array of name values to be filled in
509 * The stat ids to retrieve
511 * Number of values in the xstats_names array
513 * When size >= the number of stats, return the number of stat values filled
515 * When size < the number of available stats, return the number of stats
516 * values, and do not fill in any data into xstats_names.
518 typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
519 enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
520 struct rte_event_dev_xstats_name *xstats_names,
521 unsigned int *ids, unsigned int size);
524 * Get value of one stats and optionally return its id
527 * Event device pointer
529 * The name of the stat to retrieve
531 * Pointer to an unsigned int where we store the stat-id for future reference.
532 * This pointer may be null if the id is not required.
534 * The value of the stat, or (uint64_t)-1 if the stat is not found.
535 * If the stat is not found, the id value will be returned as (unsigned)-1,
536 * if id pointer is non-NULL
538 typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
539 const char *name, unsigned int *id);
543 * Retrieve the event device's ethdev Rx adapter capabilities for the
544 * specified ethernet port
547 * Event device pointer
550 * Ethernet device pointer
553 * A pointer to memory filled with Rx event adapter capabilities.
556 * - 0: Success, driver provides Rx event adapter capabilities for the
558 * - <0: Error code returned by the driver function.
561 typedef int (*eventdev_eth_rx_adapter_caps_get_t)
562 (const struct rte_eventdev *dev,
563 const struct rte_eth_dev *eth_dev,
566 struct rte_event_eth_rx_adapter_queue_conf;
569 * Retrieve the event device's timer adapter capabilities, as well as the ops
570 * structure that an event timer adapter should call through to enter the
574 * Event device pointer
577 * Flags that can be used to determine how to select an event timer
578 * adapter ops structure
581 * A pointer to memory filled with Rx event adapter capabilities.
584 * A pointer to the ops pointer to set with the address of the desired ops
588 * - 0: Success, driver provides Rx event adapter capabilities for the
590 * - <0: Error code returned by the driver function.
593 typedef int (*eventdev_timer_adapter_caps_get_t)(
594 const struct rte_eventdev *dev, uint64_t flags, uint32_t *caps,
595 const struct event_timer_adapter_ops **ops);
598 * Add ethernet Rx queues to event device. This callback is invoked if
599 * the caps returned from rte_eventdev_eth_rx_adapter_caps_get(, eth_port_id)
600 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set.
603 * Event device pointer
606 * Ethernet device pointer
609 * Ethernet device receive queue index
612 * Additional configuration structure
615 * - 0: Success, ethernet receive queue added successfully.
616 * - <0: Error code returned by the driver function.
619 typedef int (*eventdev_eth_rx_adapter_queue_add_t)(
620 const struct rte_eventdev *dev,
621 const struct rte_eth_dev *eth_dev,
623 const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
626 * Delete ethernet Rx queues from event device. This callback is invoked if
627 * the caps returned from eventdev_eth_rx_adapter_caps_get(, eth_port_id)
628 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set.
631 * Event device pointer
634 * Ethernet device pointer
637 * Ethernet device receive queue index
640 * - 0: Success, ethernet receive queue deleted successfully.
641 * - <0: Error code returned by the driver function.
644 typedef int (*eventdev_eth_rx_adapter_queue_del_t)
645 (const struct rte_eventdev *dev,
646 const struct rte_eth_dev *eth_dev,
647 int32_t rx_queue_id);
650 * Retrieve Rx adapter queue config information for the specified
654 * Event device pointer
657 * Ethernet device pointer
660 * Ethernet device receive queue index.
662 * @param[out] queue_conf
663 * Pointer to rte_event_eth_rx_adapter_queue_conf structure
667 * - <0: Error code on failure.
669 typedef int (*eventdev_eth_rx_adapter_queue_conf_get_t)
670 (const struct rte_eventdev *dev,
671 const struct rte_eth_dev *eth_dev,
672 uint16_t rx_queue_id,
673 struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
676 * Start ethernet Rx adapter. This callback is invoked if
677 * the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
678 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set and Rx queues
679 * from eth_port_id have been added to the event device.
682 * Event device pointer
685 * Ethernet device pointer
688 * - 0: Success, ethernet Rx adapter started successfully.
689 * - <0: Error code returned by the driver function.
691 typedef int (*eventdev_eth_rx_adapter_start_t)
692 (const struct rte_eventdev *dev,
693 const struct rte_eth_dev *eth_dev);
696 * Stop ethernet Rx adapter. This callback is invoked if
697 * the caps returned from eventdev_eth_rx_adapter_caps_get(..,eth_port_id)
698 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set and Rx queues
699 * from eth_port_id have been added to the event device.
702 * Event device pointer
705 * Ethernet device pointer
708 * - 0: Success, ethernet Rx adapter stopped successfully.
709 * - <0: Error code returned by the driver function.
711 typedef int (*eventdev_eth_rx_adapter_stop_t)
712 (const struct rte_eventdev *dev,
713 const struct rte_eth_dev *eth_dev);
715 struct rte_event_eth_rx_adapter_stats;
718 * Retrieve ethernet Rx adapter statistics.
721 * Event device pointer
724 * Ethernet device pointer
727 * Pointer to stats structure
730 * Return 0 on success.
733 typedef int (*eventdev_eth_rx_adapter_stats_get)
734 (const struct rte_eventdev *dev,
735 const struct rte_eth_dev *eth_dev,
736 struct rte_event_eth_rx_adapter_stats *stats);
738 * Reset ethernet Rx adapter statistics.
741 * Event device pointer
744 * Ethernet device pointer
747 * Return 0 on success.
749 typedef int (*eventdev_eth_rx_adapter_stats_reset)
750 (const struct rte_eventdev *dev,
751 const struct rte_eth_dev *eth_dev);
753 * Start eventdev selftest.
756 * Return 0 on success.
758 typedef int (*eventdev_selftest)(void);
760 struct rte_event_eth_rx_adapter_vector_limits;
762 * Get event vector limits for a given event, ethernet device pair.
765 * Event device pointer
768 * Ethernet device pointer
771 * Pointer to the limits structure to be filled.
775 * - <0: Error code returned by the driver function.
777 typedef int (*eventdev_eth_rx_adapter_vector_limits_get_t)(
778 const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev,
779 struct rte_event_eth_rx_adapter_vector_limits *limits);
781 typedef uint32_t rte_event_pmd_selftest_seqn_t;
782 extern int rte_event_pmd_selftest_seqn_dynfield_offset;
785 * Read test sequence number from mbuf.
787 * @param mbuf Structure to read from.
788 * @return pointer to test sequence number.
791 static inline rte_event_pmd_selftest_seqn_t *
792 rte_event_pmd_selftest_seqn(struct rte_mbuf *mbuf)
794 return RTE_MBUF_DYNFIELD(mbuf,
795 rte_event_pmd_selftest_seqn_dynfield_offset,
796 rte_event_pmd_selftest_seqn_t *);
799 struct rte_cryptodev;
802 * This API may change without prior notice
804 * Retrieve the event device's crypto adapter capabilities for the
805 * specified cryptodev
808 * Event device pointer
814 * A pointer to memory filled with event adapter capabilities.
815 * It is expected to be pre-allocated & initialized by caller.
818 * - 0: Success, driver provides event adapter capabilities for the
820 * - <0: Error code returned by the driver function.
823 typedef int (*eventdev_crypto_adapter_caps_get_t)
824 (const struct rte_eventdev *dev,
825 const struct rte_cryptodev *cdev,
829 * This API may change without prior notice
831 * Add crypto queue pair to event device. This callback is invoked if
832 * the caps returned from rte_event_crypto_adapter_caps_get(, cdev_id)
833 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set.
836 * Event device pointer
841 * @param queue_pair_id
842 * cryptodev queue pair identifier.
845 * Event information required for binding cryptodev queue pair to event queue.
846 * This structure will have a valid value for only those HW PMDs supporting
847 * @see RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND capability.
850 * - 0: Success, cryptodev queue pair added successfully.
851 * - <0: Error code returned by the driver function.
854 typedef int (*eventdev_crypto_adapter_queue_pair_add_t)
855 (const struct rte_eventdev *dev,
856 const struct rte_cryptodev *cdev,
857 int32_t queue_pair_id,
858 const struct rte_event *event);
862 * This API may change without prior notice
864 * Delete crypto queue pair to event device. This callback is invoked if
865 * the caps returned from rte_event_crypto_adapter_caps_get(, cdev_id)
866 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set.
869 * Event device pointer
874 * @param queue_pair_id
875 * cryptodev queue pair identifier.
878 * - 0: Success, cryptodev queue pair deleted successfully.
879 * - <0: Error code returned by the driver function.
882 typedef int (*eventdev_crypto_adapter_queue_pair_del_t)
883 (const struct rte_eventdev *dev,
884 const struct rte_cryptodev *cdev,
885 int32_t queue_pair_id);
888 * Start crypto adapter. This callback is invoked if
889 * the caps returned from rte_event_crypto_adapter_caps_get(.., cdev_id)
890 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set and queue pairs
891 * from cdev_id have been added to the event device.
894 * Event device pointer
897 * Crypto device pointer
900 * - 0: Success, crypto adapter started successfully.
901 * - <0: Error code returned by the driver function.
903 typedef int (*eventdev_crypto_adapter_start_t)
904 (const struct rte_eventdev *dev,
905 const struct rte_cryptodev *cdev);
908 * Stop crypto adapter. This callback is invoked if
909 * the caps returned from rte_event_crypto_adapter_caps_get(.., cdev_id)
910 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set and queue pairs
911 * from cdev_id have been added to the event device.
914 * Event device pointer
917 * Crypto device pointer
920 * - 0: Success, crypto adapter stopped successfully.
921 * - <0: Error code returned by the driver function.
923 typedef int (*eventdev_crypto_adapter_stop_t)
924 (const struct rte_eventdev *dev,
925 const struct rte_cryptodev *cdev);
927 struct rte_event_crypto_adapter_stats;
930 * Retrieve crypto adapter statistics.
933 * Event device pointer
936 * Crypto device pointer
939 * Pointer to stats structure
942 * Return 0 on success.
945 typedef int (*eventdev_crypto_adapter_stats_get)
946 (const struct rte_eventdev *dev,
947 const struct rte_cryptodev *cdev,
948 struct rte_event_crypto_adapter_stats *stats);
951 * Reset crypto adapter statistics.
954 * Event device pointer
957 * Crypto device pointer
960 * Return 0 on success.
963 typedef int (*eventdev_crypto_adapter_stats_reset)
964 (const struct rte_eventdev *dev,
965 const struct rte_cryptodev *cdev);
968 * Retrieve the event device's eth Tx adapter capabilities.
971 * Event device pointer
974 * Ethernet device pointer
977 * A pointer to memory filled with eth Tx adapter capabilities.
980 * - 0: Success, driver provides eth Tx adapter capabilities
981 * - <0: Error code returned by the driver function.
984 typedef int (*eventdev_eth_tx_adapter_caps_get_t)
985 (const struct rte_eventdev *dev,
986 const struct rte_eth_dev *eth_dev,
990 * Create adapter callback.
996 * Event device pointer
1000 * - <0: Error code on failure.
1002 typedef int (*eventdev_eth_tx_adapter_create_t)(uint8_t id,
1003 const struct rte_eventdev *dev);
1006 * Free adapter callback.
1009 * Adapter identifier
1012 * Event device pointer
1016 * - <0: Error code on failure.
1018 typedef int (*eventdev_eth_tx_adapter_free_t)(uint8_t id,
1019 const struct rte_eventdev *dev);
1022 * Add a Tx queue to the adapter.
1023 * A queue value of -1 is used to indicate all
1024 * queues within the device.
1027 * Adapter identifier
1030 * Event device pointer
1033 * Ethernet device pointer
1035 * @param tx_queue_id
1036 * Transmit queue index
1040 * - <0: Error code on failure.
1042 typedef int (*eventdev_eth_tx_adapter_queue_add_t)(
1044 const struct rte_eventdev *dev,
1045 const struct rte_eth_dev *eth_dev,
1046 int32_t tx_queue_id);
1049 * Delete a Tx queue from the adapter.
1050 * A queue value of -1 is used to indicate all
1051 * queues within the device, that have been added to this
1055 * Adapter identifier
1058 * Event device pointer
1061 * Ethernet device pointer
1063 * @param tx_queue_id
1064 * Transmit queue index
1067 * - 0: Success, Queues deleted successfully.
1068 * - <0: Error code on failure.
1070 typedef int (*eventdev_eth_tx_adapter_queue_del_t)(
1072 const struct rte_eventdev *dev,
1073 const struct rte_eth_dev *eth_dev,
1074 int32_t tx_queue_id);
1077 * Start the adapter.
1080 * Adapter identifier
1083 * Event device pointer
1086 * - 0: Success, Adapter started correctly.
1087 * - <0: Error code on failure.
1089 typedef int (*eventdev_eth_tx_adapter_start_t)(uint8_t id,
1090 const struct rte_eventdev *dev);
1096 * Adapter identifier
1099 * Event device pointer
1103 * - <0: Error code on failure.
1105 typedef int (*eventdev_eth_tx_adapter_stop_t)(uint8_t id,
1106 const struct rte_eventdev *dev);
1108 struct rte_event_eth_tx_adapter_stats;
1111 * Retrieve statistics for an adapter
1114 * Adapter identifier
1117 * Event device pointer
1119 * @param [out] stats
1120 * A pointer to structure used to retrieve statistics for an adapter
1123 * - 0: Success, statistics retrieved successfully.
1124 * - <0: Error code on failure.
1126 typedef int (*eventdev_eth_tx_adapter_stats_get_t)(
1128 const struct rte_eventdev *dev,
1129 struct rte_event_eth_tx_adapter_stats *stats);
1132 * Reset statistics for an adapter
1135 * Adapter identifier
1138 * Event device pointer
1141 * - 0: Success, statistics retrieved successfully.
1142 * - <0: Error code on failure.
1144 typedef int (*eventdev_eth_tx_adapter_stats_reset_t)(uint8_t id,
1145 const struct rte_eventdev *dev);
1147 /** Event device operations function pointer table */
1148 struct eventdev_ops {
1149 eventdev_info_get_t dev_infos_get; /**< Get device info. */
1150 eventdev_configure_t dev_configure; /**< Configure device. */
1151 eventdev_start_t dev_start; /**< Start device. */
1152 eventdev_stop_t dev_stop; /**< Stop device. */
1153 eventdev_close_t dev_close; /**< Close device. */
1155 eventdev_queue_default_conf_get_t queue_def_conf;
1156 /**< Get default queue configuration. */
1157 eventdev_queue_setup_t queue_setup;
1158 /**< Set up an event queue. */
1159 eventdev_queue_release_t queue_release;
1160 /**< Release an event queue. */
1162 eventdev_port_default_conf_get_t port_def_conf;
1163 /**< Get default port configuration. */
1164 eventdev_port_setup_t port_setup;
1165 /**< Set up an event port. */
1166 eventdev_port_release_t port_release;
1167 /**< Release an event port. */
1169 eventdev_port_link_t port_link;
1170 /**< Link event queues to an event port. */
1171 eventdev_port_unlink_t port_unlink;
1172 /**< Unlink event queues from an event port. */
1173 eventdev_port_unlinks_in_progress_t port_unlinks_in_progress;
1174 /**< Unlinks in progress on an event port. */
1175 eventdev_dequeue_timeout_ticks_t timeout_ticks;
1176 /**< Converts ns to *timeout_ticks* value for rte_event_dequeue() */
1177 eventdev_dump_t dump;
1178 /* Dump internal information */
1180 eventdev_xstats_get_t xstats_get;
1181 /**< Get extended device statistics. */
1182 eventdev_xstats_get_names_t xstats_get_names;
1183 /**< Get names of extended stats. */
1184 eventdev_xstats_get_by_name xstats_get_by_name;
1185 /**< Get one value by name. */
1186 eventdev_xstats_reset_t xstats_reset;
1187 /**< Reset the statistics values in xstats. */
1189 eventdev_eth_rx_adapter_caps_get_t eth_rx_adapter_caps_get;
1190 /**< Get ethernet Rx adapter capabilities */
1191 eventdev_eth_rx_adapter_queue_add_t eth_rx_adapter_queue_add;
1192 /**< Add Rx queues to ethernet Rx adapter */
1193 eventdev_eth_rx_adapter_queue_del_t eth_rx_adapter_queue_del;
1194 /**< Delete Rx queues from ethernet Rx adapter */
1195 eventdev_eth_rx_adapter_queue_conf_get_t eth_rx_adapter_queue_conf_get;
1196 /**< Get Rx adapter queue info */
1197 eventdev_eth_rx_adapter_start_t eth_rx_adapter_start;
1198 /**< Start ethernet Rx adapter */
1199 eventdev_eth_rx_adapter_stop_t eth_rx_adapter_stop;
1200 /**< Stop ethernet Rx adapter */
1201 eventdev_eth_rx_adapter_stats_get eth_rx_adapter_stats_get;
1202 /**< Get ethernet Rx stats */
1203 eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset;
1204 /**< Reset ethernet Rx stats */
1205 eventdev_eth_rx_adapter_vector_limits_get_t
1206 eth_rx_adapter_vector_limits_get;
1207 /**< Get event vector limits for the Rx adapter */
1209 eventdev_timer_adapter_caps_get_t timer_adapter_caps_get;
1210 /**< Get timer adapter capabilities */
1212 eventdev_crypto_adapter_caps_get_t crypto_adapter_caps_get;
1213 /**< Get crypto adapter capabilities */
1214 eventdev_crypto_adapter_queue_pair_add_t crypto_adapter_queue_pair_add;
1215 /**< Add queue pair to crypto adapter */
1216 eventdev_crypto_adapter_queue_pair_del_t crypto_adapter_queue_pair_del;
1217 /**< Delete queue pair from crypto adapter */
1218 eventdev_crypto_adapter_start_t crypto_adapter_start;
1219 /**< Start crypto adapter */
1220 eventdev_crypto_adapter_stop_t crypto_adapter_stop;
1221 /**< Stop crypto adapter */
1222 eventdev_crypto_adapter_stats_get crypto_adapter_stats_get;
1223 /**< Get crypto stats */
1224 eventdev_crypto_adapter_stats_reset crypto_adapter_stats_reset;
1225 /**< Reset crypto stats */
1227 eventdev_eth_tx_adapter_caps_get_t eth_tx_adapter_caps_get;
1228 /**< Get ethernet Tx adapter capabilities */
1230 eventdev_eth_tx_adapter_create_t eth_tx_adapter_create;
1231 /**< Create adapter callback */
1232 eventdev_eth_tx_adapter_free_t eth_tx_adapter_free;
1233 /**< Free adapter callback */
1234 eventdev_eth_tx_adapter_queue_add_t eth_tx_adapter_queue_add;
1235 /**< Add Tx queues to the eth Tx adapter */
1236 eventdev_eth_tx_adapter_queue_del_t eth_tx_adapter_queue_del;
1237 /**< Delete Tx queues from the eth Tx adapter */
1238 eventdev_eth_tx_adapter_start_t eth_tx_adapter_start;
1239 /**< Start eth Tx adapter */
1240 eventdev_eth_tx_adapter_stop_t eth_tx_adapter_stop;
1241 /**< Stop eth Tx adapter */
1242 eventdev_eth_tx_adapter_stats_get_t eth_tx_adapter_stats_get;
1243 /**< Get eth Tx adapter statistics */
1244 eventdev_eth_tx_adapter_stats_reset_t eth_tx_adapter_stats_reset;
1245 /**< Reset eth Tx adapter statistics */
1247 eventdev_selftest dev_selftest;
1248 /**< Start eventdev Selftest */
1250 eventdev_stop_flush_t dev_stop_flush;
1251 /**< User-provided event flush function */
1255 * Allocates a new eventdev slot for an event device and returns the pointer
1256 * to that slot for the driver to use.
1259 * Unique identifier name for each device
1261 * Socket to allocate resources on.
1263 * - Slot in the rte_dev_devices array for a new device;
1266 struct rte_eventdev *
1267 rte_event_pmd_allocate(const char *name, int socket_id);
1270 * Release the specified eventdev device.
1273 * The *eventdev* pointer is the address of the *rte_eventdev* structure.
1275 * - 0 on success, negative on error
1279 rte_event_pmd_release(struct rte_eventdev *eventdev);
1284 * This is the last step of device probing.
1285 * It must be called after a port is allocated and initialized successfully.
1292 event_dev_probing_finish(struct rte_eventdev *eventdev);
1295 * Reset eventdevice fastpath APIs to dummy values.
1298 * The *fp_ops* pointer to reset.
1302 event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op);
1305 * Set eventdevice fastpath APIs to event device values.
1308 * The *fp_ops* pointer to set.
1312 event_dev_fp_ops_set(struct rte_event_fp_ops *fp_ops,
1313 const struct rte_eventdev *dev);
1319 #endif /* _RTE_EVENTDEV_PMD_H_ */