DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] eventdev: use links_map to unlink queues
@ 2017-12-11 15:05 Pavan Nikhilesh
  2017-12-11 17:24 ` Eads, Gage
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pavan Nikhilesh @ 2017-12-11 15:05 UTC (permalink / raw)
  To: gage.eads, jerin.jacob, bruce.richardson, nipun.gupta,
	santosh.shukla, harry.van.haaren, hemant.agrawal
  Cc: dev, Pavan Nikhilesh

The octeontx event device doesn't store the queues to port mapping as a result
it cannot return the exact number of queues unlinked from a port when
application wants to unlink all the queues mapped (supplies queues param as
NULL).

Using links_map we can determine the exact queues mapped to a specific port and
unlink them.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventdev.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index e0c2a78..e17f8fc 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -888,7 +888,8 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 {
 	struct rte_eventdev *dev;
 	uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
-	int i, diag;
+	uint8_t linked_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
+	int i, diag, j;
 	uint16_t *links_map;
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0);
@@ -918,6 +919,18 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 			rte_errno = -EINVAL;
 			return 0;
 		}
+	j = 0;
+	links_map = dev->data->links_map;
+	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
+	for (i = 0; i < nb_unlinks; i++) {
+		if (links_map[queues[i]] !=
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
+			linked_queues[j] = queues[i];
+			j++;
+		}
+	}
+	queues = linked_queues;
+	nb_unlinks = j;
 
 	diag = (*dev->dev_ops->port_unlink)(dev, dev->data->ports[port_id],
 					queues, nb_unlinks);
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues
  2017-12-11 15:05 [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues Pavan Nikhilesh
@ 2017-12-11 17:24 ` Eads, Gage
  2017-12-12  7:23   ` Pavan Nikhilesh Bhagavatula
  2017-12-12  9:33 ` [dpdk-dev] [PATCH v2] eventdev: use links map " Pavan Nikhilesh
  2017-12-12 18:58 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
  2 siblings, 1 reply; 8+ messages in thread
From: Eads, Gage @ 2017-12-11 17:24 UTC (permalink / raw)
  To: Pavan Nikhilesh, jerin.jacob, Richardson, Bruce, nipun.gupta,
	santosh.shukla, Van Haaren, Harry, hemant.agrawal
  Cc: dev


> -----Original Message-----
> From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> Sent: Monday, December 11, 2017 9:05 AM
> To: Eads, Gage <gage.eads@intel.com>; jerin.jacob@caviumnetworks.com;
> Richardson, Bruce <bruce.richardson@intel.com>; nipun.gupta@nxp.com;
> santosh.shukla@caviumnetworks.com; Van Haaren, Harry
> <harry.van.haaren@intel.com>; hemant.agrawal@nxp.com
> Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues
> 
> The octeontx event device doesn't store the queues to port mapping as a result
> it cannot return the exact number of queues unlinked from a port when
> application wants to unlink all the queues mapped (supplies queues param as
> NULL).
> 
> Using links_map we can determine the exact queues mapped to a specific port
> and unlink them.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  lib/librte_eventdev/rte_eventdev.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev.c
> b/lib/librte_eventdev/rte_eventdev.c
> index e0c2a78..e17f8fc 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -888,7 +888,8 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,  {
>  	struct rte_eventdev *dev;
>  	uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> -	int i, diag;
> +	uint8_t linked_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> +	int i, diag, j;
>  	uint16_t *links_map;
> 
>  	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0);
> @@ -918,6 +919,18 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
>  			rte_errno = -EINVAL;
>  			return 0;
>  		}
> +	j = 0;
> +	links_map = dev->data->links_map;
> +	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
> +	for (i = 0; i < nb_unlinks; i++) {
> +		if (links_map[queues[i]] !=
> +				EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
> +			linked_queues[j] = queues[i];
> +			j++;
> +		}
> +	}
> +	queues = linked_queues;
> +	nb_unlinks = j;

Consider the following case where queues is non-NULL: nb_unlinks = 3, queues = [0, 5, 2], and queue 5 is not linked to the port.

This new code block will unlink queues 0 and 2, and the function will return 2. However the documentation states that "if the return value is less than *nb_unlinks*, the remaining queues at the end of queues[] are not established", so a return value of 2 would imply that queues 0 and 5 were unlinked, but queue 2 was not.

Perhaps this code could be moved to the "if (queues == NULL)" block, and in its place you can update nb_unlinks like so to handle the non-NULL queues case:

	links_map = dev->data->links_map;
	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
	for (i = 0; i < nb_unlinks; i++) {
		if (links_map[queues[i]] !=
				EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
			break;
	}
	nb_unlinks = i;

Thanks,
Gage

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

* Re: [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues
  2017-12-11 17:24 ` Eads, Gage
@ 2017-12-12  7:23   ` Pavan Nikhilesh Bhagavatula
  0 siblings, 0 replies; 8+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2017-12-12  7:23 UTC (permalink / raw)
  To: Eads, Gage, jerin.jacob, Richardson, Bruce, nipun.gupta,
	santosh.shukla, Van Haaren, Harry, hemant.agrawal
  Cc: dev

On Mon, Dec 11, 2017 at 05:24:57PM +0000, Eads, Gage wrote:
>
> > -----Original Message-----
> > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> > Sent: Monday, December 11, 2017 9:05 AM
> > To: Eads, Gage <gage.eads@intel.com>; jerin.jacob@caviumnetworks.com;
> > Richardson, Bruce <bruce.richardson@intel.com>; nipun.gupta@nxp.com;
> > santosh.shukla@caviumnetworks.com; Van Haaren, Harry
> > <harry.van.haaren@intel.com>; hemant.agrawal@nxp.com
> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues
> >
> > The octeontx event device doesn't store the queues to port mapping as a result
> > it cannot return the exact number of queues unlinked from a port when
> > application wants to unlink all the queues mapped (supplies queues param as
> > NULL).
> >
> > Using links_map we can determine the exact queues mapped to a specific port
> > and unlink them.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > ---
> >  lib/librte_eventdev/rte_eventdev.c | 15 ++++++++++++++-
> >  1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > b/lib/librte_eventdev/rte_eventdev.c
> > index e0c2a78..e17f8fc 100644
> > --- a/lib/librte_eventdev/rte_eventdev.c
> > +++ b/lib/librte_eventdev/rte_eventdev.c
> > @@ -888,7 +888,8 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,  {
> >  	struct rte_eventdev *dev;
> >  	uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> > -	int i, diag;
> > +	uint8_t linked_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> > +	int i, diag, j;
> >  	uint16_t *links_map;
> >
> >  	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0);
> > @@ -918,6 +919,18 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
> >  			rte_errno = -EINVAL;
> >  			return 0;
> >  		}
> > +	j = 0;
> > +	links_map = dev->data->links_map;
> > +	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
> > +	for (i = 0; i < nb_unlinks; i++) {
> > +		if (links_map[queues[i]] !=
> > +				EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
> > +			linked_queues[j] = queues[i];
> > +			j++;
> > +		}
> > +	}
> > +	queues = linked_queues;
> > +	nb_unlinks = j;
>
> Consider the following case where queues is non-NULL: nb_unlinks = 3, queues = [0, 5, 2], and queue 5 is not linked to the port.
>
> This new code block will unlink queues 0 and 2, and the function will return 2. However the documentation states that "if the return value is less than *nb_unlinks*, the remaining queues at the end of queues[] are not established", so a return value of 2 would imply that queues 0 and 5 were unlinked, but queue 2 was not.
>
> Perhaps this code could be moved to the "if (queues == NULL)" block, and in its place you can update nb_unlinks like so to handle the non-NULL queues case:
>
> 	links_map = dev->data->links_map;
> 	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
> 	for (i = 0; i < nb_unlinks; i++) {
> 		if (links_map[queues[i]] !=
> 				EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
> 			break;
> 	}
> 	nb_unlinks = i;
>
> Thanks,
> Gage

Agreed, will send out a cleaned up v2 addressing both the cases.

Thanks,
Pavan.

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

* [dpdk-dev]  [PATCH v2] eventdev: use links map to unlink queues
  2017-12-11 15:05 [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues Pavan Nikhilesh
  2017-12-11 17:24 ` Eads, Gage
@ 2017-12-12  9:33 ` Pavan Nikhilesh
  2017-12-12 16:08   ` Eads, Gage
  2017-12-12 18:58 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
  2 siblings, 1 reply; 8+ messages in thread
From: Pavan Nikhilesh @ 2017-12-12  9:33 UTC (permalink / raw)
  To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads,
	hemant.agrawal, nipun.gupta, nikhil.rao, santosh.shukla
  Cc: dev, Pavan Nikhilesh

The octeontx event device doesn't store the queues to port mapping as a
result it cannot return the exact number of queues unlinked from a port
when application wants to unlink all the queues mapped (supplies queues
param as NULL).

Using links_map we can determine the exact queues mapped to a specific
port and unlink them.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventdev.c | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index e0c2a78..b43ffbf 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -888,7 +888,8 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 {
 	struct rte_eventdev *dev;
 	uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
-	int i, diag;
+	uint8_t linked_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
+	int i, diag, j;
 	uint16_t *links_map;
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0);
@@ -906,13 +907,34 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		return 0;
 	}
 
+	links_map = dev->data->links_map;
+	/* Point links_map to this port specific area */
+	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
+
 	if (queues == NULL) {
-		for (i = 0; i < dev->data->nb_queues; i++)
-			all_queues[i] = i;
+		j = 0;
+		for (i = 0; i < dev->data->nb_queues; i++) {
+			if (links_map[i] !=
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
+				all_queues[j] = i;
+				j++;
+			}
+		}
 		queues = all_queues;
-		nb_unlinks = dev->data->nb_queues;
+	} else {
+		j = 0;
+		for (i = 0; i < nb_unlinks; i++) {
+			if (links_map[queues[i]] ==
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
+				break;
+
+			linked_queues[j] = queues[i];
+			j++;
+		}
+		queues = linked_queues;
 	}
 
+	nb_unlinks = j;
 	for (i = 0; i < nb_unlinks; i++)
 		if (queues[i] >= dev->data->nb_queues) {
 			rte_errno = -EINVAL;
@@ -925,9 +947,6 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 	if (diag < 0)
 		return diag;
 
-	links_map = dev->data->links_map;
-	/* Point links_map to this port specific area */
-	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
 	for (i = 0; i < diag; i++)
 		links_map[queues[i]] = EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] eventdev: use links map to unlink queues
  2017-12-12  9:33 ` [dpdk-dev] [PATCH v2] eventdev: use links map " Pavan Nikhilesh
@ 2017-12-12 16:08   ` Eads, Gage
  2017-12-12 17:22     ` Pavan Nikhilesh Bhagavatula
  0 siblings, 1 reply; 8+ messages in thread
From: Eads, Gage @ 2017-12-12 16:08 UTC (permalink / raw)
  To: Pavan Nikhilesh, jerin.jacob, Richardson, Bruce, Van Haaren,
	Harry, hemant.agrawal, nipun.gupta, Rao, Nikhil, santosh.shukla
  Cc: dev



> -----Original Message-----
> From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> Sent: Tuesday, December 12, 2017 3:34 AM
> To: jerin.jacob@caviumnetworks.com; Richardson, Bruce
> <bruce.richardson@intel.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>;
> hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Rao, Nikhil
> <nikhil.rao@intel.com>; santosh.shukla@caviumnetworks.com
> Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v2] eventdev: use links map to unlink queues
> 
> The octeontx event device doesn't store the queues to port mapping as a result
> it cannot return the exact number of queues unlinked from a port when
> application wants to unlink all the queues mapped (supplies queues param as
> NULL).
> 
> Using links_map we can determine the exact queues mapped to a specific port
> and unlink them.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  lib/librte_eventdev/rte_eventdev.c | 33 ++++++++++++++++++++++++++-------
>  1 file changed, 26 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev.c
> b/lib/librte_eventdev/rte_eventdev.c
> index e0c2a78..b43ffbf 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -888,7 +888,8 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,  {
>  	struct rte_eventdev *dev;
>  	uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> -	int i, diag;
> +	uint8_t linked_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> +	int i, diag, j;
>  	uint16_t *links_map;
> 
>  	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0);
> @@ -906,13 +907,34 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t
> port_id,
>  		return 0;
>  	}
> 
> +	links_map = dev->data->links_map;
> +	/* Point links_map to this port specific area */
> +	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
> +
>  	if (queues == NULL) {
> -		for (i = 0; i < dev->data->nb_queues; i++)
> -			all_queues[i] = i;
> +		j = 0;
> +		for (i = 0; i < dev->data->nb_queues; i++) {
> +			if (links_map[i] !=
> +
> 	EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
> +				all_queues[j] = i;
> +				j++;
> +			}
> +		}
>  		queues = all_queues;
> -		nb_unlinks = dev->data->nb_queues;
> +	} else {
> +		j = 0;
> +		for (i = 0; i < nb_unlinks; i++) {
> +			if (links_map[queues[i]] ==
> +
> 	EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
> +				break;
> +
> +			linked_queues[j] = queues[i];
> +			j++;
> +		}
> +		queues = linked_queues;
>  	}
> 

Looks good. If you want, you can simplify the else case like so:

+	} else {
+		for (j = 0; j < nb_unlinks; j++)
+			if (links_map[queues[j]] ==
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
+				break;
+	}

Up to you. Either way:
Acked-by: Gage Eads <gage.eads@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] eventdev: use links map to unlink queues
  2017-12-12 16:08   ` Eads, Gage
@ 2017-12-12 17:22     ` Pavan Nikhilesh Bhagavatula
  0 siblings, 0 replies; 8+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2017-12-12 17:22 UTC (permalink / raw)
  To: Eads, Gage, jerin.jacob, Richardson, Bruce, Van Haaren, Harry,
	hemant.agrawal, nipun.gupta, Rao, Nikhil, santosh.shukla
  Cc: dev

On Tue, Dec 12, 2017 at 04:08:12PM +0000, Eads, Gage wrote:
>
>
> > -----Original Message-----
> > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> > Sent: Tuesday, December 12, 2017 3:34 AM
> > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce
> > <bruce.richardson@intel.com>; Van Haaren, Harry
> > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>;
> > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Rao, Nikhil
> > <nikhil.rao@intel.com>; santosh.shukla@caviumnetworks.com
> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH v2] eventdev: use links map to unlink queues
> >
> > The octeontx event device doesn't store the queues to port mapping as a result
> > it cannot return the exact number of queues unlinked from a port when
> > application wants to unlink all the queues mapped (supplies queues param as
> > NULL).
> >
> > Using links_map we can determine the exact queues mapped to a specific port
> > and unlink them.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > ---
> >  lib/librte_eventdev/rte_eventdev.c | 33 ++++++++++++++++++++++++++-------
> >  1 file changed, 26 insertions(+), 7 deletions(-)
> >
> > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > b/lib/librte_eventdev/rte_eventdev.c
> > index e0c2a78..b43ffbf 100644
> > --- a/lib/librte_eventdev/rte_eventdev.c
> > +++ b/lib/librte_eventdev/rte_eventdev.c
> > @@ -888,7 +888,8 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,  {
> >  	struct rte_eventdev *dev;
> >  	uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> > -	int i, diag;
> > +	uint8_t linked_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> > +	int i, diag, j;
> >  	uint16_t *links_map;
> >
> >  	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0);
> > @@ -906,13 +907,34 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t
> > port_id,
> >  		return 0;
> >  	}
> >
> > +	links_map = dev->data->links_map;
> > +	/* Point links_map to this port specific area */
> > +	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
> > +
> >  	if (queues == NULL) {
> > -		for (i = 0; i < dev->data->nb_queues; i++)
> > -			all_queues[i] = i;
> > +		j = 0;
> > +		for (i = 0; i < dev->data->nb_queues; i++) {
> > +			if (links_map[i] !=
> > +
> > 	EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
> > +				all_queues[j] = i;
> > +				j++;
> > +			}
> > +		}
> >  		queues = all_queues;
> > -		nb_unlinks = dev->data->nb_queues;
> > +	} else {
> > +		j = 0;
> > +		for (i = 0; i < nb_unlinks; i++) {
> > +			if (links_map[queues[i]] ==
> > +
> > 	EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
> > +				break;
> > +
> > +			linked_queues[j] = queues[i];
> > +			j++;
> > +		}
> > +		queues = linked_queues;
> >  	}
> >
>
> Looks good. If you want, you can simplify the else case like so:
>
> +	} else {
> +		for (j = 0; j < nb_unlinks; j++)
> +			if (links_map[queues[j]] ==
> +					EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
> +				break;
> +	}

Thanks Gage, will clean up 'linked_queues' and send v3.

Pavan
>
> Up to you. Either way:
> Acked-by: Gage Eads <gage.eads@intel.com>

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

* [dpdk-dev]  [PATCH v3] eventdev: use links map to unlink queues
  2017-12-11 15:05 [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues Pavan Nikhilesh
  2017-12-11 17:24 ` Eads, Gage
  2017-12-12  9:33 ` [dpdk-dev] [PATCH v2] eventdev: use links map " Pavan Nikhilesh
@ 2017-12-12 18:58 ` Pavan Nikhilesh
  2017-12-16  9:16   ` Jerin Jacob
  2 siblings, 1 reply; 8+ messages in thread
From: Pavan Nikhilesh @ 2017-12-12 18:58 UTC (permalink / raw)
  To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads,
	hemant.agrawal, nipun.gupta, nikhil.rao, santosh.shukla
  Cc: dev, Pavan Nikhilesh

The octeontx event device doesn't store the queues to port mapping as a
result it cannot return the exact number of queues unlinked from a port
when application wants to unlink all the queues mapped (supplies queues
param as NULL).

Using links_map we can determine the exact queues mapped to a specific
port and unlink them.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
---

 v3 Changes:
  - Clean up unneeded variables.

 v2 Changes:
  - Fixed issue when invalid queue exists in between valid queue id's of the
  queue list.

 lib/librte_eventdev/rte_eventdev.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index e0c2a7876..fec252bf1 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -888,7 +888,7 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 {
 	struct rte_eventdev *dev;
 	uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
-	int i, diag;
+	int i, diag, j;
 	uint16_t *links_map;

 	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0);
@@ -906,13 +906,29 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		return 0;
 	}

+	links_map = dev->data->links_map;
+	/* Point links_map to this port specific area */
+	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
+
 	if (queues == NULL) {
-		for (i = 0; i < dev->data->nb_queues; i++)
-			all_queues[i] = i;
+		j = 0;
+		for (i = 0; i < dev->data->nb_queues; i++) {
+			if (links_map[i] !=
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
+				all_queues[j] = i;
+				j++;
+			}
+		}
 		queues = all_queues;
-		nb_unlinks = dev->data->nb_queues;
+	} else {
+		for (j = 0; j < nb_unlinks; j++) {
+			if (links_map[queues[j]] ==
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
+				break;
+		}
 	}

+	nb_unlinks = j;
 	for (i = 0; i < nb_unlinks; i++)
 		if (queues[i] >= dev->data->nb_queues) {
 			rte_errno = -EINVAL;
@@ -925,9 +941,6 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 	if (diag < 0)
 		return diag;

-	links_map = dev->data->links_map;
-	/* Point links_map to this port specific area */
-	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
 	for (i = 0; i < diag; i++)
 		links_map[queues[i]] = EVENT_QUEUE_SERVICE_PRIORITY_INVALID;

--
2.14.1

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

* Re: [dpdk-dev] [PATCH v3] eventdev: use links map to unlink queues
  2017-12-12 18:58 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
@ 2017-12-16  9:16   ` Jerin Jacob
  0 siblings, 0 replies; 8+ messages in thread
From: Jerin Jacob @ 2017-12-16  9:16 UTC (permalink / raw)
  To: Pavan Nikhilesh
  Cc: bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal,
	nipun.gupta, nikhil.rao, santosh.shukla, dev

-----Original Message-----
> Date: Wed, 13 Dec 2017 00:28:09 +0530
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> To: jerin.jacob@caviumnetworks.com, bruce.richardson@intel.com,
>  harry.van.haaren@intel.com, gage.eads@intel.com, hemant.agrawal@nxp.com,
>  nipun.gupta@nxp.com, nikhil.rao@intel.com,
>  santosh.shukla@caviumnetworks.com
> Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v3] eventdev: use links map to unlink queues
> X-Mailer: git-send-email 2.14.1
> 
> The octeontx event device doesn't store the queues to port mapping as a
> result it cannot return the exact number of queues unlinked from a port
> when application wants to unlink all the queues mapped (supplies queues
> param as NULL).
> 
> Using links_map we can determine the exact queues mapped to a specific
> port and unlink them.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Acked-by: Gage Eads <gage.eads@intel.com>

Cc: stable@dpdk.org

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

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

end of thread, other threads:[~2017-12-16  9:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-11 15:05 [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues Pavan Nikhilesh
2017-12-11 17:24 ` Eads, Gage
2017-12-12  7:23   ` Pavan Nikhilesh Bhagavatula
2017-12-12  9:33 ` [dpdk-dev] [PATCH v2] eventdev: use links map " Pavan Nikhilesh
2017-12-12 16:08   ` Eads, Gage
2017-12-12 17:22     ` Pavan Nikhilesh Bhagavatula
2017-12-12 18:58 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
2017-12-16  9:16   ` 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).