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