From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0083.outbound.protection.outlook.com [104.47.32.83]) by dpdk.org (Postfix) with ESMTP id B2114F04 for ; Wed, 20 Sep 2017 15:33:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fDCZSzssbaudZL2hFjuADSKwQcF8W9XFg6DC77+gCHg=; b=RdNCoqhwL0SzdwSV1SHEpZSib1XpFj66DXBW8f3tu4QsCKABXJS9IiHPsiHxFgWFH8ac+/j+oN3ylefiaCgabYlBcnrBXNPGaTjqOBH++iugE7dOOi5c55YtnGwcpj+E0ZKbt0IfekURTRym5rnqsQitNI94FP+UwJG78lkVakU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT (111.93.218.67) by CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Wed, 20 Sep 2017 13:33:12 +0000 Date: Wed, 20 Sep 2017 19:02:49 +0530 From: Pavan Nikhilesh Bhagavatula To: "Dumitrescu, Cristian" , stephen@networkplumber.org Cc: dev@dpdk.org Message-ID: <20170920133247.GA13845@PBHAGAVATULA-LT> References: <1504795187-11087-1-git-send-email-pbhagavatula@caviumnetworks.com> <3EB4FA525960D640B5BDFFD6A3D891267BABD136@IRSMSX108.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D891267BABD136@IRSMSX108.ger.corp.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0071.INDPRD01.PROD.OUTLOOK.COM (10.174.208.139) To CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) X-MS-Office365-Filtering-Correlation-Id: 45f77937-ef17-456e-583e-08d5002c2490 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR07MB3461; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 3:H/TXRLgheliwwllQRceYrTWMYt4YXTos6wa6OUYRHNy5VCkVpBlFNoWGqYj0shniS/vBeWfk1ci9Bs8buMHzGrZdfoWWM7Qm2RqAC2OE2nQjyC9ZkSmzFdhXR4/v7S5mlJ5kBSY4GqhpKycj+bv8E+HZ1whHodMxbBocsuVKb8DsVuEErXXSFFEV9VhbSW180jwfcsfLJm7S/Nr1s9ZudIRgUMU6cEcCMRgfucPHBMWecVBA8I0aOWNOi8aHuOah; 25:HMLc96Jb/IYdIKPeDiG+7aT/Gv5Pwin7vHOTrYG7BbZ1EfXUsla7rTsvNCAX9EhnGQMMX4HZ01NI7oCRyIaflrLzP5HDbUOCG/8S2kfzDWyN+LXhUQ+3yEFVHsFAlh7CTgsmWvrzNxyuzFiN3iq+DCD0QEBOGg+Aou69TI0W8ZbcOdmEDf1t2ZrPituLdi0bCcZbCWAMHvW24VlvRjPTnPU/ozYI12RvyZUhD+RKW8gVAdQpLn5bO40ZXe4sc3/fbpLLGeMreMuYDbSX/+W5HfXPsS3t83Pw18WnoWcGIf8DAk4PkUjFdDWohh3pvKBzpRHJkOSWe+OKZ4wb8eKSBQ==; 31:oEIQnV1NtVzlzpk8r5UXI4uh1Gc0/mS+sy7xhT+6KoGGQO+uViaJHhXR313AiTNRccVM0bXqUN8/oU2Axolwempm2lWw1I7tJ+I5ddzpbBhXU7C6JE9aFLxduE1qrhSw4YS2UQfs6POg5xmZCib64QpPhz08dLq6Tr1n7SH+IyJmM/wYV49Ri17ID052aslIHxAYcdLjqdrIOYoCF4eKjMq9tkSb+YaQYIMViWDMQgE= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PR07MB3461: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 20:zrDxBaHiRnWRkskuNIcvesv9Mx5j1wn/tuptmwckh79N9xVZQcNRn2GsZsAYuIJioSlsCbrgLF7F55hmrZjJYJqDrh9gZObtgU29rhe0jCnU2X6MQ+yJ1LIq79/tLW5agrYDSjfCFRRD9AQOjrsXHNUrqLteYWz/ngTLF4zNvHnpwF8xOARBQW9bHe/wfrQDRfmqvFM0mZXiISR5tgi7EoBbkuzqV5P193iZFA4deF4KiNicmrscMvQlFtce005A0xzfAtjDNNef+76vZmT+0p1m7KyHkemjThbgUM7laXy/xh0WhRr1VP1PAY6k3JrXQ8MNV58UXVzfQw9mx3KALj7h8AtYGeCeP9qqi4Y5pLHPn/R2iP2/8AFaeTpG+ZgsdJ/jHzOL3vLuaovTjolcBCjDgva+mpdAHWKxIQG2CpQJNCIGRBGMQWCfGyDa8bDQGzxX0te/IB1lQkwT/auWP0f7kC/D2KK93DMGaQYmHg3taiBMYEv6cHZRqJFEpiitR7PdH1M7f2F/nMseOODDtr+ZFNobI38KqMz/x/by+9lZUojx1P+WXvKgjlhd7VJBNYyT4qTIpXEvr1IUZjDBQwmpmDxp74GeH6z5o4FYO78= X-Exchange-Antispam-Report-Test: UriScan:(278428928389397)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(93006095)(3002001)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR07MB3461; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR07MB3461; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 4:gIrhYxQAlMba/K2QsffImJodDatuR9lPeVG9xrcQbd3m5ufO7zjB2kkbt4KSg2HPn4hsUcpitTrRd2MxjlMeZVkZHsfk4NOFmMPaEkMXLn4f6zb4j+wa+ZRXflfgEAdlkL2RzpusoHGdGgu2s/scVpG79crvqTjjGy8/Z4NN4ApGktWyvsTiPgdMqEkATObTDsYGmBwWxnEuHNlYdO9u0kSHqep3nvJZPO4uQKEi0h7fxoc32gMsK0vB6+lyo8z/i7Ml8OKcR7i5aDhydUQ0/PvU3Je2tKUQb2bcPCBaST2zauZGoBkDOtkNAq2go84MZLg/n9loW4IbpkINy0E5EA== X-Forefront-PRVS: 04362AC73B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(199003)(377454003)(24454002)(13464003)(189002)(54356999)(68736007)(76176999)(1076002)(50986999)(2950100002)(72206003)(42882006)(106356001)(4326008)(5009440100003)(229853002)(3846002)(6116002)(23726003)(305945005)(66066001)(101416001)(105586002)(47776003)(2906002)(7736002)(53936002)(33656002)(25786009)(6496005)(33716001)(478600001)(6246003)(8676002)(9686003)(55016002)(8936002)(83506001)(58126008)(50466002)(81156014)(81166006)(316002)(575784001)(16526017)(97736004)(6666003)(189998001)(16586007)(53546010)(5660300001)(18370500001)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3461; H:PBHAGAVATULA-LT; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3461; 23:idK4YDIPpElp7FGxhYzxEIqeAlo676WBdjdb0HEIC?= =?us-ascii?Q?lLFxdvS5LL7Z9XgtNYwmty8yMSg93rOfHT6djUrMwM/tztHbkL59YY9XlrU3?= =?us-ascii?Q?WkeNgnNIepUzlohihvoexiA2g1Vl3nI4XKK/M0D341PnWuaXxVEIvLXk6OIM?= =?us-ascii?Q?c7OAJX8rvc3KdDLnB7Rk0IdBaJKcNDvf3CkkVdlnz63fqgyxEGm82wSvymdy?= =?us-ascii?Q?PqsdnHP7CYO1ZiFbJ2hZupkuatp2S0at031oPzg82raFQkXv4L8l/WqAZIJq?= =?us-ascii?Q?AMdi5kjNE6viSzF0hywREXVdJlsP98tOP5BuOXtyd8IZhxrDCyTUEI5Xaldu?= =?us-ascii?Q?lUflBvsgIhROssDpHUxiaDoDt9Xf9cjoSomH6rE0w+jDPKgZeglHVv2Qd64v?= =?us-ascii?Q?yW1lqcNBbunos2LSFua57av0+SGzt0LX3x4IlOA+IVL7A7yBGCUpTauBZHLg?= =?us-ascii?Q?odK4HBMVP7NLbVrQHifC4iBV5+E74DOIlaz83Q98owBekHvvrfwHizDJa+id?= =?us-ascii?Q?qI2Fv/r6vaPI3M8Z7h6hvO1okWSSYqE68P7VjnZM1RK1Q7GbrS148FmUuetQ?= =?us-ascii?Q?VR0Oxjtan6saXrEvBCmcqd6KiSIySIAkks5UT1dBSnr7xCFDF9aXDGgJy7kW?= =?us-ascii?Q?Ov3kkqPdfWRdQxVWex4T/7iF5oa2DULPADm482IjZYmcuLTzydQVQbzvEUxs?= =?us-ascii?Q?rXHFV1lS5udop8ocz6RrtorvP6jY2doxS35HiFyKlWIEcDx+ZpdsBnWHUha1?= =?us-ascii?Q?KulCd1SdNpp/UpOAdGeo3FgeuHm0+fGgN7/P8KqDQTx1FxEtF5ezFWBCnBb4?= =?us-ascii?Q?/2SaGgF/VsUbuk2Gtde2TfhiM/6vv2D+IHLqx94zo1FBamYHCr/WFPTQwIU1?= =?us-ascii?Q?YCk7J9+w7Z0EZOoQUBciFyfFdB9FBBLT8r5XzRHEk9+TjnxX6WH4TL5BHm3l?= =?us-ascii?Q?q7wTr1IYTKKYqwwhB91jgPWcROj01noe7nHj/LhQyVndZtqmnPKqZLKaL2kF?= =?us-ascii?Q?/Pf/M4dcGwVAjiX/N5GG6gzIdLA48F5Qv9CfZ0tDDPXrdmVPrTTKZP4ttwjO?= =?us-ascii?Q?uHp6ijgOiKL6wbJ43mwvPl54v3sL2+s7cS+Vrt2xv/5YvwV5twVmKK5O3vcV?= =?us-ascii?Q?v9Bn3WfN0XXO+Mo2KdtCowHwWZOW91kDthFhQ5yjQzQ+NzhlJ624INtpKHxC?= =?us-ascii?Q?lNX5TDmU6a266MwzaBrvs496C5KrA1e5gbGT5AlK4Aq6YHH/Fe584LYbtvyb?= =?us-ascii?Q?U00U4uRrSXaZjNgBLCZmBhNsl+QV1xi412Gzi0Q9Lkw63K+lXyyYDl4VxbsG?= =?us-ascii?Q?WyD6YL6Z7+yKiHyQc5VvWTJFPaNvcFkm3XCXbC1YG4a?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 6:pHagPJ406KJjA2Nn8lEOHByZ/Npftaar83EnHYUJ1HByl2IET+8w46KfcuMe9I1vwbETgQg4GbuvW68nNrImApWfWMrUs61wtUvOh357Wjy/2hc3nZdg4BRac4EMAJU3jF3SIvcA32IWDDfI/pxFzpykrx0A4zHO6JNwji7ywq8QKKNMuXI/5h1Q5XsQbWogmFG1U6+6ONbsYtKo/cdOxMeWFruNjRdK/XMPcbuYP2QLnAiOYr/vnnizhBfY/1WHExq678P+VVBkwssJyJCEV8EiwJBVtDTRo98htctodnYhJY3GZVW6mW9hpxczgAs+NqSiIfHZslsR7ZeoRM6qXw==; 5:FLGNY+xFxVte1eJnFR4I4T/lOtShjY5oO+udkBRY0rhH/klckrHWCNDBuqtYMzCrBnkoUq1/jf4cFNbwo4ZK5cgIxzkxXlNACiCdlP3lUvNZNk5VPuqcbT1B1QNRgSpOkHUF60SO6r3SCKTeL5Nxbw==; 24:xwqL29ktecNv1mm73cbfjif6yDuwDXYUJVc41TLSqOv9Hze6HLPzCVkXrBfvUI6+ADwh90I5mQEmHvwptvAbdEQ0y73cCJ2rEXyKFlgalCs=; 7:TuB4h8mrpIrwPu0Pb16pcoUzv4nFozK58b6fRekoSCOGfizAZAL6zYqJ5YnEK1XyNAytx0YPMLOGG8/OJKySf3Hq+5WURCdDtJaeEgYTwf3y0Fyo7BnE5oI+ZksGoWENU602rBShGKCYgknyPsOcmUZh4wIq8lBJUNkpcajO1VVRxFxHVB6/rjO7XivGDmUWupx6SEm1IKNuiuyqLbjs3JjPxFyuL/ZZJUoLjY7yJy4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2017 13:33:12.0888 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3461 Subject: Re: [dpdk-dev] [PATCH 1/2] eal: move bitmap from lib sched 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: , X-List-Received-Date: Wed, 20 Sep 2017 13:33:16 -0000 On Wed, Sep 20, 2017 at 01:27:41PM +0000, Dumitrescu, Cristian wrote: > > -----Original Message----- > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > Sent: Thursday, September 7, 2017 3:40 PM > > To: Dumitrescu, Cristian ; > > stephen@networkplumber.org > > Cc: dev@dpdk.org; Pavan Nikhilesh > > Subject: [dpdk-dev] [PATCH 1/2] eal: move bitmap from lib sched > > > > The librte_sched uses rte_bitmap to manage large arrays of bits in an > > optimized method so, moving it to eal/common would allow other libraries > > and applications to use it. > > > > Signed-off-by: Pavan Nikhilesh > > --- > > lib/librte_eal/common/Makefile | 1 + > > .../common/include}/rte_bitmap.h | 100 +++++++++++++-------- > > lib/librte_sched/Makefile | 5 +- > > lib/librte_sched/rte_sched.c | 2 +- > > 4 files changed, 70 insertions(+), 38 deletions(-) > > rename lib/{librte_sched => librte_eal/common/include}/rte_bitmap.h > > (85%) > > > > diff --git a/lib/librte_eal/common/Makefile > > b/lib/librte_eal/common/Makefile > > index e8fd67a..c2c6a7f 100644 > > --- a/lib/librte_eal/common/Makefile > > +++ b/lib/librte_eal/common/Makefile > > @@ -42,6 +42,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h > > rte_dev.h rte_vdev.h > > INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h > > INC += rte_malloc.h rte_keepalive.h rte_time.h > > INC += rte_service.h rte_service_component.h > > +INC += rte_bitmap.h > > > > GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h > > GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h > > diff --git a/lib/librte_sched/rte_bitmap.h > > b/lib/librte_eal/common/include/rte_bitmap.h > > similarity index 85% > > rename from lib/librte_sched/rte_bitmap.h > > rename to lib/librte_eal/common/include/rte_bitmap.h > > index 010d752..0938c63 100644 > > --- a/lib/librte_sched/rte_bitmap.h > > +++ b/lib/librte_eal/common/include/rte_bitmap.h > > @@ -65,6 +65,7 @@ extern "C" { > > ***/ > > > > #include > > + > > #include > > #include > > #include > > @@ -72,36 +73,46 @@ extern "C" { > > #include > > > > #ifndef RTE_BITMAP_OPTIMIZATIONS > > -#define RTE_BITMAP_OPTIMIZATIONS 1 > > +#define RTE_BITMAP_OPTIMIZATIONS 1 > > #endif > > > > /* Slab */ > > -#define RTE_BITMAP_SLAB_BIT_SIZE 64 > > -#define RTE_BITMAP_SLAB_BIT_SIZE_LOG2 6 > > -#define RTE_BITMAP_SLAB_BIT_MASK > > (RTE_BITMAP_SLAB_BIT_SIZE - 1) > > +#define RTE_BITMAP_SLAB_BIT_SIZE 64 > > +#define RTE_BITMAP_SLAB_BIT_SIZE_LOG2 6 > > +#define RTE_BITMAP_SLAB_BIT_MASK (RTE_BITMAP_SLAB_BIT_SIZE - > > 1) > > > > /* Cache line (CL) */ > > -#define RTE_BITMAP_CL_BIT_SIZE (RTE_CACHE_LINE_SIZE * 8) > > -#define RTE_BITMAP_CL_BIT_SIZE_LOG2 > > (RTE_CACHE_LINE_SIZE_LOG2 + 3) > > -#define RTE_BITMAP_CL_BIT_MASK (RTE_BITMAP_CL_BIT_SIZE - > > 1) > > +#define RTE_BITMAP_CL_BIT_SIZE (RTE_CACHE_LINE_SIZE * 8) > > +#define RTE_BITMAP_CL_BIT_SIZE_LOG2 (RTE_CACHE_LINE_SIZE_LOG2 > > + 3) > > +#define RTE_BITMAP_CL_BIT_MASK (RTE_BITMAP_CL_BIT_SIZE - 1) > > > > -#define RTE_BITMAP_CL_SLAB_SIZE (RTE_BITMAP_CL_BIT_SIZE / > > RTE_BITMAP_SLAB_BIT_SIZE) > > -#define RTE_BITMAP_CL_SLAB_SIZE_LOG2 > > (RTE_BITMAP_CL_BIT_SIZE_LOG2 - RTE_BITMAP_SLAB_BIT_SIZE_LOG2) > > -#define RTE_BITMAP_CL_SLAB_MASK > > (RTE_BITMAP_CL_SLAB_SIZE - 1) > > +#define RTE_BITMAP_CL_SLAB_SIZE \ > > + (RTE_BITMAP_CL_BIT_SIZE / RTE_BITMAP_SLAB_BIT_SIZE) > > +#define RTE_BITMAP_CL_SLAB_SIZE_LOG2 \ > > + (RTE_BITMAP_CL_BIT_SIZE_LOG2 - > > RTE_BITMAP_SLAB_BIT_SIZE_LOG2) > > +#define RTE_BITMAP_CL_SLAB_MASK (RTE_BITMAP_CL_SLAB_SIZE - 1) > > > > /** Bitmap data structure */ > > struct rte_bitmap { > > /* Context for array1 and array2 */ > > - uint64_t *array1; /**< Bitmap array1 */ > > - uint64_t *array2; /**< Bitmap array2 */ > > - uint32_t array1_size; /**< Number of 64-bit slabs in array1 > > that are actually used */ > > - uint32_t array2_size; /**< Number of 64-bit slabs in array2 > > */ > > + uint64_t *array1; > > + /**< Bitmap array1 */ > > + uint64_t *array2; > > + /**< Bitmap array2 */ > > + uint32_t array1_size; > > + /**< Number of 64-bit slabs in array1 that are actually used */ > > + uint32_t array2_size; > > + /**< Number of 64-bit slabs in array2 */ > > > > /* Context for the "scan next" operation */ > > - uint32_t index1; /**< Bitmap scan: Index of current array1 slab */ > > - uint32_t offset1; /**< Bitmap scan: Offset of current bit within > > current array1 slab */ > > - uint32_t index2; /**< Bitmap scan: Index of current array2 slab */ > > - uint32_t go2; /**< Bitmap scan: Go/stop condition for current > > array2 cache line */ > > + uint32_t index1; > > + /**< Bitmap scan: Index of current array1 slab */ > > + uint32_t offset1; > > + /**< Bitmap scan: Offset of current bit within current array1 slab */ > > + uint32_t index2; > > + /**< Bitmap scan: Index of current array2 slab */ > > + uint32_t go2; > > + /**< Bitmap scan: Go/stop condition for current array2 cache line */ > > > > /* Storage space for array1 and array2 */ > > uint8_t memory[]; > > @@ -122,7 +133,8 @@ __rte_bitmap_mask1_get(struct rte_bitmap *bmp) > > static inline void > > __rte_bitmap_index2_set(struct rte_bitmap *bmp) > > { > > - bmp->index2 = (((bmp->index1 << > > RTE_BITMAP_SLAB_BIT_SIZE_LOG2) + bmp->offset1) << > > RTE_BITMAP_CL_SLAB_SIZE_LOG2); > > + bmp->index2 = (((bmp->index1 << > > RTE_BITMAP_SLAB_BIT_SIZE_LOG2) + > > + bmp->offset1) << > > RTE_BITMAP_CL_SLAB_SIZE_LOG2); > > } > > > > #if RTE_BITMAP_OPTIMIZATIONS > > @@ -171,12 +183,18 @@ __rte_bitmap_get_memory_footprint(uint32_t > > n_bits, > > uint32_t n_cache_lines_array2; > > uint32_t n_bytes_total; > > > > - n_cache_lines_array2 = (n_bits + RTE_BITMAP_CL_BIT_SIZE - 1) / > > RTE_BITMAP_CL_BIT_SIZE; > > - n_slabs_array1 = (n_cache_lines_array2 + > > RTE_BITMAP_SLAB_BIT_SIZE - 1) / RTE_BITMAP_SLAB_BIT_SIZE; > > + n_cache_lines_array2 = (n_bits + RTE_BITMAP_CL_BIT_SIZE - 1) / > > + RTE_BITMAP_CL_BIT_SIZE; > > + n_slabs_array1 = (n_cache_lines_array2 + > > RTE_BITMAP_SLAB_BIT_SIZE - 1) / > > + RTE_BITMAP_SLAB_BIT_SIZE; > > n_slabs_array1 = rte_align32pow2(n_slabs_array1); > > - n_slabs_context = (sizeof(struct rte_bitmap) + > > (RTE_BITMAP_SLAB_BIT_SIZE / 8) - 1) / (RTE_BITMAP_SLAB_BIT_SIZE / 8); > > - n_cache_lines_context_and_array1 = (n_slabs_context + > > n_slabs_array1 + RTE_BITMAP_CL_SLAB_SIZE - 1) / > > RTE_BITMAP_CL_SLAB_SIZE; > > - n_bytes_total = (n_cache_lines_context_and_array1 + > > n_cache_lines_array2) * RTE_CACHE_LINE_SIZE; > > + n_slabs_context = (sizeof(struct rte_bitmap) + > > + (RTE_BITMAP_SLAB_BIT_SIZE / 8) - 1) / > > + (RTE_BITMAP_SLAB_BIT_SIZE / 8); > > + n_cache_lines_context_and_array1 = (n_slabs_context + > > n_slabs_array1 + > > + RTE_BITMAP_CL_SLAB_SIZE - 1) / > > RTE_BITMAP_CL_SLAB_SIZE; > > + n_bytes_total = (n_cache_lines_context_and_array1 + > > + n_cache_lines_array2) * RTE_CACHE_LINE_SIZE; > > > > if (array1_byte_offset) { > > *array1_byte_offset = n_slabs_context * > > (RTE_BITMAP_SLAB_BIT_SIZE / 8); > > @@ -185,7 +203,8 @@ __rte_bitmap_get_memory_footprint(uint32_t > > n_bits, > > *array1_slabs = n_slabs_array1; > > } > > if (array2_byte_offset) { > > - *array2_byte_offset = n_cache_lines_context_and_array1 * > > RTE_CACHE_LINE_SIZE; > > + *array2_byte_offset = n_cache_lines_context_and_array1 * > > + RTE_CACHE_LINE_SIZE; > > } > > if (array2_slabs) { > > *array2_slabs = n_cache_lines_array2 * > > RTE_BITMAP_CL_SLAB_SIZE; > > @@ -210,6 +229,7 @@ __rte_bitmap_scan_init(struct rte_bitmap *bmp) > > * > > * @param n_bits > > * Number of bits in the bitmap > > + * > > * @return > > * Bitmap memory footprint measured in bytes on success, 0 on error > > */ > > @@ -226,12 +246,14 @@ rte_bitmap_get_memory_footprint(uint32_t > > n_bits) { > > /** > > * Bitmap initialization > > * > > - * @param mem_size > > - * Minimum expected size of bitmap. > > + * @param n_bits > > + * Number of pre-allocated bits in array2. Must be non-zero and multiple > > of > > + * 512. > > * @param mem > > * Base address of array1 and array2. > > - * @param n_bits > > - * Number of pre-allocated bits in array2. Must be non-zero and multiple of > > 512. > > + * @param mem_size > > + * Minimum expected size of bitmap. > > + * > > * @return > > * Handle to bitmap instance. > > */ > > @@ -277,6 +299,7 @@ rte_bitmap_init(uint32_t n_bits, uint8_t *mem, > > uint32_t mem_size) > > * > > * @param bmp > > * Handle to bitmap instance > > + * > > * @return > > * 0 upon success, error code otherwise > > */ > > @@ -312,6 +335,7 @@ rte_bitmap_reset(struct rte_bitmap *bmp) > > * Handle to bitmap instance > > * @param pos > > * Bit position > > + * > > * @return > > * 0 upon success, error code otherwise > > */ > > @@ -333,6 +357,7 @@ rte_bitmap_prefetch0(struct rte_bitmap *bmp, > > uint32_t pos) > > * Handle to bitmap instance > > * @param pos > > * Bit position > > + * > > * @return > > * 0 when bit is cleared, non-zero when bit is set > > */ > > @@ -365,7 +390,8 @@ rte_bitmap_set(struct rte_bitmap *bmp, uint32_t > > pos) > > /* Set bit in array2 slab and set bit in array1 slab */ > > index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2; > > offset2 = pos & RTE_BITMAP_SLAB_BIT_MASK; > > - index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + > > RTE_BITMAP_CL_BIT_SIZE_LOG2); > > + index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + > > + RTE_BITMAP_CL_BIT_SIZE_LOG2); > > offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & > > RTE_BITMAP_SLAB_BIT_MASK; > > slab2 = bmp->array2 + index2; > > slab1 = bmp->array1 + index1; > > @@ -392,7 +418,8 @@ rte_bitmap_set_slab(struct rte_bitmap *bmp, > > uint32_t pos, uint64_t slab) > > > > /* Set bits in array2 slab and set bit in array1 slab */ > > index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2; > > - index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + > > RTE_BITMAP_CL_BIT_SIZE_LOG2); > > + index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + > > + RTE_BITMAP_CL_BIT_SIZE_LOG2); > > offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & > > RTE_BITMAP_SLAB_BIT_MASK; > > slab2 = bmp->array2 + index2; > > slab1 = bmp->array1 + index1; > > @@ -449,7 +476,8 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t > > pos) > > } > > > > /* The array2 cache line is all-zeros, so clear bit in array1 slab */ > > - index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + > > RTE_BITMAP_CL_BIT_SIZE_LOG2); > > + index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + > > + RTE_BITMAP_CL_BIT_SIZE_LOG2); > > offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & > > RTE_BITMAP_SLAB_BIT_MASK; > > slab1 = bmp->array1 + index1; > > *slab1 &= ~(1lu << offset1); > > @@ -500,7 +528,8 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, > > uint32_t *pos, uint64_t *slab) > > uint64_t *slab2; > > > > slab2 = bmp->array2 + bmp->index2; > > - for ( ; bmp->go2 ; bmp->index2 ++, slab2 ++, bmp->go2 = bmp- > > >index2 & RTE_BITMAP_CL_SLAB_MASK) { > > + for ( ; bmp->go2 ; bmp->index2 ++, slab2 ++, > > + bmp->go2 = bmp->index2 & > > RTE_BITMAP_CL_SLAB_MASK) { > > if (*slab2) { > > *pos = bmp->index2 << > > RTE_BITMAP_SLAB_BIT_SIZE_LOG2; > > *slab = *slab2; > > @@ -520,10 +549,10 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, > > uint32_t *pos, uint64_t *slab) > > * > > * @param bmp > > * Handle to bitmap instance > > - * @param pos > > + * @param[out] pos > > * When function call returns 1, pos contains the position of the next set > > * bit, otherwise not modified > > - * @param slab > > + * @param[out] slab > > * When function call returns 1, slab contains the value of the entire 64-bit > > * slab where the bit indicated by pos is located. Slabs are always 64-bit > > * aligned, so the position of the first bit of the slab (this bit is not > > @@ -532,6 +561,7 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, > > uint32_t *pos, uint64_t *slab) > > * after this slab, so the same slab will not be returned again if it > > * contains more than one bit which is set. When function call returns 0, > > * slab is not modified. > > + * > > * @return > > * 0 if there is no bit set in the bitmap, 1 otherwise > > */ > > diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile > > index 18274e7..072cd63 100644 > > --- a/lib/librte_sched/Makefile > > +++ b/lib/librte_sched/Makefile > > @@ -55,7 +55,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_sched.c > > rte_red.c rte_approx.c > > SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_reciprocal.c > > > > # install includes > > -SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h > > rte_bitmap.h rte_sched_common.h rte_red.h rte_approx.h > > -SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h > > +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h > > +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_sched_common.h > > rte_red.h > > +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_approx.h > > > > include $(RTE_SDK)/mk/rte.lib.mk > > diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c > > index b7cba11..b3e0d4f 100644 > > --- a/lib/librte_sched/rte_sched.c > > +++ b/lib/librte_sched/rte_sched.c > > @@ -34,6 +34,7 @@ > > #include > > #include > > > > +#include > > #include > > #include > > #include > > @@ -44,7 +45,6 @@ > > #include > > > > #include "rte_sched.h" > > -#include "rte_bitmap.h" > > #include "rte_sched_common.h" > > #include "rte_approx.h" > > #include "rte_reciprocal.h" > > -- > > 2.7.4 > > Hi Pavan, > > I think moving rte_bitmap.h to a common code area is a good idea, as it allows easier reuse by libs and apps. > > A few asks from my side: > 1. Please do not do any cosmetic changes on rte_bitmap.h, it adds a lot of code churn that makes review very difficult while adding no real value. This way, your patch will be very short and we don't need to worry about any bug introduction. > 2. I want to retain maintainership of rte_bitmap.h, so please add a section in MANTAINERS file under EAL: > > Bitmap > M: Cristian Dumitrescu > F: lib/librte_eal/common/include/rte_bitmap.h > F: test/test/test_bitmap.c > > Regards, > Cristian > Sure will spin up a v2. Thanks, Pavan