eventdev: support device maintenance in adapters

Introduce support for event devices requiring calls to
rte_event_maintain() in the Ethernet RX, Timer and Crypto Eventdev
adapters.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Tested-by: Richard Eklycke <richard.eklycke@ericsson.com>
This commit is contained in:
Mattias Rönnblom 2021-11-01 19:40:16 +01:00 committed by Jerin Jacob
parent aaf3b44c66
commit 578402f2d5
3 changed files with 21 additions and 7 deletions

View File

@ -630,19 +630,25 @@ static void
eca_crypto_adapter_run(struct event_crypto_adapter *adapter,
unsigned int max_ops)
{
while (max_ops) {
unsigned int ops_left = max_ops;
while (ops_left > 0) {
unsigned int e_cnt, d_cnt;
e_cnt = eca_crypto_adapter_deq_run(adapter, max_ops);
max_ops -= RTE_MIN(max_ops, e_cnt);
e_cnt = eca_crypto_adapter_deq_run(adapter, ops_left);
ops_left -= RTE_MIN(ops_left, e_cnt);
d_cnt = eca_crypto_adapter_enq_run(adapter, max_ops);
max_ops -= RTE_MIN(max_ops, d_cnt);
d_cnt = eca_crypto_adapter_enq_run(adapter, ops_left);
ops_left -= RTE_MIN(ops_left, d_cnt);
if (e_cnt == 0 && d_cnt == 0)
break;
}
if (ops_left == max_ops)
rte_event_maintain(adapter->eventdev_id,
adapter->event_port_id, 0);
}
static int

View File

@ -1000,6 +1000,7 @@ rxa_eth_rx(struct event_eth_rx_adapter *rx_adapter, uint16_t port_id,
struct rte_mbuf *mbufs[BATCH_SIZE];
uint16_t n;
uint32_t nb_rx = 0;
uint32_t nb_flushed = 0;
if (rxq_empty)
*rxq_empty = 0;
@ -1008,7 +1009,8 @@ rxa_eth_rx(struct event_eth_rx_adapter *rx_adapter, uint16_t port_id,
*/
while (rxa_pkt_buf_available(buf)) {
if (buf->count >= BATCH_SIZE)
rxa_flush_event_buffer(rx_adapter, buf, stats);
nb_flushed +=
rxa_flush_event_buffer(rx_adapter, buf, stats);
stats->rx_poll_count++;
n = rte_eth_rx_burst(port_id, queue_id, mbufs, BATCH_SIZE);
@ -1025,9 +1027,12 @@ rxa_eth_rx(struct event_eth_rx_adapter *rx_adapter, uint16_t port_id,
}
if (buf->count > 0)
rxa_flush_event_buffer(rx_adapter, buf, stats);
nb_flushed += rxa_flush_event_buffer(rx_adapter, buf, stats);
stats->rx_packets += nb_rx;
if (nb_flushed == 0)
rte_event_maintain(rx_adapter->eventdev_id,
rx_adapter->event_port_id, 0);
return nb_rx;
}

View File

@ -786,6 +786,9 @@ swtim_service_func(void *arg)
sw->stats.adapter_tick_count++;
}
rte_event_maintain(adapter->data->event_dev_id,
adapter->data->event_port_id, 0);
return 0;
}