From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3710145561; Wed, 3 Jul 2024 14:50:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 107A540E7C; Wed, 3 Jul 2024 14:50:26 +0200 (CEST) Received: from fout7-smtp.messagingengine.com (fout7-smtp.messagingengine.com [103.168.172.150]) by mails.dpdk.org (Postfix) with ESMTP id 492A24029E for ; Wed, 3 Jul 2024 14:50:24 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.nyi.internal (Postfix) with ESMTP id BF6051380152; Wed, 3 Jul 2024 08:50:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 03 Jul 2024 08:50:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1720011023; x=1720097423; bh=kWgE/6xK7sTga9hGASV/c8rQh0xukeQuCwj7lvaq5m0=; b= Hs3oRVnx1Z06DmTfUuAKnBTSa1jGx6Hjm5pENDcLKTcvJpNpfjDjv1sRYd/vl3Rj F2QLlmhBV3LpALb4p4ECYZi7LNrW/tvXTDPsSeEqjTY1jBIjfJE8st6S0NHz6fRD L8ipuBBRgfuaYzSjxD4MiBS4l1DccI4xVhb4NhC8gwb2laUJaS/eVQyD28fEDyLA Tzd4+L4uQ88Oj4NjYP+kJ5SorNdebV26ie6m46qnfs2YfwSVcDulBglQqakpgKIb 3z6giYPvN0fOs5htSSYJoHEi2PikHlqlJFFXZ5aK08rud0MYxp1HX90UNhTY95Yr tjBViWk6FaOCct6yRzQosg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1720011023; x= 1720097423; bh=kWgE/6xK7sTga9hGASV/c8rQh0xukeQuCwj7lvaq5m0=; b=E 8XQilN8u/VhbHIErFyCpGNN5Q7GEw7O727CSMbJ5duam5PLDurhvJLsh3STqPdk6 HvQvMiM2jwVbFy4pwnKgWbDcoM4w8IcTE/SZSdyZQb97+MToDAshibCQouOJMOs8 EfJC+niiUAML/+E6xo5bMEZxBKSXiPfZNEgkUhS9nW9wwSdB8VlpiU1vhU2b9yXh r4nsFpgMWGvFOttGtce8vYHh+RPLqDT2Wz9j232+ck0Y3YlbydKkeQvGa/aKGc/h Q7BPtvp7zvOEuaJ4qK5i55VtBKlimpXg4y1V/ELoIuq5J0WYPth82rAvVQtiRvMy pa1edWNP9uzm7RdbeWmtw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudejgdehjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepjeduveehieevuddutdevfffgtdegkeeuveejffejgedtgeegkefg vdeugfefkeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Jul 2024 08:50:22 -0400 (EDT) From: Thomas Monjalon To: Volodymyr Fialko Cc: dev@dpdk.org, cristian.dumitrescu@intel.com, jerinj@marvell.com, anoobj@marvell.com Subject: Re: [PATCH v5] bitmap: add scan from offset function Date: Wed, 03 Jul 2024 14:50:19 +0200 Message-ID: <11099356.0mgMEAqHVh@thomas> In-Reply-To: <20230703123909.328480-1-vfialko@marvell.com> References: <20230703093130.198304-1-vfialko@marvell.com> <20230703123909.328480-1-vfialko@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 03/07/2023 14:39, Volodymyr Fialko: > Currently, in the case when we search for a bit set after a particular > value, the bitmap has to be scanned from the beginning and > rte_bitmap_scan() has to be called multiple times until we hit the value. > > Add a new rte_bitmap_scan_from_offset() function to initialize scan > state at the given offset and perform scan, this will allow getting > the next set bit after certain offset within one scan call. > > Signed-off-by: Volodymyr Fialko > --- > v2: > - added rte_bitmap_scan_from_offset > v3: > - added note for internal use only for init_at function > v4: > - marked init_at function as __rte_internal > v5: > - removed __rte_internal due to build errors What was the build error? You should not add an internal function in the public header file. At least, it should be experimental. > --- a/lib/eal/include/rte_bitmap.h > +++ b/lib/eal/include/rte_bitmap.h > +/** > + * Bitmap initialize internal scan pointers at the given position for the scan function. > + * > + * Note: for private/internal use, for public: > + * @see rte_bitmap_scan_from_offset() > + * > + * @param bmp > + * Handle to bitmap instance > + * @param pos > + * Bit position to start scan > + */ > +static inline void > +__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos) > +{ > + uint64_t *slab1; > + > + bmp->index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + RTE_BITMAP_CL_BIT_SIZE_LOG2); > + bmp->offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK; > + bmp->index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2; > + slab1 = bmp->array1 + bmp->index1; > + bmp->go2 = *slab1 & (1llu << bmp->offset1); > +}