#include <rte_common.h>
#include <rte_config.h>
-#include <rte_memory.h>
#include <rte_errno.h>
+#include <rte_mbuf_pool_ops.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
#include "rte_eventdev_trace_fp.h"
int
rte_event_dev_close(uint8_t dev_id);
+/**
+ * Event vector structure.
+ */
+struct rte_event_vector {
+ uint16_t nb_elem;
+ /**< Number of elements in this event vector. */
+ uint16_t rsvd : 15;
+ /**< Reserved for future use */
+ uint16_t attr_valid : 1;
+ /**< Indicates that the below union attributes have valid information.
+ */
+ union {
+ /* Used by Rx/Tx adapter.
+ * Indicates that all the elements in this vector belong to the
+ * same port and queue pair when originating from Rx adapter,
+ * valid only when event type is ETHDEV_VECTOR or
+ * ETH_RX_ADAPTER_VECTOR.
+ * Can also be used to indicate the Tx adapter the destination
+ * port and queue of the mbufs in the vector
+ */
+ struct {
+ uint16_t port;
+ /* Ethernet device port id. */
+ uint16_t queue;
+ /* Ethernet device queue id. */
+ };
+ };
+ /**< Union to hold common attributes of the vector array. */
+ uint64_t impl_opaque;
+ /**< Implementation specific opaque value.
+ * An implementation may use this field to hold implementation specific
+ * value to share between dequeue and enqueue operation.
+ * The application should not modify this field.
+ */
+ union {
+ struct rte_mbuf *mbufs[0];
+ void *ptrs[0];
+ uint64_t *u64s[0];
+ } __rte_aligned(16);
+ /**< Start of the vector array union. Depending upon the event type the
+ * vector array can be an array of mbufs or pointers or opaque u64
+ * values.
+ */
+};
+
/* Scheduler type definitions */
#define RTE_SCHED_TYPE_ORDERED 0
/**< Ordered scheduling
*/
#define RTE_EVENT_TYPE_ETH_RX_ADAPTER 0x4
/**< The event generated from event eth Rx adapter */
+#define RTE_EVENT_TYPE_VECTOR 0x8
+/**< Indicates that event is a vector.
+ * All vector event types should be a logical OR of EVENT_TYPE_VECTOR.
+ * This simplifies the pipeline design as one can split processing the events
+ * between vector events and normal event across event types.
+ * Example:
+ * if (ev.event_type & RTE_EVENT_TYPE_VECTOR) {
+ * // Classify and handle vector event.
+ * } else {
+ * // Classify and handle event.
+ * }
+ */
+#define RTE_EVENT_TYPE_ETHDEV_VECTOR \
+ (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETHDEV)
+/**< The event vector generated from ethdev subsystem */
+#define RTE_EVENT_TYPE_CPU_VECTOR (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CPU)
+/**< The event vector generated from cpu for pipelining. */
+#define RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR \
+ (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETH_RX_ADAPTER)
+/**< The event vector generated from eth Rx adapter. */
+
#define RTE_EVENT_TYPE_MAX 0x10
/**< Maximum number of event types */
/**< Opaque event pointer */
struct rte_mbuf *mbuf;
/**< mbuf pointer if dequeued event is associated with mbuf */
+ struct rte_event_vector *vec;
+ /**< Event vector pointer. */
};
};
* @see struct rte_event_eth_rx_adapter_queue_conf::ev
* @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags
*/
+#define RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR 0x8
+/**< Adapter supports event vectorization per ethdev. */
/**
* Retrieve the event device's ethdev Rx adapter capabilities for the
#define RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT 0x1
/**< This flag is sent when the PMD supports a packet transmit callback
*/
+#define RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR 0x2
+/**< Indicates that the Tx adapter is capable of handling event vector of
+ * mbufs.
+ */
/**
* Retrieve the event device's eth Tx adapter capabilities
* burst having same destination Ethernet port & Tx queue.
*/
+typedef uint16_t (*event_crypto_adapter_enqueue)(void *port,
+ struct rte_event ev[], uint16_t nb_events);
+/**< @internal Enqueue burst of events on crypto adapter */
+
#define RTE_EVENTDEV_NAME_MAX_LEN (64)
/**< @internal Max length of name of event PMD */
uint8_t attached : 1;
/**< Flag indicating the device is attached */
+ event_crypto_adapter_enqueue ca_enqueue;
+ /**< Pointer to PMD crypto adapter enqueue function. */
+
uint64_t reserved_64s[4]; /**< Reserved for future fields */
- void *reserved_ptrs[4]; /**< Reserved for future fields */
+ void *reserved_ptrs[3]; /**< Reserved for future fields */
} __rte_cache_aligned;
extern struct rte_eventdev *rte_eventdevs;
*/
int rte_event_dev_selftest(uint8_t dev_id);
+/**
+ * Get the memory required per event vector based on the number of elements per
+ * vector.
+ * This should be used to create the mempool that holds the event vectors.
+ *
+ * @param name
+ * The name of the vector pool.
+ * @param n
+ * The number of elements in the mbuf pool.
+ * @param cache_size
+ * Size of the per-core object cache. See rte_mempool_create() for
+ * details.
+ * @param nb_elem
+ * The number of elements that a single event vector should be able to hold.
+ * @param socket_id
+ * The socket identifier where the memory should be allocated. The
+ * value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
+ * reserved zone
+ *
+ * @return
+ * The pointer to the newly allocated mempool, on success. NULL on error
+ * with rte_errno set appropriately. Possible rte_errno values include:
+ * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ * - E_RTE_SECONDARY - function was called from a secondary process instance
+ * - EINVAL - cache size provided is too large, or priv_size is not aligned.
+ * - ENOSPC - the maximum number of memzones has already been allocated
+ * - EEXIST - a memzone with the same name already exists
+ * - ENOMEM - no appropriate memory area found in which to create memzone
+ * - ENAMETOOLONG - mempool name requested is too long.
+ */
+__rte_experimental
+struct rte_mempool *
+rte_event_vector_pool_create(const char *name, unsigned int n,
+ unsigned int cache_size, uint16_t nb_elem,
+ int socket_id);
+
#ifdef __cplusplus
}
#endif