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, andrew@lunn.ch, f.fainelli@gmail.com,
mkubecek@suse.cz, eugenem@fb.com, jonathan.lemon@gmail.com
Subject: Re: [PATCH net-next v2 4/7] nfp: devlink: report fixed versions
Date: Wed, 30 Jan 2019 22:56:37 +0100 [thread overview]
Message-ID: <20190130215637.GC349@nanopsycho.orion> (raw)
In-Reply-To: <20190130190513.25718-5-jakub.kicinski@netronome.com>
Wed, Jan 30, 2019 at 08:05:10PM CET, jakub.kicinski@netronome.com wrote:
>Report information about the hardware.
>
>RFCv2:
> - add defines for board IDs which are likely to be reusable for
> other drivers (Jiri).
>
>Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>---
> .../net/ethernet/netronome/nfp/nfp_devlink.c | 37 ++++++++++++++++++-
> include/net/devlink.h | 5 +++
> 2 files changed, 41 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
>index cb3ef7e46614..9857fa663adf 100644
>--- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
>+++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
>@@ -172,6 +172,41 @@ static int nfp_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
> return ret;
> }
>
>+static const struct nfp_devlink_versions_simple {
>+ const char *key;
>+ const char *hwinfo;
>+} nfp_devlink_versions_hwinfo[] = {
>+ { DEVLINK_VERSION_GENERIC_BOARD_ID, "assembly.partno", },
>+ { DEVLINK_VERSION_GENERIC_BOARD_REV, "assembly.revision", },
>+ { "board.vendor", /* fab */ "assembly.vendor", },
>+ { "board.model", /* code name */ "assembly.model", },
>+};
>+
>+static int
>+nfp_devlink_versions_get_hwinfo(struct nfp_pf *pf, struct devlink_info_req *req)
>+{
>+ unsigned int i;
>+ int err;
>+
>+ for (i = 0; i < ARRAY_SIZE(nfp_devlink_versions_hwinfo); i++) {
>+ const struct nfp_devlink_versions_simple *info;
>+ const char *val;
>+
>+ info = &nfp_devlink_versions_hwinfo[i];
>+
>+ val = nfp_hwinfo_lookup(pf->hwinfo, info->hwinfo);
>+ if (!val)
>+ continue;
>+
>+ err = devlink_info_report_version(req, DEVLINK_VERSION_FIXED,
>+ info->key, val);
>+ if (err)
>+ return err;
>+ }
>+
>+ return 0;
>+}
>+
> static int
> nfp_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
> struct netlink_ext_ack *extack)
>@@ -191,7 +226,7 @@ nfp_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
> return err;
> }
>
>- return 0;
>+ return nfp_devlink_versions_get_hwinfo(pf, req);
> }
>
> const struct devlink_ops nfp_devlink_ops = {
>diff --git a/include/net/devlink.h b/include/net/devlink.h
>index ec72638aa47f..3d553cc6693d 100644
>--- a/include/net/devlink.h
>+++ b/include/net/devlink.h
>@@ -428,6 +428,11 @@ enum devlink_param_wol_types {
> .validate = _validate, \
> }
>
>+/* Part number, identifier of board design */
>+#define DEVLINK_VERSION_GENERIC_BOARD_ID "board.id"
>+/* Revision of board design */
>+#define DEVLINK_VERSION_GENERIC_BOARD_REV "board.rev"
Please have this as a separate patch, not part of "nfp".
>+
> enum devlink_version_type {
> DEVLINK_VERSION_FIXED,
> DEVLINK_VERSION_STORED,
>--
>2.19.2
>
next prev parent reply other threads:[~2019-01-30 23:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-30 19:05 [PATCH net-next v2 0/7] devlink: add device (driver) information API Jakub Kicinski
2019-01-30 19:05 ` [PATCH net-next v2 1/7] devlink: add device " Jakub Kicinski
2019-01-30 21:16 ` Jiri Pirko
2019-01-30 19:05 ` [PATCH net-next v2 2/7] devlink: add version reporting to devlink info API Jakub Kicinski
2019-01-30 21:54 ` Jiri Pirko
2019-01-30 19:05 ` [PATCH net-next v2 3/7] nfp: devlink: report driver name and serial number Jakub Kicinski
2019-01-30 19:05 ` [PATCH net-next v2 4/7] nfp: devlink: report fixed versions Jakub Kicinski
2019-01-30 21:56 ` Jiri Pirko [this message]
2019-01-30 19:05 ` [PATCH net-next v2 5/7] nfp: nsp: add support for versions command Jakub Kicinski
2019-01-30 19:05 ` [PATCH net-next v2 6/7] nfp: devlink: report the running and flashed versions Jakub Kicinski
2019-01-30 21:57 ` Jiri Pirko
2019-01-30 22:21 ` Jakub Kicinski
2019-01-30 22:19 ` Jiri Pirko
2019-01-30 19:05 ` [PATCH net-next v2 7/7] ethtool: add compat for devlink info Jakub Kicinski
2019-01-30 22:12 ` Jiri Pirko
2019-01-31 19:05 ` kbuild test robot
2019-02-01 4:06 ` kbuild test robot
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=20190130215637.GC349@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=eugenem@fb.com \
--cc=f.fainelli@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=jonathan.lemon@gmail.com \
--cc=mkubecek@suse.cz \
--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).