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 22E55A0613 for ; Wed, 28 Aug 2019 17:13:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1A3CA1C115; Wed, 28 Aug 2019 17:13:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1E2E81DB9 for ; Wed, 28 Aug 2019 17:13:06 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7SF0DlI028100; Wed, 28 Aug 2019 08:13:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=SX0wnBSGglBhnDyw4sywsT/1rM3+mwm2leRw0XCnAl0=; b=sQB6Ec7pzGyxbRFNIE+RG5bGotdwLDZGr7zJHWxdeqnFP3wPJotFTq5qCR96mdD4q3ug 9pl64s8Zoe7tP662L7mEqTZpvCVk9DyopJL3zGBsYQVBKqAyBN3FNgNhmjrGhVQ9Cbml auQ/LpKSDowiJus2dPrOxCckOEAXat70uIqb4+Xkm04pmq0PTwerrcU6fKU+L2ovJCu5 O4NdYOVTbbccrZD888lJXUyAUAMktSWUsIbOM5AcLNxoFMvMeDU0fCTC0YYrNo2dvSPs ysBJlK/SXphgbDhtFv1qWvDAn9XR+kb8y9872EbQiTvMHr3k0ZnQvjuYnXxJpgRM7Lag RQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rkqfrf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 28 Aug 2019 08:13:01 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 28 Aug 2019 08:12:59 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.51) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 28 Aug 2019 08:12:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PiqXNMOtVQ7WjMZNS2zz8aw8ae9r03iWCe+NYcbGCU8HoI4elFZbJZNJfan+1vbWQo3CYm8bQEEqKLF17dWyaOseYXBiAmxO4nAkG1fL6/FKFFDEnbxIF5S3pT11kTr/yhfM2zE6EbN6+GF4fQws1wE7RU+UYrwcYHWlHiv/FiPlW+Gxepdqf/3auiz8mBpgTdTFhNUEGDxFmGBzC0bnbHkmpqerGp2mVWKp7xIczZsKuau/jNahMYshw7kAQkTUiFASP7InnfCTS9GpyagD8Lpv2qg9UuVC4vBT9LZd9t1IZsxdlmezOP257rOTuevl3oOXEs1in2jOvC2OFOEHBw== 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=SX0wnBSGglBhnDyw4sywsT/1rM3+mwm2leRw0XCnAl0=; b=lKcxvk7M0M57j6z9/QO7O8DRtW063lpxAepNSaZ9S2vc4qbhRfdKupFpiO7gR4M0JtRQBH5TOYFSUAeBtAuK2ebSYaY4XVnR/6Kt+VYCDOd3DJB9MYFdUxgdSGPaxsCFVunET32RD7S3iH3Gk5pf1KzWwxZG699jFiRDqy5W5q6ZtK0W1T1CPN+Ugt3Tt9dR3bgBDtRxBypFcwWKRVz6RwzAE69WdQGZmvksb02f1HokyxmRu2vfSVDUDUlMd2CXBraPOMP61nObv+pphadjjfpM8WboSzaZigOISrTlDQilA7e9xwLvtI6vy3DUxiRzWgYwBvlSwErC36WWl2kbkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SX0wnBSGglBhnDyw4sywsT/1rM3+mwm2leRw0XCnAl0=; b=vxbaBFI+IT3BO+gu58LzXsvj84jV7bSKCJPsOyoG2ADw6ityKEkmqfPzehQeF+fW77wY5VyG7M6ZrGvyNz3LWs1mHluTNmIaqPkW9aEkGx1LVFKPpb6FB3Z8ISIb/CmRLmAfR5k8kZqr5QEq3V08x2JGkTuLJzNYhXDWkJ2tMXc= Received: from BYAPR18MB2424.namprd18.prod.outlook.com (20.179.91.149) by BYAPR18MB2664.namprd18.prod.outlook.com (20.179.94.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.21; Wed, 28 Aug 2019 15:12:53 +0000 Received: from BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::5877:72b7:40cf:2013]) by BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::5877:72b7:40cf:2013%3]) with mapi id 15.20.2199.021; Wed, 28 Aug 2019 15:12:53 +0000 From: Jerin Jacob Kollanukkaran To: Honnappa Nagarahalli , "olivier.matz@6wind.com" , "yipeng1.wang@intel.com" , "sameh.gobriel@intel.com" , "bruce.richardson@intel.com" , "pablo.de.lara.guarch@intel.com" CC: "dev@dpdk.org" , "dharmik.thakkar@arm.com" , "gavin.hu@arm.com" , "ruifeng.wang@arm.com" , "nd@arm.com" Thread-Topic: [dpdk-dev] [PATCH 0/5] lib/ring: templates to support custom element size Thread-Index: AQHVXa9mSlJx4Z0na0a/JG3gXu65YacQqdPQ Date: Wed, 28 Aug 2019 15:12:53 +0000 Message-ID: References: <20190828144614.25284-1-honnappa.nagarahalli@arm.com> In-Reply-To: <20190828144614.25284-1-honnappa.nagarahalli@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [122.181.204.84] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1083c3fe-93c5-4478-60a0-08d72bca32f6 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:BYAPR18MB2664; x-ms-traffictypediagnostic: BYAPR18MB2664: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 014304E855 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(366004)(136003)(396003)(39860400002)(346002)(189003)(199004)(13464003)(14454004)(478600001)(4326008)(25786009)(66066001)(76116006)(52536014)(66946007)(66476007)(66446008)(64756008)(66556008)(5660300002)(102836004)(71200400001)(71190400001)(7696005)(99286004)(186003)(26005)(53546011)(256004)(14444005)(76176011)(6506007)(316002)(110136005)(54906003)(486006)(7736002)(11346002)(446003)(305945005)(74316002)(7416002)(2906002)(9686003)(55016002)(6246003)(53936002)(33656002)(476003)(6436002)(3846002)(6116002)(2501003)(229853002)(81166006)(81156014)(8936002)(2201001)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2664; H:BYAPR18MB2424.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Xcumea8jKqW9Tn+tXq5/mszime4szEXWOWys/utcppyLoVt7A0mwcRmxeR4R+8cHFtRQZvJJQgDEsDoT40LjILn7sWT8lMZ79v167hDVwAR1lQFEwcnAXFj+W0rtIw1jUZV87I8Io4mMXJT2GFasyv5PW7FFnv/K4CX6avoeuXG11Tb8OaKsjTSs1Mk5msSZ+jUzPJT2ySswNAznTGXbo5uBvmiWMfjwM9rgIDvVULUUkE76iYv69if7Oy7T5XhatzXxjoPNY8JlCPdOEikTUihvLeZmvGTdIp0IvwkXDGOzKwuO6t6s7bJdBJLYhpRolbagnos1h9waYh9dlQVYRemgwjTrjn8dUsnDOwvqc8DQeQYVqosyJ1g7GyMOm1yUsJvcGDFxSaGUT2Dk2SDAOEAh08TxxX4oPVuJjEb7YSE= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1083c3fe-93c5-4478-60a0-08d72bca32f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Aug 2019 15:12:53.2031 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KJ2tsdPLpwgtjPY5387AVXW+dj7Xzy/RWDlpCpT2U4ZrkiqAPbwdw3OdDnvgdNu6Z2bjKRM557QYurg8JO6OqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2664 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-08-28_07:2019-08-28,2019-08-28 signatures=0 Subject: Re: [dpdk-dev] [PATCH 0/5] lib/ring: templates to support custom 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" > -----Original Message----- > From: dev On Behalf Of Honnappa Nagarahalli > Sent: Wednesday, August 28, 2019 8:16 PM > To: olivier.matz@6wind.com; yipeng1.wang@intel.com; > sameh.gobriel@intel.com; bruce.richardson@intel.com; > pablo.de.lara.guarch@intel.com; honnappa.nagarahalli@arm.com > Cc: dev@dpdk.org; dharmik.thakkar@arm.com; gavin.hu@arm.com; > ruifeng.wang@arm.com; nd@arm.com > Subject: [dpdk-dev] [PATCH 0/5] lib/ring: templates to support custom ele= ment > size >=20 > The current rte_ring hard-codes the type of the ring element to 'void *',= hence > the size of the element is hard-coded to 32b/64b. Since the ring element = type is > not an input to rte_ring APIs, it results in couple of issues: >=20 > 1) If an application requires to store an element which is not 64b, it > needs to writes its own ring APIs similar to rte_event_ring APIs. This > creates additional burden on the programmers, who simply end up making > work-arounds and often waste memory. If we are taking this path, Could you change rte_event_ring implementation = based on new framework? > 2) If there are multiple libraries that store elements of the same > type, currently they would have to write their own rte_ring APIs. This > results in code duplication. >=20 > This patch consists of 4 parts: > 1) New APIs to support configurable ring element size > These will help reduce code duplication in the templates. I think thes= e > can be made internal (do not expose to DPDK applications, but expose t= o > DPDK libraries), feedback needed. >=20 > 2) rte_ring templates > The templates provide an easy way to add new APIs for different ring > element types/sizes which can be used by multiple libraries. These > also allow for creating APIs to store elements of custom types > (for ex: a structure) >=20 > The template needs 4 parameters: > a) RTE_RING_TMPLT_API_SUFFIX - This is used as a suffix to the > rte_ring APIs. > For ex: if RTE_RING_TMPLT_API_SUFFIX is '32b', the API name will be > rte_ring_create_32b > b) RTE_RING_TMPLT_ELEM_SIZE - Size of the ring element in bytes. > For ex: sizeof(uint32_t) > c) RTE_RING_TMPLT_ELEM_TYPE - Type of the ring element. > For ex: uint32_t. If a common ring library does not use a standard > data type, it should create its own type by defining a structure > with standard data type. For ex: for an elment size of 96b, one > could define a structure >=20 > struct s_96b { > uint32_t a[3]; > } > The common library can use this structure to define > RTE_RING_TMPLT_ELEM_TYPE. >=20 > The application using this common ring library should define its > element type as a union with the above structure. >=20 > union app_element_type { > struct s_96b v; > struct app_element { > uint16_t a; > uint16_t b; > uint32_t c; > uint32_t d; > } > } > d) RTE_RING_TMPLT_EXPERIMENTAL - Indicates if the new APIs being defin= ed > are experimental. Should be set to empty to remove the experimental > tag. >=20 > The ring library consists of some APIs that are defined as inline > functions and some APIs that are non-inline functions. The non-inline > functions are in rte_ring_template.c. However, this file needs to be > included in other .c files. Any feedback on how to handle this is > appreciated. >=20 > Note that the templates help create the APIs that are dependent on the > element size (for ex: rte_ring_create, enqueue/dequeue etc). Other API= s > that do NOT depend on the element size do not need to be part of the > template (for ex: rte_ring_dump, rte_ring_count, rte_ring_free_count > etc). >=20 > 3) APIs for 32b ring element size > This uses the templates to create APIs to enqueue/dequeue elements of > size 32b. >=20 > 4) rte_hash libray is changed to use 32b ring APIs > The 32b APIs are used in rte_hash library to store the free slot index > and free bucket index. >=20 > This patch results in following checkpatch issue: > WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' >=20 > The patch is following the rules in the existing code. Please let me know= if this > needs to be fixed. >=20 > Honnappa Nagarahalli (5): > lib/ring: apis to support configurable element size > lib/ring: add template to support different element sizes > tools/checkpatch: relax constraints on __rte_experimental > lib/ring: add ring APIs to support 32b ring elements > lib/hash: use ring with 32b element size to save memory >=20 > devtools/checkpatches.sh | 11 +- > lib/librte_hash/rte_cuckoo_hash.c | 55 ++--- > lib/librte_hash/rte_cuckoo_hash.h | 2 +- > lib/librte_ring/Makefile | 9 +- > lib/librte_ring/meson.build | 11 +- > lib/librte_ring/rte_ring.c | 34 ++- > lib/librte_ring/rte_ring.h | 72 ++++++ > lib/librte_ring/rte_ring_32.c | 19 ++ > lib/librte_ring/rte_ring_32.h | 36 +++ > lib/librte_ring/rte_ring_template.c | 46 ++++ > lib/librte_ring/rte_ring_template.h | 330 +++++++++++++++++++++++++++ > lib/librte_ring/rte_ring_version.map | 4 + > 12 files changed, 582 insertions(+), 47 deletions(-) create mode 100644 > lib/librte_ring/rte_ring_32.c create mode 100644 lib/librte_ring/rte_rin= g_32.h > create mode 100644 lib/librte_ring/rte_ring_template.c > create mode 100644 lib/librte_ring/rte_ring_template.h >=20 > -- > 2.17.1