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