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 E1B7F43433; Mon, 11 Dec 2023 17:50:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CD88642686; Mon, 11 Dec 2023 17:50:15 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by mails.dpdk.org (Postfix) with ESMTP id 3631E42670 for ; Mon, 11 Dec 2023 17:50:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VdrmsRErErOr5E/FzClwltrvAaPNsiRXBM7GuhNR4RbqId+x168tlO2+3Jn1NMYkGnTX34MeZotv5S54NV3WWmxkHKdzpDeMva6Oj71cBVzBrrkHGewvVorCrJ3P0npK6xrsspn3X0D9SB9m35X1y+3g+03Pt0DSEL+7pfMg1jFMKZrR0ikF+A2MLCHkHXLc6pT4y+NgGfjPo29Q1+H/sbL0sJ+3BttNh8Ks1s7vIyRFu/GpTU11+g9X3utfmwIUWHrmx37wpwwmnE9DCN53wypc4XtsXqhGg/qtenojOOlkKyHj4CQ2JP5Izpu3D+h1wHESN5ss3JVu0hxYmhqs3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NujjlIsK4vet6GaXzLMLPQBJJNZXW7LqqFCZhJOjyyo=; b=RpN3LMALObxPetqSmGro+UQ5D8UnOpFlBff7iFL1jEryWIUoy6QPDxwWnXyAgoIf29LjGOqP8CliD4OOJxRb56ZxuRoxXANBbl39YMAfdv+lK1K01DhxwUQJNeF9v+2jArfDyTdkW14ffr21alajUwNm/d4hLXfrGKVWvxq1VHNoAIYwipNt7YMmev5iIT1X6eyaGJKbGKtx8BDPtofe0Oc5T3NilnPQhDuMAQ6Aesj01p69O86CXYH9v23EI3xSFmkZzh45PtSOmio2Bs58xStCNmjNmlChvo/O7QTK3C/HWVQE1o1LoRgDMUSLrAuVd5I6Rn1tG/Ixw0+JN4Be8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NujjlIsK4vet6GaXzLMLPQBJJNZXW7LqqFCZhJOjyyo=; b=5LCgulu8IRLIv/pBUtSNhMKiOXnLF0qgXOfkGPvv5KJZ/syH6aTObBo6Xe4YcZAwHuVQ2S/4CvSlkBV5+La7EYOiEOfCS3Fz7uOXu+qpzVCe2eOaKY8+L46/3DDgZtfUaZuiSnRNt9waKB+Yi98WriWkfo+Kz87UqyGDlLq4ZIg= Received: from DM3PR12MB9286.namprd12.prod.outlook.com (2603:10b6:8:1ae::6) by CH3PR12MB7571.namprd12.prod.outlook.com (2603:10b6:610:147::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 16:50:11 +0000 Received: from DM3PR12MB9286.namprd12.prod.outlook.com ([fe80::2f17:4c1d:b750:cc44]) by DM3PR12MB9286.namprd12.prod.outlook.com ([fe80::2f17:4c1d:b750:cc44%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 16:50:10 +0000 From: "Tummala, Sivaprasad" To: Euan Bourke , "dev@dpdk.org" CC: Anatoly Burakov , David Hunt Subject: RE: [PATCH v3 8/8] examples/l3fwd-power: update to call arg parser API Thread-Topic: [PATCH v3 8/8] examples/l3fwd-power: update to call arg parser API Thread-Index: AQHaKSkRTGOFunXM30W3N736KI1kXrCkTeOA Date: Mon, 11 Dec 2023 16:50:10 +0000 Message-ID: References: <20231207161818.2590661-1-euan.bourke@intel.com> <20231207161818.2590661-9-euan.bourke@intel.com> In-Reply-To: <20231207161818.2590661-9-euan.bourke@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=2d33b69e-bbcf-4d02-99a8-8be6eca1a19d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-12-11T16:35:51Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM3PR12MB9286:EE_|CH3PR12MB7571:EE_ x-ms-office365-filtering-correlation-id: c365c542-4d1f-4e4a-a46f-08dbfa693d0a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Qdy2lGHVzIbq9+VCp8I7qtICGAltsBoI94BPrFOASDJtwSDiltzSB2SZ6f9oLoouWUH0NxkXBW+yp5eXCrSDgsiJVmegzsQooI9UhkXRVExwj2i7Fiu8HWAJ6oF6S976awBoWCMTV+XN63wO9UCRoisJJr4Thvgq4RlP96mpqDGRYWJsrbOsiZdzqIO88zC4IVnMk0C7AaRkRlBXBFPatRVJsxBoP4MOumiuWi2M+SEsEjvHNRDuIskYfOnncQkP3V4FQfEEnhaRb9C/hg/xn+EjF1QOT7GfovqPM56vMhUTCE4FCoesycMkk1pUOs0IeCRkJKqQUO0QnBsbkOq1GRjL41R5E0kDEJn79sD4Cq2nja3e9326QRs7Xkt+zmYRRB8pYGqv/l2ACPjN5tf27AN7nKXSWfgYlwR/TWECwu4Vu2f+L54zH1LMXqJNGa04f11WbqbP75HJSLlksb9qTePQ7hMuJYebJd9bR3qSDJFJ5rWmS9o3YqQlGuC5A3SicHwicrPNaDtrAnr85qCmRF09/L1nK8Dpau8nupkM3YWKxw9f2yaB7sJGeDBKoL5lTN+R+9TGq0wyn8F24bzKjfCGxodIPdsCCPNnWaRQkdqwyDWRW9qCMESeUD85YZ8sq3CWwICQZ67lDupOIaM1r+8WA/dtPjlzwvIbsl8aAM4= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM3PR12MB9286.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(136003)(366004)(396003)(376002)(346002)(230273577357003)(230173577357003)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(52536014)(9686003)(53546011)(6506007)(5660300002)(26005)(33656002)(55016003)(38070700009)(66946007)(64756008)(76116006)(54906003)(66446008)(66476007)(66556008)(2906002)(83380400001)(41300700001)(478600001)(7696005)(86362001)(8676002)(8936002)(4326008)(122000001)(110136005)(15650500001)(316002)(38100700002)(71200400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?YtUj3Mvqf/jbPPwVuV6khawOxI7VVS8TvOx6Qv1AX+zjYqO1A7S2TiqklpuX?= =?us-ascii?Q?OiiHzrogcZy3huj/QvtEAY2NxQjfav1LcCQ1LN6Ocm2dIvFvFrxr4ei7hz7v?= =?us-ascii?Q?SvUREdFUjJuesEpxLO4SBoTGN2GOrKHW7w54oX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or+aX/VKyxr1vdlGZpz2JK5yMfOFmLYlohHGxsXLh2Qfrs+7BXP7TLLoj2?= =?us-ascii?Q?raBJEnv/LSEoerqCVfxmia9eH2DnWsgBdxypWf0WRP9Owa/rhFyVik07DJHt?= =?us-ascii?Q?QaOQS05JCEJFe3Ykm5wBpXiq6NuZGU1Ze5cYerbCMpgyDu3aVNV8cWEaNWHh?= =?us-ascii?Q?lICJ3RciN3YadH8zSJkVcKVBuzaTkLKzeI+XCQUTAWhOtYebMh67HouwqwXb?= =?us-ascii?Q?ZsJm4nUZknC9jNvq+OxM5eSGI2EsBSYlgxs18/PSscF8PEWyFx2SUJ4zO9i2?= =?us-ascii?Q?35VSe0UVCDqGSpHSo/Hk3cdJwuNosEC+WpVGbQBBjJS2pH9B392RQd0pNzRF?= =?us-ascii?Q?y3QtBX8FyeI9qmAAkBUqUfx3iyMKwZat2i8mBEUsT+qMMug8uP9tFdzYI835?= =?us-ascii?Q?bzJ8TDJF3TmmsAbzsReW6Y2JPXBiKpuGRxPaLiQ9hc9qIH9taV0CwJk+iWKQ?= =?us-ascii?Q?r5hBVVijvvPU4wkGvSLmGfdhwyMHiQst/t2+4YG9sfDJjmxCAZWo7bGLz65w?= =?us-ascii?Q?NNo40ghmF9ZJ5gYPwHk=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM3PR12MB9286.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c365c542-4d1f-4e4a-a46f-08dbfa693d0a X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2023 16:50:10.5150 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: iGbgBhvOybaek9zcDvCYYDpIyCgoBy/Op7SevMQtzqdrnrO3a+KWNdYiX54GCs9YxL+mF1X6/ISeuPVLyCxj9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7571 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 [AMD Official Use Only - General] Hi Euan, > -----Original Message----- > From: Euan Bourke > Sent: Thursday, December 7, 2023 9:48 PM > To: dev@dpdk.org > Cc: Euan Bourke ; Anatoly Burakov > ; David Hunt ; Tummala, > Sivaprasad > Subject: [PATCH v3 8/8] examples/l3fwd-power: update to call arg parser A= PI > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Update to the l3fwd-power example application to call the arg parser libr= ary for its > 'combined core string parser' instead of implementing its own corelist pa= rser. The > default_type passed into the function call is a corelist. > > Signed-off-by: Euan Bourke > --- > examples/l3fwd-power/perf_core.c | 51 +++++--------------------------- > 1 file changed, 8 insertions(+), 43 deletions(-) > > diff --git a/examples/l3fwd-power/perf_core.c b/examples/l3fwd-power/perf= _core.c > index 41ef6d0c9a..f8511e30b3 100644 > --- a/examples/l3fwd-power/perf_core.c > +++ b/examples/l3fwd-power/perf_core.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > > #include "perf_core.h" > #include "main.h" > @@ -177,56 +178,20 @@ parse_perf_config(const char *q_arg) int > parse_perf_core_list(const char *corelist) { > - int i, idx =3D 0; > - unsigned int count =3D 0; > - char *end =3D NULL; > - int min, max; > + int count; > + uint16_t cores[RTE_MAX_LCORE]; > > if (corelist =3D=3D NULL) { > printf("invalid core list\n"); > return -1; > } > > + count =3D rte_arg_parse_core_string(corelist, cores, > + RTE_DIM(cores), 1); Can you replace the magic number with "RTE_ARG_PARSE_TYPE_CORELIST" as defa= ult parse type. > > - /* Remove all blank characters ahead and after */ > - while (isblank(*corelist)) > - corelist++; > - i =3D strlen(corelist); > - while ((i > 0) && isblank(corelist[i - 1])) > - i--; > + for (int i =3D 0; i < count; i++) > + hp_lcores[i] =3D cores[i]; > > - /* Get list of cores */ > - min =3D RTE_MAX_LCORE; > - do { > - while (isblank(*corelist)) > - corelist++; > - if (*corelist =3D=3D '\0') > - return -1; > - errno =3D 0; > - idx =3D strtoul(corelist, &end, 10); > - if (errno || end =3D=3D NULL) > - return -1; > - while (isblank(*end)) > - end++; > - if (*end =3D=3D '-') { > - min =3D idx; > - } else if ((*end =3D=3D ',') || (*end =3D=3D '\0')) { > - max =3D idx; > - if (min =3D=3D RTE_MAX_LCORE) > - min =3D idx; > - for (idx =3D min; idx <=3D max; idx++) { > - hp_lcores[count] =3D idx; > - count++; > - } > - min =3D RTE_MAX_LCORE; > - } else { > - printf("invalid core list\n"); > - return -1; > - } > - corelist =3D end + 1; > - } while (*end !=3D '\0'); > - > - if (count =3D=3D 0) { > + if (count =3D=3D 0 || count =3D=3D -1) { > printf("invalid core list\n"); > return -1; > } > @@ -234,7 +199,7 @@ parse_perf_core_list(const char *corelist) > nb_hp_lcores =3D count; > > printf("Configured %d high performance cores\n", nb_hp_lcores); > - for (i =3D 0; i < nb_hp_lcores; i++) > + for (uint16_t i =3D 0; i < nb_hp_lcores; i++) > printf("\tHigh performance core %d %d\n", > i, hp_lcores[i]); > > -- > 2.34.1