From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eads, Gage" Subject: Re: [PATCH v2] eventdev: use links map to unlink queues Date: Tue, 12 Dec 2017 16:08:12 +0000 Message-ID: <9184057F7FC11744A2107296B6B8EB1E2BB16F75@FMSMSX108.amr.corp.intel.com> References: <20171211150528.13236-1-pbhagavatula@caviumnetworks.com> <20171212093331.20216-1-pbhagavatula@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: Pavan Nikhilesh , "jerin.jacob@caviumnetworks.com" , "Richardson, Bruce" , "Van Haaren, Harry" , "hemant.agrawal@nxp.com" , "nipun.gupta@nxp.com" , "Rao, Nikhil" , "santosh.shukla@caviumnetworks.com" Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 5F899293B for ; Tue, 12 Dec 2017 17:08:14 +0100 (CET) In-Reply-To: <20171212093331.20216-1-pbhagavatula@caviumnetworks.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 > ; Van Haaren, Harry > ; Eads, Gage ; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Rao, Nikhil > ; santosh.shukla@caviumnetworks.com > Cc: dev@dpdk.org; Pavan Nikhilesh > Subject: [dpdk-dev] [PATCH v2] eventdev: use links map to unlink queues >=20 > The octeontx event device doesn't store the queues to port mapping as a r= esult > 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). >=20 > Using links_map we can determine the exact queues mapped to a specific po= rt > and unlink them. >=20 > Signed-off-by: Pavan Nikhilesh > --- > lib/librte_eventdev/rte_eventdev.c | 33 ++++++++++++++++++++++++++------= - > 1 file changed, 26 insertions(+), 7 deletions(-) >=20 > 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; >=20 > 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; > } >=20 > + links_map =3D dev->data->links_map; > + /* Point links_map to this port specific area */ > + links_map +=3D (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV); > + > if (queues =3D=3D NULL) { > - for (i =3D 0; i < dev->data->nb_queues; i++) > - all_queues[i] =3D i; > + j =3D 0; > + for (i =3D 0; i < dev->data->nb_queues; i++) { > + if (links_map[i] !=3D > + > EVENT_QUEUE_SERVICE_PRIORITY_INVALID) { > + all_queues[j] =3D i; > + j++; > + } > + } > queues =3D all_queues; > - nb_unlinks =3D dev->data->nb_queues; > + } else { > + j =3D 0; > + for (i =3D 0; i < nb_unlinks; i++) { > + if (links_map[queues[i]] =3D=3D > + > EVENT_QUEUE_SERVICE_PRIORITY_INVALID) > + break; > + > + linked_queues[j] =3D queues[i]; > + j++; > + } > + queues =3D linked_queues; > } >=20 Looks good. If you want, you can simplify the else case like so: + } else { + for (j =3D 0; j < nb_unlinks; j++) + if (links_map[queues[j]] =3D=3D + EVENT_QUEUE_SERVICE_PRIORITY_INVALID) + break; + } Up to you. Either way: Acked-by: Gage Eads