Page MenuHomeFreeBSD

if_bnxt: add bitmap search/test-and-set helpers
Needs ReviewPublic

Authored by sumit.saxena_broadcom.com on Aug 3 2026, 12:17 PM.
Tags
None
Referenced Files
F171033310: D58605.id184657.diff
Tue, Sep 8, 7:35 AM
F170992735: D58605.id183284.diff
Tue, Sep 8, 1:44 AM
Unknown Object (File)
Mon, Sep 7, 11:27 AM
Unknown Object (File)
Sun, Sep 6, 1:33 AM
Unknown Object (File)
Sat, Sep 5, 11:41 AM
Unknown Object (File)
Sat, Sep 5, 10:25 AM
Unknown Object (File)
Fri, Sep 4, 1:17 AM
Unknown Object (File)
Thu, Sep 3, 11:16 AM
Subscribers
None

Details

Summary

Add bnxt_find_next_zero_bit()/bnxt_find_first_zero_bit()/
bnxt_test_and_set_bit()/bnxt_find_next_bit()/bnxt_test_and_clear_bit(),
wrapping sys/bitstring.h's bit_test()/bit_set()/bit_clear() with the
find-first/find-next and atomic test-and-flip semantics the kTLS
key-context ID allocator needs; bitstring.h has no equivalent
primitives.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Can't most these just be implemented in terms of the already existing primitives in sys/bitstring.h? Eg, bnxt_find_first_zero_bit -> bit_ffc bnxt_find_next_zero_bit -> bit_ffc_at bnxt_find_next_bit > bit_ffs_

The ones that can't have misleading naming. test_and_set and test_and_clear sound atomic, but these aren't. I might include non-atomic in the names.

This revision now requires changes to proceed.Aug 3 2026, 11:25 PM

Can't most these just be implemented in terms of the already existing primitives in sys/bitstring.h? Eg, bnxt_find_first_zero_bit -> bit_ffc bnxt_find_next_zero_bit -> bit_ffc_at bnxt_find_next_bit > bit_ffs_

The ones that can't have misleading naming. test_and_set and test_and_clear sound atomic, but these aren't. I might include non-atomic in the names.

I think we can do that. I will fix it up.