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 CB71BA04F6; Tue, 7 Jan 2020 06:35:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 430B41D90D; Tue, 7 Jan 2020 06:35:42 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80071.outbound.protection.outlook.com [40.107.8.71]) by dpdk.org (Postfix) with ESMTP id D9E0B1D8FF for ; Tue, 7 Jan 2020 06:35:40 +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=3QRnyihSXZWSx5EnPDZp1QmLMl96DD5tgcYCSwTENP8=; b=zCm6cZMVWJ14vvEipWamEOekXLF0QWOYUuxRzx3xjtRFMOlzenwc5anKG35bVxwL/45jRuxHbfC5qm8bVoKfh6xzDNv8C+1VG68nZsJzlhm0mTOt8iyPnrNXgm4dMKOqHvCF5vXbcrcprHdj1eQ6O4UGxLt++s0e94QiFpR6+MY= Received: from VI1PR08CA0203.eurprd08.prod.outlook.com (2603:10a6:800:d2::33) by HE1PR0802MB2316.eurprd08.prod.outlook.com (2603:10a6:3:cb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.14; Tue, 7 Jan 2020 05:35:38 +0000 Received: from DB5EUR03FT027.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::201) by VI1PR08CA0203.outlook.office365.com (2603:10a6:800:d2::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.13 via Frontend Transport; Tue, 7 Jan 2020 05:35:38 +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 DB5EUR03FT027.mail.protection.outlook.com (10.152.20.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Tue, 7 Jan 2020 05:35:38 +0000 Received: ("Tessian outbound 1da651c29646:v40"); Tue, 07 Jan 2020 05:35:37 +0000 X-CR-MTA-TID: 64aa7808 Received: from 02966199bf00.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3CF09C18-893D-44B9-836D-1882A1CCA127.1; Tue, 07 Jan 2020 05:35:32 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 02966199bf00.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Jan 2020 05:35:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m+kC7V0gRpPmmkr2zX98GhhU003Tw28tx7PTqTSCPoK++opwBABMUh8vCZAOO1uxGBjSe19k3r6/GxOkMVYtd+yeoZQqkNa0eSOJGY4pGBzlSLGZh2+uTj9TdIN4ppJ5fXLLpgs8WAC8lnYKb6ABxBqpnpN3Eti4ijK7DLioj1hSb6aZUkWI/53kovtAd2i5FzuOTmGjfuR8buEir6r4iRtzuM/YGJbDJ3RaHrFbK2iWEHmo1jtuyn8b/ByQ+KANcjx54k9QaWn/7X6yjev3JVX1Goi7wqP2ut5clNEafhv9gkW68Lzu2k/aaJAak+ndBu/XNYZ3anSF6jD0akfciQ== 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=3QRnyihSXZWSx5EnPDZp1QmLMl96DD5tgcYCSwTENP8=; b=eprnDdfK53uNPGS/sltX/k8OpjIi8aH7hkUcPYTtge0plcd4SnnEvPmbUbLXf2qiTf3OhBgegbbJE/0eQEqN0Oswubf2y11S44rQbJEQz7K0EuarG4UdlaIuSleswuVcEGWcCEd4RJ/ZkVDutRPwFQp38W4s0iO0+4ipjowe8NbGvjtcWoyHAiWVpJo4hR5zh+/9VK66UK4T/r3arzjbEWv+eNtUcDKlcSYmyPoWHq5O5sbRhnGsWWDb2aWAKTSizCgg801Mgu9LbN8/owpXWbglYC7FaHJN007xaXXodno3XsX/159QKRIjls2tRupc3Hmd0Izv5wii1UAuy3digg== 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=3QRnyihSXZWSx5EnPDZp1QmLMl96DD5tgcYCSwTENP8=; b=zCm6cZMVWJ14vvEipWamEOekXLF0QWOYUuxRzx3xjtRFMOlzenwc5anKG35bVxwL/45jRuxHbfC5qm8bVoKfh6xzDNv8C+1VG68nZsJzlhm0mTOt8iyPnrNXgm4dMKOqHvCF5vXbcrcprHdj1eQ6O4UGxLt++s0e94QiFpR6+MY= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.27) by VE1PR08MB5198.eurprd08.prod.outlook.com (20.179.31.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.12; Tue, 7 Jan 2020 05:35:31 +0000 Received: from VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::29eb:a1be:8f8f:fae2]) by VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::29eb:a1be:8f8f:fae2%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 05:35:31 +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 02/17] lib/ring: apis to support configurable element size Thread-Index: AQHVwYun8sYxhXoQvESKMlV7eC4Zb6fer7kQ Date: Tue, 7 Jan 2020 05:35:30 +0000 Message-ID: References: <20190906190510.11146-1-honnappa.nagarahalli@arm.com> <20191220044524.32910-1-honnappa.nagarahalli@arm.com> <20191220044524.32910-3-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: d4b920e9-31ee-40d9-89de-6aa715862c4a.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: a8129b6c-1253-4ab2-bbc5-08d793336d34 X-MS-TrafficTypeDiagnostic: VE1PR08MB5198:|VE1PR08MB5198:|HE1PR0802MB2316: 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:6790;OLM:6790; x-forefront-prvs: 027578BB13 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(366004)(396003)(346002)(376002)(199004)(189003)(76116006)(4326008)(7696005)(8936002)(6506007)(26005)(55016002)(66946007)(64756008)(66556008)(66476007)(66446008)(71200400001)(478600001)(186003)(5660300002)(54906003)(316002)(2906002)(52536014)(9686003)(33656002)(110136005)(86362001)(8676002)(81166006)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5198; H:VE1PR08MB5149.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: IaplvJU7Iv1IbrYVOt28uocTjaM0tNyCDzuXLzCD8EpfiRdyOt5C81nCo+DqKkig29bLDYSev3psqiaw58oA2gbBYJvnQhbGHfEwnujqrELXHat72qe8X/LMyF9VWp9IyPPi/TvuCA8giTN95Df2Zqw53B0dVM/q0h78weuUV4D/9B6d/77c1QAU3Bs7kcTQT/Qbal11IhL2CiKwPSUC2rNwsVDNzlyeNm+pk1Y0jbolB2GFJB/2OsKkabo7azGOhiWmun0wYHQ3d7JHyNYHw7NkgbSiRCNuKlKHWUmiFXM+84JYnZwlGIE0lx9nJR6NFGq0rkMIdXb8tfJXXO36XLyqhSV8XuU48Gb0M+YVH9qH9XB89oDOtoVo/a8ZidyFw7JabG+iSluM1f5GDrWmclLsoGezk2wHXKhpUVnnV0VIfaST8SL7yMW+c3DVx6cF Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5198 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT027.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)(346002)(396003)(376002)(189003)(199004)(336012)(55016002)(33656002)(8936002)(316002)(110136005)(356004)(54906003)(52536014)(5660300002)(9686003)(478600001)(70206006)(4326008)(8676002)(7696005)(2906002)(26005)(186003)(81166006)(6506007)(81156014)(86362001)(70586007)(26826003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0802MB2316; 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: 237b1424-5a13-4834-856b-08d7933368fa NoDisclaimer: True X-Forefront-PRVS: 027578BB13 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A33xDVUWxifurK1F7IvgzKw0Eauw+5661yqctOiwZGXORnCC1jFY57h05KK05K83oFbilzhbT/AB/+weOodomJtY88VkzmmGGqOa6R+p4yYvTej1N5ufq4C3sMP8ja6mhSh2GeR5glg7Q1gLw6K2zZEFMgVDG+wCDLYQl7KefLTVhMNi6yky8py4aj62laXQ1aYvhuxuIo88yyXxWUhnX25tAhyT6NMi7kPvmYE+3Jk15SgNIJ+fnjH8ts7WL3BFJdUBEcUj5y7sxHtI44m+RyZpjI6/xfNgPh2lpRQXhosd7H7uxhe7FnQY0vZb/cKRlYShJeoatp32sy38IlTAQw0W9XoNKedVW5N8+R+N1znvL6HGjRMfUF+MJtxcjE6LvfGgn7gNmzm2Ggdt27QQqSGAsGS5vKLrGYqTQlNuLCZ0r2fsG+sVe1BqRQK/JO13 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2020 05:35:38.0401 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8129b6c-1253-4ab2-bbc5-08d793336d34 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: HE1PR0802MB2316 Subject: Re: [dpdk-dev] [PATCH v7 02/17] 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" > > diff --git a/lib/librte_ring/rte_ring_elem.h > > b/lib/librte_ring/rte_ring_elem.h new file mode 100644 index > > 000000000..fc7fe127c > > --- /dev/null > > +++ b/lib/librte_ring/rte_ring_elem.h > > @@ -0,0 +1,1002 @@ > > + > > +static __rte_always_inline void > > +enqueue_elems_128(struct rte_ring *r, uint32_t prod_head, > > + const void *obj_table, uint32_t n) > > +{ > > + unsigned int i; > > + const uint32_t size =3D r->size; > > + uint32_t idx =3D prod_head & r->mask; > > + __uint128_t *ring =3D (__uint128_t *)&r[1]; > > + const __uint128_t *obj =3D (const __uint128_t *)obj_table; > > + if (likely(idx + n < size)) { > > + for (i =3D 0; i < (n & ~0x1); i +=3D 2, idx +=3D 2) { > > + ring[idx] =3D obj[i]; > > + ring[idx + 1] =3D obj[i + 1]; >=20 >=20 > AFAIK, that implies 16B aligned obj_table... > Would it always be the case? I am not sure from the compiler perspective. At least on Arm architecture, unaligned access (address that is accessed is= not aligned to the size of the data element being accessed) will result in= faults or require additional cycles. So, aligning on 16B should be fine. >=20 > > + } > > + switch (n & 0x1) { > > + case 1: > > + ring[idx++] =3D obj[i++]; > > + } > > + } else { > > + for (i =3D 0; idx < size; i++, idx++) > > + ring[idx] =3D obj[i]; > > + /* Start at the beginning */ > > + for (idx =3D 0; i < n; i++, idx++) > > + ring[idx] =3D obj[i]; > > + } > > +} > > + > > +/* the actual enqueue of elements on the ring. > > + * Placed here since identical code needed in both > > + * single and multi producer enqueue functions. > > + */ > > +static __rte_always_inline void > > +enqueue_elems(struct rte_ring *r, uint32_t prod_head, const void > *obj_table, > > + uint32_t esize, uint32_t num) > > +{ > > + uint32_t idx, nr_idx, nr_num; > > + > > + /* 8B and 16B copies implemented individually to retain > > + * the current performance. > > + */ > > + if (esize =3D=3D 8) > > + enqueue_elems_64(r, prod_head, obj_table, num); > > + else if (esize =3D=3D 16) > > + enqueue_elems_128(r, prod_head, obj_table, num); > > + else { > > + /* Normalize to uint32_t */ > > + uint32_t scale =3D esize / sizeof(uint32_t); > > + nr_num =3D num * scale; > > + idx =3D prod_head & r->mask; > > + nr_idx =3D idx * scale; > > + enqueue_elems_32(r, nr_idx, obj_table, nr_num); > > + } > > +} > > +