eventdev: add port maintenance API
Extend Eventdev API to allow for event devices which require various forms of internal processing to happen, even when events are not enqueued to or dequeued from a port. Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com> Acked-by: Jerin Jacob <jerinj@marvell.com> Tested-by: Richard Eklycke <richard.eklycke@ericsson.com> Tested-by: Liron Himi <lironh@marvell.com>
This commit is contained in:
parent
ea9ec3de0f
commit
54f17843a8
@ -164,6 +164,8 @@ struct rte_eventdev {
|
||||
/**< 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.
|
||||
|
@ -44,6 +44,13 @@ dummy_event_dequeue_burst(__rte_unused void *port,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
dummy_event_maintain(__rte_unused void *port, __rte_unused int op)
|
||||
{
|
||||
RTE_EDEV_LOG_ERR(
|
||||
"maintenance requested for unconfigured event device");
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
dummy_event_tx_adapter_enqueue(__rte_unused void *port,
|
||||
__rte_unused struct rte_event ev[],
|
||||
@ -85,6 +92,7 @@ event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op)
|
||||
.enqueue_forward_burst = dummy_event_enqueue_burst,
|
||||
.dequeue = dummy_event_dequeue,
|
||||
.dequeue_burst = dummy_event_dequeue_burst,
|
||||
.maintain = dummy_event_maintain,
|
||||
.txa_enqueue = dummy_event_tx_adapter_enqueue,
|
||||
.txa_enqueue_same_dest =
|
||||
dummy_event_tx_adapter_enqueue_same_dest,
|
||||
@ -105,6 +113,7 @@ event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op,
|
||||
fp_op->enqueue_forward_burst = dev->enqueue_forward_burst;
|
||||
fp_op->dequeue = dev->dequeue;
|
||||
fp_op->dequeue_burst = dev->dequeue_burst;
|
||||
fp_op->maintain = dev->maintain;
|
||||
fp_op->txa_enqueue = dev->txa_enqueue;
|
||||
fp_op->txa_enqueue_same_dest = dev->txa_enqueue_same_dest;
|
||||
fp_op->ca_enqueue = dev->ca_enqueue;
|
||||
|
@ -37,6 +37,9 @@ RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_enq_burst,
|
||||
RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_deq_burst,
|
||||
lib.eventdev.deq.burst)
|
||||
|
||||
RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_maintain,
|
||||
lib.eventdev.maintain)
|
||||
|
||||
/* Eventdev Rx adapter trace points */
|
||||
RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_eth_rx_adapter_create,
|
||||
lib.eventdev.rx.adapter.create)
|
||||
|
@ -299,6 +299,15 @@ struct rte_event;
|
||||
* the content of this field is implementation dependent.
|
||||
*/
|
||||
|
||||
#define RTE_EVENT_DEV_CAP_REQUIRES_MAINT (1ULL << 10)
|
||||
/**< Event device requires calls to rte_event_maintain() during
|
||||
* periods when neither rte_event_dequeue_burst() nor
|
||||
* rte_event_enqueue_burst() are called on a port. This will allow the
|
||||
* event device to perform internal processing, such as flushing
|
||||
* buffered events, return credits to a global pool, or process
|
||||
* signaling related to load balancing.
|
||||
*/
|
||||
|
||||
/* Event device priority levels */
|
||||
#define RTE_EVENT_DEV_PRIORITY_HIGHEST 0
|
||||
/**< Highest priority expressed across eventdev subsystem
|
||||
@ -2063,6 +2072,76 @@ rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[],
|
||||
timeout_ticks);
|
||||
}
|
||||
|
||||
#define RTE_EVENT_DEV_MAINT_OP_FLUSH (1 << 0)
|
||||
/**< Force an immediately flush of any buffered events in the port,
|
||||
* potentially at the cost of additional overhead.
|
||||
*
|
||||
* @see rte_event_maintain()
|
||||
*/
|
||||
|
||||
/**
|
||||
* Maintain an event device.
|
||||
*
|
||||
* This function is only relevant for event devices which have the
|
||||
* @ref RTE_EVENT_DEV_CAP_REQUIRES_MAINT flag set. Such devices
|
||||
* require an application thread using a particular port to
|
||||
* periodically call rte_event_maintain() on that port during periods
|
||||
* which it is neither attempting to enqueue events to nor dequeue
|
||||
* events from the port. rte_event_maintain() is a low-overhead
|
||||
* function and should be called at a high rate (e.g., in the
|
||||
* application's poll loop).
|
||||
*
|
||||
* No port may be left unmaintained.
|
||||
*
|
||||
* At the application thread's convenience, rte_event_maintain() may
|
||||
* (but is not required to) be called even during periods when enqueue
|
||||
* or dequeue functions are being called, at the cost of a slight
|
||||
* increase in overhead.
|
||||
*
|
||||
* rte_event_maintain() may be called on event devices which haven't
|
||||
* set @ref RTE_EVENT_DEV_CAP_REQUIRES_MAINT flag, in which case it is
|
||||
* a no-operation.
|
||||
*
|
||||
* @param dev_id
|
||||
* The identifier of the device.
|
||||
* @param port_id
|
||||
* The identifier of the event port.
|
||||
* @param op
|
||||
* 0, or @ref RTE_EVENT_DEV_MAINT_OP_FLUSH.
|
||||
* @return
|
||||
* - 0 on success.
|
||||
* - -EINVAL if *dev_id*, *port_id*, or *op* is invalid.
|
||||
*
|
||||
* @see RTE_EVENT_DEV_CAP_REQUIRES_MAINT
|
||||
*/
|
||||
__rte_experimental
|
||||
static inline int
|
||||
rte_event_maintain(uint8_t dev_id, uint8_t port_id, int op)
|
||||
{
|
||||
const struct rte_event_fp_ops *fp_ops;
|
||||
void *port;
|
||||
|
||||
fp_ops = &rte_event_fp_ops[dev_id];
|
||||
port = fp_ops->data[port_id];
|
||||
#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
|
||||
if (dev_id >= RTE_EVENT_MAX_DEVS ||
|
||||
port_id >= RTE_EVENT_MAX_PORTS_PER_DEV)
|
||||
return -EINVAL;
|
||||
|
||||
if (port == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
if (op & (~RTE_EVENT_DEV_MAINT_OP_FLUSH))
|
||||
return -EINVAL;
|
||||
#endif
|
||||
rte_eventdev_trace_maintain(dev_id, port_id, op);
|
||||
|
||||
if (fp_ops->maintain != NULL)
|
||||
fp_ops->maintain(port, op);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -29,6 +29,9 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
|
||||
uint64_t timeout_ticks);
|
||||
/**< @internal Dequeue burst of events from port of a device */
|
||||
|
||||
typedef void (*event_maintain_t)(void *port, int op);
|
||||
/**< @internal Maintains a port */
|
||||
|
||||
typedef uint16_t (*event_tx_adapter_enqueue_t)(void *port,
|
||||
struct rte_event ev[],
|
||||
uint16_t nb_events);
|
||||
@ -54,6 +57,8 @@ struct rte_event_fp_ops {
|
||||
/**< PMD dequeue function. */
|
||||
event_dequeue_burst_t dequeue_burst;
|
||||
/**< PMD dequeue burst function. */
|
||||
event_maintain_t maintain;
|
||||
/**< PMD port maintenance function. */
|
||||
event_tx_adapter_enqueue_t txa_enqueue;
|
||||
/**< PMD Tx adapter enqueue function. */
|
||||
event_tx_adapter_enqueue_t txa_enqueue_same_dest;
|
||||
|
@ -38,6 +38,14 @@ RTE_TRACE_POINT_FP(
|
||||
rte_trace_point_emit_ptr(enq_mode_cb);
|
||||
)
|
||||
|
||||
RTE_TRACE_POINT_FP(
|
||||
rte_eventdev_trace_maintain,
|
||||
RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint8_t port_id, int op),
|
||||
rte_trace_point_emit_u8(dev_id);
|
||||
rte_trace_point_emit_u8(port_id);
|
||||
rte_trace_point_emit_int(op);
|
||||
)
|
||||
|
||||
RTE_TRACE_POINT_FP(
|
||||
rte_eventdev_trace_eth_tx_adapter_enqueue,
|
||||
RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint8_t port_id, void *ev_table,
|
||||
|
Loading…
x
Reference in New Issue
Block a user