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 61B1F42C9E; Tue, 13 Jun 2023 06:51:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E535140A8A; Tue, 13 Jun 2023 06:51:44 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 75D3040698 for ; Tue, 13 Jun 2023 06:51:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686631903; x=1718167903; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=URPdBUOu0G/Yaxi7kHS3RjC197DpRg1PNqOGzV9EIQU=; b=Kl12xR1tevbyJDeosX9KBY7riU6nSQIy3e1pM0/eGEnHAx1MKp3SznoG Lx6Pq13lCb3Tlyuqixiok8nZd9mDtvtsIaJB19sUU/p2M74sry0wa0IMa 2dgIreR2p4JV28LjbWX/jAXoze8FekgeIVzBNrXd0rm15L/M0uQhC6AVU 3aQAej+he+GawAJPbzahenz2a7wq4bYDJOkRni4qbEcKgfLrebhHFG3r7 Mb45m0WLYfFbm4JusIZWY8f4yn//Y//Z1jLSvIZuKh99zl7LKWeZ/M9ZW ythecJrdBQrmKcfBwJ4IT66EHEUm/TFsf8HZCwioJLthYiNFnx2CwB8o/ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="337864924" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="337864924" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 21:51:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="711470844" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="711470844" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga002.jf.intel.com with ESMTP; 12 Jun 2023 21:51:34 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 12 Jun 2023 21:51:33 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 12 Jun 2023 21:51:33 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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 via Frontend Transport; Mon, 12 Jun 2023 21:51:33 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.46) 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; Mon, 12 Jun 2023 21:51:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B06Refe99GOmkjv1Oi/5W+QM0ag8QxpVvTX3VrfgK0RSJDZRJWXNGdfaCQ3CHqkL+70ATaiTykJKsXMeQXjMcs/De3lFEOe7dWBPi53PiO9FUohHhpLuSX+myyUam3zsY+synX5kB9N6YnLw9RMUbpVggR6oWtpxbvJtBLYEWGO9ADHnnXIrsSbNi0xAdN3+HdA5qj2kv2sHKFgmBOhGo8WbTkc5/0lXgY9EfhbhAYpQUet2p0zr6ADrW6e2wy5wLhKxHOHUKhWbnyU8vfTCRpq87KJZVY/Q8jRXM8wZyE+j8pkAOkT1f4ixp8KWK18Yw/alit29G7e2ME2eCaGzUg== 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=jT9XFubQ2655jv+XM2OmMW3L0iDHTGEOz7tQKPTwbDQ=; b=E7MN8WIhmEFpDARKs0+4hQI1yVbJ9s/kgf90bbcmzM3nyiBwM7NtJbGODUGxUDK5lE+/0tQoYcpNXUUudgYVwFYpZw/bTK8musNfx5FqMno48h6XxMUKW8J7t/oOryJcI8fVvP7rnrEPYMK6FEKz2igWszl3zr83tsQqJa2ZZrfjZ0EpvInjsjsmRdei413OlgA+kNqJSF4RtqPK8zp32RzITyevW2btz6nejEkGRlour0DijS+9lPCkqapiRPVosnAUqazVefj92QaK4WUk+uJdYcnLp76vK4RCzUNIdi9LIQSv+nYMpThlxMm9izwyPc8w6/8KZf9MmOXm/Xm+cA== 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 DS0PR11MB8020.namprd11.prod.outlook.com (2603:10b6:8:114::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Tue, 13 Jun 2023 04:51:29 +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.6455.034; Tue, 13 Jun 2023 04:51:29 +0000 From: "Jiang, Cheng1" To: Amit Prakash Shukla , "thomas@monjalon.net" , "Richardson, Bruce" , "mb@smartsharesystems.com" , "Xia, Chenbo" CC: "dev@dpdk.org" , "Hu, Jiayu" , "Ding, Xuan" , "Ma, WenwuX" , "Wang, YuanX" , "He, Xingguang" , Jerin Jacob Kollanukkaran , Anoob Joseph Subject: RE: [EXT] [PATCH v5] app/dma-perf: introduce dma-perf application Thread-Topic: [EXT] [PATCH v5] app/dma-perf: introduce dma-perf application Thread-Index: AQHZmepmH5sZGSySr0eGsksF60IL36+CgmwAgARYSACAAFsOoA== Date: Tue, 13 Jun 2023 04:51:29 +0000 Message-ID: References: <20230420072215.19069-1-cheng1.jiang@intel.com> <20230608084355.16209-1-cheng1.jiang@intel.com> In-Reply-To: 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_|DS0PR11MB8020:EE_ x-ms-office365-filtering-correlation-id: fadfa0a2-1a79-4db7-8390-08db6bc9d9d8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eyhPX2dCtS1CCqmpyHaBPEEAYdtGvEehHKvKggjt4XAVEM+teNN+EwwPfR1ym6gfsVU7ehK9XUBe5LGjDxZVxhH3IgsEIqHrTMAjz63Nb1EaVNVl/96iuQhsEaUS2PG1a28EZmxdItWBow/ruX/aF55eUM+6BSyxcG5fVZNOtySDZ6FCt25hmsDiNiGD6NmseVeMgki3ESq02c9k5DqJuNTiGrprSLJCdjAUEWtmdYD3G9CAgXKcmNObgUvq1YJMpnEiOlJt+Ca5NWgExrrAjJLj7N7ZC8sCBOFoRofq5C8yHW0eJ+gYtA+1WYHwn0JgfIREHuPUai2xiQDDHhvGmGVxg+bJQmuaADgkgr6wp/aQv0WQiLCs9hAMpINdtX0jQZOum+hfbhCvMqYr0ab6bHTmyBS0Re4Wm+4fdgpSAj3zVvT89+Mfj/JhKwQfHqdhMLUFme4d1usGI86EK2Ld3fyQV3eooKjKRv5uClVmljpb07WQFK3G2cDkiOl3UST9xbdbE5+CvAI1P5F9Ur2orMcDevhYqagnBboLnZ9RtFD4gxQsa2n9O1e57CW7YBwF6A2UQdyzGzQKKn+kId48jfWhAI6XlwcxsR9A//XagP/JbsneEtAchrY1gNQEp20K 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)(376002)(39860400002)(396003)(366004)(136003)(346002)(451199021)(86362001)(7696005)(33656002)(55016003)(38100700002)(122000001)(82960400001)(38070700005)(478600001)(71200400001)(54906003)(110136005)(8936002)(8676002)(5660300002)(52536014)(30864003)(4326008)(6636002)(66946007)(66556008)(66476007)(66446008)(64756008)(316002)(41300700001)(2906002)(66574015)(83380400001)(6506007)(76116006)(26005)(9686003)(186003)(53546011); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?lAhQIZAormEgFAZsTGv01WF0NdxCHROgIDK46h3wEfl7QtUeF6C/p2AmJH?= =?iso-8859-1?Q?2S2wcTFZ4InagADJnP9icpnGcLObpZ1/X/Y1JEcg47j6a79fwXmBLeJDYG?= =?iso-8859-1?Q?Pp2WzCjBH03DwPy2S5kgdgF+hrVqsVR/KNIEpmfLMv23by2aN5JVmKPZUH?= =?iso-8859-1?Q?iZiSqJ6t6Nd/H6nm+OqJUO1iPUdDsR7Wjp8D9SKknvLkbE8p3yPjgYWch7?= =?iso-8859-1?Q?djxDPJLYdnJgd1sTTpviST+auaSdAavHzWvvtCqoVxoNqq0BABEe1oBvd9?= =?iso-8859-1?Q?8imeECjHG7wVaGdkvGXBKCy1j2QeyRqlTz4MhdANGgX8lwkWkKK7tw/EVy?= =?iso-8859-1?Q?pJlwDxjcy750W6mDO9AQyZnnchqp9QdqwTkxUJdBr96cZWC3z9EdzmYXy3?= =?iso-8859-1?Q?BaqHkJ7JFIXb+iUEEoUg0QGy55DeUbecnYi1G7NaHQKDEVsk8ob5/SFRqr?= =?iso-8859-1?Q?+Mdy8t4ZUnkFo+RUqak1sjEDt/DvLNuZECmoomvMfxrn9vThIfhvb6h71z?= =?iso-8859-1?Q?VCyqE8o0mVs5Nb9kIT7B26m7SHxm9V2ha8oTMuhgwkYWgpiRXIsATwFdZi?= =?iso-8859-1?Q?RkOa+A17kJp/VPmw0a+PGOhaSCzblIVxYhp8K5z38WU/HCAjQ3jCpbb2dD?= =?iso-8859-1?Q?v/9k1i0Ieq8xPrRCMJKn/v66gyc7DGYV7ivGkF0aOZ4XGbUKx7BnuEj+BK?= =?iso-8859-1?Q?W1VbX6sZ8slFPoQGWYU91A5x7zgvItjAESNBtbrNOzScC36+A3rSA3dfc8?= =?iso-8859-1?Q?9JCWRaZSgJPwTj4jxuEvBfIJGDZffhNMuIMXnof3D5xFumobG0EcNkPVUs?= =?iso-8859-1?Q?Ifg9MUI/ZNbcKhXkVb3mkUl6+VgceHXnxjMc3UaGA2i/RpSeGUDJ6pPdhi?= =?iso-8859-1?Q?Yx+SeCikq+2BoT4B0Qx9fDQl57AIxNmjyo6sZXM8sBwwA24TywN7Jt4iCZ?= =?iso-8859-1?Q?4FUzpzl7zBvGpFcN6XnYp0E+RFQUIPTLz/0mY6Udg3UwLlQ480EDnjHujD?= =?iso-8859-1?Q?8lLbQ8xU+Muf3afo6aNSxcnB+2P7zzeXOd6QX5MEGrINca1nlrmLfMlBOu?= =?iso-8859-1?Q?OEHq/POpypAfuYnQ6kmNqiBwYPJm5nHgWRdyOd1fp54YKuQD+WVxVFOXZo?= =?iso-8859-1?Q?h3uhxJ7ckGmYfRNPqC9sMQM3tXDwbCfBMVpqzpJiWx9YzrYHsFKzuLo4hA?= =?iso-8859-1?Q?S4XgQwD43oGYszgc+Rl6J/ecYm4tU4/Wk+VGdj36LjH1oE+EupRAJOHF9G?= =?iso-8859-1?Q?NGXmx2MiHKDtNPcC+u11AEZlbfovC3vFThltGZkTNEomhRbE0YW6gSaP4H?= =?iso-8859-1?Q?+ug5TikRe4p0uY0ntlklrG8X7S9pLQiNnKd04v3aepj7rG0RoqjghChPbD?= =?iso-8859-1?Q?co8qKLzj0UymA1uvVS0Bji+t+vE2xTnftsQgpmNFDjljV0/IgHaSt9lcS/?= =?iso-8859-1?Q?bPxtPIVcpwf6IJCa8WQzptYVvwWff2lT3g01N37oo/q5I3RTvJLbf8Ex5J?= =?iso-8859-1?Q?iAl/6OJaWAtSr6BtMu/8iNCIA7ZOFYa5QkRsIbRfQpPwshGrEF9nTHG3zx?= =?iso-8859-1?Q?V00lRtL1g2iAn44H5XMgEGvTNCrKKW1IIwFZo6ORyNxFxVmRtKNqYA/V3u?= =?iso-8859-1?Q?6r6oziRrMKo+WzCo4x2/zuaasf91aAWysj?= 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: fadfa0a2-1a79-4db7-8390-08db6bc9d9d8 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2023 04:51:29.0463 (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: RYUsi8rw9AEMyKSHG0ksYQT+8i/+3U4WkaFsHE3h2cL2ddQ2GZFUFeQf9ipmNuGJh96ImJTM2ACar3fOFE38PQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB8020 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, Replies are inline. > -----Original Message----- > From: Jiang, Cheng1 > Sent: Monday, June 12, 2023 4:27 PM > To: Amit Prakash Shukla ; > thomas@monjalon.net; Richardson, Bruce ; > mb@smartsharesystems.com; Xia, Chenbo > Cc: dev@dpdk.org; Hu, Jiayu ; Ding, Xuan > ; Ma, WenwuX ; Wang, > YuanX ; He, Xingguang ; > Jerin Jacob Kollanukkaran ; Anoob Joseph > > Subject: RE: [EXT] [PATCH v5] app/dma-perf: introduce dma-perf applicatio= n >=20 > Hi, >=20 > Thanks for your comments, replies are inline. >=20 > Thanks, > Cheng >=20 > > -----Original Message----- > > From: Amit Prakash Shukla > > Sent: Friday, June 9, 2023 10:03 PM > > To: Jiang, Cheng1 ; thomas@monjalon.net; > > Richardson, Bruce ; > > mb@smartsharesystems.com; Xia, Chenbo > > Cc: dev@dpdk.org; Hu, Jiayu ; Ding, Xuan > > ; Ma, WenwuX ; Wang, > YuanX > > ; He, Xingguang ; Jerin > > Jacob Kollanukkaran ; Anoob Joseph > > > > Subject: RE: [EXT] [PATCH v5] app/dma-perf: introduce dma-perf > > application > > > > > > > > > -----Original Message----- > > > From: Cheng Jiang > > > Sent: Thursday, June 8, 2023 2:14 PM > > > To: thomas@monjalon.net; bruce.richardson@intel.com; > > > mb@smartsharesystems.com; chenbo.xia@intel.com > > > Cc: dev@dpdk.org; jiayu.hu@intel.com; xuan.ding@intel.com; > > > wenwux.ma@intel.com; yuanx.wang@intel.com; > xingguang.he@intel.com; > > > Cheng Jiang > > > Subject: [EXT] [PATCH v5] app/dma-perf: introduce dma-perf > > > application > > > > > > External Email > > > > > > -------------------------------------------------------------------- > > > -- 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 > > > --- > > > 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 | 472 ++++++++++++++++++++++++++++ > > > 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, 1187 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 > > > > > > > > > > > > + > > > +static inline int > > > +do_dma_mem_copy(void *p) > > > +{ > > > + uint16_t *para_idx =3D (uint16_t *)p; > > > + volatile struct lcore_params *para =3D worker_params[*para_idx]; > > > + volatile struct worker_info *worker_info =3D &(para->worker_info); > > > + uint16_t dev_id =3D para->dev_id; > > > + uint32_t nr_buf =3D para->nr_buf; > > > + uint16_t kick_batch =3D para->kick_batch; > > > + uint32_t buf_size =3D para->buf_size; > > > + struct rte_mbuf **srcs =3D para->srcs; > > > + struct rte_mbuf **dsts =3D para->dsts; > > > + int64_t async_cnt =3D 0; > > > + int nr_cpl =3D 0; > > > + uint32_t i; > > > + uint32_t poll_cnt =3D 0; > > > + > > > + worker_info->stop_flag =3D false; > > > + worker_info->ready_flag =3D true; > > > + > > > + while (!worker_info->start_flag) > > > + ; > > > + > > > + while (1) { > > > + for (i =3D 0; i < nr_buf; i++) { > > > + if (unlikely(rte_dma_copy(dev_id, > > > + 0, > > > + rte_pktmbuf_iova(srcs[i]), > > > + rte_pktmbuf_iova(dsts[i]), > > > + buf_size, > > > + 0) < 0)) { > > > + rte_dma_submit(dev_id, 0); > > > + while (rte_dma_burst_capacity(dev_id, 0) =3D=3D > > > 0) { > > > + nr_cpl =3D rte_dma_completed(dev_id, > > > 0, MAX_DMA_CPL_NB, > > > + NULL, NULL); > > > + async_cnt -=3D nr_cpl; > > > + worker_info->total_cpl +=3D nr_cpl; > > > + } > > > + if (rte_dma_copy(dev_id, > > > + 0, > > > + rte_pktmbuf_iova(srcs[i]), > > > + rte_pktmbuf_iova(dsts[i]), > > > + buf_size, > > > + 0) < 0) { > > > + printf("enqueue fail again at %u\n", > > > i); > > > + printf("space:%d\n", > > > rte_dma_burst_capacity(dev_id, 0)); > > > + rte_exit(EXIT_FAILURE, "DMA > > > enqueue failed\n"); > > > > [Amit]: On all success or failure exits, please call rte_dma_stop and > > rte_dma_close to exit cleanly. >=20 > [Cheng] Got it. Thanks, I'll fix it in the next version. [Cheng] Hi, I take a look into it, and find out rte_exit() will call rte_dm= a_close(), so I think there is no need to do it explicitly here. What do yo= u think? >=20 > > > > > + } > > > + } > > > + async_cnt++; > > > + > > > + if ((async_cnt % kick_batch) =3D=3D 0) { > > > + rte_dma_submit(dev_id, 0); > > > + /* add a poll to avoid ring full */ > > > + nr_cpl =3D rte_dma_completed(dev_id, 0, > > > MAX_DMA_CPL_NB, NULL, NULL); > > > + async_cnt -=3D nr_cpl; > > > + worker_info->total_cpl +=3D nr_cpl; > > > + } > > > + } > > > + > > > + if (worker_info->stop_flag) > > > + break; > > > + } > > > + > > > + rte_dma_submit(dev_id, 0); > > > + while ((async_cnt > 0) && (poll_cnt++ < POLL_MAX)) { > > > + nr_cpl =3D rte_dma_completed(dev_id, 0, > > > MAX_DMA_CPL_NB, NULL, NULL); > > > + async_cnt -=3D nr_cpl; > > > + } > > > + > > > + return 0; > > > +} > > > + > > > > > > > > > + > > > +void > > > +mem_copy_benchmark(struct test_configure *cfg, bool is_dma) { > > > + uint16_t i; > > > + uint32_t offset; > > > + unsigned int lcore_id =3D 0; > > > + struct rte_mbuf **srcs =3D NULL, **dsts =3D NULL; > > > + struct lcore_dma_map_t *ldm =3D &cfg->lcore_dma_map; > > > + unsigned int buf_size =3D cfg->buf_size.cur; > > > + uint16_t kick_batch =3D cfg->kick_batch.cur; > > > + uint32_t nr_buf =3D cfg->nr_buf =3D (cfg->mem_size.cur * 1024 * 102= 4) > > > +/ > > > (cfg->buf_size.cur * 2); > > > + uint16_t nb_workers =3D ldm->cnt; > > > + uint16_t test_secs =3D cfg->test_secs; > > > + float memory; > > > + uint32_t avg_cycles =3D 0; > > > + float mops; > > > + float bandwidth; > > > + > > > + if (setup_memory_env(cfg, &srcs, &dsts) < 0) > > > + goto out; > > > + > > > + if (is_dma) > > > + if (config_dmadevs(cfg) < 0) > > > + goto out; > > > + > > > + if (cfg->cache_flush) { > > > + cache_flush_buf(srcs, buf_size, nr_buf); > > > + cache_flush_buf(dsts, buf_size, nr_buf); > > > + rte_mb(); > > > + } > > > + > > > + printf("Start testing....\n"); > > > + > > > + for (i =3D 0; i < nb_workers; i++) { > > > + lcore_id =3D ldm->lcores[i]; > > > + offset =3D nr_buf / nb_workers * i; > > > + > > > + worker_params[i] =3D rte_malloc(NULL, sizeof(struct > > > lcore_params), 0); > > > + if (!worker_params[i]) { > > > + printf("lcore parameters malloc failure for lcore > > > %d\n", lcore_id); > > > + break; > > > + } > > > + if (is_dma) { > > > + worker_params[i]->dma_name =3D ldm- > > > >dma_names[i]; > > > + worker_params[i]->dev_id =3D ldm->dma_ids[i]; > > > + worker_params[i]->kick_batch =3D kick_batch; > > > + } > > > + worker_params[i]->worker_id =3D i; > > > + worker_params[i]->nr_buf =3D (uint32_t)(nr_buf / > > > nb_workers); > > > + worker_params[i]->buf_size =3D buf_size; > > > + worker_params[i]->test_secs =3D test_secs; > > > + worker_params[i]->srcs =3D srcs + offset; > > > + worker_params[i]->dsts =3D dsts + offset; > > > + worker_params[i]->scenario_id =3D cfg->scenario_id; > > > + worker_params[i]->lcore_id =3D lcore_id; > > > + > > > + if (is_dma) > > > + rte_eal_remote_launch(do_dma_mem_copy, (void > > > *)(&i), lcore_id); > > > + else > > > + rte_eal_remote_launch(do_cpu_mem_copy, (void > > > *)(&i), lcore_id); > > > + } > > > + > > > + while (1) { > > > + bool ready =3D true; > > > + for (i =3D 0; i < nb_workers; i++) { > > > + if (worker_params[i]->worker_info.ready_flag =3D=3D > > > false) { > > > + ready =3D 0; > > > + break; > > > + } > > > + } > > > + if (ready) > > > + break; > > > + } > > > + > > > + for (i =3D 0; i < nb_workers; i++) > > > + worker_params[i]->worker_info.start_flag =3D true; > > > + > > > + usleep(TEST_WAIT_U_SECOND); > > > + for (i =3D 0; i < nb_workers; i++) > > > + worker_params[i]->worker_info.test_cpl =3D > > > +worker_params[i]->worker_info.total_cpl; > > > + > > > + usleep(test_secs * 1000 * 1000); > > > + for (i =3D 0; i < nb_workers; i++) > > > + worker_params[i]->worker_info.test_cpl =3D > > > worker_params[i]->worker_info.total_cpl - > > > + worker_params[i]- > > > >worker_info.test_cpl; > > > + > > > + for (i =3D 0; i < nb_workers; i++) > > > + worker_params[i]->worker_info.stop_flag =3D true; > > > + > > > + rte_eal_mp_wait_lcore(); > > > + > > > + for (i =3D 0; i < nb_workers; i++) { > > > + calc_result(buf_size, nr_buf, nb_workers, test_secs, > > > + worker_params[i]->worker_info.test_cpl, > > > + &memory, &avg_cycles, &bandwidth, &mops); > > > + output_result(cfg->scenario_id, worker_params[i]->lcore_id, > > > + worker_params[i]->dma_name, > > > avg_cycles, buf_size, > > > + nr_buf / nb_workers, memory, > > > bandwidth, mops, is_dma); > > > + } > > > + > > > +out: > > > + /* free env */ > > > + if (srcs) > > > + rte_pktmbuf_free_bulk(srcs, nr_buf); > > > + if (dsts) > > > + rte_pktmbuf_free_bulk(dsts, nr_buf); > > > + > > > + if (src_pool) > > > + rte_mempool_free(src_pool); > > > + if (dst_pool) > > > + rte_mempool_free(dst_pool); > > > + > > > + if (is_dma) { > > > + for (i =3D 0; i < nb_workers; i++) { > > > + printf("Stopping dmadev %d\n", ldm->dma_ids[i]); > > > + rte_dma_stop(ldm->dma_ids[i]); > > > > [Amit]: Below rte_dma_stop please call rte_dma_close for clean exit. > > >=20 > [Cheng] Sure, I'll fix it in the next version. [Cheng] We are not planning to exit here, we are just going to do the next = test, so we shouldn't call the rte_dma_close(). Just clarify. And when we f= inished all the test, we will call the rte_eal_cleanup() which will call th= e rte_dma_close(). Thanks! >=20 > > > > > > > +#endif /* _MAIN_H_ */ > > > diff --git a/app/test-dma-perf/meson.build b/app/test-dma- > > > perf/meson.build new file mode 100644 index 0000000000..bd6c264002 > > > --- /dev/null > > > +++ b/app/test-dma-perf/meson.build > > > @@ -0,0 +1,17 @@ > > > +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019-2023 > > > +Intel Corporation > > > + > > > +# meson file, for building this app as part of a main DPDK build. > > > + > > > +if is_windows > > > + build =3D false > > > + reason =3D 'not supported on Windows' > > > + subdir_done() > > > +endif > > > + > > > +deps +=3D ['dmadev', 'mbuf', 'cfgfile'] > > > + > > > +sources =3D files( > > > + 'main.c', > > > + 'benchmark.c', > > > +) > > > -- > > > 2.40.1