Commit f2f069da authored by David S. Miller's avatar David S. Miller

Merge branch 'ethtool-extack'

Jakub Kicinski says:

====================
net: support extack in dump and simplify ethtool uAPI

Ethtool currently requires header nest to be always present even if
it doesn't have to carry any attr for a given request. This inflicts
unnecessary pain on the users.

What makes it worse is that extack was not working in dump's ->start()
callback. Address both of those issues.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 23813168 500e1340
...@@ -311,6 +311,7 @@ struct netlink_dump_control { ...@@ -311,6 +311,7 @@ struct netlink_dump_control {
int (*start)(struct netlink_callback *); int (*start)(struct netlink_callback *);
int (*dump)(struct sk_buff *skb, struct netlink_callback *); int (*dump)(struct sk_buff *skb, struct netlink_callback *);
int (*done)(struct netlink_callback *); int (*done)(struct netlink_callback *);
struct netlink_ext_ack *extack;
void *data; void *data;
struct module *module; struct module *module;
u32 min_dump_alloc; u32 min_dump_alloc;
......
...@@ -96,6 +96,8 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info, ...@@ -96,6 +96,8 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
int ret; int ret;
if (!header) { if (!header) {
if (!require_dev)
return 0;
NL_SET_ERR_MSG(extack, "request header missing"); NL_SET_ERR_MSG(extack, "request header missing");
return -EINVAL; return -EINVAL;
} }
......
...@@ -2360,7 +2360,9 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, ...@@ -2360,7 +2360,9 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
cb->strict_check = !!(nlk2->flags & NETLINK_F_STRICT_CHK); cb->strict_check = !!(nlk2->flags & NETLINK_F_STRICT_CHK);
if (control->start) { if (control->start) {
cb->extack = control->extack;
ret = control->start(cb); ret = control->start(cb);
cb->extack = NULL;
if (ret) if (ret)
goto error_put; goto error_put;
} }
......
...@@ -912,6 +912,7 @@ static int genl_family_rcv_msg_dumpit(const struct genl_family *family, ...@@ -912,6 +912,7 @@ static int genl_family_rcv_msg_dumpit(const struct genl_family *family,
.start = genl_start, .start = genl_start,
.dump = genl_lock_dumpit, .dump = genl_lock_dumpit,
.done = genl_lock_done, .done = genl_lock_done,
.extack = extack,
}; };
genl_unlock(); genl_unlock();
...@@ -924,6 +925,7 @@ static int genl_family_rcv_msg_dumpit(const struct genl_family *family, ...@@ -924,6 +925,7 @@ static int genl_family_rcv_msg_dumpit(const struct genl_family *family,
.start = genl_start, .start = genl_start,
.dump = ops->dumpit, .dump = ops->dumpit,
.done = genl_parallel_done, .done = genl_parallel_done,
.extack = extack,
}; };
err = __netlink_dump_start(net->genl_sock, skb, nlh, &c); err = __netlink_dump_start(net->genl_sock, skb, nlh, &c);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment