18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#ifndef _NET_ETHTOOL_BITSET_H
48c2ecf20Sopenharmony_ci#define _NET_ETHTOOL_BITSET_H
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#define ETHNL_MAX_BITSET_SIZE S16_MAX
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_citypedef const char (*const ethnl_string_array_t)[ETH_GSTRING_LEN];
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciint ethnl_bitset_is_compact(const struct nlattr *bitset, bool *compact);
118c2ecf20Sopenharmony_ciint ethnl_bitset_size(const unsigned long *val, const unsigned long *mask,
128c2ecf20Sopenharmony_ci		      unsigned int nbits, ethnl_string_array_t names,
138c2ecf20Sopenharmony_ci		      bool compact);
148c2ecf20Sopenharmony_ciint ethnl_bitset32_size(const u32 *val, const u32 *mask, unsigned int nbits,
158c2ecf20Sopenharmony_ci			ethnl_string_array_t names, bool compact);
168c2ecf20Sopenharmony_ciint ethnl_put_bitset(struct sk_buff *skb, int attrtype,
178c2ecf20Sopenharmony_ci		     const unsigned long *val, const unsigned long *mask,
188c2ecf20Sopenharmony_ci		     unsigned int nbits, ethnl_string_array_t names,
198c2ecf20Sopenharmony_ci		     bool compact);
208c2ecf20Sopenharmony_ciint ethnl_put_bitset32(struct sk_buff *skb, int attrtype, const u32 *val,
218c2ecf20Sopenharmony_ci		       const u32 *mask, unsigned int nbits,
228c2ecf20Sopenharmony_ci		       ethnl_string_array_t names, bool compact);
238c2ecf20Sopenharmony_ciint ethnl_update_bitset(unsigned long *bitmap, unsigned int nbits,
248c2ecf20Sopenharmony_ci			const struct nlattr *attr, ethnl_string_array_t names,
258c2ecf20Sopenharmony_ci			struct netlink_ext_ack *extack, bool *mod);
268c2ecf20Sopenharmony_ciint ethnl_update_bitset32(u32 *bitmap, unsigned int nbits,
278c2ecf20Sopenharmony_ci			  const struct nlattr *attr, ethnl_string_array_t names,
288c2ecf20Sopenharmony_ci			  struct netlink_ext_ack *extack, bool *mod);
298c2ecf20Sopenharmony_ciint ethnl_parse_bitset(unsigned long *val, unsigned long *mask,
308c2ecf20Sopenharmony_ci		       unsigned int nbits, const struct nlattr *attr,
318c2ecf20Sopenharmony_ci		       ethnl_string_array_t names,
328c2ecf20Sopenharmony_ci		       struct netlink_ext_ack *extack);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#endif /* _NET_ETHTOOL_BITSET_H */
35