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_
16 * These API are from event PMD only and user applications should not call
22 #include <rte_common.h>
23 #include <rte_compat.h>
24 #include <rte_config.h>
27 #include <rte_malloc.h>
29 #include <rte_mbuf_dyn.h>
31 #include "event_timer_adapter_pmd.h"
32 #include "rte_eventdev.h"
35 #define RTE_EDEV_LOG_ERR(...) \
36 RTE_LOG(ERR, EVENTDEV, \
37 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
38 __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
40 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
41 #define RTE_EDEV_LOG_DEBUG(...) \
42 RTE_LOG(DEBUG, EVENTDEV, \
43 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
44 __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
46 #define RTE_EDEV_LOG_DEBUG(...) (void)0
49 /* Macros to check for valid device */
50 #define RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
51 if (!rte_event_pmd_is_valid_dev((dev_id))) { \
52 RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
57 #define RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, errno, retval) do { \
58 if (!rte_event_pmd_is_valid_dev((dev_id))) { \
59 RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
65 #define RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id) do { \
66 if (!rte_event_pmd_is_valid_dev((dev_id))) { \
67 RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
72 #define RTE_EVENT_ETH_RX_ADAPTER_SW_CAP \
73 ((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | \
74 (RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ) | \
75 (RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR))
77 #define RTE_EVENT_CRYPTO_ADAPTER_SW_CAP \
78 RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA
80 /**< Ethernet Rx adapter cap to return If the packet transfers from
81 * the ethdev to eventdev use a SW service function
84 #define RTE_EVENTDEV_DETACHED (0)
85 #define RTE_EVENTDEV_ATTACHED (1)
87 #define RTE_EVENTDEV_NAME_MAX_LEN (64)
88 /**< @internal Max length of name of event PMD */
92 /** Global structure used for maintaining state of allocated event devices */
93 struct rte_eventdev_global {
94 uint8_t nb_devs; /**< Number of devices found */
99 * The data part, with no function pointers, associated with each device.
101 * This structure is safe to place in shared memory to be common among
102 * different processes in a multi-process configuration.
104 struct rte_eventdev_data {
106 /**< Socket ID where memory is allocated */
108 /**< Device ID for this instance */
110 /**< Number of event queues. */
112 /**< Number of event ports. */
113 void *ports[RTE_EVENT_MAX_PORTS_PER_DEV];
114 /**< Array of pointers to ports. */
115 struct rte_event_port_conf ports_cfg[RTE_EVENT_MAX_PORTS_PER_DEV];
116 /**< Array of port configuration structures. */
117 struct rte_event_queue_conf queues_cfg[RTE_EVENT_MAX_QUEUES_PER_DEV];
118 /**< Array of queue configuration structures. */
119 uint16_t links_map[RTE_EVENT_MAX_PORTS_PER_DEV *
120 RTE_EVENT_MAX_QUEUES_PER_DEV];
121 /**< Memory to store queues to port connections. */
123 /**< PMD-specific private data */
124 uint32_t event_dev_cap;
125 /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
126 struct rte_event_dev_config dev_conf;
127 /**< Configuration applied to device. */
128 uint8_t service_inited;
129 /* Service initialization state */
132 void *dev_stop_flush_arg;
133 /**< User-provided argument for event flush function */
136 uint8_t dev_started : 1;
137 /**< Device state: STARTED(1)/STOPPED(0) */
139 char name[RTE_EVENTDEV_NAME_MAX_LEN];
140 /**< Unique identifier name */
142 uint64_t reserved_64s[4]; /**< Reserved for future fields */
143 void *reserved_ptrs[4]; /**< Reserved for future fields */
144 } __rte_cache_aligned;
146 /** @internal The data structure associated with each event device. */
147 struct rte_eventdev {
148 struct rte_eventdev_data *data;
149 /**< Pointer to device data */
150 struct eventdev_ops *dev_ops;
151 /**< Functions exported by PMD */
152 struct rte_device *dev;
153 /**< Device info. supplied by probing */
156 uint8_t attached : 1;
157 /**< Flag indicating the device is attached */
159 event_enqueue_t enqueue;
160 /**< Pointer to PMD enqueue function. */
161 event_enqueue_burst_t enqueue_burst;
162 /**< Pointer to PMD enqueue burst function. */
163 event_enqueue_burst_t enqueue_new_burst;
164 /**< Pointer to PMD enqueue burst function(op new variant) */
165 event_enqueue_burst_t enqueue_forward_burst;
166 /**< Pointer to PMD enqueue burst function(op forward variant) */
167 event_dequeue_t dequeue;
168 /**< Pointer to PMD dequeue function. */
169 event_dequeue_burst_t dequeue_burst;
170 /**< Pointer to PMD dequeue burst function. */
171 event_maintain_t maintain;
172 /**< Pointer to PMD port maintenance function. */
173 event_tx_adapter_enqueue_t txa_enqueue_same_dest;
174 /**< Pointer to PMD eth Tx adapter burst enqueue function with
175 * events destined to same Eth port & Tx queue.
177 event_tx_adapter_enqueue_t txa_enqueue;
178 /**< Pointer to PMD eth Tx adapter enqueue function. */
179 event_crypto_adapter_enqueue_t ca_enqueue;
181 uint64_t reserved_64s[4]; /**< Reserved for future fields */
182 void *reserved_ptrs[3]; /**< Reserved for future fields */
183 } __rte_cache_aligned;
185 extern struct rte_eventdev *rte_eventdevs;
186 /** @internal The pool of rte_eventdev structures. */
189 * Get the rte_eventdev structure device pointer for the named device.
192 * device name to select the device structure.
195 * - The rte_eventdev structure pointer for the given device ID.
198 static inline struct rte_eventdev *
199 rte_event_pmd_get_named_dev(const char *name)
201 struct rte_eventdev *dev;
207 for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) {
208 dev = &rte_eventdevs[i];
209 if ((dev->attached == RTE_EVENTDEV_ATTACHED) &&
210 (strcmp(dev->data->name, name) == 0))
218 * Validate if the event device index is valid attached event device.
221 * Event device index.
224 * - If the device index is valid (1) or not (0).
227 static inline unsigned
228 rte_event_pmd_is_valid_dev(uint8_t dev_id)
230 struct rte_eventdev *dev;
232 if (dev_id >= RTE_EVENT_MAX_DEVS)
235 dev = &rte_eventdevs[dev_id];
236 if (dev->attached != RTE_EVENTDEV_ATTACHED)
243 * Definitions of all functions exported by a driver through the
244 * generic structure of type *event_dev_ops* supplied in the
245 * *rte_eventdev* structure associated with a device.
249 * Get device information of a device.
252 * Event device pointer
254 * Event device information structure
256 typedef void (*eventdev_info_get_t)(struct rte_eventdev *dev,
257 struct rte_event_dev_info *dev_info);
260 * Configure a device.
263 * Event device pointer
266 * Returns 0 on success
268 typedef int (*eventdev_configure_t)(const struct rte_eventdev *dev);
271 * Start a configured device.
274 * Event device pointer
277 * Returns 0 on success
279 typedef int (*eventdev_start_t)(struct rte_eventdev *dev);
282 * Stop a configured device.
285 * Event device pointer
287 typedef void (*eventdev_stop_t)(struct rte_eventdev *dev);
290 * Close a configured device.
293 * Event device pointer
297 * - (-EAGAIN) if can't close as device is busy
299 typedef int (*eventdev_close_t)(struct rte_eventdev *dev);
302 * Retrieve the default event queue configuration.
305 * Event device pointer
308 * @param[out] queue_conf
309 * Event queue configuration structure
312 typedef void (*eventdev_queue_default_conf_get_t)(struct rte_eventdev *dev,
313 uint8_t queue_id, struct rte_event_queue_conf *queue_conf);
316 * Setup an event queue.
319 * Event device pointer
323 * Event queue configuration structure
326 * Returns 0 on success.
328 typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
330 const struct rte_event_queue_conf *queue_conf);
333 * Release resources allocated by given event queue.
336 * Event device pointer
341 typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
345 * Retrieve the default event port configuration.
348 * Event device pointer
351 * @param[out] port_conf
352 * Event port configuration structure
355 typedef void (*eventdev_port_default_conf_get_t)(struct rte_eventdev *dev,
356 uint8_t port_id, struct rte_event_port_conf *port_conf);
359 * Setup an event port.
362 * Event device pointer
366 * Event port configuration structure
369 * Returns 0 on success.
371 typedef int (*eventdev_port_setup_t)(struct rte_eventdev *dev,
373 const struct rte_event_port_conf *port_conf);
376 * Release memory resources allocated by given event port.
382 typedef void (*eventdev_port_release_t)(void *port);
385 * Link multiple source event queues to destination event port.
388 * Event device pointer
392 * Points to an array of *nb_links* event queues to be linked
395 * Points to an array of *nb_links* service priorities associated with each
396 * event queue link to event port.
398 * The number of links to establish
401 * Returns 0 on success.
404 typedef int (*eventdev_port_link_t)(struct rte_eventdev *dev, void *port,
405 const uint8_t queues[], const uint8_t priorities[],
409 * Unlink multiple source event queues from destination event port.
412 * Event device pointer
416 * An array of *nb_unlinks* event queues to be unlinked from the event port.
418 * The number of unlinks to establish
421 * Returns 0 on success.
424 typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port,
425 uint8_t queues[], uint16_t nb_unlinks);
428 * Unlinks in progress. Returns number of unlinks that the PMD is currently
429 * performing, but have not yet been completed.
432 * Event device pointer
438 * Returns the number of in-progress unlinks. Zero is returned if none are
441 typedef int (*eventdev_port_unlinks_in_progress_t)(struct rte_eventdev *dev,
445 * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue()
448 * Event device pointer
450 * Wait time in nanosecond
451 * @param[out] timeout_ticks
452 * Value for the *timeout_ticks* parameter in rte_event_dequeue() function
455 * Returns 0 on success.
458 typedef int (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev,
459 uint64_t ns, uint64_t *timeout_ticks);
462 * Dump internal information
465 * Event device pointer
467 * A pointer to a file for output
470 typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
473 * Retrieve a set of statistics from device
476 * Event device pointer
478 * Level (device, port or queue)
479 * @param queue_port_id
480 * Queue or port number depending on mode
482 * The stat ids to retrieve
484 * The returned stat values
486 * The number of id values and entries in the values array
488 * The number of stat values successfully filled into the values array
490 typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
491 enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
492 const unsigned int ids[], uint64_t values[], unsigned int n);
495 * Resets the statistic values in xstats for the device, based on mode.
497 typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
498 enum rte_event_dev_xstats_mode mode,
499 int16_t queue_port_id,
500 const uint32_t ids[],
504 * Get names of extended stats of an event device
507 * Event device pointer
509 * Level (device, port or queue)
510 * @param queue_port_id
511 * Queue or port number depending on mode
512 * @param xstats_names
513 * Array of name values to be filled in
515 * The stat ids to retrieve
517 * Number of values in the xstats_names array
519 * When size >= the number of stats, return the number of stat values filled
521 * When size < the number of available stats, return the number of stats
522 * values, and do not fill in any data into xstats_names.
524 typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
525 enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
526 struct rte_event_dev_xstats_name *xstats_names,
527 unsigned int *ids, unsigned int size);
530 * Get value of one stats and optionally return its id
533 * Event device pointer
535 * The name of the stat to retrieve
537 * Pointer to an unsigned int where we store the stat-id for future reference.
538 * This pointer may be null if the id is not required.
540 * The value of the stat, or (uint64_t)-1 if the stat is not found.
541 * If the stat is not found, the id value will be returned as (unsigned)-1,
542 * if id pointer is non-NULL
544 typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
545 const char *name, unsigned int *id);
549 * Retrieve the event device's ethdev Rx adapter capabilities for the
550 * specified ethernet port
553 * Event device pointer
556 * Ethernet device pointer
559 * A pointer to memory filled with Rx event adapter capabilities.
562 * - 0: Success, driver provides Rx event adapter capabilities for the
564 * - <0: Error code returned by the driver function.
567 typedef int (*eventdev_eth_rx_adapter_caps_get_t)
568 (const struct rte_eventdev *dev,
569 const struct rte_eth_dev *eth_dev,
572 struct rte_event_eth_rx_adapter_queue_conf;
575 * Retrieve the event device's timer adapter capabilities, as well as the ops
576 * structure that an event timer adapter should call through to enter the
580 * Event device pointer
583 * Flags that can be used to determine how to select an event timer
584 * adapter ops structure
587 * A pointer to memory filled with Rx event adapter capabilities.
590 * A pointer to the ops pointer to set with the address of the desired ops
594 * - 0: Success, driver provides Rx event adapter capabilities for the
596 * - <0: Error code returned by the driver function.
599 typedef int (*eventdev_timer_adapter_caps_get_t)(
600 const struct rte_eventdev *dev, uint64_t flags, uint32_t *caps,
601 const struct event_timer_adapter_ops **ops);
604 * Add ethernet Rx queues to event device. This callback is invoked if
605 * the caps returned from rte_eventdev_eth_rx_adapter_caps_get(, eth_port_id)
606 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set.
609 * Event device pointer
612 * Ethernet device pointer
615 * Ethernet device receive queue index
618 * Additional configuration structure
621 * - 0: Success, ethernet receive queue added successfully.
622 * - <0: Error code returned by the driver function.
625 typedef int (*eventdev_eth_rx_adapter_queue_add_t)(
626 const struct rte_eventdev *dev,
627 const struct rte_eth_dev *eth_dev,
629 const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
632 * Delete ethernet Rx queues from event device. This callback is invoked if
633 * the caps returned from eventdev_eth_rx_adapter_caps_get(, eth_port_id)
634 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set.
637 * Event device pointer
640 * Ethernet device pointer
643 * Ethernet device receive queue index
646 * - 0: Success, ethernet receive queue deleted successfully.
647 * - <0: Error code returned by the driver function.
650 typedef int (*eventdev_eth_rx_adapter_queue_del_t)
651 (const struct rte_eventdev *dev,
652 const struct rte_eth_dev *eth_dev,
653 int32_t rx_queue_id);
656 * Retrieve Rx adapter queue config information for the specified
660 * Event device pointer
663 * Ethernet device pointer
666 * Ethernet device receive queue index.
668 * @param[out] queue_conf
669 * Pointer to rte_event_eth_rx_adapter_queue_conf structure
673 * - <0: Error code on failure.
675 typedef int (*eventdev_eth_rx_adapter_queue_conf_get_t)
676 (const struct rte_eventdev *dev,
677 const struct rte_eth_dev *eth_dev,
678 uint16_t rx_queue_id,
679 struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
682 * Start ethernet Rx adapter. This callback is invoked if
683 * the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
684 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set and Rx queues
685 * from eth_port_id have been added to the event device.
688 * Event device pointer
691 * Ethernet device pointer
694 * - 0: Success, ethernet Rx adapter started successfully.
695 * - <0: Error code returned by the driver function.
697 typedef int (*eventdev_eth_rx_adapter_start_t)
698 (const struct rte_eventdev *dev,
699 const struct rte_eth_dev *eth_dev);
702 * Stop ethernet Rx adapter. This callback is invoked if
703 * the caps returned from eventdev_eth_rx_adapter_caps_get(..,eth_port_id)
704 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set and Rx queues
705 * from eth_port_id have been added to the event device.
708 * Event device pointer
711 * Ethernet device pointer
714 * - 0: Success, ethernet Rx adapter stopped successfully.
715 * - <0: Error code returned by the driver function.
717 typedef int (*eventdev_eth_rx_adapter_stop_t)
718 (const struct rte_eventdev *dev,
719 const struct rte_eth_dev *eth_dev);
721 struct rte_event_eth_rx_adapter_stats;
724 * Retrieve ethernet Rx adapter statistics.
727 * Event device pointer
730 * Ethernet device pointer
733 * Pointer to stats structure
736 * Return 0 on success.
739 typedef int (*eventdev_eth_rx_adapter_stats_get)
740 (const struct rte_eventdev *dev,
741 const struct rte_eth_dev *eth_dev,
742 struct rte_event_eth_rx_adapter_stats *stats);
744 * Reset ethernet Rx adapter statistics.
747 * Event device pointer
750 * Ethernet device pointer
753 * Return 0 on success.
755 typedef int (*eventdev_eth_rx_adapter_stats_reset)
756 (const struct rte_eventdev *dev,
757 const struct rte_eth_dev *eth_dev);
759 struct rte_event_eth_rx_adapter_queue_stats;
762 * Retrieve ethernet Rx adapter queue statistics.
765 * Event device pointer
768 * Ethernet device pointer
771 * Ethernet device receive queue index.
773 * @param[out] q_stats
774 * Pointer to queue stats structure
777 * Return 0 on success.
779 typedef int (*eventdev_eth_rx_adapter_q_stats_get)
780 (const struct rte_eventdev *dev,
781 const struct rte_eth_dev *eth_dev,
782 uint16_t rx_queue_id,
783 struct rte_event_eth_rx_adapter_queue_stats *q_stats);
786 * Reset ethernet Rx adapter queue statistics.
789 * Event device pointer
792 * Ethernet device pointer
795 * Ethernet device receive queue index.
798 * Return 0 on success.
800 typedef int (*eventdev_eth_rx_adapter_q_stats_reset)
801 (const struct rte_eventdev *dev,
802 const struct rte_eth_dev *eth_dev,
803 uint16_t rx_queue_id);
806 * Start eventdev selftest.
809 * Return 0 on success.
811 typedef int (*eventdev_selftest)(void);
813 struct rte_event_eth_rx_adapter_vector_limits;
815 * Get event vector limits for a given event, ethernet device pair.
818 * Event device pointer
821 * Ethernet device pointer
824 * Pointer to the limits structure to be filled.
828 * - <0: Error code returned by the driver function.
830 typedef int (*eventdev_eth_rx_adapter_vector_limits_get_t)(
831 const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev,
832 struct rte_event_eth_rx_adapter_vector_limits *limits);
834 typedef uint32_t rte_event_pmd_selftest_seqn_t;
835 extern int rte_event_pmd_selftest_seqn_dynfield_offset;
838 * Read test sequence number from mbuf.
840 * @param mbuf Structure to read from.
841 * @return pointer to test sequence number.
844 static inline rte_event_pmd_selftest_seqn_t *
845 rte_event_pmd_selftest_seqn(struct rte_mbuf *mbuf)
847 return RTE_MBUF_DYNFIELD(mbuf,
848 rte_event_pmd_selftest_seqn_dynfield_offset,
849 rte_event_pmd_selftest_seqn_t *);
852 struct rte_cryptodev;
855 * This API may change without prior notice
857 * Retrieve the event device's crypto adapter capabilities for the
858 * specified cryptodev
861 * Event device pointer
867 * A pointer to memory filled with event adapter capabilities.
868 * It is expected to be pre-allocated & initialized by caller.
871 * - 0: Success, driver provides event adapter capabilities for the
873 * - <0: Error code returned by the driver function.
876 typedef int (*eventdev_crypto_adapter_caps_get_t)
877 (const struct rte_eventdev *dev,
878 const struct rte_cryptodev *cdev,
882 * This API may change without prior notice
884 * Add crypto queue pair to event device. This callback is invoked if
885 * the caps returned from rte_event_crypto_adapter_caps_get(, cdev_id)
886 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set.
889 * Event device pointer
894 * @param queue_pair_id
895 * cryptodev queue pair identifier.
898 * Event information required for binding cryptodev queue pair to event queue.
899 * This structure will have a valid value for only those HW PMDs supporting
900 * @see RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND capability.
903 * - 0: Success, cryptodev queue pair added successfully.
904 * - <0: Error code returned by the driver function.
907 typedef int (*eventdev_crypto_adapter_queue_pair_add_t)
908 (const struct rte_eventdev *dev,
909 const struct rte_cryptodev *cdev,
910 int32_t queue_pair_id,
911 const struct rte_event *event);
915 * This API may change without prior notice
917 * Delete crypto queue pair to event device. This callback is invoked if
918 * the caps returned from rte_event_crypto_adapter_caps_get(, cdev_id)
919 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set.
922 * Event device pointer
927 * @param queue_pair_id
928 * cryptodev queue pair identifier.
931 * - 0: Success, cryptodev queue pair deleted successfully.
932 * - <0: Error code returned by the driver function.
935 typedef int (*eventdev_crypto_adapter_queue_pair_del_t)
936 (const struct rte_eventdev *dev,
937 const struct rte_cryptodev *cdev,
938 int32_t queue_pair_id);
941 * Start crypto adapter. This callback is invoked if
942 * the caps returned from rte_event_crypto_adapter_caps_get(.., cdev_id)
943 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set and queue pairs
944 * from cdev_id have been added to the event device.
947 * Event device pointer
950 * Crypto device pointer
953 * - 0: Success, crypto adapter started successfully.
954 * - <0: Error code returned by the driver function.
956 typedef int (*eventdev_crypto_adapter_start_t)
957 (const struct rte_eventdev *dev,
958 const struct rte_cryptodev *cdev);
961 * Stop crypto adapter. This callback is invoked if
962 * the caps returned from rte_event_crypto_adapter_caps_get(.., cdev_id)
963 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set and queue pairs
964 * from cdev_id have been added to the event device.
967 * Event device pointer
970 * Crypto device pointer
973 * - 0: Success, crypto adapter stopped successfully.
974 * - <0: Error code returned by the driver function.
976 typedef int (*eventdev_crypto_adapter_stop_t)
977 (const struct rte_eventdev *dev,
978 const struct rte_cryptodev *cdev);
980 struct rte_event_crypto_adapter_stats;
983 * Retrieve crypto adapter statistics.
986 * Event device pointer
989 * Crypto device pointer
992 * Pointer to stats structure
995 * Return 0 on success.
998 typedef int (*eventdev_crypto_adapter_stats_get)
999 (const struct rte_eventdev *dev,
1000 const struct rte_cryptodev *cdev,
1001 struct rte_event_crypto_adapter_stats *stats);
1004 * Reset crypto adapter statistics.
1007 * Event device pointer
1010 * Crypto device pointer
1013 * Return 0 on success.
1016 typedef int (*eventdev_crypto_adapter_stats_reset)
1017 (const struct rte_eventdev *dev,
1018 const struct rte_cryptodev *cdev);
1021 * Retrieve the event device's eth Tx adapter capabilities.
1024 * Event device pointer
1027 * Ethernet device pointer
1030 * A pointer to memory filled with eth Tx adapter capabilities.
1033 * - 0: Success, driver provides eth Tx adapter capabilities
1034 * - <0: Error code returned by the driver function.
1037 typedef int (*eventdev_eth_tx_adapter_caps_get_t)
1038 (const struct rte_eventdev *dev,
1039 const struct rte_eth_dev *eth_dev,
1043 * Create adapter callback.
1046 * Adapter identifier
1049 * Event device pointer
1053 * - <0: Error code on failure.
1055 typedef int (*eventdev_eth_tx_adapter_create_t)(uint8_t id,
1056 const struct rte_eventdev *dev);
1059 * Free adapter callback.
1062 * Adapter identifier
1065 * Event device pointer
1069 * - <0: Error code on failure.
1071 typedef int (*eventdev_eth_tx_adapter_free_t)(uint8_t id,
1072 const struct rte_eventdev *dev);
1075 * Add a Tx queue to the adapter.
1076 * A queue value of -1 is used to indicate all
1077 * queues within the device.
1080 * Adapter identifier
1083 * Event device pointer
1086 * Ethernet device pointer
1088 * @param tx_queue_id
1089 * Transmit queue index
1093 * - <0: Error code on failure.
1095 typedef int (*eventdev_eth_tx_adapter_queue_add_t)(
1097 const struct rte_eventdev *dev,
1098 const struct rte_eth_dev *eth_dev,
1099 int32_t tx_queue_id);
1102 * Delete a Tx queue from the adapter.
1103 * A queue value of -1 is used to indicate all
1104 * queues within the device, that have been added to this
1108 * Adapter identifier
1111 * Event device pointer
1114 * Ethernet device pointer
1116 * @param tx_queue_id
1117 * Transmit queue index
1120 * - 0: Success, Queues deleted successfully.
1121 * - <0: Error code on failure.
1123 typedef int (*eventdev_eth_tx_adapter_queue_del_t)(
1125 const struct rte_eventdev *dev,
1126 const struct rte_eth_dev *eth_dev,
1127 int32_t tx_queue_id);
1130 * Start the adapter.
1133 * Adapter identifier
1136 * Event device pointer
1139 * - 0: Success, Adapter started correctly.
1140 * - <0: Error code on failure.
1142 typedef int (*eventdev_eth_tx_adapter_start_t)(uint8_t id,
1143 const struct rte_eventdev *dev);
1149 * Adapter identifier
1152 * Event device pointer
1156 * - <0: Error code on failure.
1158 typedef int (*eventdev_eth_tx_adapter_stop_t)(uint8_t id,
1159 const struct rte_eventdev *dev);
1161 struct rte_event_eth_tx_adapter_stats;
1164 * Retrieve statistics for an adapter
1167 * Adapter identifier
1170 * Event device pointer
1172 * @param [out] stats
1173 * A pointer to structure used to retrieve statistics for an adapter
1176 * - 0: Success, statistics retrieved successfully.
1177 * - <0: Error code on failure.
1179 typedef int (*eventdev_eth_tx_adapter_stats_get_t)(
1181 const struct rte_eventdev *dev,
1182 struct rte_event_eth_tx_adapter_stats *stats);
1185 * Reset statistics for an adapter
1188 * Adapter identifier
1191 * Event device pointer
1194 * - 0: Success, statistics retrieved successfully.
1195 * - <0: Error code on failure.
1197 typedef int (*eventdev_eth_tx_adapter_stats_reset_t)(uint8_t id,
1198 const struct rte_eventdev *dev);
1200 /** Event device operations function pointer table */
1201 struct eventdev_ops {
1202 eventdev_info_get_t dev_infos_get; /**< Get device info. */
1203 eventdev_configure_t dev_configure; /**< Configure device. */
1204 eventdev_start_t dev_start; /**< Start device. */
1205 eventdev_stop_t dev_stop; /**< Stop device. */
1206 eventdev_close_t dev_close; /**< Close device. */
1208 eventdev_queue_default_conf_get_t queue_def_conf;
1209 /**< Get default queue configuration. */
1210 eventdev_queue_setup_t queue_setup;
1211 /**< Set up an event queue. */
1212 eventdev_queue_release_t queue_release;
1213 /**< Release an event queue. */
1215 eventdev_port_default_conf_get_t port_def_conf;
1216 /**< Get default port configuration. */
1217 eventdev_port_setup_t port_setup;
1218 /**< Set up an event port. */
1219 eventdev_port_release_t port_release;
1220 /**< Release an event port. */
1222 eventdev_port_link_t port_link;
1223 /**< Link event queues to an event port. */
1224 eventdev_port_unlink_t port_unlink;
1225 /**< Unlink event queues from an event port. */
1226 eventdev_port_unlinks_in_progress_t port_unlinks_in_progress;
1227 /**< Unlinks in progress on an event port. */
1228 eventdev_dequeue_timeout_ticks_t timeout_ticks;
1229 /**< Converts ns to *timeout_ticks* value for rte_event_dequeue() */
1230 eventdev_dump_t dump;
1231 /* Dump internal information */
1233 eventdev_xstats_get_t xstats_get;
1234 /**< Get extended device statistics. */
1235 eventdev_xstats_get_names_t xstats_get_names;
1236 /**< Get names of extended stats. */
1237 eventdev_xstats_get_by_name xstats_get_by_name;
1238 /**< Get one value by name. */
1239 eventdev_xstats_reset_t xstats_reset;
1240 /**< Reset the statistics values in xstats. */
1242 eventdev_eth_rx_adapter_caps_get_t eth_rx_adapter_caps_get;
1243 /**< Get ethernet Rx adapter capabilities */
1244 eventdev_eth_rx_adapter_queue_add_t eth_rx_adapter_queue_add;
1245 /**< Add Rx queues to ethernet Rx adapter */
1246 eventdev_eth_rx_adapter_queue_del_t eth_rx_adapter_queue_del;
1247 /**< Delete Rx queues from ethernet Rx adapter */
1248 eventdev_eth_rx_adapter_queue_conf_get_t eth_rx_adapter_queue_conf_get;
1249 /**< Get Rx adapter queue info */
1250 eventdev_eth_rx_adapter_start_t eth_rx_adapter_start;
1251 /**< Start ethernet Rx adapter */
1252 eventdev_eth_rx_adapter_stop_t eth_rx_adapter_stop;
1253 /**< Stop ethernet Rx adapter */
1254 eventdev_eth_rx_adapter_stats_get eth_rx_adapter_stats_get;
1255 /**< Get ethernet Rx stats */
1256 eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset;
1257 /**< Reset ethernet Rx stats */
1258 eventdev_eth_rx_adapter_vector_limits_get_t
1259 eth_rx_adapter_vector_limits_get;
1260 /**< Get event vector limits for the Rx adapter */
1262 eventdev_timer_adapter_caps_get_t timer_adapter_caps_get;
1263 /**< Get timer adapter capabilities */
1265 eventdev_crypto_adapter_caps_get_t crypto_adapter_caps_get;
1266 /**< Get crypto adapter capabilities */
1267 eventdev_crypto_adapter_queue_pair_add_t crypto_adapter_queue_pair_add;
1268 /**< Add queue pair to crypto adapter */
1269 eventdev_crypto_adapter_queue_pair_del_t crypto_adapter_queue_pair_del;
1270 /**< Delete queue pair from crypto adapter */
1271 eventdev_crypto_adapter_start_t crypto_adapter_start;
1272 /**< Start crypto adapter */
1273 eventdev_crypto_adapter_stop_t crypto_adapter_stop;
1274 /**< Stop crypto adapter */
1275 eventdev_crypto_adapter_stats_get crypto_adapter_stats_get;
1276 /**< Get crypto stats */
1277 eventdev_crypto_adapter_stats_reset crypto_adapter_stats_reset;
1278 /**< Reset crypto stats */
1280 eventdev_eth_rx_adapter_q_stats_get eth_rx_adapter_queue_stats_get;
1281 /**< Get ethernet Rx queue stats */
1282 eventdev_eth_rx_adapter_q_stats_reset eth_rx_adapter_queue_stats_reset;
1283 /**< Reset ethernet Rx queue stats */
1285 eventdev_eth_tx_adapter_caps_get_t eth_tx_adapter_caps_get;
1286 /**< Get ethernet Tx adapter capabilities */
1288 eventdev_eth_tx_adapter_create_t eth_tx_adapter_create;
1289 /**< Create adapter callback */
1290 eventdev_eth_tx_adapter_free_t eth_tx_adapter_free;
1291 /**< Free adapter callback */
1292 eventdev_eth_tx_adapter_queue_add_t eth_tx_adapter_queue_add;
1293 /**< Add Tx queues to the eth Tx adapter */
1294 eventdev_eth_tx_adapter_queue_del_t eth_tx_adapter_queue_del;
1295 /**< Delete Tx queues from the eth Tx adapter */
1296 eventdev_eth_tx_adapter_start_t eth_tx_adapter_start;
1297 /**< Start eth Tx adapter */
1298 eventdev_eth_tx_adapter_stop_t eth_tx_adapter_stop;
1299 /**< Stop eth Tx adapter */
1300 eventdev_eth_tx_adapter_stats_get_t eth_tx_adapter_stats_get;
1301 /**< Get eth Tx adapter statistics */
1302 eventdev_eth_tx_adapter_stats_reset_t eth_tx_adapter_stats_reset;
1303 /**< Reset eth Tx adapter statistics */
1305 eventdev_selftest dev_selftest;
1306 /**< Start eventdev Selftest */
1308 eventdev_stop_flush_t dev_stop_flush;
1309 /**< User-provided event flush function */
1313 * Allocates a new eventdev slot for an event device and returns the pointer
1314 * to that slot for the driver to use.
1317 * Unique identifier name for each device
1319 * Socket to allocate resources on.
1321 * - Slot in the rte_dev_devices array for a new device;
1324 struct rte_eventdev *
1325 rte_event_pmd_allocate(const char *name, int socket_id);
1328 * Release the specified eventdev device.
1331 * The *eventdev* pointer is the address of the *rte_eventdev* structure.
1333 * - 0 on success, negative on error
1337 rte_event_pmd_release(struct rte_eventdev *eventdev);
1342 * This is the last step of device probing.
1343 * It must be called after a port is allocated and initialized successfully.
1350 event_dev_probing_finish(struct rte_eventdev *eventdev);
1353 * Reset eventdevice fastpath APIs to dummy values.
1356 * The *fp_ops* pointer to reset.
1360 event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op);
1363 * Set eventdevice fastpath APIs to event device values.
1366 * The *fp_ops* pointer to set.
1370 event_dev_fp_ops_set(struct rte_event_fp_ops *fp_ops,
1371 const struct rte_eventdev *dev);
1377 #endif /* _RTE_EVENTDEV_PMD_H_ */