Lines Matching +full:array +full:- +full:nest

1 // SPDX-License-Identifier: GPL-2.0-only
8 /* Some bitmaps are internally represented as an array of unsigned long, some
9 * as an array of u32 (some even as single u32 for now). To avoid the need of
17 return ~(u32)0 >> (32 - n % 32); in ethnl_lower_bits()
26 * ethnl_bitmap32_clear() - Clear u32 based bitmap
78 * ethnl_bitmap32_not_zero() - Check if any bit is set in an interval
83 * Return: true if there is non-zero bit with index @start <= i < @end,
108 (end_word - start_word) * sizeof(u32))) in ethnl_bitmap32_not_zero()
116 * ethnl_bitmap32_update() - Modify u32 based bitmap according to value/mask
146 nbits -= 32; in ethnl_bitmap32_update()
159 * ethnl_bitset32_size() - Calculate size of bitset nested attribute
163 * @names: array of bit names (optional)
205 /* bit nest */ in ethnl_bitset32_size()
208 /* bits nest */ in ethnl_bitset32_size()
212 /* outermost nest */ in ethnl_bitset32_size()
217 * ethnl_put_bitset32() - Put a bitset nest into a message
219 * @attrtype: attribute type for the bitset nest
223 * @names: array of bit names (optional)
236 struct nlattr *nest; in ethnl_put_bitset32() local
239 nest = nla_nest_start(skb, attrtype); in ethnl_put_bitset32()
240 if (!nest) in ethnl_put_bitset32()
241 return -EMSGSIZE; in ethnl_put_bitset32()
258 dst[nwords - 1] &= ethnl_lower_bits(nbits); in ethnl_put_bitset32()
267 dst[nwords - 1] &= ethnl_lower_bits(nbits); in ethnl_put_bitset32()
297 nla_nest_end(skb, nest); in ethnl_put_bitset32()
301 nla_nest_cancel(skb, nest); in ethnl_put_bitset32()
302 return -EMSGSIZE; in ethnl_put_bitset32()
321 * ethnl_bitset_is_compact() - check if bitset attribute represents a compact
333 ret = nla_parse_nested(tb, ARRAY_SIZE(bitset_policy) - 1, bitset, in ethnl_bitset_is_compact()
340 return -EINVAL; in ethnl_bitset_is_compact()
345 return -EINVAL; in ethnl_bitset_is_compact()
352 * ethnl_name_to_idx() - look up string index for a name
353 * @names: array of ETH_GSTRING_LEN sized strings
354 * @n_names: number of strings in the array
357 * Return: index of the string if found, -ENOENT if not found
365 return -ENOENT; in ethnl_name_to_idx()
374 return -ENOENT; in ethnl_name_to_idx()
385 ret = nla_parse_nested(tb, ARRAY_SIZE(bit_policy) - 1, bit_attr, in ethnl_parse_bit()
398 return -EOPNOTSUPP; in ethnl_parse_bit()
406 return -EINVAL; in ethnl_parse_bit()
415 return -EOPNOTSUPP; in ethnl_parse_bit()
420 return -EINVAL; in ethnl_parse_bit()
429 * ethnl_bitmap32_equal() - Compare two bitmaps
462 return -EINVAL; in ethnl_update_bitset32_verbose()
467 return -EINVAL; in ethnl_update_bitset32_verbose()
481 return -ENOMEM; in ethnl_update_bitset32_verbose()
494 return -EINVAL; in ethnl_update_bitset32_verbose()
521 const struct nlattr *nest, in ethnl_compact_sanity_checks() argument
532 return -EINVAL; in ethnl_compact_sanity_checks()
535 NL_SET_ERR_MSG_ATTR(extack, nest, in ethnl_compact_sanity_checks()
537 return -EINVAL; in ethnl_compact_sanity_checks()
540 NL_SET_ERR_MSG_ATTR(extack, nest, in ethnl_compact_sanity_checks()
542 return -EINVAL; in ethnl_compact_sanity_checks()
545 NL_SET_ERR_MSG_ATTR(extack, nest, in ethnl_compact_sanity_checks()
547 return -EINVAL; in ethnl_compact_sanity_checks()
555 return -EINVAL; in ethnl_compact_sanity_checks()
561 return -EINVAL; in ethnl_compact_sanity_checks()
571 return -EINVAL; in ethnl_compact_sanity_checks()
577 * ethnl_update_bitset32() - Apply a bitset nest to a u32 based bitmap
580 * @attr: nest attribute to parse and apply
581 * @names: array of bit names; may be null for compact format
603 ret = nla_parse_nested(tb, ARRAY_SIZE(bitset_policy) - 1, attr, in ethnl_update_bitset32()
630 * ethnl_parse_bitset() - Compute effective value and mask from bitset nest
634 * @attr: nest attribute to parse and apply
635 * @names: array of bit names; may be null for compact format
657 ret = nla_parse_nested(tb, ARRAY_SIZE(bitset_policy) - 1, attr, in ethnl_parse_bitset()
676 bitmap_clear(val, change_bits, nbits - change_bits); in ethnl_parse_bitset()
685 nbits - change_bits); in ethnl_parse_bitset()
694 return -EINVAL; in ethnl_parse_bitset()
699 return -EINVAL; in ethnl_parse_bitset()
727 /* 64-bit big endian architectures are the only case when u32 based bitmaps
754 return -ENOMEM; in ethnl_bitset_size()
790 return -ENOMEM; in ethnl_put_bitset()
825 return -ENOMEM; in ethnl_update_bitset()
844 /* On little endian 64-bit and all 32-bit architectures, an unsigned long