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()
442 return -EINVAL; in ethnl_update_bitset32_verbose()
447 return -EINVAL; in ethnl_update_bitset32_verbose()
461 return -EINVAL; in ethnl_update_bitset32_verbose()
481 const struct nlattr *nest, in ethnl_compact_sanity_checks() argument
492 return -EINVAL; in ethnl_compact_sanity_checks()
495 NL_SET_ERR_MSG_ATTR(extack, nest, in ethnl_compact_sanity_checks()
497 return -EINVAL; in ethnl_compact_sanity_checks()
500 NL_SET_ERR_MSG_ATTR(extack, nest, in ethnl_compact_sanity_checks()
502 return -EINVAL; in ethnl_compact_sanity_checks()
505 NL_SET_ERR_MSG_ATTR(extack, nest, in ethnl_compact_sanity_checks()
507 return -EINVAL; in ethnl_compact_sanity_checks()
515 return -EINVAL; in ethnl_compact_sanity_checks()
521 return -EINVAL; in ethnl_compact_sanity_checks()
531 return -EINVAL; in ethnl_compact_sanity_checks()
537 * ethnl_update_bitset32() - Apply a bitset nest to a u32 based bitmap
540 * @attr: nest attribute to parse and apply
541 * @names: array of bit names; may be null for compact format
563 ret = nla_parse_nested(tb, ARRAY_SIZE(bitset_policy) - 1, attr, in ethnl_update_bitset32()
590 * ethnl_parse_bitset() - Compute effective value and mask from bitset nest
594 * @attr: nest attribute to parse and apply
595 * @names: array of bit names; may be null for compact format
617 ret = nla_parse_nested(tb, ARRAY_SIZE(bitset_policy) - 1, attr, in ethnl_parse_bitset()
636 bitmap_clear(val, change_bits, nbits - change_bits); in ethnl_parse_bitset()
645 nbits - change_bits); in ethnl_parse_bitset()
654 return -EINVAL; in ethnl_parse_bitset()
659 return -EINVAL; in ethnl_parse_bitset()
687 /* 64-bit big endian architectures are the only case when u32 based bitmaps
714 return -ENOMEM; in ethnl_bitset_size()
750 return -ENOMEM; in ethnl_put_bitset()
785 return -ENOMEM; in ethnl_update_bitset()
804 /* On little endian 64-bit and all 32-bit architectures, an unsigned long