From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B2122137C for ; Mon, 28 Aug 2017 12:55:14 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2017 03:55:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,441,1498546800"; d="scan'208";a="1166769768" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by orsmga001.jf.intel.com with ESMTP; 28 Aug 2017 03:55:12 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by irsmsx110.ger.corp.intel.com (163.33.3.25) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 28 Aug 2017 11:55:06 +0100 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.59]) by irsmsx112.ger.corp.intel.com ([169.254.1.110]) with mapi id 14.03.0319.002; Mon, 28 Aug 2017 11:55:06 +0100 From: "Van Haaren, Harry" To: Pavan Nikhilesh CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API Thread-Index: AQHTHAGBor78mrkgL0+pFsQj2n/xa6KZnuoQ Date: Mon, 28 Aug 2017 10:55:05 +0000 Message-ID: References: <1503487012-20247-1-git-send-email-pbhagavatula@caviumnetworks.com> In-Reply-To: <1503487012-20247-1-git-send-email-pbhagavatula@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDk0MzY2NTMtMTUxOC00Y2IxLTlhNmEtNzYyM2Y3ZWM5MTdmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImoyK29WbzI0KzhsNmd5ZVJiYnJSTFVEOTVtYk43dDdoUzJjOUNaYytHeVk9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API 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, 28 Aug 2017 10:55:15 -0000 > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Wednesday, August 23, 2017 12:17 PM > To: Van Haaren, Harry > Cc: dev@dpdk.org; Pavan Nikhilesh > Subject: [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_ser= vices` API >=20 > This new API returns the number of services that are running on a specifi= c > service core. It allows an application to decide which service core to ru= n > a new service on. >=20 > Signed-off-by: Pavan Nikhilesh Hi, Thanks - yes a useful addition to the API. Comments inline below, apart fro= m that, thanks for the addition! -H > --- > lib/librte_eal/common/include/rte_service.h | 12 ++++++++++++ > lib/librte_eal/common/rte_service.c | 11 +++++++++++ > 2 files changed, 23 insertions(+) >=20 > diff --git a/lib/librte_eal/common/include/rte_service.h > b/lib/librte_eal/common/include/rte_service.h > index 7c6f738..5f0904f 100644 > --- a/lib/librte_eal/common/include/rte_service.h > +++ b/lib/librte_eal/common/include/rte_service.h > @@ -374,6 +374,18 @@ int32_t rte_service_lcore_list(uint32_t array[], uin= t32_t n); > * @warning > * @b EXPERIMENTAL: this API may change without prior notice > * > + * Get the numer of services running on the supplied lcore. > + * > + * @param Lcore Id of the service core. > + * @retval >=3D0 Number of services registered to this core. > + * @retval -EINVAL The provided lcore is not a service core. > + */ > +int32_t rte_service_lcore_count_services(uint32_t lcore); Perhaps -ENOTSUP would be clearer for "not a service core"? Then -EINVAL becomes available to indicate an invalid lcore-id pass in? > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > * Dumps any information available about the service. If service is NULL= , > * dumps info for all services. > */ > diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/= rte_service.c > index 7efb76d..ddaed22 100644 > --- a/lib/librte_eal/common/rte_service.c > +++ b/lib/librte_eal/common/rte_service.c > @@ -397,6 +397,17 @@ rte_service_lcore_list(uint32_t array[], uint32_t n) > } >=20 > int32_t > +rte_service_lcore_count_services(uint32_t lcore) > +{ /* need to error check lcore here, return -EINVAL if not valid. */ > + struct core_state *cs =3D &lcore_states[lcore]; > + > + if (!cs->is_service_core) > + return -EINVAL; /* suggesting to use -ENOTSUP instead here */ > + > + return __builtin_popcountll(cs->service_mask); > +} > + > +int32_t > rte_service_start_with_defaults(void) > { > /* create a default mapping from cores to services, then start the > -- > 2.7.4