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 C03B2A329E for ; Wed, 23 Oct 2019 21:12:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E9ECF1C2EF; Wed, 23 Oct 2019 21:12:15 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20085.outbound.protection.outlook.com [40.107.2.85]) by dpdk.org (Postfix) with ESMTP id 8F1B21C2A3 for ; Wed, 23 Oct 2019 21:12:14 +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=o0lX+sZmTwDqeBWFCZW+68/2a/mwwaDWMcDl4AB+NUI=; b=k0D5hTgfzMjim3FnmuQGm21s+sk6pRyy6bbvlhLuxl7ooB2NqXQ8mluIrnrPf4gf8He3lt/aFGhlJnIcAyixVrd/+MUzMyJzsWYmGO60NS9fgHFcF/N0quOt/vG42rDVAtQCnEDKPdCKAcgwbWIhVBM1sHDZ++JBv9aTX1K2HZU= Received: from DB6PR0801CA0044.eurprd08.prod.outlook.com (2603:10a6:4:2b::12) by AM5PR0801MB2068.eurprd08.prod.outlook.com (2603:10a6:203:4e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.24; Wed, 23 Oct 2019 19:12:13 +0000 Received: from DB5EUR03FT050.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::209) by DB6PR0801CA0044.outlook.office365.com (2603:10a6:4:2b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.21 via Frontend Transport; Wed, 23 Oct 2019 19:12:13 +0000 Authentication-Results: spf=fail (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=none action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 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 DB5EUR03FT050.mail.protection.outlook.com (10.152.21.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.23 via Frontend Transport; Wed, 23 Oct 2019 19:12:13 +0000 Received: ("Tessian outbound 0939a6bab6b1:v33"); Wed, 23 Oct 2019 19:12:12 +0000 X-CR-MTA-TID: 64aa7808 Received: from d67a295c1b6d.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.9.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 48761500-BBAE-4B98-BE46-8AB28D8FF13E.1; Wed, 23 Oct 2019 19:12:06 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2056.outbound.protection.outlook.com [104.47.9.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d67a295c1b6d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 23 Oct 2019 19:12:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VLO/4OpgTLpdQDuQLzGvaXEKNlpRrX5pW8A0sCpsLndepIK1gCxT6BHlBcDCkquBunq6N8k0h6+dHBazz4T6j5Y4T+m0iw9+TuGJQiiTfpuAJ4Vb8Rhw/BEr3lxGPO2C4wcoXps8ANzx58XWVayZLBjF8mTxBvnZJ7VWnRRn1wqZK/XmPEfx6rM+pVVAiy+iOzXFeM2njSwrINGzD/1RXu9Iz2CYV3kKS/6NcQ4sg6NTQ2n5Q+P8UhZY0xef0a5UuaMobAOgy1cYpMM/TkgudkpuPa4BARD5DDHTf6keDWUKjXYz3nelVNCR9q2KViY7sm+uALvHT7Dfj6jnXScEYQ== 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=o0lX+sZmTwDqeBWFCZW+68/2a/mwwaDWMcDl4AB+NUI=; b=d4yYO0WeSDoWgyYenUGsmpl29cx1UttGz7Pb7p9rdKchOiHp0BVmUc8eSaqFFjIt3SVuEDIQ750g4aA3JxfbhQefpGKzaPlTN7HrxO4SDzxrZ85Ezeb0Fm2oHJg3t2GcGVrEpla4lloKlwsNbg94OyRkv0OYOKNbx1Nsfprd2GOvy/F2bgJBHpyFdEVVW9n3d7cNrQfQSHDfETewws7zinWLsnl9pAcUQOOFd8q0kYp1nrupI8XIpr9lmpWamYF+1TzYvw6UwIjIzkcJ1miy4SVHYqc9pYamcaAnLzTzyWXEJurO5f/QBDj4RFZ8UcGeTBb/WXMPl8asw4oA0c9Y6w== 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=o0lX+sZmTwDqeBWFCZW+68/2a/mwwaDWMcDl4AB+NUI=; b=k0D5hTgfzMjim3FnmuQGm21s+sk6pRyy6bbvlhLuxl7ooB2NqXQ8mluIrnrPf4gf8He3lt/aFGhlJnIcAyixVrd/+MUzMyJzsWYmGO60NS9fgHFcF/N0quOt/vG42rDVAtQCnEDKPdCKAcgwbWIhVBM1sHDZ++JBv9aTX1K2HZU= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.27) by VE1PR08MB5102.eurprd08.prod.outlook.com (20.179.30.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.24; Wed, 23 Oct 2019 19:12:04 +0000 Received: from VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::8c82:8d9c:c78d:22a6]) by VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::8c82:8d9c:c78d:22a6%7]) with mapi id 15.20.2367.022; Wed, 23 Oct 2019 19:12:04 +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" , "drc@linux.vnet.ibm.com" , "hemant.agrawal@nxp.com" , "dev@dpdk.org" , Dharmik Thakkar , "Ruifeng Wang (Arm Technology China)" , "Gavin Hu (Arm Technology China)" , Honnappa Nagarahalli , nd , nd Thread-Topic: [RFC v6 2/6] lib/ring: apis to support configurable element size Thread-Index: AQHViYidZqf++36Yn020cOGQlVjVI6dolrAA Date: Wed, 23 Oct 2019 19:12:03 +0000 Message-ID: References: <20190906190510.11146-1-honnappa.nagarahalli@arm.com> <20191021002300.26497-1-honnappa.nagarahalli@arm.com> <20191021002300.26497-3-honnappa.nagarahalli@arm.com> <20191023095951.GD25286@glumotte.dev.6wind.com> In-Reply-To: <20191023095951.GD25286@glumotte.dev.6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 126a1ee8-ffbf-4e17-b040-95abc794d6e1.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: 2652639b-5422-4bed-7a67-08d757ece94d X-MS-TrafficTypeDiagnostic: VE1PR08MB5102:|VE1PR08MB5102:|AM5PR0801MB2068: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; x-forefront-prvs: 019919A9E4 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(39860400002)(366004)(376002)(396003)(189003)(199004)(66556008)(64756008)(66476007)(54906003)(66446008)(3846002)(86362001)(316002)(478600001)(6116002)(66946007)(2906002)(305945005)(7736002)(76116006)(229853002)(7416002)(74316002)(6246003)(76176011)(4326008)(102836004)(186003)(6506007)(81166006)(33656002)(446003)(11346002)(5660300002)(26005)(9686003)(6916009)(66066001)(256004)(71190400001)(71200400001)(486006)(14454004)(7696005)(99286004)(55016002)(8676002)(81156014)(8936002)(6436002)(52536014)(476003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5102; H:VE1PR08MB5149.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ahHmSt4hExJhx+k6xIUMQvXAoa8p7dKR38xy56TJRJ3qcWNEYCDhYxQO1+14+mrKm6VVQqer5W6jPRQMcir6bQZlhdTe/mBr31lG+tSGGNHHpG+7g7hgQnbQLszL+3f/qnfB/4pht0oTDoEJHRNt55/SHNPkNfOAj2ksYkLuhdsXq8e0efCedptwlMI+8g/GgFz9XrmHrteW+ovLKBtXGXEcz6agPgB8hriykVzcR+Q3EGKHc+DrFjuGFj+cFIZfYOWaIbAk+W0sjMp8yEPsl5n9D5rDa3ToC0+NR/iVtDYGpCOZzXvSTbV/anw7gxyxN/TaEmbtt827XSBhEWDKQ2sJ5IAfZeOxvkdzhJSQsGb7V27/RduLWuU5nHm6894YEmEJ0vCGl3r5EXFqE0d1TgzfoyMGF5V+gQ+p2RuDWi933BwP7oQ3dflbUHUZft4F Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5102 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT050.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)(136003)(39860400002)(376002)(346002)(396003)(1110001)(339900001)(199004)(189003)(22756006)(4326008)(55016002)(229853002)(6116002)(86362001)(6862004)(7736002)(305945005)(9686003)(6246003)(336012)(2906002)(97756001)(25786009)(476003)(76130400001)(486006)(54906003)(46406003)(11346002)(126002)(446003)(76176011)(8746002)(8936002)(6506007)(52536014)(66066001)(33656002)(356004)(50466002)(26005)(105606002)(14454004)(5660300002)(478600001)(26826003)(186003)(316002)(102836004)(99286004)(81156014)(81166006)(47776003)(70586007)(70206006)(7696005)(74316002)(23726003)(8676002)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0801MB2068; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Fail; 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: 891a66b9-b1d7-433c-3139-08d757ece3b3 NoDisclaimer: True X-Forefront-PRVS: 019919A9E4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VIY/4F64Hj+iuh9MhADvtPiL3zRDhTe8hqu6qWFLUtDtQm9CtmiwB8H71ecIr7Bq6nBlwP1aLsBy2WTVkPFXcyUCOlNVoAoq+wivJwGtvraOJBpu0ulktQzfh8t+1ZzRcFAvuNyvAxLUQ6L7lOdRQ/wJcPVR75Zw8ldbsp66Sa2sm6QdQYsQ7iKkSNUgB8EsRWh7GEesJmeMTu7iTubEi0hgV/Wi96YEkBsYq9hcXNmiQF2z7/8jQAQFLHT7hzeHwAPI8NxTvZrSDDTTROPrXqqJgn/a4UNRIUwb1Xa+U6aHYWE6WZ/f39BsCyGqvVzJpBkoZLRnZPhLhtTmSby255yH9EvTOmExc5MkyYU6fH6Pimxn+TkWCCx5EyjAPj1y/g3ulCTqgfCqihsHLX3gxNExQ7hCCFENrCU7e/GLjkcnyDRcy5ZPRR04iPtUzXlS X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2019 19:12:13.3751 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2652639b-5422-4bed-7a67-08d757ece94d 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: AM5PR0801MB2068 Subject: Re: [dpdk-dev] [RFC v6 2/6] lib/ring: apis to support configurable element size 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 > On Sun, Oct 20, 2019 at 07:22:56PM -0500, Honnappa Nagarahalli wrote: > > Current APIs assume ring elements to be pointers. However, in many use > > cases, the size can be different. Add new APIs to support configurable > > ring element sizes. > > > > Signed-off-by: Honnappa Nagarahalli > > Reviewed-by: Dharmik Thakkar > > Reviewed-by: Gavin Hu > > Reviewed-by: Ruifeng Wang > > --- > > lib/librte_ring/Makefile | 3 +- > > lib/librte_ring/meson.build | 4 + > > lib/librte_ring/rte_ring.c | 44 +- > > lib/librte_ring/rte_ring.h | 1 + > > lib/librte_ring/rte_ring_elem.h | 946 +++++++++++++++++++++++++++ > > lib/librte_ring/rte_ring_version.map | 2 + > > 6 files changed, 991 insertions(+), 9 deletions(-) create mode > > 100644 lib/librte_ring/rte_ring_elem.h >=20 > (...) >=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_ELEM(r, ring_start, prod_head, obj_table, esize, = n) > do { \ > > + if (esize =3D=3D 4) \ > > + ENQUEUE_PTRS_32(r, ring_start, prod_head, obj_table, n); \ > > + else if (esize =3D=3D 8) \ > > + ENQUEUE_PTRS_64(r, ring_start, prod_head, obj_table, n); \ > > + else if (esize =3D=3D 16) \ > > + ENQUEUE_PTRS_128(r, ring_start, prod_head, obj_table, n); \ } > while > > +(0) >=20 > My initial thinking was that it could be a static inline functions instea= d of > macros. I see that patches 5 and 6 are changing it. I wonder however if p= atches > 5 and 6 shouldn't be merged and moved before this > one: it would avoid to introduce new macros that will be removed after. Patch 2, 5 and 6 implement different methods to do the copy of elements. We= can drop 5, as 6 proves to be better than 5 in my tests. The question on c= hoosing between 2 and 6 is still open. If we go with 2, I will convert the = macros into inline functions. >=20 > (...) >=20 > > +/** > > + * @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 esize > > + * The size of ring element, in bytes. It must be a multiple of 4. > > + * Currently, sizes 4, 8 and 16 are supported. This should be the sa= me > > + * as passed while creating the ring, otherwise the results are unde= fined. >=20 > The comment "It must be a multiple of 4" and "Currently, sizes 4, 8 and 1= 6 are > supported" are redundant (it appears several times in the file). The seco= nd one > should be removed by patch 5 (I think it is missing?). >=20 > But if patch 5 and 6 are moved before this one, only "It must be a multip= le of > 4" would be needed I think, and there would be no transition with only 3 > supported sizes. (refer to the comment above) if 2 is chosen, then, I would like to remove t= he restriction of limited sizes by adding a for loop around the 32b copy. 6= 4b and 128b will remain the same to meet the existing performance.