[dpdk-dev,v3] eventdev: use links map to unlink queues

Message ID 20171212185809.15482-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pavan Nikhilesh Dec. 12, 2017, 6:58 p.m. UTC
  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(-)

--
2.14.1
  

Comments

Jerin Jacob Dec. 16, 2017, 9:16 a.m. UTC | #1
-----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.
  

Patch

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;