162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci#ifndef _NET_ETHTOOL_BITSET_H
462306a36Sopenharmony_ci#define _NET_ETHTOOL_BITSET_H
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#define ETHNL_MAX_BITSET_SIZE S16_MAX
762306a36Sopenharmony_ci
862306a36Sopenharmony_citypedef const char (*const ethnl_string_array_t)[ETH_GSTRING_LEN];
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciint ethnl_bitset_is_compact(const struct nlattr *bitset, bool *compact);
1162306a36Sopenharmony_ciint ethnl_bitset_size(const unsigned long *val, const unsigned long *mask,
1262306a36Sopenharmony_ci		      unsigned int nbits, ethnl_string_array_t names,
1362306a36Sopenharmony_ci		      bool compact);
1462306a36Sopenharmony_ciint ethnl_bitset32_size(const u32 *val, const u32 *mask, unsigned int nbits,
1562306a36Sopenharmony_ci			ethnl_string_array_t names, bool compact);
1662306a36Sopenharmony_ciint ethnl_put_bitset(struct sk_buff *skb, int attrtype,
1762306a36Sopenharmony_ci		     const unsigned long *val, const unsigned long *mask,
1862306a36Sopenharmony_ci		     unsigned int nbits, ethnl_string_array_t names,
1962306a36Sopenharmony_ci		     bool compact);
2062306a36Sopenharmony_ciint ethnl_put_bitset32(struct sk_buff *skb, int attrtype, const u32 *val,
2162306a36Sopenharmony_ci		       const u32 *mask, unsigned int nbits,
2262306a36Sopenharmony_ci		       ethnl_string_array_t names, bool compact);
2362306a36Sopenharmony_ciint ethnl_update_bitset(unsigned long *bitmap, unsigned int nbits,
2462306a36Sopenharmony_ci			const struct nlattr *attr, ethnl_string_array_t names,
2562306a36Sopenharmony_ci			struct netlink_ext_ack *extack, bool *mod);
2662306a36Sopenharmony_ciint ethnl_update_bitset32(u32 *bitmap, unsigned int nbits,
2762306a36Sopenharmony_ci			  const struct nlattr *attr, ethnl_string_array_t names,
2862306a36Sopenharmony_ci			  struct netlink_ext_ack *extack, bool *mod);
2962306a36Sopenharmony_ciint ethnl_parse_bitset(unsigned long *val, unsigned long *mask,
3062306a36Sopenharmony_ci		       unsigned int nbits, const struct nlattr *attr,
3162306a36Sopenharmony_ci		       ethnl_string_array_t names,
3262306a36Sopenharmony_ci		       struct netlink_ext_ack *extack);
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#endif /* _NET_ETHTOOL_BITSET_H */
35