DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/4] Have event adapters report idle status
@ 2022-10-10 14:54 Mattias Rönnblom
  2022-10-10 14:54 ` [PATCH 1/4] eventdev: have crypto adapter appropriately report idle Mattias Rönnblom
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Mattias Rönnblom @ 2022-10-10 14:54 UTC (permalink / raw)
  To: Jay Jayatheerthan, Erik Gabriel Carrillo, Abhinandan Gujjar, Jerin Jacob
  Cc: dev, Harry van Haaren, hofors, Mattias Rönnblom

This series updates the event adapters' service functions to report
back to the service cores framework, whether or not any useful work
was performed. This in turn makes it possible to use the service core
statistics to compute service lcore load (i.e., the fraction of time
its EAL thread is doing something useful).

This patchset does not affect scenarios where the event device has
internal ports for relaying packets from the NIC into the scheduler
(and vice versa), and thus no service core is required.

Mattias Rönnblom (4):
  eventdev: have crypto adapter appropriately report idle
  eventdev: have ethernet Rx adapter appropriately report idle
  eventdev: have ethernet Tx adapter appropriately report idle
  eventdev: have timer adapter appropriately report idle

 lib/eventdev/rte_event_crypto_adapter.c | 12 ++++--
 lib/eventdev/rte_event_eth_rx_adapter.c | 56 ++++++++++++++++++-------
 lib/eventdev/rte_event_eth_tx_adapter.c | 13 ++++--
 lib/eventdev/rte_event_timer_adapter.c  |  3 +-
 4 files changed, 60 insertions(+), 24 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/4] eventdev: have crypto adapter appropriately report idle
  2022-10-10 14:54 [PATCH 0/4] Have event adapters report idle status Mattias Rönnblom
@ 2022-10-10 14:54 ` Mattias Rönnblom
  2022-10-17  5:47   ` Gujjar, Abhinandan S
  2022-10-10 14:54 ` [PATCH 2/4] eventdev: have ethernet Rx " Mattias Rönnblom
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: Mattias Rönnblom @ 2022-10-10 14:54 UTC (permalink / raw)
  To: Jay Jayatheerthan, Erik Gabriel Carrillo, Abhinandan Gujjar, Jerin Jacob
  Cc: dev, Harry van Haaren, hofors, Mattias Rönnblom

Update the event crypto adapter's service function to report as idle
(i.e., return -EAGAIN) in case no crypto operations were performed.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 lib/eventdev/rte_event_crypto_adapter.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index a11cbcf4f3..59777726f6 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -771,7 +771,7 @@ eca_crypto_adapter_deq_run(struct event_crypto_adapter *adapter,
 	return nb_deq;
 }
 
-static void
+static int
 eca_crypto_adapter_run(struct event_crypto_adapter *adapter,
 		       unsigned int max_ops)
 {
@@ -791,22 +791,26 @@ eca_crypto_adapter_run(struct event_crypto_adapter *adapter,
 
 	}
 
-	if (ops_left == max_ops)
+	if (ops_left == max_ops) {
 		rte_event_maintain(adapter->eventdev_id,
 				   adapter->event_port_id, 0);
+		return -EAGAIN;
+	} else
+		return 0;
 }
 
 static int
 eca_service_func(void *args)
 {
 	struct event_crypto_adapter *adapter = args;
+	int ret;
 
 	if (rte_spinlock_trylock(&adapter->lock) == 0)
 		return 0;
-	eca_crypto_adapter_run(adapter, adapter->max_nb);
+	ret = eca_crypto_adapter_run(adapter, adapter->max_nb);
 	rte_spinlock_unlock(&adapter->lock);
 
-	return 0;
+	return ret;
 }
 
 static int
-- 
2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
  2022-10-10 14:54 [PATCH 0/4] Have event adapters report idle status Mattias Rönnblom
  2022-10-10 14:54 ` [PATCH 1/4] eventdev: have crypto adapter appropriately report idle Mattias Rönnblom
@ 2022-10-10 14:54 ` Mattias Rönnblom
  2022-10-11  7:10   ` Jayatheerthan, Jay
  2022-10-10 14:54 ` [PATCH 3/4] eventdev: have ethernet Tx " Mattias Rönnblom
  2022-10-10 14:54 ` [PATCH 4/4] eventdev: have timer " Mattias Rönnblom
  3 siblings, 1 reply; 17+ messages in thread
From: Mattias Rönnblom @ 2022-10-10 14:54 UTC (permalink / raw)
  To: Jay Jayatheerthan, Erik Gabriel Carrillo, Abhinandan Gujjar, Jerin Jacob
  Cc: dev, Harry van Haaren, hofors, Mattias Rönnblom

Update the Event Ethernet Rx Adapter's service function to report as
idle (i.e., return -EAGAIN) in case no Ethernet frames were received
from the ethdev and no events were enqueued to the event device.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 56 ++++++++++++++++++-------
 1 file changed, 41 insertions(+), 15 deletions(-)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 5c3021a184..cf7bbd4d69 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1184,7 +1184,7 @@ rxa_intr_thread(void *arg)
 /* Dequeue <port, q> from interrupt ring and enqueue received
  * mbufs to eventdev
  */
-static inline void
+static inline bool
 rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)
 {
 	uint32_t n;
@@ -1194,20 +1194,27 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)
 	struct rte_event_eth_rx_adapter_stats *stats;
 	rte_spinlock_t *ring_lock;
 	uint8_t max_done = 0;
+	bool work = false;
 
 	if (rx_adapter->num_rx_intr == 0)
-		return;
+		return work;
 
 	if (rte_ring_count(rx_adapter->intr_ring) == 0
 		&& !rx_adapter->qd_valid)
-		return;
+		return work;
 
 	buf = &rx_adapter->event_enqueue_buffer;
 	stats = &rx_adapter->stats;
 	ring_lock = &rx_adapter->intr_ring_lock;
 
-	if (buf->count >= BATCH_SIZE)
-		rxa_flush_event_buffer(rx_adapter, buf, stats);
+	if (buf->count >= BATCH_SIZE) {
+		uint16_t n;
+
+		n = rxa_flush_event_buffer(rx_adapter, buf, stats);
+
+		if (likely(n > 0))
+			work = true;
+	}
 
 	while (rxa_pkt_buf_available(buf)) {
 		struct eth_device_info *dev_info;
@@ -1289,7 +1296,12 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)
 	}
 
 done:
-	rx_adapter->stats.rx_intr_packets += nb_rx;
+	if (nb_rx > 0) {
+		rx_adapter->stats.rx_intr_packets += nb_rx;
+		work = true;
+	}
+
+	return work;
 }
 
 /*
@@ -1305,7 +1317,7 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)
  * the hypervisor's switching layer where adjustments can be made to deal with
  * it.
  */
-static inline void
+static inline bool
 rxa_poll(struct event_eth_rx_adapter *rx_adapter)
 {
 	uint32_t num_queue;
@@ -1314,6 +1326,7 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter)
 	struct rte_event_eth_rx_adapter_stats *stats = NULL;
 	uint32_t wrr_pos;
 	uint32_t max_nb_rx;
+	bool work = false;
 
 	wrr_pos = rx_adapter->wrr_pos;
 	max_nb_rx = rx_adapter->max_nb_rx;
@@ -1329,14 +1342,20 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter)
 		/* Don't do a batch dequeue from the rx queue if there isn't
 		 * enough space in the enqueue buffer.
 		 */
-		if (buf->count >= BATCH_SIZE)
-			rxa_flush_event_buffer(rx_adapter, buf, stats);
+		if (buf->count >= BATCH_SIZE) {
+			uint16_t n;
+
+			n = rxa_flush_event_buffer(rx_adapter, buf, stats);
+
+			if (likely(n > 0))
+				work = true;
+		}
 		if (!rxa_pkt_buf_available(buf)) {
 			if (rx_adapter->use_queue_event_buf)
 				goto poll_next_entry;
 			else {
 				rx_adapter->wrr_pos = wrr_pos;
-				return;
+				break;
 			}
 		}
 
@@ -1352,6 +1371,11 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter)
 		if (++wrr_pos == rx_adapter->wrr_len)
 			wrr_pos = 0;
 	}
+
+	if (nb_rx > 0)
+		work = true;
+
+	return work;
 }
 
 static void
@@ -1384,12 +1408,14 @@ static int
 rxa_service_func(void *args)
 {
 	struct event_eth_rx_adapter *rx_adapter = args;
+	bool intr_work;
+	bool poll_work;
 
 	if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0)
-		return 0;
+		return -EAGAIN;
 	if (!rx_adapter->rxa_started) {
 		rte_spinlock_unlock(&rx_adapter->rx_lock);
-		return 0;
+		return -EAGAIN;
 	}
 
 	if (rx_adapter->ena_vector) {
@@ -1410,12 +1436,12 @@ rxa_service_func(void *args)
 		}
 	}
 
-	rxa_intr_ring_dequeue(rx_adapter);
-	rxa_poll(rx_adapter);
+	intr_work = rxa_intr_ring_dequeue(rx_adapter);
+	poll_work = rxa_poll(rx_adapter);
 
 	rte_spinlock_unlock(&rx_adapter->rx_lock);
 
-	return 0;
+	return intr_work || poll_work ? 0 : -EAGAIN;
 }
 
 static void *
-- 
2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
  2022-10-10 14:54 [PATCH 0/4] Have event adapters report idle status Mattias Rönnblom
  2022-10-10 14:54 ` [PATCH 1/4] eventdev: have crypto adapter appropriately report idle Mattias Rönnblom
  2022-10-10 14:54 ` [PATCH 2/4] eventdev: have ethernet Rx " Mattias Rönnblom
@ 2022-10-10 14:54 ` Mattias Rönnblom
  2022-10-11  7:10   ` Jayatheerthan, Jay
  2022-10-10 14:54 ` [PATCH 4/4] eventdev: have timer " Mattias Rönnblom
  3 siblings, 1 reply; 17+ messages in thread
From: Mattias Rönnblom @ 2022-10-10 14:54 UTC (permalink / raw)
  To: Jay Jayatheerthan, Erik Gabriel Carrillo, Abhinandan Gujjar, Jerin Jacob
  Cc: dev, Harry van Haaren, hofors, Mattias Rönnblom

Update the Event Ethernet Tx Adapter's service function to report as
idle (i.e., return -EAGAIN) in case no events were dequeued from the
event device and no Ethernet frames were sent out on the wire.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index 7f7d86f683..c2a848103b 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -639,6 +639,7 @@ txa_service_func(void *args)
 	struct txa_service_data *txa = args;
 	uint8_t dev_id;
 	uint8_t port;
+	int ret = -EAGAIN;
 	uint16_t n;
 	uint32_t nb_tx, max_nb_tx;
 	struct rte_event ev[TXA_BATCH_SIZE];
@@ -648,10 +649,10 @@ txa_service_func(void *args)
 	port = txa->port_id;
 
 	if (txa->nb_queues == 0)
-		return 0;
+		return ret;
 
 	if (!rte_spinlock_trylock(&txa->tx_lock))
-		return 0;
+		return ret;
 
 	for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
 
@@ -659,6 +660,7 @@ txa_service_func(void *args)
 		if (!n)
 			break;
 		txa_service_tx(txa, ev, n);
+		ret = 0;
 	}
 
 	if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
@@ -692,10 +694,13 @@ txa_service_func(void *args)
 			}
 		}
 
-		txa->stats.tx_packets += nb_tx;
+		if (likely(nb_tx > 0)) {
+			txa->stats.tx_packets += nb_tx;
+			ret = 0;
+		}
 	}
 	rte_spinlock_unlock(&txa->tx_lock);
-	return 0;
+	return ret;
 }
 
 static int
-- 
2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 4/4] eventdev: have timer adapter appropriately report idle
  2022-10-10 14:54 [PATCH 0/4] Have event adapters report idle status Mattias Rönnblom
                   ` (2 preceding siblings ...)
  2022-10-10 14:54 ` [PATCH 3/4] eventdev: have ethernet Tx " Mattias Rönnblom
@ 2022-10-10 14:54 ` Mattias Rönnblom
  2022-10-17 21:42   ` Carrillo, Erik G
  3 siblings, 1 reply; 17+ messages in thread
From: Mattias Rönnblom @ 2022-10-10 14:54 UTC (permalink / raw)
  To: Jay Jayatheerthan, Erik Gabriel Carrillo, Abhinandan Gujjar, Jerin Jacob
  Cc: dev, Harry van Haaren, hofors, Mattias Rönnblom

Update the Event Timer Adapter's service function to report as idle
(i.e., return -EAGAIN) in case no timer events were enqueued to the
event device.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 lib/eventdev/rte_event_timer_adapter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index 1731770b5e..a0f14bf861 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -785,6 +785,7 @@ swtim_service_func(void *arg)
 	struct swtim *sw = swtim_pmd_priv(adapter);
 	uint16_t nb_evs_flushed = 0;
 	uint16_t nb_evs_invalid = 0;
+	const uint64_t prior_enq_count = sw->stats.ev_enq_count;
 
 	if (swtim_did_tick(sw)) {
 		rte_timer_alt_manage(sw->timer_data_id,
@@ -811,7 +812,7 @@ swtim_service_func(void *arg)
 	rte_event_maintain(adapter->data->event_dev_id,
 			   adapter->data->event_port_id, 0);
 
-	return 0;
+	return prior_enq_count == sw->stats.ev_enq_count ? -EAGAIN : 0;
 }
 
 /* The adapter initialization function rounds the mempool size up to the next
-- 
2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
  2022-10-10 14:54 ` [PATCH 2/4] eventdev: have ethernet Rx " Mattias Rönnblom
@ 2022-10-11  7:10   ` Jayatheerthan, Jay
  2022-10-13  1:32     ` Naga Harish K, S V
  0 siblings, 1 reply; 17+ messages in thread
From: Jayatheerthan, Jay @ 2022-10-11  7:10 UTC (permalink / raw)
  To: mattias.ronnblom, Carrillo, Erik G, Gujjar, Abhinandan S,
	Jerin Jacob, Naga Harish K, S V
  Cc: dev, Van Haaren, Harry, hofors, mattias.ronnblom

@Harish, Could you review the patch ?

-Jay

> -----Original Message-----
> From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Sent: Monday, October 10, 2022 8:24 PM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>; hofors@lysator.liu.se; mattias.ronnblom
> <mattias.ronnblom@ericsson.com>
> Subject: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
> 
> Update the Event Ethernet Rx Adapter's service function to report as
> idle (i.e., return -EAGAIN) in case no Ethernet frames were received
> from the ethdev and no events were enqueued to the event device.
> 
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 56 ++++++++++++++++++-------
>  1 file changed, 41 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index 5c3021a184..cf7bbd4d69 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -1184,7 +1184,7 @@ rxa_intr_thread(void *arg)
>  /* Dequeue <port, q> from interrupt ring and enqueue received
>   * mbufs to eventdev
>   */
> -static inline void
> +static inline bool
>  rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)
>  {
>  	uint32_t n;
> @@ -1194,20 +1194,27 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)
>  	struct rte_event_eth_rx_adapter_stats *stats;
>  	rte_spinlock_t *ring_lock;
>  	uint8_t max_done = 0;
> +	bool work = false;
> 
>  	if (rx_adapter->num_rx_intr == 0)
> -		return;
> +		return work;
> 
>  	if (rte_ring_count(rx_adapter->intr_ring) == 0
>  		&& !rx_adapter->qd_valid)
> -		return;
> +		return work;
> 
>  	buf = &rx_adapter->event_enqueue_buffer;
>  	stats = &rx_adapter->stats;
>  	ring_lock = &rx_adapter->intr_ring_lock;
> 
> -	if (buf->count >= BATCH_SIZE)
> -		rxa_flush_event_buffer(rx_adapter, buf, stats);
> +	if (buf->count >= BATCH_SIZE) {
> +		uint16_t n;
> +
> +		n = rxa_flush_event_buffer(rx_adapter, buf, stats);
> +
> +		if (likely(n > 0))
> +			work = true;
> +	}
> 
>  	while (rxa_pkt_buf_available(buf)) {
>  		struct eth_device_info *dev_info;
> @@ -1289,7 +1296,12 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)
>  	}
> 
>  done:
> -	rx_adapter->stats.rx_intr_packets += nb_rx;
> +	if (nb_rx > 0) {
> +		rx_adapter->stats.rx_intr_packets += nb_rx;
> +		work = true;
> +	}
> +
> +	return work;
>  }
> 
>  /*
> @@ -1305,7 +1317,7 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)
>   * the hypervisor's switching layer where adjustments can be made to deal with
>   * it.
>   */
> -static inline void
> +static inline bool
>  rxa_poll(struct event_eth_rx_adapter *rx_adapter)
>  {
>  	uint32_t num_queue;
> @@ -1314,6 +1326,7 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter)
>  	struct rte_event_eth_rx_adapter_stats *stats = NULL;
>  	uint32_t wrr_pos;
>  	uint32_t max_nb_rx;
> +	bool work = false;
> 
>  	wrr_pos = rx_adapter->wrr_pos;
>  	max_nb_rx = rx_adapter->max_nb_rx;
> @@ -1329,14 +1342,20 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter)
>  		/* Don't do a batch dequeue from the rx queue if there isn't
>  		 * enough space in the enqueue buffer.
>  		 */
> -		if (buf->count >= BATCH_SIZE)
> -			rxa_flush_event_buffer(rx_adapter, buf, stats);
> +		if (buf->count >= BATCH_SIZE) {
> +			uint16_t n;
> +
> +			n = rxa_flush_event_buffer(rx_adapter, buf, stats);
> +
> +			if (likely(n > 0))
> +				work = true;
> +		}
>  		if (!rxa_pkt_buf_available(buf)) {
>  			if (rx_adapter->use_queue_event_buf)
>  				goto poll_next_entry;
>  			else {
>  				rx_adapter->wrr_pos = wrr_pos;
> -				return;
> +				break;
>  			}
>  		}
> 
> @@ -1352,6 +1371,11 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter)
>  		if (++wrr_pos == rx_adapter->wrr_len)
>  			wrr_pos = 0;
>  	}
> +
> +	if (nb_rx > 0)
> +		work = true;
> +
> +	return work;
>  }
> 
>  static void
> @@ -1384,12 +1408,14 @@ static int
>  rxa_service_func(void *args)
>  {
>  	struct event_eth_rx_adapter *rx_adapter = args;
> +	bool intr_work;
> +	bool poll_work;
> 
>  	if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0)
> -		return 0;
> +		return -EAGAIN;
>  	if (!rx_adapter->rxa_started) {
>  		rte_spinlock_unlock(&rx_adapter->rx_lock);
> -		return 0;
> +		return -EAGAIN;
>  	}
> 
>  	if (rx_adapter->ena_vector) {
> @@ -1410,12 +1436,12 @@ rxa_service_func(void *args)
>  		}
>  	}
> 
> -	rxa_intr_ring_dequeue(rx_adapter);
> -	rxa_poll(rx_adapter);
> +	intr_work = rxa_intr_ring_dequeue(rx_adapter);
> +	poll_work = rxa_poll(rx_adapter);
> 
>  	rte_spinlock_unlock(&rx_adapter->rx_lock);
> 
> -	return 0;
> +	return intr_work || poll_work ? 0 : -EAGAIN;
>  }
> 
>  static void *
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
  2022-10-10 14:54 ` [PATCH 3/4] eventdev: have ethernet Tx " Mattias Rönnblom
@ 2022-10-11  7:10   ` Jayatheerthan, Jay
  2022-10-13  1:30     ` Naga Harish K, S V
  0 siblings, 1 reply; 17+ messages in thread
From: Jayatheerthan, Jay @ 2022-10-11  7:10 UTC (permalink / raw)
  To: mattias.ronnblom, Carrillo, Erik G, Gujjar, Abhinandan S,
	Jerin Jacob, Naga Harish K, S V
  Cc: dev, Van Haaren, Harry, hofors, mattias.ronnblom

@Harish, could you review the patch ?

-Jay



> -----Original Message-----
> From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Sent: Monday, October 10, 2022 8:24 PM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>; hofors@lysator.liu.se; mattias.ronnblom
> <mattias.ronnblom@ericsson.com>
> Subject: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
> 
> Update the Event Ethernet Tx Adapter's service function to report as
> idle (i.e., return -EAGAIN) in case no events were dequeued from the
> event device and no Ethernet frames were sent out on the wire.
> 
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> ---
>  lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
> index 7f7d86f683..c2a848103b 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -639,6 +639,7 @@ txa_service_func(void *args)
>  	struct txa_service_data *txa = args;
>  	uint8_t dev_id;
>  	uint8_t port;
> +	int ret = -EAGAIN;
>  	uint16_t n;
>  	uint32_t nb_tx, max_nb_tx;
>  	struct rte_event ev[TXA_BATCH_SIZE];
> @@ -648,10 +649,10 @@ txa_service_func(void *args)
>  	port = txa->port_id;
> 
>  	if (txa->nb_queues == 0)
> -		return 0;
> +		return ret;
> 
>  	if (!rte_spinlock_trylock(&txa->tx_lock))
> -		return 0;
> +		return ret;
> 
>  	for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
> 
> @@ -659,6 +660,7 @@ txa_service_func(void *args)
>  		if (!n)
>  			break;
>  		txa_service_tx(txa, ev, n);
> +		ret = 0;
>  	}
> 
>  	if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
> @@ -692,10 +694,13 @@ txa_service_func(void *args)
>  			}
>  		}
> 
> -		txa->stats.tx_packets += nb_tx;
> +		if (likely(nb_tx > 0)) {
> +			txa->stats.tx_packets += nb_tx;
> +			ret = 0;
> +		}
>  	}
>  	rte_spinlock_unlock(&txa->tx_lock);
> -	return 0;
> +	return ret;
>  }
> 
>  static int
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
  2022-10-11  7:10   ` Jayatheerthan, Jay
@ 2022-10-13  1:30     ` Naga Harish K, S V
  2022-10-18  9:19       ` Jayatheerthan, Jay
  0 siblings, 1 reply; 17+ messages in thread
From: Naga Harish K, S V @ 2022-10-13  1:30 UTC (permalink / raw)
  To: Jayatheerthan, Jay, mattias.ronnblom, Carrillo, Erik G, Gujjar,
	Abhinandan S, Jerin Jacob
  Cc: dev, Van Haaren, Harry, hofors, mattias.ronnblom



> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Tuesday, October 11, 2022 12:41 PM
> To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
> Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> report idle
> 
> @Harish, could you review the patch ?
> 
> -Jay
> 
> 
> 
> > -----Original Message-----
> > From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > Sent: Monday, October 10, 2022 8:24 PM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > hofors@lysator.liu.se; mattias.ronnblom
> > <mattias.ronnblom@ericsson.com>
> > Subject: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > report idle
> >
> > Update the Event Ethernet Tx Adapter's service function to report as
> > idle (i.e., return -EAGAIN) in case no events were dequeued from the
> > event device and no Ethernet frames were sent out on the wire.
> >
> > Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > ---
> >  lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > index 7f7d86f683..c2a848103b 100644
> > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > @@ -639,6 +639,7 @@ txa_service_func(void *args)
> >  	struct txa_service_data *txa = args;
> >  	uint8_t dev_id;
> >  	uint8_t port;
> > +	int ret = -EAGAIN;
> >  	uint16_t n;
> >  	uint32_t nb_tx, max_nb_tx;
> >  	struct rte_event ev[TXA_BATCH_SIZE]; @@ -648,10 +649,10 @@
> > txa_service_func(void *args)
> >  	port = txa->port_id;
> >
> >  	if (txa->nb_queues == 0)
> > -		return 0;
> > +		return ret;
> >
> >  	if (!rte_spinlock_trylock(&txa->tx_lock))
> > -		return 0;
> > +		return ret;
> >
> >  	for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
> >
> > @@ -659,6 +660,7 @@ txa_service_func(void *args)
> >  		if (!n)
> >  			break;
> >  		txa_service_tx(txa, ev, n);
> > +		ret = 0;
> >  	}
> >
> >  	if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) { @@ -
> 692,10
> > +694,13 @@ txa_service_func(void *args)
> >  			}
> >  		}
> >
> > -		txa->stats.tx_packets += nb_tx;
> > +		if (likely(nb_tx > 0)) {

How are the performance numbers before and after this patch?
Trying to understand the performance impact, as new condition is added to the service function Datapath.

> > +			txa->stats.tx_packets += nb_tx;
> > +			ret = 0;
> > +		}
> >  	}
> >  	rte_spinlock_unlock(&txa->tx_lock);
> > -	return 0;
> > +	return ret;
> >  }
> >
> >  static int
> > --
> > 2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
  2022-10-11  7:10   ` Jayatheerthan, Jay
@ 2022-10-13  1:32     ` Naga Harish K, S V
  2022-10-13  9:53       ` Mattias Rönnblom
  0 siblings, 1 reply; 17+ messages in thread
From: Naga Harish K, S V @ 2022-10-13  1:32 UTC (permalink / raw)
  To: Jayatheerthan, Jay, mattias.ronnblom, Carrillo, Erik G, Gujjar,
	Abhinandan S, Jerin Jacob
  Cc: dev, Van Haaren, Harry, hofors, mattias.ronnblom



> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Tuesday, October 11, 2022 12:40 PM
> To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
> Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> Subject: RE: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately
> report idle
> 
> @Harish, Could you review the patch ?
> 
> -Jay
> 
> > -----Original Message-----
> > From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > Sent: Monday, October 10, 2022 8:24 PM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > hofors@lysator.liu.se; mattias.ronnblom
> > <mattias.ronnblom@ericsson.com>
> > Subject: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately
> > report idle
> >
> > Update the Event Ethernet Rx Adapter's service function to report as
> > idle (i.e., return -EAGAIN) in case no Ethernet frames were received
> > from the ethdev and no events were enqueued to the event device.
> >
> > Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > ---
> >  lib/eventdev/rte_event_eth_rx_adapter.c | 56
> > ++++++++++++++++++-------
> >  1 file changed, 41 insertions(+), 15 deletions(-)
> >
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > index 5c3021a184..cf7bbd4d69 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -1184,7 +1184,7 @@ rxa_intr_thread(void *arg)
> >  /* Dequeue <port, q> from interrupt ring and enqueue received
> >   * mbufs to eventdev
> >   */
> > -static inline void
> > +static inline bool
> >  rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)  {
> >  	uint32_t n;
> > @@ -1194,20 +1194,27 @@ rxa_intr_ring_dequeue(struct
> event_eth_rx_adapter *rx_adapter)
> >  	struct rte_event_eth_rx_adapter_stats *stats;
> >  	rte_spinlock_t *ring_lock;
> >  	uint8_t max_done = 0;
> > +	bool work = false;
> >
> >  	if (rx_adapter->num_rx_intr == 0)
> > -		return;
> > +		return work;
> >
> >  	if (rte_ring_count(rx_adapter->intr_ring) == 0
> >  		&& !rx_adapter->qd_valid)
> > -		return;
> > +		return work;
> >
> >  	buf = &rx_adapter->event_enqueue_buffer;
> >  	stats = &rx_adapter->stats;
> >  	ring_lock = &rx_adapter->intr_ring_lock;
> >
> > -	if (buf->count >= BATCH_SIZE)
> > -		rxa_flush_event_buffer(rx_adapter, buf, stats);
> > +	if (buf->count >= BATCH_SIZE) {
> > +		uint16_t n;
> > +
> > +		n = rxa_flush_event_buffer(rx_adapter, buf, stats);
> > +
> > +		if (likely(n > 0))
> > +			work = true;
> > +	}
> >
> >  	while (rxa_pkt_buf_available(buf)) {
> >  		struct eth_device_info *dev_info;
> > @@ -1289,7 +1296,12 @@ rxa_intr_ring_dequeue(struct
> event_eth_rx_adapter *rx_adapter)
> >  	}
> >
> >  done:
> > -	rx_adapter->stats.rx_intr_packets += nb_rx;
> > +	if (nb_rx > 0) {

How are the performance numbers before and after this patch?
Trying to understand the performance impact, as new condition is added to the service function Datapath.

> > +		rx_adapter->stats.rx_intr_packets += nb_rx;
> > +		work = true;
> > +	}
> > +
> > +	return work;
> >  }
> >
> >  /*
> > @@ -1305,7 +1317,7 @@ rxa_intr_ring_dequeue(struct
> event_eth_rx_adapter *rx_adapter)
> >   * the hypervisor's switching layer where adjustments can be made to deal
> with
> >   * it.
> >   */
> > -static inline void
> > +static inline bool
> >  rxa_poll(struct event_eth_rx_adapter *rx_adapter)  {
> >  	uint32_t num_queue;
> > @@ -1314,6 +1326,7 @@ rxa_poll(struct event_eth_rx_adapter
> *rx_adapter)
> >  	struct rte_event_eth_rx_adapter_stats *stats = NULL;
> >  	uint32_t wrr_pos;
> >  	uint32_t max_nb_rx;
> > +	bool work = false;
> >
> >  	wrr_pos = rx_adapter->wrr_pos;
> >  	max_nb_rx = rx_adapter->max_nb_rx;
> > @@ -1329,14 +1342,20 @@ rxa_poll(struct event_eth_rx_adapter
> *rx_adapter)
> >  		/* Don't do a batch dequeue from the rx queue if there isn't
> >  		 * enough space in the enqueue buffer.
> >  		 */
> > -		if (buf->count >= BATCH_SIZE)
> > -			rxa_flush_event_buffer(rx_adapter, buf, stats);
> > +		if (buf->count >= BATCH_SIZE) {
> > +			uint16_t n;
> > +
> > +			n = rxa_flush_event_buffer(rx_adapter, buf, stats);
> > +
> > +			if (likely(n > 0))
> > +				work = true;

Same as above

> > +		}
> >  		if (!rxa_pkt_buf_available(buf)) {
> >  			if (rx_adapter->use_queue_event_buf)
> >  				goto poll_next_entry;
> >  			else {
> >  				rx_adapter->wrr_pos = wrr_pos;
> > -				return;
> > +				break;
> >  			}
> >  		}
> >
> > @@ -1352,6 +1371,11 @@ rxa_poll(struct event_eth_rx_adapter
> *rx_adapter)
> >  		if (++wrr_pos == rx_adapter->wrr_len)
> >  			wrr_pos = 0;
> >  	}
> > +
> > +	if (nb_rx > 0)
> > +		work = true;
> > +
> > +	return work;

Same as above

> >  }
> >
> >  static void
> > @@ -1384,12 +1408,14 @@ static int
> >  rxa_service_func(void *args)
> >  {
> >  	struct event_eth_rx_adapter *rx_adapter = args;
> > +	bool intr_work;
> > +	bool poll_work;
> >
> >  	if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0)
> > -		return 0;
> > +		return -EAGAIN;
> >  	if (!rx_adapter->rxa_started) {
> >  		rte_spinlock_unlock(&rx_adapter->rx_lock);
> > -		return 0;
> > +		return -EAGAIN;
> >  	}
> >
> >  	if (rx_adapter->ena_vector) {
> > @@ -1410,12 +1436,12 @@ rxa_service_func(void *args)
> >  		}
> >  	}
> >
> > -	rxa_intr_ring_dequeue(rx_adapter);
> > -	rxa_poll(rx_adapter);
> > +	intr_work = rxa_intr_ring_dequeue(rx_adapter);
> > +	poll_work = rxa_poll(rx_adapter);
> >
> >  	rte_spinlock_unlock(&rx_adapter->rx_lock);
> >
> > -	return 0;
> > +	return intr_work || poll_work ? 0 : -EAGAIN;
> >  }
> >
> >  static void *
> > --
> > 2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
  2022-10-13  1:32     ` Naga Harish K, S V
@ 2022-10-13  9:53       ` Mattias Rönnblom
  2022-10-14 17:36         ` Jerin Jacob
  0 siblings, 1 reply; 17+ messages in thread
From: Mattias Rönnblom @ 2022-10-13  9:53 UTC (permalink / raw)
  To: Naga Harish K, S V, Jayatheerthan, Jay, Carrillo, Erik G, Gujjar,
	Abhinandan S, Jerin Jacob
  Cc: dev, Van Haaren, Harry, hofors

On 2022-10-13 03:32, Naga Harish K, S V wrote:
> 
> 
>> -----Original Message-----
>> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
>> Sent: Tuesday, October 11, 2022 12:40 PM
>> To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
>> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
>> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
>> Harish K, S V <s.v.naga.harish.k@intel.com>
>> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
>> hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
>> Subject: RE: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately
>> report idle
>>
>> @Harish, Could you review the patch ?
>>
>> -Jay
>>
>>> -----Original Message-----
>>> From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
>>> Sent: Monday, October 10, 2022 8:24 PM
>>> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
>>> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
>>> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
>>> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
>>> hofors@lysator.liu.se; mattias.ronnblom
>>> <mattias.ronnblom@ericsson.com>
>>> Subject: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately
>>> report idle
>>>
>>> Update the Event Ethernet Rx Adapter's service function to report as
>>> idle (i.e., return -EAGAIN) in case no Ethernet frames were received
>>> from the ethdev and no events were enqueued to the event device.
>>>
>>> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
>>> ---
>>>   lib/eventdev/rte_event_eth_rx_adapter.c | 56
>>> ++++++++++++++++++-------
>>>   1 file changed, 41 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
>>> b/lib/eventdev/rte_event_eth_rx_adapter.c
>>> index 5c3021a184..cf7bbd4d69 100644
>>> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
>>> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
>>> @@ -1184,7 +1184,7 @@ rxa_intr_thread(void *arg)
>>>   /* Dequeue <port, q> from interrupt ring and enqueue received
>>>    * mbufs to eventdev
>>>    */
>>> -static inline void
>>> +static inline bool
>>>   rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter)  {
>>>   	uint32_t n;
>>> @@ -1194,20 +1194,27 @@ rxa_intr_ring_dequeue(struct
>> event_eth_rx_adapter *rx_adapter)
>>>   	struct rte_event_eth_rx_adapter_stats *stats;
>>>   	rte_spinlock_t *ring_lock;
>>>   	uint8_t max_done = 0;
>>> +	bool work = false;
>>>
>>>   	if (rx_adapter->num_rx_intr == 0)
>>> -		return;
>>> +		return work;
>>>
>>>   	if (rte_ring_count(rx_adapter->intr_ring) == 0
>>>   		&& !rx_adapter->qd_valid)
>>> -		return;
>>> +		return work;
>>>
>>>   	buf = &rx_adapter->event_enqueue_buffer;
>>>   	stats = &rx_adapter->stats;
>>>   	ring_lock = &rx_adapter->intr_ring_lock;
>>>
>>> -	if (buf->count >= BATCH_SIZE)
>>> -		rxa_flush_event_buffer(rx_adapter, buf, stats);
>>> +	if (buf->count >= BATCH_SIZE) {
>>> +		uint16_t n;
>>> +
>>> +		n = rxa_flush_event_buffer(rx_adapter, buf, stats);
>>> +
>>> +		if (likely(n > 0))
>>> +			work = true;
>>> +	}
>>>
>>>   	while (rxa_pkt_buf_available(buf)) {
>>>   		struct eth_device_info *dev_info;
>>> @@ -1289,7 +1296,12 @@ rxa_intr_ring_dequeue(struct
>> event_eth_rx_adapter *rx_adapter)
>>>   	}
>>>
>>>   done:
>>> -	rx_adapter->stats.rx_intr_packets += nb_rx;
>>> +	if (nb_rx > 0) {
> 
> How are the performance numbers before and after this patch?
> Trying to understand the performance impact, as new condition is added to the service function Datapath.
> 
I haven't tested the RX and TX adapters separately, but if you run them 
on the same core, I get the following result:

Without patches, with stats disabled: 16,0 Mpps
Without patches, with stats enabled: 16,1 Mpps
With patches, with stats disabled: 16,1 Mpps
With patches, with stats enabled: 16,2 Mpps

So these patches, with this particular hardware, compiler, and test 
application, adding a tiny bit of additional logic actually make the 
RX+TX adapter perform better. This is contrary to what you might expect, 
and I'm sure YMMV.

Enabling service core statistics (which boils down to a 2x rdtsc and 
some cheap arithmetic in rte_service.c) actually make the RX+TX adapter 
core perform better, both before and after this patchset. Also contrary 
to what you might expect.

The results are consistent across multiple runs.

GCC 11.2.0 and AMD Zen 3 @ 3,7 GHz. Event device is DSW and I/O is the 
ring Ethdev.

>>> +		rx_adapter->stats.rx_intr_packets += nb_rx;
>>> +		work = true;
>>> +	}
>>> +
>>> +	return work;
>>>   }
>>>
>>>   /*
>>> @@ -1305,7 +1317,7 @@ rxa_intr_ring_dequeue(struct
>> event_eth_rx_adapter *rx_adapter)
>>>    * the hypervisor's switching layer where adjustments can be made to deal
>> with
>>>    * it.
>>>    */
>>> -static inline void
>>> +static inline bool
>>>   rxa_poll(struct event_eth_rx_adapter *rx_adapter)  {
>>>   	uint32_t num_queue;
>>> @@ -1314,6 +1326,7 @@ rxa_poll(struct event_eth_rx_adapter
>> *rx_adapter)
>>>   	struct rte_event_eth_rx_adapter_stats *stats = NULL;
>>>   	uint32_t wrr_pos;
>>>   	uint32_t max_nb_rx;
>>> +	bool work = false;
>>>
>>>   	wrr_pos = rx_adapter->wrr_pos;
>>>   	max_nb_rx = rx_adapter->max_nb_rx;
>>> @@ -1329,14 +1342,20 @@ rxa_poll(struct event_eth_rx_adapter
>> *rx_adapter)
>>>   		/* Don't do a batch dequeue from the rx queue if there isn't
>>>   		 * enough space in the enqueue buffer.
>>>   		 */
>>> -		if (buf->count >= BATCH_SIZE)
>>> -			rxa_flush_event_buffer(rx_adapter, buf, stats);
>>> +		if (buf->count >= BATCH_SIZE) {
>>> +			uint16_t n;
>>> +
>>> +			n = rxa_flush_event_buffer(rx_adapter, buf, stats);
>>> +
>>> +			if (likely(n > 0))
>>> +				work = true;
> 
> Same as above
> 
>>> +		}
>>>   		if (!rxa_pkt_buf_available(buf)) {
>>>   			if (rx_adapter->use_queue_event_buf)
>>>   				goto poll_next_entry;
>>>   			else {
>>>   				rx_adapter->wrr_pos = wrr_pos;
>>> -				return;
>>> +				break;
>>>   			}
>>>   		}
>>>
>>> @@ -1352,6 +1371,11 @@ rxa_poll(struct event_eth_rx_adapter
>> *rx_adapter)
>>>   		if (++wrr_pos == rx_adapter->wrr_len)
>>>   			wrr_pos = 0;
>>>   	}
>>> +
>>> +	if (nb_rx > 0)
>>> +		work = true;
>>> +
>>> +	return work;
> 
> Same as above
> 
>>>   }
>>>
>>>   static void
>>> @@ -1384,12 +1408,14 @@ static int
>>>   rxa_service_func(void *args)
>>>   {
>>>   	struct event_eth_rx_adapter *rx_adapter = args;
>>> +	bool intr_work;
>>> +	bool poll_work;
>>>
>>>   	if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0)
>>> -		return 0;
>>> +		return -EAGAIN;
>>>   	if (!rx_adapter->rxa_started) {
>>>   		rte_spinlock_unlock(&rx_adapter->rx_lock);
>>> -		return 0;
>>> +		return -EAGAIN;
>>>   	}
>>>
>>>   	if (rx_adapter->ena_vector) {
>>> @@ -1410,12 +1436,12 @@ rxa_service_func(void *args)
>>>   		}
>>>   	}
>>>
>>> -	rxa_intr_ring_dequeue(rx_adapter);
>>> -	rxa_poll(rx_adapter);
>>> +	intr_work = rxa_intr_ring_dequeue(rx_adapter);
>>> +	poll_work = rxa_poll(rx_adapter);
>>>
>>>   	rte_spinlock_unlock(&rx_adapter->rx_lock);
>>>
>>> -	return 0;
>>> +	return intr_work || poll_work ? 0 : -EAGAIN;
>>>   }
>>>
>>>   static void *
>>> --
>>> 2.34.1
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
  2022-10-13  9:53       ` Mattias Rönnblom
@ 2022-10-14 17:36         ` Jerin Jacob
  2022-10-17 12:36           ` Naga Harish K, S V
  0 siblings, 1 reply; 17+ messages in thread
From: Jerin Jacob @ 2022-10-14 17:36 UTC (permalink / raw)
  To: Mattias Rönnblom
  Cc: Naga Harish K, S V, Jayatheerthan, Jay, Carrillo, Erik G, Gujjar,
	Abhinandan S, Jerin Jacob, dev, Van Haaren, Harry, hofors

On Thu, Oct 13, 2022 at 3:23 PM Mattias Rönnblom
<mattias.ronnblom@ericsson.com> wrote:
>
> On 2022-10-13 03:32, Naga Harish K, S V wrote:
> >
> >
> >> -----Original Message-----
> >> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> >> Sent: Tuesday, October 11, 2022 12:40 PM
> >> To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> >> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> >> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
> >> Harish K, S V <s.v.naga.harish.k@intel.com>
> >> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> >> hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> >> Subject: RE: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately
> >> report idle
> >>
> >> @Harish, Could you review the patch ?
> >>
> >> -Jay
> >>
> >>>
> >>>   done:
> >>> -   rx_adapter->stats.rx_intr_packets += nb_rx;
> >>> +   if (nb_rx > 0) {
> >
> > How are the performance numbers before and after this patch?
> > Trying to understand the performance impact, as new condition is added to the service function Datapath.
> >
> I haven't tested the RX and TX adapters separately, but if you run them
> on the same core, I get the following result:
>
> Without patches, with stats disabled: 16,0 Mpps
> Without patches, with stats enabled: 16,1 Mpps
> With patches, with stats disabled: 16,1 Mpps
> With patches, with stats enabled: 16,2 Mpps
>
> So these patches, with this particular hardware, compiler, and test
> application, adding a tiny bit of additional logic actually make the
> RX+TX adapter perform better. This is contrary to what you might expect,
> and I'm sure YMMV.
>
> Enabling service core statistics (which boils down to a 2x rdtsc and
> some cheap arithmetic in rte_service.c) actually make the RX+TX adapter
> core perform better, both before and after this patchset. Also contrary
> to what you might expect.
>
> The results are consistent across multiple runs.
>
> GCC 11.2.0 and AMD Zen 3 @ 3,7 GHz. Event device is DSW and I/O is the
> ring Ethdev.

@Naga Harish K, S V @Jayatheerthan, Jay  @Gujjar, Abhinandan S  @Erik
Gabriel Carrillo
Planning to take this series for rc2. If there are no other comments,
I will merge the series then.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 1/4] eventdev: have crypto adapter appropriately report idle
  2022-10-10 14:54 ` [PATCH 1/4] eventdev: have crypto adapter appropriately report idle Mattias Rönnblom
@ 2022-10-17  5:47   ` Gujjar, Abhinandan S
  0 siblings, 0 replies; 17+ messages in thread
From: Gujjar, Abhinandan S @ 2022-10-17  5:47 UTC (permalink / raw)
  To: mattias.ronnblom, Jayatheerthan, Jay, Carrillo, Erik G, Jerin Jacob
  Cc: dev, Van Haaren, Harry, hofors, mattias.ronnblom

Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>

> -----Original Message-----
> From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Sent: Monday, October 10, 2022 8:24 PM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> Subject: [PATCH 1/4] eventdev: have crypto adapter appropriately report idle
> 
> Update the event crypto adapter's service function to report as idle (i.e., return
> -EAGAIN) in case no crypto operations were performed.
> 
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> ---
>  lib/eventdev/rte_event_crypto_adapter.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> b/lib/eventdev/rte_event_crypto_adapter.c
> index a11cbcf4f3..59777726f6 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -771,7 +771,7 @@ eca_crypto_adapter_deq_run(struct
> event_crypto_adapter *adapter,
>  	return nb_deq;
>  }
> 
> -static void
> +static int
>  eca_crypto_adapter_run(struct event_crypto_adapter *adapter,
>  		       unsigned int max_ops)
>  {
> @@ -791,22 +791,26 @@ eca_crypto_adapter_run(struct
> event_crypto_adapter *adapter,
> 
>  	}
> 
> -	if (ops_left == max_ops)
> +	if (ops_left == max_ops) {
>  		rte_event_maintain(adapter->eventdev_id,
>  				   adapter->event_port_id, 0);
> +		return -EAGAIN;
> +	} else
> +		return 0;
>  }
> 
>  static int
>  eca_service_func(void *args)
>  {
>  	struct event_crypto_adapter *adapter = args;
> +	int ret;
> 
>  	if (rte_spinlock_trylock(&adapter->lock) == 0)
>  		return 0;
> -	eca_crypto_adapter_run(adapter, adapter->max_nb);
> +	ret = eca_crypto_adapter_run(adapter, adapter->max_nb);
>  	rte_spinlock_unlock(&adapter->lock);
> 
> -	return 0;
> +	return ret;
>  }
> 
>  static int
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
  2022-10-14 17:36         ` Jerin Jacob
@ 2022-10-17 12:36           ` Naga Harish K, S V
  2022-10-18  9:19             ` Jayatheerthan, Jay
  0 siblings, 1 reply; 17+ messages in thread
From: Naga Harish K, S V @ 2022-10-17 12:36 UTC (permalink / raw)
  To: Jerin Jacob, mattias.ronnblom
  Cc: Jayatheerthan, Jay, Carrillo, Erik G, Gujjar, Abhinandan S,
	Jerin Jacob, dev, Van Haaren, Harry, hofors



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Friday, October 14, 2022 11:07 PM
> To: mattias.ronnblom <mattias.ronnblom@ericsson.com>
> Cc: Naga Harish K, S V <s.v.naga.harish.k@intel.com>; Jayatheerthan, Jay
> <jay.jayatheerthan@intel.com>; Carrillo, Erik G <Erik.G.Carrillo@intel.com>;
> Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jerin Jacob
> <jerinj@marvell.com>; dev@dpdk.org; Van Haaren, Harry
> <harry.van.haaren@intel.com>; hofors@lysator.liu.se
> Subject: Re: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately
> report idle
> 
> On Thu, Oct 13, 2022 at 3:23 PM Mattias Rönnblom
> <mattias.ronnblom@ericsson.com> wrote:
> >
> > On 2022-10-13 03:32, Naga Harish K, S V wrote:
> > >
> > >
> > >> -----Original Message-----
> > >> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > >> Sent: Tuesday, October 11, 2022 12:40 PM
> > >> To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo,
> > >> Erik G <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > >> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>;
> > >> Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > >> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > >> hofors@lysator.liu.se; mattias.ronnblom
> > >> <mattias.ronnblom@ericsson.com>
> > >> Subject: RE: [PATCH 2/4] eventdev: have ethernet Rx adapter
> > >> appropriately report idle

nitpick: 
the headline can be modified as "eventdev/eth_rx:" for Rx adapter patches,
to make it consistent with the currently following procedure.

Similar change for other patches of other adapters.

After these changes, my "Reviewed-by: " tag can be added for patches 2 and 3 (Rx adapter and Tx adapter).

-Harish

> > >>
> > >> @Harish, Could you review the patch ?
> > >>
> > >> -Jay
> > >>
> > >>>
> > >>>   done:
> > >>> -   rx_adapter->stats.rx_intr_packets += nb_rx;
> > >>> +   if (nb_rx > 0) {
> > >
> > > How are the performance numbers before and after this patch?
> > > Trying to understand the performance impact, as new condition is added
> to the service function Datapath.
> > >
> > I haven't tested the RX and TX adapters separately, but if you run
> > them on the same core, I get the following result:
> >
> > Without patches, with stats disabled: 16,0 Mpps Without patches, with
> > stats enabled: 16,1 Mpps With patches, with stats disabled: 16,1 Mpps
> > With patches, with stats enabled: 16,2 Mpps
> >
> > So these patches, with this particular hardware, compiler, and test
> > application, adding a tiny bit of additional logic actually make the
> > RX+TX adapter perform better. This is contrary to what you might
> > RX+expect,
> > and I'm sure YMMV.
> >
> > Enabling service core statistics (which boils down to a 2x rdtsc and
> > some cheap arithmetic in rte_service.c) actually make the RX+TX
> > adapter core perform better, both before and after this patchset. Also
> > contrary to what you might expect.
> >
> > The results are consistent across multiple runs.
> >
> > GCC 11.2.0 and AMD Zen 3 @ 3,7 GHz. Event device is DSW and I/O is the
> > ring Ethdev.
> 
> @Naga Harish K, S V @Jayatheerthan, Jay  @Gujjar, Abhinandan S  @Erik
> Gabriel Carrillo Planning to take this series for rc2. If there are no other
> comments, I will merge the series then.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 4/4] eventdev: have timer adapter appropriately report idle
  2022-10-10 14:54 ` [PATCH 4/4] eventdev: have timer " Mattias Rönnblom
@ 2022-10-17 21:42   ` Carrillo, Erik G
  0 siblings, 0 replies; 17+ messages in thread
From: Carrillo, Erik G @ 2022-10-17 21:42 UTC (permalink / raw)
  To: mattias.ronnblom, Jayatheerthan, Jay, Gujjar, Abhinandan S, Jerin Jacob
  Cc: dev, Van Haaren, Harry, hofors, mattias.ronnblom

> -----Original Message-----
> From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Sent: Monday, October 10, 2022 9:54 AM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> Subject: [PATCH 4/4] eventdev: have timer adapter appropriately report idle
> 
> Update the Event Timer Adapter's service function to report as idle (i.e.,
> return -EAGAIN) in case no timer events were enqueued to the event
> device.
> 
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
  2022-10-17 12:36           ` Naga Harish K, S V
@ 2022-10-18  9:19             ` Jayatheerthan, Jay
  0 siblings, 0 replies; 17+ messages in thread
From: Jayatheerthan, Jay @ 2022-10-18  9:19 UTC (permalink / raw)
  To: Naga Harish K, S V, Jerin Jacob, mattias.ronnblom
  Cc: Carrillo, Erik G, Gujjar, Abhinandan S, Jerin Jacob, dev,
	Van Haaren, Harry, hofors

Looks good to me. Thanks for submitting this!

Acked by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

-Jay



> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Monday, October 17, 2022 6:07 PM
> To: Jerin Jacob <jerinjacobk@gmail.com>; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> hofors@lysator.liu.se
> Subject: RE: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle
> 
> 
> 
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Friday, October 14, 2022 11:07 PM
> > To: mattias.ronnblom <mattias.ronnblom@ericsson.com>
> > Cc: Naga Harish K, S V <s.v.naga.harish.k@intel.com>; Jayatheerthan, Jay
> > <jay.jayatheerthan@intel.com>; Carrillo, Erik G <Erik.G.Carrillo@intel.com>;
> > Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jerin Jacob
> > <jerinj@marvell.com>; dev@dpdk.org; Van Haaren, Harry
> > <harry.van.haaren@intel.com>; hofors@lysator.liu.se
> > Subject: Re: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately
> > report idle
> >
> > On Thu, Oct 13, 2022 at 3:23 PM Mattias Rönnblom
> > <mattias.ronnblom@ericsson.com> wrote:
> > >
> > > On 2022-10-13 03:32, Naga Harish K, S V wrote:
> > > >
> > > >
> > > >> -----Original Message-----
> > > >> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > > >> Sent: Tuesday, October 11, 2022 12:40 PM
> > > >> To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo,
> > > >> Erik G <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > >> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>;
> > > >> Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > >> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > > >> hofors@lysator.liu.se; mattias.ronnblom
> > > >> <mattias.ronnblom@ericsson.com>
> > > >> Subject: RE: [PATCH 2/4] eventdev: have ethernet Rx adapter
> > > >> appropriately report idle
> 
> nitpick:
> the headline can be modified as "eventdev/eth_rx:" for Rx adapter patches,
> to make it consistent with the currently following procedure.
> 
> Similar change for other patches of other adapters.
> 
> After these changes, my "Reviewed-by: " tag can be added for patches 2 and 3 (Rx adapter and Tx adapter).
> 
> -Harish
> 
> > > >>
> > > >> @Harish, Could you review the patch ?
> > > >>
> > > >> -Jay
> > > >>
> > > >>>
> > > >>>   done:
> > > >>> -   rx_adapter->stats.rx_intr_packets += nb_rx;
> > > >>> +   if (nb_rx > 0) {
> > > >
> > > > How are the performance numbers before and after this patch?
> > > > Trying to understand the performance impact, as new condition is added
> > to the service function Datapath.
> > > >
> > > I haven't tested the RX and TX adapters separately, but if you run
> > > them on the same core, I get the following result:
> > >
> > > Without patches, with stats disabled: 16,0 Mpps Without patches, with
> > > stats enabled: 16,1 Mpps With patches, with stats disabled: 16,1 Mpps
> > > With patches, with stats enabled: 16,2 Mpps
> > >
> > > So these patches, with this particular hardware, compiler, and test
> > > application, adding a tiny bit of additional logic actually make the
> > > RX+TX adapter perform better. This is contrary to what you might
> > > RX+expect,
> > > and I'm sure YMMV.
> > >
> > > Enabling service core statistics (which boils down to a 2x rdtsc and
> > > some cheap arithmetic in rte_service.c) actually make the RX+TX
> > > adapter core perform better, both before and after this patchset. Also
> > > contrary to what you might expect.
> > >
> > > The results are consistent across multiple runs.
> > >
> > > GCC 11.2.0 and AMD Zen 3 @ 3,7 GHz. Event device is DSW and I/O is the
> > > ring Ethdev.
> >
> > @Naga Harish K, S V @Jayatheerthan, Jay  @Gujjar, Abhinandan S  @Erik
> > Gabriel Carrillo Planning to take this series for rc2. If there are no other
> > comments, I will merge the series then.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
  2022-10-13  1:30     ` Naga Harish K, S V
@ 2022-10-18  9:19       ` Jayatheerthan, Jay
  2022-10-19 11:32         ` Jerin Jacob
  0 siblings, 1 reply; 17+ messages in thread
From: Jayatheerthan, Jay @ 2022-10-18  9:19 UTC (permalink / raw)
  To: Naga Harish K, S V, mattias.ronnblom, Carrillo, Erik G, Gujjar,
	Abhinandan S, Jerin Jacob
  Cc: dev, Van Haaren, Harry, hofors, mattias.ronnblom

Looks good to me. Thanks for submitting this!

Acked by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

-Jay

> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Thursday, October 13, 2022 7:00 AM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>; hofors@lysator.liu.se; mattias.ronnblom
> <mattias.ronnblom@ericsson.com>
> Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
> 
> 
> 
> > -----Original Message-----
> > From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Sent: Tuesday, October 11, 2022 12:41 PM
> > To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
> > Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> > Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > report idle
> >
> > @Harish, could you review the patch ?
> >
> > -Jay
> >
> >
> >
> > > -----Original Message-----
> > > From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > Sent: Monday, October 10, 2022 8:24 PM
> > > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > > hofors@lysator.liu.se; mattias.ronnblom
> > > <mattias.ronnblom@ericsson.com>
> > > Subject: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > > report idle
> > >
> > > Update the Event Ethernet Tx Adapter's service function to report as
> > > idle (i.e., return -EAGAIN) in case no events were dequeued from the
> > > event device and no Ethernet frames were sent out on the wire.
> > >
> > > Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > ---
> > >  lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
> > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > index 7f7d86f683..c2a848103b 100644
> > > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > @@ -639,6 +639,7 @@ txa_service_func(void *args)
> > >  	struct txa_service_data *txa = args;
> > >  	uint8_t dev_id;
> > >  	uint8_t port;
> > > +	int ret = -EAGAIN;
> > >  	uint16_t n;
> > >  	uint32_t nb_tx, max_nb_tx;
> > >  	struct rte_event ev[TXA_BATCH_SIZE]; @@ -648,10 +649,10 @@
> > > txa_service_func(void *args)
> > >  	port = txa->port_id;
> > >
> > >  	if (txa->nb_queues == 0)
> > > -		return 0;
> > > +		return ret;
> > >
> > >  	if (!rte_spinlock_trylock(&txa->tx_lock))
> > > -		return 0;
> > > +		return ret;
> > >
> > >  	for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
> > >
> > > @@ -659,6 +660,7 @@ txa_service_func(void *args)
> > >  		if (!n)
> > >  			break;
> > >  		txa_service_tx(txa, ev, n);
> > > +		ret = 0;
> > >  	}
> > >
> > >  	if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) { @@ -
> > 692,10
> > > +694,13 @@ txa_service_func(void *args)
> > >  			}
> > >  		}
> > >
> > > -		txa->stats.tx_packets += nb_tx;
> > > +		if (likely(nb_tx > 0)) {
> 
> How are the performance numbers before and after this patch?
> Trying to understand the performance impact, as new condition is added to the service function Datapath.
> 
> > > +			txa->stats.tx_packets += nb_tx;
> > > +			ret = 0;
> > > +		}
> > >  	}
> > >  	rte_spinlock_unlock(&txa->tx_lock);
> > > -	return 0;
> > > +	return ret;
> > >  }
> > >
> > >  static int
> > > --
> > > 2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
  2022-10-18  9:19       ` Jayatheerthan, Jay
@ 2022-10-19 11:32         ` Jerin Jacob
  0 siblings, 0 replies; 17+ messages in thread
From: Jerin Jacob @ 2022-10-19 11:32 UTC (permalink / raw)
  To: Jayatheerthan, Jay
  Cc: Naga Harish K, S V, mattias.ronnblom, Carrillo, Erik G, Gujjar,
	Abhinandan S, Jerin Jacob, dev, Van Haaren, Harry, hofors

On Tue, Oct 18, 2022 at 2:49 PM Jayatheerthan, Jay
<jay.jayatheerthan@intel.com> wrote:
>
> Looks good to me. Thanks for submitting this!
>
> Acked by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


Updated the git commit as follows and series applied to
dpdk-next-net-eventdev/for-main. Thanks

commit 76d97b8d05b62da1a15c0716d15f1179dd77369e (HEAD -> for-main,
origin/for-main, origin/HEAD)
Author: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Date:   Mon Oct 10 16:54:06 2022 +0200

    eventdev/timer: support appropriately report idle

    Update the Event Timer Adapter's service function to report as idle
    (i.e., return -EAGAIN) in case no timer events were enqueued to the
    event device.

    Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
    Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>

commit a7f9687a436a5e0af2512bca9bf430f1d28085f6
Author: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Date:   Mon Oct 10 16:54:05 2022 +0200

    eventdev/eth_tx: support appropriately report idle

    Update the Event Ethernet Tx Adapter's service function to report as
    idle (i.e., return -EAGAIN) in case no events were dequeued from the
    event device and no Ethernet frames were sent out on the wire.

    Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
    Reviewed-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
    Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

commit 0474cb12be6a4d82d0019db1621050af959f908e
Author: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Date:   Mon Oct 10 16:54:04 2022 +0200

    eventdev/eth_rx: support appropriately report idle

    Update the Event Ethernet Rx Adapter's service function to report as
    idle (i.e., return -EAGAIN) in case no Ethernet frames were received
    from the ethdev and no events were enqueued to the event device.

    Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
    Reviewed-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
    Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

commit 855d32d7af3c7ef4e2231edf6d2d3ffe943ff15d
Author: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Date:   Mon Oct 10 16:54:03 2022 +0200

    eventdev/crypto: support appropriately report idle

    Update the event crypto adapter's service function to report as idle
    (i.e., return -EAGAIN) in case no crypto operations were performed.

    Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
    Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>

>
> -Jay
>
> > -----Original Message-----
> > From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Sent: Thursday, October 13, 2022 7:00 AM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>; hofors@lysator.liu.se; mattias.ronnblom
> > <mattias.ronnblom@ericsson.com>
> > Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
> >
> >
> >
> > > -----Original Message-----
> > > From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > > Sent: Tuesday, October 11, 2022 12:41 PM
> > > To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
> > > Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > > hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> > > Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > > report idle
> > >
> > > @Harish, could you review the patch ?
> > >
> > > -Jay
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > > Sent: Monday, October 10, 2022 8:24 PM
> > > > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > > > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > > > hofors@lysator.liu.se; mattias.ronnblom
> > > > <mattias.ronnblom@ericsson.com>
> > > > Subject: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > > > report idle
> > > >
> > > > Update the Event Ethernet Tx Adapter's service function to report as
> > > > idle (i.e., return -EAGAIN) in case no events were dequeued from the
> > > > event device and no Ethernet frames were sent out on the wire.
> > > >
> > > > Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > > ---
> > > >  lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
> > > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > > index 7f7d86f683..c2a848103b 100644
> > > > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > > @@ -639,6 +639,7 @@ txa_service_func(void *args)
> > > >   struct txa_service_data *txa = args;
> > > >   uint8_t dev_id;
> > > >   uint8_t port;
> > > > + int ret = -EAGAIN;
> > > >   uint16_t n;
> > > >   uint32_t nb_tx, max_nb_tx;
> > > >   struct rte_event ev[TXA_BATCH_SIZE]; @@ -648,10 +649,10 @@
> > > > txa_service_func(void *args)
> > > >   port = txa->port_id;
> > > >
> > > >   if (txa->nb_queues == 0)
> > > > -         return 0;
> > > > +         return ret;
> > > >
> > > >   if (!rte_spinlock_trylock(&txa->tx_lock))
> > > > -         return 0;
> > > > +         return ret;
> > > >
> > > >   for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
> > > >
> > > > @@ -659,6 +660,7 @@ txa_service_func(void *args)
> > > >           if (!n)
> > > >                   break;
> > > >           txa_service_tx(txa, ev, n);
> > > > +         ret = 0;
> > > >   }
> > > >
> > > >   if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) { @@ -
> > > 692,10
> > > > +694,13 @@ txa_service_func(void *args)
> > > >                   }
> > > >           }
> > > >
> > > > -         txa->stats.tx_packets += nb_tx;
> > > > +         if (likely(nb_tx > 0)) {
> >
> > How are the performance numbers before and after this patch?
> > Trying to understand the performance impact, as new condition is added to the service function Datapath.
> >
> > > > +                 txa->stats.tx_packets += nb_tx;
> > > > +                 ret = 0;
> > > > +         }
> > > >   }
> > > >   rte_spinlock_unlock(&txa->tx_lock);
> > > > - return 0;
> > > > + return ret;
> > > >  }
> > > >
> > > >  static int
> > > > --
> > > > 2.34.1
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-10-19 11:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 14:54 [PATCH 0/4] Have event adapters report idle status Mattias Rönnblom
2022-10-10 14:54 ` [PATCH 1/4] eventdev: have crypto adapter appropriately report idle Mattias Rönnblom
2022-10-17  5:47   ` Gujjar, Abhinandan S
2022-10-10 14:54 ` [PATCH 2/4] eventdev: have ethernet Rx " Mattias Rönnblom
2022-10-11  7:10   ` Jayatheerthan, Jay
2022-10-13  1:32     ` Naga Harish K, S V
2022-10-13  9:53       ` Mattias Rönnblom
2022-10-14 17:36         ` Jerin Jacob
2022-10-17 12:36           ` Naga Harish K, S V
2022-10-18  9:19             ` Jayatheerthan, Jay
2022-10-10 14:54 ` [PATCH 3/4] eventdev: have ethernet Tx " Mattias Rönnblom
2022-10-11  7:10   ` Jayatheerthan, Jay
2022-10-13  1:30     ` Naga Harish K, S V
2022-10-18  9:19       ` Jayatheerthan, Jay
2022-10-19 11:32         ` Jerin Jacob
2022-10-10 14:54 ` [PATCH 4/4] eventdev: have timer " Mattias Rönnblom
2022-10-17 21:42   ` Carrillo, Erik G

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).