patch 'eal: introduce more macros for bit definition' has been queued to stable release 23.11.7

Shani Peretz shperetz at nvidia.com
Wed Apr 15 11:59:02 CEST 2026


Hi,

FYI, your patch has been queued to stable release 23.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/19/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/shanipr/dpdk-stable

This queued commit can be viewed at:
https://github.com/shanipr/dpdk-stable/commit/a1ed4e9b43d451fa656854f8c9c2e6b5a2c68cd2

Thanks.

Shani

---
>From a1ed4e9b43d451fa656854f8c9c2e6b5a2c68cd2 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen at huawei.com>
Date: Tue, 31 Mar 2026 13:42:59 +0100
Subject: [PATCH] eal: introduce more macros for bit definition

[ upstream commit 1d8f2285ed3ffc3dfbf0857a960915c0e8ef6a8d ]

Introduce macros:
1. RTE_SHIFT_VAL64: get the uint64_t value which shifted by nr.
2. RTE_SHIFT_VAL32: get the uint32_t value which shifted by nr.
3. RTE_GENMASK64: generate a contiguous 64bit bitmask starting at bit
                  position low and ending at position high.
4. RTE_GENMASK32: generate a contiguous 32bit bitmask starting at bit
                  position low and ending at position high.
5. RTE_FIELD_GET64: extract a 64bit field element.
6. RTE_FIELD_GET32: extract a 32bit field element.

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
Signed-off-by: Marat Khalili <marat.khalili at huawei.com>
---
 lib/eal/include/rte_bitops.h | 66 ++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h
index 1337a67b4a..cd7e4bbb7a 100644
--- a/lib/eal/include/rte_bitops.h
+++ b/lib/eal/include/rte_bitops.h
@@ -39,6 +39,72 @@ extern "C" {
  */
 #define RTE_BIT32(nr) (UINT32_C(1) << (nr))
 
+/**
+ * Get the uint32_t shifted value.
+ *
+ * @param val
+ *   The value to be shifted.
+ * @param nr
+ *   The shift number in range of 0 to (32 - width of val).
+ */
+#define RTE_SHIFT_VAL32(val, nr) (UINT32_C(val) << (nr))
+
+/**
+ * Get the uint64_t shifted value.
+ *
+ * @param val
+ *   The value to be shifted.
+ * @param nr
+ *   The shift number in range of 0 to (64 - width of val).
+ */
+#define RTE_SHIFT_VAL64(val, nr) (UINT64_C(val) << (nr))
+
+/**
+ * Generate a contiguous 32-bit mask
+ * starting at bit position low and ending at position high.
+ *
+ * @param high
+ *   High bit position.
+ * @param low
+ *   Low bit position.
+ */
+#define RTE_GENMASK32(high, low) \
+		(((~UINT32_C(0)) << (low)) & (~UINT32_C(0) >> (31u - (high))))
+
+/**
+ * Generate a contiguous 64-bit mask
+ * starting at bit position low and ending at position high.
+ *
+ * @param high
+ *   High bit position.
+ * @param low
+ *   Low bit position.
+ */
+#define RTE_GENMASK64(high, low) \
+		(((~UINT64_C(0)) << (low)) & (~UINT64_C(0) >> (63u - (high))))
+
+/**
+ * Extract a 32-bit field element.
+ *
+ * @param mask
+ *   Shifted mask.
+ * @param reg
+ *   Value of entire bitfield.
+ */
+#define RTE_FIELD_GET32(mask, reg) \
+		((typeof(mask))(((reg) & (mask)) >> rte_ctz32(mask)))
+
+/**
+ * Extract a 64-bit field element.
+ *
+ * @param mask
+ *   Shifted mask.
+ * @param reg
+ *   Value of entire bitfield.
+ */
+#define RTE_FIELD_GET64(mask, reg) \
+		((typeof(mask))(((reg) & (mask)) >> rte_ctz64(mask)))
+
 /*------------------------ 32-bit relaxed operations ------------------------*/
 
 /**
-- 
2.43.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-04-14 14:44:29.009073359 +0300
+++ 0001-eal-introduce-more-macros-for-bit-definition.patch	2026-04-14 14:44:28.362392000 +0300
@@ -1 +1 @@
-From 1d8f2285ed3ffc3dfbf0857a960915c0e8ef6a8d Mon Sep 17 00:00:00 2001
+From a1ed4e9b43d451fa656854f8c9c2e6b5a2c68cd2 Mon Sep 17 00:00:00 2001
@@ -3 +3 @@
-Date: Fri, 26 Jan 2024 06:10:06 +0000
+Date: Tue, 31 Mar 2026 13:42:59 +0100
@@ -5,0 +6,2 @@
+[ upstream commit 1d8f2285ed3ffc3dfbf0857a960915c0e8ef6a8d ]
+
@@ -16,0 +19 @@
+Signed-off-by: Marat Khalili <marat.khalili at huawei.com>
@@ -22 +25 @@
-index 6bd8bae21a..449565eeae 100644
+index 1337a67b4a..cd7e4bbb7a 100644


More information about the stable mailing list