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 * Set an event queue attribute at runtime.
348 * Event device pointer
352 * Event queue attribute id
354 * Event queue attribute value
358 * - <0: Error code on failure.
360 typedef int (*eventdev_queue_attr_set_t)(struct rte_eventdev *dev,
361 uint8_t queue_id, uint32_t attr_id,
362 uint64_t attr_value);
365 * Retrieve the default event port configuration.
368 * Event device pointer
371 * @param[out] port_conf
372 * Event port configuration structure
375 typedef void (*eventdev_port_default_conf_get_t)(struct rte_eventdev *dev,
376 uint8_t port_id, struct rte_event_port_conf *port_conf);
379 * Setup an event port.
382 * Event device pointer
386 * Event port configuration structure
389 * Returns 0 on success.
391 typedef int (*eventdev_port_setup_t)(struct rte_eventdev *dev,
393 const struct rte_event_port_conf *port_conf);
396 * Release memory resources allocated by given event port.
402 typedef void (*eventdev_port_release_t)(void *port);
405 * Quiesce any core specific resources consumed by the event port
408 * Event device pointer.
410 * Event port pointer.
412 * User-provided event flush function.
414 * Arguments to be passed to the user-provided event flush function.
417 typedef void (*eventdev_port_quiesce_t)(struct rte_eventdev *dev, void *port,
418 rte_eventdev_port_flush_t flush_cb,
422 * Link multiple source event queues to destination event port.
425 * Event device pointer
429 * Points to an array of *nb_links* event queues to be linked
432 * Points to an array of *nb_links* service priorities associated with each
433 * event queue link to event port.
435 * The number of links to establish
438 * Returns 0 on success.
441 typedef int (*eventdev_port_link_t)(struct rte_eventdev *dev, void *port,
442 const uint8_t queues[], const uint8_t priorities[],
446 * Unlink multiple source event queues from destination event port.
449 * Event device pointer
453 * An array of *nb_unlinks* event queues to be unlinked from the event port.
455 * The number of unlinks to establish
458 * Returns 0 on success.
461 typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port,
462 uint8_t queues[], uint16_t nb_unlinks);
465 * Unlinks in progress. Returns number of unlinks that the PMD is currently
466 * performing, but have not yet been completed.
469 * Event device pointer
475 * Returns the number of in-progress unlinks. Zero is returned if none are
478 typedef int (*eventdev_port_unlinks_in_progress_t)(struct rte_eventdev *dev,
482 * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue()
485 * Event device pointer
487 * Wait time in nanosecond
488 * @param[out] timeout_ticks
489 * Value for the *timeout_ticks* parameter in rte_event_dequeue() function
492 * Returns 0 on success.
495 typedef int (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev,
496 uint64_t ns, uint64_t *timeout_ticks);
499 * Dump internal information
502 * Event device pointer
504 * A pointer to a file for output
507 typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
510 * Retrieve a set of statistics from device
513 * Event device pointer
515 * Level (device, port or queue)
516 * @param queue_port_id
517 * Queue or port number depending on mode
519 * The stat ids to retrieve
521 * The returned stat values
523 * The number of id values and entries in the values array
525 * The number of stat values successfully filled into the values array
527 typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
528 enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
529 const unsigned int ids[], uint64_t values[], unsigned int n);
532 * Resets the statistic values in xstats for the device, based on mode.
534 typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
535 enum rte_event_dev_xstats_mode mode,
536 int16_t queue_port_id,
537 const uint32_t ids[],
541 * Get names of extended stats of an event device
544 * Event device pointer
546 * Level (device, port or queue)
547 * @param queue_port_id
548 * Queue or port number depending on mode
549 * @param xstats_names
550 * Array of name values to be filled in
552 * The stat ids to retrieve
554 * Number of values in the xstats_names array
556 * When size >= the number of stats, return the number of stat values filled
558 * When size < the number of available stats, return the number of stats
559 * values, and do not fill in any data into xstats_names.
561 typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
562 enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
563 struct rte_event_dev_xstats_name *xstats_names,
564 unsigned int *ids, unsigned int size);
567 * Get value of one stats and optionally return its id
570 * Event device pointer
572 * The name of the stat to retrieve
574 * Pointer to an unsigned int where we store the stat-id for future reference.
575 * This pointer may be null if the id is not required.
577 * The value of the stat, or (uint64_t)-1 if the stat is not found.
578 * If the stat is not found, the id value will be returned as (unsigned)-1,
579 * if id pointer is non-NULL
581 typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
582 const char *name, unsigned int *id);
586 * Retrieve the event device's ethdev Rx adapter capabilities for the
587 * specified ethernet port
590 * Event device pointer
593 * Ethernet device pointer
596 * A pointer to memory filled with Rx event adapter capabilities.
599 * - 0: Success, driver provides Rx event adapter capabilities for the
601 * - <0: Error code returned by the driver function.
604 typedef int (*eventdev_eth_rx_adapter_caps_get_t)
605 (const struct rte_eventdev *dev,
606 const struct rte_eth_dev *eth_dev,
609 struct rte_event_eth_rx_adapter_queue_conf;
612 * Retrieve the event device's timer adapter capabilities, as well as the ops
613 * structure that an event timer adapter should call through to enter the
617 * Event device pointer
620 * Flags that can be used to determine how to select an event timer
621 * adapter ops structure
624 * A pointer to memory filled with Rx event adapter capabilities.
627 * A pointer to the ops pointer to set with the address of the desired ops
631 * - 0: Success, driver provides Rx event adapter capabilities for the
633 * - <0: Error code returned by the driver function.
636 typedef int (*eventdev_timer_adapter_caps_get_t)(
637 const struct rte_eventdev *dev, uint64_t flags, uint32_t *caps,
638 const struct event_timer_adapter_ops **ops);
641 * Add ethernet Rx queues to event device. This callback is invoked if
642 * the caps returned from rte_eventdev_eth_rx_adapter_caps_get(, eth_port_id)
643 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set.
646 * Event device pointer
649 * Ethernet device pointer
652 * Ethernet device receive queue index
655 * Additional configuration structure
658 * - 0: Success, ethernet receive queue added successfully.
659 * - <0: Error code returned by the driver function.
662 typedef int (*eventdev_eth_rx_adapter_queue_add_t)(
663 const struct rte_eventdev *dev,
664 const struct rte_eth_dev *eth_dev,
666 const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
669 * Delete ethernet Rx queues from event device. This callback is invoked if
670 * the caps returned from eventdev_eth_rx_adapter_caps_get(, eth_port_id)
671 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set.
674 * Event device pointer
677 * Ethernet device pointer
680 * Ethernet device receive queue index
683 * - 0: Success, ethernet receive queue deleted successfully.
684 * - <0: Error code returned by the driver function.
687 typedef int (*eventdev_eth_rx_adapter_queue_del_t)
688 (const struct rte_eventdev *dev,
689 const struct rte_eth_dev *eth_dev,
690 int32_t rx_queue_id);
693 * Retrieve Rx adapter queue config information for the specified
697 * Event device pointer
700 * Ethernet device pointer
703 * Ethernet device receive queue index.
705 * @param[out] queue_conf
706 * Pointer to rte_event_eth_rx_adapter_queue_conf structure
710 * - <0: Error code on failure.
712 typedef int (*eventdev_eth_rx_adapter_queue_conf_get_t)
713 (const struct rte_eventdev *dev,
714 const struct rte_eth_dev *eth_dev,
715 uint16_t rx_queue_id,
716 struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
719 * Start ethernet Rx adapter. This callback is invoked if
720 * the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
721 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set and Rx queues
722 * from eth_port_id have been added to the event device.
725 * Event device pointer
728 * Ethernet device pointer
731 * - 0: Success, ethernet Rx adapter started successfully.
732 * - <0: Error code returned by the driver function.
734 typedef int (*eventdev_eth_rx_adapter_start_t)
735 (const struct rte_eventdev *dev,
736 const struct rte_eth_dev *eth_dev);
739 * Stop ethernet Rx adapter. This callback is invoked if
740 * the caps returned from eventdev_eth_rx_adapter_caps_get(..,eth_port_id)
741 * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set and Rx queues
742 * from eth_port_id have been added to the event device.
745 * Event device pointer
748 * Ethernet device pointer
751 * - 0: Success, ethernet Rx adapter stopped successfully.
752 * - <0: Error code returned by the driver function.
754 typedef int (*eventdev_eth_rx_adapter_stop_t)
755 (const struct rte_eventdev *dev,
756 const struct rte_eth_dev *eth_dev);
758 struct rte_event_eth_rx_adapter_stats;
761 * Retrieve ethernet Rx adapter statistics.
764 * Event device pointer
767 * Ethernet device pointer
770 * Pointer to stats structure
773 * Return 0 on success.
776 typedef int (*eventdev_eth_rx_adapter_stats_get)
777 (const struct rte_eventdev *dev,
778 const struct rte_eth_dev *eth_dev,
779 struct rte_event_eth_rx_adapter_stats *stats);
781 * Reset ethernet Rx adapter statistics.
784 * Event device pointer
787 * Ethernet device pointer
790 * Return 0 on success.
792 typedef int (*eventdev_eth_rx_adapter_stats_reset)
793 (const struct rte_eventdev *dev,
794 const struct rte_eth_dev *eth_dev);
796 struct rte_event_eth_rx_adapter_queue_stats;
799 * Retrieve ethernet Rx adapter queue statistics.
802 * Event device pointer
805 * Ethernet device pointer
808 * Ethernet device receive queue index.
810 * @param[out] q_stats
811 * Pointer to queue stats structure
814 * Return 0 on success.
816 typedef int (*eventdev_eth_rx_adapter_q_stats_get)
817 (const struct rte_eventdev *dev,
818 const struct rte_eth_dev *eth_dev,
819 uint16_t rx_queue_id,
820 struct rte_event_eth_rx_adapter_queue_stats *q_stats);
823 * Reset ethernet Rx adapter queue statistics.
826 * Event device pointer
829 * Ethernet device pointer
832 * Ethernet device receive queue index.
835 * Return 0 on success.
837 typedef int (*eventdev_eth_rx_adapter_q_stats_reset)
838 (const struct rte_eventdev *dev,
839 const struct rte_eth_dev *eth_dev,
840 uint16_t rx_queue_id);
843 * Start eventdev selftest.
846 * Return 0 on success.
848 typedef int (*eventdev_selftest)(void);
850 struct rte_event_eth_rx_adapter_vector_limits;
852 * Get event vector limits for a given event, ethernet device pair.
855 * Event device pointer
858 * Ethernet device pointer
861 * Pointer to the limits structure to be filled.
865 * - <0: Error code returned by the driver function.
867 typedef int (*eventdev_eth_rx_adapter_vector_limits_get_t)(
868 const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev,
869 struct rte_event_eth_rx_adapter_vector_limits *limits);
871 typedef uint32_t rte_event_pmd_selftest_seqn_t;
872 extern int rte_event_pmd_selftest_seqn_dynfield_offset;
875 * Read test sequence number from mbuf.
877 * @param mbuf Structure to read from.
878 * @return pointer to test sequence number.
881 static inline rte_event_pmd_selftest_seqn_t *
882 rte_event_pmd_selftest_seqn(struct rte_mbuf *mbuf)
884 return RTE_MBUF_DYNFIELD(mbuf,
885 rte_event_pmd_selftest_seqn_dynfield_offset,
886 rte_event_pmd_selftest_seqn_t *);
889 struct rte_cryptodev;
892 * This API may change without prior notice
894 * Retrieve the event device's crypto adapter capabilities for the
895 * specified cryptodev
898 * Event device pointer
904 * A pointer to memory filled with event adapter capabilities.
905 * It is expected to be pre-allocated & initialized by caller.
908 * - 0: Success, driver provides event adapter capabilities for the
910 * - <0: Error code returned by the driver function.
913 typedef int (*eventdev_crypto_adapter_caps_get_t)
914 (const struct rte_eventdev *dev,
915 const struct rte_cryptodev *cdev,
919 * This API may change without prior notice
921 * Add crypto queue pair to event device. This callback is invoked if
922 * the caps returned from rte_event_crypto_adapter_caps_get(, cdev_id)
923 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set.
926 * Event device pointer
931 * @param queue_pair_id
932 * cryptodev queue pair identifier.
935 * Event information required for binding cryptodev queue pair to event queue.
936 * This structure will have a valid value for only those HW PMDs supporting
937 * @see RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND capability.
940 * - 0: Success, cryptodev queue pair added successfully.
941 * - <0: Error code returned by the driver function.
944 typedef int (*eventdev_crypto_adapter_queue_pair_add_t)
945 (const struct rte_eventdev *dev,
946 const struct rte_cryptodev *cdev,
947 int32_t queue_pair_id,
948 const struct rte_event *event);
952 * This API may change without prior notice
954 * Delete crypto queue pair to event device. This callback is invoked if
955 * the caps returned from rte_event_crypto_adapter_caps_get(, cdev_id)
956 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set.
959 * Event device pointer
964 * @param queue_pair_id
965 * cryptodev queue pair identifier.
968 * - 0: Success, cryptodev queue pair deleted successfully.
969 * - <0: Error code returned by the driver function.
972 typedef int (*eventdev_crypto_adapter_queue_pair_del_t)
973 (const struct rte_eventdev *dev,
974 const struct rte_cryptodev *cdev,
975 int32_t queue_pair_id);
978 * Start crypto adapter. This callback is invoked if
979 * the caps returned from rte_event_crypto_adapter_caps_get(.., cdev_id)
980 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set and queue pairs
981 * from cdev_id have been added to the event device.
984 * Event device pointer
987 * Crypto device pointer
990 * - 0: Success, crypto adapter started successfully.
991 * - <0: Error code returned by the driver function.
993 typedef int (*eventdev_crypto_adapter_start_t)
994 (const struct rte_eventdev *dev,
995 const struct rte_cryptodev *cdev);
998 * Stop crypto adapter. This callback is invoked if
999 * the caps returned from rte_event_crypto_adapter_caps_get(.., cdev_id)
1000 * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set and queue pairs
1001 * from cdev_id have been added to the event device.
1004 * Event device pointer
1007 * Crypto device pointer
1010 * - 0: Success, crypto adapter stopped successfully.
1011 * - <0: Error code returned by the driver function.
1013 typedef int (*eventdev_crypto_adapter_stop_t)
1014 (const struct rte_eventdev *dev,
1015 const struct rte_cryptodev *cdev);
1017 struct rte_event_crypto_adapter_stats;
1020 * Retrieve crypto adapter statistics.
1023 * Event device pointer
1026 * Crypto device pointer
1029 * Pointer to stats structure
1032 * Return 0 on success.
1035 typedef int (*eventdev_crypto_adapter_stats_get)
1036 (const struct rte_eventdev *dev,
1037 const struct rte_cryptodev *cdev,
1038 struct rte_event_crypto_adapter_stats *stats);
1041 * Reset crypto adapter statistics.
1044 * Event device pointer
1047 * Crypto device pointer
1050 * Return 0 on success.
1053 typedef int (*eventdev_crypto_adapter_stats_reset)
1054 (const struct rte_eventdev *dev,
1055 const struct rte_cryptodev *cdev);
1058 * Retrieve the event device's eth Tx adapter capabilities.
1061 * Event device pointer
1064 * Ethernet device pointer
1067 * A pointer to memory filled with eth Tx adapter capabilities.
1070 * - 0: Success, driver provides eth Tx adapter capabilities
1071 * - <0: Error code returned by the driver function.
1074 typedef int (*eventdev_eth_tx_adapter_caps_get_t)
1075 (const struct rte_eventdev *dev,
1076 const struct rte_eth_dev *eth_dev,
1080 * Create adapter callback.
1083 * Adapter identifier
1086 * Event device pointer
1090 * - <0: Error code on failure.
1092 typedef int (*eventdev_eth_tx_adapter_create_t)(uint8_t id,
1093 const struct rte_eventdev *dev);
1096 * Free adapter callback.
1099 * Adapter identifier
1102 * Event device pointer
1106 * - <0: Error code on failure.
1108 typedef int (*eventdev_eth_tx_adapter_free_t)(uint8_t id,
1109 const struct rte_eventdev *dev);
1112 * Add a Tx queue to the adapter.
1113 * A queue value of -1 is used to indicate all
1114 * queues within the device.
1117 * Adapter identifier
1120 * Event device pointer
1123 * Ethernet device pointer
1125 * @param tx_queue_id
1126 * Transmit queue index
1130 * - <0: Error code on failure.
1132 typedef int (*eventdev_eth_tx_adapter_queue_add_t)(
1134 const struct rte_eventdev *dev,
1135 const struct rte_eth_dev *eth_dev,
1136 int32_t tx_queue_id);
1139 * Delete a Tx queue from the adapter.
1140 * A queue value of -1 is used to indicate all
1141 * queues within the device, that have been added to this
1145 * Adapter identifier
1148 * Event device pointer
1151 * Ethernet device pointer
1153 * @param tx_queue_id
1154 * Transmit queue index
1157 * - 0: Success, Queues deleted successfully.
1158 * - <0: Error code on failure.
1160 typedef int (*eventdev_eth_tx_adapter_queue_del_t)(
1162 const struct rte_eventdev *dev,
1163 const struct rte_eth_dev *eth_dev,
1164 int32_t tx_queue_id);
1167 * Start the adapter.
1170 * Adapter identifier
1173 * Event device pointer
1176 * - 0: Success, Adapter started correctly.
1177 * - <0: Error code on failure.
1179 typedef int (*eventdev_eth_tx_adapter_start_t)(uint8_t id,
1180 const struct rte_eventdev *dev);
1186 * Adapter identifier
1189 * Event device pointer
1193 * - <0: Error code on failure.
1195 typedef int (*eventdev_eth_tx_adapter_stop_t)(uint8_t id,
1196 const struct rte_eventdev *dev);
1198 struct rte_event_eth_tx_adapter_stats;
1201 * Retrieve statistics for an adapter
1204 * Adapter identifier
1207 * Event device pointer
1209 * @param [out] stats
1210 * A pointer to structure used to retrieve statistics for an adapter
1213 * - 0: Success, statistics retrieved successfully.
1214 * - <0: Error code on failure.
1216 typedef int (*eventdev_eth_tx_adapter_stats_get_t)(
1218 const struct rte_eventdev *dev,
1219 struct rte_event_eth_tx_adapter_stats *stats);
1222 * Reset statistics for an adapter
1225 * Adapter identifier
1228 * Event device pointer
1231 * - 0: Success, statistics retrieved successfully.
1232 * - <0: Error code on failure.
1234 typedef int (*eventdev_eth_tx_adapter_stats_reset_t)(uint8_t id,
1235 const struct rte_eventdev *dev);
1237 /** Event device operations function pointer table */
1238 struct eventdev_ops {
1239 eventdev_info_get_t dev_infos_get; /**< Get device info. */
1240 eventdev_configure_t dev_configure; /**< Configure device. */
1241 eventdev_start_t dev_start; /**< Start device. */
1242 eventdev_stop_t dev_stop; /**< Stop device. */
1243 eventdev_close_t dev_close; /**< Close device. */
1245 eventdev_queue_default_conf_get_t queue_def_conf;
1246 /**< Get default queue configuration. */
1247 eventdev_queue_setup_t queue_setup;
1248 /**< Set up an event queue. */
1249 eventdev_queue_release_t queue_release;
1250 /**< Release an event queue. */
1251 eventdev_queue_attr_set_t queue_attr_set;
1252 /**< Set an event queue attribute. */
1254 eventdev_port_default_conf_get_t port_def_conf;
1255 /**< Get default port configuration. */
1256 eventdev_port_setup_t port_setup;
1257 /**< Set up an event port. */
1258 eventdev_port_release_t port_release;
1259 /**< Release an event port. */
1260 eventdev_port_quiesce_t port_quiesce;
1261 /**< Quiesce an event port. */
1263 eventdev_port_link_t port_link;
1264 /**< Link event queues to an event port. */
1265 eventdev_port_unlink_t port_unlink;
1266 /**< Unlink event queues from an event port. */
1267 eventdev_port_unlinks_in_progress_t port_unlinks_in_progress;
1268 /**< Unlinks in progress on an event port. */
1269 eventdev_dequeue_timeout_ticks_t timeout_ticks;
1270 /**< Converts ns to *timeout_ticks* value for rte_event_dequeue() */
1271 eventdev_dump_t dump;
1272 /* Dump internal information */
1274 eventdev_xstats_get_t xstats_get;
1275 /**< Get extended device statistics. */
1276 eventdev_xstats_get_names_t xstats_get_names;
1277 /**< Get names of extended stats. */
1278 eventdev_xstats_get_by_name xstats_get_by_name;
1279 /**< Get one value by name. */
1280 eventdev_xstats_reset_t xstats_reset;
1281 /**< Reset the statistics values in xstats. */
1283 eventdev_eth_rx_adapter_caps_get_t eth_rx_adapter_caps_get;
1284 /**< Get ethernet Rx adapter capabilities */
1285 eventdev_eth_rx_adapter_queue_add_t eth_rx_adapter_queue_add;
1286 /**< Add Rx queues to ethernet Rx adapter */
1287 eventdev_eth_rx_adapter_queue_del_t eth_rx_adapter_queue_del;
1288 /**< Delete Rx queues from ethernet Rx adapter */
1289 eventdev_eth_rx_adapter_queue_conf_get_t eth_rx_adapter_queue_conf_get;
1290 /**< Get Rx adapter queue info */
1291 eventdev_eth_rx_adapter_start_t eth_rx_adapter_start;
1292 /**< Start ethernet Rx adapter */
1293 eventdev_eth_rx_adapter_stop_t eth_rx_adapter_stop;
1294 /**< Stop ethernet Rx adapter */
1295 eventdev_eth_rx_adapter_stats_get eth_rx_adapter_stats_get;
1296 /**< Get ethernet Rx stats */
1297 eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset;
1298 /**< Reset ethernet Rx stats */
1299 eventdev_eth_rx_adapter_vector_limits_get_t
1300 eth_rx_adapter_vector_limits_get;
1301 /**< Get event vector limits for the Rx adapter */
1303 eventdev_timer_adapter_caps_get_t timer_adapter_caps_get;
1304 /**< Get timer adapter capabilities */
1306 eventdev_crypto_adapter_caps_get_t crypto_adapter_caps_get;
1307 /**< Get crypto adapter capabilities */
1308 eventdev_crypto_adapter_queue_pair_add_t crypto_adapter_queue_pair_add;
1309 /**< Add queue pair to crypto adapter */
1310 eventdev_crypto_adapter_queue_pair_del_t crypto_adapter_queue_pair_del;
1311 /**< Delete queue pair from crypto adapter */
1312 eventdev_crypto_adapter_start_t crypto_adapter_start;
1313 /**< Start crypto adapter */
1314 eventdev_crypto_adapter_stop_t crypto_adapter_stop;
1315 /**< Stop crypto adapter */
1316 eventdev_crypto_adapter_stats_get crypto_adapter_stats_get;
1317 /**< Get crypto stats */
1318 eventdev_crypto_adapter_stats_reset crypto_adapter_stats_reset;
1319 /**< Reset crypto stats */
1321 eventdev_eth_rx_adapter_q_stats_get eth_rx_adapter_queue_stats_get;
1322 /**< Get ethernet Rx queue stats */
1323 eventdev_eth_rx_adapter_q_stats_reset eth_rx_adapter_queue_stats_reset;
1324 /**< Reset ethernet Rx queue stats */
1326 eventdev_eth_tx_adapter_caps_get_t eth_tx_adapter_caps_get;
1327 /**< Get ethernet Tx adapter capabilities */
1329 eventdev_eth_tx_adapter_create_t eth_tx_adapter_create;
1330 /**< Create adapter callback */
1331 eventdev_eth_tx_adapter_free_t eth_tx_adapter_free;
1332 /**< Free adapter callback */
1333 eventdev_eth_tx_adapter_queue_add_t eth_tx_adapter_queue_add;
1334 /**< Add Tx queues to the eth Tx adapter */
1335 eventdev_eth_tx_adapter_queue_del_t eth_tx_adapter_queue_del;
1336 /**< Delete Tx queues from the eth Tx adapter */
1337 eventdev_eth_tx_adapter_start_t eth_tx_adapter_start;
1338 /**< Start eth Tx adapter */
1339 eventdev_eth_tx_adapter_stop_t eth_tx_adapter_stop;
1340 /**< Stop eth Tx adapter */
1341 eventdev_eth_tx_adapter_stats_get_t eth_tx_adapter_stats_get;
1342 /**< Get eth Tx adapter statistics */
1343 eventdev_eth_tx_adapter_stats_reset_t eth_tx_adapter_stats_reset;
1344 /**< Reset eth Tx adapter statistics */
1346 eventdev_selftest dev_selftest;
1347 /**< Start eventdev Selftest */
1349 eventdev_stop_flush_t dev_stop_flush;
1350 /**< User-provided event flush function */
1354 * Allocates a new eventdev slot for an event device and returns the pointer
1355 * to that slot for the driver to use.
1358 * Unique identifier name for each device
1360 * Socket to allocate resources on.
1362 * - Slot in the rte_dev_devices array for a new device;
1365 struct rte_eventdev *
1366 rte_event_pmd_allocate(const char *name, int socket_id);
1369 * Release the specified eventdev device.
1372 * The *eventdev* pointer is the address of the *rte_eventdev* structure.
1374 * - 0 on success, negative on error
1378 rte_event_pmd_release(struct rte_eventdev *eventdev);
1383 * This is the last step of device probing.
1384 * It must be called after a port is allocated and initialized successfully.
1391 event_dev_probing_finish(struct rte_eventdev *eventdev);
1394 * Reset eventdevice fastpath APIs to dummy values.
1397 * The *fp_ops* pointer to reset.
1401 event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op);
1404 * Set eventdevice fastpath APIs to event device values.
1407 * The *fp_ops* pointer to set.
1411 event_dev_fp_ops_set(struct rte_event_fp_ops *fp_ops,
1412 const struct rte_eventdev *dev);
1418 #endif /* _RTE_EVENTDEV_PMD_H_ */