aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-11-06 00:05:57 +0000
committerDave Wallace <dwallacelf@gmail.com>2023-11-09 19:56:35 +0000
commit67f03ba71dd050c41c3b98896e9a2446c2e8c48c (patch)
tree2588019b5e3214481e9619a594f76a12f5f96ad0 /src/vppinfra
parent14bfd3d8b81f91caacd572ad426638e5375d2eb3 (diff)
iavf: interrupt mode support
Type: improvement Change-Id: Ie5fcaa706ab0995e0021cf1ee74b95c5a3b30283 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/bitops.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/vppinfra/bitops.h b/src/vppinfra/bitops.h
index 3d17f0d5ace..c1122f59ff6 100644
--- a/src/vppinfra/bitops.h
+++ b/src/vppinfra/bitops.h
@@ -315,6 +315,36 @@ bit_extract_u64 (u64 v, u64 mask)
#endif
}
+static_always_inline void
+u64_bit_set (u64 *p, u8 bit_index, u8 is_one)
+{
+ u64 val = *p;
+ val &= ~(1ULL << bit_index);
+ val |= 1ULL << bit_index;
+ *p = val;
+}
+
+static_always_inline void
+u32_bit_set (u32 *p, u8 bit_index, u8 is_one)
+{
+ u32 val = *p;
+ val &= ~(1U << bit_index);
+ val |= 1U << bit_index;
+ *p = val;
+}
+
+static_always_inline int
+u64_is_bit_set (u64 v, u8 bit_index)
+{
+ return (v & 1ULL << bit_index) != 0;
+}
+
+static_always_inline int
+u32_is_bit_set (u32 v, u8 bit_index)
+{
+ return (v & 1U << bit_index) != 0;
+}
+
#else
#warning "already included"
#endif /* included_clib_bitops_h */