From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 035E114E8 for ; Mon, 11 Dec 2017 18:24:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2017 09:24:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,392,1508828400"; d="scan'208";a="157782200" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga004.jf.intel.com with ESMTP; 11 Dec 2017 09:24:58 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 11 Dec 2017 09:24:58 -0800 Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.23]) by FMSMSX109.amr.corp.intel.com ([169.254.15.83]) with mapi id 14.03.0319.002; Mon, 11 Dec 2017 09:24:57 -0800 From: "Eads, Gage" To: Pavan Nikhilesh , "jerin.jacob@caviumnetworks.com" , "Richardson, Bruce" , "nipun.gupta@nxp.com" , "santosh.shukla@caviumnetworks.com" , "Van Haaren, Harry" , "hemant.agrawal@nxp.com" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues Thread-Index: AQHTcpGWiswy8HirQ0KRYugKEdYjpaM+Yc1g Date: Mon, 11 Dec 2017 17:24:57 +0000 Message-ID: <9184057F7FC11744A2107296B6B8EB1E2BB16442@FMSMSX108.amr.corp.intel.com> References: <20171211150528.13236-1-pbhagavatula@caviumnetworks.com> In-Reply-To: <20171211150528.13236-1-pbhagavatula@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTIzMDM2MjAtMTYxOS00MGVjLTllM2QtYmY2ZjQ4ZTc3YzM3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IllYd0VpRHo0Wk5aT3RjMWRNYytVWWVEU29kdUJvcXRmRkFtNDEwVGl4dnM9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.1.200.106] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] eventdev: use links_map to unlink queues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2017 17:25:00 -0000 > -----Original Message----- > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Monday, December 11, 2017 9:05 AM > To: Eads, Gage ; jerin.jacob@caviumnetworks.com; > Richardson, Bruce ; nipun.gupta@nxp.com; > santosh.shukla@caviumnetworks.com; Van Haaren, Harry > ; hemant.agrawal@nxp.com > Cc: dev@dpdk.org; Pavan Nikhilesh > Subject: [dpdk-dev] [PATCH] 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 | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) >=20 > 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; >=20 > 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_i= d, > rte_errno =3D -EINVAL; > return 0; > } > + j =3D 0; > + links_map =3D dev->data->links_map; > + links_map +=3D (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV); > + for (i =3D 0; i < nb_unlinks; i++) { > + if (links_map[queues[i]] !=3D > + EVENT_QUEUE_SERVICE_PRIORITY_INVALID) { > + linked_queues[j] =3D queues[i]; > + j++; > + } > + } > + queues =3D linked_queues; > + nb_unlinks =3D j; Consider the following case where queues is non-NULL: nb_unlinks =3D 3, que= ues =3D [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 retur= n 2. However the documentation states that "if the return value is less tha= n *nb_unlinks*, the remaining queues at the end of queues[] are not establi= shed", 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 =3D=3D NULL)" block, an= d in its place you can update nb_unlinks like so to handle the non-NULL que= ues case: links_map =3D dev->data->links_map; links_map +=3D (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV); for (i =3D 0; i < nb_unlinks; i++) { if (links_map[queues[i]] !=3D EVENT_QUEUE_SERVICE_PRIORITY_INVALID) break; } nb_unlinks =3D i; Thanks, Gage