git: aef2db6fac23 - main - if_bnxt: add bitmap search/test-and-set helpers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 Oct 2026 10:12:40 UTC
The branch main has been updated by ssaxena:
URL: https://cgit.FreeBSD.org/src/commit/?id=aef2db6fac2329bfd553f8db9c87b34dccdb33ac
commit aef2db6fac2329bfd553f8db9c87b34dccdb33ac
Author: Sumit Saxena <sumit.saxena@broadcom.com>
AuthorDate: 2026-07-29 12:14:27 +0000
Commit: Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2026-10-09 08:24:43 +0000
if_bnxt: add bitmap search/test-and-set helpers
Add bitmap search/test-and-set helpers the kTLS
key-context ID allocator needs; bitstring.h has no equivalent
primitives.
Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: Broadcom Inc.
Differential Revision: https://reviews.freebsd.org/D58605
---
sys/dev/bnxt/bnxt_en/bnxt.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/sys/dev/bnxt/bnxt_en/bnxt.h b/sys/dev/bnxt/bnxt_en/bnxt.h
index 04f0f0bf20ec..7b03aa1da866 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt.h
+++ b/sys/dev/bnxt/bnxt_en/bnxt.h
@@ -1584,4 +1584,24 @@ writel_fbsd(struct bnxt_softc *bp, u32 reg_off, u8 bar_idx, u32 val)
panic("%s: invalid bar_idx %u", __func__, bar_idx);
}
}
+
+/* Non-atomic test-and-set; caller must hold the lock serializing bmap.
+ * bitstring.h has no equivalent primitive. */
+static inline int
+bnxt_test_and_set_bit_nonatomic(int nr, bitstr_t *bmap)
+{
+ if (bit_test(bmap, nr))
+ return (1);
+ bit_set(bmap, nr);
+ return (0);
+}
+
+static inline int
+bnxt_test_and_clear_bit_nonatomic(int nr, bitstr_t *bmap)
+{
+ if (!bit_test(bmap, nr))
+ return (0);
+ bit_clear(bmap, nr);
+ return (1);
+}
#endif /* _BNXT_H */