Page MenuHomeFreeBSD

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

Authored by sumit.saxena_broadcom.com on Mon, Aug 3, 12:17 PM.

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.Mon, Aug 3, 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.