DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eventdev: fix eth Tx adapter queue count checks
@ 2018-11-29 11:11 Nikhil Rao
  2018-12-01 14:39 ` Jerin Jacob
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nikhil Rao @ 2018-11-29 11:11 UTC (permalink / raw)
  To: jerin.jacob; +Cc: dev, Nikhil Rao, stable

rte_event_eth_tx_adapter_queue_add() - add a check
that returns an error if the ethdev the zero Tx queues
configured.

rte_event_eth_tx_adapter_queue_del() - remove the
checks for ethdev queue count, instead check for
queues added to the adapter which maybe different
from the current ethdev queue count.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
 lib/librte_eventdev/rte_event_eth_tx_adapter.c | 53 +++++++++++++++++---------
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
index ccf8a75..8431656 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
@@ -59,6 +59,19 @@
 		return -EINVAL; \
 } while (0)
 
+#define TXA_CHECK_TXQ(dev, queue) \
+do {\
+	if ((dev)->data->nb_tx_queues == 0) { \
+		RTE_EDEV_LOG_ERR("No tx queues configured"); \
+		return -EINVAL; \
+	} \
+	if (queue != -1 && (uint16_t)queue >= (dev)->data->nb_tx_queues) { \
+		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, \
+				(uint16_t)queue); \
+		return -EINVAL; \
+	} \
+} while (0)
+
 /* Tx retry callback structure */
 struct txa_retry {
 	/* Ethernet port id */
@@ -795,20 +808,35 @@ static int txa_service_queue_del(uint8_t id,
 	struct rte_eth_dev_tx_buffer *tb;
 	uint16_t port_id;
 
+	txa = txa_service_id_to_data(id);
+	port_id = dev->data->port_id;
+
 	if (tx_queue_id == -1) {
-		uint16_t i;
-		int ret = -1;
+		uint16_t i, q, nb_queues;
+		int ret = 0;
 
-		for (i = 0; i < dev->data->nb_tx_queues; i++) {
-			ret = txa_service_queue_del(id, dev, i);
-			if (ret != 0)
-				break;
+		nb_queues = txa->nb_queues;
+		if (nb_queues == 0)
+			return 0;
+
+		i = 0;
+		q = 0;
+		tqi = txa->txa_ethdev[port_id].queues;
+
+		while (i < nb_queues) {
+
+			if (tqi[q].added) {
+				ret = txa_service_queue_del(id, dev, q);
+				if (ret != 0)
+					break;
+			}
+			i++;
+			q++;
 		}
 		return ret;
 	}
 
 	txa = txa_service_id_to_data(id);
-	port_id = dev->data->port_id;
 
 	tqi = txa_service_queue(txa, port_id, tx_queue_id);
 	if (tqi == NULL || !tqi->added)
@@ -999,11 +1027,7 @@ static int txa_service_queue_del(uint8_t id,
 	TXA_CHECK_OR_ERR_RET(id);
 
 	eth_dev = &rte_eth_devices[eth_dev_id];
-	if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues) {
-		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
-				(uint16_t)queue);
-		return -EINVAL;
-	}
+	TXA_CHECK_TXQ(eth_dev, queue);
 
 	caps = 0;
 	if (txa_dev_caps_get(id))
@@ -1034,11 +1058,6 @@ static int txa_service_queue_del(uint8_t id,
 	TXA_CHECK_OR_ERR_RET(id);
 
 	eth_dev = &rte_eth_devices[eth_dev_id];
-	if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues) {
-		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
-				(uint16_t)queue);
-		return -EINVAL;
-	}
 
 	caps = 0;
 
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH] eventdev: fix eth Tx adapter queue count checks
  2018-11-29 11:11 [dpdk-dev] [PATCH] eventdev: fix eth Tx adapter queue count checks Nikhil Rao
@ 2018-12-01 14:39 ` Jerin Jacob
  2018-12-03  7:37   ` Rao, Nikhil
  2018-12-13  8:23 ` [dpdk-dev] [PATCH v2] " Nikhil Rao
  2018-12-17  4:39 ` [dpdk-dev] [PATCH v3] " Nikhil Rao
  2 siblings, 1 reply; 7+ messages in thread
From: Jerin Jacob @ 2018-12-01 14:39 UTC (permalink / raw)
  To: Nikhil Rao; +Cc: dev, stable

-----Original Message-----
> Date: Thu, 29 Nov 2018 16:41:48 +0530
> From: Nikhil Rao <nikhil.rao@intel.com>
> To: jerin.jacob@caviumnetworks.com
> CC: dev@dpdk.org, Nikhil Rao <nikhil.rao@intel.com>, stable@dpdk.org
> Subject: [PATCH] eventdev: fix eth Tx adapter queue count checks
> X-Mailer: git-send-email 1.8.3.1
> 
> 
> rte_event_eth_tx_adapter_queue_add() - add a check
> that returns an error if the ethdev the zero Tx queues
> configured.
> 
> rte_event_eth_tx_adapter_queue_del() - remove the
> checks for ethdev queue count, instead check for
> queues added to the adapter which maybe different
> from the current ethdev queue count.
> 
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: stable@dpdk.org
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
>  lib/librte_eventdev/rte_event_eth_tx_adapter.c | 53 +++++++++++++++++---------
>  1 file changed, 36 insertions(+), 17 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> index ccf8a75..8431656 100644
> --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> @@ -59,6 +59,19 @@
>                 return -EINVAL; \
>  } while (0)
> 
> +#define TXA_CHECK_TXQ(dev, queue) \
> +do {\
> +       if ((dev)->data->nb_tx_queues == 0) { \
> +               RTE_EDEV_LOG_ERR("No tx queues configured"); \
> +               return -EINVAL; \
> +       } \
> +       if (queue != -1 && (uint16_t)queue >= (dev)->data->nb_tx_queues) { \

The queue should be bracket i.e ((queue) != 1) to avoid any side effect

> +               RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, \
> +                               (uint16_t)queue); \
> +               return -EINVAL; \
> +       } \
> +} while (0)
> +
>         txa = txa_service_id_to_data(id);
> -       port_id = dev->data->port_id;
> 
>         tqi = txa_service_queue(txa, port_id, tx_queue_id);
>         if (tqi == NULL || !tqi->added)
> @@ -999,11 +1027,7 @@ static int txa_service_queue_del(uint8_t id,
>         TXA_CHECK_OR_ERR_RET(id);
> 
>         eth_dev = &rte_eth_devices[eth_dev_id];
> -       if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues) {
> -               RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
> -                               (uint16_t)queue);
> -               return -EINVAL;
> -       }
> +       TXA_CHECK_TXQ(eth_dev, queue);
> 
>         caps = 0;
>         if (txa_dev_caps_get(id))
> @@ -1034,11 +1058,6 @@ static int txa_service_queue_del(uint8_t id,
>         TXA_CHECK_OR_ERR_RET(id);
> 
>         eth_dev = &rte_eth_devices[eth_dev_id];
> -       if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues) {
> -               RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
> -                               (uint16_t)queue);
> -               return -EINVAL;
> -       }

Shouldn't we need TXA_CHECK_TXQ here? If we need only one place, Do we need
macro?


> 
>         caps = 0;
> 
> --
> 1.8.3.1
> 

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

* Re: [dpdk-dev] [PATCH] eventdev: fix eth Tx adapter queue count checks
  2018-12-01 14:39 ` Jerin Jacob
@ 2018-12-03  7:37   ` Rao, Nikhil
  0 siblings, 0 replies; 7+ messages in thread
From: Rao, Nikhil @ 2018-12-03  7:37 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, stable

> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Saturday, December 1, 2018 8:09 PM
> To: Rao, Nikhil <nikhil.rao@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [PATCH] eventdev: fix eth Tx adapter queue count checks
> 
> -----Original Message-----
> > Date: Thu, 29 Nov 2018 16:41:48 +0530
> > From: Nikhil Rao <nikhil.rao@intel.com>
> > To: jerin.jacob@caviumnetworks.com
> > CC: dev@dpdk.org, Nikhil Rao <nikhil.rao@intel.com>, stable@dpdk.org
> > Subject: [PATCH] eventdev: fix eth Tx adapter queue count checks
> > X-Mailer: git-send-email 1.8.3.1
> >
> >
> > rte_event_eth_tx_adapter_queue_add() - add a check that returns an
> > error if the ethdev the zero Tx queues configured.
> >
> > rte_event_eth_tx_adapter_queue_del() - remove the checks for ethdev
> > queue count, instead check for queues added to the adapter which maybe
> > different from the current ethdev queue count.
> >
> > Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> > Cc: stable@dpdk.org
> > Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> > ---
> >  lib/librte_eventdev/rte_event_eth_tx_adapter.c | 53
> > +++++++++++++++++---------
> >  1 file changed, 36 insertions(+), 17 deletions(-)
> >
> > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> > b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> > index ccf8a75..8431656 100644
> > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> > @@ -59,6 +59,19 @@
> >                 return -EINVAL; \
> >  } while (0)
> >
> > +#define TXA_CHECK_TXQ(dev, queue) \
> > +do {\
> > +       if ((dev)->data->nb_tx_queues == 0) { \
> > +               RTE_EDEV_LOG_ERR("No tx queues configured"); \
> > +               return -EINVAL; \
> > +       } \
> > +       if (queue != -1 && (uint16_t)queue >=
> > +(dev)->data->nb_tx_queues) { \
> 
> The queue should be bracket i.e ((queue) != 1) to avoid any side effect
> 

Thanks. Will fix.

> > +               RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, \
> > +                               (uint16_t)queue); \
> > +               return -EINVAL; \
> > +       } \
> > +} while (0)
> > +
> >         txa = txa_service_id_to_data(id);
> > -       port_id = dev->data->port_id;
> >
> >         tqi = txa_service_queue(txa, port_id, tx_queue_id);
> >         if (tqi == NULL || !tqi->added) @@ -999,11 +1027,7 @@ static
> > int txa_service_queue_del(uint8_t id,
> >         TXA_CHECK_OR_ERR_RET(id);
> >
> >         eth_dev = &rte_eth_devices[eth_dev_id];
> > -       if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues)
> {
> > -               RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
> > -                               (uint16_t)queue);
> > -               return -EINVAL;
> > -       }
> > +       TXA_CHECK_TXQ(eth_dev, queue);
> >
> >         caps = 0;
> >         if (txa_dev_caps_get(id))
> > @@ -1034,11 +1058,6 @@ static int txa_service_queue_del(uint8_t id,
> >         TXA_CHECK_OR_ERR_RET(id);
> >
> >         eth_dev = &rte_eth_devices[eth_dev_id];
> > -       if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues)
> {
> > -               RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
> > -                               (uint16_t)queue);
> > -               return -EINVAL;
> > -       }
> 
> Shouldn't we need TXA_CHECK_TXQ here? 

This patch updates the common queue delete code to handle queues that have been added to the adapter (so rte_event_eth_tx_adapter_queue_del() will also work after if its called after calling rte_eth_dev_close())

> If we need only one place, Do we
> need macro?

I won't say we need it,  I had it originally in rte_event_eth_tx_adapter_queue_del() as well, I retained it since it eliminated clutter in rte_event_eth_tx_adapter_queue_add().

Nikhil

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

* [dpdk-dev] [PATCH v2] eventdev: fix eth Tx adapter queue count checks
  2018-11-29 11:11 [dpdk-dev] [PATCH] eventdev: fix eth Tx adapter queue count checks Nikhil Rao
  2018-12-01 14:39 ` Jerin Jacob
@ 2018-12-13  8:23 ` Nikhil Rao
  2018-12-16 23:11   ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
  2018-12-17  4:39 ` [dpdk-dev] [PATCH v3] " Nikhil Rao
  2 siblings, 1 reply; 7+ messages in thread
From: Nikhil Rao @ 2018-12-13  8:23 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, Nikhil Rao, stable

rte_event_eth_tx_adapter_queue_add() - add a check
that returns an error if the ethdev the zero Tx queues
configured.

rte_event_eth_tx_adapter_queue_del() - remove the
checks for ethdev queue count, instead check for
queues added to the adapter which maybe different
from the current ethdev queue count.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
 lib/librte_eventdev/rte_event_eth_tx_adapter.c | 53 +++++++++++++++++---------
 1 file changed, 36 insertions(+), 17 deletions(-)

v2:
- enclosed macro parameter queue in ()

diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
index ccf8a75..8431656 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
@@ -59,6 +59,19 @@
 		return -EINVAL; \
 } while (0)
 
+#define TXA_CHECK_TXQ(dev, queue) \
+do {\
+	if ((dev)->data->nb_tx_queues == 0) { \
+		RTE_EDEV_LOG_ERR("No tx queues configured"); \
+		return -EINVAL; \
+	} \
+	if (queue != -1 && (uint16_t)queue >= (dev)->data->nb_tx_queues) { \
+		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, \
+				(uint16_t)queue); \
+		return -EINVAL; \
+	} \
+} while (0)
+
 /* Tx retry callback structure */
 struct txa_retry {
 	/* Ethernet port id */
@@ -795,20 +808,35 @@ static int txa_service_queue_del(uint8_t id,
 	struct rte_eth_dev_tx_buffer *tb;
 	uint16_t port_id;
 
+	txa = txa_service_id_to_data(id);
+	port_id = dev->data->port_id;
+
 	if (tx_queue_id == -1) {
-		uint16_t i;
-		int ret = -1;
+		uint16_t i, q, nb_queues;
+		int ret = 0;
 
-		for (i = 0; i < dev->data->nb_tx_queues; i++) {
-			ret = txa_service_queue_del(id, dev, i);
-			if (ret != 0)
-				break;
+		nb_queues = txa->nb_queues;
+		if (nb_queues == 0)
+			return 0;
+
+		i = 0;
+		q = 0;
+		tqi = txa->txa_ethdev[port_id].queues;
+
+		while (i < nb_queues) {
+
+			if (tqi[q].added) {
+				ret = txa_service_queue_del(id, dev, q);
+				if (ret != 0)
+					break;
+			}
+			i++;
+			q++;
 		}
 		return ret;
 	}
 
 	txa = txa_service_id_to_data(id);
-	port_id = dev->data->port_id;
 
 	tqi = txa_service_queue(txa, port_id, tx_queue_id);
 	if (tqi == NULL || !tqi->added)
@@ -999,11 +1027,7 @@ static int txa_service_queue_del(uint8_t id,
 	TXA_CHECK_OR_ERR_RET(id);
 
 	eth_dev = &rte_eth_devices[eth_dev_id];
-	if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues) {
-		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
-				(uint16_t)queue);
-		return -EINVAL;
-	}
+	TXA_CHECK_TXQ(eth_dev, queue);
 
 	caps = 0;
 	if (txa_dev_caps_get(id))
@@ -1034,11 +1058,6 @@ static int txa_service_queue_del(uint8_t id,
 	TXA_CHECK_OR_ERR_RET(id);
 
 	eth_dev = &rte_eth_devices[eth_dev_id];
-	if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues) {
-		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
-				(uint16_t)queue);
-		return -EINVAL;
-	}
 
 	caps = 0;
 
-- 
1.8.3.1

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

* Re: [dpdk-dev] [EXT] [PATCH v2] eventdev: fix eth Tx adapter queue count checks
  2018-12-13  8:23 ` [dpdk-dev] [PATCH v2] " Nikhil Rao
@ 2018-12-16 23:11   ` Jerin Jacob Kollanukkaran
  0 siblings, 0 replies; 7+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2018-12-16 23:11 UTC (permalink / raw)
  To: nikhil.rao, dev; +Cc: jerin.jacob, stable

On Thu, 2018-12-13 at 13:53 +0530, Nikhil Rao wrote:
> 
> rte_event_eth_tx_adapter_queue_add() - add a check
> that returns an error if the ethdev the zero Tx queues
> configured.
> 
> rte_event_eth_tx_adapter_queue_del() - remove the
> checks for ethdev queue count, instead check for
> queues added to the adapter which maybe different
> from the current ethdev queue count.
> 
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: stable@dpdk.org
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
>  lib/librte_eventdev/rte_event_eth_tx_adapter.c | 53
> +++++++++++++++++---------
>  1 file changed, 36 insertions(+), 17 deletions(-)
> 
> v2:
> - enclosed macro parameter queue in ()
> 
> diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> index ccf8a75..8431656 100644
> --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
> @@ -59,6 +59,19 @@
>                 return -EINVAL; \
>  } while (0)
> 
> +#define TXA_CHECK_TXQ(dev, queue) \
> +do {\
> +       if ((dev)->data->nb_tx_queues == 0) { \
> +               RTE_EDEV_LOG_ERR("No tx queues configured"); \
> +               return -EINVAL; \
> +       } \
> +       if (queue != -1 && (uint16_t)queue >= (dev)->data-

missing enclosure for queue to avoid side effects, ie.
	if ((queue) != -1 && (uint16_t)(queue)


> >nb_tx_queues) { \
> +               RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, \
> +                               (uint16_t)queue); \

(uint16_t)(queue)

> +               return -EINVAL; \
> +       } \
> +} while (0)


Another than above nits,

Acked-by: Jerin Jacob <jerinj@marvell.com>

Please send the v3 asap so that I can include it in RC1.


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

* [dpdk-dev] [PATCH v3] eventdev: fix eth Tx adapter queue count checks
  2018-11-29 11:11 [dpdk-dev] [PATCH] eventdev: fix eth Tx adapter queue count checks Nikhil Rao
  2018-12-01 14:39 ` Jerin Jacob
  2018-12-13  8:23 ` [dpdk-dev] [PATCH v2] " Nikhil Rao
@ 2018-12-17  4:39 ` Nikhil Rao
  2018-12-17 21:14   ` Jerin Jacob Kollanukkaran
  2 siblings, 1 reply; 7+ messages in thread
From: Nikhil Rao @ 2018-12-17  4:39 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, Nikhil Rao, stable

rte_event_eth_tx_adapter_queue_add() - add a check
that returns an error if the ethdev has zero Tx queues
configured.

rte_event_eth_tx_adapter_queue_del() - remove the
checks for ethdev queue count, instead check for
queues added to the adapter which maybe different
from the current ethdev queue count.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---

v2:
- none (missed adding changes, now in v3)
v3:
- enclosed macro parameter queue in ()


 lib/librte_eventdev/rte_event_eth_tx_adapter.c | 54 ++++++++++++++++++--------
 1 file changed, 37 insertions(+), 17 deletions(-)

diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
index ccf8a75..67216a3 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
@@ -59,6 +59,20 @@
 		return -EINVAL; \
 } while (0)
 
+#define TXA_CHECK_TXQ(dev, queue) \
+do {\
+	if ((dev)->data->nb_tx_queues == 0) { \
+		RTE_EDEV_LOG_ERR("No tx queues configured"); \
+		return -EINVAL; \
+	} \
+	if ((queue) != -1 && \
+		(uint16_t)(queue) >= (dev)->data->nb_tx_queues) { \
+		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, \
+				(uint16_t)(queue)); \
+		return -EINVAL; \
+	} \
+} while (0)
+
 /* Tx retry callback structure */
 struct txa_retry {
 	/* Ethernet port id */
@@ -795,20 +809,35 @@ static int txa_service_queue_del(uint8_t id,
 	struct rte_eth_dev_tx_buffer *tb;
 	uint16_t port_id;
 
+	txa = txa_service_id_to_data(id);
+	port_id = dev->data->port_id;
+
 	if (tx_queue_id == -1) {
-		uint16_t i;
-		int ret = -1;
+		uint16_t i, q, nb_queues;
+		int ret = 0;
 
-		for (i = 0; i < dev->data->nb_tx_queues; i++) {
-			ret = txa_service_queue_del(id, dev, i);
-			if (ret != 0)
-				break;
+		nb_queues = txa->nb_queues;
+		if (nb_queues == 0)
+			return 0;
+
+		i = 0;
+		q = 0;
+		tqi = txa->txa_ethdev[port_id].queues;
+
+		while (i < nb_queues) {
+
+			if (tqi[q].added) {
+				ret = txa_service_queue_del(id, dev, q);
+				if (ret != 0)
+					break;
+			}
+			i++;
+			q++;
 		}
 		return ret;
 	}
 
 	txa = txa_service_id_to_data(id);
-	port_id = dev->data->port_id;
 
 	tqi = txa_service_queue(txa, port_id, tx_queue_id);
 	if (tqi == NULL || !tqi->added)
@@ -999,11 +1028,7 @@ static int txa_service_queue_del(uint8_t id,
 	TXA_CHECK_OR_ERR_RET(id);
 
 	eth_dev = &rte_eth_devices[eth_dev_id];
-	if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues) {
-		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
-				(uint16_t)queue);
-		return -EINVAL;
-	}
+	TXA_CHECK_TXQ(eth_dev, queue);
 
 	caps = 0;
 	if (txa_dev_caps_get(id))
@@ -1034,11 +1059,6 @@ static int txa_service_queue_del(uint8_t id,
 	TXA_CHECK_OR_ERR_RET(id);
 
 	eth_dev = &rte_eth_devices[eth_dev_id];
-	if (queue != -1 && (uint16_t)queue >= eth_dev->data->nb_tx_queues) {
-		RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16,
-				(uint16_t)queue);
-		return -EINVAL;
-	}
 
 	caps = 0;
 
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH v3] eventdev: fix eth Tx adapter queue count checks
  2018-12-17  4:39 ` [dpdk-dev] [PATCH v3] " Nikhil Rao
@ 2018-12-17 21:14   ` Jerin Jacob Kollanukkaran
  0 siblings, 0 replies; 7+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2018-12-17 21:14 UTC (permalink / raw)
  To: nikhil.rao, dev; +Cc: jerin.jacob, stable

On Mon, 2018-12-17 at 10:09 +0530, Nikhil Rao wrote:
> rte_event_eth_tx_adapter_queue_add() - add a check
> that returns an error if the ethdev has zero Tx queues
> configured.
> 
> rte_event_eth_tx_adapter_queue_del() - remove the
> checks for ethdev queue count, instead check for
> queues added to the adapter which maybe different
> from the current ethdev queue count.
> 
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: stable@dpdk.org
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>


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


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

end of thread, other threads:[~2018-12-17 21:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 11:11 [dpdk-dev] [PATCH] eventdev: fix eth Tx adapter queue count checks Nikhil Rao
2018-12-01 14:39 ` Jerin Jacob
2018-12-03  7:37   ` Rao, Nikhil
2018-12-13  8:23 ` [dpdk-dev] [PATCH v2] " Nikhil Rao
2018-12-16 23:11   ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
2018-12-17  4:39 ` [dpdk-dev] [PATCH v3] " Nikhil Rao
2018-12-17 21:14   ` Jerin Jacob Kollanukkaran

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