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 0C57CA051C; Sat, 18 Jan 2020 17:28:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8DD6F1BE8A; Sat, 18 Jan 2020 17:28:06 +0100 (CET) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10076.outbound.protection.outlook.com [40.107.1.76]) by dpdk.org (Postfix) with ESMTP id 20C641BE81 for ; Sat, 18 Jan 2020 17:28:05 +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=5V5UjnPMvP2AZIm0nP3D/nYDWVTbFiYciqbENsUxopo=; b=Ovr+EtLZ34opHq65/ZyLDelDEhxXxKlcb0p9z4LGb067xeZGS2S/yy+6yDM2SKPTNZQTFIPkW78yXBrTNJcXixIfErwAlwfM1iHvH9fZ8r4HRgKPM6i0yrZBKxq+fm073IDyFS3UK6K9tyDSi85Wyg+1xNjj4QvQ0ZvXAaY0s1k= Received: from AM6PR08CA0024.eurprd08.prod.outlook.com (2603:10a6:20b:b2::36) by VI1PR08MB4445.eurprd08.prod.outlook.com (2603:10a6:803:fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.23; Sat, 18 Jan 2020 16:28:02 +0000 Received: from AM5EUR03FT057.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::202) by AM6PR08CA0024.outlook.office365.com (2603:10a6:20b:b2::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20 via Frontend Transport; Sat, 18 Jan 2020 16:28:02 +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 AM5EUR03FT057.mail.protection.outlook.com (10.152.17.44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.23 via Frontend Transport; Sat, 18 Jan 2020 16:28:02 +0000 Received: ("Tessian outbound 1da651c29646:v40"); Sat, 18 Jan 2020 16:28:01 +0000 X-CR-MTA-TID: 64aa7808 Received: from cddc97ab4468.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A6B88A29-08D0-4A20-A002-5BFD7E93D334.1; Sat, 18 Jan 2020 16:27:56 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cddc97ab4468.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 18 Jan 2020 16:27:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=buG2H+NDLaT/JvfRhwnqLc18iTeRBhdAgD9A/dQBydmyHJ9qPItzjsmcar/6a7cxhduUOWFIy6T10WSb6ENrRiIFBZMLVsczpUFutR+IgZSK+XSe1ZpehlkB5kYeBuN3vgfQIvNs7lhdhot5/rDnLVRzED4cOFWGlKYf+LvHBGr/gHeK35yWQ9JeSYajA8rheVS6/4V6DSjF871+Dxpgoykvy/JngqSTciTDTKZqvSis00mJ9PglwhNwROKtqglUAEgYWXmI4X12TIYlc6fFo3WIiJw+Crx7pGEcOxqpMp1895h455vLhIldeOdeXgm+6wJpkTx+mgVSND5ollfBvg== 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=5V5UjnPMvP2AZIm0nP3D/nYDWVTbFiYciqbENsUxopo=; b=oMtaxUDgfehrY8CEC/CK7jhV2lJpzEio/6N3hEy2FYSkYelaED7Ye9e80qOGuoNs8L0TFnHExITCgqusJbTbJM/vc3iXSJNKVRUuRSEDiQ9+Les4m90HUFL/FO2Fwi6yUSKYPH1E8Hf76ostZCXHLCk4sFGomeFk8M1WPkBCZn2AKO4q/OmQ+ZcEq5XEykXlQN5WJTrScgXFowCJm7HRRomBUdgMeS3Dbl5jL3gTNtRviyTLzuegutSA3enl+8bUbtdVlEfwrLS7SkFWcOrIgVPXayioQsCg0N7JCi2GptOwSoC4b04szUIVttSj3bHwVBwEaJHS11q/LurN21LxuA== 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=5V5UjnPMvP2AZIm0nP3D/nYDWVTbFiYciqbENsUxopo=; b=Ovr+EtLZ34opHq65/ZyLDelDEhxXxKlcb0p9z4LGb067xeZGS2S/yy+6yDM2SKPTNZQTFIPkW78yXBrTNJcXixIfErwAlwfM1iHvH9fZ8r4HRgKPM6i0yrZBKxq+fm073IDyFS3UK6K9tyDSi85Wyg+1xNjj4QvQ0ZvXAaY0s1k= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.27) by VE1PR08MB4672.eurprd08.prod.outlook.com (10.255.112.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.23; Sat, 18 Jan 2020 16:27:53 +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.2644.024; Sat, 18 Jan 2020 16:27:53 +0000 From: Honnappa Nagarahalli To: Olivier Matz CC: "sthemmin@microsoft.com" , "jerinj@marvell.com" , "bruce.richardson@intel.com" , "david.marchand@redhat.com" , "pbhagavatula@marvell.com" , "konstantin.ananyev@intel.com" , "yipeng1.wang@intel.com" , "dev@dpdk.org" , Dharmik Thakkar , Ruifeng Wang , Gavin Hu , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v9 3/6] test/ring: add functional tests for rte_ring_xxx_elem APIs Thread-Index: AQHVzVgCXy0st70b20alrykNdzHj8qfwm7ZQ Date: Sat, 18 Jan 2020 16:27:53 +0000 Message-ID: References: <20190906190510.11146-1-honnappa.nagarahalli@arm.com> <20200116052511.8557-1-honnappa.nagarahalli@arm.com> <20200116052511.8557-4-honnappa.nagarahalli@arm.com> <20200117170312.GZ22738@platinum> In-Reply-To: <20200117170312.GZ22738@platinum> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: e918ebff-cf7d-4bc9-8c04-247a7909c75a.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: 42309412-bc78-40ef-1826-08d79c336369 X-MS-TrafficTypeDiagnostic: VE1PR08MB4672:|VE1PR08MB4672:|VI1PR08MB4445: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: True x-ms-oob-tlc-oobclassifiers: OLM:590;OLM:590; x-forefront-prvs: 0286D7B531 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(346002)(376002)(396003)(136003)(199004)(189003)(9686003)(55016002)(6916009)(66476007)(4326008)(66556008)(64756008)(52536014)(66446008)(76116006)(5660300002)(66946007)(71200400001)(8936002)(478600001)(7696005)(8676002)(86362001)(186003)(6506007)(33656002)(81156014)(81166006)(26005)(2906002)(316002)(54906003)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4672; H:VE1PR08MB5149.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: 7rZyTBtyyV02bWeYxm/GAtpbqmkJxqLAIXax1m03bHO2E3jh9shWheWOdtBBcnBuemVmziWwnERmiqUni9v2W7ooG1P/v5V/RED8Z58lJAjU22ilji0FSrSzr7xpOYuX64xN4jSbtnJ5AO9MR7TDHVQ43NBIUab5NMrBxI2RqLu0tphtbCVvo/NwLwDgDNn9ezyoItfQdNDuSML/jS1Z3th+M50o4ukQwSxAu3Cjo6+EanxuYPPeWSvYxqI8gcSL6T2NrauiVusV1Nfy2+wnDvhj4A3LInkeMaVe/pKiXTgkK4XO7wu5Roh2ZbMjtzc8YprCynYZOyHEY8v0sPe5vQsfZEbLXdvuLO6OZzKSzpgKWMQvWjDDnlntS3odXM8fBBU/CKrLsVsK573E1rqoG2eWtioLBaKNsnkxvJTQkz8Qhg7j9JWuuzFm1/F32x5soJhoFyx6v0ko2dBy4+3FTgNM8wIzEYpYPE6IovqpJC4LMi3n+dGDe0La84NnP5N2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4672 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT057.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)(396003)(136003)(39860400002)(376002)(346002)(199004)(189003)(7696005)(316002)(36906005)(54906003)(33656002)(336012)(86362001)(8676002)(55016002)(478600001)(26826003)(6862004)(186003)(6506007)(9686003)(81166006)(81156014)(26005)(8936002)(4326008)(356004)(70586007)(70206006)(52536014)(5660300002)(2906002)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB4445; 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: 621bf048-78ad-4f08-6eea-08d79c335e51 X-Forefront-PRVS: 0286D7B531 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZnZrsaGjlxpzFjhb0Eba9i7zkOraEXCh9NC/QSDDKbCskxm5q849J6qkB7RmXpUxVlzpeQxDVqYwYMSWmIlqsdo36CL4w11pKyPvIDzTLuIk1sQGHNWnPevW7ooNqHyImIErMIoHqbXCvKu6sgm1uIkt2V9ohukjyy/vX9BocQ+mgjvhmxj+/ty8kd1EIt/xSHoNLSjuMce1lYqiNXe7uk0A8HjibiQXDssqb+nlLrmhmcKB24hnpBCej354QWsy2o/SWP1zH9fEPG/yDbAQg3Sc1Rmzof4CPHXBCNAi9UwzR19dF8eljfU7bh6TGz5RFcuifQi64h1+I7wD60ieIyp8S1tJWJkh2rwkUShEaPLVzOPW2mjlVsXlcLcxfj2C5oVmI2/Q1mjyDS0rMzj6s6kB2Phc0pMil/hzLVjjSw6NdneJZl7pc5cGNeH+p0immRypyE7LVrLCG54vGYhipoymeUBGy1syEUnMJI4rBLTE3quRFP9u+sdO4xaxLkUi X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2020 16:28:02.0691 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42309412-bc78-40ef-1826-08d79c336369 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: VI1PR08MB4445 Subject: Re: [dpdk-dev] [PATCH v9 3/6] 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" > On Wed, Jan 15, 2020 at 11:25:08PM -0600, Honnappa Nagarahalli wrote: > > Add basic infrastructure to test rte_ring_xxx_elem APIs. > > Adjust the existing test cases to test for various ring element sizes. > > > > Signed-off-by: Honnappa Nagarahalli > > Reviewed-by: Gavin Hu > > --- > > app/test/test_ring.c | 1342 > > +++++++++++++++++++++--------------------- > > app/test/test_ring.h | 187 ++++++ > > 2 files changed, 850 insertions(+), 679 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..c08500eca 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 >=20 > As you are changing a lot of things, maybe it's an opportunity to update = or > remove the comment at the beginning of the file. I have removed specific comments. I have converted it into generic comments= . >=20 >=20 > > @@ -55,8 +57,6 @@ > > #define RING_SIZE 4096 > > #define MAX_BULK 32 > > > > -static rte_atomic32_t synchro; > > - > > #define TEST_RING_VERIFY(exp) > \ > > if (!(exp)) { \ > > printf("error at %s:%d\tcondition " #exp " failed\n", \ > > @@ -67,808 +67,792 @@ static rte_atomic32_t synchro; > > > > #define TEST_RING_FULL_EMTPY_ITER 8 > > > > -/* > > - * helper routine for test_ring_basic > > - */ > > -static int > > -test_ring_basic_full_empty(struct rte_ring *r, void * const src[], > > void *dst[]) > > +static int esize[] =3D {-1, 4, 8, 16, 20}; >=20 > it could be const Yes >=20 > [...] >=20 > > +/* > > + * Burst and bulk operations with sp/sc, mp/mc and default (during > > +creation) > > + * Random number of elements are enqueued and dequeued. > > + */ > > +static int > > +test_ring_burst_bulk_tests1(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 int i, j; > > + int rand; > > + const unsigned int rsz =3D RING_SIZE - 1; > > > > - /* 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; > > - } > > + for (i =3D 0; i < RTE_DIM(esize); i++) { > > + test_ring_print_test_string("Test standard ring", api_type, > > + esize[i]); > > > > - cur_src =3D src; > > - cur_dst =3D dst; > > + /* Create the ring */ > > + r =3D test_ring_create("test_ring_burst_bulk_tests", esize[i], > > + RING_SIZE, SOCKET_ID_ANY, 0); > > > > - ret =3D rte_ring_mp_enqueue(r, cur_src); > > - if (ret !=3D 0) > > - 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; > > > > - ret =3D rte_ring_mc_dequeue(r, cur_dst); > > - if (ret !=3D 0) > > - 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; > > + > > + printf("Random full/empty test\n"); > > + > > + for (j =3D 0; j !=3D TEST_RING_FULL_EMTPY_ITER; j++) { > > + /* random shift in the ring */ > > + 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); > > + TEST_RING_VERIFY(ret !=3D 0); > > + > > + ret =3D test_ring_dequeue(r, cur_dst, esize[i], rand, > > + api_type); > > + TEST_RING_VERIFY(ret =3D=3D rand); > > + > > + /* fill the ring */ > > + ret =3D test_ring_enqueue(r, cur_src, esize[i], rsz, > > + api_type); > > + TEST_RING_VERIFY(ret !=3D 0); > > + > > + TEST_RING_VERIFY(rte_ring_free_count(r) =3D=3D 0); > > + TEST_RING_VERIFY(rsz =3D=3D rte_ring_count(r)); > > + TEST_RING_VERIFY(rte_ring_full(r)); > > + TEST_RING_VERIFY(rte_ring_empty(r) =3D=3D 0); > > + > > + /* empty the ring */ > > + ret =3D test_ring_dequeue(r, cur_dst, esize[i], rsz, > > + api_type); > > + 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); > > + TEST_RING_VERIFY(rte_ring_full(r) =3D=3D 0); > > + TEST_RING_VERIFY(rte_ring_empty(r)); > > + > > + /* check data */ > > + TEST_RING_VERIFY(memcmp(src, dst, rsz) =3D=3D 0); > > + } > > + > > + /* Free memory before test completed */ > > + rte_ring_free(r); > > + rte_free(src); > > + rte_free(dst); >=20 > I think they should be reset to NULL to avoid a double free if next itera= tion > fails. >=20 > There are several places like this, I think it can be done even if not re= ally > needed. Will change all of them >=20 > [...] >=20 > > diff --git a/app/test/test_ring.h b/app/test/test_ring.h new file mode > > 100644 index 000000000..26716e4f8 > > --- /dev/null > > +++ b/app/test/test_ring.h > > @@ -0,0 +1,187 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(c) 2019 Arm Limited > > + */ > > + > > +#include > > +#include > > +#include > > + > > +/* API type to call > > + * rte_ring__enqueue_ > > + * TEST_RING_THREAD_DEF - Uses configured SPSC/MPMC calls > > + * TEST_RING_THREAD_SPSC - Calls SP or SC API > > + * TEST_RING_THREAD_MPMC - Calls MP or MC API */ #define > > +TEST_RING_THREAD_DEF 1 #define TEST_RING_THREAD_SPSC 2 #define > > +TEST_RING_THREAD_MPMC 4 > > + > > +/* API type to call > > + * SL - Calls single element APIs > > + * BL - Calls bulk APIs > > + * BR - Calls burst APIs > > + */ >=20 > The comment was not updated according to macro name. Will fix >=20