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 B00FEA04A5; Thu, 18 Jun 2020 15:20:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B976E1BF31; Thu, 18 Jun 2020 15:20:25 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10051.outbound.protection.outlook.com [40.107.1.51]) by dpdk.org (Postfix) with ESMTP id 19AEB1BF30 for ; Thu, 18 Jun 2020 15:20:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TTT9EpILw13MMxyQnsOmLUbWpJylDd4MKE1VEQFurwvnnboleOyKvJdljuY50YBtCt9w0Js1Lh3tf82f0otWIjmf6ZBTqEOZ61/FPWhpx5tP2VjUuY+wkSSmAXgFsWEX/22nlX+Mdv6ux0fz83iT1Y7mZjtbkQI7iWkIEWeZzbIi1RgEvWqvK61NkhWS97Jo+wyQcVJtuZ1hafkzKYfJJSMjXFuHkdlfstNN4HNn6nitonAb6+1m2mab8fNzkmaxAKejs2wGI+l39hsXxSUueObALKXMpt9GedaOZA8oH+xC953wv+TpBointU1By+CU13AcM1/iGqmJtFHfz6k8Aw== 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=rU5CnDVYh/CArHyJhOc8rFqWx7lidr9U9kJzSIRiot4=; b=ZXGxlvDmR7XIQadRNj43q5zQd86Xp2HIqn3zAEhkbPknxG69HpgmEFdX/I/GO9NVNvOPwvHF/XsrT2feeJM6KNCG47JZT+TkI7i4c1cw7CqNQLR/iMMYB4jGMIRSYDfZgj4NkvPGqeIoSN5WtTaAdZcRZEt1hnshfsbLECMcpOkA7dUcU3BFf1v1CvXIbxCi7w9S5dSHITp+0NkBnPutR6lJ+Ty7KL2fPBd9SGP8Q5TfXlIThmLcjOrEkFjJ2YxWQMJf7lW+QLwOYjZnprAh5lvdOEOhp9hKVpj2YRuRkcK+wKXDgEF1k9Csr50J4isRdjbp3Cg3QbRWL0WEjRpUUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rU5CnDVYh/CArHyJhOc8rFqWx7lidr9U9kJzSIRiot4=; b=plo2kP8XzKT2F57Y3++yBPmg6QHgfmQmEyVhl72/kz8HFA/g2K35mMwAuLEOoe+tcH7Q9Sv6pI7I4O68jNNxZzRPBffR9zrfubibFDyjEmJDP+FEUw1lsvKiLPi3tjmjoKsJcwIq+e47HnKrO9njwpjaLNfAqZoi6B2e7JwOT/Y= Received: from AM0PR05MB4866.eurprd05.prod.outlook.com (2603:10a6:208:c0::32) by AM0PR05MB5138.eurprd05.prod.outlook.com (2603:10a6:208:f2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Thu, 18 Jun 2020 13:20:22 +0000 Received: from AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::d44d:a804:c730:d2b7]) by AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::d44d:a804:c730:d2b7%2]) with mapi id 15.20.3109.021; Thu, 18 Jun 2020 13:20:22 +0000 From: Parav Pandit To: Thomas Monjalon , =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: "dev@dpdk.org" , "ferruh.yigit@intel.com" , Ori Kam , Matan Azrad , "joyce.kong@arm.com" , "phil.yang@arm.com" , "honnappa.nagarahalli@arm.com" , "mb@smartsharesystems.com" Thread-Topic: [dpdk-dev] [RFC PATCH 1/6] eal: introduce macros for getting value for bit Thread-Index: AQHWP0sbqePDFySEQEqfAS6rxROb86jaGSoAgAJkToCAAagKwIAALgWQgAAEHgCAAA/IYA== Date: Thu, 18 Jun 2020 13:20:22 +0000 Message-ID: References: <20200610171728.89-1-parav@mellanox.com> <2125265.EUd4R9OQLY@thomas> In-Reply-To: <2125265.EUd4R9OQLY@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [106.51.29.68] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 88fbce83-4597-4673-a5c7-08d8138a5afc x-ms-traffictypediagnostic: AM0PR05MB5138: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 0438F90F17 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +/fuEYqsc5mpGGeJyu7DseT6VTCmVpBIhaSlkX5kXHz16fiIOb4+zcBztU+BprQhxha5jVA98oS3bIaSmvyvDfsnw04VA5oj2Ae9/IQtBamFfpF9hCZjltmp//1uSWnpevF62zMNTwoggZp1guYH8FmtLyMjll/CwdQROJTxfKWhigHN385/xyMVyeu6bySUqeUeaT8L+fLZuKNFSifRfpbgpSeEDEq3Go3tvP7Qb81MxTjlb+faEl/18Wz+N7KOECOZE2ZuB5ZlokpSGAwu/1M1HsdID4AF7advWnNSUh4+jaZFNnjP5YEar34snaKc x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB4866.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(136003)(366004)(376002)(39860400002)(346002)(8676002)(4326008)(2906002)(71200400001)(33656002)(55016002)(186003)(26005)(8936002)(54906003)(110136005)(66946007)(478600001)(9686003)(7696005)(76116006)(55236004)(52536014)(66476007)(66574015)(86362001)(316002)(66556008)(64756008)(6506007)(5660300002)(53546011)(66446008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: fzc32J+zAmnPJSTeCo2lhyZFj+7T0GlDt9pItGsCoYNcJc1n64v6rYKQ5L4B+h4eFF9es/+IxcgtMq92aufrFESSghvW/oVaAv6giXaaInpuHiPCVwVq1JuEIgkxXWptEEB1Lsu3x1eN/jYbsgkbZ8pk6gWPsiMSlg6HS0pdhhictRjEHCPVixzsSjyrfcBRjapmne+9amgc+mckXkb+88z2HoDKWR4y3C6G8VqWkn4m61s2xnRTnd9vLA+su1XN7K22WVMDIkO2ApcPbf6z5d2zm+VJOJVu8H03WlmrqZ7MGKZmjGoipveWFP85BM8bjEykMmS1Q9zeiNd84wT6V306pO0cz5Db0WZ60yN8iOjjxdRRJEtRQH2w5/LV+sBR9nCYBrMSZFIDH78AcJFsUQ7DEDreIM8/aubTbaO3AaocPsbZv88mt+G75YeLy+YiHiaAbcY2qqVk43gjCPLeg997cvQhq/KEPVdvsz3Hu7g= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88fbce83-4597-4673-a5c7-08d8138a5afc X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jun 2020 13:20:22.5197 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: q8ZXE877uOWzUohx/MnBIYlnoJyFG8Ih6sujkdCuvhEt0NGkV1aotcn2qeocUgxgDRF5z+34q12mtDYRG4hcyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5138 Subject: Re: [dpdk-dev] [RFC PATCH 1/6] eal: introduce macros for getting value for bit 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" > From: Thomas Monjalon > Sent: Thursday, June 18, 2020 5:52 PM >=20 > 18/06/2020 14:16, Parav Pandit: > > From: Parav Pandit > > > From: Thomas Monjalon > > > > 15/06/2020 21:33, Ga=EBtan Rivet: > > > > > On 10/06/20 17:17 +0000, Parav Pandit wrote: > > > > > > There are several drivers which duplicate bit generation macro. > > > > > > Introduce a generic bit macros so that such drivers avoid > > > > > > redefining same in multiple drivers. > > > > > > > > > > > > Signed-off-by: Parav Pandit > > > > > > --- > > > > [...] > > > > > > --- /dev/null > > > > > > +++ b/lib/librte_eal/include/rte_bits.h > > > > > > @@ -0,0 +1,10 @@ > > > > > > +/* SPDX-License-Identifier: BSD-3-Clause > > > > > > + * Copyright 2020 Mellanox Technologies, Ltd. > > > > > > + */ > > > > > > + > > > > > > +#ifndef _RTE_BITS_H_ > > > > > > +#define _RTE_BITS_H_ > > > > > > + > > > > > > +#define RTE_BIT(bit_num) (1UL << (bit_num)) > > > > > ^ The tab here should be replaced by a= space. > > > > > > + > > > > > > +#endif > > > > > > > > > > I'm not sure this kind of macro is needed, but if multiple > > > > > drivers are using the patterns let's say ok. > > > > > > > > Yes. we certainly need it. Currently BIT() macro is used at 3000+ > > > locations and defined in 10+ drivers. > > > Once we have this macro, it can gradually be replaced. > > > > > > > > However I don't think it needs its own header. Would it be ok in > > > > > lib/librte_eal/include/rte_common.h for example? > > > > > > > > If we want to reuse an existing file, it could be > > > > lib/librte_eal/include/rte_bitops.h > > > > > > > o.k. > > > I will rename file from rte_bits.h to rte_bitops.h More such macros > > > will be available here to avoid redefinitions in drivers. > > > > I see that rte_bitops.h already exist and this new definition doesn't f= it well > in the rte_bitops.h. > > The intent of the rte_bitops.h is to have generic mostly macros to repl= ace > current duplication of: > > > > Such as > > BIT() > > BIT_ULL() > > BITS_PER_BYTE() > > BITS_TO_LONGS() > > > > They do not fit well in rte_bitops.h which works on the 'bitmap'. >=20 > Current bitops functions are getting and setting a bit. > I don't undertand why you say "works on the bitmap". It sets in 32-bit and 64-bit addr. Eventually it will be possibly extended to more than 64-bit. It will be a b= itmap as generic API. > In my opinion, bit definition fits in this include file. >=20 Ok. I am fine. I don't have strong opinion to create a new file. I will place it here.