^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #ifndef _NET_ETHTOOL_BITSET_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #define _NET_ETHTOOL_BITSET_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define ETHNL_MAX_BITSET_SIZE S16_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) typedef const char (*const ethnl_string_array_t)[ETH_GSTRING_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) int ethnl_bitset_is_compact(const struct nlattr *bitset, bool *compact);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) int ethnl_bitset_size(const unsigned long *val, const unsigned long *mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) unsigned int nbits, ethnl_string_array_t names,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) bool compact);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) int ethnl_bitset32_size(const u32 *val, const u32 *mask, unsigned int nbits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) ethnl_string_array_t names, bool compact);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) int ethnl_put_bitset(struct sk_buff *skb, int attrtype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) const unsigned long *val, const unsigned long *mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) unsigned int nbits, ethnl_string_array_t names,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) bool compact);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) int ethnl_put_bitset32(struct sk_buff *skb, int attrtype, const u32 *val,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) const u32 *mask, unsigned int nbits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) ethnl_string_array_t names, bool compact);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int ethnl_update_bitset(unsigned long *bitmap, unsigned int nbits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) const struct nlattr *attr, ethnl_string_array_t names,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct netlink_ext_ack *extack, bool *mod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int ethnl_update_bitset32(u32 *bitmap, unsigned int nbits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) const struct nlattr *attr, ethnl_string_array_t names,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct netlink_ext_ack *extack, bool *mod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int ethnl_parse_bitset(unsigned long *val, unsigned long *mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned int nbits, const struct nlattr *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) ethnl_string_array_t names,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct netlink_ext_ack *extack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #endif /* _NET_ETHTOOL_BITSET_H */