netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, oss-drivers@netronome.com
Subject: Re: [RFC net-next 2/6] devlink: add version reporting API
Date: Tue, 15 Jan 2019 11:12:17 +0100	[thread overview]
Message-ID: <20190115101217.GC2290@nanopsycho> (raw)
In-Reply-To: <20190115005009.16025-3-jakub.kicinski@netronome.com>

Tue, Jan 15, 2019 at 01:50:04AM CET, jakub.kicinski@netronome.com wrote:

[...]

>@@ -3701,6 +3732,40 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
> 	return msg->len;
> }
> 
>+int devlink_versions_report(struct sk_buff *skb, enum devlink_attr attr,
>+			    const char *version_name, const char *version_value)

Hmm, so this is a helper to construct the msg. I think it would be good
to have this somehow separated from the netlink. Meaning a separate enum
just for fixed/running/stored and perhaps a "context structure" which
you can use just as a pointer with layout invisible for the driver
(containing skb). Passing skb itself is a bit confusing and gives the
driver opportunity to put in some weird crap. Better to disallow it by
the api design.


>+{
>+	struct nlattr *nest;
>+	int err;
>+
>+	if (attr < DEVLINK_ATTR_INFO_VERSIONS_FIXED ||
>+	    attr > DEVLINK_ATTR_INFO_VERSIONS_STORED)
>+		return -EINVAL;
>+
>+	nest = nla_nest_start(skb, attr);
>+	if (!nest)
>+		return -EMSGSIZE;
>+
>+	err = nla_put_string(skb, DEVLINK_ATTR_INFO_VERSIONS_NAME,
>+			     version_name);
>+	if (err)
>+		goto nla_put_failure;
>+
>+	err = nla_put_string(skb, DEVLINK_ATTR_INFO_VERSIONS_VALUE,
>+			     version_value);
>+	if (err)
>+		goto nla_put_failure;
>+
>+	nla_nest_end(skb, nest);
>+
>+	return 0;
>+
>+nla_put_failure:
>+	nla_nest_cancel(skb, nest);
>+	return err;
>+}
>+EXPORT_SYMBOL_GPL(devlink_versions_report);
>+
> static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {
> 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING },
> 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING },
>-- 
>2.19.2
>

  reply	other threads:[~2019-01-15 10:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15  0:50 [RFC net-next 0/6] devlink: add device (driver) information API Jakub Kicinski
2019-01-15  0:50 ` [RFC net-next 1/6] devlink: add device " Jakub Kicinski
2019-01-15 10:15   ` Jiri Pirko
2019-01-15 17:41     ` Jakub Kicinski
2019-01-15 20:00       ` Andrew Lunn
2019-01-15 21:42         ` Jakub Kicinski
2019-01-15  0:50 ` [RFC net-next 2/6] devlink: add version reporting API Jakub Kicinski
2019-01-15 10:12   ` Jiri Pirko [this message]
2019-01-15  0:50 ` [RFC net-next 3/6] nfp: devlink: report serial number Jakub Kicinski
2019-01-15  0:50 ` [RFC net-next 4/6] nfp: devlink: report fixed versions Jakub Kicinski
2019-01-15 10:18   ` Jiri Pirko
2019-01-15 18:09     ` Jakub Kicinski
2019-01-15  0:50 ` [RFC net-next 5/6] nfp: nsp: add support for versions command Jakub Kicinski
2019-01-15  0:50 ` [RFC net-next 6/6] nfp: devlink: report the running and flashed versions Jakub Kicinski
2019-01-15  0:50 ` [RFC iproute2-next] devlink: add info subcommand Jakub Kicinski
2019-01-15  8:20   ` Jiri Pirko
2019-01-15 14:00     ` Andrew Lunn
2019-01-15 14:07       ` Jiri Pirko
2019-01-15 17:58       ` Jakub Kicinski
2019-01-15 17:53     ` Jakub Kicinski
2019-01-15 18:05       ` Jiri Pirko
2019-01-15 18:32         ` Jakub Kicinski
2019-01-15  1:00 ` [RFC net-next 0/6] devlink: add device (driver) information API Florian Fainelli
2019-01-15  1:18 ` Andrew Lunn
2019-01-15  1:33   ` Jakub Kicinski
2019-01-15  1:57     ` Andrew Lunn
2019-01-15  3:27       ` Jakub Kicinski
2019-01-15  7:36         ` Michal Kubecek
2019-01-15  8:12       ` Jiri Pirko
2019-01-15 19:30 ` Jonathan Lemon
2019-01-15 21:06   ` Jakub Kicinski
2019-01-15 23:41     ` Jiri Pirko
2019-01-16 19:00     ` Jonathan Lemon

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=20190115101217.GC2290@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.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).