Page MenuHomeFreeBSD

if_bnxt: add bitmap search/test-and-set helpers
ClosedPublic

Authored by sumit.saxena_broadcom.com on Aug 3 2026, 12:17 PM.
Tags
None
Referenced Files
F175814355: D58605.id183284.diff
Tue, Oct 13, 2:29 PM
Unknown Object (File)
Mon, Oct 12, 6:15 AM
Unknown Object (File)
Mon, Oct 12, 4:10 AM
Unknown Object (File)
Mon, Oct 12, 3:48 AM
Unknown Object (File)
Mon, Oct 12, 3:47 AM
Unknown Object (File)
Mon, Oct 12, 3:35 AM
Unknown Object (File)
Fri, Oct 9, 10:23 PM
Unknown Object (File)
Fri, Oct 9, 10:22 PM
Subscribers

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.

This revision is now accepted and ready to land.Wed, Oct 7, 3:48 PM