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 76860A00BE; Tue, 7 Jul 2020 07:19:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF0011D407; Tue, 7 Jul 2020 07:19:23 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150040.outbound.protection.outlook.com [40.107.15.40]) by dpdk.org (Postfix) with ESMTP id 9D5251C19F for ; Tue, 7 Jul 2020 07:19:22 +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=uxVMAL/E4AU4qXYogX8T3X+5aQFeX5KvZ98OcpGfY1g=; b=t9nVuaeDIoZdwY8sWSGubbmhWo7NVU8jXpW7rMsGlO85szLY3x/f/hbwF2dBnPs/cwbaM0u/DIkFpnPAbzsL5zsn9eYrAKCywGX94kBTr+TcyHA8limMrMwsLt95/AhAWR3Eq2WN10decAq+pJMn+VxlkRb/AZ+yn20nQY9ds5U= Received: from DB6P195CA0023.EURP195.PROD.OUTLOOK.COM (2603:10a6:4:cb::33) by DB7PR08MB3818.eurprd08.prod.outlook.com (2603:10a6:10:7e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.28; Tue, 7 Jul 2020 05:19:20 +0000 Received: from DB5EUR03FT064.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:cb:cafe::b7) by DB6P195CA0023.outlook.office365.com (2603:10a6:4:cb::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Tue, 7 Jul 2020 05:19:20 +0000 X-MS-Exchange-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 DB5EUR03FT064.mail.protection.outlook.com (10.152.21.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.24 via Frontend Transport; Tue, 7 Jul 2020 05:19:20 +0000 Received: ("Tessian outbound 8239f48e56bd:v62"); Tue, 07 Jul 2020 05:19:20 +0000 X-CR-MTA-TID: 64aa7808 Received: from 4384d964a64b.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id DDF32091-9AE6-4A46-B8CF-141F42D254ED.1; Tue, 07 Jul 2020 05:19:15 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4384d964a64b.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Jul 2020 05:19:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TokPleAM76SqDr11D2/jaHbT7PcEh2Sltrl/cjweh826rSGiOPPHtkLZN7JSHfgBEOAnAPKExcEmG5ZnJ0gFy2JKvRpclhW8dWaYT0p0Q9RxsIoa4wXplYJOt5nAcejQi2jOlW86D8P9lbAo8R9niBSuH2C2MCZxr7+Y/6H1O0z98v94dclOBYbt4Q3Iljdggjm1tFdJp2cSJGF4SPLphbOyGZHXXUwOcuciGyjpdHftrQmsyhgCqbobQElbTq/iVhkYbIhxBEgzS7lcYylliai8OPJvKZX3izPcJm8Fz7KGJ1SPeJZSjKr0xhiqBlfYOXgRUtaxHI9sgkgvWmtFnw== 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=uxVMAL/E4AU4qXYogX8T3X+5aQFeX5KvZ98OcpGfY1g=; b=dEcFmfFjB76nK57Uq5m4gQm/qwUMLlX15XoBP6JcwZ+RLF6FpeJXxaNRhxiW75cL7dPSlKVY3W8WxVqGauu/+rLcM5xBE3v9kA+Z9wN9P64s41CTRoXiHx9YSfz8F/AHFEwIrcaQjZD5fzrRx3kn6tJD3wvrcYnBzVytdDBzpCrLgDJsMjdR+E310mJKcQgy4N+NCt1fEs9H4DVIxAOGy83QiAaNV4o7k/5aFn/gsvFEZzccLnm6cRIePOi12AmK0WW0/ZVGbeciXRRTdGkPQOD/UWj/xjrsKbwRdhY9X+7QXDQZR5JmTfv93GSXJnLDPsDqDxFWD/8RMJa0dIrWqQ== 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=uxVMAL/E4AU4qXYogX8T3X+5aQFeX5KvZ98OcpGfY1g=; b=t9nVuaeDIoZdwY8sWSGubbmhWo7NVU8jXpW7rMsGlO85szLY3x/f/hbwF2dBnPs/cwbaM0u/DIkFpnPAbzsL5zsn9eYrAKCywGX94kBTr+TcyHA8limMrMwsLt95/AhAWR3Eq2WN10decAq+pJMn+VxlkRb/AZ+yn20nQY9ds5U= Received: from VI1PR08MB3023.eurprd08.prod.outlook.com (2603:10a6:803:4e::21) by VI1PR08MB5504.eurprd08.prod.outlook.com (2603:10a6:803:13b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21; Tue, 7 Jul 2020 05:19:13 +0000 Received: from VI1PR08MB3023.eurprd08.prod.outlook.com ([fe80::8146:10d3:6c3:2c12]) by VI1PR08MB3023.eurprd08.prod.outlook.com ([fe80::8146:10d3:6c3:2c12%6]) with mapi id 15.20.3153.029; Tue, 7 Jul 2020 05:19:13 +0000 From: Feifei Wang To: Feifei Wang , Honnappa Nagarahalli , Konstantin Ananyev , "drc@linux.vnet.ibm.com" CC: "dev@dpdk.org" , nd , Ruifeng Wang , nd Thread-Topic: [PATCH 3/3] ring: use element APIs to implement legacy APIs Thread-Index: AQHWUSSMQT4gUrpYPUKzByelG1Yowqj7emsg Date: Tue, 7 Jul 2020 05:19:13 +0000 Message-ID: References: <20200703102651.8918-1-feifei.wang2@arm.com> <20200703102651.8918-4-feifei.wang2@arm.com> In-Reply-To: <20200703102651.8918-4-feifei.wang2@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 639f4ece-d6c9-4701-8d6a-4b504cbbacb7.1 x-checkrecipientchecked: true Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [203.126.0.111] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bbec3f64-d51e-4e36-ba22-08d822354d83 x-ms-traffictypediagnostic: VI1PR08MB5504:|DB7PR08MB3818: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508; x-forefront-prvs: 0457F11EAF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: uBtUscSm8zxCcKfk7W0GpkwMdSbIZvzUVTfphS1SE30QORHn1+DgyCmkO6IoCI9Ad2E1jn5VTiNO2iJeGYP+j3Nn6crc3u2KQiYFFv1REfem5PTHYHR8HM3wxTyBxIxMCA/hKx+Mt2O6c2Y05JPMcMaFv4+XnZa957vuSLrwwrP3pH7JUwWia6dz/5Jy+/a4ASwmSTyi28aB3+vDNvLlBT1QGSNFyRWcSTycQfvIdQ5C+/TLAcYSWsLH1lhSQ3XhWFHMBkwx7B6iVdA6SuHF1IwvaIPCw1v0RaNyQldpYGFkpxccLkz4gnQPJh/9gPde8wca60Vxkcc8351UhfZMEkXqxj6aPK6tBwcFIsfkqvv/Xow7WESrWWCnUGLb8+GU X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3023.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(396003)(366004)(39860400002)(376002)(346002)(5660300002)(66476007)(66556008)(64756008)(66446008)(66946007)(316002)(54906003)(2906002)(55016002)(9686003)(71200400001)(7696005)(33656002)(4326008)(8936002)(83380400001)(8676002)(478600001)(76116006)(86362001)(26005)(30864003)(186003)(110136005)(52536014)(6506007)(53546011)(21314003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: VYO5b0NuiiwmYIHGbyHNyuCkYwxe/95h0kFZvVrRRDiJX04Tgn0Hs5vC+tdlG8Tp/HO7WDXnj6ewXM8VWF3mIwVX6WFfxl/fL6ToBj/Cak53w1Q+iaWBLor8glMRCzzdL16OB5Qh9D4VjC9eVmFvIyx7v8c15eIY9WQO6prxdFytzbXfILXkUD0xM9QOc+aDF3pDFqTdkHLoVy9xExauveNuHIPIcnk/OpPrDg0RZEZqAeuJ3zFEgmzSeQeJ3Xt4LAwEXMv0gX7yhkOBP5Z6E9Pz7vwcYqC55eD6MQuDJN0EATcXxHhOY8da/OLJ99/Gsc4IFSG8G6edgJFhqQXZcnNkh44vixgdAeX7/10QRYh/oFAePwf5EUJxWcZniJCFV6GL4+azKH7etDj3eDvw2JKLzddY7+m8UFU2jQmz8voVdqWyQcFDTurxwVDRKSf9KIGsjrh6LKUKR8TufkLgArOLK55tzw58IItA7UKk7D4= Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5504 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT064.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)(39860400002)(136003)(396003)(346002)(376002)(46966005)(9686003)(8936002)(55016002)(186003)(478600001)(70206006)(70586007)(7696005)(52536014)(26005)(4326008)(53546011)(6506007)(86362001)(82310400002)(81166007)(356005)(83380400001)(82740400003)(47076004)(316002)(30864003)(54906003)(110136005)(5660300002)(33656002)(8676002)(2906002)(336012)(21314003); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 89a5dfe4-a091-47a9-ae87-08d8223549be X-Forefront-PRVS: 0457F11EAF X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kyxYcOgqPOsRQBekZvt1JlnRIRN3CGaEuvkOrZykvhcw+U3GsD7+C/iN3PXH6/1gGkvvsJbNbi69PhlIdDL5CKJrPuUhKzSi8Ri2XFAuQQXVqV+TQmZWOJ601jz+Ksg7mFOeQhy6DAs+lQdJuKs0s3UnovXnGSCVK7PHoBIzEZnRw5TiO4pVnYIAt/Zr5519vP4Wzcf3n+DZWFL+PpEpUcsL6DzXQec6cPkz4L9/JZi2c8VNGRv2WksyEuQObv0BbjbLDhiArU8+waWwHYUTyC8vlr3pPNOyhbf5MaZe+X9Z3BSFAjW2n45Agy0SgEUMGyC2OwwQ1VmKz+nA++OesLWdvC/RGvdr+GUKWUfY+mcP0cg21yyeIueEOMoyqSxER7YvxsA605eE0uddOcPIYGudfv/M3dfQG46fqH6sug4= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2020 05:19:20.1934 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bbec3f64-d51e-4e36-ba22-08d822354d83 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-AuthSource: DB5EUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3818 Subject: Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy 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, Konstantin, David I'm Feifei Wang from Arm. Sorry to make the following request: Would you please do some ring performance tests of this patch in your platf= orms at the time you are free? And I want to know whether this patch has a significant impact on other pla= tforms except ARM. Thanks very much. Feifei > -----Original Message----- > From: Feifei Wang > Sent: 2020=1B$BG/=1B(B7=1B$B7n=1B(B3=1B$BF|=1B(B 18:27 > To: Honnappa Nagarahalli ; Konstantin > Ananyev > Cc: dev@dpdk.org; nd ; Feifei Wang > > Subject: [PATCH 3/3] ring: use element APIs to implement legacy APIs >=20 > Use rte_ring_xxx_elem_xxx APIs to replace legacy API implementation. > This reduces code duplication and improves code maintenance. >=20 > aarch64: > HW:N1sdp, 1 socket, 4 cores, 1 thread/core, 2.6GHz OS:Ubuntu 18.04.1 LTS, > Kernel: 5.4.0+ > DPDK: 20.05-rc3, Configuration: arm64-n1sdp-linux-gcc > gcc:9.2.1 >=20 > $sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2 > RTE>>ring_perf_autotest >=20 > test results on aarch64 in the case of esize 4: >=20 > without this patch with this patch > Testing burst enq/deq > legacy APIs: SP/SC: burst (size: 8): 1.11 1.10 > legacy APIs: SP/SC: burst (size: 32): 1.95 1.97 > legacy APIs: MP/MC: burst (size: 8): 1.86 1.94 > legacy APIs: MP/MC: burst (size: 32): 2.65 2.69 > Testing bulk enq/deq > legacy APIs: SP/SC: bulk (size: 8): 1.08 1.09 > legacy APIs: SP/SC: bulk (size: 32): 1.89 1.90 > legacy APIs: MP/MC: bulk (size: 8): 1.85 1.98 > legacy APIs: MP/MC: bulk (size: 32): 2.65 2.69 >=20 > x86: > HW: dell, CPU Intel(R) Xeon(R) Gold 6240, 2 sockets, 18 cores/socket, > 1 thread/core, 3.3GHz > OS: Ubuntu 20.04 LTS, Kernel: 5.4.0-37-generic > DPDK: 20.05-rc3, Configuration: x86_64-native-linuxapp-gcc > gcc: 9.3.0 >=20 > $sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 > RTE>>ring_perf_autotest >=20 > test results on x86 in the case of esize 4: >=20 > without this patch with this patch > Testing burst enq/deq > legacy APIs: SP/SC: burst (size: 8): 29.35 27.78 > legacy APIs: SP/SC: burst (size: 32): 73.11 73.39 > legacy APIs: MP/MC: burst (size: 8): 62.36 62.37 > legacy APIs: MP/MC: burst (size: 32): 101.01 101.03 > Testing bulk enq/deq > legacy APIs: SP/SC: bulk (size: 8): 25.94 29.55 > legacy APIs: SP/SC: bulk (size: 32): 70.00 78.87 > legacy APIs: MP/MC: bulk (size: 8): 63.41 62.48 > legacy APIs: MP/MC: bulk (size: 32): 105.86 103.84 >=20 > Summary: > In aarch64 server with this patch, there is almost no performance differe= nce. > In x86 server with this patch, in some cases, the performance slightly > improve, in other cases, the performance slightly drop. >=20 > Signed-off-by: Feifei Wang > Reviewed-by: Honnappa Nagarahalli > Reviewed-by: Ruifeng Wang > --- > lib/librte_ring/rte_ring.h | 284 ++++--------------------------------- > 1 file changed, 30 insertions(+), 254 deletions(-) >=20 > diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h inde= x > 35f3f8c42..2a2190bfc 100644 > --- a/lib/librte_ring/rte_ring.h > +++ b/lib/librte_ring/rte_ring.h > @@ -191,168 +191,6 @@ void rte_ring_free(struct rte_ring *r); > */ > void rte_ring_dump(FILE *f, const struct rte_ring *r); >=20 > -/* the actual enqueue of pointers on the ring. > - * Placed here since identical code needed in both > - * single and multi producer enqueue functions */ -#define > ENQUEUE_PTRS(r, ring_start, prod_head, obj_table, n, obj_type) do { \ > - unsigned int i; \ > - const uint32_t size =3D (r)->size; \ > - uint32_t idx =3D prod_head & (r)->mask; \ > - obj_type *ring =3D (obj_type *)ring_start; \ > - if (likely(idx + n < size)) { \ > - for (i =3D 0; i < (n & ~0x3); i +=3D 4, idx +=3D 4) { \ > - ring[idx] =3D obj_table[i]; \ > - ring[idx + 1] =3D obj_table[i + 1]; \ > - ring[idx + 2] =3D obj_table[i + 2]; \ > - ring[idx + 3] =3D obj_table[i + 3]; \ > - } \ > - switch (n & 0x3) { \ > - case 3: \ > - ring[idx++] =3D obj_table[i++]; /* fallthrough */ \ > - case 2: \ > - ring[idx++] =3D obj_table[i++]; /* fallthrough */ \ > - case 1: \ > - ring[idx++] =3D obj_table[i++]; \ > - } \ > - } else { \ > - for (i =3D 0; idx < size; i++, idx++)\ > - ring[idx] =3D obj_table[i]; \ > - for (idx =3D 0; i < n; i++, idx++) \ > - ring[idx] =3D obj_table[i]; \ > - } \ > -} while (0) > - > -/* the actual copy of pointers on the ring to obj_table. > - * Placed here since identical code needed in both > - * single and multi consumer dequeue functions */ -#define > DEQUEUE_PTRS(r, ring_start, cons_head, obj_table, n, obj_type) do { \ > - unsigned int i; \ > - uint32_t idx =3D cons_head & (r)->mask; \ > - const uint32_t size =3D (r)->size; \ > - obj_type *ring =3D (obj_type *)ring_start; \ > - if (likely(idx + n < size)) { \ > - for (i =3D 0; i < (n & ~0x3); i +=3D 4, idx +=3D 4) {\ > - obj_table[i] =3D ring[idx]; \ > - obj_table[i + 1] =3D ring[idx + 1]; \ > - obj_table[i + 2] =3D ring[idx + 2]; \ > - obj_table[i + 3] =3D ring[idx + 3]; \ > - } \ > - switch (n & 0x3) { \ > - case 3: \ > - obj_table[i++] =3D ring[idx++]; /* fallthrough */ \ > - case 2: \ > - obj_table[i++] =3D ring[idx++]; /* fallthrough */ \ > - case 1: \ > - obj_table[i++] =3D ring[idx++]; \ > - } \ > - } else { \ > - for (i =3D 0; idx < size; i++, idx++) \ > - obj_table[i] =3D ring[idx]; \ > - for (idx =3D 0; i < n; i++, idx++) \ > - obj_table[i] =3D ring[idx]; \ > - } \ > -} while (0) > - > -/* Between load and load. there might be cpu reorder in weak model > - * (powerpc/arm). > - * There are 2 choices for the users > - * 1.use rmb() memory barrier > - * 2.use one-direction load_acquire/store_release barrier,defined by > - * CONFIG_RTE_USE_C11_MEM_MODEL=3Dy > - * It depends on performance test results. > - * By default, move common functions to rte_ring_generic.h > - */ > -#ifdef RTE_USE_C11_MEM_MODEL > -#include "rte_ring_c11_mem.h" > -#else > -#include "rte_ring_generic.h" > -#endif > - > -/** > - * @internal Enqueue several objects on the ring > - * > - * @param r > - * A pointer to the ring structure. > - * @param obj_table > - * A pointer to a table of void * pointers (objects). > - * @param n > - * The number of objects to add in the ring from the obj_table. > - * @param behavior > - * RTE_RING_QUEUE_FIXED: Enqueue a fixed number of items from a > ring > - * RTE_RING_QUEUE_VARIABLE: Enqueue as many items as possible from > ring > - * @param is_sp > - * Indicates whether to use single producer or multi-producer head upd= ate > - * @param free_space > - * returns the amount of space after the enqueue operation has finishe= d > - * @return > - * Actual number of objects enqueued. > - * If behavior =3D=3D RTE_RING_QUEUE_FIXED, this will be 0 or n only. > - */ > -static __rte_always_inline unsigned int -__rte_ring_do_enqueue(struct > rte_ring *r, void * const *obj_table, > - unsigned int n, enum rte_ring_queue_behavior behavior, > - unsigned int is_sp, unsigned int *free_space) > -{ > - uint32_t prod_head, prod_next; > - uint32_t free_entries; > - > - n =3D __rte_ring_move_prod_head(r, is_sp, n, behavior, > - &prod_head, &prod_next, &free_entries); > - if (n =3D=3D 0) > - goto end; > - > - ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); > - > - update_tail(&r->prod, prod_head, prod_next, is_sp, 1); > -end: > - if (free_space !=3D NULL) > - *free_space =3D free_entries - n; > - return n; > -} > - > -/** > - * @internal Dequeue several objects from the ring > - * > - * @param r > - * A pointer to the ring structure. > - * @param obj_table > - * A pointer to a table of void * pointers (objects). > - * @param n > - * The number of objects to pull from the ring. > - * @param behavior > - * RTE_RING_QUEUE_FIXED: Dequeue a fixed number of items from a > ring > - * RTE_RING_QUEUE_VARIABLE: Dequeue as many items as possible from > ring > - * @param is_sc > - * Indicates whether to use single consumer or multi-consumer head > update > - * @param available > - * returns the number of remaining ring entries after the dequeue has > finished > - * @return > - * - Actual number of objects dequeued. > - * If behavior =3D=3D RTE_RING_QUEUE_FIXED, this will be 0 or n only= . > - */ > -static __rte_always_inline unsigned int -__rte_ring_do_dequeue(struct > rte_ring *r, void **obj_table, > - unsigned int n, enum rte_ring_queue_behavior behavior, > - unsigned int is_sc, unsigned int *available) > -{ > - uint32_t cons_head, cons_next; > - uint32_t entries; > - > - n =3D __rte_ring_move_cons_head(r, (int)is_sc, n, behavior, > - &cons_head, &cons_next, &entries); > - if (n =3D=3D 0) > - goto end; > - > - DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); > - > - update_tail(&r->cons, cons_head, cons_next, is_sc, 0); > - > -end: > - if (available !=3D NULL) > - *available =3D entries - n; > - return n; > -} > - > /** > * Enqueue several objects on the ring (multi-producers safe). > * > @@ -375,8 +213,8 @@ static __rte_always_inline unsigned int > rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, > unsigned int n, unsigned int *free_space) { > - return __rte_ring_do_enqueue(r, obj_table, n, > RTE_RING_QUEUE_FIXED, > - RTE_RING_SYNC_MT, free_space); > + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, sizeof(void *), > + n, free_space); > } >=20 > /** > @@ -398,8 +236,8 @@ static __rte_always_inline unsigned int > rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, > unsigned int n, unsigned int *free_space) { > - return __rte_ring_do_enqueue(r, obj_table, n, > RTE_RING_QUEUE_FIXED, > - RTE_RING_SYNC_ST, free_space); > + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, sizeof(void *), > + n, free_space); > } >=20 > /** > @@ -425,24 +263,8 @@ static __rte_always_inline unsigned int > rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, > unsigned int n, unsigned int *free_space) { > - switch (r->prod.sync_type) { > - case RTE_RING_SYNC_MT: > - return rte_ring_mp_enqueue_bulk(r, obj_table, n, > free_space); > - case RTE_RING_SYNC_ST: > - return rte_ring_sp_enqueue_bulk(r, obj_table, n, > free_space); > -#ifdef ALLOW_EXPERIMENTAL_API > - case RTE_RING_SYNC_MT_RTS: > - return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, > - free_space); > - case RTE_RING_SYNC_MT_HTS: > - return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, > - free_space); > -#endif > - } > - > - /* valid ring should never reach this point */ > - RTE_ASSERT(0); > - return 0; > + return rte_ring_enqueue_bulk_elem(r, obj_table, sizeof(void *), > + n, free_space); > } >=20 > /** > @@ -462,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * > const *obj_table, static __rte_always_inline int > rte_ring_mp_enqueue(struct rte_ring *r, void *obj) { > - return rte_ring_mp_enqueue_bulk(r, &obj, 1, NULL) ? 0 : -ENOBUFS; > + return rte_ring_mp_enqueue_elem(r, obj, sizeof(void *)); > } >=20 > /** > @@ -479,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj) > static __rte_always_inline int rte_ring_sp_enqueue(struct rte_ring *r, v= oid > *obj) { > - return rte_ring_sp_enqueue_bulk(r, &obj, 1, NULL) ? 0 : -ENOBUFS; > + return rte_ring_sp_enqueue_elem(r, obj, sizeof(void *)); > } >=20 > /** > @@ -500,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) > static __rte_always_inline int rte_ring_enqueue(struct rte_ring *r, void= *obj) > { > - return rte_ring_enqueue_bulk(r, &obj, 1, NULL) ? 0 : -ENOBUFS; > + return rte_ring_enqueue_elem(r, obj, sizeof(void *)); > } >=20 > /** > @@ -525,8 +347,8 @@ static __rte_always_inline unsigned int > rte_ring_mc_dequeue_bulk(struct rte_ring *r, void **obj_table, > unsigned int n, unsigned int *available) { > - return __rte_ring_do_dequeue(r, obj_table, n, > RTE_RING_QUEUE_FIXED, > - RTE_RING_SYNC_MT, available); > + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, sizeof(void *), > + n, available); > } >=20 > /** > @@ -549,8 +371,8 @@ static __rte_always_inline unsigned int > rte_ring_sc_dequeue_bulk(struct rte_ring *r, void **obj_table, > unsigned int n, unsigned int *available) { > - return __rte_ring_do_dequeue(r, obj_table, n, > RTE_RING_QUEUE_FIXED, > - RTE_RING_SYNC_ST, available); > + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, sizeof(void *), > + n, available); > } >=20 > /** > @@ -576,22 +398,8 @@ static __rte_always_inline unsigned int > rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int = n, > unsigned int *available) > { > - switch (r->cons.sync_type) { > - case RTE_RING_SYNC_MT: > - return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); > - case RTE_RING_SYNC_ST: > - return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); > -#ifdef ALLOW_EXPERIMENTAL_API > - case RTE_RING_SYNC_MT_RTS: > - return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, > available); > - case RTE_RING_SYNC_MT_HTS: > - return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, > available); > -#endif > - } > - > - /* valid ring should never reach this point */ > - RTE_ASSERT(0); > - return 0; > + return rte_ring_dequeue_bulk_elem(r, obj_table, sizeof(void *), > + n, available); > } >=20 > /** > @@ -612,7 +420,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void > **obj_table, unsigned int n, static __rte_always_inline int > rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p) { > - return rte_ring_mc_dequeue_bulk(r, obj_p, 1, NULL) ? 0 : -ENOENT; > + return rte_ring_mc_dequeue_elem(r, obj_p, sizeof(void *)); > } >=20 > /** > @@ -630,7 +438,7 @@ rte_ring_mc_dequeue(struct rte_ring *r, void > **obj_p) static __rte_always_inline int rte_ring_sc_dequeue(struct > rte_ring *r, void **obj_p) { > - return rte_ring_sc_dequeue_bulk(r, obj_p, 1, NULL) ? 0 : -ENOENT; > + return rte_ring_sc_dequeue_elem(r, obj_p, sizeof(void *)); > } >=20 > /** > @@ -652,7 +460,7 @@ rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p) > static __rte_always_inline int rte_ring_dequeue(struct rte_ring *r, void > **obj_p) { > - return rte_ring_dequeue_bulk(r, obj_p, 1, NULL) ? 0 : -ENOENT; > + return rte_ring_dequeue_elem(r, obj_p, sizeof(void *)); > } >=20 > /** > @@ -860,8 +668,8 @@ static __rte_always_inline unsigned int > rte_ring_mp_enqueue_burst(struct rte_ring *r, void * const *obj_table, > unsigned int n, unsigned int *free_space) { > - return __rte_ring_do_enqueue(r, obj_table, n, > - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, > free_space); > + return rte_ring_mp_enqueue_burst_elem(r, obj_table, sizeof(void > *), > + n, free_space); > } >=20 > /** > @@ -883,8 +691,8 @@ static __rte_always_inline unsigned int > rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table, > unsigned int n, unsigned int *free_space) { > - return __rte_ring_do_enqueue(r, obj_table, n, > - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, > free_space); > + return rte_ring_sp_enqueue_burst_elem(r, obj_table, sizeof(void *), > + n, free_space); > } >=20 > /** > @@ -910,24 +718,8 @@ static __rte_always_inline unsigned int > rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table, > unsigned int n, unsigned int *free_space) { > - switch (r->prod.sync_type) { > - case RTE_RING_SYNC_MT: > - return rte_ring_mp_enqueue_burst(r, obj_table, n, > free_space); > - case RTE_RING_SYNC_ST: > - return rte_ring_sp_enqueue_burst(r, obj_table, n, > free_space); > -#ifdef ALLOW_EXPERIMENTAL_API > - case RTE_RING_SYNC_MT_RTS: > - return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, > - free_space); > - case RTE_RING_SYNC_MT_HTS: > - return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, > - free_space); > -#endif > - } > - > - /* valid ring should never reach this point */ > - RTE_ASSERT(0); > - return 0; > + return rte_ring_enqueue_burst_elem(r, obj_table, sizeof(void *), > + n, free_space); > } >=20 > /** > @@ -954,8 +746,8 @@ static __rte_always_inline unsigned int > rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table, > unsigned int n, unsigned int *available) { > - return __rte_ring_do_dequeue(r, obj_table, n, > - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, > available); > + return rte_ring_mc_dequeue_burst_elem(r, obj_table, sizeof(void > *), > + n, available); > } >=20 > /** > @@ -979,8 +771,8 @@ static __rte_always_inline unsigned int > rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table, > unsigned int n, unsigned int *available) { > - return __rte_ring_do_dequeue(r, obj_table, n, > - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, > available); > + return rte_ring_sc_dequeue_burst_elem(r, obj_table, sizeof(void *), > + n, available); > } >=20 > /** > @@ -1006,24 +798,8 @@ static __rte_always_inline unsigned int > rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, > unsigned int n, unsigned int *available) { > - switch (r->cons.sync_type) { > - case RTE_RING_SYNC_MT: > - return rte_ring_mc_dequeue_burst(r, obj_table, n, > available); > - case RTE_RING_SYNC_ST: > - return rte_ring_sc_dequeue_burst(r, obj_table, n, available); > -#ifdef ALLOW_EXPERIMENTAL_API > - case RTE_RING_SYNC_MT_RTS: > - return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, > - available); > - case RTE_RING_SYNC_MT_HTS: > - return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, > - available); > -#endif > - } > - > - /* valid ring should never reach this point */ > - RTE_ASSERT(0); > - return 0; > + return rte_ring_dequeue_burst_elem(r, obj_table, sizeof(void *), > + n, available); > } >=20 > #ifdef __cplusplus > -- > 2.17.1