From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <harry.van.haaren@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 1265725E5
 for <dev@dpdk.org>; Fri, 15 Sep 2017 15:57:45 +0200 (CEST)
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 15 Sep 2017 06:57:44 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.42,397,1500966000"; d="scan'208";a="151734170"
Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99])
 by fmsmga005.fm.intel.com with ESMTP; 15 Sep 2017 06:57:43 -0700
Received: from irsmsx102.ger.corp.intel.com ([169.254.2.59]) by
 IRSMSX107.ger.corp.intel.com ([169.254.10.65]) with mapi id 14.03.0319.002;
 Fri, 15 Sep 2017 14:57:43 +0100
From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: Pavan Nikhilesh Bhagavatula <pbhagavatula@caviumnetworks.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>
Thread-Topic: [dpdk-dev] [PATCH] eal: added new `rte_lcore_is_service_lcore`
 API.
Thread-Index: AQHTHCIRejLk4K1hBEGkGqXEqpO/LKKZoOZA///444CAADSUsIAAB/qAgBw0fACAABEogA==
Date: Fri, 15 Sep 2017 13:57:42 +0000
Message-ID: <E923DB57A917B54B9182A2E928D00FA640C7A141@IRSMSX102.ger.corp.intel.com>
References: <1503501027-11046-1-git-send-email-pbhagavatula@caviumnetworks.com>
 <E923DB57A917B54B9182A2E928D00FA640C6D354@IRSMSX102.ger.corp.intel.com>
 <20170828150946.GA18980@PBHAGAVATULA-LT> <7169652.mOItyNrJXL@xps>
In-Reply-To: <7169652.mOItyNrJXL@xps>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzA1ZjM3YWEtZGMzMC00MGJhLTk5ZWEtODA2MTc4OTk2YTZlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InM2MVN1RCs5U3JHN1R4OUZkNXRHbUlGeGFvQk1rYkNETHh1SlpaOVVRV1U9In0=
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] eal: added new `rte_lcore_is_service_lcore`
 API.
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 15 Sep 2017 13:57:47 -0000

> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Friday, September 15, 2017 2:53 PM
> To: Pavan Nikhilesh Bhagavatula <pbhagavatula@caviumnetworks.com>; Van Ha=
aren,
> Harry <harry.van.haaren@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] eal: added new `rte_lcore_is_service_lcor=
e`
> API.
>=20
> 28/08/2017 17:09, Pavan Nikhilesh Bhagavatula:
> > On Mon, Aug 28, 2017 at 01:49:37PM +0000, Van Haaren, Harry wrote:
> > > From: Pavan Nikhilesh Bhagavatula [mailto:pbhagavatula@caviumnetworks=
.com]
> > > > On Mon, Aug 28, 2017 at 10:59:51AM +0000, Van Haaren, Harry wrote:
> > > > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> > > > > > --- a/lib/librte_eal/common/include/rte_lcore.h
> > > > > > +++ b/lib/librte_eal/common/include/rte_lcore.h
> > > > > > @@ -180,6 +180,24 @@ rte_lcore_is_enabled(unsigned lcore_id)
> > > > > >  }
> > > > > >
> > > > > >  /**
> > > > > > + * Test if an lcore is service lcore.
> > > > > > + *
> > > > > > + * @param lcore_id
> > > > > > + *   The identifier of the lcore, which MUST be between 0 and
> > > > > > + *   RTE_MAX_LCORE-1.
> > > > > > + * @return
> > > > > > + *   True if the given lcore is service; false otherwise.
> > > > > > + */
> > > > > > +static inline int
> > > > > > +rte_lcore_is_service_lcore(unsigned lcore_id)
> > > > > > +{
> > > > > > +	struct rte_config *cfg =3D rte_eal_get_configuration();
> > > > > > +	if (lcore_id >=3D RTE_MAX_LCORE)
> > > > > > +		return 0;
> > > > > > +	return cfg->lcore_role[lcore_id] =3D=3D ROLE_SERVICE;
> > > > > > +}
> > > > >
> > > > > No header file and Static inline - so this is only to be used
> internally in the service
> > > > cores library?
> > > > > If so, the function should actually be used, instead of only adde=
d but
> not used in the
> > > > library itself.
> > > > >
> > > >
> > > > The enum rte_lcore_role_t has ROLE_SERVICE which tells that a parti=
cular
> lcore is
> > > > a service lcore as well as an EAL thread some libraries such as rte=
_timer
> allow
> > > > specific operations only over EAL threads.
> > >
> > > Understood that role of cores is important, and that rte_timer might
> require this information.
> > >
> > >
> > > > The rte_timer lib uses the rte_is_lcore_enabled() call to check if =
a
> lcore is an
> > > > EAL thread, Which checks if the lcore role is  ROLE_RTE. But it sho=
uld
> also
> > > > allow timers to be registered on a service core as processing those
> timers can
> > > > be done on them.
> > >
> > > No problem from me here either - although it's the Timers library
> maintainer that should check this.
> > >
> > >
> > > > This new function allows such libraries to check if the role is
> > > > ROLE_SERVICE and allow those operations.
> > >
> > > If the timers library requires information about service-cores, it sh=
ould
> use a public API to retrieve that information. Having "internal" function=
s
> between libraries is not nice.
> > >
> > > I think a better design would be to add this function as a public fun=
ction,
> (add it to the .map files etc) and then call the public function from the
> timers library.
> > >
> > > Does that sound like a good solution? -Harry
> > >
> >
> > The file rte_lcore.h is in librte_eal/common/include I couldn't find a =
.map
> > file for eal/common and also other functions that are present in rte_lc=
ore.h
> > aren't mapped in eal/linuxapp or eal/bsdapp.
> > I think it is fine as the functions are static inline.
>=20
> We must avoid adding more inline functions without a good justification.
> The inline functions are tolerated for performance reasons only.
>=20
> We could also choose to add this function to rte_service.h ?

Yes that is an option, and OK with me.

@Pavan what do you think of adding it to service.h, implement in .c and add=
 to .map?=20