blob: c2c2e0051d004665756ffcdf3f78fc481bddeca3 [file] [log] [blame]
Michal Kubecek10b518d2019-12-27 15:55:28 +01001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#ifndef _NET_ETHTOOL_BITSET_H
4#define _NET_ETHTOOL_BITSET_H
5
Michal Kubeceke34f1752020-02-24 20:42:12 +01006#define ETHNL_MAX_BITSET_SIZE S16_MAX
7
Michal Kubecek10b518d2019-12-27 15:55:28 +01008typedef const char (*const ethnl_string_array_t)[ETH_GSTRING_LEN];
9
10int ethnl_bitset_is_compact(const struct nlattr *bitset, bool *compact);
11int ethnl_bitset_size(const unsigned long *val, const unsigned long *mask,
12 unsigned int nbits, ethnl_string_array_t names,
13 bool compact);
14int ethnl_bitset32_size(const u32 *val, const u32 *mask, unsigned int nbits,
15 ethnl_string_array_t names, bool compact);
16int 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);
20int 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);
23int 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);
26int 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);
Michal Kubecek88db6d12020-03-12 21:07:53 +010029int 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);
Michal Kubecek10b518d2019-12-27 15:55:28 +010033
34#endif /* _NET_ETHTOOL_BITSET_H */