Lines Matching refs:nbits
128 static void ethnl_bitmap32_update(u32 *dst, unsigned int nbits, in ethnl_bitmap32_update() argument
131 while (nbits > 0) { in ethnl_bitmap32_update()
135 if (nbits < 32) in ethnl_bitmap32_update()
136 real_mask &= ethnl_lower_bits(nbits); in ethnl_bitmap32_update()
143 if (nbits <= 32) in ethnl_bitmap32_update()
146 nbits -= 32; in ethnl_bitmap32_update()
171 int ethnl_bitset32_size(const u32 *val, const u32 *mask, unsigned int nbits, in ethnl_bitset32_size() argument
183 unsigned int nwords = DIV_ROUND_UP(nbits, 32); in ethnl_bitset32_size()
191 for (i = 0; i < nbits; i++) { in ethnl_bitset32_size()
233 const u32 *mask, unsigned int nbits, in ethnl_put_bitset32() argument
245 if (nla_put_u32(skb, ETHTOOL_A_BITSET_SIZE, nbits)) in ethnl_put_bitset32()
248 unsigned int nwords = DIV_ROUND_UP(nbits, 32); in ethnl_put_bitset32()
257 if (nbits % 32) in ethnl_put_bitset32()
258 dst[nwords - 1] &= ethnl_lower_bits(nbits); in ethnl_put_bitset32()
266 if (nbits % 32) in ethnl_put_bitset32()
267 dst[nwords - 1] &= ethnl_lower_bits(nbits); in ethnl_put_bitset32()
276 for (i = 0; i < nbits; i++) { in ethnl_put_bitset32()
377 static int ethnl_parse_bit(unsigned int *index, bool *val, unsigned int nbits, in ethnl_parse_bit() argument
394 if (idx >= nbits) { in ethnl_parse_bit()
409 idx = ethnl_name_to_idx(names, nbits, in ethnl_parse_bit()
429 ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits, in ethnl_update_bitset32_verbose() argument
452 ethnl_bitmap32_clear(bitmap, 0, nbits, mod); in ethnl_update_bitset32_verbose()
463 ret = ethnl_parse_bit(&idx, &new_val, nbits, bit_attr, no_mask, in ethnl_update_bitset32_verbose()
480 static int ethnl_compact_sanity_checks(unsigned int nbits, in ethnl_compact_sanity_checks() argument
523 if (attr_nbits <= nbits) in ethnl_compact_sanity_checks()
528 if (ethnl_bitmap32_not_zero(nla_data(test_attr), nbits, attr_nbits)) { in ethnl_compact_sanity_checks()
552 int ethnl_update_bitset32(u32 *bitmap, unsigned int nbits, in ethnl_update_bitset32() argument
569 return ethnl_update_bitset32_verbose(bitmap, nbits, attr, tb, in ethnl_update_bitset32()
571 ret = ethnl_compact_sanity_checks(nbits, attr, tb, extack); in ethnl_update_bitset32()
577 nla_get_u32(tb[ETHTOOL_A_BITSET_SIZE]), nbits); in ethnl_update_bitset32()
583 if (no_mask && change_bits < nbits) in ethnl_update_bitset32()
584 ethnl_bitmap32_clear(bitmap, change_bits, nbits, mod); in ethnl_update_bitset32()
605 unsigned int nbits, const struct nlattr *attr, in ethnl_parse_bitset() argument
626 ret = ethnl_compact_sanity_checks(nbits, attr, tb, extack); in ethnl_parse_bitset()
631 if (change_bits > nbits) in ethnl_parse_bitset()
632 change_bits = nbits; in ethnl_parse_bitset()
635 if (change_bits < nbits) in ethnl_parse_bitset()
636 bitmap_clear(val, change_bits, nbits - change_bits); in ethnl_parse_bitset()
638 bitmap_fill(mask, nbits); in ethnl_parse_bitset()
643 if (change_bits < nbits) in ethnl_parse_bitset()
645 nbits - change_bits); in ethnl_parse_bitset()
662 bitmap_zero(val, nbits); in ethnl_parse_bitset()
664 bitmap_fill(mask, nbits); in ethnl_parse_bitset()
666 bitmap_zero(mask, nbits); in ethnl_parse_bitset()
672 ret = ethnl_parse_bit(&idx, &bit_val, nbits, bit_attr, no_mask, in ethnl_parse_bitset()
700 unsigned int nbits, ethnl_string_array_t names, in ethnl_bitset_size() argument
709 if (nbits > ETHNL_SMALL_BITMAP_BITS) { in ethnl_bitset_size()
710 unsigned int nwords = DIV_ROUND_UP(nbits, 32); in ethnl_bitset_size()
721 bitmap_to_arr32(val32, val, nbits); in ethnl_bitset_size()
723 bitmap_to_arr32(mask32, mask, nbits); in ethnl_bitset_size()
726 ret = ethnl_bitset32_size(val32, mask32, nbits, names, compact); in ethnl_bitset_size()
728 if (nbits > ETHNL_SMALL_BITMAP_BITS) in ethnl_bitset_size()
736 unsigned int nbits, ethnl_string_array_t names, in ethnl_put_bitset() argument
745 if (nbits > ETHNL_SMALL_BITMAP_BITS) { in ethnl_put_bitset()
746 unsigned int nwords = DIV_ROUND_UP(nbits, 32); in ethnl_put_bitset()
757 bitmap_to_arr32(val32, val, nbits); in ethnl_put_bitset()
759 bitmap_to_arr32(mask32, mask, nbits); in ethnl_put_bitset()
762 ret = ethnl_put_bitset32(skb, attrtype, val32, mask32, nbits, names, in ethnl_put_bitset()
765 if (nbits > ETHNL_SMALL_BITMAP_BITS) in ethnl_put_bitset()
771 int ethnl_update_bitset(unsigned long *bitmap, unsigned int nbits, in ethnl_update_bitset() argument
780 if (nbits > ETHNL_SMALL_BITMAP_BITS) { in ethnl_update_bitset()
781 unsigned int dst_words = DIV_ROUND_UP(nbits, 32); in ethnl_update_bitset()
788 bitmap_to_arr32(bitmap32, bitmap, nbits); in ethnl_update_bitset()
789 ret = ethnl_update_bitset32(bitmap32, nbits, attr, names, extack, in ethnl_update_bitset()
792 bitmap_from_arr32(bitmap, bitmap32, nbits); in ethnl_update_bitset()
796 if (nbits > ETHNL_SMALL_BITMAP_BITS) in ethnl_update_bitset()
809 unsigned int nbits, ethnl_string_array_t names, in ethnl_bitset_size() argument
812 return ethnl_bitset32_size((const u32 *)val, (const u32 *)mask, nbits, in ethnl_bitset_size()
818 unsigned int nbits, ethnl_string_array_t names, in ethnl_put_bitset() argument
822 (const u32 *)mask, nbits, names, compact); in ethnl_put_bitset()
825 int ethnl_update_bitset(unsigned long *bitmap, unsigned int nbits, in ethnl_update_bitset() argument
829 return ethnl_update_bitset32((u32 *)bitmap, nbits, attr, names, extack, in ethnl_update_bitset()