Skip to contentSkip to conversation

bitmap: add scan init at given position

PATCH In review Volodymyr Fialko 5 participants 25 messages Apr 14, 2023 – Oct 10, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitmap: add scan init at given position

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_init_at() function to initialize scan state at the given position, this will allow getting the next bit set after some value within one rte_bitmap_scan() call.

---
 app/test/test_bitmap.c       | 23 +++++++++++++++++++++++
 lib/eal/include/rte_bitmap.h | 22 ++++++++++++++++++++++
 2 files changed, 45 insertions(+)
app/test/test_bitmap.c +23 -0
index e9c61590ae..69ff7262f3 100644
@@ -71,6 +71,29 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 		return TEST_FAILED;
 	}
 
+	/* Scan reset with count check. */
+	__rte_bitmap_scan_init_at(bmp, pos + RTE_BITMAP_SLAB_BIT_SIZE);
+	if (!rte_bitmap_scan(bmp, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab2_magic != out_slab) {
+		printf("Scan init at operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	__rte_bitmap_scan_init_at(bmp, pos + 2 * RTE_BITMAP_SLAB_BIT_SIZE);
+	if (!rte_bitmap_scan(bmp, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab1_magic != out_slab) {
+		printf("Scan init at operation failed.\n");
+		return TEST_FAILED;
+	}
+
 	/* Test scan when a cline is half full */
 	rte_bitmap_reset(bmp);
 	for (i = 0; i < MAX_BITS; i++)
lib/eal/include/rte_bitmap.h +22 -0
index 27ee3d18a4..54a986aa8f 100644
@@ -137,6 +137,28 @@ __rte_bitmap_scan_init(struct rte_bitmap *bmp)
 	bmp->go2 = 0;
 }
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Bitmap initialize internal scan pointers at the given position for the scan function.
+ * @see rte_bitmap_scan()
+ *
+ * @param bmp
+ *   Handle to bitmap instance
+ * @param pos
+ *   Bit position to start scan
+ */
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)
+{
+	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;
+	bmp->go2 = 1;
+}
+
 /**
  * Bitmap memory footprint calculation
  *
Signature · 1 line
2.34.1
#1 lore raw

Cristian, please could you review this patch?

14/04/2023 10:39, Volodymyr Fialko:

Quoted 9 lines

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_init_at() function to initialize scan state at the given position, this will allow getting the next bit set after some value within one rte_bitmap_scan() call.

[...]

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 160

Quoted 9 lines
lib/eal/include/rte_bitmap.h +9 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)
+{
+	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;
+	bmp->go2 = 1;
+}

It is supposed to be an internal (inlined) function but it is not used.

#2 lore raw

Hi Volodymyr,

Thanks for your patch, comments below under your code:

Quoted 27 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, June 1, 2023 4:26 PM
To: Dumitrescu, Cristian <[email protected]>; Volodymyr Fialko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] bitmap: add scan init at given position

Cristian, please could you review this patch?

14/04/2023 10:39, Volodymyr Fialko:

Quoted 9 lines

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_init_at() function to initialize scan state at the given position, this will allow getting the next bit set after some value within one rte_bitmap_scan() call.

[...]

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp)

Quoted 5 lines
lib/eal/include/rte_bitmap.h +5 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)
+{
+	bmp->index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 +

RTE_BITMAP_CL_BIT_SIZE_LOG2);

Quoted 9 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	bmp->offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) &

RTE_BITMAP_SLAB_BIT_MASK;

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 160

Quoted 3 lines
lib/eal/include/rte_bitmap.h +3 -0
+	bmp->index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2;
+	bmp->go2 = 1;
+}

It is supposed to be an internal (inlined) function but it is not used.

My understanding is your proposed procedure for scanning starting at an offset is:
1. Call the new function: __rte_bitmap_scan_init_at()
2. Call the regular function: rte_bitmap_scan()

I think this procedure is not ideal, therefore I suggest we create a new API function which has an additional offset argument:

rte_bitmap_scan_from_offset(struct rte_bitmap *bmp, uint32_t offset, uint32_t *pos, uint64_t *slab).

Under the hood, the new API should call an internal function similar to yours to start the scan at a given offset (while aborting any scan that might be in progress). Makes sense?

BTW, do we need to declare the experimental functions defined in a header file to the library map file? I don't see this in the patch, but the patch seems to compile and link fine ...

Regards,
Cristian

#3 lore raw
Quoted 45 lines · Cristian

Hi Volodymyr,

Thanks for your patch, comments below under your code:

Quoted 27 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, June 1, 2023 4:26 PM
To: Dumitrescu, Cristian <[email protected]>; Volodymyr Fialko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] bitmap: add scan init at given position

Cristian, please could you review this patch?

14/04/2023 10:39, Volodymyr Fialko:

Quoted 9 lines

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_init_at() function to initialize scan state at the given position, this will allow getting the next bit set after some value within one rte_bitmap_scan() call.

[...]

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp)

Quoted 5 lines
lib/eal/include/rte_bitmap.h +5 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)
+{
+	bmp->index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 +

RTE_BITMAP_CL_BIT_SIZE_LOG2);

Quoted 9 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	bmp->offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) &

RTE_BITMAP_SLAB_BIT_MASK;

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 160

Quoted 3 lines
lib/eal/include/rte_bitmap.h +3 -0
+	bmp->index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2;
+	bmp->go2 = 1;
+}

It is supposed to be an internal (inlined) function but it is not used.

My understanding is your proposed procedure for scanning starting at an offset is:
1. Call the new function: __rte_bitmap_scan_init_at()
2. Call the regular function: rte_bitmap_scan()

Quoted 8 lines

I think this procedure is not ideal, therefore I suggest we create a new API function which has an additional offset argument:

rte_bitmap_scan_from_offset(struct rte_bitmap *bmp, uint32_t offset, uint32_t *pos, uint64_t *slab).

Under the hood, the new API should call an internal function similar to yours to start the scan at a given offset (while aborting any scan that might be in progress). Makes sense?

BTW, do we need to declare the experimental functions defined in a header file to the library map file? I don't see this in the patch, but the patch seems to compile and link fine ...

Inline functions in headers are not real "functions" in the output code, as they get inlined into the caller. Therefore, they have no entries in the version.map file, since they don't exist in the compiled object code.

/Bruce

#4 lore raw
In reply to Dumitrescu, Cristian

Hi Cristian,

<snip>

Quoted 10 lines

My understanding is your proposed procedure for scanning starting at an offset is:
1. Call the new function: __rte_bitmap_scan_init_at() 2. Call the regular function: rte_bitmap_scan()

I think this procedure is not ideal, therefore I suggest we create a new API function which has an additional offset argument:

rte_bitmap_scan_from_offset(struct rte_bitmap *bmp, uint32_t offset, uint32_t *pos,
uint64_t *slab).

Quoted 8 lines

Under the hood, the new API should call an internal function similar to yours to start the scan at a given offset (while aborting any scan that might be in progress). Makes sense?

BTW, do we need to declare the experimental functions defined in a header file to the library map file? I don't see this in the patch, but the patch seems to compile and link fine ...

Regards,
Cristian

I like the suggested idea to add rte_bitmap_scan_from_offset API. I will implement it in the next version.

#5 lore raw

PATCH v2 1/1 bitmap: add scan from offset function

In reply to 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.

---
 app/test/test_bitmap.c       | 33 ++++++++++++++++++++-
 lib/eal/include/rte_bitmap.h | 56 ++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 1 deletion(-)
app/test/test_bitmap.c +32 -1
index e9c61590ae..9e38087408 100644
@@ -18,8 +18,8 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 {
 	uint64_t slab1_magic = 0xBADC0FFEEBADF00D;
 	uint64_t slab2_magic = 0xFEEDDEADDEADF00D;
+	int i, nb_clear, nb_set, next_cl;
 	uint32_t pos = 0, start_pos;
-	int i, nb_clear, nb_set;
 	uint64_t out_slab = 0;
 
 	rte_bitmap_reset(bmp);
@@ -71,6 +71,37 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 		return TEST_FAILED;
 	}
 
+	/* Scan with offset check. */
+	if (!rte_bitmap_scan_from_offset(bmp, RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap with scan from offset.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab2_magic != out_slab) {
+		printf("Scan from offset operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	/* Scan with offset wrap around check. */
+	if (!rte_bitmap_scan_from_offset(bmp, 2 * RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap with scan from offset.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab1_magic != out_slab) {
+		printf("Scan from offset with wrap around operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	/* Test scan when the bit set is on a next cline */
+	rte_bitmap_reset(bmp);
+	next_cl = RTE_MIN(RTE_BITMAP_CL_BIT_SIZE, MAX_BITS);
+	rte_bitmap_set(bmp, next_cl);
+	if (!rte_bitmap_scan_from_offset(bmp, 0, &pos, &out_slab)) {
+		printf("Failed to get slab from next cache line from bitmap.\n");
+		return TEST_FAILED;
+	}
+
 	/* Test scan when a cline is half full */
 	rte_bitmap_reset(bmp);
 	for (i = 0; i < MAX_BITS; i++)
lib/eal/include/rte_bitmap.h +56 -0

68 lines not on this page · raw message

Signature · 1 line
2.34.1
#6 lore raw

RE: [PATCH v2] bitmap: add scan from offset function

Quoted 24 lines

-----Original Message-----
From: Volodymyr Fialko <[email protected]>
Sent: Tuesday, June 13, 2023 4:40 PM
To: [email protected]; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Volodymyr Fialko <[email protected]>
Subject: [PATCH v2] bitmap: add scan from offset function

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.

---
 app/test/test_bitmap.c       | 33 ++++++++++++++++++++-
 lib/eal/include/rte_bitmap.h | 56 ++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 1 deletion(-)

<snip>

Quoted 12 lines

+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Bitmap initialize internal scan pointers at the given position for the scan function.
+ *
+ * @param bmp
+ * Handle to bitmap instance
+ * @param pos
+ * Bit position to start scan
+ */

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 153

Quoted 3 lines
lib/eal/include/rte_bitmap.h +3 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)

Please add a note for this function to mark it as internal, which should be obvious from the double underscore prefix in the name, but better to write it explicitly as well.

#7 lore raw

PATCH v3 1/1 bitmap: add scan from offset function

In reply to 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.

---
v2:
- added rte_bitmap_scan_from_offset
v3
- added note for internal use only for init_at function

 app/test/test_bitmap.c       | 33 +++++++++++++++++++-
 lib/eal/include/rte_bitmap.h | 59 ++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 1 deletion(-)
app/test/test_bitmap.c +32 -1
index e9c61590ae..9e38087408 100644
@@ -18,8 +18,8 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 {
 	uint64_t slab1_magic = 0xBADC0FFEEBADF00D;
 	uint64_t slab2_magic = 0xFEEDDEADDEADF00D;
+	int i, nb_clear, nb_set, next_cl;
 	uint32_t pos = 0, start_pos;
-	int i, nb_clear, nb_set;
 	uint64_t out_slab = 0;
 
 	rte_bitmap_reset(bmp);
@@ -71,6 +71,37 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 		return TEST_FAILED;
 	}
 
+	/* Scan with offset check. */
+	if (!rte_bitmap_scan_from_offset(bmp, RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap with scan from offset.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab2_magic != out_slab) {
+		printf("Scan from offset operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	/* Scan with offset wrap around check. */
+	if (!rte_bitmap_scan_from_offset(bmp, 2 * RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap with scan from offset.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab1_magic != out_slab) {
+		printf("Scan from offset with wrap around operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	/* Test scan when the bit set is on a next cline */
+	rte_bitmap_reset(bmp);
+	next_cl = RTE_MIN(RTE_BITMAP_CL_BIT_SIZE, MAX_BITS);
+	rte_bitmap_set(bmp, next_cl);
+	if (!rte_bitmap_scan_from_offset(bmp, 0, &pos, &out_slab)) {
+		printf("Failed to get slab from next cache line from bitmap.\n");
+		return TEST_FAILED;
+	}
+
 	/* Test scan when a cline is half full */
 	rte_bitmap_reset(bmp);
 	for (i = 0; i < MAX_BITS; i++)
lib/eal/include/rte_bitmap.h +59 -0

71 lines not on this page · raw message

Signature · 1 line
2.34.1
Acked-by on v3 1/1
#8 lore raw

RE: [PATCH v3] bitmap: add scan from offset function

Quoted 14 lines

-----Original Message-----
From: Volodymyr Fialko <[email protected]>
Sent: Wednesday, June 21, 2023 11:01 AM
To: [email protected]; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Volodymyr Fialko <[email protected]>
Subject: [PATCH v3] bitmap: add scan from offset function

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.

Quoted 6 lines

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.

---

#9 lore raw

Re: [PATCH v3] bitmap: add scan from offset function

In reply to Volodymyr Fialko

21/06/2023 12:01, Volodymyr Fialko:

Quoted 14 lines

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.

---
v2:
- added rte_bitmap_scan_from_offset
v3
- added note for internal use only for init_at function

[...]

Quoted 7 lines
lib/eal/include/rte_bitmap.h +7 -0
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Bitmap initialize internal scan pointers at the given position for the scan function.
+ *
+ * Note: for private/internal use, for public:

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 156

Quoted 10 lines
lib/eal/include/rte_bitmap.h +10 -0
+ * @see rte_bitmap_scan_from_offset()
+ *
+ * @param bmp
+ *   Handle to bitmap instance
+ * @param pos
+ *   Bit position to start scan
+ */
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)

I think it should marked with __rte_internal instead of experimental.

#10 lore raw

RE: [PATCH v3] bitmap: add scan from offset function

Quoted 32 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, June 22, 2023 6:45 PM
To: Volodymyr Fialko <[email protected]>
Cc: [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v3] bitmap: add scan from offset function

21/06/2023 12:01, Volodymyr Fialko:

Quoted 14 lines

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.

---
v2:
- added rte_bitmap_scan_from_offset
v3
- added note for internal use only for init_at function

[...]

Quoted 5 lines

+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Bitmap initialize internal scan pointers at the given position for the scan

function.

Quoted 16 lines

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 156

Quoted 12 lines

+ *
+ * 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
+ */

lib/eal/include/rte_bitmap.h +3 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)

I think it should marked with __rte_internal instead of experimental.

+1

#11 lore raw

RE: [PATCH v3] bitmap: add scan from offset function

Since it's header-only library, there is issue with using __rte_intenal (appeared in v4).
Even if the function itself is not used directly, it get's included to the other public files.
It explains why other functions in this library does not have the rte_internal prefix, but the double underscores. So, should I simply remove __rte_internal from v4, or there's another approach to resolve this issue(beside creating .c file)?

/Volodymyr

Quoted 65 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Friday, June 23, 2023 2:41 PM
To: Thomas Monjalon <[email protected]>; Volodymyr Fialko <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Anoob Joseph <[email protected]>
Subject: [EXT] RE: [PATCH v3] bitmap: add scan from offset function

External Email

----------------------------------------------------------------------

Quoted 33 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, June 22, 2023 6:45 PM
To: Volodymyr Fialko <[email protected]>
Cc: [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v3] bitmap: add scan from offset function

21/06/2023 12:01, Volodymyr Fialko:

Quoted 15 lines

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.

---
v2:
- added rte_bitmap_scan_from_offset
v3
- added note for internal use only for init_at function

[...]

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp)

Quoted 6 lines
lib/eal/include/rte_bitmap.h +6 -0
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Bitmap initialize internal scan pointers at the given position
+for the scan

function.

Quoted 16 lines

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 156

Quoted 12 lines

+ *
+ * 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
+ */

lib/eal/include/rte_bitmap.h +3 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)

I think it should marked with __rte_internal instead of experimental.

+1

#12 lore raw

Re: [PATCH v3] bitmap: add scan from offset function

03/07/2023 12:56, Volodymyr Fialko:

Quoted 1 line

Since it's header-only library, there is issue with using __rte_intenal (appeared in v4).

What is the issue?

Quoted 72 lines

Even if the function itself is not used directly, it get's included to the other public files.
It explains why other functions in this library does not have the rte_internal prefix, but the double underscores. So, should I simply remove __rte_internal from v4, or there's another approach to resolve this issue(beside creating .c file)?

/Volodymyr

Quoted 65 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Friday, June 23, 2023 2:41 PM
To: Thomas Monjalon <[email protected]>; Volodymyr Fialko <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Anoob Joseph <[email protected]>
Subject: [EXT] RE: [PATCH v3] bitmap: add scan from offset function

External Email

----------------------------------------------------------------------

Quoted 33 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, June 22, 2023 6:45 PM
To: Volodymyr Fialko <[email protected]>
Cc: [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v3] bitmap: add scan from offset function

21/06/2023 12:01, Volodymyr Fialko:

Quoted 15 lines

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.

---
v2:
- added rte_bitmap_scan_from_offset
v3
- added note for internal use only for init_at function

[...]

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp)

Quoted 6 lines
lib/eal/include/rte_bitmap.h +6 -0
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Bitmap initialize internal scan pointers at the given position
+for the scan

function.

Quoted 16 lines

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 156

Quoted 12 lines

+ *
+ * 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
+ */

lib/eal/include/rte_bitmap.h +3 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)

I think it should marked with __rte_internal instead of experimental.

+1

#13 lore raw

RE: [EXT] Re: [PATCH v3] bitmap: add scan from offset function

Quoted 9 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, July 3, 2023 1:51 PM
To: Dumitrescu, Cristian <[email protected]>; Volodymyr Fialko <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Anoob Joseph <[email protected]>
Subject: [EXT] Re: [PATCH v3] bitmap: add scan from offset function

Quoted 7 lines

External Email

----------------------------------------------------------------------
03/07/2023 12:56, Volodymyr Fialko:

Quoted 1 line

Since it's header-only library, there is issue with using __rte_intenal (appeared in v4).

What is the issue?

From V4 ci build failure(http://mails.dpdk.org/archives/test-report/2023-July/421235.html):
In file included from ../examples/ipsec-secgw/event_helper.c:6:
../lib/eal/include/rte_bitmap.h:645:2: error: Symbol is not public ABI
__rte_bitmap_scan_init_at(bmp, offset);
^

	../lib/eal/include/rte_bitmap.h:150:1: note: from 'diagnose_if' attribute on '__rte_bitmap_scan_init_at':
	__rte_internal
	^~~~~~~~~~~~~~
	../lib/eal/include/rte_compat.h:42:16: note: expanded from macro '__rte_internal'	
	__attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \
              		^           ~
	1 error generated.

/Volodymyr

Quoted 81 lines
Quoted 3 lines

Even if the function itself is not used directly, it get's included to the other public files. It explains why other functions in this library does not have the rte_internal prefix, but the double

underscores.

Quoted 1 line

So, should I simply remove __rte_internal from v4, or there's another approach to resolve this

issue(beside creating .c file)?

Quoted 71 lines

/Volodymyr

Quoted 67 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Friday, June 23, 2023 2:41 PM
To: Thomas Monjalon <[email protected]>; Volodymyr Fialko <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Anoob Joseph <[email protected]>
Subject: [EXT] RE: [PATCH v3] bitmap: add scan from offset function

External Email

--------------------------------------------------------------------
--

Quoted 33 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, June 22, 2023 6:45 PM
To: Volodymyr Fialko <[email protected]>
Cc: [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v3] bitmap: add scan from offset function

21/06/2023 12:01, Volodymyr Fialko:

Quoted 15 lines

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.

---
v2:
- added rte_bitmap_scan_from_offset
v3
- added note for internal use only for init_at function

[...]

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp)

Quoted 6 lines
lib/eal/include/rte_bitmap.h +6 -0
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Bitmap initialize internal scan pointers at the given
+position for the scan

function.

Quoted 16 lines

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 156

Quoted 12 lines

+ *
+ * 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
+ */

lib/eal/include/rte_bitmap.h +3 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)

I think it should marked with __rte_internal instead of experimental.

+1

#14 lore raw

Re: [EXT] Re: [PATCH v3] bitmap: add scan from offset function

03/07/2023 14:02, Volodymyr Fialko:

Quoted 22 lines
Quoted 9 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, July 3, 2023 1:51 PM
To: Dumitrescu, Cristian <[email protected]>; Volodymyr Fialko <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Anoob Joseph <[email protected]>
Subject: [EXT] Re: [PATCH v3] bitmap: add scan from offset function

Quoted 7 lines

External Email

----------------------------------------------------------------------
03/07/2023 12:56, Volodymyr Fialko:

Quoted 1 line

Since it's header-only library, there is issue with using __rte_intenal (appeared in v4).

What is the issue?

From V4 ci build failure(http://mails.dpdk.org/archives/test-report/2023-July/421235.html):
In file included from ../examples/ipsec-secgw/event_helper.c:6:
../lib/eal/include/rte_bitmap.h:645:2: error: Symbol is not public ABI
__rte_bitmap_scan_init_at(bmp, offset);
^

Quoted 7 lines
	../lib/eal/include/rte_bitmap.h:150:1: note: from 'diagnose_if' attribute on '__rte_bitmap_scan_init_at':
	__rte_internal
	^~~~~~~~~~~~~~
	../lib/eal/include/rte_compat.h:42:16: note: expanded from macro '__rte_internal'	
	__attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \
              		^           ~
	1 error generated.

OK I see.
So we should give up with __rte_internal for inline functions. As it is not supposed to be exposed to the applications, I think we can skip the __rte_experimental flag.

Quoted 82 lines
Quoted 80 lines
Quoted 2 lines

Even if the function itself is not used directly, it get's included to the other public files. It explains why other functions in this library does not have the rte_internal prefix, but the double

underscores.

Quoted 1 line

So, should I simply remove __rte_internal from v4, or there's another approach to resolve this

issue(beside creating .c file)?

Quoted 71 lines

/Volodymyr

Quoted 67 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Friday, June 23, 2023 2:41 PM
To: Thomas Monjalon <[email protected]>; Volodymyr Fialko <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Anoob Joseph <[email protected]>
Subject: [EXT] RE: [PATCH v3] bitmap: add scan from offset function

External Email

--------------------------------------------------------------------
--

Quoted 33 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, June 22, 2023 6:45 PM
To: Volodymyr Fialko <[email protected]>
Cc: [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v3] bitmap: add scan from offset function

21/06/2023 12:01, Volodymyr Fialko:

Quoted 15 lines

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.

---
v2:
- added rte_bitmap_scan_from_offset
v3
- added note for internal use only for init_at function

[...]

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp)

Quoted 6 lines
lib/eal/include/rte_bitmap.h +6 -0
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Bitmap initialize internal scan pointers at the given
+position for the scan

function.

Quoted 16 lines

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 156

Quoted 12 lines

+ *
+ * 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
+ */

lib/eal/include/rte_bitmap.h +3 -0
+__rte_experimental
+static inline void
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)

I think it should marked with __rte_internal instead of experimental.

+1

#15 lore raw

PATCH v4 1/1 bitmap: add scan from offset function

In reply to 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.

---
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

 app/test/test_bitmap.c       | 33 ++++++++++++++++++++-
 lib/eal/include/rte_bitmap.h | 56 ++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 1 deletion(-)
app/test/test_bitmap.c +32 -1
index e9c61590ae..9e38087408 100644
@@ -18,8 +18,8 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 {
 	uint64_t slab1_magic = 0xBADC0FFEEBADF00D;
 	uint64_t slab2_magic = 0xFEEDDEADDEADF00D;
+	int i, nb_clear, nb_set, next_cl;
 	uint32_t pos = 0, start_pos;
-	int i, nb_clear, nb_set;
 	uint64_t out_slab = 0;
 
 	rte_bitmap_reset(bmp);
@@ -71,6 +71,37 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 		return TEST_FAILED;
 	}
 
+	/* Scan with offset check. */
+	if (!rte_bitmap_scan_from_offset(bmp, RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap with scan from offset.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab2_magic != out_slab) {
+		printf("Scan from offset operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	/* Scan with offset wrap around check. */
+	if (!rte_bitmap_scan_from_offset(bmp, 2 * RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap with scan from offset.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab1_magic != out_slab) {
+		printf("Scan from offset with wrap around operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	/* Test scan when the bit set is on a next cline */
+	rte_bitmap_reset(bmp);
+	next_cl = RTE_MIN(RTE_BITMAP_CL_BIT_SIZE, MAX_BITS);
+	rte_bitmap_set(bmp, next_cl);
+	if (!rte_bitmap_scan_from_offset(bmp, 0, &pos, &out_slab)) {
+		printf("Failed to get slab from next cache line from bitmap.\n");
+		return TEST_FAILED;
+	}
+
 	/* Test scan when a cline is half full */
 	rte_bitmap_reset(bmp);
 	for (i = 0; i < MAX_BITS; i++)
lib/eal/include/rte_bitmap.h +56 -0

68 lines not on this page · raw message

Signature · 1 line
2.34.1
Acked-by on v4 1/1
#16 lore raw

RE: [PATCH v4] bitmap: add scan from offset function

Quoted 27 lines

-----Original Message-----
From: Volodymyr Fialko <[email protected]>
Sent: Monday, July 3, 2023 10:31 AM
To: [email protected]; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Volodymyr Fialko <[email protected]>
Subject: [PATCH v4] bitmap: add scan from offset function

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.

---
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

Quoted 2 lines
 app/test/test_bitmap.c       | 33 ++++++++++++++++++++-
 lib/eal/include/rte_bitmap.h | 56 
#17 lore raw

PATCH v5 1/1 bitmap: add scan from offset function

In reply to 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.

---
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

 app/test/test_bitmap.c       | 33 +++++++++++++++++++++-
 lib/eal/include/rte_bitmap.h | 55 ++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 1 deletion(-)
app/test/test_bitmap.c +32 -1
index e9c61590ae..9e38087408 100644
@@ -18,8 +18,8 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 {
 	uint64_t slab1_magic = 0xBADC0FFEEBADF00D;
 	uint64_t slab2_magic = 0xFEEDDEADDEADF00D;
+	int i, nb_clear, nb_set, next_cl;
 	uint32_t pos = 0, start_pos;
-	int i, nb_clear, nb_set;
 	uint64_t out_slab = 0;
 
 	rte_bitmap_reset(bmp);
@@ -71,6 +71,37 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)
 		return TEST_FAILED;
 	}
 
+	/* Scan with offset check. */
+	if (!rte_bitmap_scan_from_offset(bmp, RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap with scan from offset.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab2_magic != out_slab) {
+		printf("Scan from offset operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	/* Scan with offset wrap around check. */
+	if (!rte_bitmap_scan_from_offset(bmp, 2 * RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {
+		printf("Failed to get slab from bitmap with scan from offset.\n");
+		return TEST_FAILED;
+	}
+
+	if (slab1_magic != out_slab) {
+		printf("Scan from offset with wrap around operation failed.\n");
+		return TEST_FAILED;
+	}
+
+	/* Test scan when the bit set is on a next cline */
+	rte_bitmap_reset(bmp);
+	next_cl = RTE_MIN(RTE_BITMAP_CL_BIT_SIZE, MAX_BITS);
+	rte_bitmap_set(bmp, next_cl);
+	if (!rte_bitmap_scan_from_offset(bmp, 0, &pos, &out_slab)) {
+		printf("Failed to get slab from next cache line from bitmap.\n");
+		return TEST_FAILED;
+	}
+
 	/* Test scan when a cline is half full */
 	rte_bitmap_reset(bmp);
 	for (i = 0; i < MAX_BITS; i++)
lib/eal/include/rte_bitmap.h +55 -0

67 lines not on this page · raw message

Signature · 1 line
2.34.1
Acked-by on v5 1/1
#18 lore raw

RE: [PATCH v5] bitmap: add scan from offset function

Quoted 14 lines

-----Original Message-----
From: Volodymyr Fialko <[email protected]>
Sent: Monday, July 3, 2023 1:39 PM
To: [email protected]; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Volodymyr Fialko <[email protected]>
Subject: [PATCH v5] bitmap: add scan from offset function

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.

Quoted 6 lines

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.

---

#20 lore raw

Re: [PATCH v5] bitmap: add scan from offset function

In reply to Volodymyr Fialko

03/07/2023 14:39, Volodymyr Fialko:

Quoted 9 lines

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.

Quoted 9 lines

---
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.

Quoted 24 lines
lib/eal/include/rte_bitmap.h +22 -0
+/**
+ * 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);
+}
#21 lore raw

Re: [PATCH v5] bitmap: add scan from offset function

Quoted 26 lines

From: Thomas Monjalon <[email protected]>
Sent: Wednesday, July 3, 2024 2:50 PM
To: Volodymyr Fialko
Cc: [email protected]; [email protected]; Jerin Jacob; Anoob Joseph
Subject: Re: [PATCH v5] bitmap: add scan from offset function

03/07/2023 14:39, Volodymyr Fialko:

Quoted 9 lines

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.

Quoted 9 lines

---
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

Quoted 5 lines

What was the build error?

You should not add an internal function in the public header file. At least, it should be experimental.

From our discussion in previous versions(V3, V4), It looks like we agreed to remove both markers.

Quoted 25 lines

From: Thomas Monjalon <[email protected]>
Sent: Monday, July 3, 2023 2:17 PM
To: Dumitrescu, Cristian; Volodymyr Fialko
Cc: [email protected]; Jerin Jacob Kollanukkaran; Anoob Joseph
Subject: Re: [PATCH v3] bitmap: add scan from offset function

Quoted 5 lines

----------------------------------------------------------------------
03/07/2023 12:56, Volodymyr Fialko:

Quoted 1 line

Since it's header-only library, there is issue with using __rte_intenal (appeared in v4).

What is the issue?

From V4 ci build failure(http://mails.dpdk.org/archives/test-report/2023-July/421235.html):
In file included from ../examples/ipsec-secgw/event_helper.c:6:
../lib/eal/include/rte_bitmap.h:645:2: error: Symbol is not public ABI
__rte_bitmap_scan_init_at(bmp, offset);
^

	../lib/eal/include/rte_bitmap.h:150:1: note: from 'diagnose_if' attribute on '__rte_bitmap_scan_init_at':
	__rte_internal
	^~~~~~~~~~~~~~
	../lib/eal/include/rte_compat.h:42:16: note: expanded from macro '__rte_internal'	
	__attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \
              		^           ~
	1 error generated.
Quoted 4 lines

OK I see.
So we should give up with __rte_internal for inline functions. As it is not supposed to be exposed to the applications, I think we can skip the __rte_experimental flag.

/Volodymyr

#22 lore raw

Re: [PATCH v5] bitmap: add scan from offset function

03/07/2024 15:42, Volodymyr Fialko:

Quoted 26 lines
Quoted 26 lines

From: Thomas Monjalon <[email protected]>
Sent: Wednesday, July 3, 2024 2:50 PM
To: Volodymyr Fialko
Cc: [email protected]; [email protected]; Jerin Jacob; Anoob Joseph
Subject: Re: [PATCH v5] bitmap: add scan from offset function

03/07/2023 14:39, Volodymyr Fialko:

Quoted 18 lines

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.

---
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

Quoted 8 lines
Quoted 5 lines

What was the build error?

You should not add an internal function in the public header file. At least, it should be experimental.

From our discussion in previous versions(V3, V4), It looks like we agreed to remove both markers.

Indeed, sorry I forgot this discussion.

#23 lore raw

Re: [PATCH v5] bitmap: add scan from offset function

In reply to Volodymyr Fialko
Quoted 5 lines · On Mon, 3 Jul 2023 14:39:08 +0200 Volodymyr Fialko <[email protected]> wrote:
lib/eal/include/rte_bitmap.h +5 -0
+/**
+ * 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()

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 154

Quoted 10 lines
lib/eal/include/rte_bitmap.h +10 -0
+ *
+ * @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;

Since this exposed in a header file, needs to be internal or experimental.

#24 lore raw

RE: [EXTERNAL] Re: [PATCH v5] bitmap: add scan from offset function

From discussion with Thomas in previous versions of this patch, we agreed to omit both markers.

Quoted 54 lines

From: Thomas Monjalon <[email protected]<mailto:[email protected]>>

Sent: Monday, July 3, 2023 2:17 PM

To: Dumitrescu, Cristian; Volodymyr Fialko

Cc [email protected]<mailto:[email protected]>; Jerin Jacob Kollanukkaran; Anoob Joseph

Subject: Re: [PATCH v3] bitmap: add scan from offset function

Quoted 6 lines

--------------------------------------------------------------------

--

03/07/2023 12:56, Volodymyr Fialko:

Quoted 7 lines
Quoted 3 lines

Since it's header-only library, there is issue with using __rte_intenal (appeared in v4).
Even if the function itself is not used directly, it get's included to the other public files. It explains why other functions in this library does not have the rte_internal prefix, but the double underscores.

What is the issue?

From V4 ci build failure(http://mails.dpdk.org/archives/test-report/2023-July/421235.html):

            In file included from ../examples/ipsec-secgw/event_helper.c:6:

            ../lib/eal/include/rte_bitmap.h:645:2: error: Symbol is not public ABI

                    __rte_bitmap_scan_init_at(bmp, offset);

                   ^

            ../lib/eal/include/rte_bitmap.h:150:1: note: from 'diagnose_if' attribute on '__rte_bitmap_scan_init_at':

            __rte_internal

            ^~~~~~~~~~~~~~

            ../lib/eal/include/rte_compat.h:42:16: note: expanded from macro '__rte_internal'

            __attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \

                                         ^           ~

            1 error generated.
Quoted 6 lines

OK I see.

So we should give up with __rte_internal for inline functions.

As it is not supposed to be exposed to the applications, I think we can skip the __rte_experimental flag.

/Volodymyr

From: Stephen Hemminger <[email protected]>
Sent: Friday, October 4, 2024 5:04 AM
To: Volodymyr Fialko <[email protected]>
Cc: [email protected]; [email protected]; Jerin Jacob <[email protected]>; Anoob Joseph <[email protected]>; [email protected]
Subject: [EXTERNAL] Re: [PATCH v5] bitmap: add scan from offset function
Mon, 3 Jul 2023 14: 39: 08 +0200 Volodymyr Fialko <vfialko@ marvell. com> wrote: > +/** > + * Bitmap initialize internal scan pointers at the given position for the scan function. > + * > + * Note: for private/internal use, ZjQcmQRYFpfptBannerStart
On Mon, 3 Jul 2023 14:39:08 +0200

Quoted 19 lines · Volodymyr Fialko <[email protected]<mailto:[email protected]>> wrote:
lib/eal/include/rte_bitmap.h +10 -0
+/**
 
+ * 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

lib/eal/include/rte_bitmap.h __rte_bitmap_scan_init(struct rte_bitmap *bmp) · line 154

Quoted 10 lines
lib/eal/include/rte_bitmap.h +5 -0
 
+ */
 
+static inline void
 
+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)
 
+{
 
+        uint64_t *slab1;

Since this exposed in a header file, needs to be internal or experimental.