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 398B6A04F6; Tue, 7 Jan 2020 07:01:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3FF5A1D5CD; Tue, 7 Jan 2020 07:00:59 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60075.outbound.protection.outlook.com [40.107.6.75]) by dpdk.org (Postfix) with ESMTP id 0B35C1BFA0 for ; Tue, 7 Jan 2020 07:00:56 +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=Vcrs8m0H/C7fbSOol7wkId1/TAbsTv6Hd56RqAJlRck=; b=bONSXiID8BO185p2e8Yxx/Epwnvw3DKr+KUhbYErcc4eFuHezzNczHi8EewKs6md2/ZJAa4fjix3WfONgKEmFwVA1JKeFQCpnYjs492Oe9XG36fWpZy1npN8qctpYM1mLxRKlJsaiAlHHxD+rft4+X3WzWuQlm/bL28w0m9QFGc= Received: from VI1PR08CA0086.eurprd08.prod.outlook.com (2603:10a6:800:d3::12) by VI1PR08MB2831.eurprd08.prod.outlook.com (2603:10a6:802:20::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10; Tue, 7 Jan 2020 06:00:54 +0000 Received: from DB5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::207) by VI1PR08CA0086.outlook.office365.com (2603:10a6:800:d3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.8 via Frontend Transport; Tue, 7 Jan 2020 06:00:54 +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 DB5EUR03FT022.mail.protection.outlook.com (10.152.20.171) 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 06:00:54 +0000 Received: ("Tessian outbound 4f3bc9719026:v40"); Tue, 07 Jan 2020 06:00:54 +0000 X-CR-MTA-TID: 64aa7808 Received: from e4fae8ffd829.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7661C855-0A6C-4C0C-B983-3589965046F3.1; Tue, 07 Jan 2020 06:00:49 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e4fae8ffd829.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Jan 2020 06:00:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EuSKW2Wz/0AreM4D380Wo++2LO+2q1hrVbLkq0wz3VNzOqaEjpHM3BzlFpU39IJiZBr8WFB4kHsaJJOF6hzyVldoXFuQntPiCK+GZLmbulVhFxIc2RBUwSezRX3eS115xCoScnUo0d13JuTVlecPPVUuQYWwsWWaxC5Kv76H3dlhIziQengA888zhkLSNvInb8oV6q8iEzXHYqtfQJpKdtj99G7Wd2R48LnEVxXxXmSCEqs0pTJpG+qnquOdoFHlrTfnh3qh3pQwWoHNVR5YjnJuEA38bdLCy5SC7u+I0INzIKYArvWcoi1IV7sklMUsM2VJs7P8UGHFx+O4pRbCOA== 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=Vcrs8m0H/C7fbSOol7wkId1/TAbsTv6Hd56RqAJlRck=; b=HIqgOezTRX8IwH6Y86N5o87lwv00VLOXYLEHN7UxSfFh18E1TAApQiETRsBVWShdWzrWANvE8EGUVQW23WBL3i8v64nH56wJVH+X+zsoVXZ4YYXDsDttc4Kv6pg8ko/2S2033MUgUWAzYgv6rJ7rrFGgvfijK8H7emFfso+ha759SfOCXK7oc/A7Kf9ocyrPD9k1L1Lg8PBwrle0n7XWkKK2DWG3wyD6qRPHElMRM+saYl3Pxkbtqp5LlcC8rbGQvRo462Q1WhLPmhOMj5Jahe3s9XmwqK7L69vbE4qOIfqL6l3y3HUS/hF0wwbHaWnEthIVEYJYoj/V1US2+m5OKw== 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=Vcrs8m0H/C7fbSOol7wkId1/TAbsTv6Hd56RqAJlRck=; b=bONSXiID8BO185p2e8Yxx/Epwnvw3DKr+KUhbYErcc4eFuHezzNczHi8EewKs6md2/ZJAa4fjix3WfONgKEmFwVA1JKeFQCpnYjs492Oe9XG36fWpZy1npN8qctpYM1mLxRKlJsaiAlHHxD+rft4+X3WzWuQlm/bL28w0m9QFGc= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.27) by VE1PR08MB4991.eurprd08.prod.outlook.com (10.255.158.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.15; Tue, 7 Jan 2020 06:00:47 +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 06:00:47 +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: AQHVwYun8sYxhXoQvESKMlV7eC4Zb6fer7kQgAALWqA= Date: Tue, 7 Jan 2020 06:00:47 +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: 91782b12-1012-4496-904b-ad981d09b4e8.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: 96d5c2ca-90a0-4dba-392d-08d79336f527 X-MS-TrafficTypeDiagnostic: VE1PR08MB4991:|VE1PR08MB4991:|VI1PR08MB2831: 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:8273;OLM:8273; x-forefront-prvs: 027578BB13 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(346002)(366004)(376002)(136003)(39860400002)(396003)(189003)(199004)(4326008)(52536014)(33656002)(5660300002)(54906003)(76116006)(110136005)(26005)(7696005)(71200400001)(6506007)(316002)(186003)(2940100002)(55016002)(81156014)(9686003)(81166006)(478600001)(66946007)(86362001)(8936002)(8676002)(66476007)(66556008)(64756008)(66446008)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4991; 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: 6vEiNbFacgucCik1F8bOwQx646iWOYHRgPQE4mCSXeY77Gdk3MjO98W8QOuYf3S+qsbtAICiZs/IPAgwOlr3Nq1rXv4YPNfoTH+3EhEKDTTBjXpdhxaadk5TCKfX4QLRpGI4S9kg8LKJx8Ory5cdlj2+vzKMO0rrJIdDKUbhHwBaOwFH3SM1GJl5Kn6Xy49Oa1r4wXwchcQ8pI1CbVUwUOYvEtmqZsLCfg4XM2k64AQIwnUBf/BAAORSrq6+tcS+14+0xRNSGEq5JMhkZWcPpKIt9RjF+MNj2Jzzwchl3chWkmrw+NfHfWpZeNfjHc+M35sPfqRpM4ILMUjZmXjPRteGYKxYaIfZEMbvzGCRWRqLi9+u0jgF0VBDD3dY7oXqUmukEZMnjHf9IHCwNnAsVeRU1zgilfohdAJl5qeahz3/4/Wl2xngWtDvvcAD3x3N Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4991 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT022.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)(39860400002)(376002)(136003)(396003)(346002)(199004)(189003)(81156014)(5660300002)(8936002)(2906002)(81166006)(86362001)(7696005)(316002)(2940100002)(55016002)(52536014)(9686003)(356004)(6506007)(336012)(70206006)(70586007)(478600001)(26826003)(33656002)(8676002)(186003)(54906003)(110136005)(26005)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB2831; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; 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: 029b6618-2fff-46fc-2d15-08d79336f0f5 NoDisclaimer: True X-Forefront-PRVS: 027578BB13 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iuYSlv7LSncRxzbdpGDY0wPTPYDJPigtMONarunt9Yo3Y+P3tRuccaBizOG8jFHYVYlUBUFTzDJdVz8R2Obeu3rmYkOlYtU0RdEOrzjiE4NIqsWM6TosHXHVlXR+tDnZ45tTWHbT80leA7iFOXBvSgNIY29Xhxt4UPPOF5p3ELlFnQZhthIvggxcnEcRtS0YrcVHXsKqesb/g/7wJ7LrEoL753Z7ORroXhrO+DzXZF0kDR3k64wT/TzgMevoSvdrMICZKKdbEFqJJEBZ7IFdZ4HzxIDnEUzk4m3A2BfERG9PGR1XdxdigtJ/CWH7Hw5owydjtOqNTyJU0tW5mEiCofHifBbeD9Lah6K7yFg/ZN7e2NT8ncDEQo+JHzswdEAH2QSbrv4EqSPe15UX4b3EPL9Hj/yE9XPK8kkn/RQYKI1IFRL3mxr4MrsHEQxzFkbM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2020 06:00:54.6199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96d5c2ca-90a0-4dba-392d-08d79336f527 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: VI1PR08MB2831 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" > > > + > > > +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]; > > > > > > 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 fa= ults or > require additional cycles. So, aligning on 16B should be fine. Further, I would be changing this to use 'rte_int128_t' as '__uint128_t' is= not defined on 32b systems. >=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); } } > > > +