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
F175318309: D58605.id183284.diff
Fri, Oct 9, 10:23 PM
F175318298: D58605.diff
Fri, Oct 9, 10:22 PM
Unknown Object (File)
Wed, Oct 7, 3:40 PM
Unknown Object (File)
Mon, Oct 5, 2:11 PM
Unknown Object (File)
Wed, Sep 30, 12:37 AM
Unknown Object (File)
Mon, Sep 28, 7:34 PM
Unknown Object (File)
Mon, Sep 28, 2:32 PM
Unknown Object (File)
Mon, Sep 28, 12:48 AM
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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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