From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavan Nikhilesh Bhagavatula Subject: Re: [PATCH v2] eventdev: use links map to unlink queues Date: Tue, 12 Dec 2017 22:52:52 +0530 Message-ID: <20171212172251.mmotp3ngusvrfsby@Pavan-LT> References: <20171211150528.13236-1-pbhagavatula@caviumnetworks.com> <20171212093331.20216-1-pbhagavatula@caviumnetworks.com> <9184057F7FC11744A2107296B6B8EB1E2BB16F75@FMSMSX108.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org To: "Eads, Gage" , "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 NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0078.outbound.protection.outlook.com [104.47.34.78]) by dpdk.org (Postfix) with ESMTP id 6233D2C55 for ; Tue, 12 Dec 2017 18:23:23 +0100 (CET) Content-Disposition: inline In-Reply-To: <9184057F7FC11744A2107296B6B8EB1E2BB16F75@FMSMSX108.amr.corp.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 > > ; 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 > > > > 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 > > --- > > 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