ethtool: link up ethnl_header_policy as a nested policy

To get the most out of parsing by the core, and to allow dumping
full policies we need to specify which policy applies to nested
attrs. For headers it's ethnl_header_policy.

$ sed -i 's@\(ETHTOOL_A_.*HEADER\].*=\) { .type = NLA_NESTED },@\1\n\t\tNLA_POLICY_NESTED(ethnl_header_policy),@' net/ethtool/*

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski
2020-10-05 15:07:36 -07:00
committed by David S. Miller
parent ff419afa43
commit 329d9c333e
18 changed files with 58 additions and 29 deletions

View File

@@ -21,7 +21,8 @@ struct features_reply_data {
container_of(__reply_base, struct features_reply_data, base)
const struct nla_policy ethnl_features_get_policy[] = {
[ETHTOOL_A_FEATURES_HEADER] = { .type = NLA_NESTED },
[ETHTOOL_A_FEATURES_HEADER] =
NLA_POLICY_NESTED(ethnl_header_policy),
};
static void ethnl_features_to_bitmap32(u32 *dest, netdev_features_t src)
@@ -125,7 +126,8 @@ const struct ethnl_request_ops ethnl_features_request_ops = {
/* FEATURES_SET */
const struct nla_policy ethnl_features_set_policy[] = {
[ETHTOOL_A_FEATURES_HEADER] = { .type = NLA_NESTED },
[ETHTOOL_A_FEATURES_HEADER] =
NLA_POLICY_NESTED(ethnl_header_policy),
[ETHTOOL_A_FEATURES_WANTED] = { .type = NLA_NESTED },
};