From 578402f2d5e81af23000e1aa7980b5383a0394be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Mon, 1 Nov 2021 19:40:16 +0100 Subject: [PATCH] eventdev: support device maintenance in adapters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Richard Eklycke --- lib/eventdev/rte_event_crypto_adapter.c | 16 +++++++++++----- lib/eventdev/rte_event_eth_rx_adapter.c | 9 +++++++-- lib/eventdev/rte_event_timer_adapter.c | 3 +++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c index ae1151fb75..d84080355d 100644 --- a/lib/eventdev/rte_event_crypto_adapter.c +++ b/lib/eventdev/rte_event_crypto_adapter.c @@ -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 diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index 4e0829c492..56318b5a6f 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -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; } diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c index 0e21b7c475..e5572e2add 100644 --- a/lib/eventdev/rte_event_timer_adapter.c +++ b/lib/eventdev/rte_event_timer_adapter.c @@ -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; }