mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 00:48:50 +00:00
88db6d1e4f
Unlike other SET type commands, modifying netdev features is required to provide a reply telling userspace what was actually changed, compared to what was requested. For that purpose, the "modified" flag provided by ethnl_update_bitset() is not sufficient, we need full information which bits were requested to change. Therefore provide ethnl_parse_bitset() returning effective value and mask bitmaps equivalent to the contents of a bitset nested attribute. v2: use non-atomic __set_bit() (suggested by David Miller) Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
34 lines
1.5 KiB
C
34 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#ifndef _NET_ETHTOOL_BITSET_H
|
|
#define _NET_ETHTOOL_BITSET_H
|
|
|
|
#define ETHNL_MAX_BITSET_SIZE S16_MAX
|
|
|
|
typedef const char (*const ethnl_string_array_t)[ETH_GSTRING_LEN];
|
|
|
|
int ethnl_bitset_is_compact(const struct nlattr *bitset, bool *compact);
|
|
int ethnl_bitset_size(const unsigned long *val, const unsigned long *mask,
|
|
unsigned int nbits, ethnl_string_array_t names,
|
|
bool compact);
|
|
int ethnl_bitset32_size(const u32 *val, const u32 *mask, unsigned int nbits,
|
|
ethnl_string_array_t names, bool compact);
|
|
int ethnl_put_bitset(struct sk_buff *skb, int attrtype,
|
|
const unsigned long *val, const unsigned long *mask,
|
|
unsigned int nbits, ethnl_string_array_t names,
|
|
bool compact);
|
|
int ethnl_put_bitset32(struct sk_buff *skb, int attrtype, const u32 *val,
|
|
const u32 *mask, unsigned int nbits,
|
|
ethnl_string_array_t names, bool compact);
|
|
int ethnl_update_bitset(unsigned long *bitmap, unsigned int nbits,
|
|
const struct nlattr *attr, ethnl_string_array_t names,
|
|
struct netlink_ext_ack *extack, bool *mod);
|
|
int ethnl_update_bitset32(u32 *bitmap, unsigned int nbits,
|
|
const struct nlattr *attr, ethnl_string_array_t names,
|
|
struct netlink_ext_ack *extack, bool *mod);
|
|
int ethnl_parse_bitset(unsigned long *val, unsigned long *mask,
|
|
unsigned int nbits, const struct nlattr *attr,
|
|
ethnl_string_array_t names,
|
|
struct netlink_ext_ack *extack);
|
|
|
|
#endif /* _NET_ETHTOOL_BITSET_H */
|