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 E4FA1A00BE; Tue, 7 Jul 2020 18:22:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A0E891DB55; Tue, 7 Jul 2020 18:22:11 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60056.outbound.protection.outlook.com [40.107.6.56]) by dpdk.org (Postfix) with ESMTP id AA03B1DA70 for ; Tue, 7 Jul 2020 18:22:09 +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=HyUdTmBy/1m4x7Fml3rNGFrqlfv6yOZD+5tnME+NCV4=; b=vTXTc67ZWfx5uoiTKjmykZILYjqn0FjYzmDNQ5R1UbwKuWDP8ekC2EbwetkTvAfP+aLkR8S+ozl/Yo++EQ2PGY+rri5uYLh4g8vfTKoVK9oQqQFTqeSYrPdivYMMRcbJ1rbl/VAt8iyXyqAS8RAuFd+R2cvDun3javuDsVwyepA= Received: from DB8PR09CA0023.eurprd09.prod.outlook.com (2603:10a6:10:a0::36) by VI1PR0801MB2125.eurprd08.prod.outlook.com (2603:10a6:800:5b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.27; Tue, 7 Jul 2020 16:22:07 +0000 Received: from DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:a0:cafe::da) by DB8PR09CA0023.outlook.office365.com (2603:10a6:10:a0::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.23 via Frontend Transport; Tue, 7 Jul 2020 16:22:07 +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 DB5EUR03FT062.mail.protection.outlook.com (10.152.20.197) 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 16:22:07 +0000 Received: ("Tessian outbound 114f46c34313:v62"); Tue, 07 Jul 2020 16:22:07 +0000 X-CR-MTA-TID: 64aa7808 Received: from 80571cd3249a.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FF087DA5-587D-4751-89CC-D6844A6446B1.1; Tue, 07 Jul 2020 16:22:02 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 80571cd3249a.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Jul 2020 16:22:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=emydhC26xeHsPB47EWQnPMT5//jjmd75WllK9jECm+xNcTVbRUSy63uBa46qupBcW+9lKyLLyIq2t8gYh2lM1SFVSHF2Uww7JRhQ1uCErGMnUDLzDaSQL8604BDMOIK0v16VsFn8rAee1ubsurf89h7rTvuZG1/pSixhlzlFS5pZluFQeEQwul7ZWsGj6FUnj+oc3MnE6QH3e2jd6s2O/UGUdIAKzoZyTohR3EK3iQdVh4R2Xim36Ym4VTuqOe5j04Kk6SEwYZ2Kt5yQrLIiuC5N4XfF9H/leKZEUoqFXl1DuG+R79LHa7uvnOD9kJlYofOOfvBzc3jmxexjWg15xQ== 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=HyUdTmBy/1m4x7Fml3rNGFrqlfv6yOZD+5tnME+NCV4=; b=oIkZm9VSvFHlZquNt/VUn0FtlUyA7cXL623uaKqfyS8l6boeaTtHWL95YXoauhqUO8wXeYjjPxzpZXDVrABNzavTSir0v40pqyokqCFrMiSV+pFk2BQHLdvE/rjXXnLyF+7khA3MbGoJ0RAf7BQwdssMYw5SxfwSWCS2O5TW83eprGmBbQKnFtYkVDLDtglWxfAQeXdpQF1t+Qomz81nESplKUGx/rYqMG98vsd7Sr/RR/s1tCvd6rivZomjuO30wQDhoJi82x7DkIqgqFTF/h0aBiWW8WqpKdul3FylqeKd1usFIAbH1APZMEuRv/sR7zRGDnsITWPqOTVaGPG5DQ== 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=HyUdTmBy/1m4x7Fml3rNGFrqlfv6yOZD+5tnME+NCV4=; b=vTXTc67ZWfx5uoiTKjmykZILYjqn0FjYzmDNQ5R1UbwKuWDP8ekC2EbwetkTvAfP+aLkR8S+ozl/Yo++EQ2PGY+rri5uYLh4g8vfTKoVK9oQqQFTqeSYrPdivYMMRcbJ1rbl/VAt8iyXyqAS8RAuFd+R2cvDun3javuDsVwyepA= Received: from DB6PR0802MB2216.eurprd08.prod.outlook.com (2603:10a6:4:85::9) by DB8PR08MB5193.eurprd08.prod.outlook.com (2603:10a6:10:e6::30) 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 16:22:00 +0000 Received: from DB6PR0802MB2216.eurprd08.prod.outlook.com ([fe80::9d1d:207b:e89d:199d]) by DB6PR0802MB2216.eurprd08.prod.outlook.com ([fe80::9d1d:207b:e89d:199d%10]) with mapi id 15.20.3153.029; Tue, 7 Jul 2020 16:21:59 +0000 From: Honnappa Nagarahalli To: "Ananyev, Konstantin" , Feifei Wang , "drc@linux.vnet.ibm.com" CC: "dev@dpdk.org" , nd , Ruifeng Wang , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH 3/3] ring: use element APIs to implement legacy APIs Thread-Index: AQHWUSSMQT4gUrpYPUKzByelG1Yowqj7emsggACySICAACQXsA== Date: Tue, 7 Jul 2020 16:21:59 +0000 Message-ID: References: <20200703102651.8918-1-feifei.wang2@arm.com> <20200703102651.8918-4-feifei.wang2@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: ddd7f257-fb86-479a-b965-6f186a09f959.0 x-checkrecipientchecked: true Authentication-Results-Original: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [70.112.90.121] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 84b13887-1dd6-440b-45da-08d82291e4ab x-ms-traffictypediagnostic: DB8PR08MB5193:|VI1PR0801MB2125: 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: oE3v10IhF3FlOlDoNs1RRSkdvP6T0RBx+OMJvmMwSxZ2t4YEAyMZc14A8dRIKzdEXkzhwD0Xvv+9GeB27gn3JNmuJz50npQxeuYBdd+slyU9TbHP0LIRqz+bdX6cEQba9fN4naR0ySdv8nnezYIM0cv2HVL/ie3yz1iv1WfWNt1cVEH9qk1DVGja0xGaYrF18PNIjU48gM59RvAz6KfZKdKpPfIxh1cr9NnX2xKojRSaQ1g8pz9gQsNiu2afN12BJN+WL8BPe3yaVKG7iZt8qsJS0sr7qJyprGVnrxhmUjXQ6UM7GU+XVKNyPy6dolibSCoF/luLexYYas570opBAgWJT7yC8IXX8qEHo6V+dHy7qxoWG5kYg8DZmGz1mdEg X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0802MB2216.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(396003)(39860400002)(136003)(346002)(376002)(30864003)(83380400001)(26005)(110136005)(8676002)(64756008)(33656002)(66476007)(53546011)(66446008)(66556008)(7696005)(66946007)(76116006)(86362001)(478600001)(8936002)(316002)(6506007)(4326008)(186003)(5660300002)(2906002)(55016002)(9686003)(71200400001)(52536014)(54906003)(21314003)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: AMgenbwiv/TlCq/KcLXuhLjuurIvzLz5i6aT/SqufYP7/fZS2hLtLNDJYq1HAIlNTYwq8Tplzjo5gpYsXDRau7BZ+Tk6yBkTuYhqBBap3kTiR3QhbnlXabeCg/5AMlPXC3GulG8ZnvSxUdv9kLLXUG9txhxTUEhRCRAE+9XYb6ALpBTsQ4mdcqedq1GU7elChfYCco3AbC0Y0wFTHFW896vRHYiM/FYrr8bpoD3g5bJx5ohM/i2iO6PlC6Fxf+5AuU4PlcP9XURq2I23Sv3wUgqwDvoVZYgSf9BAPEkKA3iCGQdhF7fVELuu95fsnYUdtTfxKGeauVYiC0u9+Z+cnVSgoHsUSrC8gLuGJIw+0BenJdh6GPWRSojyiiQxKSMKEZH9ghz3U1e1frWUn3cinKMsv5HOh7s2NrS/PA7U+6fcBT2vlg4x/pV7hUxApy8+RqJUurNErf7tXt1WvqgFbjkbNyd/U+qo9UsDiY4JERvr5FZJlsSJYPonVaYRCmeF Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5193 Original-Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT062.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)(376002)(346002)(39860400002)(136003)(396003)(46966005)(30864003)(2906002)(83380400001)(55016002)(82740400003)(33656002)(8936002)(478600001)(9686003)(47076004)(82310400002)(7696005)(186003)(5660300002)(70586007)(8676002)(81166007)(356005)(4326008)(70206006)(316002)(54906003)(336012)(110136005)(6506007)(52536014)(26005)(53546011)(86362001)(21314003); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 33bf3eba-e442-4c7f-3dda-08d82291e031 X-Forefront-PRVS: 0457F11EAF X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XbE5XDY/Zcq2y0VQ9J0bDwzUjvqWaa/TBmlQNJzb7VlPeTgzeQ3Eooi6uqOs4dc1amRr5m8sbbefShpTwTbVZ3TgQVByyYPcEuvADoqOaeNZo1i4u08TuiU+SDSSeTH5mRJPP5vInIuiB/VWJSJ0sLZrvGZoe+8v7rtMA0wHwDrq+Zn/2Gjgzbo/1cfTCCAuGAbQRfm3wEbLbYi4L0STmJAKBVDF0bDxYzm9e2Bwqy+wbx/3LiSyWTyTbJe0Yy0VDGowwqGiljuTL5nwZueCwO/1g7O+Y7CM4mPOKvP+j4XCf9hNIF9/fPJ2F9sn1Pq9M3GVVw4DrNWidUllyJY5FjiXfHBaPHzPh9Ld2fiRy0a5jfyMQwjXhnQ7kGtR7tf1t2pmn3do7Sc2Y0/rAzJqO0rQsJGRyWyMVYBr8+PxIKU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2020 16:22:07.4877 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84b13887-1dd6-440b-45da-08d82291e4ab 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: DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2125 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" >=20 > Hi Feifei, >=20 > > 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 > platforms at the time you are free? > > And I want to know whether this patch has a significant impact on other > platforms except ARM. >=20 > I run few tests on SKX box and so far didn=1B$B!G=1B(Bt notice any real p= erf difference. Thanks Konstantin for testing this. > Konstantin >=20 > > 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 > > > > > > Use rte_ring_xxx_elem_xxx APIs to replace legacy API implementation. > > > This reduces code duplication and improves code maintenance. > > > > > > 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 > > > > > > $sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2 > > > RTE>>ring_perf_autotest > > > > > > test results on aarch64 in the case of esize 4: > > > > > > without this patch with this p= atch > > > 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 > > > > > > 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 > > > > > > $sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 > > > RTE>>ring_perf_autotest > > > > > > test results on x86 in the case of esize 4: > > > > > > without this patch with this p= atch > > > 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.0= 3 > > > 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.8= 4 > > > > > > Summary: > > > In aarch64 server with this patch, there is almost no performance > difference. > > > In x86 server with this patch, in some cases, the performance > > > slightly improve, in other cases, the performance slightly drop. I suggest removing the perf data from the commit message, as Konstantin con= firmed there is no perf drop on x86 either. > > > > > > 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(-) > > > > > > diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h > > > index 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); > > > > > > -/* 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 > update > > > - * @param free_space > > > - * returns the amount of space after the enqueue operation has fin= ished > > > - * @return > > > - * Actual number of objects enqueued. > > > - * If behavior =3D=3D RTE_RING_QUEUE_FIXED, this will be 0 or n on= ly. > > > - */ > > > -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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 *)); > > > } > > > > > > /** > > > @@ -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, void > > > *obj) { > > > - return rte_ring_sp_enqueue_bulk(r, &obj, 1, NULL) ? 0 : -ENOBUFS; > > > + return rte_ring_sp_enqueue_elem(r, obj, sizeof(void *)); > > > } > > > > > > /** > > > @@ -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 *)); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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 *)); > > > } > > > > > > /** > > > @@ -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 *)); > > > } > > > > > > /** > > > @@ -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 *)); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > /** > > > @@ -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); > > > } > > > > > > #ifdef __cplusplus > > > -- > > > 2.17.1