summaryrefslogtreecommitdiff
path: root/net/ethtool/channels.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2020-10-06 01:07:33 +0300
committerDavid S. Miller <davem@davemloft.net>2020-10-06 16:25:55 +0300
commit4f30974feb9667f12e224b195b551a170fcc8723 (patch)
tree83fd7df8ebb7892f52ff9cfa4cf41a386ec06d4e /net/ethtool/channels.c
parent02da0b615b4bd7db747ed77199d5f1a161a0411a (diff)
downloadlinux-4f30974feb9667f12e224b195b551a170fcc8723.tar.xz
ethtool: wire up get policies to ops
Wire up policies for get commands in struct nla_policy of the ethtool family. Make use of genetlink code attr validation and parsing, as well as allow dumping policies to user space. For every ETHTOOL_MSG_*_GET: - add 'ethnl_' prefix to policy name - add extern declaration in net/ethtool/netlink.h - wire up the policy & attr in ethtool_genl_ops[]. - remove .request_policy and .max_attr from ethnl_request_ops. Obviously core only records the first "layer" of parsed attrs so we still need to parse the sub-attrs of the nested header attribute. v2: - merge of patches 1 and 2 from v1 - remove stray empty lines in ops - also remove .max_attr Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethtool/channels.c')
-rw-r--r--net/ethtool/channels.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ethtool/channels.c b/net/ethtool/channels.c
index 9ecda09ecb11..6ffcea099fd3 100644
--- a/net/ethtool/channels.c
+++ b/net/ethtool/channels.c
@@ -17,8 +17,8 @@ struct channels_reply_data {
#define CHANNELS_REPDATA(__reply_base) \
container_of(__reply_base, struct channels_reply_data, base)
-static const struct nla_policy
-channels_get_policy[ETHTOOL_A_CHANNELS_MAX + 1] = {
+const struct nla_policy
+ethnl_channels_get_policy[ETHTOOL_A_CHANNELS_MAX + 1] = {
[ETHTOOL_A_CHANNELS_UNSPEC] = { .type = NLA_REJECT },
[ETHTOOL_A_CHANNELS_HEADER] = { .type = NLA_NESTED },
[ETHTOOL_A_CHANNELS_RX_MAX] = { .type = NLA_REJECT },
@@ -99,10 +99,8 @@ const struct ethnl_request_ops ethnl_channels_request_ops = {
.request_cmd = ETHTOOL_MSG_CHANNELS_GET,
.reply_cmd = ETHTOOL_MSG_CHANNELS_GET_REPLY,
.hdr_attr = ETHTOOL_A_CHANNELS_HEADER,
- .max_attr = ETHTOOL_A_CHANNELS_MAX,
.req_info_size = sizeof(struct channels_req_info),
.reply_data_size = sizeof(struct channels_reply_data),
- .request_policy = channels_get_policy,
.prepare_data = channels_prepare_data,
.reply_size = channels_reply_size,