From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4AABA00C5; Thu, 30 Apr 2020 03:57:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF4501D9D7; Thu, 30 Apr 2020 03:57:56 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) by dpdk.org (Postfix) with ESMTP id 999A61D9BB for ; Thu, 30 Apr 2020 03:57:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PMof29vm0rEKhL1V/S55qv97j0IB5GuGEAYQyLb2KkQ=; b=GzXKwjVXwHcwmK4imWugL2ykdOrEyi7MPH/i1/pBVMe/TBqb7d29fAJ/C6/jnKKlB54fCDo/kpHsuVU/M+EGd1PlhbmMio0rq2HgkUk9+gPW0PQGzAl1RZh9lc9I6sNkfM1wJ3zHL0Hr/1VivdpKbyiii9gK/cOsZTENXRN80Ls= Received: from AM5PR0202CA0011.eurprd02.prod.outlook.com (2603:10a6:203:69::21) by AM6PR08MB3527.eurprd08.prod.outlook.com (2603:10a6:20b:41::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Thu, 30 Apr 2020 01:57:53 +0000 Received: from VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:69:cafe::73) by AM5PR0202CA0011.outlook.office365.com (2603:10a6:203:69::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 01:57:53 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT036.mail.protection.outlook.com (10.152.19.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 01:57:53 +0000 Received: ("Tessian outbound 5abcb386707e:v54"); Thu, 30 Apr 2020 01:57:52 +0000 X-CR-MTA-TID: 64aa7808 Received: from 75727d3be67d.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B0E9872F-20E5-4160-BB1C-460BF36DC323.1; Thu, 30 Apr 2020 01:57:47 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 75727d3be67d.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 01:57:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IMkLFmprjs3ON0nfb87F4hLTKKyRNYFaSuIniODD68uRi7tFpsKgkUSdHzXof3iyXsxPY7Qur8BbPCfhYVByYGHhDBISmv9YJWshEp1O6omcJHD1iDtnGMNmRgM517gPFVMAGY7pWkHHKNhNo8DU7H4hLqTbte5BS+d0x6p08UC7p17bw45qfuuQuqcw2oI4FrwjqOfI904KgmwfUfA5E9O59buL1Kabl61F0X2L2c2Eq2H1D/ChJ4oTYP1QDsngnfUTpwlbOLvCnf0kQunhvk8ngvLilqAssaI3ekDyJb0G1qdS7zuJyvNZm+Gub7YHOC75jv3WCcX0ppWNOpuuBA== 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-SenderADCheck; bh=PMof29vm0rEKhL1V/S55qv97j0IB5GuGEAYQyLb2KkQ=; b=IUEGf0XYCt63fiImNNuFDHa833GhKcNxQ0BIKry2zZ8Xp+EmS8+xArLPfrYlHUkr3gL4E75AIL+NASGTaO4W+xfxYpB6NPsckcITwF1KvsVwNcqzQvQX1yKw210HKNWnEzputH0ipTlv9TPqt4lYOQPcv20z+4/zCEVQN4gnNehac+x9sZhdifBkO8gRZD/fgti6huxAAOxtKx4bEeDpjXAF5symC3WXjTDqudpUuR906o6TMczr6skD0iPHRUE9dIv+QGSNh0GQ7vgjSqJ71Cne208Kl6Qw3ju095E+quDirRO5Q9d4mcU+ySm9i7djx9GLVRxs1X2XH1MLArMn1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PMof29vm0rEKhL1V/S55qv97j0IB5GuGEAYQyLb2KkQ=; b=GzXKwjVXwHcwmK4imWugL2ykdOrEyi7MPH/i1/pBVMe/TBqb7d29fAJ/C6/jnKKlB54fCDo/kpHsuVU/M+EGd1PlhbmMio0rq2HgkUk9+gPW0PQGzAl1RZh9lc9I6sNkfM1wJ3zHL0Hr/1VivdpKbyiii9gK/cOsZTENXRN80Ls= Received: from DBBPR08MB4646.eurprd08.prod.outlook.com (2603:10a6:10:f5::16) by DBBPR08MB4887.eurprd08.prod.outlook.com (2603:10a6:10:d7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Thu, 30 Apr 2020 01:57:45 +0000 Received: from DBBPR08MB4646.eurprd08.prod.outlook.com ([fe80::1870:afc4:b90f:609d]) by DBBPR08MB4646.eurprd08.prod.outlook.com ([fe80::1870:afc4:b90f:609d%5]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 01:57:45 +0000 From: Honnappa Nagarahalli To: Konstantin Ananyev , "dev@dpdk.org" CC: "aconole@redhat.com" , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH] test/ring: code rework to reduce compilation time Thread-Index: AQHWHk+l64WNWhz7zUq1AmUBfvaQkqiQx4Ew Date: Thu, 30 Apr 2020 01:57:45 +0000 Message-ID: References: <20200429175714.31141-1-konstantin.ananyev@intel.com> In-Reply-To: <20200429175714.31141-1-konstantin.ananyev@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 1876cc7f-f9aa-4a93-9810-3e96619f98dd.0 x-checkrecipientchecked: true Authentication-Results-Original: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c1c9bfbb-49a5-49c7-f8ac-08d7eca9e512 x-ms-traffictypediagnostic: DBBPR08MB4887:|DBBPR08MB4887:|AM6PR08MB3527: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:6430;OLM:6430; x-forefront-prvs: 0389EDA07F X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR08MB4646.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(136003)(39860400002)(396003)(366004)(8936002)(2906002)(33656002)(5660300002)(6506007)(53546011)(186003)(26005)(8676002)(9686003)(71200400001)(55016002)(4326008)(86362001)(66556008)(54906003)(966005)(66446008)(66946007)(66476007)(7696005)(110136005)(64756008)(76116006)(316002)(52536014)(30864003)(478600001)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: QO+kejaBovHGsS67gTAlcAO9ZM5fixcA5KIyuDiYpgqfZEkxg/F0TjXnQ8MRX65qKe09dMLmr7RSjNR/dBg/XiWd+LrF1PHBK98BglRTMDeSeJtM1uq9q8iFSkXpDL48CPF34onU04yno1y2YmqGH4m5vj1XZ3TjVVD9I8Ipe8k/ToX0Q2Mthi65vy8M/OGjJIGbNugY7eJ9oMUozY4orBoPNT/jeCK2i74O567xj14WXxlv5aWmaXUtfg9e+SfuTnm14UQjACjca2a2BnjulQMptZkuM8vHidW+n22JvU3hLAeK0KvDPEqR8gI/c1oQT8PRfTlopLvD4MpUthfhWS4DvvkdD+EJ9SvelBk9lVUFrE5/8fd2SHjclN58VK58BowR3W76fTbQM5PoZxwJXA+IgZa45hqQVhL37dX6R1COMSKCvJjTq208O78ENT5q80JTHRqavkNxVsPJk7yVTe7b43rHfOVdWdzXqV9ElXHmeXyppYUpIL+WFF/vwHkLnS4F1zy/m9sYxPai/WoH7Q== x-ms-exchange-antispam-messagedata: fe/JyX0MtmkZWJIHoE4mbt6PoIs2zrWkKHv+VtQyumhnc1k1xymHuFRok41zG3dzN3dhVj846GiC9FYicocWSmkaEse39rhgUZcSoe+Qwbf4DTCOtOm0Xme2SzaJboeqT3uzXjYRA+NYvSZ8kbxz3CvwtNXH6gfdNDQLVXVzLPIdI2qxpHieVnQ75BgYG+habEHskY2pjW7E3DPcMlWRDWBQ9h1xu6/xxr9nwjZJyXeqnfdHif209RIuBx3UaUQW6eesFrmey6A1WyBlZfVeE1wBtbtCoteJYbwG/Rh4rgIorgdE21yT/Lzqh9QJZfJ3Axakj76VMedeBzZJBa4+7SS+/btspZaeBu8WJZCSI0L2JHFbH3e6kb2OwT+0OuI9UaWXI8CmD7qxgiB5mNojlBbT2vndhO8t8eQU4b1Mqxm8m2f6wXUbw5pl7fL7tKeDVS5Fwf/83w6QABfINFznAapud3r5fBaZsDk5lvVHwPRGIutD5fyk3RYdaDGnqmuKmq0Wdl/OUwK2JuXVb78xQjchFHuHrmGUQnZknVSaedCyIkzUIx2sU2pHZpMAK+UuzHA2PJ9Uje4nBxtR9cBM1yjN58n1115+yLXmtPz5TRI7eVJMVa44JktGR6Ji22C38lT5FIBCBHiSqmJ0ypKCMzlF0yLThc5Qx6PlmSKuiiwV+oFdMtL6Zmm7RYKY2+q1RZ8vF3qVM6jUkL+Tcgq2wnXj8V3/wESYwBGM6jdj13D4TEFk2/lD2YeaXQ2PbJ+nVXfCoCr5VQYsgmagLmow3YczJ2+iH/rbF+TsA2+Hfs2sfeDHQ0JwDdzpc4l/trjE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4887 Original-Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(396003)(136003)(346002)(39860400002)(376002)(46966005)(186003)(33656002)(8676002)(82310400002)(52536014)(5660300002)(8936002)(81166007)(4326008)(86362001)(356005)(70586007)(70206006)(55016002)(478600001)(26005)(53546011)(6506007)(82740400003)(30864003)(47076004)(336012)(316002)(2906002)(110136005)(36906005)(966005)(9686003)(7696005)(54906003); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: ab90310b-d16b-4712-66be-08d7eca9e0b1 X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b3h8vL9XhTNV2v1aOoylQzncrzhL/rIAhi0ICkVo+gT47cERjh8Oxg4DAZtPLgpHMH3aCMZRojx0/qp9Gu16fr5Rqje7SoK+QTrEcLkbqBwrjv1RVF0g3hy5GMRTgSnHoFSA/Kdasds5qSe7ts8Nf2lfHEjexa91FUXmr3naSn+vyXwWmwJR91pC3JQx2f8yRzWrcW9q7NsAveRblLP3sD4AnHpyN1E/1Rv4f/VAngZwL/SmMxbw/YKqiK6Btn6DXloGbrbFVP2bDZTEC8Hz+vFyAUpNfL+Khqf23zTDj3CfzBE9j4dEtHzYhPH5WU0n+17Pblnul2IOmvepByKQG2LbQr0IkArEVhoeHjtgezK86wtP4PBa4LWzq6diMDcXl/JIHQ7HxUPBeJqRroIIGOXffYZLC8Dfm+74YL0bqSs7c5kw0TvTUw+aMmbssjKDO93AvDhb/tKLvBdo7mJ9F9iJKGElfiwo/pUdsbjz3SL9dD6ERYp7czECuRfL6D8anhpc0kpKyPMBDGNstihd9sn190d2hTRVcjgyTkYgPTdMDD/sDwt2kQp4C2zfXM9CKGMnCjWA8VMYl+3sKSmEfmYnEKBaBXGEOueliFeb8L8= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 01:57:53.1449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1c9bfbb-49a5-49c7-f8ac-08d7eca9e512 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3527 Subject: Re: [dpdk-dev] [PATCH] test/ring: code rework to reduce compilation time X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Konstantin, I like the way the tests are organized and it looks good. I am just wondering about the way it is being tested here. The intent to wr= ite the test cases the way they are currently is to mimic how the APIs woul= d be used mostly. IMO, the APIs would be used with a constant value for ele= ment size so that the compiler will throw away the unwanted code (in the fu= nctions where the actual copy is being done). With your method here, it looks to me like all the branches in the copy fun= ctions are kept and the branch decisions are done at run time. Is my unders= tanding correct? Can you please check this? https://patches.dpdk.org/patch/69567/ Thanks, Honnappa > -----Original Message----- > From: Konstantin Ananyev > Sent: Wednesday, April 29, 2020 12:57 PM > To: dev@dpdk.org > Cc: aconole@redhat.com; Honnappa Nagarahalli > ; Konstantin Ananyev > > Subject: [PATCH] test/ring: code rework to reduce compilation time >=20 > Rework test code to reduce code complexity for the compiler and bring dow= n > compilation time and memory consumption. >=20 > Signed-off-by: Konstantin Ananyev > --- > app/test/test_ring.c | 373 +++++++++++++++++++++++++++++-------------- > 1 file changed, 249 insertions(+), 124 deletions(-) >=20 > diff --git a/app/test/test_ring.c b/app/test/test_ring.c index > e21557cd9..0ae97d341 100644 > --- a/app/test/test_ring.c > +++ b/app/test/test_ring.c > @@ -58,6 +58,181 @@ >=20 > static const int esize[] =3D {-1, 4, 8, 16, 20}; >=20 > +static const struct { > + const char *desc; > + uint32_t api_type; > + uint32_t create_flags; > + struct { > + unsigned int (*flegacy)(struct rte_ring *r, > + void * const *obj_table, unsigned int n, > + unsigned int *free_space); > + unsigned int (*felem)(struct rte_ring *r, const void *obj_table, > + unsigned int esize, unsigned int n, > + unsigned int *free_space); > + } enq; > + struct { > + unsigned int (*flegacy)(struct rte_ring *r, > + void **obj_table, unsigned int n, > + unsigned int *available); > + unsigned int (*felem)(struct rte_ring *r, void *obj_table, > + unsigned int esize, unsigned int n, > + unsigned int *available); > + } deq; > +} test_enqdeq_impl[] =3D { > + { > + .desc =3D "MP/MC sync mode", Details about the tests are already printed by the function 'test_ring_prin= t_test_string'. This string should be 'Test standard ring'. > + .api_type =3D TEST_RING_ELEM_BULK | > TEST_RING_THREAD_DEF, > + .create_flags =3D 0, > + .enq =3D { > + .flegacy =3D rte_ring_enqueue_bulk, > + .felem =3D rte_ring_enqueue_bulk_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_dequeue_bulk, > + .felem =3D rte_ring_dequeue_bulk_elem, > + }, > + }, > + { > + .desc =3D "SP/SC sync mode", > + .api_type =3D TEST_RING_ELEM_BULK | > TEST_RING_THREAD_SPSC, > + .create_flags =3D RING_F_SP_ENQ | RING_F_SC_DEQ, > + .enq =3D { > + .flegacy =3D rte_ring_sp_enqueue_bulk, > + .felem =3D rte_ring_sp_enqueue_bulk_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_sc_dequeue_bulk, > + .felem =3D rte_ring_sc_dequeue_bulk_elem, > + }, > + }, > + { > + .desc =3D "MP/MC sync mode", > + .api_type =3D TEST_RING_ELEM_BULK | > TEST_RING_THREAD_MPMC, > + .create_flags =3D 0, > + .enq =3D { > + .flegacy =3D rte_ring_mp_enqueue_bulk, > + .felem =3D rte_ring_mp_enqueue_bulk_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_mc_dequeue_bulk, > + .felem =3D rte_ring_mc_dequeue_bulk_elem, > + }, > + }, > + { > + .desc =3D "MP_RTS/MC_RTS sync mode", > + .api_type =3D TEST_RING_ELEM_BULK | > TEST_RING_THREAD_DEF, > + .create_flags =3D RING_F_MP_RTS_ENQ | > RING_F_MC_RTS_DEQ, > + .enq =3D { > + .flegacy =3D rte_ring_enqueue_bulk, > + .felem =3D rte_ring_enqueue_bulk_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_dequeue_bulk, > + .felem =3D rte_ring_dequeue_bulk_elem, > + }, > + }, > + { > + .desc =3D "MP_HTS/MC_HTS sync mode", > + .api_type =3D TEST_RING_ELEM_BULK | > TEST_RING_THREAD_DEF, > + .create_flags =3D RING_F_MP_HTS_ENQ | > RING_F_MC_HTS_DEQ, > + .enq =3D { > + .flegacy =3D rte_ring_enqueue_bulk, > + .felem =3D rte_ring_enqueue_bulk_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_dequeue_bulk, > + .felem =3D rte_ring_dequeue_bulk_elem, > + }, > + }, > + { > + .desc =3D "MP/MC sync mode", > + .api_type =3D TEST_RING_ELEM_BURST | > TEST_RING_THREAD_DEF, > + .create_flags =3D 0, > + .enq =3D { > + .flegacy =3D rte_ring_enqueue_burst, > + .felem =3D rte_ring_enqueue_burst_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_dequeue_burst, > + .felem =3D rte_ring_dequeue_burst_elem, > + }, > + }, > + { > + .desc =3D "SP/SC sync mode", > + .api_type =3D TEST_RING_ELEM_BURST | > TEST_RING_THREAD_SPSC, > + .create_flags =3D RING_F_SP_ENQ | RING_F_SC_DEQ, > + .enq =3D { > + .flegacy =3D rte_ring_sp_enqueue_burst, > + .felem =3D rte_ring_sp_enqueue_burst_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_sc_dequeue_burst, > + .felem =3D rte_ring_sc_dequeue_burst_elem, > + }, > + }, > + { > + .desc =3D "MP/MC sync mode", > + .api_type =3D TEST_RING_ELEM_BURST | > TEST_RING_THREAD_MPMC, > + .create_flags =3D 0, > + .enq =3D { > + .flegacy =3D rte_ring_mp_enqueue_burst, > + .felem =3D rte_ring_mp_enqueue_burst_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_mc_dequeue_burst, > + .felem =3D rte_ring_mc_dequeue_burst_elem, > + }, > + }, > + { > + .desc =3D "MP_RTS/MC_RTS sync mode", > + .api_type =3D TEST_RING_ELEM_BURST | > TEST_RING_THREAD_DEF, > + .create_flags =3D RING_F_MP_RTS_ENQ | > RING_F_MC_RTS_DEQ, > + .enq =3D { > + .flegacy =3D rte_ring_enqueue_burst, > + .felem =3D rte_ring_enqueue_burst_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_dequeue_burst, > + .felem =3D rte_ring_dequeue_burst_elem, > + }, > + }, > + { > + .desc =3D "MP_HTS/MC_HTS sync mode", > + .api_type =3D TEST_RING_ELEM_BURST | > TEST_RING_THREAD_DEF, > + .create_flags =3D RING_F_MP_HTS_ENQ | > RING_F_MC_HTS_DEQ, > + .enq =3D { > + .flegacy =3D rte_ring_enqueue_burst, > + .felem =3D rte_ring_enqueue_burst_elem, > + }, > + .deq =3D { > + .flegacy =3D rte_ring_dequeue_burst, > + .felem =3D rte_ring_dequeue_burst_elem, > + }, > + }, > +}; > + > +static unsigned int > +test_ring_enq_impl(struct rte_ring *r, void **obj, int esize, unsigned i= nt n, > + unsigned int test_idx) > +{ > + if (esize =3D=3D -1) > + return test_enqdeq_impl[test_idx].enq.flegacy(r, obj, n, NULL); > + else > + return test_enqdeq_impl[test_idx].enq.felem(r, obj, esize, n, > + NULL); > +} > + > +static unsigned int > +test_ring_deq_impl(struct rte_ring *r, void **obj, int esize, unsigned i= nt n, > + unsigned int test_idx) > +{ > + if (esize =3D=3D -1) > + return test_enqdeq_impl[test_idx].deq.flegacy(r, obj, n, NULL); > + else > + return test_enqdeq_impl[test_idx].deq.felem(r, obj, esize, n, > + NULL); > +} > + > static void** > test_ring_inc_ptr(void **obj, int esize, unsigned int n) { @@ -203,8 +3= 78,7 > @@ test_ring_negative_tests(void) > * Random number of elements are enqueued and dequeued. > */ > static int > -test_ring_burst_bulk_tests1(unsigned int api_type, unsigned int create_f= lags, > - const char *tname) > +test_ring_burst_bulk_tests1(unsigned int test_idx) > { > struct rte_ring *r; > void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; > @@ -214,11 +388,13 @@ test_ring_burst_bulk_tests1(unsigned int api_type, > unsigned int create_flags, > const unsigned int rsz =3D RING_SIZE - 1; >=20 > for (i =3D 0; i < RTE_DIM(esize); i++) { > - test_ring_print_test_string(tname, api_type, esize[i]); > + test_ring_print_test_string(test_enqdeq_impl[test_idx].desc, > + test_enqdeq_impl[test_idx].api_type, esize[i]); >=20 > /* Create the ring */ > r =3D test_ring_create("test_ring_burst_bulk_tests", esize[i], > - RING_SIZE, SOCKET_ID_ANY, > create_flags); > + RING_SIZE, SOCKET_ID_ANY, > + test_enqdeq_impl[test_idx].create_flags); >=20 > /* alloc dummy object pointers */ > src =3D test_ring_calloc(RING_SIZE * 2, esize[i]); @@ -240,17 > +416,17 @@ test_ring_burst_bulk_tests1(unsigned int api_type, unsigned in= t > create_flags, > rand =3D RTE_MAX(rte_rand() % RING_SIZE, 1UL); > printf("%s: iteration %u, random shift: %u;\n", > __func__, i, rand); > - ret =3D test_ring_enqueue(r, cur_src, esize[i], rand, > - api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], rand, > + test_idx); > TEST_RING_VERIFY(ret !=3D 0); >=20 > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], rand, > - api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], rand, > + test_idx); > TEST_RING_VERIFY(ret =3D=3D rand); >=20 > /* fill the ring */ > - ret =3D test_ring_enqueue(r, cur_src, esize[i], rsz, > - api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], rsz, > + test_idx); > TEST_RING_VERIFY(ret !=3D 0); >=20 > TEST_RING_VERIFY(rte_ring_free_count(r) =3D=3D 0); @@ > -259,8 +435,8 @@ test_ring_burst_bulk_tests1(unsigned int api_type, > unsigned int create_flags, > TEST_RING_VERIFY(rte_ring_empty(r) =3D=3D 0); >=20 > /* empty the ring */ > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], rsz, > - api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], rsz, > + test_idx); > TEST_RING_VERIFY(ret =3D=3D (int)rsz); > TEST_RING_VERIFY(rsz =3D=3D rte_ring_free_count(r)); > TEST_RING_VERIFY(rte_ring_count(r) =3D=3D 0); @@ - > 294,8 +470,7 @@ test_ring_burst_bulk_tests1(unsigned int api_type, > unsigned int create_flags, > * dequeued data. > */ > static int > -test_ring_burst_bulk_tests2(unsigned int api_type, unsigned int create_f= lags, > - const char *tname) > +test_ring_burst_bulk_tests2(unsigned int test_idx) > { > struct rte_ring *r; > void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; > @@ -303,11 +478,13 @@ test_ring_burst_bulk_tests2(unsigned int api_type, > unsigned int create_flags, > unsigned int i; >=20 > for (i =3D 0; i < RTE_DIM(esize); i++) { > - test_ring_print_test_string(tname, api_type, esize[i]); > + test_ring_print_test_string(test_enqdeq_impl[test_idx].desc, > + test_enqdeq_impl[test_idx].api_type, esize[i]); >=20 > /* Create the ring */ > r =3D test_ring_create("test_ring_burst_bulk_tests", esize[i], > - RING_SIZE, SOCKET_ID_ANY, > create_flags); > + RING_SIZE, SOCKET_ID_ANY, > + test_enqdeq_impl[test_idx].create_flags); >=20 > /* alloc dummy object pointers */ > src =3D test_ring_calloc(RING_SIZE * 2, esize[i]); @@ -323,39 > +500,39 @@ test_ring_burst_bulk_tests2(unsigned int api_type, unsigned in= t > create_flags, > cur_dst =3D dst; >=20 > printf("enqueue 1 obj\n"); > - ret =3D test_ring_enqueue(r, cur_src, esize[i], 1, api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], 1, test_idx); > if (ret !=3D 1) > goto fail; > cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 1); >=20 > printf("enqueue 2 objs\n"); > - ret =3D test_ring_enqueue(r, cur_src, esize[i], 2, api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], 2, test_idx); > if (ret !=3D 2) > goto fail; > cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 2); >=20 > printf("enqueue MAX_BULK objs\n"); > - ret =3D test_ring_enqueue(r, cur_src, esize[i], MAX_BULK, > - api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], MAX_BULK, > + test_idx); > if (ret !=3D MAX_BULK) > goto fail; > cur_src =3D test_ring_inc_ptr(cur_src, esize[i], MAX_BULK); >=20 > printf("dequeue 1 obj\n"); > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], 1, api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], 1, test_idx); > if (ret !=3D 1) > goto fail; > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 1); >=20 > printf("dequeue 2 objs\n"); > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], 2, api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], 2, test_idx); > if (ret !=3D 2) > goto fail; > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 2); >=20 > printf("dequeue MAX_BULK objs\n"); > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], MAX_BULK, > - api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], MAX_BULK, > + test_idx); > if (ret !=3D MAX_BULK) > goto fail; > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK); @@ > -390,8 +567,7 @@ test_ring_burst_bulk_tests2(unsigned int api_type, > unsigned int create_flags, > * Enqueue and dequeue to cover the entire ring length. > */ > static int > -test_ring_burst_bulk_tests3(unsigned int api_type, unsigned int create_f= lags, > - const char *tname) > +test_ring_burst_bulk_tests3(unsigned int test_idx) > { > struct rte_ring *r; > void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; > @@ -399,11 +575,13 @@ test_ring_burst_bulk_tests3(unsigned int api_type, > unsigned int create_flags, > unsigned int i, j; >=20 > for (i =3D 0; i < RTE_DIM(esize); i++) { > - test_ring_print_test_string(tname, api_type, esize[i]); > + test_ring_print_test_string(test_enqdeq_impl[test_idx].desc, > + test_enqdeq_impl[test_idx].api_type, esize[i]); >=20 > /* Create the ring */ > r =3D test_ring_create("test_ring_burst_bulk_tests", esize[i], > - RING_SIZE, SOCKET_ID_ANY, > create_flags); > + RING_SIZE, SOCKET_ID_ANY, > + test_enqdeq_impl[test_idx].create_flags); >=20 > /* alloc dummy object pointers */ > src =3D test_ring_calloc(RING_SIZE * 2, esize[i]); @@ -420,15 > +598,15 @@ test_ring_burst_bulk_tests3(unsigned int api_type, unsigned in= t > create_flags, >=20 > printf("fill and empty the ring\n"); > for (j =3D 0; j < RING_SIZE / MAX_BULK; j++) { > - ret =3D test_ring_enqueue(r, cur_src, esize[i], > MAX_BULK, > - api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], > MAX_BULK, > + test_idx); > if (ret !=3D MAX_BULK) > goto fail; > cur_src =3D test_ring_inc_ptr(cur_src, esize[i], > MAX_BULK); >=20 > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], > MAX_BULK, > - api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], > MAX_BULK, > + test_idx); > if (ret !=3D MAX_BULK) > goto fail; > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], @@ - > 465,21 +643,24 @@ test_ring_burst_bulk_tests3(unsigned int api_type, > unsigned int create_flags, > * Enqueue till the ring is full and dequeue till the ring becomes empty= . > */ > static int > -test_ring_burst_bulk_tests4(unsigned int api_type, unsigned int create_f= lags, > - const char *tname) > +test_ring_burst_bulk_tests4(unsigned int test_idx) > { > struct rte_ring *r; > void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; > int ret; > unsigned int i, j; > - unsigned int num_elems; > + unsigned int api_type, num_elems; > + > + api_type =3D test_enqdeq_impl[test_idx].api_type; >=20 > for (i =3D 0; i < RTE_DIM(esize); i++) { > - test_ring_print_test_string(tname, api_type, esize[i]); > + test_ring_print_test_string(test_enqdeq_impl[test_idx].desc, > + test_enqdeq_impl[test_idx].api_type, esize[i]); >=20 > /* Create the ring */ > r =3D test_ring_create("test_ring_burst_bulk_tests", esize[i], > - RING_SIZE, SOCKET_ID_ANY, > create_flags); > + RING_SIZE, SOCKET_ID_ANY, > + test_enqdeq_impl[test_idx].create_flags); >=20 > /* alloc dummy object pointers */ > src =3D test_ring_calloc(RING_SIZE * 2, esize[i]); @@ -496,8 > +677,8 @@ test_ring_burst_bulk_tests4(unsigned int api_type, unsigned int > create_flags, >=20 > printf("Test enqueue without enough memory space\n"); > for (j =3D 0; j < (RING_SIZE/MAX_BULK - 1); j++) { > - ret =3D test_ring_enqueue(r, cur_src, esize[i], > MAX_BULK, > - api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], > MAX_BULK, > + test_idx); > if (ret !=3D MAX_BULK) > goto fail; > cur_src =3D test_ring_inc_ptr(cur_src, esize[i], @@ - > 505,7 +686,7 @@ test_ring_burst_bulk_tests4(unsigned int api_type, > unsigned int create_flags, > } >=20 > printf("Enqueue 2 objects, free entries =3D MAX_BULK - 2\n"); > - ret =3D test_ring_enqueue(r, cur_src, esize[i], 2, api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], 2, test_idx); > if (ret !=3D 2) > goto fail; > cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 2); @@ -517,8 > +698,8 @@ test_ring_burst_bulk_tests4(unsigned int api_type, unsigned int > create_flags, > else > num_elems =3D MAX_BULK; > /* Always one free entry left */ > - ret =3D test_ring_enqueue(r, cur_src, esize[i], num_elems, > - api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], num_elems, > + test_idx); > if (ret !=3D MAX_BULK - 3) > goto fail; > cur_src =3D test_ring_inc_ptr(cur_src, esize[i], MAX_BULK - 3); > @@ -528,15 +709,15 @@ test_ring_burst_bulk_tests4(unsigned int api_type, > unsigned int create_flags, > goto fail; >=20 > printf("Test enqueue for a full entry\n"); > - ret =3D test_ring_enqueue(r, cur_src, esize[i], MAX_BULK, > - api_type); > + ret =3D test_ring_enq_impl(r, cur_src, esize[i], MAX_BULK, > + test_idx); > if (ret !=3D 0) > goto fail; >=20 > printf("Test dequeue without enough objects\n"); > for (j =3D 0; j < RING_SIZE / MAX_BULK - 1; j++) { > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], > MAX_BULK, > - api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], > MAX_BULK, > + test_idx); > if (ret !=3D MAX_BULK) > goto fail; > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], @@ - > 544,7 +725,7 @@ test_ring_burst_bulk_tests4(unsigned int api_type, > unsigned int create_flags, > } >=20 > /* Available memory space for the exact MAX_BULK entries > */ > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], 2, api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], 2, test_idx); > if (ret !=3D 2) > goto fail; > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 2); @@ -554,8 > +735,8 @@ test_ring_burst_bulk_tests4(unsigned int api_type, unsigned int > create_flags, > num_elems =3D MAX_BULK - 3; > else > num_elems =3D MAX_BULK; > - ret =3D test_ring_dequeue(r, cur_dst, esize[i], num_elems, > - api_type); > + ret =3D test_ring_deq_impl(r, cur_dst, esize[i], num_elems, > + test_idx); > if (ret !=3D MAX_BULK - 3) > goto fail; > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK - 3); > @@ -816,22 +997,7 @@ static int > test_ring(void) > { > int32_t rc; > - unsigned int i, j; > - const char *tname; > - > - static const struct { > - uint32_t create_flags; > - const char *name; > - } test_sync_modes[] =3D { > - { > - RING_F_MP_RTS_ENQ | RING_F_MC_RTS_DEQ, > - "Test MT_RTS ring", > - }, > - { > - RING_F_MP_HTS_ENQ | RING_F_MC_HTS_DEQ, > - "Test MT_HTS ring", > - }, > - }; > + unsigned int i; >=20 > /* Negative test cases */ > if (test_ring_negative_tests() < 0) > @@ -848,65 +1014,24 @@ test_ring(void) > * The test cases are split into smaller test cases to > * help clang compile faster. > */ > - tname =3D "Test standard ring"; > - > - for (j =3D TEST_RING_ELEM_BULK; j <=3D TEST_RING_ELEM_BURST; j <<=3D 1) > - for (i =3D TEST_RING_THREAD_DEF; > - i <=3D TEST_RING_THREAD_MPMC; i > <<=3D 1) > - if (test_ring_burst_bulk_tests1(i | j, 0, tname) < 0) > - goto test_fail; > - > - for (j =3D TEST_RING_ELEM_BULK; j <=3D TEST_RING_ELEM_BURST; j <<=3D 1) > - for (i =3D TEST_RING_THREAD_DEF; > - i <=3D TEST_RING_THREAD_MPMC; i > <<=3D 1) > - if (test_ring_burst_bulk_tests2(i | j, 0, tname) < 0) > - goto test_fail; > - > - for (j =3D TEST_RING_ELEM_BULK; j <=3D TEST_RING_ELEM_BURST; j <<=3D 1) > - for (i =3D TEST_RING_THREAD_DEF; > - i <=3D TEST_RING_THREAD_MPMC; i > <<=3D 1) > - if (test_ring_burst_bulk_tests3(i | j, 0, tname) < 0) > - goto test_fail; > - > - for (j =3D TEST_RING_ELEM_BULK; j <=3D TEST_RING_ELEM_BURST; j <<=3D 1) > - for (i =3D TEST_RING_THREAD_DEF; > - i <=3D TEST_RING_THREAD_MPMC; i > <<=3D 1) > - if (test_ring_burst_bulk_tests4(i | j, 0, tname) < 0) > - goto test_fail; > - > - /* Burst and bulk operations with MT_RTS and MT_HTS sync modes > */ > - for (i =3D 0; i !=3D RTE_DIM(test_sync_modes); i++) { > - for (j =3D TEST_RING_ELEM_BULK; j <=3D TEST_RING_ELEM_BURST; > - j <<=3D 1) { > - > - rc =3D test_ring_burst_bulk_tests1( > - TEST_RING_THREAD_DEF | j, > - test_sync_modes[i].create_flags, > - test_sync_modes[i].name); > - if (rc < 0) > - goto test_fail; > - > - rc =3D test_ring_burst_bulk_tests2( > - TEST_RING_THREAD_DEF | j, > - test_sync_modes[i].create_flags, > - test_sync_modes[i].name); > - if (rc < 0) > - goto test_fail; > - > - rc =3D test_ring_burst_bulk_tests3( > - TEST_RING_THREAD_DEF | j, > - test_sync_modes[i].create_flags, > - test_sync_modes[i].name); > - if (rc < 0) > - goto test_fail; > - > - rc =3D test_ring_burst_bulk_tests3( > - TEST_RING_THREAD_DEF | j, > - test_sync_modes[i].create_flags, > - test_sync_modes[i].name); > - if (rc < 0) > - goto test_fail; > - } > + for (i =3D 0; i !=3D RTE_DIM(test_enqdeq_impl); i++) { > + > + > + rc =3D test_ring_burst_bulk_tests1(i); > + if (rc < 0) > + goto test_fail; > + > + rc =3D test_ring_burst_bulk_tests2(i); > + if (rc < 0) > + goto test_fail; > + > + rc =3D test_ring_burst_bulk_tests3(i); > + if (rc < 0) > + goto test_fail; > + > + rc =3D test_ring_burst_bulk_tests4(i); > + if (rc < 0) > + goto test_fail; > } >=20 > /* dump the ring status */ > -- > 2.17.1