diff mbox series

[3/3] eventdev: have adapters support device maintenance

Message ID 20211026173148.19399-3-mattias.ronnblom@ericsson.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers show
Series [1/3] eventdev: allow for event devices requiring maintenance | expand

Checks

Context Check Description
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build fail github build: failed
ci/checkpatch success coding style OK

Commit Message

Mattias Rönnblom Oct. 26, 2021, 5:31 p.m. UTC
Introduce support for event devices requiring calls to
rte_event_maintain() in the Ethernet RX, Timer and Crypto Eventdev
adapters.

RFC v2:
  - For simplicity, the timer adapter now unconditionally calls
    rte_event_maintain().
  - The RX adapter now only calls rte_event_maintain() when it has not
    enqueued any events.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Tested-by: Richard Eklycke <richard.eklycke@ericsson.com>
---
 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 mbox series

Patch

diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index ae1151fb75..a6bd48da81 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);
 }
 
 static int
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index a175c61551..adf20f8b0c 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -992,6 +992,7 @@  rxa_eth_rx(struct event_eth_rx_adapter *rx_adapter, uint16_t port_id,
 					&rx_adapter->stats;
 	uint16_t n;
 	uint32_t nb_rx = 0;
+	uint32_t nb_flushed = 0;
 
 	if (rxq_empty)
 		*rxq_empty = 0;
@@ -1000,7 +1001,7 @@  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);
+			nb_flushed += rxa_flush_event_buffer(rx_adapter, buf);
 
 		stats->rx_poll_count++;
 		n = rte_eth_rx_burst(port_id, queue_id, mbufs, BATCH_SIZE);
@@ -1016,7 +1017,11 @@  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);
+		nb_flushed += rxa_flush_event_buffer(rx_adapter, buf);
+
+	if (nb_flushed == 0)
+		rte_event_maintain(rx_adapter->eventdev_id,
+				   rx_adapter->event_port_id);
 
 	return nb_rx;
 }
diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index 0e21b7c475..a89cf8b978 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);
+
 	return 0;
 }