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 06FD442CB2; Wed, 14 Jun 2023 08:40:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9415340E0F; Wed, 14 Jun 2023 08:40:16 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 1CE4D40DDB for ; Wed, 14 Jun 2023 08:40:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686724814; x=1718260814; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Dok9Tasr9zfaFsqbNLUnUwCOKQE5XeUbscBQm7paBo0=; b=eh71cjcoZFa/66NQGXNWshp+yeGD/lyTpJowSDAgz3F8Pfn18ZWnd+Vk LFqqQj/YZO7Voe8T+9Qgu9rJuxhirMfQqdsZyodI7bYSFqwObDwPAZIDb t1sTJzh1JDANP7QA+SawKYy42es8deW38hMJRnsU/W5j/3E7vLYx+Iucb XMgXwxeI93b+rtBt9Lln8S8RvsDfumd25Gy0Txgwyo/Ra4tWLyrkJLPsD lLNfjm8k0RsktmNvgUtzxRYJIPZMG/5151hy65I1ewbuIK4vHQCnttryN 6OV71DwG04PekjxHR/EUIMVB+D48u2WuoAmyW0bsEPOgvjiKWRXSFgU+T A==; X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="358538200" X-IronPort-AV: E=Sophos;i="6.00,241,1681196400"; d="scan'208";a="358538200" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 23:40:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="886108694" X-IronPort-AV: E=Sophos;i="6.00,241,1681196400"; d="scan'208";a="886108694" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga005.jf.intel.com with ESMTP; 13 Jun 2023 23:40:12 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 13 Jun 2023 23:40:11 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Tue, 13 Jun 2023 23:40:11 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.170) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Tue, 13 Jun 2023 23:40:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RJ+zHhVetnqgKWPf9N7Uo2kDKK+Kcwl7IJaQ28nuUIfVXtp9ZHADfsw7+o2xNDvxifAjhObMtbCSU/5Xykb2SMnhotqznsbXzKn90LAxYDyt6hNwyJOcNtunoRzK5F+PHPbjCL0W6bmvFE4oNA6L7aNwBcSkcsPfFTcW0bxEOMPeiL7/m5a7N0GswAV//7z+mmKLFY54AQ2NcvZas2uarNlqrcNKbT+3D4zo7u1EdmtX3b87gIBvlJdPSji6wzyA8AQMMSB0Z9w5ZFGm02HZzLs5c6AV2xB8qoYnZt/1aFhoHhLWmmYnGfgZ/mw6f1YUFcmRiH+4xGvO5IsaNMonug== 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=0JPKZeSYZSGUMD9/fJftpUWFt+UJz3S2wb8c379pjfg=; b=TC6AL9SeUUQNOekA1KNxsnueMDH2sz/sH8NJ2gwHPHADCLG8uxMoiOg7FD1xRqUzBIwbxLzpyzHxeeBGJ1L5bOzM+O/qHCIdp1Q1tK9KgdVac0nAK8jWkd/7sDTn1zM2dpXQRJCMOOC+PtdfBUeS63xic58X3L926QEkVWBCbYNgeRmn9XsLOq5Z6F5pfoQr64ZsdWjDl3z1nMbmJlYtelAXVl9GlZW5yL5kH3MX7mBS7+v0fF8IKBPZywZZX8CmfiV4wSAmS3pJBoqRyP9X5OdxJHu7/1Wk5YHqHXC7l9rV2jq8xTjf9hAgBsdq/oA1bzFsVCb4xWw2xqbzu3Bgug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN7PR11MB7019.namprd11.prod.outlook.com (2603:10b6:806:2ae::22) by DS0PR11MB6373.namprd11.prod.outlook.com (2603:10b6:8:cb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 06:40:09 +0000 Received: from SN7PR11MB7019.namprd11.prod.outlook.com ([fe80::2d39:426d:f529:6088]) by SN7PR11MB7019.namprd11.prod.outlook.com ([fe80::2d39:426d:f529:6088%4]) with mapi id 15.20.6477.037; Wed, 14 Jun 2023 06:40:09 +0000 From: "Jiang, Cheng1" To: huangdengdui , "thomas@monjalon.net" , "Richardson, Bruce" , "mb@smartsharesystems.com" , "Xia, Chenbo" , "amitprakashs@marvell.com" , "anoobj@marvell.com" CC: "dev@dpdk.org" , "Hu, Jiayu" , "Ding, Xuan" , "Ma, WenwuX" , "Wang, YuanX" , "He, Xingguang" Subject: RE: [PATCH v6] app/dma-perf: introduce dma-perf application Thread-Topic: [PATCH v6] app/dma-perf: introduce dma-perf application Thread-Index: AQHZnbUBtaI3/jfMaEW1JJ15Pu3zk6+IsSEAgAEWwrA= Date: Wed, 14 Jun 2023 06:40:08 +0000 Message-ID: References: <20230420072215.19069-1-cheng1.jiang@intel.com> <20230613043140.18101-1-cheng1.jiang@intel.com> <8b8949c1-739a-59f9-fd7d-a0e232c30252@huawei.com> In-Reply-To: <8b8949c1-739a-59f9-fd7d-a0e232c30252@huawei.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN7PR11MB7019:EE_|DS0PR11MB6373:EE_ x-ms-office365-filtering-correlation-id: d9bcfe93-0b43-4293-bd12-08db6ca23250 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: v9rOK+enzTN+Ygjzy4rrGO6DrFuNrFC5APjUetrHpiEJPR/tMAtC/RnlODLPxT4VmC83QpftVv/U+NDnncM380brVXWz07PG+4SnhUsmx+3r6v135toeF0FDodE+6u/3pzQCMBhjEoCwvvKYVBWDJZVhPz9ujzfyCEsmfU559FUAhYjsKn6bNZjuJd8iTYWkrHFN4co02ZydoyMoKM/xCx7Z6WLoY3lkvTeRRNTIQ0RRgEMpaowL86TRZDNGHwVTE8pKR8fqexwdhZnGxoX0GHv3D+pHNFVDVO1dSdt3KQZaoamStrL18YfgT6PBFEAgxWZOlkOIoFlp1EwU5JckvtiDJEBuOLWbAyXKdPLvXKKlo4h71mkE6NToU3O3OteZKE1u9D+aAJwB2KHrRmPNmw3WLXlraqSAVLqsFKXedJ3a1OZjpsZb7afHmoFAB/i5hjq0Ib/R1niqgSgZms1HATMRGtxRoDggmsZRoFhkuboT5cxT/x3CSj3r22RT69N7kpJMQtFcV4Wdi81ursBGvuUwdQ+SGa8W7MMnDkz9v8yu8nvRHWPhJvdf4vi26HR8z610QosPRcYLM6gGLkhInCIOVOniywx4ER/h6UZh2x+TMoE7DNGYcE7Lxp2FlYzv x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN7PR11MB7019.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(136003)(376002)(366004)(346002)(396003)(451199021)(38070700005)(86362001)(33656002)(66556008)(54906003)(110136005)(4326008)(478600001)(71200400001)(76116006)(66476007)(64756008)(66946007)(66446008)(316002)(107886003)(7696005)(55016003)(2906002)(8936002)(30864003)(8676002)(52536014)(82960400001)(38100700002)(41300700001)(122000001)(5660300002)(9686003)(6506007)(83380400001)(26005)(53546011)(186003)(66574015); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?mCAQzjQgMxE+/imcfcrFFdYnphzQ9iKxzJtje+uDxrS4SNS+ITzECLwJTa?= =?iso-8859-1?Q?CMifeaQ4SBm1Z+1k+o6YqplQG6kyiyk7AAganjoZsEY1R5dokW4QOwCT8H?= =?iso-8859-1?Q?gj/e4TEPg6Xkad9oWfGZ+/wqgKy66EJoAf2RBPqhdbqufSpUQ1gVOw8tl4?= =?iso-8859-1?Q?MjxKbT2dhGVpb5qR0fOE/W7nIXcBJFwpmPElfux8nqvT04zJsaXS+43Gb4?= =?iso-8859-1?Q?W4ZqIfJwCd7pBXDP47DRTvuWUTC8xLyMBC7hQSrV8X2ank4I+PzVtf7R4U?= =?iso-8859-1?Q?WbAHMvaAVkaf3mEka5Uo7BbSUr8GTvZJJ3kZ4N2DRZA/l3UCXYCErIs/Re?= =?iso-8859-1?Q?5WRgDRlvZvZYrrxfehXSB4HExmQ68qAWL5mPqEPWBOwM7Ju4f7xDuLztHK?= =?iso-8859-1?Q?MhjY7K3q3+qcZ6gu1D40w0IyFYPCL29G7d2gdM6UzPwjKj3HT+taEy+N4z?= =?iso-8859-1?Q?EPARVUtOxmiqoon3wE8lOMPNSdKBdWnpYbRzHg+zmFWakndX32TWthOG+E?= =?iso-8859-1?Q?k3C/qw58SAW1EWxLGHasxWI1NK1Eux49iczokzkbLHi2Ko45dzrxajFDz/?= =?iso-8859-1?Q?9yC1uwaC94stBtzVAC3Y1Cts+I+7s3lOeL3b2hgfyVmiAG/YIXOBPd4Xpy?= =?iso-8859-1?Q?IIsPpaEQr5NMJqe/UQ8AICpfkLHTBI24l1zmp+YhI/+AwfK0MWYcbRi0gJ?= =?iso-8859-1?Q?Vr9JcxxUc3giBKj5CDgGpU7PxcqvzuVLTkJCl5G62Unz3Ssl5AY5GMim3U?= =?iso-8859-1?Q?fc4Me12GHppVYfdRIUzNxg76W33zmZDk1MkX4G99LB/eOqGG1e5dXdZyQm?= =?iso-8859-1?Q?CElmkSFn+y7nOPJC37tWWJiE0cDLsn46QbknnRpYdsGdEfdjnxrz+tRrfN?= =?iso-8859-1?Q?PXTe13whXGBcxMnah8dBa9eNOd5yfm93J7eYwqhJjiy3tGRDs5xw9A31Nh?= =?iso-8859-1?Q?GjVKTOoktmvqTZg4sbY2TrFxnzGFgSBLOICeTHbym+0536JY4UWRCxxF0e?= =?iso-8859-1?Q?JX3cWOTSFrT0qlRvWVJT84OMUpArl+jV5ck3NP4IaD9mB/bHkntbPsRIni?= =?iso-8859-1?Q?4/agKjNWVaTHg+GbaK6FKyYhUHgawKnf1PStovTnOkZhjkmeNs41irubKT?= =?iso-8859-1?Q?5pkn9oaFTK2i61YlhyyHaMGY6pDdVM4cyT+ItDdilS1F9WEtYz1sCi0p+5?= =?iso-8859-1?Q?mwv8K0Ed3En/e5DcDByXuFWdxghYca19xoCd8TgpOnyEV9su2qYUPjCUjb?= =?iso-8859-1?Q?ctyM4F/NfxyIhY7GNpzDGWrPum8QtZW9vXLPE7k0M7wIu4ojJHg68JUDDI?= =?iso-8859-1?Q?QHENAFqN4IWVPPVjJnaG5cwW+hjHuFdC6r4xCD+JOW18+DkZklllNl6s7W?= =?iso-8859-1?Q?Syh/zVcJ4e0Fohj+dLNa2jN9IfiCLIFC9jFYYF/IUpm9zxrK0jRDWe6qsR?= =?iso-8859-1?Q?k92HQXMAGk1R/+gXUAwHaWkM89QOMNXylR0/gXB5j8UvauBsIGjZhLojSU?= =?iso-8859-1?Q?NgdP+R/tmda6HmSOBtfm94CGSPKprTKAdLcfHckyLQDR5cFI0HDFUmOeRR?= =?iso-8859-1?Q?btTptgs829qwdXUDUfHGkbdz79ljf6+eX8bdg/RFgziYjQb2wDYDdDlKhH?= =?iso-8859-1?Q?XmLGWPn7YMwDp/AX3bFMutdZqZqIGEFfub?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN7PR11MB7019.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9bcfe93-0b43-4293-bd12-08db6ca23250 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jun 2023 06:40:08.7232 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NzhzF5evcSDl4rqUy9wREC7hFEPDuEwL1O2M1dxSBJE6a2b30TVea7WVjlSHgaEN+svBs+vWH9u+frzo7OQaUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB6373 X-OriginatorOrg: intel.com 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 Hi, Thanks for your comments, replies are inline. Thanks a again, Cheng > -----Original Message----- > From: huangdengdui > Sent: Tuesday, June 13, 2023 8:55 PM > To: Jiang, Cheng1 ; thomas@monjalon.net; > Richardson, Bruce ; > mb@smartsharesystems.com; Xia, Chenbo ; > amitprakashs@marvell.com; anoobj@marvell.com > Cc: dev@dpdk.org; Hu, Jiayu ; Ding, Xuan > ; Ma, WenwuX ; Wang, > YuanX ; He, Xingguang > Subject: Re: [PATCH v6] app/dma-perf: introduce dma-perf application >=20 > Hi Cheng, >=20 > Few comments inline. Please check. >=20 > Thanks, > Dengdui >=20 > On 2023/6/13 12:31, Cheng Jiang wrote: > > There are many high-performance DMA devices supported in DPDK now, > and > > these DMA devices can also be integrated into other modules of DPDK as > > accelerators, such as Vhost. Before integrating DMA into applications, > > developers need to know the performance of these DMA devices in > > various scenarios and the performance of CPUs in the same scenario, > > such as different buffer lengths. Only in this way can we know the > > target performance of the application accelerated by using them. This > > patch introduces a high-performance testing tool, which supports > > comparing the performance of CPU and DMA in different scenarios > > automatically with a pre-set config file. Memory Copy performance test = are > supported for now. > > > > Signed-off-by: Cheng Jiang > > Signed-off-by: Jiayu Hu > > Signed-off-by: Yuan Wang > > Acked-by: Morten Br=F8rup > > Acked-by: Chenbo Xia > > --- > > v6: > > improved code based on Anoob's comments; > > fixed some code structure issues; > > v5: > > fixed some LONG_LINE warnings; > > v4: > > fixed inaccuracy of the memory footprint display; > > v3: > > fixed some typos; > > v2: > > added lcore/dmadev designation; > > added error case process; > > removed worker_threads parameter from config.ini; > > improved the logs; > > improved config file; > > > > app/meson.build | 1 + > > app/test-dma-perf/benchmark.c | 477 ++++++++++++++++++++++++++++ > > app/test-dma-perf/config.ini | 59 ++++ > > app/test-dma-perf/main.c | 569 > ++++++++++++++++++++++++++++++++++ > > app/test-dma-perf/main.h | 69 +++++ > > app/test-dma-perf/meson.build | 17 + > > 6 files changed, 1192 insertions(+) > > create mode 100644 app/test-dma-perf/benchmark.c create mode > 100644 > > app/test-dma-perf/config.ini create mode 100644 > > app/test-dma-perf/main.c create mode 100644 app/test-dma-perf/main.h > > create mode 100644 app/test-dma-perf/meson.build > > > > diff --git a/app/meson.build b/app/meson.build index > > 74d2420f67..4fc1a83eba 100644 > > --- a/app/meson.build > > +++ b/app/meson.build > > @@ -19,6 +19,7 @@ apps =3D [ > > 'test-cmdline', > > 'test-compress-perf', > > 'test-crypto-perf', > > + 'test-dma-perf', > > 'test-eventdev', > > 'test-fib', > > 'test-flow-perf', > > diff --git a/app/test-dma-perf/benchmark.c > > b/app/test-dma-perf/benchmark.c new file mode 100644 index > > 0000000000..bc1ca82297 > > --- /dev/null > > +++ b/app/test-dma-perf/benchmark.c > > @@ -0,0 +1,477 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(c) 2023 Intel Corporation */ > > + >=20 > >=20 > > +static inline int > > +__rte_format_printf(3, 4) > > +print_err(const char *func, int lineno, const char *format, ...) { > > + va_list ap; > > + int ret; > > + > > + ret =3D fprintf(stderr, "In %s:%d - ", func, lineno); > > + va_start(ap, format); > > + ret +=3D vfprintf(stderr, format, ap); > > + va_end(ap); > > + > > + return ret; > > +} > > + > > +static inline void > > +calc_result(uint32_t buf_size, uint32_t nr_buf, uint16_t nb_workers, > uint16_t test_secs, > > + uint32_t total_cnt, float *memory, uint32_t > *ave_cycle, > > + float *bandwidth, float *mops) > > +{ > > + *memory =3D (float)(buf_size * (nr_buf / nb_workers) * 2) / (1024 * > 1024); > > + *ave_cycle =3D test_secs * rte_get_timer_hz() / total_cnt; > > + *bandwidth =3D (buf_size * 8 * (rte_get_timer_hz() / (float)*ave_cycl= e)) > / 1000000000; > > + *mops =3D (float)rte_get_timer_hz() / *ave_cycle / 1000000; >=20 > The value of ave_cycle may be 0. >=20 > *mops =3D (float)(total_cnt / test_secs) / 1000000; ? OK, it makes sense to me. I'll fix it in the next version. >=20 > > +} > > + > > +static void > > +output_result(uint8_t scenario_id, uint32_t lcore_id, char *dma_name, > uint64_t ave_cycle, > > + uint32_t buf_size, uint32_t nr_buf, float memory, > > + float bandwidth, float mops, bool is_dma) { > > + if (is_dma) > > + printf("lcore %u, DMA %s:\n", lcore_id, dma_name); > > + else > > + printf("lcore %u\n", lcore_id); > > + > > + printf("average cycles/op: %" PRIu64 ", buffer size: %u, nr_buf: %u, > memory: %.2lfMB, frequency: %" PRIu64 ".\n", > > + ave_cycle, buf_size, nr_buf, memory, > rte_get_timer_hz()); > > + printf("Average bandwidth: %.3lfGbps, MOps: %.3lf\n", bandwidth, > > +mops); > > + > > + if (is_dma) > > + snprintf(output_str[lcore_id], MAX_OUTPUT_STR_LEN, > CSV_LINE_DMA_FMT, > > + scenario_id, lcore_id, dma_name, buf_size, > > + nr_buf, memory, ave_cycle, bandwidth, mops); > > + else > > + snprintf(output_str[lcore_id], MAX_OUTPUT_STR_LEN, > CSV_LINE_CPU_FMT, > > + scenario_id, lcore_id, buf_size, > > + nr_buf, memory, ave_cycle, bandwidth, mops); } > > + > > +static inline void > > +cache_flush_buf(__maybe_unused struct rte_mbuf **array, > > + __maybe_unused uint32_t buf_size, > > + __maybe_unused uint32_t nr_buf) > > +{ > > +#ifdef RTE_ARCH_X86_64 > > + char *data; > > + struct rte_mbuf **srcs =3D array; > > + uint32_t i, offset; > > + > > + for (i =3D 0; i < nr_buf; i++) { > > + data =3D rte_pktmbuf_mtod(srcs[i], char *); > > + for (offset =3D 0; offset < buf_size; offset +=3D 64) > > + __builtin_ia32_clflush(data + offset); > > + } > > +#endif > > +} > > + >=20 > >=20 > > + > > +/* Parse the argument given in the command line of the application */ > > +static int append_eal_args(int argc, char **argv, const char > > +*eal_args, char **new_argv) { > > + int i; > > + char *tokens[MAX_EAL_PARAM_NB]; > > + char args[MAX_EAL_PARAM_LEN] =3D {0}; > > + int token_nb, new_argc =3D 0; > > + > > + for (i =3D 0; i < argc; i++) { > > + if ((strcmp(argv[i], CMDLINE_CONFIG_ARG) =3D=3D 0) || > > + (strcmp(argv[i], CMDLINE_RESULT_ARG) =3D=3D 0)) > { > > + i++; > > + continue; > > + } > > + strlcpy(new_argv[new_argc], argv[i], > sizeof(new_argv[new_argc])); >=20 > The type_of argv[new_argc] is *char. Cannot use sizeof(). >=20 > strcpy(new_argv[new_argc], argv[i]); or strlcpy(new_argv[new_argc], argv[= i], > MAX_EAL_PARAM_LEN); ? Yes, it's a mistake, thanks for pointing out! I'll fix it in the next versi= on. >=20 > > + new_argc++; > > + } > > + > > + if (eal_args) { > > + strlcpy(args, eal_args, sizeof(args)); > > + token_nb =3D rte_strsplit(args, strlen(args), > > + tokens, MAX_EAL_PARAM_NB, ' '); > > + for (i =3D 0; i < token_nb; i++) > > + strcpy(new_argv[new_argc++], tokens[i]); > > + } > > + > > + return new_argc; > > +} > > + > > +int > > +main(int argc, char *argv[]) > > +{ > > + int ret; > > + uint16_t case_nb; > > + uint32_t i, nb_lcores; > > + pid_t cpid, wpid; > > + int wstatus; > > + char args[MAX_EAL_PARAM_NB][MAX_EAL_PARAM_LEN]; > > + char *pargs[MAX_EAL_PARAM_NB]; > > + char *cfg_path_ptr =3D NULL; > > + char *rst_path_ptr =3D NULL; > > + char rst_path[PATH_MAX]; > > + int new_argc; > > + bool is_first_case =3D true; > > + > > + memset(args, 0, sizeof(args)); > > + > > + for (i =3D 0; i < RTE_DIM(pargs); i++) > > + pargs[i] =3D args[i]; > > + > > + for (i =3D 0; i < (uint32_t)argc; i++) { > > + if (strncmp(argv[i], CMDLINE_CONFIG_ARG, > MAX_LONG_OPT_SZ) =3D=3D 0) > > + cfg_path_ptr =3D argv[i + 1]; > > + if (strncmp(argv[i], CMDLINE_RESULT_ARG, > MAX_LONG_OPT_SZ) =3D=3D 0) > > + rst_path_ptr =3D argv[i + 1]; > > + } > > + if (cfg_path_ptr =3D=3D NULL) { > > + printf("Config file not assigned.\n"); > > + return -1; > > + } > > + if (rst_path_ptr =3D=3D NULL) { > > + strlcpy(rst_path, cfg_path_ptr, PATH_MAX); > > + strcat(strtok(basename(rst_path), "."), "_result.csv"); > > + rst_path_ptr =3D rst_path; > > + } > > + > > + case_nb =3D load_configs(cfg_path_ptr); > > + fd =3D fopen(rst_path_ptr, "w"); > > + if (fd =3D=3D NULL) { > > + printf("Open output CSV file error.\n"); > > + return -1; > > + } > > + fclose(fd); > > + > > + for (i =3D 0; i < case_nb; i++) { > > + if (test_cases[i].test_type =3D=3D TEST_TYPE_NONE) { > > + printf("No test type in test case %d.\n\n", i + 1); > > + continue; > > + } > > + if (!test_cases[i].is_valid) { > > + printf("Invalid test case %d.\n\n", i + 1); > > + continue; > > + } > > + > > + cpid =3D fork(); > > + if (cpid < 0) { > > + printf("Fork case %d failed.\n", i + 1); > > + exit(EXIT_FAILURE); > > + } else if (cpid =3D=3D 0) { > > + printf("\nRunning case %u\n\n", i + 1); > > + > > + new_argc =3D append_eal_args(argc, argv, > test_cases[i].eal_args, pargs); > > + ret =3D rte_eal_init(new_argc, pargs); > > + if (ret < 0) > > + rte_exit(EXIT_FAILURE, "Invalid EAL > arguments\n"); > > + > > + /* Check lcores. */ > > + nb_lcores =3D rte_lcore_count(); > > + if (nb_lcores < 2) > > + rte_exit(EXIT_FAILURE, > > + "There should be at least 2 worker > lcores.\n"); > > + > > + fd =3D fopen(rst_path_ptr, "a"); > > + if (!fd) { > > + printf("Open output CSV file error.\n"); > > + return 0; > > + } > > + > > + if (is_first_case) { > > + output_env_info(); > > + is_first_case =3D false; > > + } > > + run_test(i + 1, &test_cases[i]); > > + > > + /* clean up the EAL */ > > + rte_eal_cleanup(); > > + > > + fclose(fd); > > + > > + printf("\nCase %u completed.\n\n", i + 1); > > + > > + exit(EXIT_SUCCESS); > > + } else { > > + wpid =3D waitpid(cpid, &wstatus, 0); > > + if (wpid =3D=3D -1) { > > + printf("waitpid error.\n"); > > + exit(EXIT_FAILURE); > > + } > > + > > + if (WIFEXITED(wstatus)) > > + printf("Case process exited. status %d\n\n", > > + WEXITSTATUS(wstatus)); > > + else if (WIFSIGNALED(wstatus)) > > + printf("Case process killed by signal %d\n\n", > > + WTERMSIG(wstatus)); > > + else if (WIFSTOPPED(wstatus)) > > + printf("Case process stopped by > signal %d\n\n", > > + WSTOPSIG(wstatus)); > > + else if (WIFCONTINUED(wstatus)) > > + printf("Case process continued.\n\n"); > > + else > > + printf("Case process unknown > terminated.\n\n"); > > + } > > + } > > + > > + printf("Bye...\n"); > > + return 0; > > +} >=20 >