From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
jiri@resnulli.us, johannes@sipsolutions.net,
Jakub Kicinski <kuba@kernel.org>,
mkubecek@suse.cz
Subject: [PATCH net-next 09/10] ethtool: netlink: simplify arguments to ethnl_default_parse()
Date: Wed, 9 Aug 2023 11:26:47 -0700 [thread overview]
Message-ID: <20230809182648.1816537-10-kuba@kernel.org> (raw)
In-Reply-To: <20230809182648.1816537-1-kuba@kernel.org>
Pass struct genl_info directly instead of its members.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: mkubecek@suse.cz
---
net/ethtool/netlink.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index 9fc7c41f4786..f7b3171a0aad 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -316,10 +316,8 @@ static struct ethnl_dump_ctx *ethnl_dump_context(struct netlink_callback *cb)
/**
* ethnl_default_parse() - Parse request message
* @req_info: pointer to structure to put data into
- * @tb: parsed attributes
- * @net: request netns
+ * @info: genl_info from the request
* @request_ops: struct request_ops for request type
- * @extack: netlink extack for error reporting
* @require_dev: fail if no device identified in header
*
* Parse universal request header and call request specific ->parse_request()
@@ -328,19 +326,21 @@ static struct ethnl_dump_ctx *ethnl_dump_context(struct netlink_callback *cb)
* Return: 0 on success or negative error code
*/
static int ethnl_default_parse(struct ethnl_req_info *req_info,
- struct nlattr **tb, struct net *net,
+ const struct genl_info *info,
const struct ethnl_request_ops *request_ops,
- struct netlink_ext_ack *extack, bool require_dev)
+ bool require_dev)
{
+ struct nlattr **tb = info->attrs;
int ret;
ret = ethnl_parse_header_dev_get(req_info, tb[request_ops->hdr_attr],
- net, extack, require_dev);
+ genl_info_net(info), info->extack,
+ require_dev);
if (ret < 0)
return ret;
if (request_ops->parse_request) {
- ret = request_ops->parse_request(req_info, tb, extack);
+ ret = request_ops->parse_request(req_info, tb, info->extack);
if (ret < 0)
return ret;
}
@@ -393,8 +393,7 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info)
return -ENOMEM;
}
- ret = ethnl_default_parse(req_info, info->attrs, genl_info_net(info),
- ops, info->extack, !ops->allow_nodev_do);
+ ret = ethnl_default_parse(req_info, info, ops, !ops->allow_nodev_do);
if (ret < 0)
goto err_dev;
ethnl_init_reply_data(reply_data, ops, req_info->dev);
@@ -538,9 +537,7 @@ static int ethnl_default_start(struct netlink_callback *cb)
goto free_req_info;
}
- ret = ethnl_default_parse(req_info, info->info.attrs,
- sock_net(cb->skb->sk),
- ops, cb->extack, false);
+ ret = ethnl_default_parse(req_info, &info->info, ops, false);
if (req_info->dev) {
/* We ignore device specification in dump requests but as the
* same parser as for non-dump (doit) requests is used, it
--
2.41.0
next prev parent reply other threads:[~2023-08-09 18:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 18:26 [PATCH net-next 00/10] genetlink: provide struct genl_info to dumps Jakub Kicinski
2023-08-09 18:26 ` [PATCH net-next 01/10] genetlink: use push conditional locking info dumpit/done Jakub Kicinski
2023-08-09 20:56 ` Johannes Berg
2023-08-10 6:54 ` Jiri Pirko
2023-08-09 18:26 ` [PATCH net-next 02/10] genetlink: make genl_info->nlhdr const Jakub Kicinski
2023-08-10 8:22 ` Jiri Pirko
2023-08-09 18:26 ` [PATCH net-next 03/10] genetlink: remove userhdr from struct genl_info Jakub Kicinski
2023-08-09 20:59 ` Johannes Berg
2023-08-09 22:02 ` Jakub Kicinski
2023-08-10 8:26 ` Jiri Pirko
2023-08-09 18:26 ` [PATCH net-next 04/10] genetlink: add struct genl_info to struct genl_dumpit_info Jakub Kicinski
2023-08-10 8:33 ` Jiri Pirko
2023-08-09 18:26 ` [PATCH net-next 05/10] genetlink: use attrs from struct genl_info Jakub Kicinski
2023-08-09 21:04 ` Johannes Berg
2023-08-10 6:17 ` Miquel Raynal
2023-08-10 8:35 ` Jiri Pirko
2023-08-09 18:26 ` [PATCH net-next 06/10] genetlink: add a family pointer to " Jakub Kicinski
2023-08-09 18:26 ` [PATCH net-next 07/10] genetlink: add genlmsg_iput() API Jakub Kicinski
2023-08-10 9:07 ` Jiri Pirko
2023-08-10 16:13 ` Jakub Kicinski
2023-08-10 16:42 ` Jiri Pirko
2023-08-09 18:26 ` [PATCH net-next 08/10] netdev-genl: use struct genl_info for reply construction Jakub Kicinski
2023-08-10 9:10 ` Jiri Pirko
2023-08-09 18:26 ` Jakub Kicinski [this message]
2023-08-10 9:12 ` [PATCH net-next 09/10] ethtool: netlink: simplify arguments to ethnl_default_parse() Jiri Pirko
2023-08-09 18:26 ` [PATCH net-next 10/10] ethtool: netlink: always pass genl_info to .prepare_data Jakub Kicinski
2023-08-10 18:40 ` Vladimir Oltean
2023-08-10 8:30 ` [PATCH net-next 00/10] genetlink: provide struct genl_info to dumps Jiri Pirko
2023-08-10 16:14 ` Jakub Kicinski
2023-08-10 16:43 ` Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230809182648.1816537-10-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@resnulli.us \
--cc=johannes@sipsolutions.net \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).