summaryrefslogtreecommitdiffstats
path: root/net/ethtool/bitset.h
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2020-03-12 21:07:53 +0100
committerDavid S. Miller <davem@davemloft.net>2020-03-12 15:32:32 -0700
commit88db6d1e4f6222d22c1c4b4d4d7166cfa9d2fe0e (patch)
tree8857cf131cdaf9990495ec4010d240da360df15b /net/ethtool/bitset.h
parent0524399d4612f5af38b8383680dde4df4bc4eea2 (diff)
downloadlinux-88db6d1e4f6222d22c1c4b4d4d7166cfa9d2fe0e.tar.gz
linux-88db6d1e4f6222d22c1c4b4d4d7166cfa9d2fe0e.tar.bz2
linux-88db6d1e4f6222d22c1c4b4d4d7166cfa9d2fe0e.zip
ethtool: add ethnl_parse_bitset() helper
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>
Diffstat (limited to 'net/ethtool/bitset.h')
-rw-r--r--net/ethtool/bitset.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ethtool/bitset.h b/net/ethtool/bitset.h
index b849f9d19676..c2c2e0051d00 100644
--- a/net/ethtool/bitset.h
+++ b/net/ethtool/bitset.h
@@ -26,5 +26,9 @@ int ethnl_update_bitset(unsigned long *bitmap, unsigned int nbits,
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 */