#ifndef _RTE_EVENTDEV_PMD_H_
#define _RTE_EVENTDEV_PMD_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** @file
* RTE Event PMD APIs
*
#include <rte_mbuf.h>
#include <rte_mbuf_dyn.h>
+#include "event_timer_adapter_pmd.h"
#include "rte_eventdev.h"
-#include "rte_event_timer_adapter_pmd.h"
/* Logging Macros */
#define RTE_EDEV_LOG_ERR(...) \
#define RTE_EVENTDEV_DETACHED (0)
#define RTE_EVENTDEV_ATTACHED (1)
+#define RTE_EVENTDEV_NAME_MAX_LEN (64)
+/**< @internal Max length of name of event PMD */
+
struct rte_eth_dev;
/** Global structure used for maintaining state of allocated event devices */
uint8_t nb_devs; /**< Number of devices found */
};
+/**
+ * @internal
+ * The data part, with no function pointers, associated with each device.
+ *
+ * This structure is safe to place in shared memory to be common among
+ * different processes in a multi-process configuration.
+ */
+struct rte_eventdev_data {
+ int socket_id;
+ /**< Socket ID where memory is allocated */
+ uint8_t dev_id;
+ /**< Device ID for this instance */
+ uint8_t nb_queues;
+ /**< Number of event queues. */
+ uint8_t nb_ports;
+ /**< Number of event ports. */
+ void *ports[RTE_EVENT_MAX_PORTS_PER_DEV];
+ /**< Array of pointers to ports. */
+ struct rte_event_port_conf ports_cfg[RTE_EVENT_MAX_PORTS_PER_DEV];
+ /**< Array of port configuration structures. */
+ struct rte_event_queue_conf queues_cfg[RTE_EVENT_MAX_QUEUES_PER_DEV];
+ /**< Array of queue configuration structures. */
+ uint16_t links_map[RTE_EVENT_MAX_PORTS_PER_DEV *
+ RTE_EVENT_MAX_QUEUES_PER_DEV];
+ /**< Memory to store queues to port connections. */
+ void *dev_private;
+ /**< PMD-specific private data */
+ uint32_t event_dev_cap;
+ /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
+ struct rte_event_dev_config dev_conf;
+ /**< Configuration applied to device. */
+ uint8_t service_inited;
+ /* Service initialization state */
+ uint32_t service_id;
+ /* Service ID*/
+ void *dev_stop_flush_arg;
+ /**< User-provided argument for event flush function */
+
+ RTE_STD_C11
+ uint8_t dev_started : 1;
+ /**< Device state: STARTED(1)/STOPPED(0) */
+
+ char name[RTE_EVENTDEV_NAME_MAX_LEN];
+ /**< Unique identifier name */
+
+ uint64_t reserved_64s[4]; /**< Reserved for future fields */
+ void *reserved_ptrs[4]; /**< Reserved for future fields */
+} __rte_cache_aligned;
+
+/** @internal The data structure associated with each event device. */
+struct rte_eventdev {
+ struct rte_eventdev_data *data;
+ /**< Pointer to device data */
+ struct eventdev_ops *dev_ops;
+ /**< Functions exported by PMD */
+ struct rte_device *dev;
+ /**< Device info. supplied by probing */
+
+ RTE_STD_C11
+ uint8_t attached : 1;
+ /**< Flag indicating the device is attached */
+
+ event_enqueue_t enqueue;
+ /**< Pointer to PMD enqueue function. */
+ event_enqueue_burst_t enqueue_burst;
+ /**< Pointer to PMD enqueue burst function. */
+ event_enqueue_burst_t enqueue_new_burst;
+ /**< Pointer to PMD enqueue burst function(op new variant) */
+ event_enqueue_burst_t enqueue_forward_burst;
+ /**< Pointer to PMD enqueue burst function(op forward variant) */
+ event_dequeue_t dequeue;
+ /**< Pointer to PMD dequeue function. */
+ event_dequeue_burst_t dequeue_burst;
+ /**< Pointer to PMD dequeue burst function. */
+ event_maintain_t maintain;
+ /**< Pointer to PMD port maintenance function. */
+ event_tx_adapter_enqueue_t txa_enqueue_same_dest;
+ /**< Pointer to PMD eth Tx adapter burst enqueue function with
+ * events destined to same Eth port & Tx queue.
+ */
+ event_tx_adapter_enqueue_t txa_enqueue;
+ /**< Pointer to PMD eth Tx adapter enqueue function. */
+ event_crypto_adapter_enqueue_t ca_enqueue;
+
+ uint64_t reserved_64s[4]; /**< Reserved for future fields */
+ void *reserved_ptrs[3]; /**< Reserved for future fields */
+} __rte_cache_aligned;
+
+extern struct rte_eventdev *rte_eventdevs;
+/** @internal The pool of rte_eventdev structures. */
+
/**
* Get the rte_eventdev structure device pointer for the named device.
*
/**
* Definitions of all functions exported by a driver through the
- * the generic structure of type *event_dev_ops* supplied in the
+ * generic structure of type *event_dev_ops* supplied in the
* *rte_eventdev* structure associated with a device.
*/
typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
uint8_t queue_id);
+/**
+ * Get an event queue attribute at runtime.
+ *
+ * @param dev
+ * Event device pointer
+ * @param queue_id
+ * Event queue index
+ * @param attr_id
+ * Event queue attribute id
+ * @param[out] attr_value
+ * Event queue attribute value
+ *
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_queue_attr_get_t)(struct rte_eventdev *dev,
+ uint8_t queue_id, uint32_t attr_id,
+ uint32_t *attr_value);
+
+/**
+ * Set an event queue attribute at runtime.
+ *
+ * @param dev
+ * Event device pointer
+ * @param queue_id
+ * Event queue index
+ * @param attr_id
+ * Event queue attribute id
+ * @param attr_value
+ * Event queue attribute value
+ *
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_queue_attr_set_t)(struct rte_eventdev *dev,
+ uint8_t queue_id, uint32_t attr_id,
+ uint64_t attr_value);
+
/**
* Retrieve the default event port configuration.
*
*/
typedef void (*eventdev_port_release_t)(void *port);
+/**
+ * Quiesce any core specific resources consumed by the event port
+ *
+ * @param dev
+ * Event device pointer.
+ * @param port
+ * Event port pointer.
+ * @param flush_cb
+ * User-provided event flush function.
+ * @param args
+ * Arguments to be passed to the user-provided event flush function.
+ *
+ */
+typedef void (*eventdev_port_quiesce_t)(struct rte_eventdev *dev, void *port,
+ rte_eventdev_port_flush_t flush_cb,
+ void *args);
+
/**
* Link multiple source event queues to destination event port.
*
*
*/
typedef int (*eventdev_timer_adapter_caps_get_t)(
- const struct rte_eventdev *dev,
- uint64_t flags,
- uint32_t *caps,
- const struct rte_event_timer_adapter_ops **ops);
+ const struct rte_eventdev *dev, uint64_t flags, uint32_t *caps,
+ const struct event_timer_adapter_ops **ops);
/**
* Add ethernet Rx queues to event device. This callback is invoked if
typedef int (*eventdev_eth_rx_adapter_stats_reset)
(const struct rte_eventdev *dev,
const struct rte_eth_dev *eth_dev);
+
+struct rte_event_eth_rx_adapter_queue_stats;
+
+/**
+ * Retrieve ethernet Rx adapter queue statistics.
+ *
+ * @param dev
+ * Event device pointer
+ *
+ * @param eth_dev
+ * Ethernet device pointer
+ *
+ * @param rx_queue_id
+ * Ethernet device receive queue index.
+ *
+ * @param[out] q_stats
+ * Pointer to queue stats structure
+ *
+ * @return
+ * Return 0 on success.
+ */
+typedef int (*eventdev_eth_rx_adapter_q_stats_get)
+ (const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_stats *q_stats);
+
+/**
+ * Reset ethernet Rx adapter queue statistics.
+ *
+ * @param dev
+ * Event device pointer
+ *
+ * @param eth_dev
+ * Ethernet device pointer
+ *
+ * @param rx_queue_id
+ * Ethernet device receive queue index.
+ *
+ * @return
+ * Return 0 on success.
+ */
+typedef int (*eventdev_eth_rx_adapter_q_stats_reset)
+ (const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev,
+ uint16_t rx_queue_id);
+
/**
* Start eventdev selftest.
*
/**< Set up an event queue. */
eventdev_queue_release_t queue_release;
/**< Release an event queue. */
+ eventdev_queue_attr_get_t queue_attr_get;
+ /**< Get an event queue attribute. */
+ eventdev_queue_attr_set_t queue_attr_set;
+ /**< Set an event queue attribute. */
eventdev_port_default_conf_get_t port_def_conf;
/**< Get default port configuration. */
/**< Set up an event port. */
eventdev_port_release_t port_release;
/**< Release an event port. */
+ eventdev_port_quiesce_t port_quiesce;
+ /**< Quiesce an event port. */
eventdev_port_link_t port_link;
/**< Link event queues to an event port. */
eventdev_crypto_adapter_stats_reset crypto_adapter_stats_reset;
/**< Reset crypto stats */
+ eventdev_eth_rx_adapter_q_stats_get eth_rx_adapter_queue_stats_get;
+ /**< Get ethernet Rx queue stats */
+ eventdev_eth_rx_adapter_q_stats_reset eth_rx_adapter_queue_stats_reset;
+ /**< Reset ethernet Rx queue stats */
+
eventdev_eth_tx_adapter_caps_get_t eth_tx_adapter_caps_get;
/**< Get ethernet Tx adapter capabilities */
int
rte_event_pmd_release(struct rte_eventdev *eventdev);
+/**
+ *
+ * @internal
+ * This is the last step of device probing.
+ * It must be called after a port is allocated and initialized successfully.
+ *
+ * @param eventdev
+ * New event device.
+ */
+__rte_internal
+void
+event_dev_probing_finish(struct rte_eventdev *eventdev);
+
+/**
+ * Reset eventdevice fastpath APIs to dummy values.
+ *
+ * @param fp_ops
+ * The *fp_ops* pointer to reset.
+ */
+__rte_internal
+void
+event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op);
+
+/**
+ * Set eventdevice fastpath APIs to event device values.
+ *
+ * @param fp_ops
+ * The *fp_ops* pointer to set.
+ */
+__rte_internal
+void
+event_dev_fp_ops_set(struct rte_event_fp_ops *fp_ops,
+ const struct rte_eventdev *dev);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _RTE_EVENTDEV_PMD_H_ */