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 B0F5EA04F6; Tue, 7 Jan 2020 06:13:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EAA621D902; Tue, 7 Jan 2020 06:13:51 +0100 (CET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70071.outbound.protection.outlook.com [40.107.7.71]) by dpdk.org (Postfix) with ESMTP id 265601D8FD for ; Tue, 7 Jan 2020 06:13:51 +0100 (CET) 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=WdqRckcnUc+p4UIDgUabR5G3OYiLpUL/LTZbdU8xbZU=; b=nTzA8AM7vb9HtO0cR37pvWdW2cjEs/7EeAiiHDwPmBmk5F5PXYdmyY19MaiOmlPiqrL8MT0wE2g26JABk6VDbf6VSnBUE0JPYxOJnD/gQw+AijveYrWT+0cgYjEQK7TgwPt+8yCgimDsw/6RMnRyaSVLH32E/CYvGwQWuKeKd90= Received: from VI1PR08CA0120.eurprd08.prod.outlook.com (2603:10a6:800:d4::22) by AM5PR0801MB2050.eurprd08.prod.outlook.com (2603:10a6:203:49::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 05:13:49 +0000 Received: from VE1EUR03FT059.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::207) by VI1PR08CA0120.outlook.office365.com (2603:10a6:800:d4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Tue, 7 Jan 2020 05:13:49 +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 VE1EUR03FT059.mail.protection.outlook.com (10.152.19.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Tue, 7 Jan 2020 05:13:49 +0000 Received: ("Tessian outbound e09e55c05044:v40"); Tue, 07 Jan 2020 05:13:48 +0000 X-CR-MTA-TID: 64aa7808 Received: from 78584aca7967.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3E96892E-7196-4178-AAAB-253B3060D504.1; Tue, 07 Jan 2020 05:13:43 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 78584aca7967.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Jan 2020 05:13:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NlPTo0dlKeRNFh2TS+O1/Z2hejZN8jEJLJks1Q6BI8kKObxMGgctalRRu260NzPxIOeosj8EEl06cfYY94jzhDunGUknT5hyLAwQ1Rd6I1mDxRPiV/SrTdO5NUl2tO5u783DEFamdNCyEfXvZXIEe7cWChdamUZ5R0SZwvlmxP6UyUg4fsr5N9DPpBZ8bEqEXoOY1FDFaGodTZdTzjhqw4GDnmVN3h2aBDygNu2lW+pPAWYHh5ZXE4B6sTTCggFyvpTbhG1hcWnrJD5lAdZkawrZ+mvn4JBzpFhtKYYNz50tleMz/WPSF5XPZQ/y3JD4FigLTf4FY9jc5fOwmhzDUA== 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=WdqRckcnUc+p4UIDgUabR5G3OYiLpUL/LTZbdU8xbZU=; b=agHiyjVBLuCRaNq2VPvm7r7vBffnZ0obpPSAm06JrUJ8IMycVHrehH9NUFmlgIGBC/qqY3jASX64XVN7DbqsP5EGrEqsoogM6pmU7232b02kaIFJqEXgNuWl+7g3KroHJhoYFicx78D/5G2hePUCuyDuxjRIRA/BnFSCkB3oZcDXASyoiiuvUsX8qKb2xKyD/i8KELL8QeGVhczUqPcTc6ZuvnDbCrifPatxiN5iMG8ilAkCosYxtO1McBeW2TjNrrfMD2ixKorEAUCP8hBpXhPbcjPiQYZsQnbAFIy6U1CXzNkXDcny5RVqRFaonquvFqv8LPVnoqWRbnovr1ywMA== 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=WdqRckcnUc+p4UIDgUabR5G3OYiLpUL/LTZbdU8xbZU=; b=nTzA8AM7vb9HtO0cR37pvWdW2cjEs/7EeAiiHDwPmBmk5F5PXYdmyY19MaiOmlPiqrL8MT0wE2g26JABk6VDbf6VSnBUE0JPYxOJnD/gQw+AijveYrWT+0cgYjEQK7TgwPt+8yCgimDsw/6RMnRyaSVLH32E/CYvGwQWuKeKd90= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.27) by VE1PR08MB5167.eurprd08.prod.outlook.com (20.179.31.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10; Tue, 7 Jan 2020 05:13:40 +0000 Received: from VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::29eb:a1be:8f8f:fae2]) by VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::29eb:a1be:8f8f:fae2%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 05:13:40 +0000 From: Honnappa Nagarahalli To: "Ananyev, Konstantin" , "olivier.matz@6wind.com" , "sthemmin@microsoft.com" , "jerinj@marvell.com" , "Richardson, Bruce" , "david.marchand@redhat.com" , "pbhagavatula@marvell.com" CC: "dev@dpdk.org" , Dharmik Thakkar , Ruifeng Wang , Gavin Hu , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v7 03/17] test/ring: add functional tests for rte_ring_xxx_elem APIs Thread-Index: AQHVwYoqZLYWmc7nL0KbrgJWkkgeh6fepxjw Date: Tue, 7 Jan 2020 05:13:39 +0000 Message-ID: References: <20190906190510.11146-1-honnappa.nagarahalli@arm.com> <20191220044524.32910-1-honnappa.nagarahalli@arm.com> <20191220044524.32910-4-honnappa.nagarahalli@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 903e8dae-e11b-44b7-9017-e4dec4d328cf.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@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: e9514b7a-2515-4fa3-93d6-08d79330611f X-MS-TrafficTypeDiagnostic: VE1PR08MB5167:|VE1PR08MB5167:|AM5PR0801MB2050: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; x-forefront-prvs: 027578BB13 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(376002)(366004)(136003)(39860400002)(346002)(396003)(189003)(199004)(51234002)(81156014)(81166006)(5660300002)(8936002)(2906002)(86362001)(316002)(7696005)(52536014)(55016002)(9686003)(66946007)(6506007)(76116006)(478600001)(64756008)(66446008)(66476007)(8676002)(33656002)(30864003)(186003)(54906003)(71200400001)(110136005)(4326008)(26005)(66556008)(21314003)(559001)(579004); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5167; H:VE1PR08MB5149.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: xepI+8mrvu5dUy0thBGo3dJoVTFp4d8qLR99CmCrN+FjNguxNMU5aBUTIXgcmPbi0DgaXcC65Rq2bcucGW1xro4luoQML8MJA39VyiXrIo+6yZva7XihXM1e3q33Oj7JXMAr3SFxWZCmdJbSR1by7Fubh5+3xroOKch+0F0/YAdNY3ao1rb27I3/BtNpref7x0mEIcJ2v/YPIVA81NWwKzGkVqa8nhi62gy+/GVdbDdIoX2D35qOybJYCp4SvICwoX88Z0f7hPVKgwh1ms69hovvVcATxeNCRfDt5pDjfKSkSjD+14Jj1lvi7pZektDWWyTa0ISfX/8LxDLiqX3oEekw/1b6kvPIYKbhXoCyPSeRRVTx0ayV5ZTdhMxhICpr19xAm9g07WdHIrkr98exxMaBVOvV7ZcF+NnKJJDKIBYNfPZslEFWJ0G2c7N69VlCadxrA/xSbn4B/WS01fueEUG44ilnD+v34BLFEVJVBvZd20aBK8s1By72KuNyXNaHWFwwrn0ybbgTzLbbFMNcOA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5167 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT059.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(396003)(346002)(376002)(199004)(189003)(51234002)(5660300002)(316002)(70206006)(9686003)(356004)(55016002)(30864003)(4326008)(54906003)(2906002)(110136005)(6506007)(36906005)(26826003)(478600001)(52536014)(186003)(7696005)(8676002)(33656002)(336012)(70586007)(81166006)(26005)(8936002)(81156014)(86362001)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0801MB2050; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: dd48bf5e-3bc6-4fd7-899c-08d793305b96 NoDisclaimer: True X-Forefront-PRVS: 027578BB13 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8IzWkQstnupKlcf1q1LD/TuJxaBdc97W9Cq/3s7pTolXxf3/WJsTW/1GXJtRpvkR1BZ/tzmDwLuPof+w9E5Gs2CnFdrGh174QDajQX56xQEqRfOcZVPALv5Zx6U5z45KKzlu+DOx72cjkyoziWuRjNwgQGsrnWkufcNoJMVDTA81tVo9fuQb3lxdzJGD+8/zz8MCf8BaZfhfXUsOtYd3TXRxOKOWhHTfonGT1Pqwtou6Oos+r/9ixfGyJCqWACDJc3AMLkbkyJa8QYg0H1tq1587CzZ/wyYYqXNnSVuy4CyHRm/UzGYd5V0In6UNN3pNYBCBdNS6xMR1aIVZRcKE4HwjmcJsktlonwzOxi3Osk4LjxXw3s9KklCXrnvXcjK7GA/JEdVDGc95YauvkL6BnNycAtnbrdLEbhDFpmLmPxdF0lfphsYmfGt4Oii02u9PsfMlnlbcTbI8gyQCA2ztHtzSGIdhsZ08VInelKLDNIF5PlmyUwIaHXv3ovb4NNHSu7wc3bYkLKqpRnEtobUueg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2020 05:13:49.1956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9514b7a-2515-4fa3-93d6-08d79330611f 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: AM5PR0801MB2050 Subject: Re: [dpdk-dev] [PATCH v7 03/17] test/ring: add functional tests for rte_ring_xxx_elem APIs 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 Honnappa, Thanks Konstantin for your feedback. >=20 > > Add basic infrastructure to test rte_ring_xxx_elem APIs. Add test > > cases for testing burst and bulk tests. > > > > Signed-off-by: Honnappa Nagarahalli > > Reviewed-by: Gavin Hu > > --- > > app/test/test_ring.c | 466 > > ++++++++++++++++++++----------------------- > > app/test/test_ring.h | 203 +++++++++++++++++++ > > 2 files changed, 419 insertions(+), 250 deletions(-) create mode > > 100644 app/test/test_ring.h > > > > diff --git a/app/test/test_ring.c b/app/test/test_ring.c index > > aaf1e70ad..e7a8b468b 100644 > > --- a/app/test/test_ring.c > > +++ b/app/test/test_ring.c > > @@ -23,11 +23,13 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > > > #include "test.h" > > +#include "test_ring.h" > > > > /* > > * Ring > > @@ -67,6 +69,50 @@ static rte_atomic32_t synchro; > > > > #define TEST_RING_FULL_EMTPY_ITER 8 > > > > +static int esize[] =3D {-1, 4, 8, 16}; > > + > > +static void > > +test_ring_mem_init(void *obj, unsigned int count, int esize) { > > + unsigned int i; > > + > > + /* Legacy queue APIs? */ > > + if (esize =3D=3D -1) > > + for (i =3D 0; i < count; i++) > > + ((void **)obj)[i] =3D (void *)(unsigned long)i; > > + else > > + for (i =3D 0; i < (count * esize / sizeof(uint32_t)); i++) > > + ((uint32_t *)obj)[i] =3D i; > > +} > > + > > +static void > > +test_ring_print_test_string(const char *istr, unsigned int api_type, > > +int esize) { > > + printf("\n%s: ", istr); > > + > > + if (esize =3D=3D -1) > > + printf("legacy APIs: "); > > + else > > + printf("elem APIs: element size %dB ", esize); > > + > > + if (api_type =3D=3D TEST_RING_IGNORE_API_TYPE) > > + return; > > + > > + if ((api_type & TEST_RING_N) =3D=3D TEST_RING_N) > > + printf(": default enqueue/dequeue: "); > > + else if ((api_type & TEST_RING_S) =3D=3D TEST_RING_S) > > + printf(": SP/SC: "); > > + else if ((api_type & TEST_RING_M) =3D=3D TEST_RING_M) > > + printf(": MP/MC: "); > > + > > + if ((api_type & TEST_RING_SL) =3D=3D TEST_RING_SL) > > + printf("single\n"); > > + else if ((api_type & TEST_RING_BL) =3D=3D TEST_RING_BL) > > + printf("bulk\n"); > > + else if ((api_type & TEST_RING_BR) =3D=3D TEST_RING_BR) > > + printf("burst\n"); > > +} > > + > > /* > > * helper routine for test_ring_basic > > */ > > @@ -314,286 +360,203 @@ test_ring_basic(struct rte_ring *r) > > return -1; > > } > > > > +/* > > + * Burst and bulk operations with sp/sc, mp/mc and default (during > > +creation) */ > > static int > > -test_ring_burst_basic(struct rte_ring *r) > > +test_ring_burst_bulk_tests(unsigned int api_type) > > { > > + struct rte_ring *r; > > void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst = =3D NULL; > > int ret; > > - unsigned i; > > + unsigned int i, j; > > + unsigned int num_elems; > > > > - /* alloc dummy object pointers */ > > - src =3D malloc(RING_SIZE*2*sizeof(void *)); > > - if (src =3D=3D NULL) > > - goto fail; > > - > > - for (i =3D 0; i < RING_SIZE*2 ; i++) { > > - src[i] =3D (void *)(unsigned long)i; > > - } > > - cur_src =3D src; > > + for (i =3D 0; i < RTE_DIM(esize); i++) { > > + test_ring_print_test_string("Test standard ring", api_type, > > + esize[i]); > > > > - /* alloc some room for copied objects */ > > - dst =3D malloc(RING_SIZE*2*sizeof(void *)); > > - if (dst =3D=3D NULL) > > - goto fail; > > + /* Create the ring */ > > + TEST_RING_CREATE("test_ring_burst_bulk_tests", esize[i], > > + RING_SIZE, SOCKET_ID_ANY, 0, r); > > > > - memset(dst, 0, RING_SIZE*2*sizeof(void *)); > > - cur_dst =3D dst; > > - > > - printf("Test SP & SC basic functions \n"); > > - printf("enqueue 1 obj\n"); > > - ret =3D rte_ring_sp_enqueue_burst(r, cur_src, 1, NULL); > > - cur_src +=3D 1; > > - if (ret !=3D 1) > > - goto fail; > > - > > - printf("enqueue 2 objs\n"); > > - ret =3D rte_ring_sp_enqueue_burst(r, cur_src, 2, NULL); > > - cur_src +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > - > > - printf("enqueue MAX_BULK objs\n"); > > - ret =3D rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); > > - cur_src +=3D MAX_BULK; > > - if (ret !=3D MAX_BULK) > > - goto fail; > > - > > - printf("dequeue 1 obj\n"); > > - ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, 1, NULL); > > - cur_dst +=3D 1; > > - if (ret !=3D 1) > > - goto fail; > > - > > - printf("dequeue 2 objs\n"); > > - ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, 2, NULL); > > - cur_dst +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > + /* alloc dummy object pointers */ > > + src =3D test_ring_calloc(RING_SIZE * 2, esize[i]); > > + if (src =3D=3D NULL) > > + goto fail; > > + test_ring_mem_init(src, RING_SIZE * 2, esize[i]); > > + cur_src =3D src; > > > > - printf("dequeue MAX_BULK objs\n"); > > - ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); > > - cur_dst +=3D MAX_BULK; > > - if (ret !=3D MAX_BULK) > > - goto fail; > > + /* alloc some room for copied objects */ > > + dst =3D test_ring_calloc(RING_SIZE * 2, esize[i]); > > + if (dst =3D=3D NULL) > > + goto fail; > > + cur_dst =3D dst; > > > > - /* check data */ > > - if (memcmp(src, dst, cur_dst - dst)) { > > - rte_hexdump(stdout, "src", src, cur_src - src); > > - rte_hexdump(stdout, "dst", dst, cur_dst - dst); > > - printf("data after dequeue is not the same\n"); > > - goto fail; > > - } > > + printf("enqueue 1 obj\n"); > > + TEST_RING_ENQUEUE(r, cur_src, esize[i], 1, ret, api_type); > > + if (ret !=3D 1) > > + goto fail; > > + TEST_RING_INCP(cur_src, esize[i], 1); > > > > - cur_src =3D src; > > - cur_dst =3D dst; > > + printf("enqueue 2 objs\n"); > > + TEST_RING_ENQUEUE(r, cur_src, esize[i], 2, ret, api_type); > > + if (ret !=3D 2) > > + goto fail; > > + TEST_RING_INCP(cur_src, esize[i], 2); > > > > - printf("Test enqueue without enough memory space \n"); > > - for (i =3D 0; i< (RING_SIZE/MAX_BULK - 1); i++) { > > - ret =3D rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, > NULL); > > - cur_src +=3D MAX_BULK; > > + printf("enqueue MAX_BULK objs\n"); > > + TEST_RING_ENQUEUE(r, cur_src, esize[i], MAX_BULK, ret, > > + api_type); > > if (ret !=3D MAX_BULK) > > goto fail; > > - } > > - > > - printf("Enqueue 2 objects, free entries =3D MAX_BULK - 2 \n"); > > - ret =3D rte_ring_sp_enqueue_burst(r, cur_src, 2, NULL); > > - cur_src +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > + TEST_RING_INCP(cur_src, esize[i], MAX_BULK); > > > > - printf("Enqueue the remaining entries =3D MAX_BULK - 2 \n"); > > - /* Always one free entry left */ > > - ret =3D rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); > > - cur_src +=3D MAX_BULK - 3; > > - if (ret !=3D MAX_BULK - 3) > > - goto fail; > > - > > - printf("Test if ring is full \n"); > > - if (rte_ring_full(r) !=3D 1) > > - goto fail; > > + printf("dequeue 1 obj\n"); > > + TEST_RING_DEQUEUE(r, cur_dst, esize[i], 1, ret, api_type); > > + if (ret !=3D 1) > > + goto fail; > > + TEST_RING_INCP(cur_dst, esize[i], 1); > > > > - printf("Test enqueue for a full entry \n"); > > - ret =3D rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); > > - if (ret !=3D 0) > > - goto fail; > > + printf("dequeue 2 objs\n"); > > + TEST_RING_DEQUEUE(r, cur_dst, esize[i], 2, ret, api_type); > > + if (ret !=3D 2) > > + goto fail; > > + TEST_RING_INCP(cur_dst, esize[i], 2); > > > > - printf("Test dequeue without enough objects \n"); > > - for (i =3D 0; i > - ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, > NULL); > > - cur_dst +=3D MAX_BULK; > > + printf("dequeue MAX_BULK objs\n"); > > + TEST_RING_DEQUEUE(r, cur_dst, esize[i], MAX_BULK, ret, > > + api_type); > > if (ret !=3D MAX_BULK) > > goto fail; > > - } > > - > > - /* Available memory space for the exact MAX_BULK entries */ > > - ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, 2, NULL); > > - cur_dst +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > - > > - ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); > > - cur_dst +=3D MAX_BULK - 3; > > - if (ret !=3D MAX_BULK - 3) > > - goto fail; > > - > > - printf("Test if ring is empty \n"); > > - /* Check if ring is empty */ > > - if (1 !=3D rte_ring_empty(r)) > > - goto fail; > > - > > - /* check data */ > > - if (memcmp(src, dst, cur_dst - dst)) { > > - rte_hexdump(stdout, "src", src, cur_src - src); > > - rte_hexdump(stdout, "dst", dst, cur_dst - dst); > > - printf("data after dequeue is not the same\n"); > > - goto fail; > > - } > > + TEST_RING_INCP(cur_dst, esize[i], MAX_BULK); > > > > - cur_src =3D src; > > - cur_dst =3D dst; > > - > > - printf("Test MP & MC basic functions \n"); > > - > > - printf("enqueue 1 obj\n"); > > - ret =3D rte_ring_mp_enqueue_burst(r, cur_src, 1, NULL); > > - cur_src +=3D 1; > > - if (ret !=3D 1) > > - goto fail; > > - > > - printf("enqueue 2 objs\n"); > > - ret =3D rte_ring_mp_enqueue_burst(r, cur_src, 2, NULL); > > - cur_src +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > - > > - printf("enqueue MAX_BULK objs\n"); > > - ret =3D rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL); > > - cur_src +=3D MAX_BULK; > > - if (ret !=3D MAX_BULK) > > - goto fail; > > - > > - printf("dequeue 1 obj\n"); > > - ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, 1, NULL); > > - cur_dst +=3D 1; > > - if (ret !=3D 1) > > - goto fail; > > - > > - printf("dequeue 2 objs\n"); > > - ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, 2, NULL); > > - cur_dst +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > - > > - printf("dequeue MAX_BULK objs\n"); > > - ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); > > - cur_dst +=3D MAX_BULK; > > - if (ret !=3D MAX_BULK) > > - goto fail; > > - > > - /* check data */ > > - if (memcmp(src, dst, cur_dst - dst)) { > > - rte_hexdump(stdout, "src", src, cur_src - src); > > - rte_hexdump(stdout, "dst", dst, cur_dst - dst); > > - printf("data after dequeue is not the same\n"); > > - goto fail; > > - } > > - > > - cur_src =3D src; > > - cur_dst =3D dst; > > + /* check data */ > > + if (memcmp(src, dst, cur_dst - dst)) { > > + rte_hexdump(stdout, "src", src, cur_src - src); > > + rte_hexdump(stdout, "dst", dst, cur_dst - dst); > > + printf("data after dequeue is not the same\n"); > > + goto fail; > > + } > > + > > + cur_src =3D src; > > + cur_dst =3D dst; > > + > > + printf("fill and empty the ring\n"); > > + for (j =3D 0; j < RING_SIZE / MAX_BULK; j++) { > > + TEST_RING_ENQUEUE(r, cur_src, esize[i], MAX_BULK, > > + ret, api_type); > > + if (ret !=3D MAX_BULK) > > + goto fail; > > + TEST_RING_INCP(cur_src, esize[i], MAX_BULK); > > + > > + TEST_RING_DEQUEUE(r, cur_dst, esize[i], MAX_BULK, > > + ret, api_type); > > + if (ret !=3D MAX_BULK) > > + goto fail; > > + TEST_RING_INCP(cur_dst, esize[i], MAX_BULK); > > + } > > > > - printf("fill and empty the ring\n"); > > - for (i =3D 0; i > - ret =3D rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, > NULL); > > - cur_src +=3D MAX_BULK; > > - if (ret !=3D MAX_BULK) > > + /* check data */ > > + if (memcmp(src, dst, cur_dst - dst)) { > > + rte_hexdump(stdout, "src", src, cur_src - src); > > + rte_hexdump(stdout, "dst", dst, cur_dst - dst); > > + printf("data after dequeue is not the same\n"); > > goto fail; > > - ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, > NULL); > > - cur_dst +=3D MAX_BULK; > > - if (ret !=3D MAX_BULK) > > + } > > + > > + cur_src =3D src; > > + cur_dst =3D dst; > > + > > + printf("Test enqueue without enough memory space\n"); > > + for (j =3D 0; j < (RING_SIZE/MAX_BULK - 1); j++) { > > + TEST_RING_ENQUEUE(r, cur_src, esize[i], MAX_BULK, > > + ret, api_type); > > + if (ret !=3D MAX_BULK) > > + goto fail; > > + TEST_RING_INCP(cur_src, esize[i], MAX_BULK); > > + } > > + > > + printf("Enqueue 2 objects, free entries =3D MAX_BULK - 2\n"); > > + TEST_RING_ENQUEUE(r, cur_src, esize[i], 2, ret, api_type); > > + if (ret !=3D 2) > > goto fail; > > - } > > - > > - /* check data */ > > - if (memcmp(src, dst, cur_dst - dst)) { > > - rte_hexdump(stdout, "src", src, cur_src - src); > > - rte_hexdump(stdout, "dst", dst, cur_dst - dst); > > - printf("data after dequeue is not the same\n"); > > - goto fail; > > - } > > - > > - cur_src =3D src; > > - cur_dst =3D dst; > > - > > - printf("Test enqueue without enough memory space \n"); > > - for (i =3D 0; i > - ret =3D rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, > NULL); > > - cur_src +=3D MAX_BULK; > > - if (ret !=3D MAX_BULK) > > + TEST_RING_INCP(cur_src, esize[i], 2); > > + > > + > > + printf("Enqueue the remaining entries =3D MAX_BULK - 3\n"); > > + /* Bulk APIs enqueue exact number of elements */ > > + if ((api_type & TEST_RING_BL) =3D=3D TEST_RING_BL) > > + num_elems =3D MAX_BULK - 3; > > + else > > + num_elems =3D MAX_BULK; > > + /* Always one free entry left */ > > + TEST_RING_ENQUEUE(r, cur_src, esize[i], num_elems, > > + ret, api_type); > > + if (ret !=3D MAX_BULK - 3) > > goto fail; > > - } > > - > > - /* Available memory space for the exact MAX_BULK objects */ > > - ret =3D rte_ring_mp_enqueue_burst(r, cur_src, 2, NULL); > > - cur_src +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > + TEST_RING_INCP(cur_src, esize[i], MAX_BULK - 3); > > > > - ret =3D rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL); > > - cur_src +=3D MAX_BULK - 3; > > - if (ret !=3D MAX_BULK - 3) > > - goto fail; > > + printf("Test if ring is full\n"); > > + if (rte_ring_full(r) !=3D 1) > > + goto fail; > > > > + printf("Test enqueue for a full entry\n"); > > + TEST_RING_ENQUEUE(r, cur_src, esize[i], MAX_BULK, > > + ret, api_type); > > + if (ret !=3D 0) > > + goto fail; > > > > - printf("Test dequeue without enough objects \n"); > > - for (i =3D 0; i > - ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, > NULL); > > - cur_dst +=3D MAX_BULK; > > - if (ret !=3D MAX_BULK) > > + printf("Test dequeue without enough objects\n"); > > + for (j =3D 0; j < RING_SIZE / MAX_BULK - 1; j++) { > > + TEST_RING_DEQUEUE(r, cur_dst, esize[i], MAX_BULK, > > + ret, api_type); > > + if (ret !=3D MAX_BULK) > > + goto fail; > > + TEST_RING_INCP(cur_dst, esize[i], MAX_BULK); > > + } > > + > > + /* Available memory space for the exact MAX_BULK entries > */ > > + TEST_RING_DEQUEUE(r, cur_dst, esize[i], 2, ret, api_type); > > + if (ret !=3D 2) > > goto fail; > > - } > > + TEST_RING_INCP(cur_dst, esize[i], 2); > > + > > + /* Bulk APIs enqueue exact number of elements */ > > + if ((api_type & TEST_RING_BL) =3D=3D TEST_RING_BL) > > + num_elems =3D MAX_BULK - 3; > > + else > > + num_elems =3D MAX_BULK; > > + TEST_RING_DEQUEUE(r, cur_dst, esize[i], num_elems, > > + ret, api_type); > > + if (ret !=3D MAX_BULK - 3) > > + goto fail; > > + TEST_RING_INCP(cur_dst, esize[i], MAX_BULK - 3); > > > > - /* Available objects - the exact MAX_BULK */ > > - ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, 2, NULL); > > - cur_dst +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > + printf("Test if ring is empty\n"); > > + /* Check if ring is empty */ > > + if (rte_ring_empty(r) !=3D 1) > > + goto fail; > > > > - ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); > > - cur_dst +=3D MAX_BULK - 3; > > - if (ret !=3D MAX_BULK - 3) > > - goto fail; > > + /* check data */ > > + if (memcmp(src, dst, cur_dst - dst)) { > > + rte_hexdump(stdout, "src", src, cur_src - src); > > + rte_hexdump(stdout, "dst", dst, cur_dst - dst); > > + printf("data after dequeue is not the same\n"); > > + goto fail; > > + } > > > > - /* check data */ > > - if (memcmp(src, dst, cur_dst - dst)) { > > - rte_hexdump(stdout, "src", src, cur_src - src); > > - rte_hexdump(stdout, "dst", dst, cur_dst - dst); > > - printf("data after dequeue is not the same\n"); > > - goto fail; > > + /* Free memory before test completed */ > > + rte_ring_free(r); > > + rte_free(src); > > + rte_free(dst); > > } > > > > - cur_src =3D src; > > - cur_dst =3D dst; > > - > > - printf("Covering rte_ring_enqueue_burst functions \n"); > > - > > - ret =3D rte_ring_enqueue_burst(r, cur_src, 2, NULL); > > - cur_src +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > - > > - ret =3D rte_ring_dequeue_burst(r, cur_dst, 2, NULL); > > - cur_dst +=3D 2; > > - if (ret !=3D 2) > > - goto fail; > > - > > - /* Free memory before test completed */ > > - free(src); > > - free(dst); > > return 0; > > - > > - fail: > > - free(src); > > - free(dst); > > +fail: > > + rte_ring_free(r); > > + rte_free(src); > > + rte_free(dst); > > return -1; > > } > > > > @@ -810,6 +773,7 @@ test_ring_with_exact_size(void) static int > > test_ring(void) > > { > > + unsigned int i, j; > > struct rte_ring *r =3D NULL; > > > > /* some more basic operations */ > > @@ -828,9 +792,11 @@ test_ring(void) > > goto test_fail; > > } > > > > - /* burst operations */ > > - if (test_ring_burst_basic(r) < 0) > > - goto test_fail; > > + /* Burst and bulk operations with sp/sc, mp/mc and default */ > > + for (j =3D TEST_RING_BL; j <=3D TEST_RING_BR; j <<=3D 1) > > + for (i =3D TEST_RING_N; i <=3D TEST_RING_M; i <<=3D 1) > > + if (test_ring_burst_bulk_tests(i | j) < 0) > > + goto test_fail; > > > > /* basic operations */ > > if (test_ring_basic(r) < 0) > > diff --git a/app/test/test_ring.h b/app/test/test_ring.h new file mode > > 100644 index 000000000..19ef1b399 > > --- /dev/null > > +++ b/app/test/test_ring.h > > @@ -0,0 +1,203 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(c) 2019 Arm Limited > > + */ > > + > > +#include > > +#include > > +#include > > + > > +/* API type to call > > + * N - Calls default APIs > > + * S - Calls SP or SC API > > + * M - Calls MP or MC API > > + */ > > +#define TEST_RING_N 1 > > +#define TEST_RING_S 2 > > +#define TEST_RING_M 4 > > + > > +/* API type to call > > + * SL - Calls single element APIs > > + * BL - Calls bulk APIs > > + * BR - Calls burst APIs > > + */ > > +#define TEST_RING_SL 8 > > +#define TEST_RING_BL 16 > > +#define TEST_RING_BR 32 > > + > > +#define TEST_RING_IGNORE_API_TYPE ~0U > > + > > +#define TEST_RING_INCP(obj, esize, n) do { \ > > + /* Legacy queue APIs? */ \ > > + if ((esize) =3D=3D -1) \ > > + obj =3D ((void **)obj) + n; \ > > + else \ > > + obj =3D (void **)(((uint32_t *)obj) + \ > > + (n * esize / sizeof(uint32_t))); \ } > while (0) > > + > > +#define TEST_RING_CREATE(name, esize, count, socket_id, flags, r) do {= \ > > + /* Legacy queue APIs? */ \ > > + if ((esize) =3D=3D -1) \ > > + r =3D rte_ring_create((name), (count), (socket_id), (flags)); \ > > + else \ > > + r =3D rte_ring_create_elem((name), (esize), (count), \ > > + (socket_id), (flags)); \ > > +} while (0) > > + > > +#define TEST_RING_ENQUEUE(r, obj, esize, n, ret, api_type) do { \ > > + /* Legacy queue APIs? */ \ > > + if ((esize) =3D=3D -1) \ > > + switch (api_type) { \ > > + case (TEST_RING_N | TEST_RING_SL): \ > > + ret =3D rte_ring_enqueue(r, obj); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_SL): \ > > + ret =3D rte_ring_sp_enqueue(r, obj); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_SL): \ > > + ret =3D rte_ring_mp_enqueue(r, obj); \ > > + break; \ > > + case (TEST_RING_N | TEST_RING_BL): \ > > + ret =3D rte_ring_enqueue_bulk(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_BL): \ > > + ret =3D rte_ring_sp_enqueue_bulk(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_BL): \ > > + ret =3D rte_ring_mp_enqueue_bulk(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_N | TEST_RING_BR): \ > > + ret =3D rte_ring_enqueue_burst(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_BR): \ > > + ret =3D rte_ring_sp_enqueue_burst(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_BR): \ > > + ret =3D rte_ring_mp_enqueue_burst(r, obj, n, NULL); \ > > + } \ > > + else \ > > + switch (api_type) { \ > > + case (TEST_RING_N | TEST_RING_SL): \ > > + ret =3D rte_ring_enqueue_elem(r, obj, esize); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_SL): \ > > + ret =3D rte_ring_sp_enqueue_elem(r, obj, esize); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_SL): \ > > + ret =3D rte_ring_mp_enqueue_elem(r, obj, esize); \ > > + break; \ > > + case (TEST_RING_N | TEST_RING_BL): \ > > + ret =3D rte_ring_enqueue_bulk_elem(r, obj, esize, n, \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_BL): \ > > + ret =3D rte_ring_sp_enqueue_bulk_elem(r, obj, esize, n, > \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_BL): \ > > + ret =3D rte_ring_mp_enqueue_bulk_elem(r, obj, esize, n, > \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_N | TEST_RING_BR): \ > > + ret =3D rte_ring_enqueue_burst_elem(r, obj, esize, n, \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_BR): \ > > + ret =3D rte_ring_sp_enqueue_burst_elem(r, obj, esize, n, > \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_BR): \ > > + ret =3D rte_ring_mp_enqueue_burst_elem(r, obj, esize, > n, \ > > + NULL); \ > > + } \ > > +} while (0) > > + > > +#define TEST_RING_DEQUEUE(r, obj, esize, n, ret, api_type) do { \ > > + /* Legacy queue APIs? */ \ > > + if ((esize) =3D=3D -1) \ > > + switch (api_type) { \ > > + case (TEST_RING_N | TEST_RING_SL): \ > > + ret =3D rte_ring_dequeue(r, obj); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_SL): \ > > + ret =3D rte_ring_sc_dequeue(r, obj); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_SL): \ > > + ret =3D rte_ring_mc_dequeue(r, obj); \ > > + break; \ > > + case (TEST_RING_N | TEST_RING_BL): \ > > + ret =3D rte_ring_dequeue_bulk(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_BL): \ > > + ret =3D rte_ring_sc_dequeue_bulk(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_BL): \ > > + ret =3D rte_ring_mc_dequeue_bulk(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_N | TEST_RING_BR): \ > > + ret =3D rte_ring_dequeue_burst(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_BR): \ > > + ret =3D rte_ring_sc_dequeue_burst(r, obj, n, NULL); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_BR): \ > > + ret =3D rte_ring_mc_dequeue_burst(r, obj, n, NULL); \ > > + } \ > > + else \ > > + switch (api_type) { \ > > + case (TEST_RING_N | TEST_RING_SL): \ > > + ret =3D rte_ring_dequeue_elem(r, obj, esize); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_SL): \ > > + ret =3D rte_ring_sc_dequeue_elem(r, obj, esize); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_SL): \ > > + ret =3D rte_ring_mc_dequeue_elem(r, obj, esize); \ > > + break; \ > > + case (TEST_RING_N | TEST_RING_BL): \ > > + ret =3D rte_ring_dequeue_bulk_elem(r, obj, esize, n, \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_BL): \ > > + ret =3D rte_ring_sc_dequeue_bulk_elem(r, obj, esize, n, > \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_BL): \ > > + ret =3D rte_ring_mc_dequeue_bulk_elem(r, obj, esize, n, > \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_N | TEST_RING_BR): \ > > + ret =3D rte_ring_dequeue_burst_elem(r, obj, esize, n, \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_S | TEST_RING_BR): \ > > + ret =3D rte_ring_sc_dequeue_burst_elem(r, obj, esize, n, > \ > > + NULL); \ > > + break; \ > > + case (TEST_RING_M | TEST_RING_BR): \ > > + ret =3D rte_ring_mc_dequeue_burst_elem(r, obj, esize, > n, \ > > + NULL); \ > > + } \ > > +} while (0) >=20 >=20 > My thought to avoid test-code duplication was a bit different. Yes, this can be done multiple ways. My implementation is not complicated e= ither. > Instead of adding extra enums/parameters and then do switch on them, my The switch statement should be removed by the compiler for the performance = tests. > intention was something like that: >=20 > 1. mv test_ring_perf.c test_ring_perf.h 2. Inside test_ring_perf.h chang= e > rte_ring_ create/enqueue/dequeue function > calls to some not-defined function/macros invocations. > With similar name, same number of parameters, and same semantics. > Also change 'void *burst[..]' to 'RING_ELEM[...]'; 3. For each test > configuration we want to have (default, 4B, 8B, 16B) > create a new .c file where we: > - define used in test_ring_perf.h macros(/function) > - include test_ring_perf.h > - REGISTER_TEST_COMMAND(, test_ring_perf); >=20 > As an example: > test_ring_perf.h: > ... > static int > enqueue_bulk(void *p) > { > ... > RING_ELEM burst[MAX_BURST]; >=20 > memset(burst, 0, sizeof(burst)); > .... > const uint64_t sp_start =3D rte_rdtsc(); > for (i =3D 0; i < iterations; i++) > while (RING_SP_ENQUEUE_BULK(r, burst, size, NULL) =3D=3D = 0) > rte_pause(); > const uint64_t sp_end =3D rte_rdtsc(); >=20 > const uint64_t mp_start =3D rte_rdtsc(); > for (i =3D 0; i < iterations; i++) > while (RING_MP_ENQUEUE_BULK(r, burst, size, NULL) =3D=3D = 0) > rte_pause(); > const uint64_t mp_end =3D rte_rdtsc(); > .... >=20 > Then in test_ring_perf.c: >=20 > .... > #define RING_ELEM void * > ... > #define RING_SP_ENQUEUE_BULK(ring, buf, size, spc) \ > rte_ring_sp_enqueue_bulk(ring, buf, size, spc) .... >=20 > #include "test_ring_perf.h" > REGISTER_TEST_COMMAND(ring_perf_autotest, test_ring_perf); >=20 >=20 > In test_ring_elem16B_perf.c: > .... > #define RING_ELEM __uint128_t > #define RING_SP_ENQUEUE_BULK(ring, buf, size, spc) \ > rte_ring_sp_enqueue_bulk_elem(ring, buf, sizeof(RING_ELEM), size, > spc) .... > #include "test_ring_perf.h" > REGISTER_TEST_COMMAND(ring_perf_elem16B_autotest, test_ring_perf); >=20 > In test_ring_elem4B_per.c: >=20 > .... > #define RING_ELEM uint32_t > #define RING_SP_ENQUEUE_BULK(ring, buf, size, spc) \ > rte_ring_sp_enqueue_bulk_elem(ring, buf, sizeof(RING_ELEM), size, > spc) .... > #include "test_ring_perf.h" > REGISTER_TEST_COMMAND(ring_perf_elem4B_autotest, test_ring_perf); >=20 > And so on. >=20 > > + > > +/* This function is placed here as it is required for both > > + * performance and functional tests. > > + */ > > +static __rte_always_inline void * > > +test_ring_calloc(unsigned int rsize, int esize) { > > + unsigned int sz; > > + void *p; > > + > > + /* Legacy queue APIs? */ > > + if (esize =3D=3D -1) > > + sz =3D sizeof(void *); > > + else > > + sz =3D esize; > > + > > + p =3D rte_zmalloc(NULL, rsize * sz, RTE_CACHE_LINE_SIZE); > > + if (p =3D=3D NULL) > > + printf("Failed to allocate memory\n"); > > + > > + return p; > > +} > > -- > > 2.17.1