From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B3B9842C4D; Wed, 7 Jun 2023 12:19:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A123140A84; Wed, 7 Jun 2023 12:19:02 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 24CB040698 for ; Wed, 7 Jun 2023 12:19:02 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id EDFFE20266; Wed, 7 Jun 2023 12:19:01 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH 3/4] eal: add API to check if lcore id is valid X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 7 Jun 2023 12:19:00 +0200 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D8799A@smartserver.smartshare.dk> In-Reply-To: <20230309045738.1261000-4-honnappa.nagarahalli@arm.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH 3/4] eal: add API to check if lcore id is valid Thread-Index: AdlSQ7sAVyTiU0XVTQSBMuZ7Lmq0vRG5OQGQ References: <20230309045738.1261000-1-honnappa.nagarahalli@arm.com> <20230309045738.1261000-4-honnappa.nagarahalli@arm.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Honnappa Nagarahalli" , , Cc: , , , , , X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > From: Honnappa Nagarahalli [mailto:honnappa.nagarahalli@arm.com] > Sent: Thursday, 9 March 2023 05.58 >=20 > Simple API to check if the lcore ID does not exceed the > maximum number of lcores configured. >=20 > Signed-off-by: Honnappa Nagarahalli > Reviewed-by: Ruifeng Wang > --- > lib/eal/include/rte_lcore.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h > index 6a355e9986..cf99919a02 100644 > --- a/lib/eal/include/rte_lcore.h > +++ b/lib/eal/include/rte_lcore.h > @@ -38,6 +38,20 @@ enum rte_lcore_role_t { > ROLE_NON_EAL, > }; >=20 > +/** > + * Check if the lcore ID is valid > + * > + * @param lcore_id > + * The identifier of the lcore. > + * > + * @return > + * True if the given lcore ID is between 0 and RTE_MAX_LCORE-1. > + */ > +static inline int rte_lcore_id_is_valid(unsigned int lcore_id) > +{ > + return (lcore_id < RTE_MAX_LCORE); > +} > + > /** > * Get a lcore's role. > * > -- > 2.25.1 >=20 Isn't LCORE_ID_ANY considered valid in some contexts? I don't think this function adds any value; it only makes the lcore_id = interpretation more opaque. Having this comparison, i.e. (lcore_id < = RTE_MAX_LCORE), directly in the source code makes it more easily = readable than a call to this function. So, NAK from me.