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 9E0C9A04F3; Thu, 9 Jan 2020 06:15:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 577BB1DB71; Thu, 9 Jan 2020 06:15:37 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by dpdk.org (Postfix) with ESMTP id 8E8451DB65 for ; Thu, 9 Jan 2020 06:15:35 +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=7dR9jO8eO5Br404qIMKrdX/nnznYty7svSyHnvMNA6w=; b=5BKDeLeYTgQF8/ubrBRHg85fjY0TlCmtTAkS6ElaJL7fCILtkPd5Pm6EZEb3PEa5Kp2TZftieZitCD9oKeqcTWJyKbseX65diodlxWHnHQmwuCSoaLkDaUtbbg/rXWBjX94BuCPwLOt91ANT3+LPnCRN5hTHqtTvX0Yi8/KxQzU= Received: from VI1PR0802CA0033.eurprd08.prod.outlook.com (2603:10a6:800:a9::19) by DB7PR08MB2953.eurprd08.prod.outlook.com (2603:10a6:5:1b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Thu, 9 Jan 2020 05:15:33 +0000 Received: from AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::200) by VI1PR0802CA0033.outlook.office365.com (2603:10a6:800:a9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10 via Frontend Transport; Thu, 9 Jan 2020 05:15:33 +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 AM5EUR03FT029.mail.protection.outlook.com (10.152.16.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Thu, 9 Jan 2020 05:15:33 +0000 Received: ("Tessian outbound 28955e0c1ca8:v40"); Thu, 09 Jan 2020 05:15:32 +0000 X-CR-MTA-TID: 64aa7808 Received: from 2b78114bb3f3.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EF8FFA0D-4B06-4782-987F-1009838EB185.1; Thu, 09 Jan 2020 05:15:27 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2b78114bb3f3.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 09 Jan 2020 05:15:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Th53hpy7EsrJUiH7a76r7ETqCCpLVGdswcMXLfQPIys5EwTa8NaVpi1l8TnOblZ+YfWcDRCiEXnO+d+yyUpx8BcxuqUx/PisW5WLr8mp62KF5k4ddjHIz52k0wdCDNO/6gF+6SyN+eW9mD81NhkmdxggOevLb7+N0z5c4ztioMzYl5UBa1VELNGIKDBKc2du+/G5JFMuGBEsABx+1wJ0ZuSbEJ0u2MzcPsgpMKjixlrHuEDKm64GyZQgUSJca5xyP9Q0cHeECt/apIazCna9x+prr6EA6bHBlgZtLBVqVGibZCFW7ahpx+5DjCmuuZFIlERoGyMzrXo9LKKk9dg/pQ== 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=7dR9jO8eO5Br404qIMKrdX/nnznYty7svSyHnvMNA6w=; b=E0H3sw+Abqr8JOxtdIIjhiDqjMZfMnKsttzNc1DjvdxAiUdyQEwAPAYCDRlnpryyPPqc7DQElAwLw5VMlvUCr1QrejHfYnJFHY3kOXjFDIa2itw5f7OaxxvHP+4OmQnge+F+zOgMbalKtSv9wpQme1iG8iCQfz20HaAZUSxMalzdMca6th4SmvdCZ6JIqYMf6Az/AEB8g7Vjv8DzX/zgIMEHw7YVgy0U1gPCon1JGxGOavm/Jm98fcN+12CHYCUcRNW3lb6+StxweqeYXNiumhRcnpUy88kn6jZAve+G8GgAKv5QRVpzB5mk3W7q9Wx7jPF4HUciM5S/h6V5/RLUXw== 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=7dR9jO8eO5Br404qIMKrdX/nnznYty7svSyHnvMNA6w=; b=5BKDeLeYTgQF8/ubrBRHg85fjY0TlCmtTAkS6ElaJL7fCILtkPd5Pm6EZEb3PEa5Kp2TZftieZitCD9oKeqcTWJyKbseX65diodlxWHnHQmwuCSoaLkDaUtbbg/rXWBjX94BuCPwLOt91ANT3+LPnCRN5hTHqtTvX0Yi8/KxQzU= Received: from AM0PR08MB5138.eurprd08.prod.outlook.com (10.255.28.224) by AM0PR08MB4067.eurprd08.prod.outlook.com (20.178.202.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.12; Thu, 9 Jan 2020 05:15:24 +0000 Received: from AM0PR08MB5138.eurprd08.prod.outlook.com ([fe80::a03f:3928:9859:4dc1]) by AM0PR08MB5138.eurprd08.prod.outlook.com ([fe80::a03f:3928:9859:4dc1%5]) with mapi id 15.20.2602.018; Thu, 9 Jan 2020 05:15:24 +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: AQHVwYoqZLYWmc7nL0KbrgJWkkgeh6fepxjwgAC99ACAAAHK8A== Date: Thu, 9 Jan 2020 05:15:24 +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: f7e96863-6d2f-4098-ae62-efc5502855c6.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: 58ed4fbc-8ff9-4c09-ddb7-08d794c2f3e2 X-MS-TrafficTypeDiagnostic: AM0PR08MB4067:|AM0PR08MB4067:|DB7PR08MB2953: 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:10000;OLM:10000; x-forefront-prvs: 02778BF158 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(366004)(346002)(39860400002)(199004)(189003)(71200400001)(66946007)(66446008)(66476007)(66556008)(64756008)(55016002)(7696005)(86362001)(9686003)(30864003)(4326008)(76116006)(110136005)(26005)(186003)(54906003)(316002)(5660300002)(6506007)(33656002)(2906002)(52536014)(478600001)(81156014)(81166006)(8676002)(8936002)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB4067; H:AM0PR08MB5138.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: YbmW13XD08XGFZkvlcevWgMkz81QewczK/Z+bL5nn65rRnFvydz9+JyESEBJ+BRNE3VWUh+HTp3ZR87N6ToaXESEQY+S0MpEvEMd7MpnipmdtT9N2p9onuphvTrZtuaty+YxXUO3vvibQZ06U/Bcb9oaKuiXl8dlClrDbJVXGDM5gwwGDWfBz7uJxIS+LSbF1K0V+fbK56GTrnWkCcdv7bTiOc4Xs3RFiuK4UkxSS7n54+CeCCGbj3TzPd/ozzoOfJ8yzmUWK1rGV7ZCaVJgsje0NqZpBfGBn5oyxeut1Wm4Rw10zTazcQDRzwiaNS4DatU7yEpU/bbrB/RpnaVp6k/2xAwUIaP2rhdqHD9Mbmgmoza2NzHEbOthXdOvMIFDFA2HhMlco/qUAFcINbMT9T7w6hDuQOVeqhKWMVDlo93Ijpl2UgSJ9qYyP73ltB3wTsnFEGfGNYWSbBctFHhD8OHFe0/XwbsMPEAZtrs/R68yU2LxZiowShsczK4a0Lan Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4067 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT029.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)(376002)(396003)(136003)(39860400002)(346002)(189003)(199004)(54906003)(70586007)(110136005)(55016002)(7696005)(316002)(9686003)(26005)(186003)(5660300002)(6506007)(86362001)(33656002)(70206006)(52536014)(2906002)(4326008)(30864003)(336012)(36906005)(26826003)(81166006)(8676002)(478600001)(8936002)(356004)(81156014)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB2953; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: b45115f6-0481-4756-d34b-08d794c2eed3 X-Forefront-PRVS: 02778BF158 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8CRBU0dFPkSb8wTW3gAmcES5KO1kI3KYmKeEgyb57zp6IPOf9lG/6N2c4uE7OSAiZMzyifxQ2Ba1Pi2pqlc+PbpBq5LE03n5Xj0+JPEgX+H0F766Jsp8nOh4jw8iypZn3HuzEEdNDqBBCvojiOQzr1X/NE9Z3CVg50YtbYfjV1oQGYEQuRolMXG9uBSVYiNfLf897wkzHxNQjuhkr0feIYyVpPiNJv2Yu5t4WUDfXcqhNB3empgFh3+aQigme+0d8eerKqT3dMIEmep09047J6guZT/7uKiylchAk4Y31zeO6IzrVqCTJpZltuUrb/MnUEUkfTN3aazDrfTRuuzZOPfE5I8Y3gtEksmB2q0SAkDM3XYUcGIpwNKRlkNUzGFqDf4KsvH5iF3AUyroUTJJv41MmZ7gRUEpdWhttTl6GPzEMwfPVVgg9tf6SDKV8eyafl1G6oFjftZUzJe3sny9Z8M5hwkHAb/1ZDrL+5apl3CFuY5YivgI4xR5OAc6evN5 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2020 05:15:33.1591 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58ed4fbc-8ff9-4c09-ddb7-08d794c2f3e2 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: DB7PR08MB2953 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" > Subject: RE: [PATCH v7 03/17] test/ring: add functional tests for > rte_ring_xxx_elem APIs >=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 > > > > --- > > > > 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) > > > > > > > > > My thought to avoid test-code duplication was a bit different. > > Yes, this can be done multiple ways. My implementation is not complicat= ed > either. > > > > > 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. >=20 > I am sure the compiler will do its job properly. > My concern is that with all these extra flags, it is really hard to read = and > understand what exactly function we are calling and what we are trying to > test. There are just 2 flags - 1) representing single/bulk/burst 2) representing = default/single/multiple threads. This is the way the rte_ring APIs are also= organized (rte_ring__enqueue_). If we want to keep the code flexible, we have to keep these 2 flags that ca= n be varied. Your proposal considers only the element size as a variable. It does not co= nsider the above mentioned variables. This results in code duplication. Thi= s is visible in patch 10/17. > Might be just me, but let say in original version for enqueue_bulk() we h= ave: >=20 > const uint64_t sp_start =3D rte_rdtsc(); > for (i =3D 0; i < iterations; i++) > while (rte_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 (rte_ring_mp_enqueue_bulk(r, burst, size, NULL) =3D= =3D 0) > rte_pause(); > const uint64_t mp_end =3D rte_rdtsc(); >=20 > Simple and easy to understand. > Same code after the patch doesn't that straightforward anymore: >=20 > const uint64_t sp_start =3D rte_rdtsc(); > for (i =3D 0; i < iterations; i++) > do { > if (flag =3D=3D 0) > TEST_RING_ENQUEUE(r, burst, esize, bsize,= ret, > TEST_RING_S | TEST_RING_B= L); > else if (flag =3D=3D 1) > TEST_RING_DEQUEUE(r, burst, esize, bsize,= ret, > TEST_RING_S | TEST_RING_B= L); Would it help if the #define names are better? May be convert TEST_RING_SL to TEST_ELEM_SINGLE TEST_RING_BL to TEST_ELEM_BULK TEST_RING_BR to TEST_ELEM_BURST and TEST_RING_N to TEST_THREAD_DEFAULT TEST_RING_S to TEST_THREAD_SPSC TEST_RING_M to TEST_THREAD_MPMC > if (ret =3D=3D 0) > rte_pause(); > } while (!ret); > const uint64_t sp_end =3D rte_rdtsc(); >=20 > Another thing - if tomorrow we'll want to add perf tests for elem_size=3D= =3D4/8, > etc. - we'll need to do copy/paste for all test-case invocations, as you = did for > 16B (or some code reorg). This is a mistake on my side. Looking at the code, 'test_ring_perf' can be = simplified to avoid the copy/paste. 'test_ring_perf' can be changed to call= another function (that contains the test cases) with different element siz= es. I will make this change. The only issue would be the wrappers 'dequeue_bulk', 'dequeue_bulk_16B' etc= . However, the wrappers are simple enough to maintain. >=20 > > > > > intention was something like that: > > > > > > 1. mv test_ring_perf.c test_ring_perf.h 2. Inside test_ring_perf.h > > > change 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); > > > > > > As an example: > > > test_ring_perf.h: > > > ... > > > static int > > > enqueue_bulk(void *p) > > > { > > > ... > > > RING_ELEM burst[MAX_BURST]; > > > > > > 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(); > > > > > > 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(); > > > .... > > > > > > Then in test_ring_perf.c: > > > > > > .... > > > #define RING_ELEM void * > > > ... > > > #define RING_SP_ENQUEUE_BULK(ring, buf, size, spc) \ > > > rte_ring_sp_enqueue_bulk(ring, buf, size, spc) .... > > > > > > #include "test_ring_perf.h" > > > REGISTER_TEST_COMMAND(ring_perf_autotest, test_ring_perf); > > > > > > > > > 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); > > > > > > In test_ring_elem4B_per.c: > > > > > > .... > > > #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); > > > > > > And so on. This will result in additional test files. > > > > > > > + > > > > +/* 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