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 2A8DEA04F6; Tue, 7 Jan 2020 11:21:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 399651D8CA; Tue, 7 Jan 2020 11:21:30 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B042F1D6F6 for ; Tue, 7 Jan 2020 11:21:28 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2020 02:21:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,405,1571727600"; d="scan'208";a="421007515" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 07 Jan 2020 02:21:27 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 7 Jan 2020 02:21:27 -0800 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 7 Jan 2020 02:21:26 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.45) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 7 Jan 2020 02:21:26 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ONZuuqIwzoG7OIxPqabtkn9APq/CGC8lG2GigbyZH0nDXfj0qyhnRxQL5FJxXP+l3w+J+cbaiqtJejCCj6jrgAy2Xv8t1kg9penw9e3RdzywQuu7O4ZrU45DAIHg0Q7bH/BgbvTzFWRLq+0k+zRhN6BbxRlrDFH3cmGZIgxW4wd+4xiiLarY3qGDxViGMHsteREs747rnmvoDpCIVnuKOfdHc7Qi9TplFqv93nrdZ5/APFyjTdMcdRb2oswRMUJ4gE06wn1fOYbyiCgWDjdSQ9GchXsblmdoUYRbR+0SxyFxiYO/0NQ7IC2a0CYyexVY5PZPXu9egHAAYir17WFcgw== 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=j5uYo8VIiSDDlQzDDaamhU5y4tCmCpNYkVoGIVuA9TI=; b=Fy/dxKlUOqS1/i/eUP3G0XrVGBID86UHpuDMOu99Jn8PZ0WL6r4LxinHdbbGzRUwaZJeb2dUiG+6uZJLEkFcw7B/wB7oQioyKjik7tPpAjf6oW6NbT65Ca96300Efps0WUDUOnp1QFpIFLgjtZgwU+RVzR+L6eODTWhA5qA2d161jp58ClmG8d+a3fowEzn4vr8pfMUdbgIE+Ds6wdbRfGNmO2/rTBfkafC5QspioiwGHB/6UTI91SfDuTd+/eGtAsTT5z2sNmF869LaHwWEfOds4Y+8G/ul7Pjy2bUBTWLRcxJYoB6Bn6ATEDqOq4+BRRghUQRHJ3hxTq5dtbZr5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j5uYo8VIiSDDlQzDDaamhU5y4tCmCpNYkVoGIVuA9TI=; b=ydpH90u1j72e0c9zEObXjz4DYiuaY+sheurtRwuJQULGlK4bv+u0t9jJfgoXS0t5U0BOUP0QP828/tBeIxegHsYghs6Z7s3eeRbiK9tz4gNht9684xsTEvvSxhNIzXEJeGwbiI2ufVYndjgqXl4xaW9FrcXzA2tACsvFF4QwOiA= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by SN6PR11MB3229.namprd11.prod.outlook.com (52.135.112.28) 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 10:21:24 +0000 Received: from SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::4d86:362a:13c3:8386]) by SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::4d86:362a:13c3:8386%7]) with mapi id 15.20.2623.008; Tue, 7 Jan 2020 10:21:24 +0000 From: "Ananyev, Konstantin" To: Honnappa Nagarahalli , "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 , nd Thread-Topic: [PATCH v7 02/17] lib/ring: apis to support configurable element size Thread-Index: AQHVtvB22uIJex5+gEyRiFOc8yhYEqfXpo/wgAckGwCAAAcRgIAAR9qg Date: Tue, 7 Jan 2020 10:21:23 +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-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGY3NmZkODQtNDUxZC00ODc2LWEzZTQtYzgwM2Q5NjE1YjdiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibWtOVzJqV3MxaHd3ckg3aWIxOVJlbng2N3JwUzJORkdHTkowQ1hDUDRWeXZwdE9jU0N3WXlxdGlmV3ZyUm1KSCJ9 dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-ctpclassification: CTP_NT authentication-results: spf=none (sender IP is ) smtp.mailfrom=konstantin.ananyev@intel.com; x-originating-ip: [192.198.151.163] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b334de1d-74f0-48a0-de8f-08d7935b5925 x-ms-traffictypediagnostic: SN6PR11MB3229: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(346002)(136003)(366004)(396003)(199004)(189003)(8676002)(66556008)(64756008)(66446008)(81156014)(8936002)(186003)(6506007)(26005)(7416002)(66476007)(81166006)(66946007)(478600001)(76116006)(7696005)(86362001)(52536014)(2906002)(4326008)(55016002)(9686003)(71200400001)(316002)(110136005)(54906003)(5660300002)(33656002); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB3229; H:SN6PR11MB2558.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: txUvJqR4Eu2MiOvQuTxisKct+zreiNQ7THKNZBaSzk0j9vcx2H8TJCQhKqmEaDkq5fcZxGrsA44knrbLD9x5/az7tuPe5c58zb4oHuiLSt5tVkQyJgKUQLNXbW8zvGoxus+gtY64LVwRfXTEE6J4z7opedGZABdnxk4A+3DZVEoqhh1jQs3V6yRY0PERX0QX+9C7yFiS+/TBqwugLF2lTfLMQWuoHRIopZEcMU6auodG1C0X73bMu00fvstsFs2P9oiYAtVR1K3sUxQUP1k0ioeyY/Cs1c+wh8nWtU4yJGxe+3K6F4KytiGYsqvA5yxPk/RJnqkUo6/g41LSNzDU1m/2sf/pm9PeExSajIwG4cAhFQ4zcd0jPlP8FDu2bgTj779R9/XVoUqBnX+MlyY64mGijrz13iGpIh3cso478WceB8+Jnj1eDJUeCj524/jQ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b334de1d-74f0-48a0-de8f-08d7935b5925 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 10:21:23.8627 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TUPz9J2VkWkzQgt3DGyIncIR3m2JizbEWtBb6kyD/1RjyLAd4swYWhSX14k2UK3NbmJ5xIfhrU9/UMwLEp1Ygaj5REwb1rMSBRHglwI61mY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3229 X-OriginatorOrg: intel.com 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 *ri= ng =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 accesse= d 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. > Further, I would be changing this to use 'rte_int128_t' as '__uint128_t' = is not defined on 32b systems. What I am trying to say: with this code we imply new requirement for elems in the ring: when sizeof(elem)=3D=3D16 it's alignment also has to be = at least 16. Which from my perspective is not ideal. Note that for elem sizes > 16 (24, 32), there is no such constraint. >=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 * scal= e; > > > > +idx =3D prod_head & r->mask; nr_idx =3D idx * scale; > > > > +enqueue_elems_32(r, nr_idx, obj_table, nr_num); } } > > > > +