DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
@ 2019-10-01  6:46 Nipun Gupta
  2019-10-01  7:44 ` Jerin Jacob
                   ` (5 more replies)
  0 siblings, 6 replies; 30+ messages in thread
From: Nipun Gupta @ 2019-10-01  6:46 UTC (permalink / raw)
  To: dev
  Cc: jerinj, pbhagavatula, skori, hemant.agrawal, bruce.richardson,
	marko.kovacevic, orika, radu.nicolau, tomasz.kantecki,
	harry.van.haaren, nikhil.rao, Nipun Gupta

This patch introduces a `flag` in the Eth TX adapter enqueue API.
Some drivers may support burst functionality only with the packets
having same destination device and queue.

The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
to indicate this so the underlying driver, for drivers to utilize
burst functionality appropriately.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-eventdev/test_pipeline_common.h          |  6 +++---
 .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
 drivers/event/octeontx/ssovf_evdev.h              |  2 +-
 drivers/event/octeontx/ssovf_worker.c             |  3 ++-
 drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
 drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
 drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
 lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15 +++++++++++++--
 lib/librte_eventdev/rte_eventdev.c                |  3 ++-
 lib/librte_eventdev/rte_eventdev.h                |  2 +-
 10 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
index 0440b9e29..6e73c6ab2 100644
--- a/app/test-eventdev/test_pipeline_common.h
+++ b/app/test-eventdev/test_pipeline_common.h
@@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t port,
 		struct rte_event * const ev)
 {
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
@@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const uint8_t port,
 {
 	uint16_t enq;
 
-	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
+	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
 	while (enq < nb_rx) {
 		enq += rte_event_eth_tx_adapter_enqueue(dev, port,
-				ev + enq, nb_rx - enq);
+				ev + enq, nb_rx - enq, 0);
 	}
 }
 
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index 192f9e1cf..a8c13e136 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()`` function.
 	if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
 
 		event.mbuf = m;
+		eq_flags = 0;
 
 		m->port = tx_port;
 		rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
 
-		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
+		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1, eq_flags);
 	} else {
 
 		event.queue_id = qid; /* event queue linked to adapter port */
diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h
index 0e622152c..1b156edab 100644
--- a/drivers/event/octeontx/ssovf_evdev.h
+++ b/drivers/event/octeontx/ssovf_evdev.h
@@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws, uint8_t queue_id,
 		ssows_handle_event_t fn, void *arg);
 void ssows_reset(struct ssows *ws);
 uint16_t sso_event_tx_adapter_enqueue(void *port,
-		struct rte_event ev[], uint16_t nb_events);
+		struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags);
 int ssovf_info(struct ssovf_info *info);
 void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
 int test_eventdev_octeontx(void);
diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c
index d940b5dd6..1d0467af3 100644
--- a/drivers/event/octeontx/ssovf_worker.c
+++ b/drivers/event/octeontx/ssovf_worker.c
@@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
 
 uint16_t
 sso_event_tx_adapter_enqueue(void *port,
-		struct rte_event ev[], uint16_t nb_events)
+		struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
 {
 	uint16_t port_id;
 	uint16_t queue_id;
@@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
 	octeontx_dq_t *dq;
 
 	RTE_SET_USED(nb_events);
+	RTE_SET_USED(eq_flags);
 	switch (ev->sched_type) {
 	case SSO_SYNC_ORDERED:
 		ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
diff --git a/drivers/event/octeontx2/otx2_evdev.h b/drivers/event/octeontx2/otx2_evdev.h
index 5cd80e3b2..74b749a15 100644
--- a/drivers/event/octeontx2/otx2_evdev.h
+++ b/drivers/event/octeontx2/otx2_evdev.h
@@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
 
 #define T(name, f4, f3, f2, f1, f0, sz, flags)				     \
 uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],\
-					   uint16_t nb_events);		     \
+					   uint16_t nb_events,		     \
+					   uint8_t eq_flags);		     \
 uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,		     \
 					       struct rte_event ev[],	     \
-					       uint16_t nb_events);	     \
+					       uint16_t nb_events,	     \
+					       uint8_t eq_flags);	     \
 uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,		     \
 						struct rte_event ev[],	     \
-						uint16_t nb_events);	     \
+						uint16_t nb_events,	     \
+						uint8_t eq_flags);	     \
 uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,		     \
 						    struct rte_event ev[],   \
-						    uint16_t nb_events);     \
+						    uint16_t nb_events,	     \
+						    uint8_t eq_flags);	     \
 
 SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
 #undef T
diff --git a/drivers/event/octeontx2/otx2_worker.c b/drivers/event/octeontx2/otx2_worker.c
index cd14cd3d2..100e21669 100644
--- a/drivers/event/octeontx2/otx2_worker.c
+++ b/drivers/event/octeontx2/otx2_worker.c
@@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port, const struct rte_event ev[],
 #define T(name, f4, f3, f2, f1, f0, sz, flags)				\
 uint16_t __hot								\
 otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],	\
-				  uint16_t nb_events)			\
+				  uint16_t nb_events,			\
+				  uint8_t eq_flags)			\
 {									\
 	struct otx2_ssogws *ws = port;					\
 	uint64_t cmd[sz];						\
 									\
 	RTE_SET_USED(nb_events);					\
+	RTE_SET_USED(eq_flags);						\
 	return otx2_ssogws_event_tx(ws, ev, cmd, flags);		\
 }
 SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
@@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
 #define T(name, f4, f3, f2, f1, f0, sz, flags)				\
 uint16_t __hot								\
 otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct rte_event ev[],\
-				      uint16_t nb_events)		\
+				      uint16_t nb_events,		\
+				      uint8_t eq_flags)			\
 {									\
 	struct otx2_ssogws *ws = port;					\
 	uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];			\
 									\
 	RTE_SET_USED(nb_events);					\
+	RTE_SET_USED(eq_flags);						\
 	return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |		\
 				    NIX_TX_MULTI_SEG_F);		\
 }
diff --git a/drivers/event/octeontx2/otx2_worker_dual.c b/drivers/event/octeontx2/otx2_worker_dual.c
index 37c274a54..c3e48da42 100644
--- a/drivers/event/octeontx2/otx2_worker_dual.c
+++ b/drivers/event/octeontx2/otx2_worker_dual.c
@@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
 uint16_t __hot								\
 otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,			\
 				       struct rte_event ev[],		\
-				       uint16_t nb_events)		\
+				       uint16_t nb_events,		\
+				       uint8_t eq_flags)		\
 {									\
 	struct otx2_ssogws_dual *ws = port;				\
 	struct otx2_ssogws *vws =					\
@@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,			\
 	uint64_t cmd[sz];						\
 									\
 	RTE_SET_USED(nb_events);					\
+	RTE_SET_USED(eq_flags);						\
 	return otx2_ssogws_event_tx(vws, ev, cmd, flags);		\
 }
 SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
@@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
 uint16_t __hot								\
 otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,			\
 					   struct rte_event ev[],	\
-					   uint16_t nb_events)		\
+					   uint16_t nb_events,		\
+					   uint8_t eq_flags)		\
 {									\
 	struct otx2_ssogws_dual *ws = port;				\
 	struct otx2_ssogws *vws =					\
@@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,			\
 	uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];			\
 									\
 	RTE_SET_USED(nb_events);					\
+	RTE_SET_USED(eq_flags);						\
 	return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |		\
 				    NIX_TX_MULTI_SEG_F);		\
 }
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
index c848261c4..98be77568 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
@@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
 int
 rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
 
+#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST	0x1
+/**< This flag is used when all the packets enqueued in the tx adapter are
+ * destined for the same Ethernet device, queue pair.
+ */
+
 /**
  * Enqueue a burst of events objects or an event object supplied in *rte_event*
  * structure on an  event device designated by its *dev_id* through the event
@@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
  *  The number of event objects to enqueue, typically number of
  *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
  *  available for this port.
+ * @param flags
+ *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
+ *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets
+ *  which are enqueued are destined for the same Ethernet device, queue pair.
  *
  * @return
  *   The number of event objects actually enqueued on the event device. The
@@ -343,7 +352,8 @@ static inline uint16_t
 rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 				uint8_t port_id,
 				struct rte_event ev[],
-				uint16_t nb_events)
+				uint16_t nb_events,
+				uint8_t flags)
 {
 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
 
@@ -359,7 +369,8 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 		return 0;
 	}
 #endif
-	return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
+	return dev->txa_enqueue(dev->data->ports[port_id], ev,
+				nb_events, flags);
 }
 
 /**
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index f44c869cb..3bf9d7115 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -1324,7 +1324,8 @@ rte_eventdev_find_free_device_index(void)
 static uint16_t
 rte_event_tx_adapter_enqueue(__rte_unused void *port,
 			__rte_unused struct rte_event ev[],
-			__rte_unused uint16_t nb_events)
+			__rte_unused uint16_t nb_events,
+			__rte_unused uint8_t flags)
 {
 	rte_errno = ENOTSUP;
 	return 0;
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 5044a13d0..2a5643da3 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1227,7 +1227,7 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
 /**< @internal Dequeue burst of events from port of a device */
 
 typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
-				struct rte_event ev[], uint16_t nb_events);
+		struct rte_event ev[], uint16_t nb_events, uint8_t flags);
 /**< @internal Enqueue burst of events on port of a device */
 
 #define RTE_EVENTDEV_NAME_MAX_LEN	(64)
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01  6:46 [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue Nipun Gupta
@ 2019-10-01  7:44 ` Jerin Jacob
  2019-10-01 11:41   ` Nipun Gupta
  2019-10-01 14:42 ` Aaron Conole
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 30+ messages in thread
From: Jerin Jacob @ 2019-10-01  7:44 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: dpdk-dev, Jerin Jacob, Pavan Nikhilesh, Sunil Kumar Kori,
	Hemant Agrawal, Richardson, Bruce, Marko Kovacevic, Ori Kam,
	Radu Nicolau, Tomasz Kantecki, Van Haaren, Harry, nikhil.rao

On Tue, Oct 1, 2019 at 12:32 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
> This patch introduces a `flag` in the Eth TX adapter enqueue API.
> Some drivers may support burst functionality only with the packets
> having same destination device and queue.
>
> The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
> to indicate this so the underlying driver, for drivers to utilize
> burst functionality appropriately.

I understand the cost of aggregating packets based on port and queue
to make it burst.
But, Could you share the use case where how do you want to use this
flag? I see two possibilities in eventdev context.
(Where dequeue can be from any ethdev port)
a) The application does the aggregation. If so, what would the
difference be in doing driver or application?
b) We may use this flag when the system has only one port and one queue.

Could you share how do you want to use this flag?

And another point is, tx adapter is NOT experimental now, We need
depreciation notice for ABI change.
If you share the exact use case, then we could think of adding a new
symbol instead of breaking ABI and
add it for next release.




> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-eventdev/test_pipeline_common.h          |  6 +++---
>  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
>  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
>  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
>  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
>  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
>  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
>  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15 +++++++++++++--
>  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
>  lib/librte_eventdev/rte_eventdev.h                |  2 +-
>  10 files changed, 44 insertions(+), 18 deletions(-)
>
> diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
> index 0440b9e29..6e73c6ab2 100644
> --- a/app/test-eventdev/test_pipeline_common.h
> +++ b/app/test-eventdev/test_pipeline_common.h
> @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t port,
>                 struct rte_event * const ev)
>  {
>         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> +       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
>                 rte_pause();
>  }
>
> @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const uint8_t port,
>  {
>         uint16_t enq;
>
> -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
> +       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
>         while (enq < nb_rx) {
>                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> -                               ev + enq, nb_rx - enq);
> +                               ev + enq, nb_rx - enq, 0);
>         }
>  }
>
> diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> index 192f9e1cf..a8c13e136 100644
> --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> @@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()`` function.
>         if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
>
>                 event.mbuf = m;
> +               eq_flags = 0;
>
>                 m->port = tx_port;
>                 rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
>
> -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
> +               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1, eq_flags);
>         } else {
>
>                 event.queue_id = qid; /* event queue linked to adapter port */
> diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h
> index 0e622152c..1b156edab 100644
> --- a/drivers/event/octeontx/ssovf_evdev.h
> +++ b/drivers/event/octeontx/ssovf_evdev.h
> @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws, uint8_t queue_id,
>                 ssows_handle_event_t fn, void *arg);
>  void ssows_reset(struct ssows *ws);
>  uint16_t sso_event_tx_adapter_enqueue(void *port,
> -               struct rte_event ev[], uint16_t nb_events);
> +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags);
>  int ssovf_info(struct ssovf_info *info);
>  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
>  int test_eventdev_octeontx(void);
> diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c
> index d940b5dd6..1d0467af3 100644
> --- a/drivers/event/octeontx/ssovf_worker.c
> +++ b/drivers/event/octeontx/ssovf_worker.c
> @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
>
>  uint16_t
>  sso_event_tx_adapter_enqueue(void *port,
> -               struct rte_event ev[], uint16_t nb_events)
> +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
>  {
>         uint16_t port_id;
>         uint16_t queue_id;
> @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
>         octeontx_dq_t *dq;
>
>         RTE_SET_USED(nb_events);
> +       RTE_SET_USED(eq_flags);
>         switch (ev->sched_type) {
>         case SSO_SYNC_ORDERED:
>                 ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> diff --git a/drivers/event/octeontx2/otx2_evdev.h b/drivers/event/octeontx2/otx2_evdev.h
> index 5cd80e3b2..74b749a15 100644
> --- a/drivers/event/octeontx2/otx2_evdev.h
> +++ b/drivers/event/octeontx2/otx2_evdev.h
> @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
>
>  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
>  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],\
> -                                          uint16_t nb_events);              \
> +                                          uint16_t nb_events,               \
> +                                          uint8_t eq_flags);                \
>  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,                  \
>                                                struct rte_event ev[],        \
> -                                              uint16_t nb_events);          \
> +                                              uint16_t nb_events,           \
> +                                              uint8_t eq_flags);            \
>  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                 \
>                                                 struct rte_event ev[],       \
> -                                               uint16_t nb_events);         \
> +                                               uint16_t nb_events,          \
> +                                               uint8_t eq_flags);           \
>  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,                     \
>                                                     struct rte_event ev[],   \
> -                                                   uint16_t nb_events);     \
> +                                                   uint16_t nb_events,      \
> +                                                   uint8_t eq_flags);       \
>
>  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
>  #undef T
> diff --git a/drivers/event/octeontx2/otx2_worker.c b/drivers/event/octeontx2/otx2_worker.c
> index cd14cd3d2..100e21669 100644
> --- a/drivers/event/octeontx2/otx2_worker.c
> +++ b/drivers/event/octeontx2/otx2_worker.c
> @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port, const struct rte_event ev[],
>  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
>  uint16_t __hot                                                         \
>  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],   \
> -                                 uint16_t nb_events)                   \
> +                                 uint16_t nb_events,                   \
> +                                 uint8_t eq_flags)                     \
>  {                                                                      \
>         struct otx2_ssogws *ws = port;                                  \
>         uint64_t cmd[sz];                                               \
>                                                                         \
>         RTE_SET_USED(nb_events);                                        \
> +       RTE_SET_USED(eq_flags);                                         \
>         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
>  }
>  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
>  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
>  uint16_t __hot                                                         \
>  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct rte_event ev[],\
> -                                     uint16_t nb_events)               \
> +                                     uint16_t nb_events,               \
> +                                     uint8_t eq_flags)                 \
>  {                                                                      \
>         struct otx2_ssogws *ws = port;                                  \
>         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
>                                                                         \
>         RTE_SET_USED(nb_events);                                        \
> +       RTE_SET_USED(eq_flags);                                         \
>         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
>                                     NIX_TX_MULTI_SEG_F);                \
>  }
> diff --git a/drivers/event/octeontx2/otx2_worker_dual.c b/drivers/event/octeontx2/otx2_worker_dual.c
> index 37c274a54..c3e48da42 100644
> --- a/drivers/event/octeontx2/otx2_worker_dual.c
> +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
>  uint16_t __hot                                                         \
>  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                     \
>                                        struct rte_event ev[],           \
> -                                      uint16_t nb_events)              \
> +                                      uint16_t nb_events,              \
> +                                      uint8_t eq_flags)                \
>  {                                                                      \
>         struct otx2_ssogws_dual *ws = port;                             \
>         struct otx2_ssogws *vws =                                       \
> @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                  \
>         uint64_t cmd[sz];                                               \
>                                                                         \
>         RTE_SET_USED(nb_events);                                        \
> +       RTE_SET_USED(eq_flags);                                         \
>         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
>  }
>  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
>  uint16_t __hot                                                         \
>  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,                 \
>                                            struct rte_event ev[],       \
> -                                          uint16_t nb_events)          \
> +                                          uint16_t nb_events,          \
> +                                          uint8_t eq_flags)            \
>  {                                                                      \
>         struct otx2_ssogws_dual *ws = port;                             \
>         struct otx2_ssogws *vws =                                       \
> @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,                      \
>         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
>                                                                         \
>         RTE_SET_USED(nb_events);                                        \
> +       RTE_SET_USED(eq_flags);                                         \
>         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
>                                     NIX_TX_MULTI_SEG_F);                \
>  }
> diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> index c848261c4..98be77568 100644
> --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
>  int
>  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
>
> +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST     0x1
> +/**< This flag is used when all the packets enqueued in the tx adapter are
> + * destined for the same Ethernet device, queue pair.
> + */
> +
>  /**
>   * Enqueue a burst of events objects or an event object supplied in *rte_event*
>   * structure on an  event device designated by its *dev_id* through the event
> @@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
>   *  The number of event objects to enqueue, typically number of
>   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
>   *  available for this port.
> + * @param flags
> + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets
> + *  which are enqueued are destined for the same Ethernet device, queue pair.
>   *
>   * @return
>   *   The number of event objects actually enqueued on the event device. The
> @@ -343,7 +352,8 @@ static inline uint16_t
>  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
>                                 uint8_t port_id,
>                                 struct rte_event ev[],
> -                               uint16_t nb_events)
> +                               uint16_t nb_events,
> +                               uint8_t flags)
>  {
>         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
>
> @@ -359,7 +369,8 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
>                 return 0;
>         }
>  #endif
> -       return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
> +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> +                               nb_events, flags);
>  }
>
>  /**
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index f44c869cb..3bf9d7115 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -1324,7 +1324,8 @@ rte_eventdev_find_free_device_index(void)
>  static uint16_t
>  rte_event_tx_adapter_enqueue(__rte_unused void *port,
>                         __rte_unused struct rte_event ev[],
> -                       __rte_unused uint16_t nb_events)
> +                       __rte_unused uint16_t nb_events,
> +                       __rte_unused uint8_t flags)
>  {
>         rte_errno = ENOTSUP;
>         return 0;
> diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
> index 5044a13d0..2a5643da3 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -1227,7 +1227,7 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
>  /**< @internal Dequeue burst of events from port of a device */
>
>  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> -                               struct rte_event ev[], uint16_t nb_events);
> +               struct rte_event ev[], uint16_t nb_events, uint8_t flags);
>  /**< @internal Enqueue burst of events on port of a device */
>
>  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> --
> 2.17.1
>

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01  7:44 ` Jerin Jacob
@ 2019-10-01 11:41   ` Nipun Gupta
  2019-10-01 13:09     ` Jerin Jacob
  0 siblings, 1 reply; 30+ messages in thread
From: Nipun Gupta @ 2019-10-01 11:41 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: dpdk-dev, Jerin Jacob, Pavan Nikhilesh, Sunil Kumar Kori,
	Hemant Agrawal, Richardson, Bruce, Marko Kovacevic, Ori Kam,
	Radu Nicolau, Tomasz Kantecki, Van Haaren, Harry, nikhil.rao



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Tuesday, October 1, 2019 1:14 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>
> Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>; Pavan
> Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori <skori@marvell.com>;
> Hemant Agrawal <hemant.agrawal@nxp.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Marko Kovacevic
> <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu Nicolau
> <radu.nicolau@intel.com>; Tomasz Kantecki <tomasz.kantecki@intel.com>; Van
> Haaren, Harry <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> packets enqueue
> 
> On Tue, Oct 1, 2019 at 12:32 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
> >
> > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > Some drivers may support burst functionality only with the packets
> > having same destination device and queue.
> >
> > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
> > to indicate this so the underlying driver, for drivers to utilize
> > burst functionality appropriately.
> 
> I understand the cost of aggregating packets based on port and queue
> to make it burst.
> But, Could you share the use case where how do you want to use this
> flag? I see two possibilities in eventdev context.
> (Where dequeue can be from any ethdev port)
> a) The application does the aggregation. If so, what would the
> difference be in doing driver or application?
> b) We may use this flag when the system has only one port and one queue.
> 
> Could you share how do you want to use this flag?

I would say both the cases you mentioned. I prefer this to depend on the smartness of
the application, as it is aware of the number of eth devices/queues it is using.
This is the reason to avoid in the driver.

A user can also use separate event ports for separate or a group of Ethernet
devices/queues, to create easy segregation.

Also the drawback of implementing in the driver, can be that when the events to
Separate devices and queues are so mixed up, that segregation does not make
sense, it shall be overhead for the driver to scan all the events.

A flag would help in providing the decision flexibility to the applications.

> 
> And another point is, tx adapter is NOT experimental now, We need
> depreciation notice for ABI change.
> If you share the exact use case, then we could think of adding a new
> symbol instead of breaking ABI and
> add it for next release.

I have heard the discussion that we may get some exceptions to deprecation
process for 19.11 as the APIs will freeze of 1 year post it. 
Anyway, if you have a better way with symbol, please suggest.

> 
> 
> 
> 
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15 +++++++++++++--
> >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> >  10 files changed, 44 insertions(+), 18 deletions(-)
> >
> > diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-
> eventdev/test_pipeline_common.h
> > index 0440b9e29..6e73c6ab2 100644
> > --- a/app/test-eventdev/test_pipeline_common.h
> > +++ b/app/test-eventdev/test_pipeline_common.h
> > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t
> port,
> >                 struct rte_event * const ev)
> >  {
> >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> > +       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
> >                 rte_pause();
> >  }
> >
> > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const
> uint8_t port,
> >  {
> >         uint16_t enq;
> >
> > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
> > +       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
> >         while (enq < nb_rx) {
> >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > -                               ev + enq, nb_rx - enq);
> > +                               ev + enq, nb_rx - enq, 0);
> >         }
> >  }
> >
> > diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > index 192f9e1cf..a8c13e136 100644
> > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > @@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()``
> function.
> >         if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
> >
> >                 event.mbuf = m;
> > +               eq_flags = 0;
> >
> >                 m->port = tx_port;
> >                 rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
> >
> > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
> > +               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1,
> eq_flags);
> >         } else {
> >
> >                 event.queue_id = qid; /* event queue linked to adapter port */
> > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> b/drivers/event/octeontx/ssovf_evdev.h
> > index 0e622152c..1b156edab 100644
> > --- a/drivers/event/octeontx/ssovf_evdev.h
> > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws, uint8_t
> queue_id,
> >                 ssows_handle_event_t fn, void *arg);
> >  void ssows_reset(struct ssows *ws);
> >  uint16_t sso_event_tx_adapter_enqueue(void *port,
> > -               struct rte_event ev[], uint16_t nb_events);
> > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags);
> >  int ssovf_info(struct ssovf_info *info);
> >  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
> >  int test_eventdev_octeontx(void);
> > diff --git a/drivers/event/octeontx/ssovf_worker.c
> b/drivers/event/octeontx/ssovf_worker.c
> > index d940b5dd6..1d0467af3 100644
> > --- a/drivers/event/octeontx/ssovf_worker.c
> > +++ b/drivers/event/octeontx/ssovf_worker.c
> > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> >
> >  uint16_t
> >  sso_event_tx_adapter_enqueue(void *port,
> > -               struct rte_event ev[], uint16_t nb_events)
> > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
> >  {
> >         uint16_t port_id;
> >         uint16_t queue_id;
> > @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
> >         octeontx_dq_t *dq;
> >
> >         RTE_SET_USED(nb_events);
> > +       RTE_SET_USED(eq_flags);
> >         switch (ev->sched_type) {
> >         case SSO_SYNC_ORDERED:
> >                 ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> > diff --git a/drivers/event/octeontx2/otx2_evdev.h
> b/drivers/event/octeontx2/otx2_evdev.h
> > index 5cd80e3b2..74b749a15 100644
> > --- a/drivers/event/octeontx2/otx2_evdev.h
> > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> >
> >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event
> ev[],\
> > -                                          uint16_t nb_events);              \
> > +                                          uint16_t nb_events,               \
> > +                                          uint8_t eq_flags);                \
> >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,                  \
> >                                                struct rte_event ev[],        \
> > -                                              uint16_t nb_events);          \
> > +                                              uint16_t nb_events,           \
> > +                                              uint8_t eq_flags);            \
> >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                 \
> >                                                 struct rte_event ev[],       \
> > -                                               uint16_t nb_events);         \
> > +                                               uint16_t nb_events,          \
> > +                                               uint8_t eq_flags);           \
> >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> \
> >                                                     struct rte_event ev[],   \
> > -                                                   uint16_t nb_events);     \
> > +                                                   uint16_t nb_events,      \
> > +                                                   uint8_t eq_flags);       \
> >
> >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> >  #undef T
> > diff --git a/drivers/event/octeontx2/otx2_worker.c
> b/drivers/event/octeontx2/otx2_worker.c
> > index cd14cd3d2..100e21669 100644
> > --- a/drivers/event/octeontx2/otx2_worker.c
> > +++ b/drivers/event/octeontx2/otx2_worker.c
> > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port, const
> struct rte_event ev[],
> >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> >  uint16_t __hot                                                         \
> >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],   \
> > -                                 uint16_t nb_events)                   \
> > +                                 uint16_t nb_events,                   \
> > +                                 uint8_t eq_flags)                     \
> >  {                                                                      \
> >         struct otx2_ssogws *ws = port;                                  \
> >         uint64_t cmd[sz];                                               \
> >                                                                         \
> >         RTE_SET_USED(nb_events);                                        \
> > +       RTE_SET_USED(eq_flags);                                         \
> >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
> >  }
> >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> >  uint16_t __hot                                                         \
> >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct rte_event ev[],\
> > -                                     uint16_t nb_events)               \
> > +                                     uint16_t nb_events,               \
> > +                                     uint8_t eq_flags)                 \
> >  {                                                                      \
> >         struct otx2_ssogws *ws = port;                                  \
> >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> >                                                                         \
> >         RTE_SET_USED(nb_events);                                        \
> > +       RTE_SET_USED(eq_flags);                                         \
> >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
> >                                     NIX_TX_MULTI_SEG_F);                \
> >  }
> > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> b/drivers/event/octeontx2/otx2_worker_dual.c
> > index 37c274a54..c3e48da42 100644
> > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> >  uint16_t __hot                                                         \
> >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                     \
> >                                        struct rte_event ev[],           \
> > -                                      uint16_t nb_events)              \
> > +                                      uint16_t nb_events,              \
> > +                                      uint8_t eq_flags)                \
> >  {                                                                      \
> >         struct otx2_ssogws_dual *ws = port;                             \
> >         struct otx2_ssogws *vws =                                       \
> > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> \
> >         uint64_t cmd[sz];                                               \
> >                                                                         \
> >         RTE_SET_USED(nb_events);                                        \
> > +       RTE_SET_USED(eq_flags);                                         \
> >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
> >  }
> >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> >  uint16_t __hot                                                         \
> >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,                 \
> >                                            struct rte_event ev[],       \
> > -                                          uint16_t nb_events)          \
> > +                                          uint16_t nb_events,          \
> > +                                          uint8_t eq_flags)            \
> >  {                                                                      \
> >         struct otx2_ssogws_dual *ws = port;                             \
> >         struct otx2_ssogws *vws =                                       \
> > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> *port,                      \
> >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> >                                                                         \
> >         RTE_SET_USED(nb_events);                                        \
> > +       RTE_SET_USED(eq_flags);                                         \
> >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
> >                                     NIX_TX_MULTI_SEG_F);                \
> >  }
> > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > index c848261c4..98be77568 100644
> > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf
> *pkt)
> >  int
> >  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t
> *event_port_id);
> >
> > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST     0x1
> > +/**< This flag is used when all the packets enqueued in the tx adapter are
> > + * destined for the same Ethernet device, queue pair.
> > + */
> > +
> >  /**
> >   * Enqueue a burst of events objects or an event object supplied in
> *rte_event*
> >   * structure on an  event device designated by its *dev_id* through the event
> > @@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t
> id, uint8_t *event_port_id);
> >   *  The number of event objects to enqueue, typically number of
> >   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> >   *  available for this port.
> > + * @param flags
> > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all
> the packets
> > + *  which are enqueued are destined for the same Ethernet device, queue pair.
> >   *
> >   * @return
> >   *   The number of event objects actually enqueued on the event device. The
> > @@ -343,7 +352,8 @@ static inline uint16_t
> >  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> >                                 uint8_t port_id,
> >                                 struct rte_event ev[],
> > -                               uint16_t nb_events)
> > +                               uint16_t nb_events,
> > +                               uint8_t flags)
> >  {
> >         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> >
> > @@ -359,7 +369,8 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> >                 return 0;
> >         }
> >  #endif
> > -       return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
> > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > +                               nb_events, flags);
> >  }
> >
> >  /**
> > diff --git a/lib/librte_eventdev/rte_eventdev.c
> b/lib/librte_eventdev/rte_eventdev.c
> > index f44c869cb..3bf9d7115 100644
> > --- a/lib/librte_eventdev/rte_eventdev.c
> > +++ b/lib/librte_eventdev/rte_eventdev.c
> > @@ -1324,7 +1324,8 @@ rte_eventdev_find_free_device_index(void)
> >  static uint16_t
> >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> >                         __rte_unused struct rte_event ev[],
> > -                       __rte_unused uint16_t nb_events)
> > +                       __rte_unused uint16_t nb_events,
> > +                       __rte_unused uint8_t flags)
> >  {
> >         rte_errno = ENOTSUP;
> >         return 0;
> > diff --git a/lib/librte_eventdev/rte_eventdev.h
> b/lib/librte_eventdev/rte_eventdev.h
> > index 5044a13d0..2a5643da3 100644
> > --- a/lib/librte_eventdev/rte_eventdev.h
> > +++ b/lib/librte_eventdev/rte_eventdev.h
> > @@ -1227,7 +1227,7 @@ typedef uint16_t (*event_dequeue_burst_t)(void
> *port, struct rte_event ev[],
> >  /**< @internal Dequeue burst of events from port of a device */
> >
> >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > -                               struct rte_event ev[], uint16_t nb_events);
> > +               struct rte_event ev[], uint16_t nb_events, uint8_t flags);
> >  /**< @internal Enqueue burst of events on port of a device */
> >
> >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > --
> > 2.17.1
> >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01 11:41   ` Nipun Gupta
@ 2019-10-01 13:09     ` Jerin Jacob
  2019-10-01 14:02       ` Nipun Gupta
  0 siblings, 1 reply; 30+ messages in thread
From: Jerin Jacob @ 2019-10-01 13:09 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: dpdk-dev, Jerin Jacob, Pavan Nikhilesh, Sunil Kumar Kori,
	Hemant Agrawal, Richardson, Bruce, Marko Kovacevic, Ori Kam,
	Radu Nicolau, Tomasz Kantecki, Van Haaren, Harry, nikhil.rao

On Tue, Oct 1, 2019 at 5:11 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Tuesday, October 1, 2019 1:14 PM
> > To: Nipun Gupta <nipun.gupta@nxp.com>
> > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>; Pavan
> > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori <skori@marvell.com>;
> > Hemant Agrawal <hemant.agrawal@nxp.com>; Richardson, Bruce
> > <bruce.richardson@intel.com>; Marko Kovacevic
> > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu Nicolau
> > <radu.nicolau@intel.com>; Tomasz Kantecki <tomasz.kantecki@intel.com>; Van
> > Haaren, Harry <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> > packets enqueue
> >
> > On Tue, Oct 1, 2019 at 12:32 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
> > >
> > > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > > Some drivers may support burst functionality only with the packets
> > > having same destination device and queue.
> > >
> > > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
> > > to indicate this so the underlying driver, for drivers to utilize
> > > burst functionality appropriately.
> >
> > I understand the cost of aggregating packets based on port and queue
> > to make it burst.
> > But, Could you share the use case where how do you want to use this
> > flag? I see two possibilities in eventdev context.
> > (Where dequeue can be from any ethdev port)
> > a) The application does the aggregation. If so, what would the
> > difference be in doing driver or application?
> > b) We may use this flag when the system has only one port and one queue.
> >
> > Could you share how do you want to use this flag?
>
> I would say both the cases you mentioned. I prefer this to depend on the smartness of
> the application, as it is aware of the number of eth devices/queues it is using.
> This is the reason to avoid in the driver.
>
> A user can also use separate event ports for separate or a group of Ethernet
> devices/queues, to create easy segregation.

If it is specific to _very_ static configuration, you can assume all
the events comes
from a specific eventdev port, comes only from a specific ethdev port.

>
> Also the drawback of implementing in the driver, can be that when the events to
> Separate devices and queues are so mixed up, that segregation does not make
> sense, it shall be overhead for the driver to scan all the events.

In the worst case, both, applications need to scan and driver need to
iterate over
all the events.


In generic l2fwd-eventdev applications etc, q0 will be connected p0 and p1 etc.
This flag will be zero.

But, If you think, there is a specific use case for it we can add this flag.


>
> A flag would help in providing the decision flexibility to the applications.
>
> >
> > And another point is, tx adapter is NOT experimental now, We need
> > depreciation notice for ABI change.
> > If you share the exact use case, then we could think of adding a new
> > symbol instead of breaking ABI and
> > add it for next release.
>
> I have heard the discussion that we may get some exceptions to deprecation
> process for 19.11 as the APIs will freeze of 1 year post it.
> Anyway, if you have a better way with symbol, please suggest.


One option could be (not as bad as changing the enqueue prototype) to
add new field in struct rte_event_eth_tx_adapter_conf.

Since this scheme can be used ONLY on the static configuration, adding
a few fields
for Tx adapter configuration would help.
If that field is set you can choose dev->txa_enqueue light weight
enqueue function
if not, the driver can aggregate the buffers and send them.



>
> >
> >
> >
> >
> > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > ---
> > >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> > >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15 +++++++++++++--
> > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-
> > eventdev/test_pipeline_common.h
> > > index 0440b9e29..6e73c6ab2 100644
> > > --- a/app/test-eventdev/test_pipeline_common.h
> > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t
> > port,
> > >                 struct rte_event * const ev)
> > >  {
> > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> > > +       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
> > >                 rte_pause();
> > >  }
> > >
> > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const
> > uint8_t port,
> > >  {
> > >         uint16_t enq;
> > >
> > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
> > > +       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
> > >         while (enq < nb_rx) {
> > >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > > -                               ev + enq, nb_rx - enq);
> > > +                               ev + enq, nb_rx - enq, 0);
> > >         }
> > >  }
> > >
> > > diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > index 192f9e1cf..a8c13e136 100644
> > > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > @@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()``
> > function.
> > >         if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
> > >
> > >                 event.mbuf = m;
> > > +               eq_flags = 0;
> > >
> > >                 m->port = tx_port;
> > >                 rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
> > >
> > > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
> > > +               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1,
> > eq_flags);
> > >         } else {
> > >
> > >                 event.queue_id = qid; /* event queue linked to adapter port */
> > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > b/drivers/event/octeontx/ssovf_evdev.h
> > > index 0e622152c..1b156edab 100644
> > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws, uint8_t
> > queue_id,
> > >                 ssows_handle_event_t fn, void *arg);
> > >  void ssows_reset(struct ssows *ws);
> > >  uint16_t sso_event_tx_adapter_enqueue(void *port,
> > > -               struct rte_event ev[], uint16_t nb_events);
> > > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags);
> > >  int ssovf_info(struct ssovf_info *info);
> > >  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
> > >  int test_eventdev_octeontx(void);
> > > diff --git a/drivers/event/octeontx/ssovf_worker.c
> > b/drivers/event/octeontx/ssovf_worker.c
> > > index d940b5dd6..1d0467af3 100644
> > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > >
> > >  uint16_t
> > >  sso_event_tx_adapter_enqueue(void *port,
> > > -               struct rte_event ev[], uint16_t nb_events)
> > > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
> > >  {
> > >         uint16_t port_id;
> > >         uint16_t queue_id;
> > > @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
> > >         octeontx_dq_t *dq;
> > >
> > >         RTE_SET_USED(nb_events);
> > > +       RTE_SET_USED(eq_flags);
> > >         switch (ev->sched_type) {
> > >         case SSO_SYNC_ORDERED:
> > >                 ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> > > diff --git a/drivers/event/octeontx2/otx2_evdev.h
> > b/drivers/event/octeontx2/otx2_evdev.h
> > > index 5cd80e3b2..74b749a15 100644
> > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > >
> > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event
> > ev[],\
> > > -                                          uint16_t nb_events);              \
> > > +                                          uint16_t nb_events,               \
> > > +                                          uint8_t eq_flags);                \
> > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,                  \
> > >                                                struct rte_event ev[],        \
> > > -                                              uint16_t nb_events);          \
> > > +                                              uint16_t nb_events,           \
> > > +                                              uint8_t eq_flags);            \
> > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                 \
> > >                                                 struct rte_event ev[],       \
> > > -                                               uint16_t nb_events);         \
> > > +                                               uint16_t nb_events,          \
> > > +                                               uint8_t eq_flags);           \
> > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> > \
> > >                                                     struct rte_event ev[],   \
> > > -                                                   uint16_t nb_events);     \
> > > +                                                   uint16_t nb_events,      \
> > > +                                                   uint8_t eq_flags);       \
> > >
> > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > >  #undef T
> > > diff --git a/drivers/event/octeontx2/otx2_worker.c
> > b/drivers/event/octeontx2/otx2_worker.c
> > > index cd14cd3d2..100e21669 100644
> > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port, const
> > struct rte_event ev[],
> > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > >  uint16_t __hot                                                         \
> > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],   \
> > > -                                 uint16_t nb_events)                   \
> > > +                                 uint16_t nb_events,                   \
> > > +                                 uint8_t eq_flags)                     \
> > >  {                                                                      \
> > >         struct otx2_ssogws *ws = port;                                  \
> > >         uint64_t cmd[sz];                                               \
> > >                                                                         \
> > >         RTE_SET_USED(nb_events);                                        \
> > > +       RTE_SET_USED(eq_flags);                                         \
> > >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
> > >  }
> > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > >  uint16_t __hot                                                         \
> > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct rte_event ev[],\
> > > -                                     uint16_t nb_events)               \
> > > +                                     uint16_t nb_events,               \
> > > +                                     uint8_t eq_flags)                 \
> > >  {                                                                      \
> > >         struct otx2_ssogws *ws = port;                                  \
> > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > >                                                                         \
> > >         RTE_SET_USED(nb_events);                                        \
> > > +       RTE_SET_USED(eq_flags);                                         \
> > >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
> > >                                     NIX_TX_MULTI_SEG_F);                \
> > >  }
> > > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > index 37c274a54..c3e48da42 100644
> > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > >  uint16_t __hot                                                         \
> > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                     \
> > >                                        struct rte_event ev[],           \
> > > -                                      uint16_t nb_events)              \
> > > +                                      uint16_t nb_events,              \
> > > +                                      uint8_t eq_flags)                \
> > >  {                                                                      \
> > >         struct otx2_ssogws_dual *ws = port;                             \
> > >         struct otx2_ssogws *vws =                                       \
> > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> > \
> > >         uint64_t cmd[sz];                                               \
> > >                                                                         \
> > >         RTE_SET_USED(nb_events);                                        \
> > > +       RTE_SET_USED(eq_flags);                                         \
> > >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
> > >  }
> > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > >  uint16_t __hot                                                         \
> > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,                 \
> > >                                            struct rte_event ev[],       \
> > > -                                          uint16_t nb_events)          \
> > > +                                          uint16_t nb_events,          \
> > > +                                          uint8_t eq_flags)            \
> > >  {                                                                      \
> > >         struct otx2_ssogws_dual *ws = port;                             \
> > >         struct otx2_ssogws *vws =                                       \
> > > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> > *port,                      \
> > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > >                                                                         \
> > >         RTE_SET_USED(nb_events);                                        \
> > > +       RTE_SET_USED(eq_flags);                                         \
> > >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
> > >                                     NIX_TX_MULTI_SEG_F);                \
> > >  }
> > > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > index c848261c4..98be77568 100644
> > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf
> > *pkt)
> > >  int
> > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t
> > *event_port_id);
> > >
> > > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST     0x1
> > > +/**< This flag is used when all the packets enqueued in the tx adapter are
> > > + * destined for the same Ethernet device, queue pair.
> > > + */
> > > +
> > >  /**
> > >   * Enqueue a burst of events objects or an event object supplied in
> > *rte_event*
> > >   * structure on an  event device designated by its *dev_id* through the event
> > > @@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t
> > id, uint8_t *event_port_id);
> > >   *  The number of event objects to enqueue, typically number of
> > >   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > >   *  available for this port.
> > > + * @param flags
> > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all
> > the packets
> > > + *  which are enqueued are destined for the same Ethernet device, queue pair.
> > >   *
> > >   * @return
> > >   *   The number of event objects actually enqueued on the event device. The
> > > @@ -343,7 +352,8 @@ static inline uint16_t
> > >  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > >                                 uint8_t port_id,
> > >                                 struct rte_event ev[],
> > > -                               uint16_t nb_events)
> > > +                               uint16_t nb_events,
> > > +                               uint8_t flags)
> > >  {
> > >         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> > >
> > > @@ -359,7 +369,8 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > >                 return 0;
> > >         }
> > >  #endif
> > > -       return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
> > > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > +                               nb_events, flags);
> > >  }
> > >
> > >  /**
> > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > b/lib/librte_eventdev/rte_eventdev.c
> > > index f44c869cb..3bf9d7115 100644
> > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > @@ -1324,7 +1324,8 @@ rte_eventdev_find_free_device_index(void)
> > >  static uint16_t
> > >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> > >                         __rte_unused struct rte_event ev[],
> > > -                       __rte_unused uint16_t nb_events)
> > > +                       __rte_unused uint16_t nb_events,
> > > +                       __rte_unused uint8_t flags)
> > >  {
> > >         rte_errno = ENOTSUP;
> > >         return 0;
> > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > b/lib/librte_eventdev/rte_eventdev.h
> > > index 5044a13d0..2a5643da3 100644
> > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > @@ -1227,7 +1227,7 @@ typedef uint16_t (*event_dequeue_burst_t)(void
> > *port, struct rte_event ev[],
> > >  /**< @internal Dequeue burst of events from port of a device */
> > >
> > >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > > -                               struct rte_event ev[], uint16_t nb_events);
> > > +               struct rte_event ev[], uint16_t nb_events, uint8_t flags);
> > >  /**< @internal Enqueue burst of events on port of a device */
> > >
> > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > --
> > > 2.17.1
> > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01 13:09     ` Jerin Jacob
@ 2019-10-01 14:02       ` Nipun Gupta
  2019-10-01 14:20         ` Jerin Jacob
  0 siblings, 1 reply; 30+ messages in thread
From: Nipun Gupta @ 2019-10-01 14:02 UTC (permalink / raw)
  To: Jerin Jacob, Jerin Jacob
  Cc: dpdk-dev, Jerin Jacob, Pavan Nikhilesh, Sunil Kumar Kori,
	Hemant Agrawal, Richardson, Bruce, Marko Kovacevic, Ori Kam,
	Radu Nicolau, Tomasz Kantecki, Van Haaren, Harry, nikhil.rao



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Tuesday, October 1, 2019 6:40 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>
> Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>; Pavan
> Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> <skori@marvell.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Marko Kovacevic
> <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> Nicolau <radu.nicolau@intel.com>; Tomasz Kantecki
> <tomasz.kantecki@intel.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> packets enqueue
> 
> On Tue, Oct 1, 2019 at 5:11 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Tuesday, October 1, 2019 1:14 PM
> > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>; Pavan
> > > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> <skori@marvell.com>;
> > > Hemant Agrawal <hemant.agrawal@nxp.com>; Richardson, Bruce
> > > <bruce.richardson@intel.com>; Marko Kovacevic
> > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> Nicolau
> > > <radu.nicolau@intel.com>; Tomasz Kantecki
> <tomasz.kantecki@intel.com>; Van
> > > Haaren, Harry <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> destined
> > > packets enqueue
> > >
> > > On Tue, Oct 1, 2019 at 12:32 PM Nipun Gupta <nipun.gupta@nxp.com>
> wrote:
> > > >
> > > > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > > > Some drivers may support burst functionality only with the packets
> > > > having same destination device and queue.
> > > >
> > > > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can
> be used
> > > > to indicate this so the underlying driver, for drivers to utilize
> > > > burst functionality appropriately.
> > >
> > > I understand the cost of aggregating packets based on port and queue
> > > to make it burst.
> > > But, Could you share the use case where how do you want to use this
> > > flag? I see two possibilities in eventdev context.
> > > (Where dequeue can be from any ethdev port)
> > > a) The application does the aggregation. If so, what would the
> > > difference be in doing driver or application?
> > > b) We may use this flag when the system has only one port and one
> queue.
> > >
> > > Could you share how do you want to use this flag?
> >
> > I would say both the cases you mentioned. I prefer this to depend on the
> smartness of
> > the application, as it is aware of the number of eth devices/queues it is
> using.
> > This is the reason to avoid in the driver.
> >
> > A user can also use separate event ports for separate or a group of
> Ethernet
> > devices/queues, to create easy segregation.
> 
> If it is specific to _very_ static configuration, you can assume all
> the events comes
> from a specific eventdev port, comes only from a specific ethdev port.

Hi Jerin,

If I understand correctly this assumption would be made in the driver?
But then applications like l2fwd-event will break.

> 
> >
> > Also the drawback of implementing in the driver, can be that when the
> events to
> > Separate devices and queues are so mixed up, that segregation does not
> make
> > sense, it shall be overhead for the driver to scan all the events.
> 
> In the worst case, both, applications need to scan and driver need to
> iterate over
> all the events.

Agree, this is what we want to avoid.

> 
> 
> In generic l2fwd-eventdev applications etc, q0 will be connected p0 and p1
> etc.
> This flag will be zero.

Okay.

> 
> But, If you think, there is a specific use case for it we can add this flag.
> 
> 
> >
> > A flag would help in providing the decision flexibility to the applications.
> >
> > >
> > > And another point is, tx adapter is NOT experimental now, We need
> > > depreciation notice for ABI change.
> > > If you share the exact use case, then we could think of adding a new
> > > symbol instead of breaking ABI and
> > > add it for next release.
> >
> > I have heard the discussion that we may get some exceptions to
> deprecation
> > process for 19.11 as the APIs will freeze of 1 year post it.
> > Anyway, if you have a better way with symbol, please suggest.
> 
> 
> One option could be (not as bad as changing the enqueue prototype) to
> add new field in struct rte_event_eth_tx_adapter_conf.
> 
> Since this scheme can be used ONLY on the static configuration, adding
> a few fields
> for Tx adapter configuration would help.
> If that field is set you can choose dev->txa_enqueue light weight
> enqueue function
> if not, the driver can aggregate the buffers and send them.

Thanks for suggesting this, we also thought of it, but would prefer having this as a
runtime option rather than static option.
We would not like to have one time configuration restriction.

> 
> 
> 
> >
> > >
> > >
> > >
> > >
> > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > ---
> > > >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> > > >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> +++++++++++++--
> > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > >
> > > > diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-
> > > eventdev/test_pipeline_common.h
> > > > index 0440b9e29..6e73c6ab2 100644
> > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const
> uint8_t
> > > port,
> > > >                 struct rte_event * const ev)
> > > >  {
> > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> > > > +       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
> > > >                 rte_pause();
> > > >  }
> > > >
> > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev,
> const
> > > uint8_t port,
> > > >  {
> > > >         uint16_t enq;
> > > >
> > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
> > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx,
> 0);
> > > >         while (enq < nb_rx) {
> > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > -                               ev + enq, nb_rx - enq);
> > > > +                               ev + enq, nb_rx - enq, 0);
> > > >         }
> > > >  }
> > > >
> > > > diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > index 192f9e1cf..a8c13e136 100644
> > > > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > @@ -137,11 +137,12 @@ should use the
> ``rte_event_enqueue_burst()``
> > > function.
> > > >         if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
> > > >
> > > >                 event.mbuf = m;
> > > > +               eq_flags = 0;
> > > >
> > > >                 m->port = tx_port;
> > > >                 rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
> > > >
> > > > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event,
> 1);
> > > > +               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> &event, 1,
> > > eq_flags);
> > > >         } else {
> > > >
> > > >                 event.queue_id = qid; /* event queue linked to adapter port */
> > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > index 0e622152c..1b156edab 100644
> > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws,
> uint8_t
> > > queue_id,
> > > >                 ssows_handle_event_t fn, void *arg);
> > > >  void ssows_reset(struct ssows *ws);
> > > >  uint16_t sso_event_tx_adapter_enqueue(void *port,
> > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags);
> > > >  int ssovf_info(struct ssovf_info *info);
> > > >  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
> > > >  int test_eventdev_octeontx(void);
> > > > diff --git a/drivers/event/octeontx/ssovf_worker.c
> > > b/drivers/event/octeontx/ssovf_worker.c
> > > > index d940b5dd6..1d0467af3 100644
> > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > >
> > > >  uint16_t
> > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
> > > >  {
> > > >         uint16_t port_id;
> > > >         uint16_t queue_id;
> > > > @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
> > > >         octeontx_dq_t *dq;
> > > >
> > > >         RTE_SET_USED(nb_events);
> > > > +       RTE_SET_USED(eq_flags);
> > > >         switch (ev->sched_type) {
> > > >         case SSO_SYNC_ORDERED:
> > > >                 ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> > > > diff --git a/drivers/event/octeontx2/otx2_evdev.h
> > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > index 5cd80e3b2..74b749a15 100644
> > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > >
> > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct
> rte_event
> > > ev[],\
> > > > -                                          uint16_t nb_events);              \
> > > > +                                          uint16_t nb_events,               \
> > > > +                                          uint8_t eq_flags);                \
> > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,
> \
> > > >                                                struct rte_event ev[],        \
> > > > -                                              uint16_t nb_events);          \
> > > > +                                              uint16_t nb_events,           \
> > > > +                                              uint8_t eq_flags);            \
> > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> \
> > > >                                                 struct rte_event ev[],       \
> > > > -                                               uint16_t nb_events);         \
> > > > +                                               uint16_t nb_events,          \
> > > > +                                               uint8_t eq_flags);           \
> > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> > > \
> > > >                                                     struct rte_event ev[],   \
> > > > -                                                   uint16_t nb_events);     \
> > > > +                                                   uint16_t nb_events,      \
> > > > +                                                   uint8_t eq_flags);       \
> > > >
> > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > >  #undef T
> > > > diff --git a/drivers/event/octeontx2/otx2_worker.c
> > > b/drivers/event/octeontx2/otx2_worker.c
> > > > index cd14cd3d2..100e21669 100644
> > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port,
> const
> > > struct rte_event ev[],
> > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > >  uint16_t __hot                                                         \
> > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event
> ev[],   \
> > > > -                                 uint16_t nb_events)                   \
> > > > +                                 uint16_t nb_events,                   \
> > > > +                                 uint8_t eq_flags)                     \
> > > >  {                                                                      \
> > > >         struct otx2_ssogws *ws = port;                                  \
> > > >         uint64_t cmd[sz];                                               \
> > > >                                                                         \
> > > >         RTE_SET_USED(nb_events);                                        \
> > > > +       RTE_SET_USED(eq_flags);                                         \
> > > >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
> > > >  }
> > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > >  uint16_t __hot                                                         \
> > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct
> rte_event ev[],\
> > > > -                                     uint16_t nb_events)               \
> > > > +                                     uint16_t nb_events,               \
> > > > +                                     uint8_t eq_flags)                 \
> > > >  {                                                                      \
> > > >         struct otx2_ssogws *ws = port;                                  \
> > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > > >                                                                         \
> > > >         RTE_SET_USED(nb_events);                                        \
> > > > +       RTE_SET_USED(eq_flags);                                         \
> > > >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
> > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > >  }
> > > > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > index 37c274a54..c3e48da42 100644
> > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > >  uint16_t __hot                                                         \
> > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                     \
> > > >                                        struct rte_event ev[],           \
> > > > -                                      uint16_t nb_events)              \
> > > > +                                      uint16_t nb_events,              \
> > > > +                                      uint8_t eq_flags)                \
> > > >  {                                                                      \
> > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > >         struct otx2_ssogws *vws =                                       \
> > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ##
> name(void *port,
> > > \
> > > >         uint64_t cmd[sz];                                               \
> > > >                                                                         \
> > > >         RTE_SET_USED(nb_events);                                        \
> > > > +       RTE_SET_USED(eq_flags);                                         \
> > > >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
> > > >  }
> > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > >  uint16_t __hot                                                         \
> > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,                 \
> > > >                                            struct rte_event ev[],       \
> > > > -                                          uint16_t nb_events)          \
> > > > +                                          uint16_t nb_events,          \
> > > > +                                          uint8_t eq_flags)            \
> > > >  {                                                                      \
> > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > >         struct otx2_ssogws *vws =                                       \
> > > > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ##
> name(void
> > > *port,                      \
> > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > > >                                                                         \
> > > >         RTE_SET_USED(nb_events);                                        \
> > > > +       RTE_SET_USED(eq_flags);                                         \
> > > >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
> > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > >  }
> > > > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > index c848261c4..98be77568 100644
> > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct
> rte_mbuf
> > > *pkt)
> > > >  int
> > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t
> > > *event_port_id);
> > > >
> > > > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST     0x1
> > > > +/**< This flag is used when all the packets enqueued in the tx adapter
> are
> > > > + * destined for the same Ethernet device, queue pair.
> > > > + */
> > > > +
> > > >  /**
> > > >   * Enqueue a burst of events objects or an event object supplied in
> > > *rte_event*
> > > >   * structure on an  event device designated by its *dev_id* through
> the event
> > > > @@ -324,6 +329,10 @@
> rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > id, uint8_t *event_port_id);
> > > >   *  The number of event objects to enqueue, typically number of
> > > >   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > >   *  available for this port.
> > > > + * @param flags
> > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies
> that all
> > > the packets
> > > > + *  which are enqueued are destined for the same Ethernet device,
> queue pair.
> > > >   *
> > > >   * @return
> > > >   *   The number of event objects actually enqueued on the event
> device. The
> > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > >  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > >                                 uint8_t port_id,
> > > >                                 struct rte_event ev[],
> > > > -                               uint16_t nb_events)
> > > > +                               uint16_t nb_events,
> > > > +                               uint8_t flags)
> > > >  {
> > > >         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> > > >
> > > > @@ -359,7 +369,8 @@ rte_event_eth_tx_adapter_enqueue(uint8_t
> dev_id,
> > > >                 return 0;
> > > >         }
> > > >  #endif
> > > > -       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> nb_events);
> > > > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > +                               nb_events, flags);
> > > >  }
> > > >
> > > >  /**
> > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > b/lib/librte_eventdev/rte_eventdev.c
> > > > index f44c869cb..3bf9d7115 100644
> > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > @@ -1324,7 +1324,8 @@ rte_eventdev_find_free_device_index(void)
> > > >  static uint16_t
> > > >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> > > >                         __rte_unused struct rte_event ev[],
> > > > -                       __rte_unused uint16_t nb_events)
> > > > +                       __rte_unused uint16_t nb_events,
> > > > +                       __rte_unused uint8_t flags)
> > > >  {
> > > >         rte_errno = ENOTSUP;
> > > >         return 0;
> > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > b/lib/librte_eventdev/rte_eventdev.h
> > > > index 5044a13d0..2a5643da3 100644
> > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> (*event_dequeue_burst_t)(void
> > > *port, struct rte_event ev[],
> > > >  /**< @internal Dequeue burst of events from port of a device */
> > > >
> > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > > > -                               struct rte_event ev[], uint16_t nb_events);
> > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t flags);
> > > >  /**< @internal Enqueue burst of events on port of a device */
> > > >
> > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > --
> > > > 2.17.1
> > > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01 14:02       ` Nipun Gupta
@ 2019-10-01 14:20         ` Jerin Jacob
  2019-10-01 15:06           ` Nipun Gupta
  0 siblings, 1 reply; 30+ messages in thread
From: Jerin Jacob @ 2019-10-01 14:20 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: Jerin Jacob, dpdk-dev, Pavan Nikhilesh, Sunil Kumar Kori,
	Hemant Agrawal, Richardson, Bruce, Marko Kovacevic, Ori Kam,
	Radu Nicolau, Tomasz Kantecki, Van Haaren, Harry, nikhil.rao

On Tue, Oct 1, 2019 at 7:32 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Tuesday, October 1, 2019 6:40 PM
> > To: Nipun Gupta <nipun.gupta@nxp.com>
> > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>; Pavan
> > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > <skori@marvell.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> > Richardson, Bruce <bruce.richardson@intel.com>; Marko Kovacevic
> > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> > Nicolau <radu.nicolau@intel.com>; Tomasz Kantecki
> > <tomasz.kantecki@intel.com>; Van Haaren, Harry
> > <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> > packets enqueue
> >
> > On Tue, Oct 1, 2019 at 5:11 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > Sent: Tuesday, October 1, 2019 1:14 PM
> > > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>; Pavan
> > > > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > <skori@marvell.com>;
> > > > Hemant Agrawal <hemant.agrawal@nxp.com>; Richardson, Bruce
> > > > <bruce.richardson@intel.com>; Marko Kovacevic
> > > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> > Nicolau
> > > > <radu.nicolau@intel.com>; Tomasz Kantecki
> > <tomasz.kantecki@intel.com>; Van
> > > > Haaren, Harry <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> > destined
> > > > packets enqueue
> > > >
> > > > On Tue, Oct 1, 2019 at 12:32 PM Nipun Gupta <nipun.gupta@nxp.com>
> > wrote:
> > > > >
> > > > > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > > > > Some drivers may support burst functionality only with the packets
> > > > > having same destination device and queue.
> > > > >
> > > > > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can
> > be used
> > > > > to indicate this so the underlying driver, for drivers to utilize
> > > > > burst functionality appropriately.
> > > >
> > > > I understand the cost of aggregating packets based on port and queue
> > > > to make it burst.
> > > > But, Could you share the use case where how do you want to use this
> > > > flag? I see two possibilities in eventdev context.
> > > > (Where dequeue can be from any ethdev port)
> > > > a) The application does the aggregation. If so, what would the
> > > > difference be in doing driver or application?
> > > > b) We may use this flag when the system has only one port and one
> > queue.
> > > >
> > > > Could you share how do you want to use this flag?
> > >
> > > I would say both the cases you mentioned. I prefer this to depend on the
> > smartness of
> > > the application, as it is aware of the number of eth devices/queues it is
> > using.
> > > This is the reason to avoid in the driver.
> > >
> > > A user can also use separate event ports for separate or a group of
> > Ethernet
> > > devices/queues, to create easy segregation.
> >
> > If it is specific to _very_ static configuration, you can assume all
> > the events comes
> > from a specific eventdev port, comes only from a specific ethdev port.
>
> Hi Jerin,
>
> If I understand correctly this assumption would be made in the driver?
> But then applications like l2fwd-event will break.

Yes. What I meant is a specific static configuration only this scheme can use.


>
> >
> > >
> > > Also the drawback of implementing in the driver, can be that when the
> > events to
> > > Separate devices and queues are so mixed up, that segregation does not
> > make
> > > sense, it shall be overhead for the driver to scan all the events.
> >
> > In the worst case, both, applications need to scan and driver need to
> > iterate over
> > all the events.
>
> Agree, this is what we want to avoid.
>
> >
> >
> > In generic l2fwd-eventdev applications etc, q0 will be connected p0 and p1
> > etc.
> > This flag will be zero.
>
> Okay.
>
> >
> > But, If you think, there is a specific use case for it we can add this flag.
> >
> >
> > >
> > > A flag would help in providing the decision flexibility to the applications.
> > >
> > > >
> > > > And another point is, tx adapter is NOT experimental now, We need
> > > > depreciation notice for ABI change.
> > > > If you share the exact use case, then we could think of adding a new
> > > > symbol instead of breaking ABI and
> > > > add it for next release.
> > >
> > > I have heard the discussion that we may get some exceptions to
> > deprecation
> > > process for 19.11 as the APIs will freeze of 1 year post it.
> > > Anyway, if you have a better way with symbol, please suggest.
> >
> >
> > One option could be (not as bad as changing the enqueue prototype) to
> > add new field in struct rte_event_eth_tx_adapter_conf.
> >
> > Since this scheme can be used ONLY on the static configuration, adding
> > a few fields
> > for Tx adapter configuration would help.
> > If that field is set you can choose dev->txa_enqueue light weight
> > enqueue function
> > if not, the driver can aggregate the buffers and send them.
>
> Thanks for suggesting this, we also thought of it, but would prefer having this as a
> runtime option rather than static option.
> We would not like to have one time configuration restriction.

Not sure how it can be used in runtime. If q0 is connected p0 and p1 and then
it flag has to be cleared. if q0 is only connected to p0 then we can
use this scheme.
So it is pretty much static in nature.

How do you think, it can be used in runtime.

If we think, If we are planning to use like below in application, it
would be really bad
in the worst case.(mbuf cache misses in-app and driver)

In app:
const port = event[0].mbuf.port;
const queue = event[0].mbuf.queue;
for (i = i; i < nb_events; i++) {
          if (port != event[i].mbuf.port || queue != event[i].mbuf.queue)
                   break;
}
if (i == nb_events)
         flag = 1;
else
        flag = 0;

more over the static scheme does not make any change in other drivers.
If you have the usecase for the dynamic scheme then let us know then
we add dynamic flag breaking the ABI.


>
> >
> >
> >
> > >
> > > >
> > > >
> > > >
> > > >
> > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > ---
> > > > >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> > > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > > >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> > > > >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> > > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> > > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> > +++++++++++++--
> > > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > > >
> > > > > diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-
> > > > eventdev/test_pipeline_common.h
> > > > > index 0440b9e29..6e73c6ab2 100644
> > > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const
> > uint8_t
> > > > port,
> > > > >                 struct rte_event * const ev)
> > > > >  {
> > > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> > > > > +       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
> > > > >                 rte_pause();
> > > > >  }
> > > > >
> > > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev,
> > const
> > > > uint8_t port,
> > > > >  {
> > > > >         uint16_t enq;
> > > > >
> > > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
> > > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx,
> > 0);
> > > > >         while (enq < nb_rx) {
> > > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > > -                               ev + enq, nb_rx - enq);
> > > > > +                               ev + enq, nb_rx - enq, 0);
> > > > >         }
> > > > >  }
> > > > >
> > > > > diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > index 192f9e1cf..a8c13e136 100644
> > > > > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > @@ -137,11 +137,12 @@ should use the
> > ``rte_event_enqueue_burst()``
> > > > function.
> > > > >         if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
> > > > >
> > > > >                 event.mbuf = m;
> > > > > +               eq_flags = 0;
> > > > >
> > > > >                 m->port = tx_port;
> > > > >                 rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
> > > > >
> > > > > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event,
> > 1);
> > > > > +               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> > &event, 1,
> > > > eq_flags);
> > > > >         } else {
> > > > >
> > > > >                 event.queue_id = qid; /* event queue linked to adapter port */
> > > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > > index 0e622152c..1b156edab 100644
> > > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws,
> > uint8_t
> > > > queue_id,
> > > > >                 ssows_handle_event_t fn, void *arg);
> > > > >  void ssows_reset(struct ssows *ws);
> > > > >  uint16_t sso_event_tx_adapter_enqueue(void *port,
> > > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags);
> > > > >  int ssovf_info(struct ssovf_info *info);
> > > > >  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
> > > > >  int test_eventdev_octeontx(void);
> > > > > diff --git a/drivers/event/octeontx/ssovf_worker.c
> > > > b/drivers/event/octeontx/ssovf_worker.c
> > > > > index d940b5dd6..1d0467af3 100644
> > > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > > >
> > > > >  uint16_t
> > > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
> > > > >  {
> > > > >         uint16_t port_id;
> > > > >         uint16_t queue_id;
> > > > > @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
> > > > >         octeontx_dq_t *dq;
> > > > >
> > > > >         RTE_SET_USED(nb_events);
> > > > > +       RTE_SET_USED(eq_flags);
> > > > >         switch (ev->sched_type) {
> > > > >         case SSO_SYNC_ORDERED:
> > > > >                 ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> > > > > diff --git a/drivers/event/octeontx2/otx2_evdev.h
> > > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > > index 5cd80e3b2..74b749a15 100644
> > > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > > @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > >
> > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct
> > rte_event
> > > > ev[],\
> > > > > -                                          uint16_t nb_events);              \
> > > > > +                                          uint16_t nb_events,               \
> > > > > +                                          uint8_t eq_flags);                \
> > > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,
> > \
> > > > >                                                struct rte_event ev[],        \
> > > > > -                                              uint16_t nb_events);          \
> > > > > +                                              uint16_t nb_events,           \
> > > > > +                                              uint8_t eq_flags);            \
> > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> > \
> > > > >                                                 struct rte_event ev[],       \
> > > > > -                                               uint16_t nb_events);         \
> > > > > +                                               uint16_t nb_events,          \
> > > > > +                                               uint8_t eq_flags);           \
> > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> > > > \
> > > > >                                                     struct rte_event ev[],   \
> > > > > -                                                   uint16_t nb_events);     \
> > > > > +                                                   uint16_t nb_events,      \
> > > > > +                                                   uint8_t eq_flags);       \
> > > > >
> > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > >  #undef T
> > > > > diff --git a/drivers/event/octeontx2/otx2_worker.c
> > > > b/drivers/event/octeontx2/otx2_worker.c
> > > > > index cd14cd3d2..100e21669 100644
> > > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port,
> > const
> > > > struct rte_event ev[],
> > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > >  uint16_t __hot                                                         \
> > > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event
> > ev[],   \
> > > > > -                                 uint16_t nb_events)                   \
> > > > > +                                 uint16_t nb_events,                   \
> > > > > +                                 uint8_t eq_flags)                     \
> > > > >  {                                                                      \
> > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > >         uint64_t cmd[sz];                                               \
> > > > >                                                                         \
> > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
> > > > >  }
> > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > >  uint16_t __hot                                                         \
> > > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct
> > rte_event ev[],\
> > > > > -                                     uint16_t nb_events)               \
> > > > > +                                     uint16_t nb_events,               \
> > > > > +                                     uint8_t eq_flags)                 \
> > > > >  {                                                                      \
> > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > > > >                                                                         \
> > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
> > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > >  }
> > > > > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > index 37c274a54..c3e48da42 100644
> > > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > >  uint16_t __hot                                                         \
> > > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                     \
> > > > >                                        struct rte_event ev[],           \
> > > > > -                                      uint16_t nb_events)              \
> > > > > +                                      uint16_t nb_events,              \
> > > > > +                                      uint8_t eq_flags)                \
> > > > >  {                                                                      \
> > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > >         struct otx2_ssogws *vws =                                       \
> > > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ##
> > name(void *port,
> > > > \
> > > > >         uint64_t cmd[sz];                                               \
> > > > >                                                                         \
> > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
> > > > >  }
> > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > >  uint16_t __hot                                                         \
> > > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,                 \
> > > > >                                            struct rte_event ev[],       \
> > > > > -                                          uint16_t nb_events)          \
> > > > > +                                          uint16_t nb_events,          \
> > > > > +                                          uint8_t eq_flags)            \
> > > > >  {                                                                      \
> > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > >         struct otx2_ssogws *vws =                                       \
> > > > > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ##
> > name(void
> > > > *port,                      \
> > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > > > >                                                                         \
> > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
> > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > >  }
> > > > > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > index c848261c4..98be77568 100644
> > > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct
> > rte_mbuf
> > > > *pkt)
> > > > >  int
> > > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t
> > > > *event_port_id);
> > > > >
> > > > > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST     0x1
> > > > > +/**< This flag is used when all the packets enqueued in the tx adapter
> > are
> > > > > + * destined for the same Ethernet device, queue pair.
> > > > > + */
> > > > > +
> > > > >  /**
> > > > >   * Enqueue a burst of events objects or an event object supplied in
> > > > *rte_event*
> > > > >   * structure on an  event device designated by its *dev_id* through
> > the event
> > > > > @@ -324,6 +329,10 @@
> > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > > id, uint8_t *event_port_id);
> > > > >   *  The number of event objects to enqueue, typically number of
> > > > >   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > > >   *  available for this port.
> > > > > + * @param flags
> > > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies
> > that all
> > > > the packets
> > > > > + *  which are enqueued are destined for the same Ethernet device,
> > queue pair.
> > > > >   *
> > > > >   * @return
> > > > >   *   The number of event objects actually enqueued on the event
> > device. The
> > > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > > >  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > > >                                 uint8_t port_id,
> > > > >                                 struct rte_event ev[],
> > > > > -                               uint16_t nb_events)
> > > > > +                               uint16_t nb_events,
> > > > > +                               uint8_t flags)
> > > > >  {
> > > > >         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> > > > >
> > > > > @@ -359,7 +369,8 @@ rte_event_eth_tx_adapter_enqueue(uint8_t
> > dev_id,
> > > > >                 return 0;
> > > > >         }
> > > > >  #endif
> > > > > -       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > nb_events);
> > > > > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > +                               nb_events, flags);
> > > > >  }
> > > > >
> > > > >  /**
> > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > > b/lib/librte_eventdev/rte_eventdev.c
> > > > > index f44c869cb..3bf9d7115 100644
> > > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > > @@ -1324,7 +1324,8 @@ rte_eventdev_find_free_device_index(void)
> > > > >  static uint16_t
> > > > >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> > > > >                         __rte_unused struct rte_event ev[],
> > > > > -                       __rte_unused uint16_t nb_events)
> > > > > +                       __rte_unused uint16_t nb_events,
> > > > > +                       __rte_unused uint8_t flags)
> > > > >  {
> > > > >         rte_errno = ENOTSUP;
> > > > >         return 0;
> > > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > > b/lib/librte_eventdev/rte_eventdev.h
> > > > > index 5044a13d0..2a5643da3 100644
> > > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> > (*event_dequeue_burst_t)(void
> > > > *port, struct rte_event ev[],
> > > > >  /**< @internal Dequeue burst of events from port of a device */
> > > > >
> > > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > > > > -                               struct rte_event ev[], uint16_t nb_events);
> > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t flags);
> > > > >  /**< @internal Enqueue burst of events on port of a device */
> > > > >
> > > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > > --
> > > > > 2.17.1
> > > > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01  6:46 [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue Nipun Gupta
  2019-10-01  7:44 ` Jerin Jacob
@ 2019-10-01 14:42 ` Aaron Conole
  2019-10-01 15:15   ` Nipun Gupta
  2019-10-04  6:55 ` [dpdk-dev] [PATCH v2] " Nipun Gupta
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 30+ messages in thread
From: Aaron Conole @ 2019-10-01 14:42 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: dev, jerinj, pbhagavatula, skori, hemant.agrawal,
	bruce.richardson, marko.kovacevic, orika, radu.nicolau,
	tomasz.kantecki, harry.van.haaren, nikhil.rao

Nipun Gupta <nipun.gupta@nxp.com> writes:

> This patch introduces a `flag` in the Eth TX adapter enqueue API.
> Some drivers may support burst functionality only with the packets
> having same destination device and queue.
>
> The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
> to indicate this so the underlying driver, for drivers to utilize
> burst functionality appropriately.
>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---

In addition to the ABI concerns (which I mirror), you also should
compile test this patch.  It currently doesn't build (for example, see a
missed adapter_enqueue in
examples/eventdev_pipeline/pipeline_worker_tx.c)

>  app/test-eventdev/test_pipeline_common.h          |  6 +++---
>  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
>  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
>  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
>  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
>  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
>  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
>  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15 +++++++++++++--
>  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
>  lib/librte_eventdev/rte_eventdev.h                |  2 +-
>  10 files changed, 44 insertions(+), 18 deletions(-)
>
> diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
> index 0440b9e29..6e73c6ab2 100644
> --- a/app/test-eventdev/test_pipeline_common.h
> +++ b/app/test-eventdev/test_pipeline_common.h
> @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t port,
>  		struct rte_event * const ev)
>  {
>  	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> -	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> +	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
>  		rte_pause();
>  }
>  
> @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const uint8_t port,
>  {
>  	uint16_t enq;
>  
> -	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
> +	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
>  	while (enq < nb_rx) {
>  		enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> -				ev + enq, nb_rx - enq);
> +				ev + enq, nb_rx - enq, 0);
>  	}
>  }
>  
> diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> index 192f9e1cf..a8c13e136 100644
> --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> @@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()`` function.
>  	if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
>  
>  		event.mbuf = m;
> +		eq_flags = 0;
>  
>  		m->port = tx_port;
>  		rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
>  
> -		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
> +		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1, eq_flags);
>  	} else {
>  
>  		event.queue_id = qid; /* event queue linked to adapter port */
> diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h
> index 0e622152c..1b156edab 100644
> --- a/drivers/event/octeontx/ssovf_evdev.h
> +++ b/drivers/event/octeontx/ssovf_evdev.h
> @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws, uint8_t queue_id,
>  		ssows_handle_event_t fn, void *arg);
>  void ssows_reset(struct ssows *ws);
>  uint16_t sso_event_tx_adapter_enqueue(void *port,
> -		struct rte_event ev[], uint16_t nb_events);
> +		struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags);
>  int ssovf_info(struct ssovf_info *info);
>  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
>  int test_eventdev_octeontx(void);
> diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c
> index d940b5dd6..1d0467af3 100644
> --- a/drivers/event/octeontx/ssovf_worker.c
> +++ b/drivers/event/octeontx/ssovf_worker.c
> @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
>  
>  uint16_t
>  sso_event_tx_adapter_enqueue(void *port,
> -		struct rte_event ev[], uint16_t nb_events)
> +		struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
>  {
>  	uint16_t port_id;
>  	uint16_t queue_id;
> @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
>  	octeontx_dq_t *dq;
>  
>  	RTE_SET_USED(nb_events);
> +	RTE_SET_USED(eq_flags);
>  	switch (ev->sched_type) {
>  	case SSO_SYNC_ORDERED:
>  		ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> diff --git a/drivers/event/octeontx2/otx2_evdev.h b/drivers/event/octeontx2/otx2_evdev.h
> index 5cd80e3b2..74b749a15 100644
> --- a/drivers/event/octeontx2/otx2_evdev.h
> +++ b/drivers/event/octeontx2/otx2_evdev.h
> @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
>  
>  #define T(name, f4, f3, f2, f1, f0, sz, flags)				     \
>  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],\
> -					   uint16_t nb_events);		     \
> +					   uint16_t nb_events,		     \
> +					   uint8_t eq_flags);		     \
>  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,		     \
>  					       struct rte_event ev[],	     \
> -					       uint16_t nb_events);	     \
> +					       uint16_t nb_events,	     \
> +					       uint8_t eq_flags);	     \
>  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,		     \
>  						struct rte_event ev[],	     \
> -						uint16_t nb_events);	     \
> +						uint16_t nb_events,	     \
> +						uint8_t eq_flags);	     \
>  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,		     \
>  						    struct rte_event ev[],   \
> -						    uint16_t nb_events);     \
> +						    uint16_t nb_events,	     \
> +						    uint8_t eq_flags);	     \
>  
>  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
>  #undef T
> diff --git a/drivers/event/octeontx2/otx2_worker.c b/drivers/event/octeontx2/otx2_worker.c
> index cd14cd3d2..100e21669 100644
> --- a/drivers/event/octeontx2/otx2_worker.c
> +++ b/drivers/event/octeontx2/otx2_worker.c
> @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port, const struct rte_event ev[],
>  #define T(name, f4, f3, f2, f1, f0, sz, flags)				\
>  uint16_t __hot								\
>  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],	\
> -				  uint16_t nb_events)			\
> +				  uint16_t nb_events,			\
> +				  uint8_t eq_flags)			\
>  {									\
>  	struct otx2_ssogws *ws = port;					\
>  	uint64_t cmd[sz];						\
>  									\
>  	RTE_SET_USED(nb_events);					\
> +	RTE_SET_USED(eq_flags);						\
>  	return otx2_ssogws_event_tx(ws, ev, cmd, flags);		\
>  }
>  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
>  #define T(name, f4, f3, f2, f1, f0, sz, flags)				\
>  uint16_t __hot								\
>  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct rte_event ev[],\
> -				      uint16_t nb_events)		\
> +				      uint16_t nb_events,		\
> +				      uint8_t eq_flags)			\
>  {									\
>  	struct otx2_ssogws *ws = port;					\
>  	uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];			\
>  									\
>  	RTE_SET_USED(nb_events);					\
> +	RTE_SET_USED(eq_flags);						\
>  	return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |		\
>  				    NIX_TX_MULTI_SEG_F);		\
>  }
> diff --git a/drivers/event/octeontx2/otx2_worker_dual.c b/drivers/event/octeontx2/otx2_worker_dual.c
> index 37c274a54..c3e48da42 100644
> --- a/drivers/event/octeontx2/otx2_worker_dual.c
> +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
>  uint16_t __hot								\
>  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,			\
>  				       struct rte_event ev[],		\
> -				       uint16_t nb_events)		\
> +				       uint16_t nb_events,		\
> +				       uint8_t eq_flags)		\
>  {									\
>  	struct otx2_ssogws_dual *ws = port;				\
>  	struct otx2_ssogws *vws =					\
> @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,			\
>  	uint64_t cmd[sz];						\
>  									\
>  	RTE_SET_USED(nb_events);					\
> +	RTE_SET_USED(eq_flags);						\
>  	return otx2_ssogws_event_tx(vws, ev, cmd, flags);		\
>  }
>  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
>  uint16_t __hot								\
>  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,			\
>  					   struct rte_event ev[],	\
> -					   uint16_t nb_events)		\
> +					   uint16_t nb_events,		\
> +					   uint8_t eq_flags)		\
>  {									\
>  	struct otx2_ssogws_dual *ws = port;				\
>  	struct otx2_ssogws *vws =					\
> @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,			\
>  	uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];			\
>  									\
>  	RTE_SET_USED(nb_events);					\
> +	RTE_SET_USED(eq_flags);						\
>  	return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |		\
>  				    NIX_TX_MULTI_SEG_F);		\
>  }
> diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> index c848261c4..98be77568 100644
> --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
>  int
>  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
>  
> +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST	0x1
> +/**< This flag is used when all the packets enqueued in the tx adapter are
> + * destined for the same Ethernet device, queue pair.
> + */
> +
>  /**
>   * Enqueue a burst of events objects or an event object supplied in *rte_event*
>   * structure on an  event device designated by its *dev_id* through the event
> @@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
>   *  The number of event objects to enqueue, typically number of
>   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
>   *  available for this port.
> + * @param flags
> + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets
> + *  which are enqueued are destined for the same Ethernet device, queue pair.
>   *
>   * @return
>   *   The number of event objects actually enqueued on the event device. The
> @@ -343,7 +352,8 @@ static inline uint16_t
>  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
>  				uint8_t port_id,
>  				struct rte_event ev[],
> -				uint16_t nb_events)
> +				uint16_t nb_events,
> +				uint8_t flags)
>  {
>  	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
>  
> @@ -359,7 +369,8 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
>  		return 0;
>  	}
>  #endif
> -	return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
> +	return dev->txa_enqueue(dev->data->ports[port_id], ev,
> +				nb_events, flags);
>  }
>  
>  /**
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index f44c869cb..3bf9d7115 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -1324,7 +1324,8 @@ rte_eventdev_find_free_device_index(void)
>  static uint16_t
>  rte_event_tx_adapter_enqueue(__rte_unused void *port,
>  			__rte_unused struct rte_event ev[],
> -			__rte_unused uint16_t nb_events)
> +			__rte_unused uint16_t nb_events,
> +			__rte_unused uint8_t flags)
>  {
>  	rte_errno = ENOTSUP;
>  	return 0;
> diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
> index 5044a13d0..2a5643da3 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -1227,7 +1227,7 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
>  /**< @internal Dequeue burst of events from port of a device */
>  
>  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> -				struct rte_event ev[], uint16_t nb_events);
> +		struct rte_event ev[], uint16_t nb_events, uint8_t flags);
>  /**< @internal Enqueue burst of events on port of a device */
>  
>  #define RTE_EVENTDEV_NAME_MAX_LEN	(64)

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01 14:20         ` Jerin Jacob
@ 2019-10-01 15:06           ` Nipun Gupta
  2019-10-01 15:35             ` Jerin Jacob
  0 siblings, 1 reply; 30+ messages in thread
From: Nipun Gupta @ 2019-10-01 15:06 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Jerin Jacob, dpdk-dev, Pavan Nikhilesh, Sunil Kumar Kori,
	Hemant Agrawal, Richardson, Bruce, Marko Kovacevic, Ori Kam,
	Radu Nicolau, Tomasz Kantecki, Van Haaren, Harry, nikhil.rao



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Tuesday, October 1, 2019 7:50 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>
> Cc: Jerin Jacob <jerinj@marvell.com>; dpdk-dev <dev@dpdk.org>; Pavan
> Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> <skori@marvell.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Marko Kovacevic
> <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> Nicolau <radu.nicolau@intel.com>; Tomasz Kantecki
> <tomasz.kantecki@intel.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> packets enqueue
> 
> On Tue, Oct 1, 2019 at 7:32 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Tuesday, October 1, 2019 6:40 PM
> > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>; Pavan
> > > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > > <skori@marvell.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> > > Richardson, Bruce <bruce.richardson@intel.com>; Marko Kovacevic
> > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> > > Nicolau <radu.nicolau@intel.com>; Tomasz Kantecki
> > > <tomasz.kantecki@intel.com>; Van Haaren, Harry
> > > <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> destined
> > > packets enqueue
> > >
> > > On Tue, Oct 1, 2019 at 5:11 PM Nipun Gupta <nipun.gupta@nxp.com>
> wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > Sent: Tuesday, October 1, 2019 1:14 PM
> > > > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>;
> Pavan
> > > > > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > > <skori@marvell.com>;
> > > > > Hemant Agrawal <hemant.agrawal@nxp.com>; Richardson, Bruce
> > > > > <bruce.richardson@intel.com>; Marko Kovacevic
> > > > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>;
> Radu
> > > Nicolau
> > > > > <radu.nicolau@intel.com>; Tomasz Kantecki
> > > <tomasz.kantecki@intel.com>; Van
> > > > > Haaren, Harry <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > > > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> > > destined
> > > > > packets enqueue
> > > > >
> > > > > On Tue, Oct 1, 2019 at 12:32 PM Nipun Gupta <nipun.gupta@nxp.com>
> > > wrote:
> > > > > >
> > > > > > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > > > > > Some drivers may support burst functionality only with the packets
> > > > > > having same destination device and queue.
> > > > > >
> > > > > > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST`
> can
> > > be used
> > > > > > to indicate this so the underlying driver, for drivers to utilize
> > > > > > burst functionality appropriately.
> > > > >
> > > > > I understand the cost of aggregating packets based on port and
> queue
> > > > > to make it burst.
> > > > > But, Could you share the use case where how do you want to use this
> > > > > flag? I see two possibilities in eventdev context.
> > > > > (Where dequeue can be from any ethdev port)
> > > > > a) The application does the aggregation. If so, what would the
> > > > > difference be in doing driver or application?
> > > > > b) We may use this flag when the system has only one port and one
> > > queue.
> > > > >
> > > > > Could you share how do you want to use this flag?
> > > >
> > > > I would say both the cases you mentioned. I prefer this to depend on
> the
> > > smartness of
> > > > the application, as it is aware of the number of eth devices/queues it is
> > > using.
> > > > This is the reason to avoid in the driver.
> > > >
> > > > A user can also use separate event ports for separate or a group of
> > > Ethernet
> > > > devices/queues, to create easy segregation.
> > >
> > > If it is specific to _very_ static configuration, you can assume all
> > > the events comes
> > > from a specific eventdev port, comes only from a specific ethdev port.
> >
> > Hi Jerin,
> >
> > If I understand correctly this assumption would be made in the driver?
> > But then applications like l2fwd-event will break.
> 
> Yes. What I meant is a specific static configuration only this scheme can use.
> 
> 
> >
> > >
> > > >
> > > > Also the drawback of implementing in the driver, can be that when the
> > > events to
> > > > Separate devices and queues are so mixed up, that segregation does
> not
> > > make
> > > > sense, it shall be overhead for the driver to scan all the events.
> > >
> > > In the worst case, both, applications need to scan and driver need to
> > > iterate over
> > > all the events.
> >
> > Agree, this is what we want to avoid.
> >
> > >
> > >
> > > In generic l2fwd-eventdev applications etc, q0 will be connected p0 and
> p1
> > > etc.
> > > This flag will be zero.
> >
> > Okay.
> >
> > >
> > > But, If you think, there is a specific use case for it we can add this flag.
> > >
> > >
> > > >
> > > > A flag would help in providing the decision flexibility to the applications.
> > > >
> > > > >
> > > > > And another point is, tx adapter is NOT experimental now, We need
> > > > > depreciation notice for ABI change.
> > > > > If you share the exact use case, then we could think of adding a new
> > > > > symbol instead of breaking ABI and
> > > > > add it for next release.
> > > >
> > > > I have heard the discussion that we may get some exceptions to
> > > deprecation
> > > > process for 19.11 as the APIs will freeze of 1 year post it.
> > > > Anyway, if you have a better way with symbol, please suggest.
> > >
> > >
> > > One option could be (not as bad as changing the enqueue prototype) to
> > > add new field in struct rte_event_eth_tx_adapter_conf.
> > >
> > > Since this scheme can be used ONLY on the static configuration, adding
> > > a few fields
> > > for Tx adapter configuration would help.
> > > If that field is set you can choose dev->txa_enqueue light weight
> > > enqueue function
> > > if not, the driver can aggregate the buffers and send them.
> >
> > Thanks for suggesting this, we also thought of it, but would prefer having
> this as a
> > runtime option rather than static option.
> > We would not like to have one time configuration restriction.
> 
> Not sure how it can be used in runtime. If q0 is connected p0 and p1 and then
> it flag has to be cleared. if q0 is only connected to p0 then we can
> use this scheme.
> So it is pretty much static in nature.
> 
> How do you think, it can be used in runtime.
> 
> If we think, If we are planning to use like below in application, it
> would be really bad
> in the worst case.(mbuf cache misses in-app and driver)
> 
> In app:
> const port = event[0].mbuf.port;
> const queue = event[0].mbuf.queue;
> for (i = i; i < nb_events; i++) {
>           if (port != event[i].mbuf.port || queue != event[i].mbuf.queue)
>                    break;
> }
> if (i == nb_events)
>          flag = 1;
> else
>         flag = 0;
> 

In such case if cache misses are observed which is more than what sending burst
of traffic is in the applications use-case, the application shall simply not use the flag.

But again I think this is to be governed by the application which is the user of the
event device, on the basis on the configuration and the memory footprint/utilization;
and more than that its performance benchmarking.

> more over the static scheme does not make any change in other drivers.
> If you have the usecase for the dynamic scheme then let us know then
> we add dynamic flag breaking the ABI.

I understand your concern that this shall not be valid on a general cases.

There are certain use-case (NXP internal) of DPDK event which have separate
event ports/cores dedicated for certain tasks - and can use the burst functionality
for performance according to the event ports which are used. Not having this at
runtime will limit the flexibility for such applications.

Regards,
Nipun

> 
> 
> >
> > >
> > >
> > >
> > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > ---
> > > > > >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> > > > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > > > >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> > > > > >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> > > > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> > > > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> > > +++++++++++++--
> > > > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > > > >
> > > > > > diff --git a/app/test-eventdev/test_pipeline_common.h
> b/app/test-
> > > > > eventdev/test_pipeline_common.h
> > > > > > index 0440b9e29..6e73c6ab2 100644
> > > > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const
> > > uint8_t
> > > > > port,
> > > > > >                 struct rte_event * const ev)
> > > > > >  {
> > > > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> > > > > > +       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1,
> 0))
> > > > > >                 rte_pause();
> > > > > >  }
> > > > > >
> > > > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t
> dev,
> > > const
> > > > > uint8_t port,
> > > > > >  {
> > > > > >         uint16_t enq;
> > > > > >
> > > > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> nb_rx);
> > > > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> nb_rx,
> > > 0);
> > > > > >         while (enq < nb_rx) {
> > > > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > > > -                               ev + enq, nb_rx - enq);
> > > > > > +                               ev + enq, nb_rx - enq, 0);
> > > > > >         }
> > > > > >  }
> > > > > >
> > > > > > diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > index 192f9e1cf..a8c13e136 100644
> > > > > > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > @@ -137,11 +137,12 @@ should use the
> > > ``rte_event_enqueue_burst()``
> > > > > function.
> > > > > >         if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> {
> > > > > >
> > > > > >                 event.mbuf = m;
> > > > > > +               eq_flags = 0;
> > > > > >
> > > > > >                 m->port = tx_port;
> > > > > >                 rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
> > > > > >
> > > > > > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> &event,
> > > 1);
> > > > > > +               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> > > &event, 1,
> > > > > eq_flags);
> > > > > >         } else {
> > > > > >
> > > > > >                 event.queue_id = qid; /* event queue linked to adapter
> port */
> > > > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > index 0e622152c..1b156edab 100644
> > > > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws,
> > > uint8_t
> > > > > queue_id,
> > > > > >                 ssows_handle_event_t fn, void *arg);
> > > > > >  void ssows_reset(struct ssows *ws);
> > > > > >  uint16_t sso_event_tx_adapter_enqueue(void *port,
> > > > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t
> eq_flags);
> > > > > >  int ssovf_info(struct ssovf_info *info);
> > > > > >  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
> > > > > >  int test_eventdev_octeontx(void);
> > > > > > diff --git a/drivers/event/octeontx/ssovf_worker.c
> > > > > b/drivers/event/octeontx/ssovf_worker.c
> > > > > > index d940b5dd6..1d0467af3 100644
> > > > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > > > >
> > > > > >  uint16_t
> > > > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
> > > > > >  {
> > > > > >         uint16_t port_id;
> > > > > >         uint16_t queue_id;
> > > > > > @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
> > > > > >         octeontx_dq_t *dq;
> > > > > >
> > > > > >         RTE_SET_USED(nb_events);
> > > > > > +       RTE_SET_USED(eq_flags);
> > > > > >         switch (ev->sched_type) {
> > > > > >         case SSO_SYNC_ORDERED:
> > > > > >                 ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> > > > > > diff --git a/drivers/event/octeontx2/otx2_evdev.h
> > > > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > index 5cd80e3b2..74b749a15 100644
> > > > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > >
> > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct
> > > rte_event
> > > > > ev[],\
> > > > > > -                                          uint16_t nb_events);              \
> > > > > > +                                          uint16_t nb_events,               \
> > > > > > +                                          uint8_t eq_flags);                \
> > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,
> > > \
> > > > > >                                                struct rte_event ev[],        \
> > > > > > -                                              uint16_t nb_events);          \
> > > > > > +                                              uint16_t nb_events,           \
> > > > > > +                                              uint8_t eq_flags);            \
> > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> > > \
> > > > > >                                                 struct rte_event ev[],       \
> > > > > > -                                               uint16_t nb_events);         \
> > > > > > +                                               uint16_t nb_events,          \
> > > > > > +                                               uint8_t eq_flags);           \
> > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> *port,
> > > > > \
> > > > > >                                                     struct rte_event ev[],   \
> > > > > > -                                                   uint16_t nb_events);     \
> > > > > > +                                                   uint16_t nb_events,      \
> > > > > > +                                                   uint8_t eq_flags);       \
> > > > > >
> > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > >  #undef T
> > > > > > diff --git a/drivers/event/octeontx2/otx2_worker.c
> > > > > b/drivers/event/octeontx2/otx2_worker.c
> > > > > > index cd14cd3d2..100e21669 100644
> > > > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > > > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port,
> > > const
> > > > > struct rte_event ev[],
> > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > >  uint16_t __hot                                                         \
> > > > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event
> > > ev[],   \
> > > > > > -                                 uint16_t nb_events)                   \
> > > > > > +                                 uint16_t nb_events,                   \
> > > > > > +                                 uint8_t eq_flags)                     \
> > > > > >  {                                                                      \
> > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > >         uint64_t cmd[sz];                                               \
> > > > > >                                                                         \
> > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
> > > > > >  }
> > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > >  uint16_t __hot                                                         \
> > > > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct
> > > rte_event ev[],\
> > > > > > -                                     uint16_t nb_events)               \
> > > > > > +                                     uint16_t nb_events,               \
> > > > > > +                                     uint8_t eq_flags)                 \
> > > > > >  {                                                                      \
> > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > > > > >                                                                         \
> > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
> > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > >  }
> > > > > > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > index 37c274a54..c3e48da42 100644
> > > > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > >  uint16_t __hot                                                         \
> > > > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                     \
> > > > > >                                        struct rte_event ev[],           \
> > > > > > -                                      uint16_t nb_events)              \
> > > > > > +                                      uint16_t nb_events,              \
> > > > > > +                                      uint8_t eq_flags)                \
> > > > > >  {                                                                      \
> > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ##
> > > name(void *port,
> > > > > \
> > > > > >         uint64_t cmd[sz];                                               \
> > > > > >                                                                         \
> > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
> > > > > >  }
> > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > >  uint16_t __hot                                                         \
> > > > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> \
> > > > > >                                            struct rte_event ev[],       \
> > > > > > -                                          uint16_t nb_events)          \
> > > > > > +                                          uint16_t nb_events,          \
> > > > > > +                                          uint8_t eq_flags)            \
> > > > > >  {                                                                      \
> > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ##
> > > name(void
> > > > > *port,                      \
> > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > > > > >                                                                         \
> > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
> > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > >  }
> > > > > > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > index c848261c4..98be77568 100644
> > > > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct
> > > rte_mbuf
> > > > > *pkt)
> > > > > >  int
> > > > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t
> > > > > *event_port_id);
> > > > > >
> > > > > > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> 0x1
> > > > > > +/**< This flag is used when all the packets enqueued in the tx
> adapter
> > > are
> > > > > > + * destined for the same Ethernet device, queue pair.
> > > > > > + */
> > > > > > +
> > > > > >  /**
> > > > > >   * Enqueue a burst of events objects or an event object supplied in
> > > > > *rte_event*
> > > > > >   * structure on an  event device designated by its *dev_id* through
> > > the event
> > > > > > @@ -324,6 +329,10 @@
> > > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > > > id, uint8_t *event_port_id);
> > > > > >   *  The number of event objects to enqueue, typically number of
> > > > > >   *
> rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > > > >   *  available for this port.
> > > > > > + * @param flags
> > > > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> signifies
> > > that all
> > > > > the packets
> > > > > > + *  which are enqueued are destined for the same Ethernet device,
> > > queue pair.
> > > > > >   *
> > > > > >   * @return
> > > > > >   *   The number of event objects actually enqueued on the event
> > > device. The
> > > > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > > > >  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > > > >                                 uint8_t port_id,
> > > > > >                                 struct rte_event ev[],
> > > > > > -                               uint16_t nb_events)
> > > > > > +                               uint16_t nb_events,
> > > > > > +                               uint8_t flags)
> > > > > >  {
> > > > > >         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> > > > > >
> > > > > > @@ -359,7 +369,8 @@
> rte_event_eth_tx_adapter_enqueue(uint8_t
> > > dev_id,
> > > > > >                 return 0;
> > > > > >         }
> > > > > >  #endif
> > > > > > -       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > nb_events);
> > > > > > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > > +                               nb_events, flags);
> > > > > >  }
> > > > > >
> > > > > >  /**
> > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > > > b/lib/librte_eventdev/rte_eventdev.c
> > > > > > index f44c869cb..3bf9d7115 100644
> > > > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > > > @@ -1324,7 +1324,8 @@
> rte_eventdev_find_free_device_index(void)
> > > > > >  static uint16_t
> > > > > >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> > > > > >                         __rte_unused struct rte_event ev[],
> > > > > > -                       __rte_unused uint16_t nb_events)
> > > > > > +                       __rte_unused uint16_t nb_events,
> > > > > > +                       __rte_unused uint8_t flags)
> > > > > >  {
> > > > > >         rte_errno = ENOTSUP;
> > > > > >         return 0;
> > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > > > b/lib/librte_eventdev/rte_eventdev.h
> > > > > > index 5044a13d0..2a5643da3 100644
> > > > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> > > (*event_dequeue_burst_t)(void
> > > > > *port, struct rte_event ev[],
> > > > > >  /**< @internal Dequeue burst of events from port of a device */
> > > > > >
> > > > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > > > > > -                               struct rte_event ev[], uint16_t nb_events);
> > > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t flags);
> > > > > >  /**< @internal Enqueue burst of events on port of a device */
> > > > > >
> > > > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > > > --
> > > > > > 2.17.1
> > > > > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01 14:42 ` Aaron Conole
@ 2019-10-01 15:15   ` Nipun Gupta
  0 siblings, 0 replies; 30+ messages in thread
From: Nipun Gupta @ 2019-10-01 15:15 UTC (permalink / raw)
  To: Aaron Conole
  Cc: dev, jerinj, pbhagavatula, skori, Hemant Agrawal,
	bruce.richardson, marko.kovacevic, orika, radu.nicolau,
	tomasz.kantecki, harry.van.haaren, nikhil.rao



> -----Original Message-----
> From: Aaron Conole <aconole@redhat.com>
> Sent: Tuesday, October 1, 2019 8:12 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; pbhagavatula@marvell.com;
> skori@marvell.com; Hemant Agrawal <hemant.agrawal@nxp.com>;
> bruce.richardson@intel.com; marko.kovacevic@intel.com;
> orika@mellanox.com; radu.nicolau@intel.com; tomasz.kantecki@intel.com;
> harry.van.haaren@intel.com; nikhil.rao@intel.com
> Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> packets enqueue
> 
> Nipun Gupta <nipun.gupta@nxp.com> writes:
> 
> > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > Some drivers may support burst functionality only with the packets
> > having same destination device and queue.
> >
> > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be
> used
> > to indicate this so the underlying driver, for drivers to utilize
> > burst functionality appropriately.
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> 
> In addition to the ABI concerns (which I mirror), you also should
> compile test this patch.  It currently doesn't build (for example, see a
> missed adapter_enqueue in
> examples/eventdev_pipeline/pipeline_worker_tx.c)

Thanks for letting me know. I missed compiling the example. Will fix in v2.

w.r.t. the ABI change, as API will freeze for 1 year post this we expect to get some
exception to deprecation process for 19.11.

> 
> >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15 +++++++++++++-
> -
> >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> >  10 files changed, 44 insertions(+), 18 deletions(-)
> >
> > diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-
> eventdev/test_pipeline_common.h
> > index 0440b9e29..6e73c6ab2 100644
> > --- a/app/test-eventdev/test_pipeline_common.h
> > +++ b/app/test-eventdev/test_pipeline_common.h
> > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t
> port,
> >  		struct rte_event * const ev)
> >  {
> >  	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > -	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> > +	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
> >  		rte_pause();
> >  }
> >
> > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const
> uint8_t port,
> >  {
> >  	uint16_t enq;
> >
> > -	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
> > +	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
> >  	while (enq < nb_rx) {
> >  		enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > -				ev + enq, nb_rx - enq);
> > +				ev + enq, nb_rx - enq, 0);
> >  	}
> >  }
> >
> > diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > index 192f9e1cf..a8c13e136 100644
> > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > @@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()``
> function.
> >  	if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
> >
> >  		event.mbuf = m;
> > +		eq_flags = 0;
> >
> >  		m->port = tx_port;
> >  		rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
> >
> > -		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> &event, 1);
> > +		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> &event, 1, eq_flags);
> >  	} else {
> >
> >  		event.queue_id = qid; /* event queue linked to adapter port
> */
> > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> b/drivers/event/octeontx/ssovf_evdev.h
> > index 0e622152c..1b156edab 100644
> > --- a/drivers/event/octeontx/ssovf_evdev.h
> > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws, uint8_t
> queue_id,
> >  		ssows_handle_event_t fn, void *arg);
> >  void ssows_reset(struct ssows *ws);
> >  uint16_t sso_event_tx_adapter_enqueue(void *port,
> > -		struct rte_event ev[], uint16_t nb_events);
> > +		struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags);
> >  int ssovf_info(struct ssovf_info *info);
> >  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
> >  int test_eventdev_octeontx(void);
> > diff --git a/drivers/event/octeontx/ssovf_worker.c
> b/drivers/event/octeontx/ssovf_worker.c
> > index d940b5dd6..1d0467af3 100644
> > --- a/drivers/event/octeontx/ssovf_worker.c
> > +++ b/drivers/event/octeontx/ssovf_worker.c
> > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> >
> >  uint16_t
> >  sso_event_tx_adapter_enqueue(void *port,
> > -		struct rte_event ev[], uint16_t nb_events)
> > +		struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
> >  {
> >  	uint16_t port_id;
> >  	uint16_t queue_id;
> > @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
> >  	octeontx_dq_t *dq;
> >
> >  	RTE_SET_USED(nb_events);
> > +	RTE_SET_USED(eq_flags);
> >  	switch (ev->sched_type) {
> >  	case SSO_SYNC_ORDERED:
> >  		ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> > diff --git a/drivers/event/octeontx2/otx2_evdev.h
> b/drivers/event/octeontx2/otx2_evdev.h
> > index 5cd80e3b2..74b749a15 100644
> > --- a/drivers/event/octeontx2/otx2_evdev.h
> > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> >
> >  #define T(name, f4, f3, f2, f1, f0, sz, flags)				     \
> >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct
> rte_event ev[],\
> > -					   uint16_t nb_events);		     \
> > +					   uint16_t nb_events,		     \
> > +					   uint8_t eq_flags);		     \
> >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,
> 	     \
> >  					       struct rte_event ev[],	     \
> > -					       uint16_t nb_events);	     \
> > +					       uint16_t nb_events,	     \
> > +					       uint8_t eq_flags);	     \
> >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> 	     \
> >  						struct rte_event ev[],	     \
> > -						uint16_t nb_events);	     \
> > +						uint16_t nb_events,	     \
> > +						uint8_t eq_flags);	     \
> >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> 		     \
> >  						    struct rte_event ev[],   \
> > -						    uint16_t nb_events);     \
> > +						    uint16_t nb_events,	     \
> > +						    uint8_t eq_flags);	     \
> >
> >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> >  #undef T
> > diff --git a/drivers/event/octeontx2/otx2_worker.c
> b/drivers/event/octeontx2/otx2_worker.c
> > index cd14cd3d2..100e21669 100644
> > --- a/drivers/event/octeontx2/otx2_worker.c
> > +++ b/drivers/event/octeontx2/otx2_worker.c
> > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port, const
> struct rte_event ev[],
> >  #define T(name, f4, f3, f2, f1, f0, sz, flags)				\
> >  uint16_t __hot
> 	\
> >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],
> 	\
> > -				  uint16_t nb_events)			\
> > +				  uint16_t nb_events,			\
> > +				  uint8_t eq_flags)			\
> >  {									\
> >  	struct otx2_ssogws *ws = port;					\
> >  	uint64_t cmd[sz];						\
> >  									\
> >  	RTE_SET_USED(nb_events);					\
> > +	RTE_SET_USED(eq_flags);
> 	\
> >  	return otx2_ssogws_event_tx(ws, ev, cmd, flags);		\
> >  }
> >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> >  #define T(name, f4, f3, f2, f1, f0, sz, flags)				\
> >  uint16_t __hot
> 	\
> >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct rte_event
> ev[],\
> > -				      uint16_t nb_events)		\
> > +				      uint16_t nb_events,		\
> > +				      uint8_t eq_flags)			\
> >  {									\
> >  	struct otx2_ssogws *ws = port;					\
> >  	uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];
> 	\
> >  									\
> >  	RTE_SET_USED(nb_events);					\
> > +	RTE_SET_USED(eq_flags);
> 	\
> >  	return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |		\
> >  				    NIX_TX_MULTI_SEG_F);		\
> >  }
> > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> b/drivers/event/octeontx2/otx2_worker_dual.c
> > index 37c274a54..c3e48da42 100644
> > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> >  uint16_t __hot
> 	\
> >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> 	\
> >  				       struct rte_event ev[],		\
> > -				       uint16_t nb_events)		\
> > +				       uint16_t nb_events,		\
> > +				       uint8_t eq_flags)		\
> >  {									\
> >  	struct otx2_ssogws_dual *ws = port;				\
> >  	struct otx2_ssogws *vws =					\
> > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ## name(void
> *port,			\
> >  	uint64_t cmd[sz];						\
> >  									\
> >  	RTE_SET_USED(nb_events);					\
> > +	RTE_SET_USED(eq_flags);
> 	\
> >  	return otx2_ssogws_event_tx(vws, ev, cmd, flags);		\
> >  }
> >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> >  uint16_t __hot
> 	\
> >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> 		\
> >  					   struct rte_event ev[],	\
> > -					   uint16_t nb_events)		\
> > +					   uint16_t nb_events,		\
> > +					   uint8_t eq_flags)		\
> >  {									\
> >  	struct otx2_ssogws_dual *ws = port;				\
> >  	struct otx2_ssogws *vws =					\
> > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ##
> name(void *port,			\
> >  	uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];
> 	\
> >  									\
> >  	RTE_SET_USED(nb_events);					\
> > +	RTE_SET_USED(eq_flags);
> 	\
> >  	return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |		\
> >  				    NIX_TX_MULTI_SEG_F);		\
> >  }
> > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > index c848261c4..98be77568 100644
> > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct
> rte_mbuf *pkt)
> >  int
> >  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t
> *event_port_id);
> >
> > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST	0x1
> > +/**< This flag is used when all the packets enqueued in the tx adapter are
> > + * destined for the same Ethernet device, queue pair.
> > + */
> > +
> >  /**
> >   * Enqueue a burst of events objects or an event object supplied in
> *rte_event*
> >   * structure on an  event device designated by its *dev_id* through the
> event
> > @@ -324,6 +329,10 @@
> rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t
> *event_port_id);
> >   *  The number of event objects to enqueue, typically number of
> >   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> >   *  available for this port.
> > + * @param flags
> > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that
> all the packets
> > + *  which are enqueued are destined for the same Ethernet device, queue
> pair.
> >   *
> >   * @return
> >   *   The number of event objects actually enqueued on the event device.
> The
> > @@ -343,7 +352,8 @@ static inline uint16_t
> >  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> >  				uint8_t port_id,
> >  				struct rte_event ev[],
> > -				uint16_t nb_events)
> > +				uint16_t nb_events,
> > +				uint8_t flags)
> >  {
> >  	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> >
> > @@ -359,7 +369,8 @@ rte_event_eth_tx_adapter_enqueue(uint8_t
> dev_id,
> >  		return 0;
> >  	}
> >  #endif
> > -	return dev->txa_enqueue(dev->data->ports[port_id], ev,
> nb_events);
> > +	return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > +				nb_events, flags);
> >  }
> >
> >  /**
> > diff --git a/lib/librte_eventdev/rte_eventdev.c
> b/lib/librte_eventdev/rte_eventdev.c
> > index f44c869cb..3bf9d7115 100644
> > --- a/lib/librte_eventdev/rte_eventdev.c
> > +++ b/lib/librte_eventdev/rte_eventdev.c
> > @@ -1324,7 +1324,8 @@ rte_eventdev_find_free_device_index(void)
> >  static uint16_t
> >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> >  			__rte_unused struct rte_event ev[],
> > -			__rte_unused uint16_t nb_events)
> > +			__rte_unused uint16_t nb_events,
> > +			__rte_unused uint8_t flags)
> >  {
> >  	rte_errno = ENOTSUP;
> >  	return 0;
> > diff --git a/lib/librte_eventdev/rte_eventdev.h
> b/lib/librte_eventdev/rte_eventdev.h
> > index 5044a13d0..2a5643da3 100644
> > --- a/lib/librte_eventdev/rte_eventdev.h
> > +++ b/lib/librte_eventdev/rte_eventdev.h
> > @@ -1227,7 +1227,7 @@ typedef uint16_t
> (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
> >  /**< @internal Dequeue burst of events from port of a device */
> >
> >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > -				struct rte_event ev[], uint16_t nb_events);
> > +		struct rte_event ev[], uint16_t nb_events, uint8_t flags);
> >  /**< @internal Enqueue burst of events on port of a device */
> >
> >  #define RTE_EVENTDEV_NAME_MAX_LEN	(64)

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01 15:06           ` Nipun Gupta
@ 2019-10-01 15:35             ` Jerin Jacob
  2019-10-02  3:08               ` Hemant Agrawal
  0 siblings, 1 reply; 30+ messages in thread
From: Jerin Jacob @ 2019-10-01 15:35 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: Jerin Jacob, dpdk-dev, Pavan Nikhilesh, Sunil Kumar Kori,
	Hemant Agrawal, Richardson, Bruce, Marko Kovacevic, Ori Kam,
	Radu Nicolau, Tomasz Kantecki, Van Haaren, Harry, nikhil.rao

On Tue, Oct 1, 2019 at 8:36 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Tuesday, October 1, 2019 7:50 PM
> > To: Nipun Gupta <nipun.gupta@nxp.com>
> > Cc: Jerin Jacob <jerinj@marvell.com>; dpdk-dev <dev@dpdk.org>; Pavan
> > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > <skori@marvell.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> > Richardson, Bruce <bruce.richardson@intel.com>; Marko Kovacevic
> > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> > Nicolau <radu.nicolau@intel.com>; Tomasz Kantecki
> > <tomasz.kantecki@intel.com>; Van Haaren, Harry
> > <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> > packets enqueue
> >
> > On Tue, Oct 1, 2019 at 7:32 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > Sent: Tuesday, October 1, 2019 6:40 PM
> > > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>; Pavan
> > > > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > > > <skori@marvell.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> > > > Richardson, Bruce <bruce.richardson@intel.com>; Marko Kovacevic
> > > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> > > > Nicolau <radu.nicolau@intel.com>; Tomasz Kantecki
> > > > <tomasz.kantecki@intel.com>; Van Haaren, Harry
> > > > <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> > destined
> > > > packets enqueue
> > > >
> > > > On Tue, Oct 1, 2019 at 5:11 PM Nipun Gupta <nipun.gupta@nxp.com>
> > wrote:
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > Sent: Tuesday, October 1, 2019 1:14 PM
> > > > > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>;
> > Pavan
> > > > > > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > > > <skori@marvell.com>;
> > > > > > Hemant Agrawal <hemant.agrawal@nxp.com>; Richardson, Bruce
> > > > > > <bruce.richardson@intel.com>; Marko Kovacevic
> > > > > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>;
> > Radu
> > > > Nicolau
> > > > > > <radu.nicolau@intel.com>; Tomasz Kantecki
> > > > <tomasz.kantecki@intel.com>; Van
> > > > > > Haaren, Harry <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > > > > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> > > > destined
> > > > > > packets enqueue
> > > > > >
> > > > > > On Tue, Oct 1, 2019 at 12:32 PM Nipun Gupta <nipun.gupta@nxp.com>
> > > > wrote:
> > > > > > >
> > > > > > > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > > > > > > Some drivers may support burst functionality only with the packets
> > > > > > > having same destination device and queue.
> > > > > > >
> > > > > > > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST`
> > can
> > > > be used
> > > > > > > to indicate this so the underlying driver, for drivers to utilize
> > > > > > > burst functionality appropriately.
> > > > > >
> > > > > > I understand the cost of aggregating packets based on port and
> > queue
> > > > > > to make it burst.
> > > > > > But, Could you share the use case where how do you want to use this
> > > > > > flag? I see two possibilities in eventdev context.
> > > > > > (Where dequeue can be from any ethdev port)
> > > > > > a) The application does the aggregation. If so, what would the
> > > > > > difference be in doing driver or application?
> > > > > > b) We may use this flag when the system has only one port and one
> > > > queue.
> > > > > >
> > > > > > Could you share how do you want to use this flag?
> > > > >
> > > > > I would say both the cases you mentioned. I prefer this to depend on
> > the
> > > > smartness of
> > > > > the application, as it is aware of the number of eth devices/queues it is
> > > > using.
> > > > > This is the reason to avoid in the driver.
> > > > >
> > > > > A user can also use separate event ports for separate or a group of
> > > > Ethernet
> > > > > devices/queues, to create easy segregation.
> > > >
> > > > If it is specific to _very_ static configuration, you can assume all
> > > > the events comes
> > > > from a specific eventdev port, comes only from a specific ethdev port.
> > >
> > > Hi Jerin,
> > >
> > > If I understand correctly this assumption would be made in the driver?
> > > But then applications like l2fwd-event will break.
> >
> > Yes. What I meant is a specific static configuration only this scheme can use.
> >
> >
> > >
> > > >
> > > > >
> > > > > Also the drawback of implementing in the driver, can be that when the
> > > > events to
> > > > > Separate devices and queues are so mixed up, that segregation does
> > not
> > > > make
> > > > > sense, it shall be overhead for the driver to scan all the events.
> > > >
> > > > In the worst case, both, applications need to scan and driver need to
> > > > iterate over
> > > > all the events.
> > >
> > > Agree, this is what we want to avoid.
> > >
> > > >
> > > >
> > > > In generic l2fwd-eventdev applications etc, q0 will be connected p0 and
> > p1
> > > > etc.
> > > > This flag will be zero.
> > >
> > > Okay.
> > >
> > > >
> > > > But, If you think, there is a specific use case for it we can add this flag.
> > > >
> > > >
> > > > >
> > > > > A flag would help in providing the decision flexibility to the applications.
> > > > >
> > > > > >
> > > > > > And another point is, tx adapter is NOT experimental now, We need
> > > > > > depreciation notice for ABI change.
> > > > > > If you share the exact use case, then we could think of adding a new
> > > > > > symbol instead of breaking ABI and
> > > > > > add it for next release.
> > > > >
> > > > > I have heard the discussion that we may get some exceptions to
> > > > deprecation
> > > > > process for 19.11 as the APIs will freeze of 1 year post it.
> > > > > Anyway, if you have a better way with symbol, please suggest.
> > > >
> > > >
> > > > One option could be (not as bad as changing the enqueue prototype) to
> > > > add new field in struct rte_event_eth_tx_adapter_conf.
> > > >
> > > > Since this scheme can be used ONLY on the static configuration, adding
> > > > a few fields
> > > > for Tx adapter configuration would help.
> > > > If that field is set you can choose dev->txa_enqueue light weight
> > > > enqueue function
> > > > if not, the driver can aggregate the buffers and send them.
> > >
> > > Thanks for suggesting this, we also thought of it, but would prefer having
> > this as a
> > > runtime option rather than static option.
> > > We would not like to have one time configuration restriction.
> >
> > Not sure how it can be used in runtime. If q0 is connected p0 and p1 and then
> > it flag has to be cleared. if q0 is only connected to p0 then we can
> > use this scheme.
> > So it is pretty much static in nature.
> >
> > How do you think, it can be used in runtime.
> >
> > If we think, If we are planning to use like below in application, it
> > would be really bad
> > in the worst case.(mbuf cache misses in-app and driver)
> >
> > In app:
> > const port = event[0].mbuf.port;
> > const queue = event[0].mbuf.queue;
> > for (i = i; i < nb_events; i++) {
> >           if (port != event[i].mbuf.port || queue != event[i].mbuf.queue)
> >                    break;
> > }
> > if (i == nb_events)
> >          flag = 1;
> > else
> >         flag = 0;
> >
>
> In such case if cache misses are observed which is more than what sending burst
> of traffic is in the applications use-case, the application shall simply not use the flag.
>
> But again I think this is to be governed by the application which is the user of the
> event device, on the basis on the configuration and the memory footprint/utilization;
> and more than that its performance benchmarking.
>
> > more over the static scheme does not make any change in other drivers.
> > If you have the usecase for the dynamic scheme then let us know then
> > we add dynamic flag breaking the ABI.
>
> I understand your concern that this shall not be valid on a general cases.
>
> There are certain use-case (NXP internal) of DPDK event which have separate
> event ports/cores dedicated for certain tasks - and can use the burst functionality
> for performance according to the event ports which are used. Not having this at
> runtime will limit the flexibility for such applications.

If it is specific to NXP internal use case then no more comments on
dynamic vs static.

@ Nikhil Rao any comments.

One option could be to incorporate NXP internal use case will be
introducing a new API,
parallel to rte_event_eth_tx_adapter_enqueue as
rte_event_eth_tx_adapter_enqueue_same_dest()
or something.

Two advantage:
# Not a major ABI breakage. Only need to add new fast-path function in
rte_eventdev.
# Even though we add 'zero' in API all the time, the Compiler prologue
needs to push to stack or move
the value to argument register as there is function pointer
indirection. so new API will have zero performance impact
for normal cases.

Not sure about minor ABI breakage in rte_eventdev(adding a new
fastpath function). If everyone is
OK as the exception for 19.11 then we can introduce a new API.



>
> Regards,
> Nipun
>
> >
> >
> > >
> > > >
> > > >
> > > >
> > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > > ---
> > > > > > >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> > > > > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > > > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > > > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > > > > >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> > > > > > >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> > > > > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> > > > > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> > > > +++++++++++++--
> > > > > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > > > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > > > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > > > > >
> > > > > > > diff --git a/app/test-eventdev/test_pipeline_common.h
> > b/app/test-
> > > > > > eventdev/test_pipeline_common.h
> > > > > > > index 0440b9e29..6e73c6ab2 100644
> > > > > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const
> > > > uint8_t
> > > > > > port,
> > > > > > >                 struct rte_event * const ev)
> > > > > > >  {
> > > > > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
> > > > > > > +       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1,
> > 0))
> > > > > > >                 rte_pause();
> > > > > > >  }
> > > > > > >
> > > > > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t
> > dev,
> > > > const
> > > > > > uint8_t port,
> > > > > > >  {
> > > > > > >         uint16_t enq;
> > > > > > >
> > > > > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> > nb_rx);
> > > > > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> > nb_rx,
> > > > 0);
> > > > > > >         while (enq < nb_rx) {
> > > > > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > > > > -                               ev + enq, nb_rx - enq);
> > > > > > > +                               ev + enq, nb_rx - enq, 0);
> > > > > > >         }
> > > > > > >  }
> > > > > > >
> > > > > > > diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > index 192f9e1cf..a8c13e136 100644
> > > > > > > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > @@ -137,11 +137,12 @@ should use the
> > > > ``rte_event_enqueue_burst()``
> > > > > > function.
> > > > > > >         if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> > {
> > > > > > >
> > > > > > >                 event.mbuf = m;
> > > > > > > +               eq_flags = 0;
> > > > > > >
> > > > > > >                 m->port = tx_port;
> > > > > > >                 rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
> > > > > > >
> > > > > > > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> > &event,
> > > > 1);
> > > > > > > +               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> > > > &event, 1,
> > > > > > eq_flags);
> > > > > > >         } else {
> > > > > > >
> > > > > > >                 event.queue_id = qid; /* event queue linked to adapter
> > port */
> > > > > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > index 0e622152c..1b156edab 100644
> > > > > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows *ws,
> > > > uint8_t
> > > > > > queue_id,
> > > > > > >                 ssows_handle_event_t fn, void *arg);
> > > > > > >  void ssows_reset(struct ssows *ws);
> > > > > > >  uint16_t sso_event_tx_adapter_enqueue(void *port,
> > > > > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t
> > eq_flags);
> > > > > > >  int ssovf_info(struct ssovf_info *info);
> > > > > > >  void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
> > > > > > >  int test_eventdev_octeontx(void);
> > > > > > > diff --git a/drivers/event/octeontx/ssovf_worker.c
> > > > > > b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > index d940b5dd6..1d0467af3 100644
> > > > > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > > > > >
> > > > > > >  uint16_t
> > > > > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t eq_flags)
> > > > > > >  {
> > > > > > >         uint16_t port_id;
> > > > > > >         uint16_t queue_id;
> > > > > > > @@ -275,6 +275,7 @@ sso_event_tx_adapter_enqueue(void *port,
> > > > > > >         octeontx_dq_t *dq;
> > > > > > >
> > > > > > >         RTE_SET_USED(nb_events);
> > > > > > > +       RTE_SET_USED(eq_flags);
> > > > > > >         switch (ev->sched_type) {
> > > > > > >         case SSO_SYNC_ORDERED:
> > > > > > >                 ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> > > > > > > diff --git a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > index 5cd80e3b2..74b749a15 100644
> > > > > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > @@ -333,16 +333,20 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > >
> > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct
> > > > rte_event
> > > > > > ev[],\
> > > > > > > -                                          uint16_t nb_events);              \
> > > > > > > +                                          uint16_t nb_events,               \
> > > > > > > +                                          uint8_t eq_flags);                \
> > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,
> > > > \
> > > > > > >                                                struct rte_event ev[],        \
> > > > > > > -                                              uint16_t nb_events);          \
> > > > > > > +                                              uint16_t nb_events,           \
> > > > > > > +                                              uint8_t eq_flags);            \
> > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> > > > \
> > > > > > >                                                 struct rte_event ev[],       \
> > > > > > > -                                               uint16_t nb_events);         \
> > > > > > > +                                               uint16_t nb_events,          \
> > > > > > > +                                               uint8_t eq_flags);           \
> > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> > *port,
> > > > > > \
> > > > > > >                                                     struct rte_event ev[],   \
> > > > > > > -                                                   uint16_t nb_events);     \
> > > > > > > +                                                   uint16_t nb_events,      \
> > > > > > > +                                                   uint8_t eq_flags);       \
> > > > > > >
> > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > >  #undef T
> > > > > > > diff --git a/drivers/event/octeontx2/otx2_worker.c
> > > > > > b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > index cd14cd3d2..100e21669 100644
> > > > > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void *port,
> > > > const
> > > > > > struct rte_event ev[],
> > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > >  uint16_t __hot                                                         \
> > > > > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event
> > > > ev[],   \
> > > > > > > -                                 uint16_t nb_events)                   \
> > > > > > > +                                 uint16_t nb_events,                   \
> > > > > > > +                                 uint8_t eq_flags)                     \
> > > > > > >  {                                                                      \
> > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > >                                                                         \
> > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
> > > > > > >  }
> > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > @@ -284,12 +286,14 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > >  uint16_t __hot                                                         \
> > > > > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct
> > > > rte_event ev[],\
> > > > > > > -                                     uint16_t nb_events)               \
> > > > > > > +                                     uint16_t nb_events,               \
> > > > > > > +                                     uint8_t eq_flags)                 \
> > > > > > >  {                                                                      \
> > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > > > > > >                                                                         \
> > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
> > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > >  }
> > > > > > > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > index 37c274a54..c3e48da42 100644
> > > > > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > >  uint16_t __hot                                                         \
> > > > > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,                     \
> > > > > > >                                        struct rte_event ev[],           \
> > > > > > > -                                      uint16_t nb_events)              \
> > > > > > > +                                      uint16_t nb_events,              \
> > > > > > > +                                      uint8_t eq_flags)                \
> > > > > > >  {                                                                      \
> > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ##
> > > > name(void *port,
> > > > > > \
> > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > >                                                                         \
> > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
> > > > > > >  }
> > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > @@ -327,7 +329,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > >  uint16_t __hot                                                         \
> > > > > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> > \
> > > > > > >                                            struct rte_event ev[],       \
> > > > > > > -                                          uint16_t nb_events)          \
> > > > > > > +                                          uint16_t nb_events,          \
> > > > > > > +                                          uint8_t eq_flags)            \
> > > > > > >  {                                                                      \
> > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_ ##
> > > > name(void
> > > > > > *port,                      \
> > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];                 \
> > > > > > >                                                                         \
> > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
> > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > >  }
> > > > > > > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > index c848261c4..98be77568 100644
> > > > > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct
> > > > rte_mbuf
> > > > > > *pkt)
> > > > > > >  int
> > > > > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t
> > > > > > *event_port_id);
> > > > > > >
> > > > > > > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > 0x1
> > > > > > > +/**< This flag is used when all the packets enqueued in the tx
> > adapter
> > > > are
> > > > > > > + * destined for the same Ethernet device, queue pair.
> > > > > > > + */
> > > > > > > +
> > > > > > >  /**
> > > > > > >   * Enqueue a burst of events objects or an event object supplied in
> > > > > > *rte_event*
> > > > > > >   * structure on an  event device designated by its *dev_id* through
> > > > the event
> > > > > > > @@ -324,6 +329,10 @@
> > > > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > > > > id, uint8_t *event_port_id);
> > > > > > >   *  The number of event objects to enqueue, typically number of
> > > > > > >   *
> > rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > > > > >   *  available for this port.
> > > > > > > + * @param flags
> > > > > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > > > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > signifies
> > > > that all
> > > > > > the packets
> > > > > > > + *  which are enqueued are destined for the same Ethernet device,
> > > > queue pair.
> > > > > > >   *
> > > > > > >   * @return
> > > > > > >   *   The number of event objects actually enqueued on the event
> > > > device. The
> > > > > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > > > > >  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > > > > >                                 uint8_t port_id,
> > > > > > >                                 struct rte_event ev[],
> > > > > > > -                               uint16_t nb_events)
> > > > > > > +                               uint16_t nb_events,
> > > > > > > +                               uint8_t flags)
> > > > > > >  {
> > > > > > >         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> > > > > > >
> > > > > > > @@ -359,7 +369,8 @@
> > rte_event_eth_tx_adapter_enqueue(uint8_t
> > > > dev_id,
> > > > > > >                 return 0;
> > > > > > >         }
> > > > > > >  #endif
> > > > > > > -       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > nb_events);
> > > > > > > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > > > +                               nb_events, flags);
> > > > > > >  }
> > > > > > >
> > > > > > >  /**
> > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > > > > b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > index f44c869cb..3bf9d7115 100644
> > > > > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > @@ -1324,7 +1324,8 @@
> > rte_eventdev_find_free_device_index(void)
> > > > > > >  static uint16_t
> > > > > > >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> > > > > > >                         __rte_unused struct rte_event ev[],
> > > > > > > -                       __rte_unused uint16_t nb_events)
> > > > > > > +                       __rte_unused uint16_t nb_events,
> > > > > > > +                       __rte_unused uint8_t flags)
> > > > > > >  {
> > > > > > >         rte_errno = ENOTSUP;
> > > > > > >         return 0;
> > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > > > > b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > index 5044a13d0..2a5643da3 100644
> > > > > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> > > > (*event_dequeue_burst_t)(void
> > > > > > *port, struct rte_event ev[],
> > > > > > >  /**< @internal Dequeue burst of events from port of a device */
> > > > > > >
> > > > > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > > > > > > -                               struct rte_event ev[], uint16_t nb_events);
> > > > > > > +               struct rte_event ev[], uint16_t nb_events, uint8_t flags);
> > > > > > >  /**< @internal Enqueue burst of events on port of a device */
> > > > > > >
> > > > > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > > > > --
> > > > > > > 2.17.1
> > > > > > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-01 15:35             ` Jerin Jacob
@ 2019-10-02  3:08               ` Hemant Agrawal
  2019-10-02  7:54                 ` Jerin Jacob
  0 siblings, 1 reply; 30+ messages in thread
From: Hemant Agrawal @ 2019-10-02  3:08 UTC (permalink / raw)
  To: Jerin Jacob, Nipun Gupta
  Cc: Jerin Jacob, dpdk-dev, Pavan Nikhilesh, Sunil Kumar Kori,
	Richardson, Bruce, Marko Kovacevic, Ori Kam, Radu Nicolau,
	Tomasz Kantecki, Van Haaren, Harry, nikhil.rao

Hi Jerin,
> On Tue, Oct 1, 2019 at 8:36 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Tuesday, October 1, 2019 7:50 PM
> > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > Cc: Jerin Jacob <jerinj@marvell.com>; dpdk-dev <dev@dpdk.org>; Pavan
> > > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > > <skori@marvell.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> > > Richardson, Bruce <bruce.richardson@intel.com>; Marko Kovacevic
> > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Radu
> > > Nicolau <radu.nicolau@intel.com>; Tomasz Kantecki
> > > <tomasz.kantecki@intel.com>; Van Haaren, Harry
> > > <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> > > destined packets enqueue
> > >
> > > On Tue, Oct 1, 2019 at 7:32 PM Nipun Gupta <nipun.gupta@nxp.com>
> wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > Sent: Tuesday, October 1, 2019 6:40 PM
> > > > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob <jerinj@marvell.com>;
> > > > > Pavan Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > > > > <skori@marvell.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>;
> > > > > Richardson, Bruce <bruce.richardson@intel.com>; Marko Kovacevic
> > > > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>;
> Radu
> > > > > Nicolau <radu.nicolau@intel.com>; Tomasz Kantecki
> > > > > <tomasz.kantecki@intel.com>; Van Haaren, Harry
> > > > > <harry.van.haaren@intel.com>; nikhil.rao@intel.com
> > > > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> > > destined
> > > > > packets enqueue
> > > > >
> > > > > On Tue, Oct 1, 2019 at 5:11 PM Nipun Gupta <nipun.gupta@nxp.com>
> > > wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > Sent: Tuesday, October 1, 2019 1:14 PM
> > > > > > > To: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > > Cc: dpdk-dev <dev@dpdk.org>; Jerin Jacob
> > > > > > > <jerinj@marvell.com>;
> > > Pavan
> > > > > > > Nikhilesh <pbhagavatula@marvell.com>; Sunil Kumar Kori
> > > > > <skori@marvell.com>;
> > > > > > > Hemant Agrawal <hemant.agrawal@nxp.com>; Richardson, Bruce
> > > > > > > <bruce.richardson@intel.com>; Marko Kovacevic
> > > > > > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>;
> > > Radu
> > > > > Nicolau
> > > > > > > <radu.nicolau@intel.com>; Tomasz Kantecki
> > > > > <tomasz.kantecki@intel.com>; Van
> > > > > > > Haaren, Harry <harry.van.haaren@intel.com>;
> > > > > > > nikhil.rao@intel.com
> > > > > > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify
> > > > > > > same
> > > > > destined
> > > > > > > packets enqueue
> > > > > > >
> > > > > > > On Tue, Oct 1, 2019 at 12:32 PM Nipun Gupta
> > > > > > > <nipun.gupta@nxp.com>
> > > > > wrote:
> > > > > > > >
> > > > > > > > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > > > > > > > Some drivers may support burst functionality only with the
> > > > > > > > packets having same destination device and queue.
> > > > > > > >
> > > > > > > > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST`
> > > can
> > > > > be used
> > > > > > > > to indicate this so the underlying driver, for drivers to
> > > > > > > > utilize burst functionality appropriately.
> > > > > > >
> > > > > > > I understand the cost of aggregating packets based on port
> > > > > > > and
> > > queue
> > > > > > > to make it burst.
> > > > > > > But, Could you share the use case where how do you want to
> > > > > > > use this flag? I see two possibilities in eventdev context.
> > > > > > > (Where dequeue can be from any ethdev port)
> > > > > > > a) The application does the aggregation. If so, what would
> > > > > > > the difference be in doing driver or application?
> > > > > > > b) We may use this flag when the system has only one port
> > > > > > > and one
> > > > > queue.
> > > > > > >
> > > > > > > Could you share how do you want to use this flag?
> > > > > >
> > > > > > I would say both the cases you mentioned. I prefer this to
> > > > > > depend on
> > > the
> > > > > smartness of
> > > > > > the application, as it is aware of the number of eth
> > > > > > devices/queues it is
> > > > > using.
> > > > > > This is the reason to avoid in the driver.
> > > > > >
> > > > > > A user can also use separate event ports for separate or a
> > > > > > group of
> > > > > Ethernet
> > > > > > devices/queues, to create easy segregation.
> > > > >
> > > > > If it is specific to _very_ static configuration, you can assume
> > > > > all the events comes from a specific eventdev port, comes only
> > > > > from a specific ethdev port.
> > > >
> > > > Hi Jerin,
> > > >
> > > > If I understand correctly this assumption would be made in the driver?
> > > > But then applications like l2fwd-event will break.
> > >
> > > Yes. What I meant is a specific static configuration only this scheme can
> use.
> > >
> > >
> > > >
> > > > >
> > > > > >
> > > > > > Also the drawback of implementing in the driver, can be that
> > > > > > when the
> > > > > events to
> > > > > > Separate devices and queues are so mixed up, that segregation
> > > > > > does
> > > not
> > > > > make
> > > > > > sense, it shall be overhead for the driver to scan all the events.
> > > > >
> > > > > In the worst case, both, applications need to scan and driver
> > > > > need to iterate over all the events.
> > > >
> > > > Agree, this is what we want to avoid.
> > > >
> > > > >
> > > > >
> > > > > In generic l2fwd-eventdev applications etc, q0 will be connected
> > > > > p0 and
> > > p1
> > > > > etc.
> > > > > This flag will be zero.
> > > >
> > > > Okay.
> > > >
> > > > >
> > > > > But, If you think, there is a specific use case for it we can add this flag.
> > > > >
> > > > >
> > > > > >
> > > > > > A flag would help in providing the decision flexibility to the
> applications.
> > > > > >
> > > > > > >
> > > > > > > And another point is, tx adapter is NOT experimental now, We
> > > > > > > need depreciation notice for ABI change.
> > > > > > > If you share the exact use case, then we could think of
> > > > > > > adding a new symbol instead of breaking ABI and add it for
> > > > > > > next release.
> > > > > >
> > > > > > I have heard the discussion that we may get some exceptions to
> > > > > deprecation
> > > > > > process for 19.11 as the APIs will freeze of 1 year post it.
> > > > > > Anyway, if you have a better way with symbol, please suggest.
> > > > >
> > > > >
> > > > > One option could be (not as bad as changing the enqueue
> > > > > prototype) to add new field in struct rte_event_eth_tx_adapter_conf.
> > > > >
> > > > > Since this scheme can be used ONLY on the static configuration,
> > > > > adding a few fields for Tx adapter configuration would help.
> > > > > If that field is set you can choose dev->txa_enqueue light
> > > > > weight enqueue function if not, the driver can aggregate the
> > > > > buffers and send them.
> > > >
> > > > Thanks for suggesting this, we also thought of it, but would
> > > > prefer having
> > > this as a
> > > > runtime option rather than static option.
> > > > We would not like to have one time configuration restriction.
> > >
> > > Not sure how it can be used in runtime. If q0 is connected p0 and p1
> > > and then it flag has to be cleared. if q0 is only connected to p0
> > > then we can use this scheme.
> > > So it is pretty much static in nature.
> > >
> > > How do you think, it can be used in runtime.
> > >
> > > If we think, If we are planning to use like below in application, it
> > > would be really bad in the worst case.(mbuf cache misses in-app and
> > > driver)
> > >
> > > In app:
> > > const port = event[0].mbuf.port;
> > > const queue = event[0].mbuf.queue;
> > > for (i = i; i < nb_events; i++) {
> > >           if (port != event[i].mbuf.port || queue != event[i].mbuf.queue)
> > >                    break;
> > > }
> > > if (i == nb_events)
> > >          flag = 1;
> > > else
> > >         flag = 0;
> > >
> >
> > In such case if cache misses are observed which is more than what
> > sending burst of traffic is in the applications use-case, the application shall
> simply not use the flag.
> >
> > But again I think this is to be governed by the application which is
> > the user of the event device, on the basis on the configuration and
> > the memory footprint/utilization; and more than that its performance
> benchmarking.
> >
> > > more over the static scheme does not make any change in other drivers.
> > > If you have the usecase for the dynamic scheme then let us know then
> > > we add dynamic flag breaking the ABI.
> >
> > I understand your concern that this shall not be valid on a general cases.
> >
> > There are certain use-case (NXP internal) of DPDK event which have
> > separate event ports/cores dedicated for certain tasks - and can use
> > the burst functionality for performance according to the event ports
> > which are used. Not having this at runtime will limit the flexibility for such
> applications.
> 
> If it is specific to NXP internal use case then no more comments on dynamic
> vs static.
> 
> @ Nikhil Rao any comments.
> 
> One option could be to incorporate NXP internal use case will be introducing
> a new API, parallel to rte_event_eth_tx_adapter_enqueue as
> rte_event_eth_tx_adapter_enqueue_same_dest()
> or something.
> 
> Two advantage:
> # Not a major ABI breakage. Only need to add new fast-path function in
> rte_eventdev.
> # Even though we add 'zero' in API all the time, the Compiler prologue needs
> to push to stack or move the value to argument register as there is function
> pointer indirection. so new API will have zero performance impact for normal
> cases.
> 
> Not sure about minor ABI breakage in rte_eventdev(adding a new fastpath
> function). If everyone is OK as the exception for 19.11 then we can introduce
> a new API.

[Hemant] There are already too many APIs and mode in eventdev. My suggestion is to minimize the new APIs. Else writing generic applications will be really difficult and it will not be easy to adapt by the application developers. 
In this particular case, it is better for NXP to go with direct eth enque mode rather than TX adapter. Note that crypto adapter already provide that mode.  However we are trying to adjust so that applications do not become complex. 

In the existing code also we have two modes in the application to send the packets out - one is 'rte_event_enqueue_burst' and other is 'rte_event_eth_tx_adapter_enqueue'.
It is still cumbersome for the application to maintain separate modes. This increases when crypto/timer is also being used in event mode.

Why do we not used the 'rte_event->event_type' for TX as well, and 'rte_event_enqueue_burst', API to internally (in respective event driver) send the packet to the respective eth/crypto/timer Tx function? It makes more sense to have a common framework to send packets, rather than having multiple API's?


> 
> 
> 
> >
> > Regards,
> > Nipun
> >
> > >
> > >
> > > >
> > > > >
> > > > >
> > > > >
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > > > ---
> > > > > > > >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> > > > > > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > > > > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > > > > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > > > > > >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> > > > > > > >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> > > > > > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> > > > > > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> > > > > +++++++++++++--
> > > > > > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > > > > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > > > > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > > > > > >
> > > > > > > > diff --git a/app/test-eventdev/test_pipeline_common.h
> > > b/app/test-
> > > > > > > eventdev/test_pipeline_common.h
> > > > > > > > index 0440b9e29..6e73c6ab2 100644
> > > > > > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > > > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > > > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev,
> > > > > > > > const
> > > > > uint8_t
> > > > > > > port,
> > > > > > > >                 struct rte_event * const ev)  {
> > > > > > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > > > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> 1))
> > > > > > > > +       while (!rte_event_eth_tx_adapter_enqueue(dev,
> > > > > > > > + port, ev, 1,
> > > 0))
> > > > > > > >                 rte_pause();  }
> > > > > > > >
> > > > > > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const
> > > > > > > > uint8_t
> > > dev,
> > > > > const
> > > > > > > uint8_t port,
> > > > > > > >  {
> > > > > > > >         uint16_t enq;
> > > > > > > >
> > > > > > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> > > nb_rx);
> > > > > > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > > > > > + ev,
> > > nb_rx,
> > > > > 0);
> > > > > > > >         while (enq < nb_rx) {
> > > > > > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > > > > > -                               ev + enq, nb_rx - enq);
> > > > > > > > +                               ev + enq, nb_rx - enq, 0);
> > > > > > > >         }
> > > > > > > >  }
> > > > > > > >
> > > > > > > > diff --git
> > > > > > > > a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > index 192f9e1cf..a8c13e136 100644
> > > > > > > > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > @@ -137,11 +137,12 @@ should use the
> > > > > ``rte_event_enqueue_burst()``
> > > > > > > function.
> > > > > > > >         if (cap &
> > > > > > > > RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> > > {
> > > > > > > >
> > > > > > > >                 event.mbuf = m;
> > > > > > > > +               eq_flags = 0;
> > > > > > > >
> > > > > > > >                 m->port = tx_port;
> > > > > > > >                 rte_event_eth_tx_adapter_txq_set(m,
> > > > > > > > tx_queue_id);
> > > > > > > >
> > > > > > > > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> > > &event,
> > > > > 1);
> > > > > > > > +               rte_event_eth_tx_adapter_enqueue(dev_id,
> > > > > > > > + ev_port,
> > > > > &event, 1,
> > > > > > > eq_flags);
> > > > > > > >         } else {
> > > > > > > >
> > > > > > > >                 event.queue_id = qid; /* event queue
> > > > > > > > linked to adapter
> > > port */
> > > > > > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > index 0e622152c..1b156edab 100644
> > > > > > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows
> > > > > > > > *ws,
> > > > > uint8_t
> > > > > > > queue_id,
> > > > > > > >                 ssows_handle_event_t fn, void *arg);  void
> > > > > > > > ssows_reset(struct ssows *ws);  uint16_t
> > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > > > > > +               struct rte_event ev[], uint16_t nb_events,
> > > > > > > > + uint8_t
> > > eq_flags);
> > > > > > > >  int ssovf_info(struct ssovf_info *info);  void
> > > > > > > > *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);  int
> > > > > > > > test_eventdev_octeontx(void); diff --git
> > > > > > > > a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > index d940b5dd6..1d0467af3 100644
> > > > > > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > > > > > >
> > > > > > > >  uint16_t
> > > > > > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > > > > > +               struct rte_event ev[], uint16_t nb_events,
> > > > > > > > + uint8_t eq_flags)
> > > > > > > >  {
> > > > > > > >         uint16_t port_id;
> > > > > > > >         uint16_t queue_id; @@ -275,6 +275,7 @@
> > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > >         octeontx_dq_t *dq;
> > > > > > > >
> > > > > > > >         RTE_SET_USED(nb_events);
> > > > > > > > +       RTE_SET_USED(eq_flags);
> > > > > > > >         switch (ev->sched_type) {
> > > > > > > >         case SSO_SYNC_ORDERED:
> > > > > > > >                 ssows_swtag_norm(ws, ev->event,
> > > > > > > > SSO_SYNC_ATOMIC); diff --git
> > > > > > > > a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > index 5cd80e3b2..74b749a15 100644
> > > > > > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > @@ -333,16 +333,20 @@
> SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > >
> > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port,
> > > > > > > > struct
> > > > > rte_event
> > > > > > > ev[],\
> > > > > > > > -                                          uint16_t nb_events);              \
> > > > > > > > +                                          uint16_t nb_events,               \
> > > > > > > > +                                          uint8_t eq_flags);                \
> > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void
> > > > > > > > *port,
> > > > > \
> > > > > > > >                                                struct rte_event ev[],        \
> > > > > > > > -                                              uint16_t nb_events);          \
> > > > > > > > +                                              uint16_t nb_events,           \
> > > > > > > > +                                              uint8_t eq_flags);            \
> > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void
> > > > > > > > *port,
> > > > > \
> > > > > > > >                                                 struct rte_event ev[],       \
> > > > > > > > -                                               uint16_t nb_events);         \
> > > > > > > > +                                               uint16_t nb_events,          \
> > > > > > > > +                                               uint8_t eq_flags);           \
> > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> > > *port,
> > > > > > > \
> > > > > > > >                                                     struct rte_event ev[],   \
> > > > > > > > -                                                   uint16_t nb_events);     \
> > > > > > > > +                                                   uint16_t nb_events,      \
> > > > > > > > +                                                   uint8_t eq_flags);       \
> > > > > > > >
> > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC  #undef T diff --git
> > > > > > > > a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > index cd14cd3d2..100e21669 100644
> > > > > > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void
> > > > > > > > *port,
> > > > > const
> > > > > > > struct rte_event ev[],
> > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > >  uint16_t __hot                                                         \
> > > > > > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct
> > > > > > > > rte_event
> > > > > ev[],   \
> > > > > > > > -                                 uint16_t nb_events)                   \
> > > > > > > > +                                 uint16_t nb_events,                   \
> > > > > > > > +                                 uint8_t eq_flags)                     \
> > > > > > > >  {                                                                      \
> > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > >                                                                         \
> > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
> > > > > > > >  }
> > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -284,12 +286,14
> @@
> > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > >  uint16_t __hot                                                         \
> > > > > > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct
> > > > > rte_event ev[],\
> > > > > > > > -                                     uint16_t nb_events)               \
> > > > > > > > +                                     uint16_t nb_events,               \
> > > > > > > > +                                     uint8_t eq_flags)                 \
> > > > > > > >  {                                                                      \
> > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];
> \
> > > > > > > >                                                                         \
> > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
> > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > >  }
> > > > > > > > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > index 37c274a54..c3e48da42 100644
> > > > > > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > >  uint16_t __hot                                                         \
> > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> \
> > > > > > > >                                        struct rte_event ev[],           \
> > > > > > > > -                                      uint16_t nb_events)              \
> > > > > > > > +                                      uint16_t nb_events,              \
> > > > > > > > +                                      uint8_t eq_flags)                \
> > > > > > > >  {                                                                      \
> > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ##
> > > > > name(void *port,
> > > > > > > \
> > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > >                                                                         \
> > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
> > > > > > > >  }
> > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -327,7 +329,8 @@
> > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > >  uint16_t __hot                                                         \
> > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> > > \
> > > > > > > >                                            struct rte_event ev[],       \
> > > > > > > > -                                          uint16_t nb_events)          \
> > > > > > > > +                                          uint16_t nb_events,          \
> > > > > > > > +                                          uint8_t eq_flags)            \
> > > > > > > >  {                                                                      \
> > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_
> ##
> > > > > name(void
> > > > > > > *port,                      \
> > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];
> \
> > > > > > > >                                                                         \
> > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
> > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > >  }
> > > > > > > > diff --git
> > > > > > > > a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > index c848261c4..98be77568 100644
> > > > > > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > @@ -300,6 +300,11 @@
> > > > > > > > rte_event_eth_tx_adapter_txq_get(struct
> > > > > rte_mbuf
> > > > > > > *pkt)
> > > > > > > >  int
> > > > > > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id,
> > > > > > > > uint8_t
> > > > > > > *event_port_id);
> > > > > > > >
> > > > > > > > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > 0x1
> > > > > > > > +/**< This flag is used when all the packets enqueued in
> > > > > > > > +the tx
> > > adapter
> > > > > are
> > > > > > > > + * destined for the same Ethernet device, queue pair.
> > > > > > > > + */
> > > > > > > > +
> > > > > > > >  /**
> > > > > > > >   * Enqueue a burst of events objects or an event object
> > > > > > > > supplied in
> > > > > > > *rte_event*
> > > > > > > >   * structure on an  event device designated by its
> > > > > > > > *dev_id* through
> > > > > the event
> > > > > > > > @@ -324,6 +329,10 @@
> > > > > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > > > > > id, uint8_t *event_port_id);
> > > > > > > >   *  The number of event objects to enqueue, typically number of
> > > > > > > >   *
> > > rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > > > > > >   *  available for this port.
> > > > > > > > + * @param flags
> > > > > > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > > > > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > signifies
> > > > > that all
> > > > > > > the packets
> > > > > > > > + *  which are enqueued are destined for the same Ethernet
> > > > > > > > + device,
> > > > > queue pair.
> > > > > > > >   *
> > > > > > > >   * @return
> > > > > > > >   *   The number of event objects actually enqueued on the event
> > > > > device. The
> > > > > > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > > > > > > rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > > > > > >                                 uint8_t port_id,
> > > > > > > >                                 struct rte_event ev[],
> > > > > > > > -                               uint16_t nb_events)
> > > > > > > > +                               uint16_t nb_events,
> > > > > > > > +                               uint8_t flags)
> > > > > > > >  {
> > > > > > > >         const struct rte_eventdev *dev =
> > > > > > > > &rte_eventdevs[dev_id];
> > > > > > > >
> > > > > > > > @@ -359,7 +369,8 @@
> > > rte_event_eth_tx_adapter_enqueue(uint8_t
> > > > > dev_id,
> > > > > > > >                 return 0;
> > > > > > > >         }
> > > > > > > >  #endif
> > > > > > > > -       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > nb_events);
> > > > > > > > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > > > > +                               nb_events, flags);
> > > > > > > >  }
> > > > > > > >
> > > > > > > >  /**
> > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > index f44c869cb..3bf9d7115 100644
> > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > @@ -1324,7 +1324,8 @@
> > > rte_eventdev_find_free_device_index(void)
> > > > > > > >  static uint16_t
> > > > > > > >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> > > > > > > >                         __rte_unused struct rte_event ev[],
> > > > > > > > -                       __rte_unused uint16_t nb_events)
> > > > > > > > +                       __rte_unused uint16_t nb_events,
> > > > > > > > +                       __rte_unused uint8_t flags)
> > > > > > > >  {
> > > > > > > >         rte_errno = ENOTSUP;
> > > > > > > >         return 0;
> > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > index 5044a13d0..2a5643da3 100644
> > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> > > > > (*event_dequeue_burst_t)(void
> > > > > > > *port, struct rte_event ev[],
> > > > > > > >  /**< @internal Dequeue burst of events from port of a
> > > > > > > > device */
> > > > > > > >
> > > > > > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > > > > > > > -                               struct rte_event ev[], uint16_t nb_events);
> > > > > > > > +               struct rte_event ev[], uint16_t nb_events,
> > > > > > > > + uint8_t flags);
> > > > > > > >  /**< @internal Enqueue burst of events on port of a
> > > > > > > > device */
> > > > > > > >
> > > > > > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > > > > > --
> > > > > > > > 2.17.1
> > > > > > > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-02  3:08               ` Hemant Agrawal
@ 2019-10-02  7:54                 ` Jerin Jacob
  2019-10-03  6:12                   ` Rao, Nikhil
  0 siblings, 1 reply; 30+ messages in thread
From: Jerin Jacob @ 2019-10-02  7:54 UTC (permalink / raw)
  To: Hemant Agrawal
  Cc: Nipun Gupta, Jerin Jacob, dpdk-dev, Pavan Nikhilesh,
	Sunil Kumar Kori, Richardson, Bruce, Marko Kovacevic, Ori Kam,
	Radu Nicolau, Tomasz Kantecki, Van Haaren, Harry, nikhil.rao

On Wed, Oct 2, 2019 at 8:38 AM Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>
> Hi Jerin,

Hi Hemant,


> > > I understand your concern that this shall not be valid on a general cases.
> > >
> > > There are certain use-case (NXP internal) of DPDK event which have
> > > separate event ports/cores dedicated for certain tasks - and can use
> > > the burst functionality for performance according to the event ports
> > > which are used. Not having this at runtime will limit the flexibility for such
> > applications.
> >
> > If it is specific to NXP internal use case then no more comments on dynamic
> > vs static.
> >
> > @ Nikhil Rao any comments.
> >
> > One option could be to incorporate NXP internal use case will be introducing
> > a new API, parallel to rte_event_eth_tx_adapter_enqueue as
> > rte_event_eth_tx_adapter_enqueue_same_dest()
> > or something.
> >
> > Two advantage:
> > # Not a major ABI breakage. Only need to add new fast-path function in
> > rte_eventdev.
> > # Even though we add 'zero' in API all the time, the Compiler prologue needs
> > to push to stack or move the value to argument register as there is function
> > pointer indirection. so new API will have zero performance impact for normal
> > cases.
> >
> > Not sure about minor ABI breakage in rte_eventdev(adding a new fastpath
> > function). If everyone is OK as the exception for 19.11 then we can introduce
> > a new API.
>
> [Hemant] There are already too many APIs and mode in eventdev. My suggestion is to minimize the new APIs. Else writing generic applications will be really difficult and it will not be easy to adapt by the application developers.
> In this particular case, it is better for NXP to go with direct eth enque mode rather than TX adapter. Note that crypto adapter already provide that mode.  However we are trying to adjust so that applications do not become complex.

Why? If you think direct queue model as use case if you might as well
write "ethdev" driver and internally use atomic schedule type.


> In the existing code also we have two modes in the application to send the packets out - one is 'rte_event_enqueue_burst' and other is 'rte_event_eth_tx_adapter_enqueue'.
> It is still cumbersome for the application to maintain separate modes. This increases when crypto/timer is also being used in event mode.

I think, we have two things here
a) specialized API for specific work like
rte_event_enqueue_new_burst() or rte_event_enqueue_forward_burst() vs
generic rte_event_enqueue_burst().
I think, that does not NOT any harm as the application can use
optimized routine if required(no separate code path case)

b) different code path
I agree, this is something I don't like and we would like to avoid.
But this specific case, We took the comprise to avoid any performance
impact for SW or HW model.
It is a public discussion and it is here

http://patches.dpdk.org/patch/40426/

>
> Why do we not used the 'rte_event->event_type' for TX as well, and 'rte_event_enqueue_burst', API to internally (in respective event driver) send the packet to the respective eth/crypto/timer Tx function? It makes more sense to have a common framework to send packets, rather than having multiple API's?

If we make rte_event_enqueue_burst() to send the packet then:
- HW eventdev driver + External PCI network card use case won't work
as you are overriding event driver enqueue which has no clue on the
external PCI network card vs integrated network controller.
- Additional switch cases rte_event_enqueue_burst() in generic
function aka performance impact.
- There are multiple SW eventdev drivers, whose generic enqueue()
function can not be changed to handle Tx adapter enqueue + add new
switch case
- Both SW and HW can use rte_event_eth_tx_adapter_enqueue() to send
the packet to have unified fast path. i.e The callback can be attached
to SW tx adapter or HW routine to send the packet.
But I am not able to recollect, Why Nikhil would like to use the
separate functions. Nikhil could you remind us why
rte_event_eth_tx_adapter_enqueue() can not be used for sending the
packet for SW Tx adapter.

Nothing is set and stone. We can always improve the API if required.


>
>
> >
> >
> >
> > >
> > > Regards,
> > > Nipun
> > >
> > > >
> > > >
> > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > > > > ---
> > > > > > > > >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> > > > > > > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > > > > > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > > > > > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > > > > > > >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++----
> > > > > > > > >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> > > > > > > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> > > > > > > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> > > > > > +++++++++++++--
> > > > > > > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > > > > > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > > > > > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > > > > > > >
> > > > > > > > > diff --git a/app/test-eventdev/test_pipeline_common.h
> > > > b/app/test-
> > > > > > > > eventdev/test_pipeline_common.h
> > > > > > > > > index 0440b9e29..6e73c6ab2 100644
> > > > > > > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > > > > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > > > > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev,
> > > > > > > > > const
> > > > > > uint8_t
> > > > > > > > port,
> > > > > > > > >                 struct rte_event * const ev)  {
> > > > > > > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > > > > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> > 1))
> > > > > > > > > +       while (!rte_event_eth_tx_adapter_enqueue(dev,
> > > > > > > > > + port, ev, 1,
> > > > 0))
> > > > > > > > >                 rte_pause();  }
> > > > > > > > >
> > > > > > > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const
> > > > > > > > > uint8_t
> > > > dev,
> > > > > > const
> > > > > > > > uint8_t port,
> > > > > > > > >  {
> > > > > > > > >         uint16_t enq;
> > > > > > > > >
> > > > > > > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> > > > nb_rx);
> > > > > > > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > > > > > > + ev,
> > > > nb_rx,
> > > > > > 0);
> > > > > > > > >         while (enq < nb_rx) {
> > > > > > > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > > > > > > -                               ev + enq, nb_rx - enq);
> > > > > > > > > +                               ev + enq, nb_rx - enq, 0);
> > > > > > > > >         }
> > > > > > > > >  }
> > > > > > > > >
> > > > > > > > > diff --git
> > > > > > > > > a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > > index 192f9e1cf..a8c13e136 100644
> > > > > > > > > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > > @@ -137,11 +137,12 @@ should use the
> > > > > > ``rte_event_enqueue_burst()``
> > > > > > > > function.
> > > > > > > > >         if (cap &
> > > > > > > > > RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> > > > {
> > > > > > > > >
> > > > > > > > >                 event.mbuf = m;
> > > > > > > > > +               eq_flags = 0;
> > > > > > > > >
> > > > > > > > >                 m->port = tx_port;
> > > > > > > > >                 rte_event_eth_tx_adapter_txq_set(m,
> > > > > > > > > tx_queue_id);
> > > > > > > > >
> > > > > > > > > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> > > > &event,
> > > > > > 1);
> > > > > > > > > +               rte_event_eth_tx_adapter_enqueue(dev_id,
> > > > > > > > > + ev_port,
> > > > > > &event, 1,
> > > > > > > > eq_flags);
> > > > > > > > >         } else {
> > > > > > > > >
> > > > > > > > >                 event.queue_id = qid; /* event queue
> > > > > > > > > linked to adapter
> > > > port */
> > > > > > > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > index 0e622152c..1b156edab 100644
> > > > > > > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct ssows
> > > > > > > > > *ws,
> > > > > > uint8_t
> > > > > > > > queue_id,
> > > > > > > > >                 ssows_handle_event_t fn, void *arg);  void
> > > > > > > > > ssows_reset(struct ssows *ws);  uint16_t
> > > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > > > > > > +               struct rte_event ev[], uint16_t nb_events,
> > > > > > > > > + uint8_t
> > > > eq_flags);
> > > > > > > > >  int ssovf_info(struct ssovf_info *info);  void
> > > > > > > > > *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);  int
> > > > > > > > > test_eventdev_octeontx(void); diff --git
> > > > > > > > > a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > index d940b5dd6..1d0467af3 100644
> > > > > > > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > > > > > > >
> > > > > > > > >  uint16_t
> > > > > > > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > > > > > > +               struct rte_event ev[], uint16_t nb_events,
> > > > > > > > > + uint8_t eq_flags)
> > > > > > > > >  {
> > > > > > > > >         uint16_t port_id;
> > > > > > > > >         uint16_t queue_id; @@ -275,6 +275,7 @@
> > > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > >         octeontx_dq_t *dq;
> > > > > > > > >
> > > > > > > > >         RTE_SET_USED(nb_events);
> > > > > > > > > +       RTE_SET_USED(eq_flags);
> > > > > > > > >         switch (ev->sched_type) {
> > > > > > > > >         case SSO_SYNC_ORDERED:
> > > > > > > > >                 ssows_swtag_norm(ws, ev->event,
> > > > > > > > > SSO_SYNC_ATOMIC); diff --git
> > > > > > > > > a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > index 5cd80e3b2..74b749a15 100644
> > > > > > > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > @@ -333,16 +333,20 @@
> > SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > >
> > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port,
> > > > > > > > > struct
> > > > > > rte_event
> > > > > > > > ev[],\
> > > > > > > > > -                                          uint16_t nb_events);              \
> > > > > > > > > +                                          uint16_t nb_events,               \
> > > > > > > > > +                                          uint8_t eq_flags);                \
> > > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void
> > > > > > > > > *port,
> > > > > > \
> > > > > > > > >                                                struct rte_event ev[],        \
> > > > > > > > > -                                              uint16_t nb_events);          \
> > > > > > > > > +                                              uint16_t nb_events,           \
> > > > > > > > > +                                              uint8_t eq_flags);            \
> > > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void
> > > > > > > > > *port,
> > > > > > \
> > > > > > > > >                                                 struct rte_event ev[],       \
> > > > > > > > > -                                               uint16_t nb_events);         \
> > > > > > > > > +                                               uint16_t nb_events,          \
> > > > > > > > > +                                               uint8_t eq_flags);           \
> > > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> > > > *port,
> > > > > > > > \
> > > > > > > > >                                                     struct rte_event ev[],   \
> > > > > > > > > -                                                   uint16_t nb_events);     \
> > > > > > > > > +                                                   uint16_t nb_events,      \
> > > > > > > > > +                                                   uint8_t eq_flags);       \
> > > > > > > > >
> > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC  #undef T diff --git
> > > > > > > > > a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > index cd14cd3d2..100e21669 100644
> > > > > > > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void
> > > > > > > > > *port,
> > > > > > const
> > > > > > > > struct rte_event ev[],
> > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct
> > > > > > > > > rte_event
> > > > > > ev[],   \
> > > > > > > > > -                                 uint16_t nb_events)                   \
> > > > > > > > > +                                 uint16_t nb_events,                   \
> > > > > > > > > +                                 uint8_t eq_flags)                     \
> > > > > > > > >  {                                                                      \
> > > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > > >                                                                         \
> > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);                \
> > > > > > > > >  }
> > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -284,12 +286,14
> > @@
> > > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct
> > > > > > rte_event ev[],\
> > > > > > > > > -                                     uint16_t nb_events)               \
> > > > > > > > > +                                     uint16_t nb_events,               \
> > > > > > > > > +                                     uint8_t eq_flags)                 \
> > > > > > > > >  {                                                                      \
> > > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];
> > \
> > > > > > > > >                                                                         \
> > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |              \
> > > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > > >  }
> > > > > > > > > diff --git a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > index 37c274a54..c3e48da42 100644
> > > > > > > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > @@ -310,7 +310,8 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> > \
> > > > > > > > >                                        struct rte_event ev[],           \
> > > > > > > > > -                                      uint16_t nb_events)              \
> > > > > > > > > +                                      uint16_t nb_events,              \
> > > > > > > > > +                                      uint8_t eq_flags)                \
> > > > > > > > >  {                                                                      \
> > > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ##
> > > > > > name(void *port,
> > > > > > > > \
> > > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > > >                                                                         \
> > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);               \
> > > > > > > > >  }
> > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -327,7 +329,8 @@
> > > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port,
> > > > \
> > > > > > > > >                                            struct rte_event ev[],       \
> > > > > > > > > -                                          uint16_t nb_events)          \
> > > > > > > > > +                                          uint16_t nb_events,          \
> > > > > > > > > +                                          uint8_t eq_flags)            \
> > > > > > > > >  {                                                                      \
> > > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_
> > ##
> > > > > > name(void
> > > > > > > > *port,                      \
> > > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS - 2];
> > \
> > > > > > > > >                                                                         \
> > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |             \
> > > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > > >  }
> > > > > > > > > diff --git
> > > > > > > > > a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > index c848261c4..98be77568 100644
> > > > > > > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > @@ -300,6 +300,11 @@
> > > > > > > > > rte_event_eth_tx_adapter_txq_get(struct
> > > > > > rte_mbuf
> > > > > > > > *pkt)
> > > > > > > > >  int
> > > > > > > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id,
> > > > > > > > > uint8_t
> > > > > > > > *event_port_id);
> > > > > > > > >
> > > > > > > > > +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > > 0x1
> > > > > > > > > +/**< This flag is used when all the packets enqueued in
> > > > > > > > > +the tx
> > > > adapter
> > > > > > are
> > > > > > > > > + * destined for the same Ethernet device, queue pair.
> > > > > > > > > + */
> > > > > > > > > +
> > > > > > > > >  /**
> > > > > > > > >   * Enqueue a burst of events objects or an event object
> > > > > > > > > supplied in
> > > > > > > > *rte_event*
> > > > > > > > >   * structure on an  event device designated by its
> > > > > > > > > *dev_id* through
> > > > > > the event
> > > > > > > > > @@ -324,6 +329,10 @@
> > > > > > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > > > > > > id, uint8_t *event_port_id);
> > > > > > > > >   *  The number of event objects to enqueue, typically number of
> > > > > > > > >   *
> > > > rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > > > > > > >   *  available for this port.
> > > > > > > > > + * @param flags
> > > > > > > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > > > > > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > > signifies
> > > > > > that all
> > > > > > > > the packets
> > > > > > > > > + *  which are enqueued are destined for the same Ethernet
> > > > > > > > > + device,
> > > > > > queue pair.
> > > > > > > > >   *
> > > > > > > > >   * @return
> > > > > > > > >   *   The number of event objects actually enqueued on the event
> > > > > > device. The
> > > > > > > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > > > > > > > rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > > > > > > >                                 uint8_t port_id,
> > > > > > > > >                                 struct rte_event ev[],
> > > > > > > > > -                               uint16_t nb_events)
> > > > > > > > > +                               uint16_t nb_events,
> > > > > > > > > +                               uint8_t flags)
> > > > > > > > >  {
> > > > > > > > >         const struct rte_eventdev *dev =
> > > > > > > > > &rte_eventdevs[dev_id];
> > > > > > > > >
> > > > > > > > > @@ -359,7 +369,8 @@
> > > > rte_event_eth_tx_adapter_enqueue(uint8_t
> > > > > > dev_id,
> > > > > > > > >                 return 0;
> > > > > > > > >         }
> > > > > > > > >  #endif
> > > > > > > > > -       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > > nb_events);
> > > > > > > > > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > > > > > +                               nb_events, flags);
> > > > > > > > >  }
> > > > > > > > >
> > > > > > > > >  /**
> > > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > index f44c869cb..3bf9d7115 100644
> > > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > @@ -1324,7 +1324,8 @@
> > > > rte_eventdev_find_free_device_index(void)
> > > > > > > > >  static uint16_t
> > > > > > > > >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> > > > > > > > >                         __rte_unused struct rte_event ev[],
> > > > > > > > > -                       __rte_unused uint16_t nb_events)
> > > > > > > > > +                       __rte_unused uint16_t nb_events,
> > > > > > > > > +                       __rte_unused uint8_t flags)
> > > > > > > > >  {
> > > > > > > > >         rte_errno = ENOTSUP;
> > > > > > > > >         return 0;
> > > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > index 5044a13d0..2a5643da3 100644
> > > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> > > > > > (*event_dequeue_burst_t)(void
> > > > > > > > *port, struct rte_event ev[],
> > > > > > > > >  /**< @internal Dequeue burst of events from port of a
> > > > > > > > > device */
> > > > > > > > >
> > > > > > > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > > > > > > > > -                               struct rte_event ev[], uint16_t nb_events);
> > > > > > > > > +               struct rte_event ev[], uint16_t nb_events,
> > > > > > > > > + uint8_t flags);
> > > > > > > > >  /**< @internal Enqueue burst of events on port of a
> > > > > > > > > device */
> > > > > > > > >
> > > > > > > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > > > > > > --
> > > > > > > > > 2.17.1
> > > > > > > > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-02  7:54                 ` Jerin Jacob
@ 2019-10-03  6:12                   ` Rao, Nikhil
  2019-10-03  6:45                     ` Hemant Agrawal
  0 siblings, 1 reply; 30+ messages in thread
From: Rao, Nikhil @ 2019-10-03  6:12 UTC (permalink / raw)
  To: Jerin Jacob, Hemant Agrawal
  Cc: Nipun Gupta, Jerin Jacob, dpdk-dev, Pavan Nikhilesh,
	Sunil Kumar Kori, Richardson, Bruce, Kovacevic, Marko, Ori Kam,
	Nicolau, Radu, Kantecki, Tomasz, Van Haaren, Harry



> -----Original Message-----
> From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> Sent: Wednesday, October 2, 2019 1:24 PM
> To: Hemant Agrawal <hemant.agrawal@nxp.com>
> Cc: Nipun Gupta <nipun.gupta@nxp.com>; Jerin Jacob <jerinj@marvell.com>;
> dpdk-dev <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>;
> Sunil Kumar Kori <skori@marvell.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; Kantecki, Tomasz <tomasz.kantecki@intel.com>;
> Van Haaren, Harry <harry.van.haaren@intel.com>; Rao, Nikhil
> <nikhil.rao@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> packets enqueue
> 
> On Wed, Oct 2, 2019 at 8:38 AM Hemant Agrawal
> <hemant.agrawal@nxp.com> wrote:
> >
> > Hi Jerin,
> 
> Hi Hemant,
> 
> 
> > > > I understand your concern that this shall not be valid on a general cases.
> > > >
> > > > There are certain use-case (NXP internal) of DPDK event which have
> > > > separate event ports/cores dedicated for certain tasks - and can
> > > > use the burst functionality for performance according to the event
> > > > ports which are used. Not having this at runtime will limit the
> > > > flexibility for such
> > > applications.
> > >
> > > If it is specific to NXP internal use case then no more comments on
> > > dynamic vs static.
> > >
> > > @ Nikhil Rao any comments.
Hi Jerin, Hemant,

Looks like we are trying to give a generic wrapper for the NXP internal use case, do we really need to solve that problem ? 


> > >
> > > One option could be to incorporate NXP internal use case will be
> > > introducing a new API, parallel to rte_event_eth_tx_adapter_enqueue
> > > as
> > > rte_event_eth_tx_adapter_enqueue_same_dest()
> > > or something.
> > >
> > > Two advantage:
> > > # Not a major ABI breakage. Only need to add new fast-path function
> > > in rte_eventdev.
> > > # Even though we add 'zero' in API all the time, the Compiler
> > > prologue needs to push to stack or move the value to argument
> > > register as there is function pointer indirection. so new API will
> > > have zero performance impact for normal cases.
> > >
> > > Not sure about minor ABI breakage in rte_eventdev(adding a new
> > > fastpath function). If everyone is OK as the exception for 19.11
> > > then we can introduce a new API.
> >
> > [Hemant] There are already too many APIs and mode in eventdev. My
> suggestion is to minimize the new APIs. Else writing generic applications will be
> really difficult and it will not be easy to adapt by the application developers.
> > In this particular case, it is better for NXP to go with direct eth enque mode
> rather than TX adapter. Note that crypto adapter already provide that mode.
> However we are trying to adjust so that applications do not become complex.
> 
> Why? If you think direct queue model as use case if you might as well write
> "ethdev" driver and internally use atomic schedule type.
> 
> 
> > In the existing code also we have two modes in the application to send the
> packets out - one is 'rte_event_enqueue_burst' and other is
> 'rte_event_eth_tx_adapter_enqueue'.
> > It is still cumbersome for the application to maintain separate modes. This
> increases when crypto/timer is also being used in event mode.
> 
> I think, we have two things here
> a) specialized API for specific work like
> rte_event_enqueue_new_burst() or rte_event_enqueue_forward_burst() vs
> generic rte_event_enqueue_burst().
> I think, that does not NOT any harm as the application can use optimized
> routine if required(no separate code path case)
> 
> b) different code path
> I agree, this is something I don't like and we would like to avoid.
> But this specific case, We took the comprise to avoid any performance impact
> for SW or HW model.
> It is a public discussion and it is here
> 
> http://patches.dpdk.org/patch/40426/
> 
> >
> > Why do we not used the 'rte_event->event_type' for TX as well, and
> 'rte_event_enqueue_burst', API to internally (in respective event driver) send
> the packet to the respective eth/crypto/timer Tx function? It makes more sense
> to have a common framework to send packets, rather than having multiple
> API's?
> 
> If we make rte_event_enqueue_burst() to send the packet then:
> - HW eventdev driver + External PCI network card use case won't work as you
> are overriding event driver enqueue which has no clue on the external PCI
> network card vs integrated network controller.
> - Additional switch cases rte_event_enqueue_burst() in generic function aka
> performance impact.
> - There are multiple SW eventdev drivers, whose generic enqueue() function
> can not be changed to handle Tx adapter enqueue + add new switch case
> - Both SW and HW can use rte_event_eth_tx_adapter_enqueue() to send the
> packet to have unified fast path. i.e The callback can be attached to SW tx
> adapter or HW routine to send the packet.


> But I am not able to recollect, Why Nikhil would like to use the separate
> functions. Nikhil could you remind us why
> rte_event_eth_tx_adapter_enqueue() can not be used for sending the packet
> for SW Tx adapter.
> 
[Nikhil] The goal was to keep the workers using the loop below. 

while (1) {
        rte_event_dequeue_burst(...);
        (event processing)
        rte_event_enqueue_burst(...);
}

Thanks,
Nikhil

> Nothing is set and stone. We can always improve the API if required.
> 
> 
> >
> >
> > >
> > >
> > >
> > > >
> > > > Regards,
> > > > Nipun
> > > >
> > > > >
> > > > >
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > > > > > ---
> > > > > > > > > >  app/test-eventdev/test_pipeline_common.h          |  6 +++---
> > > > > > > > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > > > > > > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > > > > > > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > > > > > > > >  drivers/event/octeontx2/otx2_evdev.h              | 12 ++++++++--
> --
> > > > > > > > > >  drivers/event/octeontx2/otx2_worker.c             |  8 ++++++--
> > > > > > > > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8 ++++++--
> > > > > > > > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> > > > > > > +++++++++++++--
> > > > > > > > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > > > > > > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > > > > > > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > > > > > > > >
> > > > > > > > > > diff --git a/app/test-eventdev/test_pipeline_common.h
> > > > > b/app/test-
> > > > > > > > > eventdev/test_pipeline_common.h
> > > > > > > > > > index 0440b9e29..6e73c6ab2 100644
> > > > > > > > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > > > > > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > > > > > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t
> > > > > > > > > > dev, const
> > > > > > > uint8_t
> > > > > > > > > port,
> > > > > > > > > >                 struct rte_event * const ev)  {
> > > > > > > > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > > > > > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> > > 1))
> > > > > > > > > > +       while (!rte_event_eth_tx_adapter_enqueue(dev,
> > > > > > > > > > + port, ev, 1,
> > > > > 0))
> > > > > > > > > >                 rte_pause();  }
> > > > > > > > > >
> > > > > > > > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const
> > > > > > > > > > uint8_t
> > > > > dev,
> > > > > > > const
> > > > > > > > > uint8_t port,
> > > > > > > > > >  {
> > > > > > > > > >         uint16_t enq;
> > > > > > > > > >
> > > > > > > > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev,
> > > > > nb_rx);
> > > > > > > > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev,
> > > > > > > > > > + port, ev,
> > > > > nb_rx,
> > > > > > > 0);
> > > > > > > > > >         while (enq < nb_rx) {
> > > > > > > > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev, port,
> > > > > > > > > > -                               ev + enq, nb_rx - enq);
> > > > > > > > > > +                               ev + enq, nb_rx - enq,
> > > > > > > > > > + 0);
> > > > > > > > > >         }
> > > > > > > > > >  }
> > > > > > > > > >
> > > > > > > > > > diff --git
> > > > > > > > > > a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > > > index 192f9e1cf..a8c13e136 100644
> > > > > > > > > > ---
> > > > > > > > > > a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > > > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.
> > > > > > > > > > +++ rst
> > > > > > > > > > @@ -137,11 +137,12 @@ should use the
> > > > > > > ``rte_event_enqueue_burst()``
> > > > > > > > > function.
> > > > > > > > > >         if (cap &
> > > > > > > > > > RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> > > > > {
> > > > > > > > > >
> > > > > > > > > >                 event.mbuf = m;
> > > > > > > > > > +               eq_flags = 0;
> > > > > > > > > >
> > > > > > > > > >                 m->port = tx_port;
> > > > > > > > > >                 rte_event_eth_tx_adapter_txq_set(m,
> > > > > > > > > > tx_queue_id);
> > > > > > > > > >
> > > > > > > > > > -               rte_event_eth_tx_adapter_enqueue(dev_id, ev_port,
> > > > > &event,
> > > > > > > 1);
> > > > > > > > > > +
> > > > > > > > > > + rte_event_eth_tx_adapter_enqueue(dev_id,
> > > > > > > > > > + ev_port,
> > > > > > > &event, 1,
> > > > > > > > > eq_flags);
> > > > > > > > > >         } else {
> > > > > > > > > >
> > > > > > > > > >                 event.queue_id = qid; /* event queue
> > > > > > > > > > linked to adapter
> > > > > port */
> > > > > > > > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > index 0e622152c..1b156edab 100644
> > > > > > > > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct
> > > > > > > > > > ssows *ws,
> > > > > > > uint8_t
> > > > > > > > > queue_id,
> > > > > > > > > >                 ssows_handle_event_t fn, void *arg);
> > > > > > > > > > void ssows_reset(struct ssows *ws);  uint16_t
> > > > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > + nb_events, uint8_t
> > > > > eq_flags);
> > > > > > > > > >  int ssovf_info(struct ssovf_info *info);  void
> > > > > > > > > > *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar);
> > > > > > > > > > int test_eventdev_octeontx(void); diff --git
> > > > > > > > > > a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > index d940b5dd6..1d0467af3 100644
> > > > > > > > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > > > > > > > >
> > > > > > > > > >  uint16_t
> > > > > > > > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > + nb_events, uint8_t eq_flags)
> > > > > > > > > >  {
> > > > > > > > > >         uint16_t port_id;
> > > > > > > > > >         uint16_t queue_id; @@ -275,6 +275,7 @@
> > > > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > >         octeontx_dq_t *dq;
> > > > > > > > > >
> > > > > > > > > >         RTE_SET_USED(nb_events);
> > > > > > > > > > +       RTE_SET_USED(eq_flags);
> > > > > > > > > >         switch (ev->sched_type) {
> > > > > > > > > >         case SSO_SYNC_ORDERED:
> > > > > > > > > >                 ssows_swtag_norm(ws, ev->event,
> > > > > > > > > > SSO_SYNC_ATOMIC); diff --git
> > > > > > > > > > a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > index 5cd80e3b2..74b749a15 100644
> > > > > > > > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > @@ -333,16 +333,20 @@
> > > SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > >
> > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void
> > > > > > > > > > *port, struct
> > > > > > > rte_event
> > > > > > > > > ev[],\
> > > > > > > > > > -                                          uint16_t nb_events);              \
> > > > > > > > > > +                                          uint16_t nb_events,               \
> > > > > > > > > > +                                          uint8_t eq_flags);                \
> > > > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void
> > > > > > > > > > *port,
> > > > > > > \
> > > > > > > > > >                                                struct rte_event ev[],        \
> > > > > > > > > > -                                              uint16_t nb_events);          \
> > > > > > > > > > +                                              uint16_t nb_events,           \
> > > > > > > > > > +                                              uint8_t eq_flags);            \
> > > > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ## name(void
> > > > > > > > > > *port,
> > > > > > > \
> > > > > > > > > >                                                 struct rte_event ev[],       \
> > > > > > > > > > -                                               uint16_t nb_events);         \
> > > > > > > > > > +                                               uint16_t nb_events,          \
> > > > > > > > > > +                                               uint8_t eq_flags);           \
> > > > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ##
> > > > > > > > > > name(void
> > > > > *port,
> > > > > > > > > \
> > > > > > > > > >                                                     struct rte_event ev[],   \
> > > > > > > > > > -                                                   uint16_t nb_events);     \
> > > > > > > > > > +                                                   uint16_t nb_events,      \
> > > > > > > > > > +                                                   uint8_t eq_flags);       \
> > > > > > > > > >
> > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC  #undef T diff --git
> > > > > > > > > > a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > index cd14cd3d2..100e21669 100644
> > > > > > > > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > @@ -270,12 +270,14 @@ otx2_ssogws_enq_fwd_burst(void
> > > > > > > > > > *port,
> > > > > > > const
> > > > > > > > > struct rte_event ev[],
> > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct
> > > > > > > > > > rte_event
> > > > > > > ev[],   \
> > > > > > > > > > -                                 uint16_t nb_events)                   \
> > > > > > > > > > +                                 uint16_t nb_events,                   \
> > > > > > > > > > +                                 uint8_t eq_flags)                     \
> > > > > > > > > >  {                                                                      \
> > > > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > > > >                                                                         \
> > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, flags);
> \
> > > > > > > > > >  }
> > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -284,12 +286,14
> > > @@
> > > > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,
> > > > > > > > > > struct
> > > > > > > rte_event ev[],\
> > > > > > > > > > -                                     uint16_t nb_events)               \
> > > > > > > > > > +                                     uint16_t nb_events,               \
> > > > > > > > > > +                                     uint8_t eq_flags)                 \
> > > > > > > > > >  {                                                                      \
> > > > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS -
> > > > > > > > > > 2];
> > > \
> > > > > > > > > >                                                                         \
> > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd, (flags) |
> \
> > > > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > > > >  }
> > > > > > > > > > diff --git
> > > > > > > > > > a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > index 37c274a54..c3e48da42 100644
> > > > > > > > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > @@ -310,7 +310,8 @@
> SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> > > \
> > > > > > > > > >                                        struct rte_event ev[],           \
> > > > > > > > > > -                                      uint16_t nb_events)              \
> > > > > > > > > > +                                      uint16_t nb_events,              \
> > > > > > > > > > +                                      uint8_t eq_flags)                \
> > > > > > > > > >  {                                                                      \
> > > > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ##
> > > > > > > name(void *port,
> > > > > > > > > \
> > > > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > > > >                                                                         \
> > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, flags);
> \
> > > > > > > > > >  }
> > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -327,7 +329,8
> @@
> > > > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> > > > > > > > > > *port,
> > > > > \
> > > > > > > > > >                                            struct rte_event ev[],       \
> > > > > > > > > > -                                          uint16_t nb_events)          \
> > > > > > > > > > +                                          uint16_t nb_events,          \
> > > > > > > > > > +                                          uint8_t eq_flags)            \
> > > > > > > > > >  {                                                                      \
> > > > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > > > @@ -335,6 +338,7 @@ otx2_ssogws_dual_tx_adptr_enq_seg_
> > > ##
> > > > > > > name(void
> > > > > > > > > *port,                      \
> > > > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS -
> > > > > > > > > > 2];
> > > \
> > > > > > > > > >                                                                         \
> > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd, (flags) |
> \
> > > > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > > > >  }
> > > > > > > > > > diff --git
> > > > > > > > > > a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > index c848261c4..98be77568 100644
> > > > > > > > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > @@ -300,6 +300,11 @@
> > > > > > > > > > rte_event_eth_tx_adapter_txq_get(struct
> > > > > > > rte_mbuf
> > > > > > > > > *pkt)
> > > > > > > > > >  int
> > > > > > > > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id,
> > > > > > > > > > uint8_t
> > > > > > > > > *event_port_id);
> > > > > > > > > >
> > > > > > > > > > +#define
> RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > > > 0x1
> > > > > > > > > > +/**< This flag is used when all the packets enqueued
> > > > > > > > > > +in the tx
> > > > > adapter
> > > > > > > are
> > > > > > > > > > + * destined for the same Ethernet device, queue pair.
> > > > > > > > > > + */
> > > > > > > > > > +
> > > > > > > > > >  /**
> > > > > > > > > >   * Enqueue a burst of events objects or an event
> > > > > > > > > > object supplied in
> > > > > > > > > *rte_event*
> > > > > > > > > >   * structure on an  event device designated by its
> > > > > > > > > > *dev_id* through
> > > > > > > the event
> > > > > > > > > > @@ -324,6 +329,10 @@
> > > > > > > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > > > > > > > id, uint8_t *event_port_id);
> > > > > > > > > >   *  The number of event objects to enqueue, typically number
> of
> > > > > > > > > >   *
> > > > > rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > > > > > > > >   *  available for this port.
> > > > > > > > > > + * @param flags
> > > > > > > > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > > > > > > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > > > signifies
> > > > > > > that all
> > > > > > > > > the packets
> > > > > > > > > > + *  which are enqueued are destined for the same
> > > > > > > > > > + Ethernet device,
> > > > > > > queue pair.
> > > > > > > > > >   *
> > > > > > > > > >   * @return
> > > > > > > > > >   *   The number of event objects actually enqueued on the
> event
> > > > > > > device. The
> > > > > > > > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > > > > > > > > rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > > > > > > > >                                 uint8_t port_id,
> > > > > > > > > >                                 struct rte_event ev[],
> > > > > > > > > > -                               uint16_t nb_events)
> > > > > > > > > > +                               uint16_t nb_events,
> > > > > > > > > > +                               uint8_t flags)
> > > > > > > > > >  {
> > > > > > > > > >         const struct rte_eventdev *dev =
> > > > > > > > > > &rte_eventdevs[dev_id];
> > > > > > > > > >
> > > > > > > > > > @@ -359,7 +369,8 @@
> > > > > rte_event_eth_tx_adapter_enqueue(uint8_t
> > > > > > > dev_id,
> > > > > > > > > >                 return 0;
> > > > > > > > > >         }
> > > > > > > > > >  #endif
> > > > > > > > > > -       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > > > nb_events);
> > > > > > > > > > +       return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > > > > > > > > +                               nb_events, flags);
> > > > > > > > > >  }
> > > > > > > > > >
> > > > > > > > > >  /**
> > > > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > index f44c869cb..3bf9d7115 100644
> > > > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > @@ -1324,7 +1324,8 @@
> > > > > rte_eventdev_find_free_device_index(void)
> > > > > > > > > >  static uint16_t
> > > > > > > > > >  rte_event_tx_adapter_enqueue(__rte_unused void *port,
> > > > > > > > > >                         __rte_unused struct rte_event ev[],
> > > > > > > > > > -                       __rte_unused uint16_t nb_events)
> > > > > > > > > > +                       __rte_unused uint16_t nb_events,
> > > > > > > > > > +                       __rte_unused uint8_t flags)
> > > > > > > > > >  {
> > > > > > > > > >         rte_errno = ENOTSUP;
> > > > > > > > > >         return 0;
> > > > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > index 5044a13d0..2a5643da3 100644
> > > > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> > > > > > > (*event_dequeue_burst_t)(void
> > > > > > > > > *port, struct rte_event ev[],
> > > > > > > > > >  /**< @internal Dequeue burst of events from port of a
> > > > > > > > > > device */
> > > > > > > > > >
> > > > > > > > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
> > > > > > > > > > -                               struct rte_event ev[], uint16_t nb_events);
> > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > + nb_events, uint8_t flags);
> > > > > > > > > >  /**< @internal Enqueue burst of events on port of a
> > > > > > > > > > device */
> > > > > > > > > >
> > > > > > > > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > > > > > > > --
> > > > > > > > > > 2.17.1
> > > > > > > > > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-03  6:12                   ` Rao, Nikhil
@ 2019-10-03  6:45                     ` Hemant Agrawal
  2019-10-03 10:26                       ` Jerin Jacob
  0 siblings, 1 reply; 30+ messages in thread
From: Hemant Agrawal @ 2019-10-03  6:45 UTC (permalink / raw)
  To: Rao, Nikhil, Jerin Jacob
  Cc: Nipun Gupta, Jerin Jacob, dpdk-dev, Pavan Nikhilesh,
	Sunil Kumar Kori, Richardson, Bruce, Kovacevic, Marko, Ori Kam,
	Nicolau, Radu, Kantecki, Tomasz, Van Haaren, Harry

Hi Nikhil,

> -----Original Message-----
> From: Rao, Nikhil <nikhil.rao@intel.com>
> Sent: Thursday, October 3, 2019 11:43 AM
> >
> > On Wed, Oct 2, 2019 at 8:38 AM Hemant Agrawal
> <hemant.agrawal@nxp.com>
> > wrote:
> > >
> > > Hi Jerin,
> >
> > Hi Hemant,
> >
> >
> > > > > I understand your concern that this shall not be valid on a general
> cases.
> > > > >
> > > > > There are certain use-case (NXP internal) of DPDK event which
> > > > > have separate event ports/cores dedicated for certain tasks -
> > > > > and can use the burst functionality for performance according to
> > > > > the event ports which are used. Not having this at runtime will
> > > > > limit the flexibility for such
> > > > applications.
> > > >
> > > > If it is specific to NXP internal use case then no more comments
> > > > on dynamic vs static.
> > > >
> > > > @ Nikhil Rao any comments.
> Hi Jerin, Hemant,
> 
> Looks like we are trying to give a generic wrapper for the NXP internal use
> case, do we really need to solve that problem ?

[Hemant] no, that is not the case. 

On the argument sake, eth TX adapter is also Marvel/Cavium specific - the idea was to reach consensus and come with generic APIs. NXP does  not need ethTX adapter. 
However, here, we are trying to avoid too many code paths for the applications, so that it becomes easy for the application writer. 

- We do support RX burst, so TX burst should be supported.  I remember Marvel do  not support RX burst, but we added it as NXP HW support it. Intel SW can also support it.
 - See existing L3 fwd application, how the burst accumulation is being done on per queue basis. 
 - Why the application is not sending all the packets and letting driver do the buffering on per queue basis? 
-  The reason is that applications knows which packets can be buffered, which need to be sent immediately. Only application can control the time out and different setting for burst mode. The burst segregation logic can not be pushed into the driver for all these various reasons.

 I am not in favor of new APIs and more code paths for the applications. It will not be favorable for the adaptability of the eventdev widely.  
We are only asking for one additional argument to indicate whether application has sent the current burst targeted for single FQ or it has mixed data. It can be set as 0 for the application like l2fwd, who are not doing buffering. However application like l3fwd, who do buffering, will definitely use it. 

Note that it is always costly for the driver to internally sort/buffer the packets from the buffer.


> 
> 
> > > >
> > > > One option could be to incorporate NXP internal use case will be
> > > > introducing a new API, parallel to
> > > > rte_event_eth_tx_adapter_enqueue as
> > > > rte_event_eth_tx_adapter_enqueue_same_dest()
> > > > or something.
> > > >
> > > > Two advantage:
> > > > # Not a major ABI breakage. Only need to add new fast-path
> > > > function in rte_eventdev.
> > > > # Even though we add 'zero' in API all the time, the Compiler
> > > > prologue needs to push to stack or move the value to argument
> > > > register as there is function pointer indirection. so new API will
> > > > have zero performance impact for normal cases.
> > > >
> > > > Not sure about minor ABI breakage in rte_eventdev(adding a new
> > > > fastpath function). If everyone is OK as the exception for 19.11
> > > > then we can introduce a new API.
> > >
> > > [Hemant] There are already too many APIs and mode in eventdev. My
> > suggestion is to minimize the new APIs. Else writing generic
> > applications will be really difficult and it will not be easy to adapt by the
> application developers.
> > > In this particular case, it is better for NXP to go with direct eth
> > > enque mode
> > rather than TX adapter. Note that crypto adapter already provide that
> mode.
> > However we are trying to adjust so that applications do not become
> complex.
> >
> > Why? If you think direct queue model as use case if you might as well
> > write "ethdev" driver and internally use atomic schedule type.
> >
> >
> > > In the existing code also we have two modes in the application to
> > > send the
> > packets out - one is 'rte_event_enqueue_burst' and other is
> > 'rte_event_eth_tx_adapter_enqueue'.
> > > It is still cumbersome for the application to maintain separate
> > > modes. This
> > increases when crypto/timer is also being used in event mode.
> >
> > I think, we have two things here
> > a) specialized API for specific work like
> > rte_event_enqueue_new_burst() or
> rte_event_enqueue_forward_burst() vs
> > generic rte_event_enqueue_burst().
> > I think, that does not NOT any harm as the application can use
> > optimized routine if required(no separate code path case)
> >
> > b) different code path
> > I agree, this is something I don't like and we would like to avoid.
> > But this specific case, We took the comprise to avoid any performance
> > impact for SW or HW model.
> > It is a public discussion and it is here
> >
> >
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> >
> es.dpdk.org%2Fpatch%2F40426%2F&amp;data=02%7C01%7Chemant.agrawa
> l%40nxp
> >
> .com%7Cdad3dcb7aa684656d9f508d747c8bac8%7C686ea1d3bc2b4c6fa92cd99
> c5c30
> >
> 1635%7C0%7C0%7C637056799769535589&amp;sdata=iCmksK0xZ%2BYpPaZ9
> McG1HHuE
> > mi1No1MaAqdsO2vIkEo%3D&amp;reserved=0
> >
> > >
> > > Why do we not used the 'rte_event->event_type' for TX as well, and
> > 'rte_event_enqueue_burst', API to internally (in respective event
> > driver) send the packet to the respective eth/crypto/timer Tx
> > function? It makes more sense to have a common framework to send
> > packets, rather than having multiple API's?
> >
> > If we make rte_event_enqueue_burst() to send the packet then:
> > - HW eventdev driver + External PCI network card use case won't work
> > as you are overriding event driver enqueue which has no clue on the
> > external PCI network card vs integrated network controller.
> > - Additional switch cases rte_event_enqueue_burst() in generic
> > function aka performance impact.
> > - There are multiple SW eventdev drivers, whose generic enqueue()
> > function can not be changed to handle Tx adapter enqueue + add new
> > switch case
> > - Both SW and HW can use rte_event_eth_tx_adapter_enqueue() to send
> > the packet to have unified fast path. i.e The callback can be attached
> > to SW tx adapter or HW routine to send the packet.
> 
> 
> > But I am not able to recollect, Why Nikhil would like to use the
> > separate functions. Nikhil could you remind us why
> > rte_event_eth_tx_adapter_enqueue() can not be used for sending the
> > packet for SW Tx adapter.
> >
> [Nikhil] The goal was to keep the workers using the loop below.
> 
> while (1) {
>         rte_event_dequeue_burst(...);
>         (event processing)
>         rte_event_enqueue_burst(...);
> }
> 
[Hemant] So everyone has a different way for sending the packet. 
	- intel wants direct event enqueue
	- Marvel/Cavium wants adapters
	- NXP don’t' want to use event for TX path. - but we can use adapter if minor adjustments are made.

> Thanks,
> Nikhil
> 
> > Nothing is set and stone. We can always improve the API if required.
> >
> >
> > >
> > >
> > > >
> > > >
> > > >
> > > > >
> > > > > Regards,
> > > > > Nipun
> > > > >
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > > > > > > ---
> > > > > > > > > > >  app/test-eventdev/test_pipeline_common.h          |  6
> +++---
> > > > > > > > > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > > > > > > > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > > > > > > > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > > > > > > > > >  drivers/event/octeontx2/otx2_evdev.h              | 12
> ++++++++--
> > --
> > > > > > > > > > >  drivers/event/octeontx2/otx2_worker.c             |  8
> ++++++--
> > > > > > > > > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8
> ++++++--
> > > > > > > > > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> > > > > > > > +++++++++++++--
> > > > > > > > > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > > > > > > > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > > > > > > > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > > > > > > > > >
> > > > > > > > > > > diff --git
> > > > > > > > > > > a/app/test-eventdev/test_pipeline_common.h
> > > > > > b/app/test-
> > > > > > > > > > eventdev/test_pipeline_common.h
> > > > > > > > > > > index 0440b9e29..6e73c6ab2 100644
> > > > > > > > > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > > > > > > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > > > > > > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t
> > > > > > > > > > > dev, const
> > > > > > > > uint8_t
> > > > > > > > > > port,
> > > > > > > > > > >                 struct rte_event * const ev)  {
> > > > > > > > > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > > > > > > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev,
> port, ev,
> > > > 1))
> > > > > > > > > > > +       while
> > > > > > > > > > > + (!rte_event_eth_tx_adapter_enqueue(dev,
> > > > > > > > > > > + port, ev, 1,
> > > > > > 0))
> > > > > > > > > > >                 rte_pause();  }
> > > > > > > > > > >
> > > > > > > > > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const
> > > > > > > > > > > uint8_t
> > > > > > dev,
> > > > > > > > const
> > > > > > > > > > uint8_t port,
> > > > > > > > > > >  {
> > > > > > > > > > >         uint16_t enq;
> > > > > > > > > > >
> > > > > > > > > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port,
> ev,
> > > > > > nb_rx);
> > > > > > > > > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev,
> > > > > > > > > > > + port, ev,
> > > > > > nb_rx,
> > > > > > > > 0);
> > > > > > > > > > >         while (enq < nb_rx) {
> > > > > > > > > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev,
> port,
> > > > > > > > > > > -                               ev + enq, nb_rx - enq);
> > > > > > > > > > > +                               ev + enq, nb_rx -
> > > > > > > > > > > + enq, 0);
> > > > > > > > > > >         }
> > > > > > > > > > >  }
> > > > > > > > > > >
> > > > > > > > > > > diff --git
> > > > > > > > > > > a/doc/guides/prog_guide/event_ethernet_tx_adapter.rs
> > > > > > > > > > > t
> > > > > > > > > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > > > > index 192f9e1cf..a8c13e136 100644
> > > > > > > > > > > ---
> > > > > > > > > > > a/doc/guides/prog_guide/event_ethernet_tx_adapter.rs
> > > > > > > > > > > t
> > > > > > > > > > > +++
> b/doc/guides/prog_guide/event_ethernet_tx_adapter.
> > > > > > > > > > > +++ rst
> > > > > > > > > > > @@ -137,11 +137,12 @@ should use the
> > > > > > > > ``rte_event_enqueue_burst()``
> > > > > > > > > > function.
> > > > > > > > > > >         if (cap &
> > > > > > > > > > > RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> > > > > > {
> > > > > > > > > > >
> > > > > > > > > > >                 event.mbuf = m;
> > > > > > > > > > > +               eq_flags = 0;
> > > > > > > > > > >
> > > > > > > > > > >                 m->port = tx_port;
> > > > > > > > > > >                 rte_event_eth_tx_adapter_txq_set(m,
> > > > > > > > > > > tx_queue_id);
> > > > > > > > > > >
> > > > > > > > > > > -               rte_event_eth_tx_adapter_enqueue(dev_id,
> ev_port,
> > > > > > &event,
> > > > > > > > 1);
> > > > > > > > > > > +
> > > > > > > > > > > + rte_event_eth_tx_adapter_enqueue(dev_id,
> > > > > > > > > > > + ev_port,
> > > > > > > > &event, 1,
> > > > > > > > > > eq_flags);
> > > > > > > > > > >         } else {
> > > > > > > > > > >
> > > > > > > > > > >                 event.queue_id = qid; /* event queue
> > > > > > > > > > > linked to adapter
> > > > > > port */
> > > > > > > > > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > > index 0e622152c..1b156edab 100644
> > > > > > > > > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct
> > > > > > > > > > > ssows *ws,
> > > > > > > > uint8_t
> > > > > > > > > > queue_id,
> > > > > > > > > > >                 ssows_handle_event_t fn, void *arg);
> > > > > > > > > > > void ssows_reset(struct ssows *ws);  uint16_t
> > > > > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > > + nb_events, uint8_t
> > > > > > eq_flags);
> > > > > > > > > > >  int ssovf_info(struct ssovf_info *info);  void
> > > > > > > > > > > *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t
> > > > > > > > > > > bar); int test_eventdev_octeontx(void); diff --git
> > > > > > > > > > > a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > > index d940b5dd6..1d0467af3 100644
> > > > > > > > > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > > > > > > > > >
> > > > > > > > > > >  uint16_t
> > > > > > > > > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > > + nb_events, uint8_t eq_flags)
> > > > > > > > > > >  {
> > > > > > > > > > >         uint16_t port_id;
> > > > > > > > > > >         uint16_t queue_id; @@ -275,6 +275,7 @@
> > > > > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > > >         octeontx_dq_t *dq;
> > > > > > > > > > >
> > > > > > > > > > >         RTE_SET_USED(nb_events);
> > > > > > > > > > > +       RTE_SET_USED(eq_flags);
> > > > > > > > > > >         switch (ev->sched_type) {
> > > > > > > > > > >         case SSO_SYNC_ORDERED:
> > > > > > > > > > >                 ssows_swtag_norm(ws, ev->event,
> > > > > > > > > > > SSO_SYNC_ATOMIC); diff --git
> > > > > > > > > > > a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > > index 5cd80e3b2..74b749a15 100644
> > > > > > > > > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > > @@ -333,16 +333,20 @@
> > > > SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > > >
> > > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > > > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void
> > > > > > > > > > > *port, struct
> > > > > > > > rte_event
> > > > > > > > > > ev[],\
> > > > > > > > > > > -                                          uint16_t nb_events);              \
> > > > > > > > > > > +                                          uint16_t nb_events,               \
> > > > > > > > > > > +                                          uint8_t eq_flags);                \
> > > > > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void
> > > > > > > > > > > *port,
> > > > > > > > \
> > > > > > > > > > >                                                struct rte_event ev[],        \
> > > > > > > > > > > -                                              uint16_t nb_events);          \
> > > > > > > > > > > +                                              uint16_t nb_events,           \
> > > > > > > > > > > +                                              uint8_t eq_flags);            \
> > > > > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ##
> > > > > > > > > > > name(void *port,
> > > > > > > > \
> > > > > > > > > > >                                                 struct rte_event ev[],       \
> > > > > > > > > > > -                                               uint16_t nb_events);         \
> > > > > > > > > > > +                                               uint16_t nb_events,          \
> > > > > > > > > > > +                                               uint8_t eq_flags);           \
> > > > > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ##
> > > > > > > > > > > name(void
> > > > > > *port,
> > > > > > > > > > \
> > > > > > > > > > >                                                     struct rte_event ev[],   \
> > > > > > > > > > > -                                                   uint16_t nb_events);     \
> > > > > > > > > > > +                                                   uint16_t nb_events,      \
> > > > > > > > > > > +                                                   uint8_t eq_flags);       \
> > > > > > > > > > >
> > > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC  #undef T diff --
> git
> > > > > > > > > > > a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > > index cd14cd3d2..100e21669 100644
> > > > > > > > > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > > @@ -270,12 +270,14 @@
> otx2_ssogws_enq_fwd_burst(void
> > > > > > > > > > > *port,
> > > > > > > > const
> > > > > > > > > > struct rte_event ev[],
> > > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port,
> > > > > > > > > > > struct rte_event
> > > > > > > > ev[],   \
> > > > > > > > > > > -                                 uint16_t nb_events)                   \
> > > > > > > > > > > +                                 uint16_t nb_events,                   \
> > > > > > > > > > > +                                 uint8_t eq_flags)                     \
> > > > > > > > > > >  {                                                                      \
> > > > > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > > > > >                                                                         \
> > > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd,
> > > > > > > > > > > flags);
> > \
> > > > > > > > > > >  }
> > > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -284,12
> +286,14
> > > > @@
> > > > > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,
> > > > > > > > > > > struct
> > > > > > > > rte_event ev[],\
> > > > > > > > > > > -                                     uint16_t nb_events)               \
> > > > > > > > > > > +                                     uint16_t nb_events,               \
> > > > > > > > > > > +                                     uint8_t eq_flags)                 \
> > > > > > > > > > >  {                                                                      \
> > > > > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS -
> > > > > > > > > > > 2];
> > > > \
> > > > > > > > > > >                                                                         \
> > > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd,
> > > > > > > > > > > (flags) |
> > \
> > > > > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > > > > >  }
> > > > > > > > > > > diff --git
> > > > > > > > > > > a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > > index 37c274a54..c3e48da42 100644
> > > > > > > > > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > > @@ -310,7 +310,8 @@
> > SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> > > > \
> > > > > > > > > > >                                        struct rte_event ev[],           \
> > > > > > > > > > > -                                      uint16_t nb_events)              \
> > > > > > > > > > > +                                      uint16_t nb_events,              \
> > > > > > > > > > > +                                      uint8_t eq_flags)                \
> > > > > > > > > > >  {                                                                      \
> > > > > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_
> > > > > > > > > > > ##
> > > > > > > > name(void *port,
> > > > > > > > > > \
> > > > > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > > > > >                                                                         \
> > > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd,
> > > > > > > > > > > flags);
> > \
> > > > > > > > > > >  }
> > > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -327,7 +329,8
> > @@
> > > > > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> > > > > > > > > > > *port,
> > > > > > \
> > > > > > > > > > >                                            struct rte_event ev[],       \
> > > > > > > > > > > -                                          uint16_t nb_events)          \
> > > > > > > > > > > +                                          uint16_t nb_events,          \
> > > > > > > > > > > +                                          uint8_t eq_flags)            \
> > > > > > > > > > >  {                                                                      \
> > > > > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > > > > @@ -335,6 +338,7 @@
> > > > > > > > > > > otx2_ssogws_dual_tx_adptr_enq_seg_
> > > > ##
> > > > > > > > name(void
> > > > > > > > > > *port,                      \
> > > > > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS -
> > > > > > > > > > > 2];
> > > > \
> > > > > > > > > > >                                                                         \
> > > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd,
> > > > > > > > > > > (flags) |
> > \
> > > > > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > > > > >  }
> > > > > > > > > > > diff --git
> > > > > > > > > > > a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > > index c848261c4..98be77568 100644
> > > > > > > > > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > > @@ -300,6 +300,11 @@
> > > > > > > > > > > rte_event_eth_tx_adapter_txq_get(struct
> > > > > > > > rte_mbuf
> > > > > > > > > > *pkt)
> > > > > > > > > > >  int
> > > > > > > > > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id,
> > > > > > > > > > > uint8_t
> > > > > > > > > > *event_port_id);
> > > > > > > > > > >
> > > > > > > > > > > +#define
> > RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > > > > 0x1
> > > > > > > > > > > +/**< This flag is used when all the packets
> > > > > > > > > > > +enqueued in the tx
> > > > > > adapter
> > > > > > > > are
> > > > > > > > > > > + * destined for the same Ethernet device, queue pair.
> > > > > > > > > > > + */
> > > > > > > > > > > +
> > > > > > > > > > >  /**
> > > > > > > > > > >   * Enqueue a burst of events objects or an event
> > > > > > > > > > > object supplied in
> > > > > > > > > > *rte_event*
> > > > > > > > > > >   * structure on an  event device designated by its
> > > > > > > > > > > *dev_id* through
> > > > > > > > the event
> > > > > > > > > > > @@ -324,6 +329,10 @@
> > > > > > > > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > > > > > > > > id, uint8_t *event_port_id);
> > > > > > > > > > >   *  The number of event objects to enqueue,
> > > > > > > > > > > typically number
> > of
> > > > > > > > > > >   *
> > > > > >
> rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > > > > > > > > >   *  available for this port.
> > > > > > > > > > > + * @param flags
> > > > > > > > > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > > > > > > > > + *
> #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > > > > signifies
> > > > > > > > that all
> > > > > > > > > > the packets
> > > > > > > > > > > + *  which are enqueued are destined for the same
> > > > > > > > > > > + Ethernet device,
> > > > > > > > queue pair.
> > > > > > > > > > >   *
> > > > > > > > > > >   * @return
> > > > > > > > > > >   *   The number of event objects actually enqueued on the
> > event
> > > > > > > > device. The
> > > > > > > > > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > > > > > > > > > rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > > > > > > > > >                                 uint8_t port_id,
> > > > > > > > > > >                                 struct rte_event ev[],
> > > > > > > > > > > -                               uint16_t nb_events)
> > > > > > > > > > > +                               uint16_t nb_events,
> > > > > > > > > > > +                               uint8_t flags)
> > > > > > > > > > >  {
> > > > > > > > > > >         const struct rte_eventdev *dev =
> > > > > > > > > > > &rte_eventdevs[dev_id];
> > > > > > > > > > >
> > > > > > > > > > > @@ -359,7 +369,8 @@
> > > > > > rte_event_eth_tx_adapter_enqueue(uint8_t
> > > > > > > > dev_id,
> > > > > > > > > > >                 return 0;
> > > > > > > > > > >         }
> > > > > > > > > > >  #endif
> > > > > > > > > > > -       return dev->txa_enqueue(dev->data->ports[port_id],
> ev,
> > > > > > > > nb_events);
> > > > > > > > > > > +       return dev->txa_enqueue(dev->data-
> >ports[port_id], ev,
> > > > > > > > > > > +                               nb_events, flags);
> > > > > > > > > > >  }
> > > > > > > > > > >
> > > > > > > > > > >  /**
> > > > > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > > index f44c869cb..3bf9d7115 100644
> > > > > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > > @@ -1324,7 +1324,8 @@
> > > > > > rte_eventdev_find_free_device_index(void)
> > > > > > > > > > >  static uint16_t
> > > > > > > > > > >  rte_event_tx_adapter_enqueue(__rte_unused void
> *port,
> > > > > > > > > > >                         __rte_unused struct rte_event ev[],
> > > > > > > > > > > -                       __rte_unused uint16_t nb_events)
> > > > > > > > > > > +                       __rte_unused uint16_t nb_events,
> > > > > > > > > > > +                       __rte_unused uint8_t flags)
> > > > > > > > > > >  {
> > > > > > > > > > >         rte_errno = ENOTSUP;
> > > > > > > > > > >         return 0;
> > > > > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > > index 5044a13d0..2a5643da3 100644
> > > > > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> > > > > > > > (*event_dequeue_burst_t)(void
> > > > > > > > > > *port, struct rte_event ev[],
> > > > > > > > > > >  /**< @internal Dequeue burst of events from port of
> > > > > > > > > > > a device */
> > > > > > > > > > >
> > > > > > > > > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void
> *port,
> > > > > > > > > > > -                               struct rte_event ev[], uint16_t
> nb_events);
> > > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > > + nb_events, uint8_t flags);
> > > > > > > > > > >  /**< @internal Enqueue burst of events on port of a
> > > > > > > > > > > device */
> > > > > > > > > > >
> > > > > > > > > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > > > > > > > > --
> > > > > > > > > > > 2.17.1
> > > > > > > > > > >

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-03  6:45                     ` Hemant Agrawal
@ 2019-10-03 10:26                       ` Jerin Jacob
  2019-10-21 11:35                         ` Rao, Nikhil
  0 siblings, 1 reply; 30+ messages in thread
From: Jerin Jacob @ 2019-10-03 10:26 UTC (permalink / raw)
  To: Hemant Agrawal
  Cc: Rao, Nikhil, Nipun Gupta, Jerin Jacob, dpdk-dev, Pavan Nikhilesh,
	Sunil Kumar Kori, Richardson, Bruce, Kovacevic, Marko, Ori Kam,
	Nicolau, Radu, Kantecki, Tomasz, Van Haaren, Harry

On Thu, Oct 3, 2019 at 12:15 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>
> Hi Nikhil,
>
> > -----Original Message-----
> > From: Rao, Nikhil <nikhil.rao@intel.com>
> > Sent: Thursday, October 3, 2019 11:43 AM
> > >
> > > On Wed, Oct 2, 2019 at 8:38 AM Hemant Agrawal
> > <hemant.agrawal@nxp.com>
> > > wrote:
> > > >
> > > > Hi Jerin,
> > >
> > > Hi Hemant,
> > >
> > >
> > > > > > I understand your concern that this shall not be valid on a general
> > cases.
> > > > > >
> > > > > > There are certain use-case (NXP internal) of DPDK event which
> > > > > > have separate event ports/cores dedicated for certain tasks -
> > > > > > and can use the burst functionality for performance according to
> > > > > > the event ports which are used. Not having this at runtime will
> > > > > > limit the flexibility for such
> > > > > applications.
> > > > >
> > > > > If it is specific to NXP internal use case then no more comments
> > > > > on dynamic vs static.
> > > > >
> > > > > @ Nikhil Rao any comments.
> > Hi Jerin, Hemant,
> >
> > Looks like we are trying to give a generic wrapper for the NXP internal use
> > case, do we really need to solve that problem ?
>
> [Hemant] no, that is not the case.
>
> On the argument sake, eth TX adapter is also Marvel/Cavium specific - the idea was to reach consensus and come with generic APIs. NXP does  not need ethTX adapter.
> However, here, we are trying to avoid too many code paths for the applications, so that it becomes easy for the application writer.
>
> - We do support RX burst, so TX burst should be supported.  I remember Marvel do  not support RX burst, but we added it as NXP HW support it. Intel SW can also support it.
>  - See existing L3 fwd application, how the burst accumulation is being done on per queue basis.
>  - Why the application is not sending all the packets and letting driver do the buffering on per queue basis?
> -  The reason is that applications knows which packets can be buffered, which need to be sent immediately. Only application can control the time out and different setting for burst mode. The burst segregation logic can not be pushed into the driver for all these various reasons.
>
>  I am not in favor of new APIs and more code paths for the applications. It will not be favorable for the adaptability of the eventdev widely.
> We are only asking for one additional argument to indicate whether application has sent the current burst targeted for single FQ or it has mixed data. It can be set as 0 for the application like l2fwd, who are not doing buffering. However application like l3fwd, who do buffering, will definitely use it.
>
> Note that it is always costly for the driver to internally sort/buffer the packets from the buffer.


After going through l3fwd code, I understand, you want to reuse
segregation  logic of send_packets_multi(). So, this makes sense to
me.


>
>
> >
> >
> > > > >
> > > > > One option could be to incorporate NXP internal use case will be
> > > > > introducing a new API, parallel to
> > > > > rte_event_eth_tx_adapter_enqueue as
> > > > > rte_event_eth_tx_adapter_enqueue_same_dest()
> > > > > or something.
> > > > >
> > > > > Two advantage:
> > > > > # Not a major ABI breakage. Only need to add new fast-path
> > > > > function in rte_eventdev.
> > > > > # Even though we add 'zero' in API all the time, the Compiler
> > > > > prologue needs to push to stack or move the value to argument
> > > > > register as there is function pointer indirection. so new API will
> > > > > have zero performance impact for normal cases.
> > > > >
> > > > > Not sure about minor ABI breakage in rte_eventdev(adding a new
> > > > > fastpath function). If everyone is OK as the exception for 19.11
> > > > > then we can introduce a new API.
> > > >
> > > > [Hemant] There are already too many APIs and mode in eventdev. My
> > > suggestion is to minimize the new APIs. Else writing generic
> > > applications will be really difficult and it will not be easy to adapt by the
> > application developers.
> > > > In this particular case, it is better for NXP to go with direct eth
> > > > enque mode
> > > rather than TX adapter. Note that crypto adapter already provide that
> > mode.
> > > However we are trying to adjust so that applications do not become
> > complex.
> > >
> > > Why? If you think direct queue model as use case if you might as well
> > > write "ethdev" driver and internally use atomic schedule type.
> > >
> > >
> > > > In the existing code also we have two modes in the application to
> > > > send the
> > > packets out - one is 'rte_event_enqueue_burst' and other is
> > > 'rte_event_eth_tx_adapter_enqueue'.
> > > > It is still cumbersome for the application to maintain separate
> > > > modes. This
> > > increases when crypto/timer is also being used in event mode.
> > >
> > > I think, we have two things here
> > > a) specialized API for specific work like
> > > rte_event_enqueue_new_burst() or
> > rte_event_enqueue_forward_burst() vs
> > > generic rte_event_enqueue_burst().
> > > I think, that does not NOT any harm as the application can use
> > > optimized routine if required(no separate code path case)
> > >
> > > b) different code path
> > > I agree, this is something I don't like and we would like to avoid.
> > > But this specific case, We took the comprise to avoid any performance
> > > impact for SW or HW model.
> > > It is a public discussion and it is here
> > >
> > >
> > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> > >
> > es.dpdk.org%2Fpatch%2F40426%2F&amp;data=02%7C01%7Chemant.agrawa
> > l%40nxp
> > >
> > .com%7Cdad3dcb7aa684656d9f508d747c8bac8%7C686ea1d3bc2b4c6fa92cd99
> > c5c30
> > >
> > 1635%7C0%7C0%7C637056799769535589&amp;sdata=iCmksK0xZ%2BYpPaZ9
> > McG1HHuE
> > > mi1No1MaAqdsO2vIkEo%3D&amp;reserved=0
> > >
> > > >
> > > > Why do we not used the 'rte_event->event_type' for TX as well, and
> > > 'rte_event_enqueue_burst', API to internally (in respective event
> > > driver) send the packet to the respective eth/crypto/timer Tx
> > > function? It makes more sense to have a common framework to send
> > > packets, rather than having multiple API's?
> > >
> > > If we make rte_event_enqueue_burst() to send the packet then:
> > > - HW eventdev driver + External PCI network card use case won't work
> > > as you are overriding event driver enqueue which has no clue on the
> > > external PCI network card vs integrated network controller.
> > > - Additional switch cases rte_event_enqueue_burst() in generic
> > > function aka performance impact.
> > > - There are multiple SW eventdev drivers, whose generic enqueue()
> > > function can not be changed to handle Tx adapter enqueue + add new
> > > switch case
> > > - Both SW and HW can use rte_event_eth_tx_adapter_enqueue() to send
> > > the packet to have unified fast path. i.e The callback can be attached
> > > to SW tx adapter or HW routine to send the packet.
> >
> >
> > > But I am not able to recollect, Why Nikhil would like to use the
> > > separate functions. Nikhil could you remind us why
> > > rte_event_eth_tx_adapter_enqueue() can not be used for sending the
> > > packet for SW Tx adapter.
> > >
> > [Nikhil] The goal was to keep the workers using the loop below.
> >
> > while (1) {
> >         rte_event_dequeue_burst(...);
> >         (event processing)
> >         rte_event_enqueue_burst(...);
> > }

We do have specialized functions for specific enqueue use case like
rte_event_enqueue_new_burst() or
rte_event_enqueue_forward_burst() to avoid any performance impact.

Since PMD agruments are same for rte_event_enqueue_burst() and
rte_event_eth_tx_adapter_enqueue()
assigning simple function pointer assignment to
rte_event_eth_tx_adapter_enqueue as dev->txa_enqueue =
dev->enqueue_burst
would have worked to have same Tx function across all platfroms
without peformance overhead.
Offcouse I understand, Slow path direct event enqueue assigment needs
different treatment.


ie in fastpath.

while (1) {
       rte_event_dequeue_burst(...);
      if (tx_stage)
        rte_event_eth_tx_adapter_enqueue()...
}

What do you say?

> >
> [Hemant] So everyone has a different way for sending the packet.
>         - intel wants direct event enqueue
>         - Marvel/Cavium wants adapters
>         - NXP don’t' want to use event for TX path. - but we can use adapter if minor adjustments are made.

OK. Lets add the flag in Tx adapter so that NXP use case also
satsified with single code flow.

I would suggent to use const compiler  optimization technique for the
flags like in rte_event_dequeue_burst() so that builtin const case it
has zero overhead.

rte_event_eth_tx_adapter_enqueue(..., const uint8_t flags)
{

if (flag)
    dev->txa_enqueue_new_pmd_op(dev->data->ports[port_id], ev, nb_events, flag)
else
     dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
}

}
>
> > Thanks,
> > Nikhil
> >
> > > Nothing is set and stone. We can always improve the API if required.
> > >
> > >
> > > >
> > > >
> > > > >
> > > > >
> > > > >
> > > > > >
> > > > > > Regards,
> > > > > > Nipun
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > > > > > > > > > > ---
> > > > > > > > > > > >  app/test-eventdev/test_pipeline_common.h          |  6
> > +++---
> > > > > > > > > > > >  .../prog_guide/event_ethernet_tx_adapter.rst      |  3 ++-
> > > > > > > > > > > >  drivers/event/octeontx/ssovf_evdev.h              |  2 +-
> > > > > > > > > > > >  drivers/event/octeontx/ssovf_worker.c             |  3 ++-
> > > > > > > > > > > >  drivers/event/octeontx2/otx2_evdev.h              | 12
> > ++++++++--
> > > --
> > > > > > > > > > > >  drivers/event/octeontx2/otx2_worker.c             |  8
> > ++++++--
> > > > > > > > > > > >  drivers/event/octeontx2/otx2_worker_dual.c        |  8
> > ++++++--
> > > > > > > > > > > >  lib/librte_eventdev/rte_event_eth_tx_adapter.h    | 15
> > > > > > > > > +++++++++++++--
> > > > > > > > > > > >  lib/librte_eventdev/rte_eventdev.c                |  3 ++-
> > > > > > > > > > > >  lib/librte_eventdev/rte_eventdev.h                |  2 +-
> > > > > > > > > > > >  10 files changed, 44 insertions(+), 18 deletions(-)
> > > > > > > > > > > >
> > > > > > > > > > > > diff --git
> > > > > > > > > > > > a/app/test-eventdev/test_pipeline_common.h
> > > > > > > b/app/test-
> > > > > > > > > > > eventdev/test_pipeline_common.h
> > > > > > > > > > > > index 0440b9e29..6e73c6ab2 100644
> > > > > > > > > > > > --- a/app/test-eventdev/test_pipeline_common.h
> > > > > > > > > > > > +++ b/app/test-eventdev/test_pipeline_common.h
> > > > > > > > > > > > @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t
> > > > > > > > > > > > dev, const
> > > > > > > > > uint8_t
> > > > > > > > > > > port,
> > > > > > > > > > > >                 struct rte_event * const ev)  {
> > > > > > > > > > > >         rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
> > > > > > > > > > > > -       while (!rte_event_eth_tx_adapter_enqueue(dev,
> > port, ev,
> > > > > 1))
> > > > > > > > > > > > +       while
> > > > > > > > > > > > + (!rte_event_eth_tx_adapter_enqueue(dev,
> > > > > > > > > > > > + port, ev, 1,
> > > > > > > 0))
> > > > > > > > > > > >                 rte_pause();  }
> > > > > > > > > > > >
> > > > > > > > > > > > @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const
> > > > > > > > > > > > uint8_t
> > > > > > > dev,
> > > > > > > > > const
> > > > > > > > > > > uint8_t port,
> > > > > > > > > > > >  {
> > > > > > > > > > > >         uint16_t enq;
> > > > > > > > > > > >
> > > > > > > > > > > > -       enq = rte_event_eth_tx_adapter_enqueue(dev, port,
> > ev,
> > > > > > > nb_rx);
> > > > > > > > > > > > +       enq = rte_event_eth_tx_adapter_enqueue(dev,
> > > > > > > > > > > > + port, ev,
> > > > > > > nb_rx,
> > > > > > > > > 0);
> > > > > > > > > > > >         while (enq < nb_rx) {
> > > > > > > > > > > >                 enq += rte_event_eth_tx_adapter_enqueue(dev,
> > port,
> > > > > > > > > > > > -                               ev + enq, nb_rx - enq);
> > > > > > > > > > > > +                               ev + enq, nb_rx -
> > > > > > > > > > > > + enq, 0);
> > > > > > > > > > > >         }
> > > > > > > > > > > >  }
> > > > > > > > > > > >
> > > > > > > > > > > > diff --git
> > > > > > > > > > > > a/doc/guides/prog_guide/event_ethernet_tx_adapter.rs
> > > > > > > > > > > > t
> > > > > > > > > > > b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > > > > > > > > > > > index 192f9e1cf..a8c13e136 100644
> > > > > > > > > > > > ---
> > > > > > > > > > > > a/doc/guides/prog_guide/event_ethernet_tx_adapter.rs
> > > > > > > > > > > > t
> > > > > > > > > > > > +++
> > b/doc/guides/prog_guide/event_ethernet_tx_adapter.
> > > > > > > > > > > > +++ rst
> > > > > > > > > > > > @@ -137,11 +137,12 @@ should use the
> > > > > > > > > ``rte_event_enqueue_burst()``
> > > > > > > > > > > function.
> > > > > > > > > > > >         if (cap &
> > > > > > > > > > > > RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> > > > > > > {
> > > > > > > > > > > >
> > > > > > > > > > > >                 event.mbuf = m;
> > > > > > > > > > > > +               eq_flags = 0;
> > > > > > > > > > > >
> > > > > > > > > > > >                 m->port = tx_port;
> > > > > > > > > > > >                 rte_event_eth_tx_adapter_txq_set(m,
> > > > > > > > > > > > tx_queue_id);
> > > > > > > > > > > >
> > > > > > > > > > > > -               rte_event_eth_tx_adapter_enqueue(dev_id,
> > ev_port,
> > > > > > > &event,
> > > > > > > > > 1);
> > > > > > > > > > > > +
> > > > > > > > > > > > + rte_event_eth_tx_adapter_enqueue(dev_id,
> > > > > > > > > > > > + ev_port,
> > > > > > > > > &event, 1,
> > > > > > > > > > > eq_flags);
> > > > > > > > > > > >         } else {
> > > > > > > > > > > >
> > > > > > > > > > > >                 event.queue_id = qid; /* event queue
> > > > > > > > > > > > linked to adapter
> > > > > > > port */
> > > > > > > > > > > > diff --git a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > > b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > > > index 0e622152c..1b156edab 100644
> > > > > > > > > > > > --- a/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > > > +++ b/drivers/event/octeontx/ssovf_evdev.h
> > > > > > > > > > > > @@ -181,7 +181,7 @@ void ssows_flush_events(struct
> > > > > > > > > > > > ssows *ws,
> > > > > > > > > uint8_t
> > > > > > > > > > > queue_id,
> > > > > > > > > > > >                 ssows_handle_event_t fn, void *arg);
> > > > > > > > > > > > void ssows_reset(struct ssows *ws);  uint16_t
> > > > > > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > > > > -               struct rte_event ev[], uint16_t nb_events);
> > > > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > > > + nb_events, uint8_t
> > > > > > > eq_flags);
> > > > > > > > > > > >  int ssovf_info(struct ssovf_info *info);  void
> > > > > > > > > > > > *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t
> > > > > > > > > > > > bar); int test_eventdev_octeontx(void); diff --git
> > > > > > > > > > > > a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > > b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > > > index d940b5dd6..1d0467af3 100644
> > > > > > > > > > > > --- a/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > > > +++ b/drivers/event/octeontx/ssovf_worker.c
> > > > > > > > > > > > @@ -264,7 +264,7 @@ ssows_reset(struct ssows *ws)
> > > > > > > > > > > >
> > > > > > > > > > > >  uint16_t
> > > > > > > > > > > >  sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > > > > -               struct rte_event ev[], uint16_t nb_events)
> > > > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > > > + nb_events, uint8_t eq_flags)
> > > > > > > > > > > >  {
> > > > > > > > > > > >         uint16_t port_id;
> > > > > > > > > > > >         uint16_t queue_id; @@ -275,6 +275,7 @@
> > > > > > > > > > > > sso_event_tx_adapter_enqueue(void *port,
> > > > > > > > > > > >         octeontx_dq_t *dq;
> > > > > > > > > > > >
> > > > > > > > > > > >         RTE_SET_USED(nb_events);
> > > > > > > > > > > > +       RTE_SET_USED(eq_flags);
> > > > > > > > > > > >         switch (ev->sched_type) {
> > > > > > > > > > > >         case SSO_SYNC_ORDERED:
> > > > > > > > > > > >                 ssows_swtag_norm(ws, ev->event,
> > > > > > > > > > > > SSO_SYNC_ATOMIC); diff --git
> > > > > > > > > > > > a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > > b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > > > index 5cd80e3b2..74b749a15 100644
> > > > > > > > > > > > --- a/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_evdev.h
> > > > > > > > > > > > @@ -333,16 +333,20 @@
> > > > > SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > > > >
> > > > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                              \
> > > > > > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void
> > > > > > > > > > > > *port, struct
> > > > > > > > > rte_event
> > > > > > > > > > > ev[],\
> > > > > > > > > > > > -                                          uint16_t nb_events);              \
> > > > > > > > > > > > +                                          uint16_t nb_events,               \
> > > > > > > > > > > > +                                          uint8_t eq_flags);                \
> > > > > > > > > > > >  uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void
> > > > > > > > > > > > *port,
> > > > > > > > > \
> > > > > > > > > > > >                                                struct rte_event ev[],        \
> > > > > > > > > > > > -                                              uint16_t nb_events);          \
> > > > > > > > > > > > +                                              uint16_t nb_events,           \
> > > > > > > > > > > > +                                              uint8_t eq_flags);            \
> > > > > > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_ ##
> > > > > > > > > > > > name(void *port,
> > > > > > > > > \
> > > > > > > > > > > >                                                 struct rte_event ev[],       \
> > > > > > > > > > > > -                                               uint16_t nb_events);         \
> > > > > > > > > > > > +                                               uint16_t nb_events,          \
> > > > > > > > > > > > +                                               uint8_t eq_flags);           \
> > > > > > > > > > > >  uint16_t otx2_ssogws_dual_tx_adptr_enq_seg_ ##
> > > > > > > > > > > > name(void
> > > > > > > *port,
> > > > > > > > > > > \
> > > > > > > > > > > >                                                     struct rte_event ev[],   \
> > > > > > > > > > > > -                                                   uint16_t nb_events);     \
> > > > > > > > > > > > +                                                   uint16_t nb_events,      \
> > > > > > > > > > > > +                                                   uint8_t eq_flags);       \
> > > > > > > > > > > >
> > > > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC  #undef T diff --
> > git
> > > > > > > > > > > > a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > > b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > > > index cd14cd3d2..100e21669 100644
> > > > > > > > > > > > --- a/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker.c
> > > > > > > > > > > > @@ -270,12 +270,14 @@
> > otx2_ssogws_enq_fwd_burst(void
> > > > > > > > > > > > *port,
> > > > > > > > > const
> > > > > > > > > > > struct rte_event ev[],
> > > > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > > > >  otx2_ssogws_tx_adptr_enq_ ## name(void *port,
> > > > > > > > > > > > struct rte_event
> > > > > > > > > ev[],   \
> > > > > > > > > > > > -                                 uint16_t nb_events)                   \
> > > > > > > > > > > > +                                 uint16_t nb_events,                   \
> > > > > > > > > > > > +                                 uint8_t eq_flags)                     \
> > > > > > > > > > > >  {                                                                      \
> > > > > > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > > > > > >                                                                         \
> > > > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd,
> > > > > > > > > > > > flags);
> > > \
> > > > > > > > > > > >  }
> > > > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -284,12
> > +286,14
> > > > > @@
> > > > > > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > > > >  #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
> > > > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > > > >  otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port,
> > > > > > > > > > > > struct
> > > > > > > > > rte_event ev[],\
> > > > > > > > > > > > -                                     uint16_t nb_events)               \
> > > > > > > > > > > > +                                     uint16_t nb_events,               \
> > > > > > > > > > > > +                                     uint8_t eq_flags)                 \
> > > > > > > > > > > >  {                                                                      \
> > > > > > > > > > > >         struct otx2_ssogws *ws = port;                                  \
> > > > > > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS -
> > > > > > > > > > > > 2];
> > > > > \
> > > > > > > > > > > >                                                                         \
> > > > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > > > >         return otx2_ssogws_event_tx(ws, ev, cmd,
> > > > > > > > > > > > (flags) |
> > > \
> > > > > > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > > > > > >  }
> > > > > > > > > > > > diff --git
> > > > > > > > > > > > a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > > b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > > > index 37c274a54..c3e48da42 100644
> > > > > > > > > > > > --- a/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > > > +++ b/drivers/event/octeontx2/otx2_worker_dual.c
> > > > > > > > > > > > @@ -310,7 +310,8 @@
> > > SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port,
> > > > > \
> > > > > > > > > > > >                                        struct rte_event ev[],           \
> > > > > > > > > > > > -                                      uint16_t nb_events)              \
> > > > > > > > > > > > +                                      uint16_t nb_events,              \
> > > > > > > > > > > > +                                      uint8_t eq_flags)                \
> > > > > > > > > > > >  {                                                                      \
> > > > > > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > > > > > @@ -318,6 +319,7 @@ otx2_ssogws_dual_tx_adptr_enq_
> > > > > > > > > > > > ##
> > > > > > > > > name(void *port,
> > > > > > > > > > > \
> > > > > > > > > > > >         uint64_t cmd[sz];                                               \
> > > > > > > > > > > >                                                                         \
> > > > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd,
> > > > > > > > > > > > flags);
> > > \
> > > > > > > > > > > >  }
> > > > > > > > > > > >  SSO_TX_ADPTR_ENQ_FASTPATH_FUNC @@ -327,7 +329,8
> > > @@
> > > > > > > > > > > > SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
> > > > > > > > > > > >  uint16_t __hot                                                         \
> > > > > > > > > > > >  otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void
> > > > > > > > > > > > *port,
> > > > > > > \
> > > > > > > > > > > >                                            struct rte_event ev[],       \
> > > > > > > > > > > > -                                          uint16_t nb_events)          \
> > > > > > > > > > > > +                                          uint16_t nb_events,          \
> > > > > > > > > > > > +                                          uint8_t eq_flags)            \
> > > > > > > > > > > >  {                                                                      \
> > > > > > > > > > > >         struct otx2_ssogws_dual *ws = port;                             \
> > > > > > > > > > > >         struct otx2_ssogws *vws =                                       \
> > > > > > > > > > > > @@ -335,6 +338,7 @@
> > > > > > > > > > > > otx2_ssogws_dual_tx_adptr_enq_seg_
> > > > > ##
> > > > > > > > > name(void
> > > > > > > > > > > *port,                      \
> > > > > > > > > > > >         uint64_t cmd[(sz) + NIX_TX_MSEG_SG_DWORDS -
> > > > > > > > > > > > 2];
> > > > > \
> > > > > > > > > > > >                                                                         \
> > > > > > > > > > > >         RTE_SET_USED(nb_events);                                        \
> > > > > > > > > > > > +       RTE_SET_USED(eq_flags);                                         \
> > > > > > > > > > > >         return otx2_ssogws_event_tx(vws, ev, cmd,
> > > > > > > > > > > > (flags) |
> > > \
> > > > > > > > > > > >                                     NIX_TX_MULTI_SEG_F);                \
> > > > > > > > > > > >  }
> > > > > > > > > > > > diff --git
> > > > > > > > > > > > a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > > > index c848261c4..98be77568 100644
> > > > > > > > > > > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> > > > > > > > > > > > @@ -300,6 +300,11 @@
> > > > > > > > > > > > rte_event_eth_tx_adapter_txq_get(struct
> > > > > > > > > rte_mbuf
> > > > > > > > > > > *pkt)
> > > > > > > > > > > >  int
> > > > > > > > > > > >  rte_event_eth_tx_adapter_event_port_get(uint8_t id,
> > > > > > > > > > > > uint8_t
> > > > > > > > > > > *event_port_id);
> > > > > > > > > > > >
> > > > > > > > > > > > +#define
> > > RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > > > > > 0x1
> > > > > > > > > > > > +/**< This flag is used when all the packets
> > > > > > > > > > > > +enqueued in the tx
> > > > > > > adapter
> > > > > > > > > are
> > > > > > > > > > > > + * destined for the same Ethernet device, queue pair.
> > > > > > > > > > > > + */
> > > > > > > > > > > > +
> > > > > > > > > > > >  /**
> > > > > > > > > > > >   * Enqueue a burst of events objects or an event
> > > > > > > > > > > > object supplied in
> > > > > > > > > > > *rte_event*
> > > > > > > > > > > >   * structure on an  event device designated by its
> > > > > > > > > > > > *dev_id* through
> > > > > > > > > the event
> > > > > > > > > > > > @@ -324,6 +329,10 @@
> > > > > > > > > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > > > > > > > > > id, uint8_t *event_port_id);
> > > > > > > > > > > >   *  The number of event objects to enqueue,
> > > > > > > > > > > > typically number
> > > of
> > > > > > > > > > > >   *
> > > > > > >
> > rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > > > > > > > > > > >   *  available for this port.
> > > > > > > > > > > > + * @param flags
> > > > > > > > > > > > + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > > > > > > > > > > + *
> > #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST
> > > > > > > signifies
> > > > > > > > > that all
> > > > > > > > > > > the packets
> > > > > > > > > > > > + *  which are enqueued are destined for the same
> > > > > > > > > > > > + Ethernet device,
> > > > > > > > > queue pair.
> > > > > > > > > > > >   *
> > > > > > > > > > > >   * @return
> > > > > > > > > > > >   *   The number of event objects actually enqueued on the
> > > event
> > > > > > > > > device. The
> > > > > > > > > > > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > > > > > > > > > > rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > > > > > > > > > > >                                 uint8_t port_id,
> > > > > > > > > > > >                                 struct rte_event ev[],
> > > > > > > > > > > > -                               uint16_t nb_events)
> > > > > > > > > > > > +                               uint16_t nb_events,
> > > > > > > > > > > > +                               uint8_t flags)
> > > > > > > > > > > >  {
> > > > > > > > > > > >         const struct rte_eventdev *dev =
> > > > > > > > > > > > &rte_eventdevs[dev_id];
> > > > > > > > > > > >
> > > > > > > > > > > > @@ -359,7 +369,8 @@
> > > > > > > rte_event_eth_tx_adapter_enqueue(uint8_t
> > > > > > > > > dev_id,
> > > > > > > > > > > >                 return 0;
> > > > > > > > > > > >         }
> > > > > > > > > > > >  #endif
> > > > > > > > > > > > -       return dev->txa_enqueue(dev->data->ports[port_id],
> > ev,
> > > > > > > > > nb_events);
> > > > > > > > > > > > +       return dev->txa_enqueue(dev->data-
> > >ports[port_id], ev,
> > > > > > > > > > > > +                               nb_events, flags);
> > > > > > > > > > > >  }
> > > > > > > > > > > >
> > > > > > > > > > > >  /**
> > > > > > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > > b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > > > index f44c869cb..3bf9d7115 100644
> > > > > > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.c
> > > > > > > > > > > > @@ -1324,7 +1324,8 @@
> > > > > > > rte_eventdev_find_free_device_index(void)
> > > > > > > > > > > >  static uint16_t
> > > > > > > > > > > >  rte_event_tx_adapter_enqueue(__rte_unused void
> > *port,
> > > > > > > > > > > >                         __rte_unused struct rte_event ev[],
> > > > > > > > > > > > -                       __rte_unused uint16_t nb_events)
> > > > > > > > > > > > +                       __rte_unused uint16_t nb_events,
> > > > > > > > > > > > +                       __rte_unused uint8_t flags)
> > > > > > > > > > > >  {
> > > > > > > > > > > >         rte_errno = ENOTSUP;
> > > > > > > > > > > >         return 0;
> > > > > > > > > > > > diff --git a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > > b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > > > index 5044a13d0..2a5643da3 100644
> > > > > > > > > > > > --- a/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > > > +++ b/lib/librte_eventdev/rte_eventdev.h
> > > > > > > > > > > > @@ -1227,7 +1227,7 @@ typedef uint16_t
> > > > > > > > > (*event_dequeue_burst_t)(void
> > > > > > > > > > > *port, struct rte_event ev[],
> > > > > > > > > > > >  /**< @internal Dequeue burst of events from port of
> > > > > > > > > > > > a device */
> > > > > > > > > > > >
> > > > > > > > > > > >  typedef uint16_t (*event_tx_adapter_enqueue)(void
> > *port,
> > > > > > > > > > > > -                               struct rte_event ev[], uint16_t
> > nb_events);
> > > > > > > > > > > > +               struct rte_event ev[], uint16_t
> > > > > > > > > > > > + nb_events, uint8_t flags);
> > > > > > > > > > > >  /**< @internal Enqueue burst of events on port of a
> > > > > > > > > > > > device */
> > > > > > > > > > > >
> > > > > > > > > > > >  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
> > > > > > > > > > > > --
> > > > > > > > > > > > 2.17.1
> > > > > > > > > > > >

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

* [dpdk-dev] [PATCH v2] eventdev: flag to identify same destined packets enqueue
  2019-10-01  6:46 [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue Nipun Gupta
  2019-10-01  7:44 ` Jerin Jacob
  2019-10-01 14:42 ` Aaron Conole
@ 2019-10-04  6:55 ` Nipun Gupta
  2019-10-04  8:21   ` Jerin Jacob
  2019-10-04 10:47 ` [dpdk-dev] [PATCH v3] " Nipun Gupta
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 30+ messages in thread
From: Nipun Gupta @ 2019-10-04  6:55 UTC (permalink / raw)
  To: dev
  Cc: jerinj, aconole, pbhagavatula, skori, hemant.agrawal,
	bruce.richardson, marko.kovacevic, orika, radu.nicolau,
	tomasz.kantecki, harry.van.haaren, nikhil.rao, Nipun Gupta

This patch introduces a `flag` in the Eth TX adapter enqueue API.
Some drivers may support burst functionality only with the packets
having same destination device and queue.

The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
to indicate this so the underlying driver, for drivers to utilize
burst functionality appropriately.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---

Changes in v2:
 - have separate internal API in tx adapter for sending burst packets to
   same eth dev, queue pair on the basis of the passed flag
 - fix compilation of examples/eventdev_pipeline/

 app/test-eventdev/test_pipeline_common.h      |  6 +++---
 .../prog_guide/event_ethernet_tx_adapter.rst  |  3 ++-
 .../eventdev_pipeline/pipeline_worker_tx.c    |  2 +-
 .../rte_event_eth_tx_adapter.h                | 19 +++++++++++++++++--
 lib/librte_eventdev/rte_eventdev.c            | 12 ++++++++++++
 lib/librte_eventdev/rte_eventdev.h            |  9 +++++++++
 6 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
index 0440b9e29..6e73c6ab2 100644
--- a/app/test-eventdev/test_pipeline_common.h
+++ b/app/test-eventdev/test_pipeline_common.h
@@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t port,
 		struct rte_event * const ev)
 {
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
@@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const uint8_t port,
 {
 	uint16_t enq;
 
-	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
+	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
 	while (enq < nb_rx) {
 		enq += rte_event_eth_tx_adapter_enqueue(dev, port,
-				ev + enq, nb_rx - enq);
+				ev + enq, nb_rx - enq, 0);
 	}
 }
 
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index 192f9e1cf..a8c13e136 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()`` function.
 	if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
 
 		event.mbuf = m;
+		eq_flags = 0;
 
 		m->port = tx_port;
 		rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
 
-		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
+		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1, eq_flags);
 	} else {
 
 		event.queue_id = qid; /* event queue linked to adapter port */
diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c
index 8961cd656..a0f40c27c 100644
--- a/examples/eventdev_pipeline/pipeline_worker_tx.c
+++ b/examples/eventdev_pipeline/pipeline_worker_tx.c
@@ -40,7 +40,7 @@ worker_tx_pkt(const uint8_t dev, const uint8_t port, struct rte_event *ev)
 {
 	exchange_mac(ev->mbuf);
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
index c848261c4..f552b6023 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
@@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
 int
 rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
 
+#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST	0x1
+/**< This flag is used when all the packets enqueued in the tx adapter are
+ * destined for the same Ethernet device, queue pair.
+ */
+
 /**
  * Enqueue a burst of events objects or an event object supplied in *rte_event*
  * structure on an  event device designated by its *dev_id* through the event
@@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
  *  The number of event objects to enqueue, typically number of
  *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
  *  available for this port.
+ * @param flags
+ *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
+ *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets
+ *  which are enqueued are destined for the same Ethernet device, queue pair.
  *
  * @return
  *   The number of event objects actually enqueued on the event device. The
@@ -343,7 +352,8 @@ static inline uint16_t
 rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 				uint8_t port_id,
 				struct rte_event ev[],
-				uint16_t nb_events)
+				uint16_t nb_events,
+				const uint8_t flags)
 {
 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
 
@@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 		return 0;
 	}
 #endif
-	return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
+	if (flags)
+		return dev->txa_enqueue_same_dest(dev->data->ports[port_id],
+						  ev, nb_events, flags);
+	else
+		return dev->txa_enqueue(dev->data->ports[port_id], ev,
+					nb_events);
 }
 
 /**
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index f44c869cb..7c8ffdfef 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -1330,6 +1330,16 @@ rte_event_tx_adapter_enqueue(__rte_unused void *port,
 	return 0;
 }
 
+static uint16_t
+rte_event_tx_adapter_enqueue_same_dest(__rte_unused void *port,
+			__rte_unused struct rte_event ev[],
+			__rte_unused uint16_t nb_events,
+			__rte_unused const uint8_t flags)
+{
+	rte_errno = ENOTSUP;
+	return 0;
+}
+
 struct rte_eventdev *
 rte_event_pmd_allocate(const char *name, int socket_id)
 {
@@ -1351,6 +1361,8 @@ rte_event_pmd_allocate(const char *name, int socket_id)
 	eventdev = &rte_eventdevs[dev_id];
 
 	eventdev->txa_enqueue = rte_event_tx_adapter_enqueue;
+	eventdev->txa_enqueue_same_dest =
+			rte_event_tx_adapter_enqueue_same_dest;
 
 	if (eventdev->data == NULL) {
 		struct rte_eventdev_data *eventdev_data = NULL;
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 5044a13d0..ea61f52f6 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1230,6 +1230,13 @@ typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
 				struct rte_event ev[], uint16_t nb_events);
 /**< @internal Enqueue burst of events on port of a device */
 
+typedef uint16_t (*event_tx_adapter_enqueue_same_dest)(void *port,
+		struct rte_event ev[], uint16_t nb_events,
+		const uint8_t flags);
+/**< @internal Enqueue burst of events on port of a device supporting flag to
+ * indicate burst having same dest eth port and queue.
+ */
+
 #define RTE_EVENTDEV_NAME_MAX_LEN	(64)
 /**< @internal Max length of name of event PMD */
 
@@ -1292,6 +1299,8 @@ struct rte_eventdev {
 	/**< Pointer to PMD dequeue function. */
 	event_dequeue_burst_t dequeue_burst;
 	/**< Pointer to PMD dequeue burst function. */
+	event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest;
+	/**< Pointer to PMD eth Tx adapter enqueue burst function. */
 	event_tx_adapter_enqueue txa_enqueue;
 	/**< Pointer to PMD eth Tx adapter enqueue function. */
 	struct rte_eventdev_data *data;
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v2] eventdev: flag to identify same destined packets enqueue
  2019-10-04  6:55 ` [dpdk-dev] [PATCH v2] " Nipun Gupta
@ 2019-10-04  8:21   ` Jerin Jacob
  0 siblings, 0 replies; 30+ messages in thread
From: Jerin Jacob @ 2019-10-04  8:21 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: dpdk-dev, Jerin Jacob, aconole, Pavan Nikhilesh,
	Sunil Kumar Kori, Hemant Agrawal, Richardson, Bruce,
	Marko Kovacevic, Ori Kam, Radu Nicolau, Tomasz Kantecki,
	Van Haaren, Harry, Rao, Nikhil, Ray Kinsella, Thomas Monjalon,
	techboard

On Fri, Oct 4, 2019 at 12:41 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
> This patch introduces a `flag` in the Eth TX adapter enqueue API.
> Some drivers may support burst functionality only with the packets
> having same destination device and queue.
>
> The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
> to indicate this so the underlying driver, for drivers to utilize
> burst functionality appropriately.
>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>
> Changes in v2:
>  - have separate internal API in tx adapter for sending burst packets to
>    same eth dev, queue pair on the basis of the passed flag
>  - fix compilation of examples/eventdev_pipeline/
>
>  app/test-eventdev/test_pipeline_common.h      |  6 +++---
>  .../prog_guide/event_ethernet_tx_adapter.rst  |  3 ++-
>  .../eventdev_pipeline/pipeline_worker_tx.c    |  2 +-
>  .../rte_event_eth_tx_adapter.h                | 19 +++++++++++++++++--
>  lib/librte_eventdev/rte_eventdev.c            | 12 ++++++++++++
>  lib/librte_eventdev/rte_eventdev.h            |  9 +++++++++

It is an ABI change so please update

a) lib/librte_eventdev/Makefile
b) lib/librte_eventdev/meson.build
c) doc/guides/rel_notes/release_19_11.rst

Please see c2189c907dd191b909ce1f18487d46410782e370 as reference.

If anyone has any objection for treating this ABI change as an
exception(ABI change without depreciation notice in advance)
then please shout.



>  6 files changed, 44 insertions(+), 7 deletions(-)
>

> diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> index c848261c4..f552b6023 100644
> --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
> @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
>  int
>  rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
>
> +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST     0x1
> +/**< This flag is used when all the packets enqueued in the tx adapter are
> + * destined for the same Ethernet device, queue pair.

I would say "Ethernet port and Tx queue"

> + */
> +
>  /**
>   * Enqueue a burst of events objects or an event object supplied in *rte_event*
>   * structure on an  event device designated by its *dev_id* through the event
> @@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
>   *  The number of event objects to enqueue, typically number of
>   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
>   *  available for this port.
> + * @param flags
> + *  See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.

Change to @see

> + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets
> + *  which are enqueued are destined for the same Ethernet device, queue pair.

Same as above. Please check generated doxgen API output.

>   *
>   * @return
>   *   The number of event objects actually enqueued on the event device. The
> @@ -343,7 +352,8 @@ static inline uint16_t
>  rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
>                                 uint8_t port_id,
>                                 struct rte_event ev[],
> -                               uint16_t nb_events)
> +                               uint16_t nb_events,
> +                               const uint8_t flags)
>  {
>         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
>
> @@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
>                 return 0;
>         }
>  #endif
> -       return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
> +       if (flags)
> +               return dev->txa_enqueue_same_dest(dev->data->ports[port_id],
> +                                                 ev, nb_events, flags);
> +       else
> +               return dev->txa_enqueue(dev->data->ports[port_id], ev,
> +                                       nb_events);
>  }
>
>  /**
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index f44c869cb..7c8ffdfef 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -1330,6 +1330,16 @@ rte_event_tx_adapter_enqueue(__rte_unused void *port,
>         return 0;
>  }
>
> +static uint16_t
> +rte_event_tx_adapter_enqueue_same_dest(__rte_unused void *port,
> +                       __rte_unused struct rte_event ev[],
> +                       __rte_unused uint16_t nb_events,
> +                       __rte_unused const uint8_t flags)
> +{
> +       rte_errno = ENOTSUP;
> +       return 0;
> +}
> +
>  struct rte_eventdev *
>  rte_event_pmd_allocate(const char *name, int socket_id)
>  {
> @@ -1351,6 +1361,8 @@ rte_event_pmd_allocate(const char *name, int socket_id)
>         eventdev = &rte_eventdevs[dev_id];
>
>         eventdev->txa_enqueue = rte_event_tx_adapter_enqueue;
> +       eventdev->txa_enqueue_same_dest =
> +                       rte_event_tx_adapter_enqueue_same_dest;
>
>         if (eventdev->data == NULL) {
>                 struct rte_eventdev_data *eventdev_data = NULL;
> diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
> index 5044a13d0..ea61f52f6 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -1230,6 +1230,13 @@ typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
>                                 struct rte_event ev[], uint16_t nb_events);
>  /**< @internal Enqueue burst of events on port of a device */
>
> +typedef uint16_t (*event_tx_adapter_enqueue_same_dest)(void *port,
> +               struct rte_event ev[], uint16_t nb_events,
> +               const uint8_t flags);
> +/**< @internal Enqueue burst of events on port of a device supporting flag to
> + * indicate burst having same dest eth port and queue.

s/queue/Tx queue

> + */
> +
>  #define RTE_EVENTDEV_NAME_MAX_LEN      (64)
>  /**< @internal Max length of name of event PMD */
>
> @@ -1292,6 +1299,8 @@ struct rte_eventdev {
>         /**< Pointer to PMD dequeue function. */
>         event_dequeue_burst_t dequeue_burst;
>         /**< Pointer to PMD dequeue burst function. */
> +       event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest;
> +       /**< Pointer to PMD eth Tx adapter enqueue burst function. */

Is it really burst function? enqueue supports already support burst.
Please change the description.

>         event_tx_adapter_enqueue txa_enqueue;
>         /**< Pointer to PMD eth Tx adapter enqueue function. */
>         struct rte_eventdev_data *data;
> --
> 2.17.1
>

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

* [dpdk-dev] [PATCH v3] eventdev: flag to identify same destined packets enqueue
  2019-10-01  6:46 [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue Nipun Gupta
                   ` (2 preceding siblings ...)
  2019-10-04  6:55 ` [dpdk-dev] [PATCH v2] " Nipun Gupta
@ 2019-10-04 10:47 ` Nipun Gupta
  2019-10-05 16:23   ` Jerin Jacob
  2019-10-09  7:32 ` [dpdk-dev] [PATCH v4] " Nipun Gupta
  2019-10-11 13:03 ` [dpdk-dev] [PATCH v5] " Nipun Gupta
  5 siblings, 1 reply; 30+ messages in thread
From: Nipun Gupta @ 2019-10-04 10:47 UTC (permalink / raw)
  To: dev
  Cc: jerinj, aconole, pbhagavatula, skori, hemant.agrawal,
	bruce.richardson, marko.kovacevic, orika, radu.nicolau,
	tomasz.kantecki, harry.van.haaren, nikhil.rao, Nipun Gupta

This patch introduces a `flag` in the Eth TX adapter enqueue API.
Some drivers may support burst functionality only with the packets
having same destination device and queue.

The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
to indicate this so the underlying driver, for drivers to utilize
burst functionality appropriately.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---

Changes in v3:
 - remove flag from internal txa_enqueue_same_dest internal API
 - ABI version update in makefile, meson and rel_notes
 - Few comments update

Changes in v2:
 - have separate internal API in tx adapter for sending burst packets to
   same eth dev, queue pair on the basis of the passed flag
 - fix compilation of examples/eventdev_pipeline/

 app/test-eventdev/test_pipeline_common.h      |  6 +++---
 .../prog_guide/event_ethernet_tx_adapter.rst  |  3 ++-
 doc/guides/rel_notes/release_19_11.rst        |  2 +-
 .../eventdev_pipeline/pipeline_worker_tx.c    |  2 +-
 lib/librte_eventdev/Makefile                  |  2 +-
 lib/librte_eventdev/meson.build               |  2 +-
 .../rte_event_eth_tx_adapter.h                | 19 +++++++++++++++++--
 lib/librte_eventdev/rte_eventdev.c            | 11 +++++++++++
 lib/librte_eventdev/rte_eventdev.h            | 10 ++++++++++
 9 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
index 0440b9e29..6e73c6ab2 100644
--- a/app/test-eventdev/test_pipeline_common.h
+++ b/app/test-eventdev/test_pipeline_common.h
@@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t port,
 		struct rte_event * const ev)
 {
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
@@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const uint8_t port,
 {
 	uint16_t enq;
 
-	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
+	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
 	while (enq < nb_rx) {
 		enq += rte_event_eth_tx_adapter_enqueue(dev, port,
-				ev + enq, nb_rx - enq);
+				ev + enq, nb_rx - enq, 0);
 	}
 }
 
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index 192f9e1cf..a8c13e136 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()`` function.
 	if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
 
 		event.mbuf = m;
+		eq_flags = 0;
 
 		m->port = tx_port;
 		rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
 
-		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
+		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1, eq_flags);
 	} else {
 
 		event.queue_id = qid; /* event queue linked to adapter port */
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 27cfbd9e3..e589e020e 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -146,7 +146,7 @@ The libraries prepended with a plus sign were incremented in this version.
      librte_eal.so.11
      librte_efd.so.1
      librte_ethdev.so.12
-     librte_eventdev.so.7
+     librte_eventdev.so.8
      librte_flow_classify.so.1
      librte_gro.so.1
      librte_gso.so.1
diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c
index 8961cd656..a0f40c27c 100644
--- a/examples/eventdev_pipeline/pipeline_worker_tx.c
+++ b/examples/eventdev_pipeline/pipeline_worker_tx.c
@@ -40,7 +40,7 @@ worker_tx_pkt(const uint8_t dev, const uint8_t port, struct rte_event *ev)
 {
 	exchange_mac(ev->mbuf);
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
index cd3ff8040..9e6a99aa1 100644
--- a/lib/librte_eventdev/Makefile
+++ b/lib/librte_eventdev/Makefile
@@ -8,7 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_eventdev.a
 
 # library version
-LIBABIVER := 7
+LIBABIVER := 8
 
 # build flags
 CFLAGS += -DALLOW_EXPERIMENTAL_API
diff --git a/lib/librte_eventdev/meson.build b/lib/librte_eventdev/meson.build
index 19541f23f..9ba6c0393 100644
--- a/lib/librte_eventdev/meson.build
+++ b/lib/librte_eventdev/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-version = 7
+version = 8
 allow_experimental_apis = true
 
 if is_linux
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
index c848261c4..93b717af9 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
@@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
 int
 rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
 
+#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST	0x1
+/**< This flag is used when all the packets enqueued in the tx adapter are
+ * destined for the same Ethernet port & Tx queue.
+ */
+
 /**
  * Enqueue a burst of events objects or an event object supplied in *rte_event*
  * structure on an  event device designated by its *dev_id* through the event
@@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
  *  The number of event objects to enqueue, typically number of
  *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
  *  available for this port.
+ * @param flags
+ *  RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
+ *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets
+ *  which are enqueued are destined for the same Ethernet port & Tx queue.
  *
  * @return
  *   The number of event objects actually enqueued on the event device. The
@@ -343,7 +352,8 @@ static inline uint16_t
 rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 				uint8_t port_id,
 				struct rte_event ev[],
-				uint16_t nb_events)
+				uint16_t nb_events,
+				const uint8_t flags)
 {
 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
 
@@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 		return 0;
 	}
 #endif
-	return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
+	if (flags)
+		return dev->txa_enqueue_same_dest(dev->data->ports[port_id],
+						  ev, nb_events);
+	else
+		return dev->txa_enqueue(dev->data->ports[port_id], ev,
+					nb_events);
 }
 
 /**
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index f44c869cb..c66b3e7ef 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -1330,6 +1330,15 @@ rte_event_tx_adapter_enqueue(__rte_unused void *port,
 	return 0;
 }
 
+static uint16_t
+rte_event_tx_adapter_enqueue_same_dest(__rte_unused void *port,
+			__rte_unused struct rte_event ev[],
+			__rte_unused uint16_t nb_events)
+{
+	rte_errno = ENOTSUP;
+	return 0;
+}
+
 struct rte_eventdev *
 rte_event_pmd_allocate(const char *name, int socket_id)
 {
@@ -1351,6 +1360,8 @@ rte_event_pmd_allocate(const char *name, int socket_id)
 	eventdev = &rte_eventdevs[dev_id];
 
 	eventdev->txa_enqueue = rte_event_tx_adapter_enqueue;
+	eventdev->txa_enqueue_same_dest =
+			rte_event_tx_adapter_enqueue_same_dest;
 
 	if (eventdev->data == NULL) {
 		struct rte_eventdev_data *eventdev_data = NULL;
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 5044a13d0..ced6f29d9 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1230,6 +1230,12 @@ typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
 				struct rte_event ev[], uint16_t nb_events);
 /**< @internal Enqueue burst of events on port of a device */
 
+typedef uint16_t (*event_tx_adapter_enqueue_same_dest)(void *port,
+		struct rte_event ev[], uint16_t nb_events);
+/**< @internal Enqueue burst of events on port of a device supporting
+ * burst having same destination Ethernet port & Tx queue.
+ */
+
 #define RTE_EVENTDEV_NAME_MAX_LEN	(64)
 /**< @internal Max length of name of event PMD */
 
@@ -1292,6 +1298,10 @@ struct rte_eventdev {
 	/**< Pointer to PMD dequeue function. */
 	event_dequeue_burst_t dequeue_burst;
 	/**< Pointer to PMD dequeue burst function. */
+	event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest;
+	/**< Pointer to PMD eth Tx adapter burst enqueue function with
+	 * events destined to same Eth port & Tx queue.
+	 */
 	event_tx_adapter_enqueue txa_enqueue;
 	/**< Pointer to PMD eth Tx adapter enqueue function. */
 	struct rte_eventdev_data *data;
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v3] eventdev: flag to identify same destined packets enqueue
  2019-10-04 10:47 ` [dpdk-dev] [PATCH v3] " Nipun Gupta
@ 2019-10-05 16:23   ` Jerin Jacob
  0 siblings, 0 replies; 30+ messages in thread
From: Jerin Jacob @ 2019-10-05 16:23 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: dpdk-dev, Jerin Jacob, aconole, Pavan Nikhilesh,
	Sunil Kumar Kori, Hemant Agrawal, Richardson, Bruce,
	Marko Kovacevic, Ori Kam, Radu Nicolau, Tomasz Kantecki,
	Van Haaren, Harry, Rao, Nikhil

On Fri, Oct 4, 2019 at 4:33 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
> This patch introduces a `flag` in the Eth TX adapter enqueue API.
> Some drivers may support burst functionality only with the packets
> having same destination device and queue.
>
> The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
> to indicate this so the underlying driver, for drivers to utilize
> burst functionality appropriately.
>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>
> Changes in v3:
>  - remove flag from internal txa_enqueue_same_dest internal API
>  - ABI version update in makefile, meson and rel_notes
>  - Few comments update
>
> Changes in v2:
>  - have separate internal API in tx adapter for sending burst packets to
>    same eth dev, queue pair on the basis of the passed flag
>  - fix compilation of examples/eventdev_pipeline/

>                 event.queue_id = qid; /* event queue linked to adapter port */
> diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
> index 27cfbd9e3..e589e020e 100644
> --- a/doc/guides/rel_notes/release_19_11.rst
> +++ b/doc/guides/rel_notes/release_19_11.rst
> @@ -146,7 +146,7 @@ The libraries prepended with a plus sign were incremented in this version.
>       librte_eal.so.11
>       librte_efd.so.1
>       librte_ethdev.so.12
> -     librte_eventdev.so.7
> +     librte_eventdev.so.8
>       librte_flow_classify.so.1
>       librte_gro.so.1
>       librte_gso.so.1


Forgot to update "API Changes" section in doc/guides/rel_notes/release_19_11.rst

> +static uint16_t
> +rte_event_tx_adapter_enqueue_same_dest(__rte_unused void *port,
> +                       __rte_unused struct rte_event ev[],
> +                       __rte_unused uint16_t nb_events)
> +{
> +       rte_errno = ENOTSUP;
> +       return 0;
> +}
> +
>  struct rte_eventdev *
>  rte_event_pmd_allocate(const char *name, int socket_id)
>  {
> @@ -1351,6 +1360,8 @@ rte_event_pmd_allocate(const char *name, int socket_id)
>         eventdev = &rte_eventdevs[dev_id];
>
>         eventdev->txa_enqueue = rte_event_tx_adapter_enqueue;
> +       eventdev->txa_enqueue_same_dest =
> +                       rte_event_tx_adapter_enqueue_same_dest;

We may not need to add new rte_event_tx_adapter_enqueue_same_dest function
as it is same as rte_event_tx_adapter_enqueue() and can simply assign
txa_enqueue_same_dest  as rte_event_tx_adapter_enqueue. No strong
opinion on this.


With the above changes:
Acked-by: Jerin Jacob <jerinj@marvell.com>

I wait for a week for any review comments, If none, I will merge your
next revision.

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

* [dpdk-dev] [PATCH v4] eventdev: flag to identify same destined packets enqueue
  2019-10-01  6:46 [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue Nipun Gupta
                   ` (3 preceding siblings ...)
  2019-10-04 10:47 ` [dpdk-dev] [PATCH v3] " Nipun Gupta
@ 2019-10-09  7:32 ` Nipun Gupta
  2019-10-10 10:06   ` Rao, Nikhil
  2019-10-11 13:03 ` [dpdk-dev] [PATCH v5] " Nipun Gupta
  5 siblings, 1 reply; 30+ messages in thread
From: Nipun Gupta @ 2019-10-09  7:32 UTC (permalink / raw)
  To: dev
  Cc: jerinj, aconole, pbhagavatula, skori, hemant.agrawal,
	bruce.richardson, marko.kovacevic, orika, radu.nicolau,
	tomasz.kantecki, harry.van.haaren, nikhil.rao, Nipun Gupta

This patch introduces a `flag` in the Eth TX adapter enqueue API.
Some drivers may support burst functionality only with the packets
having same destination device and queue.

The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
to indicate this so the underlying driver, for drivers to utilize
burst functionality appropriately.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---

Changes in v4:
 - Update rel note specifying the API change
 - Remove redundant rte_event_tx_adapter_enqueue_same_dest API

Changes in v3:
 - remove flag from internal txa_enqueue_same_dest internal API
 - ABI version update in makefile, meson and rel_notes
 - Few comments update

Changes in v2:
 - have separate internal API in tx adapter for sending burst packets to
   same eth dev, queue pair on the basis of the passed flag
 - fix compilation of examples/eventdev_pipeline/

 app/test-eventdev/test_pipeline_common.h      |  6 +++---
 .../prog_guide/event_ethernet_tx_adapter.rst  |  3 ++-
 doc/guides/rel_notes/release_19_11.rst        |  7 ++++++-
 .../eventdev_pipeline/pipeline_worker_tx.c    |  2 +-
 lib/librte_eventdev/Makefile                  |  2 +-
 lib/librte_eventdev/meson.build               |  2 +-
 .../rte_event_eth_tx_adapter.h                | 19 +++++++++++++++++--
 lib/librte_eventdev/rte_eventdev.c            |  1 +
 lib/librte_eventdev/rte_eventdev.h            | 10 ++++++++++
 9 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
index 0440b9e29..6e73c6ab2 100644
--- a/app/test-eventdev/test_pipeline_common.h
+++ b/app/test-eventdev/test_pipeline_common.h
@@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t port,
 		struct rte_event * const ev)
 {
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
@@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const uint8_t port,
 {
 	uint16_t enq;
 
-	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
+	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
 	while (enq < nb_rx) {
 		enq += rte_event_eth_tx_adapter_enqueue(dev, port,
-				ev + enq, nb_rx - enq);
+				ev + enq, nb_rx - enq, 0);
 	}
 }
 
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index 192f9e1cf..a8c13e136 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()`` function.
 	if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
 
 		event.mbuf = m;
+		eq_flags = 0;
 
 		m->port = tx_port;
 		rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
 
-		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
+		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1, eq_flags);
 	} else {
 
 		event.queue_id = qid; /* event queue linked to adapter port */
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 27cfbd9e3..051ab26b8 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -94,6 +94,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =========================================================
 
+* event: The function ``rte_event_eth_tx_adapter_enqueue`` takes an additional
+  input as ``flags``. Flag ``RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST`` which
+  has been introduced in this release is used when used when all the packets
+  enqueued in the tx adapter are destined for the same Ethernet port & Tx queue.
+
 
 ABI Changes
 -----------
@@ -146,7 +151,7 @@ The libraries prepended with a plus sign were incremented in this version.
      librte_eal.so.11
      librte_efd.so.1
      librte_ethdev.so.12
-     librte_eventdev.so.7
+     librte_eventdev.so.8
      librte_flow_classify.so.1
      librte_gro.so.1
      librte_gso.so.1
diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c
index 8961cd656..a0f40c27c 100644
--- a/examples/eventdev_pipeline/pipeline_worker_tx.c
+++ b/examples/eventdev_pipeline/pipeline_worker_tx.c
@@ -40,7 +40,7 @@ worker_tx_pkt(const uint8_t dev, const uint8_t port, struct rte_event *ev)
 {
 	exchange_mac(ev->mbuf);
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
index cd3ff8040..9e6a99aa1 100644
--- a/lib/librte_eventdev/Makefile
+++ b/lib/librte_eventdev/Makefile
@@ -8,7 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_eventdev.a
 
 # library version
-LIBABIVER := 7
+LIBABIVER := 8
 
 # build flags
 CFLAGS += -DALLOW_EXPERIMENTAL_API
diff --git a/lib/librte_eventdev/meson.build b/lib/librte_eventdev/meson.build
index 19541f23f..9ba6c0393 100644
--- a/lib/librte_eventdev/meson.build
+++ b/lib/librte_eventdev/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-version = 7
+version = 8
 allow_experimental_apis = true
 
 if is_linux
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
index c848261c4..93b717af9 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
@@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
 int
 rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
 
+#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST	0x1
+/**< This flag is used when all the packets enqueued in the tx adapter are
+ * destined for the same Ethernet port & Tx queue.
+ */
+
 /**
  * Enqueue a burst of events objects or an event object supplied in *rte_event*
  * structure on an  event device designated by its *dev_id* through the event
@@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
  *  The number of event objects to enqueue, typically number of
  *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
  *  available for this port.
+ * @param flags
+ *  RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
+ *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets
+ *  which are enqueued are destined for the same Ethernet port & Tx queue.
  *
  * @return
  *   The number of event objects actually enqueued on the event device. The
@@ -343,7 +352,8 @@ static inline uint16_t
 rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 				uint8_t port_id,
 				struct rte_event ev[],
-				uint16_t nb_events)
+				uint16_t nb_events,
+				const uint8_t flags)
 {
 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
 
@@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 		return 0;
 	}
 #endif
-	return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
+	if (flags)
+		return dev->txa_enqueue_same_dest(dev->data->ports[port_id],
+						  ev, nb_events);
+	else
+		return dev->txa_enqueue(dev->data->ports[port_id], ev,
+					nb_events);
 }
 
 /**
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index f44c869cb..b987e0745 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -1351,6 +1351,7 @@ rte_event_pmd_allocate(const char *name, int socket_id)
 	eventdev = &rte_eventdevs[dev_id];
 
 	eventdev->txa_enqueue = rte_event_tx_adapter_enqueue;
+	eventdev->txa_enqueue_same_dest = rte_event_tx_adapter_enqueue;
 
 	if (eventdev->data == NULL) {
 		struct rte_eventdev_data *eventdev_data = NULL;
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 5044a13d0..ced6f29d9 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1230,6 +1230,12 @@ typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
 				struct rte_event ev[], uint16_t nb_events);
 /**< @internal Enqueue burst of events on port of a device */
 
+typedef uint16_t (*event_tx_adapter_enqueue_same_dest)(void *port,
+		struct rte_event ev[], uint16_t nb_events);
+/**< @internal Enqueue burst of events on port of a device supporting
+ * burst having same destination Ethernet port & Tx queue.
+ */
+
 #define RTE_EVENTDEV_NAME_MAX_LEN	(64)
 /**< @internal Max length of name of event PMD */
 
@@ -1292,6 +1298,10 @@ struct rte_eventdev {
 	/**< Pointer to PMD dequeue function. */
 	event_dequeue_burst_t dequeue_burst;
 	/**< Pointer to PMD dequeue burst function. */
+	event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest;
+	/**< Pointer to PMD eth Tx adapter burst enqueue function with
+	 * events destined to same Eth port & Tx queue.
+	 */
 	event_tx_adapter_enqueue txa_enqueue;
 	/**< Pointer to PMD eth Tx adapter enqueue function. */
 	struct rte_eventdev_data *data;
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v4] eventdev: flag to identify same destined packets enqueue
  2019-10-09  7:32 ` [dpdk-dev] [PATCH v4] " Nipun Gupta
@ 2019-10-10 10:06   ` Rao, Nikhil
  2019-10-10 12:43     ` Nipun Gupta
  0 siblings, 1 reply; 30+ messages in thread
From: Rao, Nikhil @ 2019-10-10 10:06 UTC (permalink / raw)
  To: Nipun Gupta, dev
  Cc: jerinj, aconole, pbhagavatula, skori, hemant.agrawal, Richardson,
	Bruce, Kovacevic, Marko, orika, Nicolau, Radu, Kantecki, Tomasz,
	Van Haaren, Harry

Hi Nipun,


> -----Original Message-----
> From: Nipun Gupta [mailto:nipun.gupta@nxp.com]
> Sent: Wednesday, October 9, 2019 1:03 PM
> To: dev@dpdk.org
> Cc: jerinj@marvell.com; aconole@redhat.com; pbhagavatula@marvell.com;
> skori@marvell.com; hemant.agrawal@nxp.com; Richardson, Bruce
> <bruce.richardson@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; orika@mellanox.com; Nicolau, Radu
> <radu.nicolau@intel.com>; Kantecki, Tomasz <tomasz.kantecki@intel.com>;
> Van Haaren, Harry <harry.van.haaren@intel.com>; Rao, Nikhil
> <nikhil.rao@intel.com>; Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH v4] eventdev: flag to identify same destined packets enqueue
> 
> This patch introduces a `flag` in the Eth TX adapter enqueue API.
> Some drivers may support burst functionality only with the packets having
> same destination device and queue.
> 
> The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
> to indicate this so the underlying driver, for drivers to utilize burst functionality
> appropriately.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Acked-by: Jerin Jacob <jerinj@marvell.com>
> ---
> 
> Changes in v4:
>  - Update rel note specifying the API change
>  - Remove redundant rte_event_tx_adapter_enqueue_same_dest API
> 
</snip>

>  /**
>   * Enqueue a burst of events objects or an event object supplied in *rte_event*
>   * structure on an  event device designated by its *dev_id* through the event
> @@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t
> id, uint8_t *event_port_id);
>   *  The number of event objects to enqueue, typically number of
>   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
>   *  available for this port.
> + * @param flags
> + *  RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all
> the
> + packets
> + *  which are enqueued are destined for the same Ethernet port & Tx queue.
>   *
>   * @return
>   *   The number of event objects actually enqueued on the event device. The
> @@ -343,7 +352,8 @@ static inline uint16_t
> rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
>  				uint8_t port_id,
>  				struct rte_event ev[],
> -				uint16_t nb_events)
> +				uint16_t nb_events,
> +				const uint8_t flags)
>  {
>  	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> 
> @@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
>  		return 0;
>  	}
>  #endif
> -	return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
> +	if (flags)
> +		return dev->txa_enqueue_same_dest(dev->data-
> >ports[port_id],
> +						  ev, nb_events);
> +	else
> +		return dev->txa_enqueue(dev->data->ports[port_id], ev,
> +					nb_events);
>  }

For the if (flags) condition to work for the PMDs that support RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT but do not have a txa_enqueue_same_dest callback, doesn't the dev->txa_enqueue_same_dest pointer need to be set to the same value as dev->txa_enqueue ?

Thanks,
Nikhil


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

* Re: [dpdk-dev] [PATCH v4] eventdev: flag to identify same destined packets enqueue
  2019-10-10 10:06   ` Rao, Nikhil
@ 2019-10-10 12:43     ` Nipun Gupta
  2019-10-11  6:14       ` Jerin Jacob
  0 siblings, 1 reply; 30+ messages in thread
From: Nipun Gupta @ 2019-10-10 12:43 UTC (permalink / raw)
  To: Rao, Nikhil, dev
  Cc: jerinj, aconole, pbhagavatula, skori, Hemant Agrawal, Richardson,
	Bruce, Kovacevic, Marko, orika, Nicolau, Radu, Kantecki, Tomasz,
	Van Haaren, Harry



> -----Original Message-----
> From: Rao, Nikhil <nikhil.rao@intel.com>
> Sent: Thursday, October 10, 2019 3:36 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org
> Cc: jerinj@marvell.com; aconole@redhat.com; pbhagavatula@marvell.com;
> skori@marvell.com; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; orika@mellanox.com; Nicolau, Radu
> <radu.nicolau@intel.com>; Kantecki, Tomasz <tomasz.kantecki@intel.com>;
> Van Haaren, Harry <harry.van.haaren@intel.com>
> Subject: RE: [PATCH v4] eventdev: flag to identify same destined packets
> enqueue
> 
> Hi Nipun,
> 
> 
> > -----Original Message-----
> > From: Nipun Gupta [mailto:nipun.gupta@nxp.com]
> > Sent: Wednesday, October 9, 2019 1:03 PM
> > To: dev@dpdk.org
> > Cc: jerinj@marvell.com; aconole@redhat.com; pbhagavatula@marvell.com;
> > skori@marvell.com; hemant.agrawal@nxp.com; Richardson, Bruce
> > <bruce.richardson@intel.com>; Kovacevic, Marko
> > <marko.kovacevic@intel.com>; orika@mellanox.com; Nicolau, Radu
> > <radu.nicolau@intel.com>; Kantecki, Tomasz
> <tomasz.kantecki@intel.com>;
> > Van Haaren, Harry <harry.van.haaren@intel.com>; Rao, Nikhil
> > <nikhil.rao@intel.com>; Nipun Gupta <nipun.gupta@nxp.com>
> > Subject: [PATCH v4] eventdev: flag to identify same destined packets
> enqueue
> >
> > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > Some drivers may support burst functionality only with the packets having
> > same destination device and queue.
> >
> > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be
> used
> > to indicate this so the underlying driver, for drivers to utilize burst
> functionality
> > appropriately.
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > Acked-by: Jerin Jacob <jerinj@marvell.com>
> > ---
> >
> > Changes in v4:
> >  - Update rel note specifying the API change
> >  - Remove redundant rte_event_tx_adapter_enqueue_same_dest API
> >
> </snip>
> 
> >  /**
> >   * Enqueue a burst of events objects or an event object supplied in
> *rte_event*
> >   * structure on an  event device designated by its *dev_id* through the
> event
> > @@ -324,6 +329,10 @@
> rte_event_eth_tx_adapter_event_port_get(uint8_t
> > id, uint8_t *event_port_id);
> >   *  The number of event objects to enqueue, typically number of
> >   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> >   *  available for this port.
> > + * @param flags
> > + *  RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that
> all
> > the
> > + packets
> > + *  which are enqueued are destined for the same Ethernet port & Tx
> queue.
> >   *
> >   * @return
> >   *   The number of event objects actually enqueued on the event device.
> The
> > @@ -343,7 +352,8 @@ static inline uint16_t
> > rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> >  				uint8_t port_id,
> >  				struct rte_event ev[],
> > -				uint16_t nb_events)
> > +				uint16_t nb_events,
> > +				const uint8_t flags)
> >  {
> >  	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> >
> > @@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t
> dev_id,
> >  		return 0;
> >  	}
> >  #endif
> > -	return dev->txa_enqueue(dev->data->ports[port_id], ev,
> nb_events);
> > +	if (flags)
> > +		return dev->txa_enqueue_same_dest(dev->data-
> > >ports[port_id],
> > +						  ev, nb_events);
> > +	else
> > +		return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > +					nb_events);
> >  }
> 
> For the if (flags) condition to work for the PMDs that support
> RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT but do not have a
> txa_enqueue_same_dest callback, doesn't the dev-
> >txa_enqueue_same_dest pointer need to be set to the same value as dev-
> >txa_enqueue ?

Something like below would work, but it would be unnecessary additional cost
	if (flags && dev->txa_enqueue_same_dest)

Instead the drivers can have both the function pointers pointing to the same 
function in such cases. Seems legitimate?
Ill add the function pointers in the octeontx and octeontx2 drivers in the next spin.

Thanks,
Nipun

> 
> Thanks,
> Nikhil


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

* Re: [dpdk-dev] [PATCH v4] eventdev: flag to identify same destined packets enqueue
  2019-10-10 12:43     ` Nipun Gupta
@ 2019-10-11  6:14       ` Jerin Jacob
  0 siblings, 0 replies; 30+ messages in thread
From: Jerin Jacob @ 2019-10-11  6:14 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: Rao, Nikhil, dev, jerinj, aconole, pbhagavatula, skori,
	Hemant Agrawal, Richardson, Bruce, Kovacevic, Marko, orika,
	Nicolau, Radu, Kantecki, Tomasz, Van Haaren, Harry

On Thu, Oct 10, 2019 at 6:13 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Rao, Nikhil <nikhil.rao@intel.com>
> > Sent: Thursday, October 10, 2019 3:36 PM
> > To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org
> > Cc: jerinj@marvell.com; aconole@redhat.com; pbhagavatula@marvell.com;
> > skori@marvell.com; Hemant Agrawal <hemant.agrawal@nxp.com>;
> > Richardson, Bruce <bruce.richardson@intel.com>; Kovacevic, Marko
> > <marko.kovacevic@intel.com>; orika@mellanox.com; Nicolau, Radu
> > <radu.nicolau@intel.com>; Kantecki, Tomasz <tomasz.kantecki@intel.com>;
> > Van Haaren, Harry <harry.van.haaren@intel.com>
> > Subject: RE: [PATCH v4] eventdev: flag to identify same destined packets
> > enqueue
> >
> > Hi Nipun,
> >
> >
> > > -----Original Message-----
> > > From: Nipun Gupta [mailto:nipun.gupta@nxp.com]
> > > Sent: Wednesday, October 9, 2019 1:03 PM
> > > To: dev@dpdk.org
> > > Cc: jerinj@marvell.com; aconole@redhat.com; pbhagavatula@marvell.com;
> > > skori@marvell.com; hemant.agrawal@nxp.com; Richardson, Bruce
> > > <bruce.richardson@intel.com>; Kovacevic, Marko
> > > <marko.kovacevic@intel.com>; orika@mellanox.com; Nicolau, Radu
> > > <radu.nicolau@intel.com>; Kantecki, Tomasz
> > <tomasz.kantecki@intel.com>;
> > > Van Haaren, Harry <harry.van.haaren@intel.com>; Rao, Nikhil
> > > <nikhil.rao@intel.com>; Nipun Gupta <nipun.gupta@nxp.com>
> > > Subject: [PATCH v4] eventdev: flag to identify same destined packets
> > enqueue
> > >
> > > This patch introduces a `flag` in the Eth TX adapter enqueue API.
> > > Some drivers may support burst functionality only with the packets having
> > > same destination device and queue.
> > >
> > > The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be
> > used
> > > to indicate this so the underlying driver, for drivers to utilize burst
> > functionality
> > > appropriately.
> > >
> > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > Acked-by: Jerin Jacob <jerinj@marvell.com>
> > > ---
> > >
> > > Changes in v4:
> > >  - Update rel note specifying the API change
> > >  - Remove redundant rte_event_tx_adapter_enqueue_same_dest API
> > >
> > </snip>
> >
> > >  /**
> > >   * Enqueue a burst of events objects or an event object supplied in
> > *rte_event*
> > >   * structure on an  event device designated by its *dev_id* through the
> > event
> > > @@ -324,6 +329,10 @@
> > rte_event_eth_tx_adapter_event_port_get(uint8_t
> > > id, uint8_t *event_port_id);
> > >   *  The number of event objects to enqueue, typically number of
> > >   *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
> > >   *  available for this port.
> > > + * @param flags
> > > + *  RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
> > > + *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that
> > all
> > > the
> > > + packets
> > > + *  which are enqueued are destined for the same Ethernet port & Tx
> > queue.
> > >   *
> > >   * @return
> > >   *   The number of event objects actually enqueued on the event device.
> > The
> > > @@ -343,7 +352,8 @@ static inline uint16_t
> > > rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
> > >                             uint8_t port_id,
> > >                             struct rte_event ev[],
> > > -                           uint16_t nb_events)
> > > +                           uint16_t nb_events,
> > > +                           const uint8_t flags)
> > >  {
> > >     const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> > >
> > > @@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t
> > dev_id,
> > >             return 0;
> > >     }
> > >  #endif
> > > -   return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > nb_events);
> > > +   if (flags)
> > > +           return dev->txa_enqueue_same_dest(dev->data-
> > > >ports[port_id],
> > > +                                             ev, nb_events);
> > > +   else
> > > +           return dev->txa_enqueue(dev->data->ports[port_id], ev,
> > > +                                   nb_events);
> > >  }
> >
> > For the if (flags) condition to work for the PMDs that support
> > RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT but do not have a
> > txa_enqueue_same_dest callback, doesn't the dev-
> > >txa_enqueue_same_dest pointer need to be set to the same value as dev-
> > >txa_enqueue ?
>
> Something like below would work, but it would be unnecessary additional cost
>         if (flags && dev->txa_enqueue_same_dest)

Yes

> Instead the drivers can have both the function pointers pointing to the same
> function in such cases. Seems legitimate?
> Ill add the function pointers in the octeontx and octeontx2 drivers in the next spin.

OK. Please make the change as slow path.

>
> Thanks,
> Nipun
>
> >
> > Thanks,
> > Nikhil
>

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

* [dpdk-dev] [PATCH v5] eventdev: flag to identify same destined packets enqueue
  2019-10-01  6:46 [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue Nipun Gupta
                   ` (4 preceding siblings ...)
  2019-10-09  7:32 ` [dpdk-dev] [PATCH v4] " Nipun Gupta
@ 2019-10-11 13:03 ` Nipun Gupta
  2019-10-16  6:41   ` Hemant Agrawal
  2019-10-16  7:19   ` Jerin Jacob
  5 siblings, 2 replies; 30+ messages in thread
From: Nipun Gupta @ 2019-10-11 13:03 UTC (permalink / raw)
  To: dev
  Cc: jerinj, aconole, pbhagavatula, skori, hemant.agrawal,
	bruce.richardson, marko.kovacevic, orika, radu.nicolau,
	tomasz.kantecki, harry.van.haaren, nikhil.rao, Nipun Gupta

This patch introduces a `flag` in the Eth TX adapter enqueue API.
Some drivers may support burst functionality only with the packets
having same destination device and queue.

The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
to indicate this so the underlying driver, for drivers to utilize
burst functionality appropriately.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---

Changes in v5:
 - Assign 'txa_enqueue_same_dest' callback in octeontx drivers

Changes in v4:
 - Update rel note specifying the API change
 - Remove redundant rte_event_tx_adapter_enqueue_same_dest API

Changes in v3:
 - remove flag from internal txa_enqueue_same_dest internal API
 - ABI version update in makefile, meson and rel_notes
 - Few comments update

Changes in v2:
 - have separate internal API in tx adapter for sending burst packets to
   same eth dev, queue pair on the basis of the passed flag
 - fix compilation of examples/eventdev_pipeline/

app/test-eventdev/test_pipeline_common.h      |  6 +++---
 .../prog_guide/event_ethernet_tx_adapter.rst  |  3 ++-
 doc/guides/rel_notes/release_19_11.rst        |  7 ++++++-
 drivers/event/octeontx/ssovf_evdev.c          |  1 +
 drivers/event/octeontx2/otx2_evdev.c          |  2 ++
 .../eventdev_pipeline/pipeline_worker_tx.c    |  2 +-
 lib/librte_eventdev/Makefile                  |  2 +-
 lib/librte_eventdev/meson.build               |  2 +-
 .../rte_event_eth_tx_adapter.h                | 19 +++++++++++++++++--
 lib/librte_eventdev/rte_eventdev.c            |  1 +
 lib/librte_eventdev/rte_eventdev.h            | 10 ++++++++++
 11 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
index 0440b9e29..6e73c6ab2 100644
--- a/app/test-eventdev/test_pipeline_common.h
+++ b/app/test-eventdev/test_pipeline_common.h
@@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t port,
 		struct rte_event * const ev)
 {
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
@@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const uint8_t port,
 {
 	uint16_t enq;
 
-	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx);
+	enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0);
 	while (enq < nb_rx) {
 		enq += rte_event_eth_tx_adapter_enqueue(dev, port,
-				ev + enq, nb_rx - enq);
+				ev + enq, nb_rx - enq, 0);
 	}
 }
 
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index 192f9e1cf..a8c13e136 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()`` function.
 	if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {
 
 		event.mbuf = m;
+		eq_flags = 0;
 
 		m->port = tx_port;
 		rte_event_eth_tx_adapter_txq_set(m, tx_queue_id);
 
-		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1);
+		rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1, eq_flags);
 	} else {
 
 		event.queue_id = qid; /* event queue linked to adapter port */
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 27cfbd9e3..051ab26b8 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -94,6 +94,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =========================================================
 
+* event: The function ``rte_event_eth_tx_adapter_enqueue`` takes an additional
+  input as ``flags``. Flag ``RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST`` which
+  has been introduced in this release is used when used when all the packets
+  enqueued in the tx adapter are destined for the same Ethernet port & Tx queue.
+
 
 ABI Changes
 -----------
@@ -146,7 +151,7 @@ The libraries prepended with a plus sign were incremented in this version.
      librte_eal.so.11
      librte_efd.so.1
      librte_ethdev.so.12
-     librte_eventdev.so.7
+     librte_eventdev.so.8
      librte_flow_classify.so.1
      librte_gro.so.1
      librte_gso.so.1
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index a273d4c96..e4e7c44ed 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -147,6 +147,7 @@ ssovf_fastpath_fns_set(struct rte_eventdev *dev)
 	dev->dequeue       = ssows_deq;
 	dev->dequeue_burst = ssows_deq_burst;
 	dev->txa_enqueue = sso_event_tx_adapter_enqueue;
+	dev->txa_enqueue_same_dest = dev->txa_enqueue;
 
 	if (edev->is_timeout_deq) {
 		dev->dequeue       = ssows_deq_timeout;
diff --git a/drivers/event/octeontx2/otx2_evdev.c b/drivers/event/octeontx2/otx2_evdev.c
index 160ac94ee..318dc475c 100644
--- a/drivers/event/octeontx2/otx2_evdev.c
+++ b/drivers/event/octeontx2/otx2_evdev.c
@@ -428,6 +428,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
 						NIX_TX_OFFLOAD_L3_L4_CSUM_F)];
 		}
 	}
+
+	event_dev->txa_enqueue_same_dest = event_dev->txa_enqueue;
 	rte_mb();
 }
 
diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c
index 8961cd656..a0f40c27c 100644
--- a/examples/eventdev_pipeline/pipeline_worker_tx.c
+++ b/examples/eventdev_pipeline/pipeline_worker_tx.c
@@ -40,7 +40,7 @@ worker_tx_pkt(const uint8_t dev, const uint8_t port, struct rte_event *ev)
 {
 	exchange_mac(ev->mbuf);
 	rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0);
-	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1))
+	while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0))
 		rte_pause();
 }
 
diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
index cd3ff8040..9e6a99aa1 100644
--- a/lib/librte_eventdev/Makefile
+++ b/lib/librte_eventdev/Makefile
@@ -8,7 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_eventdev.a
 
 # library version
-LIBABIVER := 7
+LIBABIVER := 8
 
 # build flags
 CFLAGS += -DALLOW_EXPERIMENTAL_API
diff --git a/lib/librte_eventdev/meson.build b/lib/librte_eventdev/meson.build
index 19541f23f..9ba6c0393 100644
--- a/lib/librte_eventdev/meson.build
+++ b/lib/librte_eventdev/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-version = 7
+version = 8
 allow_experimental_apis = true
 
 if is_linux
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
index c848261c4..93b717af9 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
@@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
 int
 rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
 
+#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST	0x1
+/**< This flag is used when all the packets enqueued in the tx adapter are
+ * destined for the same Ethernet port & Tx queue.
+ */
+
 /**
  * Enqueue a burst of events objects or an event object supplied in *rte_event*
  * structure on an  event device designated by its *dev_id* through the event
@@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
  *  The number of event objects to enqueue, typically number of
  *  rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
  *  available for this port.
+ * @param flags
+ *  RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags.
+ *  #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets
+ *  which are enqueued are destined for the same Ethernet port & Tx queue.
  *
  * @return
  *   The number of event objects actually enqueued on the event device. The
@@ -343,7 +352,8 @@ static inline uint16_t
 rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 				uint8_t port_id,
 				struct rte_event ev[],
-				uint16_t nb_events)
+				uint16_t nb_events,
+				const uint8_t flags)
 {
 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
 
@@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
 		return 0;
 	}
 #endif
-	return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events);
+	if (flags)
+		return dev->txa_enqueue_same_dest(dev->data->ports[port_id],
+						  ev, nb_events);
+	else
+		return dev->txa_enqueue(dev->data->ports[port_id], ev,
+					nb_events);
 }
 
 /**
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index f44c869cb..b987e0745 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -1351,6 +1351,7 @@ rte_event_pmd_allocate(const char *name, int socket_id)
 	eventdev = &rte_eventdevs[dev_id];
 
 	eventdev->txa_enqueue = rte_event_tx_adapter_enqueue;
+	eventdev->txa_enqueue_same_dest = rte_event_tx_adapter_enqueue;
 
 	if (eventdev->data == NULL) {
 		struct rte_eventdev_data *eventdev_data = NULL;
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 5044a13d0..ced6f29d9 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1230,6 +1230,12 @@ typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
 				struct rte_event ev[], uint16_t nb_events);
 /**< @internal Enqueue burst of events on port of a device */
 
+typedef uint16_t (*event_tx_adapter_enqueue_same_dest)(void *port,
+		struct rte_event ev[], uint16_t nb_events);
+/**< @internal Enqueue burst of events on port of a device supporting
+ * burst having same destination Ethernet port & Tx queue.
+ */
+
 #define RTE_EVENTDEV_NAME_MAX_LEN	(64)
 /**< @internal Max length of name of event PMD */
 
@@ -1292,6 +1298,10 @@ struct rte_eventdev {
 	/**< Pointer to PMD dequeue function. */
 	event_dequeue_burst_t dequeue_burst;
 	/**< Pointer to PMD dequeue burst function. */
+	event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest;
+	/**< Pointer to PMD eth Tx adapter burst enqueue function with
+	 * events destined to same Eth port & Tx queue.
+	 */
 	event_tx_adapter_enqueue txa_enqueue;
 	/**< Pointer to PMD eth Tx adapter enqueue function. */
 	struct rte_eventdev_data *data;
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v5] eventdev: flag to identify same destined packets enqueue
  2019-10-11 13:03 ` [dpdk-dev] [PATCH v5] " Nipun Gupta
@ 2019-10-16  6:41   ` Hemant Agrawal
  2019-10-16  7:19   ` Jerin Jacob
  1 sibling, 0 replies; 30+ messages in thread
From: Hemant Agrawal @ 2019-10-16  6:41 UTC (permalink / raw)
  To: Nipun Gupta, dev
  Cc: jerinj, aconole, pbhagavatula, skori, bruce.richardson,
	marko.kovacevic, orika, radu.nicolau, tomasz.kantecki,
	harry.van.haaren, nikhil.rao, Nipun Gupta

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

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

* Re: [dpdk-dev] [PATCH v5] eventdev: flag to identify same destined packets enqueue
  2019-10-11 13:03 ` [dpdk-dev] [PATCH v5] " Nipun Gupta
  2019-10-16  6:41   ` Hemant Agrawal
@ 2019-10-16  7:19   ` Jerin Jacob
  1 sibling, 0 replies; 30+ messages in thread
From: Jerin Jacob @ 2019-10-16  7:19 UTC (permalink / raw)
  To: Nipun Gupta
  Cc: dpdk-dev, Jerin Jacob, aconole, Pavan Nikhilesh,
	Sunil Kumar Kori, Hemant Agrawal, Richardson, Bruce,
	Marko Kovacevic, Ori Kam, Radu Nicolau, Tomasz Kantecki,
	Van Haaren, Harry, Rao, Nikhil

On Fri, Oct 11, 2019 at 6:48 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
> This patch introduces a `flag` in the Eth TX adapter enqueue API.
> Some drivers may support burst functionality only with the packets
> having same destination device and queue.
>
> The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used
> to indicate this so the underlying driver, for drivers to utilize
> burst functionality appropriately.
>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Acked-by: Jerin Jacob <jerinj@marvell.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Applied to dpdk-next-eventdev/master. Thanks.

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-03 10:26                       ` Jerin Jacob
@ 2019-10-21 11:35                         ` Rao, Nikhil
  2019-10-22  8:45                           ` Jerin Jacob
  0 siblings, 1 reply; 30+ messages in thread
From: Rao, Nikhil @ 2019-10-21 11:35 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Nipun Gupta, Jerin Jacob, dpdk-dev, Pavan Nikhilesh,
	Sunil Kumar Kori, Richardson, Bruce, Kovacevic, Marko, Ori Kam,
	Nicolau, Radu, Kantecki, Tomasz, Van Haaren, Harry,
	Hemant Agrawal

> -----Original Message-----
> From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> Sent: Thursday, October 3, 2019 3:57 PM
> To: Hemant Agrawal <hemant.agrawal@nxp.com>
> Cc: Rao, Nikhil <nikhil.rao@intel.com>; Nipun Gupta <nipun.gupta@nxp.com>;
> Jerin Jacob <jerinj@marvell.com>; dpdk-dev <dev@dpdk.org>; Pavan Nikhilesh
> <pbhagavatula@marvell.com>; Sunil Kumar Kori <skori@marvell.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; Kantecki, Tomasz <tomasz.kantecki@intel.com>;
> Van Haaren, Harry <harry.van.haaren@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> packets enqueue
> 
</snip>

> > > > But I am not able to recollect, Why Nikhil would like to use the
> > > > separate functions. Nikhil could you remind us why
> > > > rte_event_eth_tx_adapter_enqueue() can not be used for sending the
> > > > packet for SW Tx adapter.
> > > >
> > > [Nikhil] The goal was to keep the workers using the loop below.
> > >
> > > while (1) {
> > >         rte_event_dequeue_burst(...);
> > >         (event processing)
> > >         rte_event_enqueue_burst(...); }
> 
> We do have specialized functions for specific enqueue use case like
> rte_event_enqueue_new_burst() or
> rte_event_enqueue_forward_burst() to avoid any performance impact.
> 
> Since PMD agruments are same for rte_event_enqueue_burst() and
> rte_event_eth_tx_adapter_enqueue()
> assigning simple function pointer assignment to
> rte_event_eth_tx_adapter_enqueue as dev->txa_enqueue =
> dev->enqueue_burst
> would have worked to have same Tx function across all platfroms without
> peformance overhead.
> Offcouse I understand, Slow path direct event enqueue assigment needs
> different treatment.
> 
> 
> ie in fastpath.
> 
> while (1) {
>        rte_event_dequeue_burst(...);
>       if (tx_stage)
>         rte_event_eth_tx_adapter_enqueue()...
> }
> 
> What do you say?
> 

Sorry missed this question previously - Unless I have misunderstood your email, the event processing stage would have if conditions for each of the stages (or minimally the tx stage), no disagreement on that, the only difference would be set up  of the event[] arrays that are sent to rte_event_enqueue_burst() and rte_event_eth_tx_adapter_enqueue() resulting in an additional call to rte_event_enqueue_burst(). If that’s true, since the abstraction has a cost to it,  should we be adding it ?
 
Nikhil

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-21 11:35                         ` Rao, Nikhil
@ 2019-10-22  8:45                           ` Jerin Jacob
  2019-10-22  9:42                             ` Rao, Nikhil
  0 siblings, 1 reply; 30+ messages in thread
From: Jerin Jacob @ 2019-10-22  8:45 UTC (permalink / raw)
  To: Rao, Nikhil
  Cc: Nipun Gupta, Jerin Jacob, dpdk-dev, Pavan Nikhilesh,
	Sunil Kumar Kori, Richardson, Bruce, Kovacevic, Marko, Ori Kam,
	Nicolau, Radu, Kantecki, Tomasz, Van Haaren, Harry,
	Hemant Agrawal

On Mon, Oct 21, 2019 at 5:05 PM Rao, Nikhil <nikhil.rao@intel.com> wrote:
>
> > -----Original Message-----
> > From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> > Sent: Thursday, October 3, 2019 3:57 PM
> > To: Hemant Agrawal <hemant.agrawal@nxp.com>
> > Cc: Rao, Nikhil <nikhil.rao@intel.com>; Nipun Gupta <nipun.gupta@nxp.com>;
> > Jerin Jacob <jerinj@marvell.com>; dpdk-dev <dev@dpdk.org>; Pavan Nikhilesh
> > <pbhagavatula@marvell.com>; Sunil Kumar Kori <skori@marvell.com>;
> > Richardson, Bruce <bruce.richardson@intel.com>; Kovacevic, Marko
> > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Nicolau, Radu
> > <radu.nicolau@intel.com>; Kantecki, Tomasz <tomasz.kantecki@intel.com>;
> > Van Haaren, Harry <harry.van.haaren@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> > packets enqueue
> >
> </snip>
>
> > > > > But I am not able to recollect, Why Nikhil would like to use the
> > > > > separate functions. Nikhil could you remind us why
> > > > > rte_event_eth_tx_adapter_enqueue() can not be used for sending the
> > > > > packet for SW Tx adapter.
> > > > >
> > > > [Nikhil] The goal was to keep the workers using the loop below.
> > > >
> > > > while (1) {
> > > >         rte_event_dequeue_burst(...);
> > > >         (event processing)
> > > >         rte_event_enqueue_burst(...); }
> >
> > We do have specialized functions for specific enqueue use case like
> > rte_event_enqueue_new_burst() or
> > rte_event_enqueue_forward_burst() to avoid any performance impact.
> >
> > Since PMD agruments are same for rte_event_enqueue_burst() and
> > rte_event_eth_tx_adapter_enqueue()
> > assigning simple function pointer assignment to
> > rte_event_eth_tx_adapter_enqueue as dev->txa_enqueue =
> > dev->enqueue_burst
> > would have worked to have same Tx function across all platfroms without
> > peformance overhead.
> > Offcouse I understand, Slow path direct event enqueue assigment needs
> > different treatment.
> >
> >
> > ie in fastpath.
> >
> > while (1) {
> >        rte_event_dequeue_burst(...);
> >       if (tx_stage)
> >         rte_event_eth_tx_adapter_enqueue()...
> > }
> >
> > What do you say?
> >
>
> Sorry missed this question previously - Unless I have misunderstood your email, the event processing stage would have if conditions for each of the stages (or minimally the tx stage), no disagreement on that, the only difference would be set up  of the event[] arrays that are sent to rte_event_enqueue_burst() and rte_event_eth_tx_adapter_enqueue() resulting in an additional call to rte_event_enqueue_burst(). If that’s true, since the abstraction has a cost to it,  should we be adding it ?

It there is a cost then we should not be adding it.
I think, the following scheme can avoid the cost by adding the
following in a _slow path_ as the prototype of the driver API is the
same.

dev->txa_enqueue = dev->enqueue_burst;

>
> Nikhil

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-22  8:45                           ` Jerin Jacob
@ 2019-10-22  9:42                             ` Rao, Nikhil
  2019-10-23  4:53                               ` Jerin Jacob
  0 siblings, 1 reply; 30+ messages in thread
From: Rao, Nikhil @ 2019-10-22  9:42 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Nipun Gupta, Jerin Jacob, dpdk-dev, Pavan Nikhilesh,
	Sunil Kumar Kori, Richardson, Bruce, Kovacevic, Marko, Ori Kam,
	Nicolau, Radu, Kantecki, Tomasz, Van Haaren, Harry,
	Hemant Agrawal


> -----Original Message-----
> From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> Sent: Tuesday, October 22, 2019 2:15 PM
> To: Rao, Nikhil <nikhil.rao@intel.com>
> Cc: Nipun Gupta <nipun.gupta@nxp.com>; Jerin Jacob <jerinj@marvell.com>;
> dpdk-dev <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>;
> Sunil Kumar Kori <skori@marvell.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; Kantecki, Tomasz <tomasz.kantecki@intel.com>;
> Van Haaren, Harry <harry.van.haaren@intel.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>
> Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> packets enqueue
> 
> On Mon, Oct 21, 2019 at 5:05 PM Rao, Nikhil <nikhil.rao@intel.com> wrote:
> >
> > > -----Original Message-----
> > > From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> > > Sent: Thursday, October 3, 2019 3:57 PM
> > > To: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > Cc: Rao, Nikhil <nikhil.rao@intel.com>; Nipun Gupta
> > > <nipun.gupta@nxp.com>; Jerin Jacob <jerinj@marvell.com>; dpdk-dev
> > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>; Sunil
> > > Kumar Kori <skori@marvell.com>; Richardson, Bruce
> > > <bruce.richardson@intel.com>; Kovacevic, Marko
> > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Nicolau,
> > > Radu <radu.nicolau@intel.com>; Kantecki, Tomasz
> > > <tomasz.kantecki@intel.com>; Van Haaren, Harry
> > > <harry.van.haaren@intel.com>
> > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> > > destined packets enqueue
> > >
> > </snip>
> >
> > > > > > But I am not able to recollect, Why Nikhil would like to use
> > > > > > the separate functions. Nikhil could you remind us why
> > > > > > rte_event_eth_tx_adapter_enqueue() can not be used for sending
> > > > > > the packet for SW Tx adapter.
> > > > > >
> > > > > [Nikhil] The goal was to keep the workers using the loop below.
> > > > >
> > > > > while (1) {
> > > > >         rte_event_dequeue_burst(...);
> > > > >         (event processing)
> > > > >         rte_event_enqueue_burst(...); }
> > >
> > > We do have specialized functions for specific enqueue use case like
> > > rte_event_enqueue_new_burst() or
> > > rte_event_enqueue_forward_burst() to avoid any performance impact.
> > >
> > > Since PMD agruments are same for rte_event_enqueue_burst() and
> > > rte_event_eth_tx_adapter_enqueue()
> > > assigning simple function pointer assignment to
> > > rte_event_eth_tx_adapter_enqueue as dev->txa_enqueue =
> > > dev->enqueue_burst
> > > would have worked to have same Tx function across all platfroms
> > > without peformance overhead.
> > > Offcouse I understand, Slow path direct event enqueue assigment
> > > needs different treatment.
> > >
> > >
> > > ie in fastpath.
> > >
> > > while (1) {
> > >        rte_event_dequeue_burst(...);
> > >       if (tx_stage)
> > >         rte_event_eth_tx_adapter_enqueue()...
> > > }
> > >
> > > What do you say?
> > >
> >
> > Sorry missed this question previously - Unless I have misunderstood your
> email, the event processing stage would have if conditions for each of the
> stages (or minimally the tx stage), no disagreement on that, the only difference
> would be set up  of the event[] arrays that are sent to
> rte_event_enqueue_burst() and rte_event_eth_tx_adapter_enqueue() resulting
> in an additional call to rte_event_enqueue_burst(). If that’s true, since the
> abstraction has a cost to it,  should we be adding it ?
> 
> It there is a cost then we should not be adding it.
> I think, the following scheme can avoid the cost by adding the following in a
> _slow path_ as the prototype of the driver API is the same.
> 
> dev->txa_enqueue = dev->enqueue_burst;
> 

I was thinking of the event loop below which results in 2 calls to rte_event_enqueue_burst()

while (1) {
	rte_event_dequeue_burst(...);
	
	for_all_events {
             		if (tx_stage) 
			event_tx[tx_cnt++] = ...
		else 
			event_non_tx[non_tx_cnt++] = ...

	}
	if (tx_cnt)
	             rte_event_eth_tx_adapter_enqueue(event_tx, tx_cnt); 
	if (non_tx_cnt)
		rte_event_enqueue_burst(event_non_tx, non_tx_cnt); 
  }

Thanks,
Nikhil

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

* Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue
  2019-10-22  9:42                             ` Rao, Nikhil
@ 2019-10-23  4:53                               ` Jerin Jacob
  0 siblings, 0 replies; 30+ messages in thread
From: Jerin Jacob @ 2019-10-23  4:53 UTC (permalink / raw)
  To: Rao, Nikhil
  Cc: Nipun Gupta, Jerin Jacob, dpdk-dev, Pavan Nikhilesh,
	Sunil Kumar Kori, Richardson, Bruce, Kovacevic, Marko, Ori Kam,
	Nicolau, Radu, Kantecki, Tomasz, Van Haaren, Harry,
	Hemant Agrawal

On Tue, Oct 22, 2019 at 3:12 PM Rao, Nikhil <nikhil.rao@intel.com> wrote:
>
>
> > -----Original Message-----
> > From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> > Sent: Tuesday, October 22, 2019 2:15 PM
> > To: Rao, Nikhil <nikhil.rao@intel.com>
> > Cc: Nipun Gupta <nipun.gupta@nxp.com>; Jerin Jacob <jerinj@marvell.com>;
> > dpdk-dev <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>;
> > Sunil Kumar Kori <skori@marvell.com>; Richardson, Bruce
> > <bruce.richardson@intel.com>; Kovacevic, Marko
> > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Nicolau, Radu
> > <radu.nicolau@intel.com>; Kantecki, Tomasz <tomasz.kantecki@intel.com>;
> > Van Haaren, Harry <harry.van.haaren@intel.com>; Hemant Agrawal
> > <hemant.agrawal@nxp.com>
> > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same destined
> > packets enqueue
> >
> > On Mon, Oct 21, 2019 at 5:05 PM Rao, Nikhil <nikhil.rao@intel.com> wrote:
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> > > > Sent: Thursday, October 3, 2019 3:57 PM
> > > > To: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > > Cc: Rao, Nikhil <nikhil.rao@intel.com>; Nipun Gupta
> > > > <nipun.gupta@nxp.com>; Jerin Jacob <jerinj@marvell.com>; dpdk-dev
> > > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>; Sunil
> > > > Kumar Kori <skori@marvell.com>; Richardson, Bruce
> > > > <bruce.richardson@intel.com>; Kovacevic, Marko
> > > > <marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>; Nicolau,
> > > > Radu <radu.nicolau@intel.com>; Kantecki, Tomasz
> > > > <tomasz.kantecki@intel.com>; Van Haaren, Harry
> > > > <harry.van.haaren@intel.com>
> > > > Subject: Re: [dpdk-dev] [PATCH] eventdev: flag to identify same
> > > > destined packets enqueue
> > > >
> > > </snip>
> > >
> > > > > > > But I am not able to recollect, Why Nikhil would like to use
> > > > > > > the separate functions. Nikhil could you remind us why
> > > > > > > rte_event_eth_tx_adapter_enqueue() can not be used for sending
> > > > > > > the packet for SW Tx adapter.
> > > > > > >
> > > > > > [Nikhil] The goal was to keep the workers using the loop below.
> > > > > >
> > > > > > while (1) {
> > > > > >         rte_event_dequeue_burst(...);
> > > > > >         (event processing)
> > > > > >         rte_event_enqueue_burst(...); }
> > > >
> > > > We do have specialized functions for specific enqueue use case like
> > > > rte_event_enqueue_new_burst() or
> > > > rte_event_enqueue_forward_burst() to avoid any performance impact.
> > > >
> > > > Since PMD agruments are same for rte_event_enqueue_burst() and
> > > > rte_event_eth_tx_adapter_enqueue()
> > > > assigning simple function pointer assignment to
> > > > rte_event_eth_tx_adapter_enqueue as dev->txa_enqueue =
> > > > dev->enqueue_burst
> > > > would have worked to have same Tx function across all platfroms
> > > > without peformance overhead.
> > > > Offcouse I understand, Slow path direct event enqueue assigment
> > > > needs different treatment.
> > > >
> > > >
> > > > ie in fastpath.
> > > >
> > > > while (1) {
> > > >        rte_event_dequeue_burst(...);
> > > >       if (tx_stage)
> > > >         rte_event_eth_tx_adapter_enqueue()...
> > > > }
> > > >
> > > > What do you say?
> > > >
> > >
> > > Sorry missed this question previously - Unless I have misunderstood your
> > email, the event processing stage would have if conditions for each of the
> > stages (or minimally the tx stage), no disagreement on that, the only difference
> > would be set up  of the event[] arrays that are sent to
> > rte_event_enqueue_burst() and rte_event_eth_tx_adapter_enqueue() resulting
> > in an additional call to rte_event_enqueue_burst(). If that’s true, since the
> > abstraction has a cost to it,  should we be adding it ?
> >
> > It there is a cost then we should not be adding it.
> > I think, the following scheme can avoid the cost by adding the following in a
> > _slow path_ as the prototype of the driver API is the same.
> >
> > dev->txa_enqueue = dev->enqueue_burst;
> >
>
> I was thinking of the event loop below which results in 2 calls to rte_event_enqueue_burst()

Agree. That would be an overhead for the SW driver.

>
> while (1) {
>         rte_event_dequeue_burst(...);
>
>         for_all_events {
>                         if (tx_stage)
>                         event_tx[tx_cnt++] = ...
>                 else
>                         event_non_tx[non_tx_cnt++] = ...
>
>         }
>         if (tx_cnt)
>                      rte_event_eth_tx_adapter_enqueue(event_tx, tx_cnt);
>         if (non_tx_cnt)
>                 rte_event_enqueue_burst(event_non_tx, non_tx_cnt);
>   }




>
> Thanks,
> Nikhil

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

end of thread, other threads:[~2019-10-23  4:53 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01  6:46 [dpdk-dev] [PATCH] eventdev: flag to identify same destined packets enqueue Nipun Gupta
2019-10-01  7:44 ` Jerin Jacob
2019-10-01 11:41   ` Nipun Gupta
2019-10-01 13:09     ` Jerin Jacob
2019-10-01 14:02       ` Nipun Gupta
2019-10-01 14:20         ` Jerin Jacob
2019-10-01 15:06           ` Nipun Gupta
2019-10-01 15:35             ` Jerin Jacob
2019-10-02  3:08               ` Hemant Agrawal
2019-10-02  7:54                 ` Jerin Jacob
2019-10-03  6:12                   ` Rao, Nikhil
2019-10-03  6:45                     ` Hemant Agrawal
2019-10-03 10:26                       ` Jerin Jacob
2019-10-21 11:35                         ` Rao, Nikhil
2019-10-22  8:45                           ` Jerin Jacob
2019-10-22  9:42                             ` Rao, Nikhil
2019-10-23  4:53                               ` Jerin Jacob
2019-10-01 14:42 ` Aaron Conole
2019-10-01 15:15   ` Nipun Gupta
2019-10-04  6:55 ` [dpdk-dev] [PATCH v2] " Nipun Gupta
2019-10-04  8:21   ` Jerin Jacob
2019-10-04 10:47 ` [dpdk-dev] [PATCH v3] " Nipun Gupta
2019-10-05 16:23   ` Jerin Jacob
2019-10-09  7:32 ` [dpdk-dev] [PATCH v4] " Nipun Gupta
2019-10-10 10:06   ` Rao, Nikhil
2019-10-10 12:43     ` Nipun Gupta
2019-10-11  6:14       ` Jerin Jacob
2019-10-11 13:03 ` [dpdk-dev] [PATCH v5] " Nipun Gupta
2019-10-16  6:41   ` Hemant Agrawal
2019-10-16  7:19   ` Jerin Jacob

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).