From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, idosch@nvidia.com,
petrm@nvidia.com, pabeni@redhat.com, edumazet@google.com,
mlxsw@nvidia.com, saeedm@nvidia.com, snelson@pensando.io
Subject: [patch net-next v4 09/12] mlxsw: core_linecards: Expose device PSID over device info
Date: Mon, 25 Jul 2022 10:29:22 +0200 [thread overview]
Message-ID: <20220725082925.366455-10-jiri@resnulli.us> (raw)
In-Reply-To: <20220725082925.366455-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@nvidia.com>
Use tunneled MGIR to obtain PSID of line card device and extend
device_info_get() op to fill up the info with that.
Example:
$ devlink dev info auxiliary/mlxsw_core.lc.0
auxiliary/mlxsw_core.lc.0:
versions:
fixed:
hw.revision 0
fw.psid MT_0000000749
running:
ini.version 4
fw 19.2010.1312
Signed-off-by: Jiri Pirko <jiri@nvidia.com>---
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
---
v3->v4:
- added Ido's RVB tag
v2->v3:
- fixed s/Used/Use/ typo in patch description
---
Documentation/networking/devlink/mlxsw.rst | 3 ++
drivers/net/ethernet/mellanox/mlxsw/core.h | 1 +
.../ethernet/mellanox/mlxsw/core_linecards.c | 31 +++++++++++++++++++
3 files changed, 35 insertions(+)
diff --git a/Documentation/networking/devlink/mlxsw.rst b/Documentation/networking/devlink/mlxsw.rst
index 65ceed98f94d..433962225bd4 100644
--- a/Documentation/networking/devlink/mlxsw.rst
+++ b/Documentation/networking/devlink/mlxsw.rst
@@ -75,6 +75,9 @@ The ``mlxsw`` driver reports the following versions for line card auxiliary devi
* - ``ini.version``
- running
- Version of line card INI loaded
+ * - ``fw.psid``
+ - fixed
+ - Line card device PSID
* - ``fw.version``
- running
- Three digit firmware version of line card device
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h
index e19860c05e75..a3246082219d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.h
@@ -568,6 +568,7 @@ struct mlxsw_linecard_device_info {
u16 fw_major;
u16 fw_minor;
u16 fw_sub_minor;
+ char psid[MLXSW_REG_MGIR_FW_INFO_PSID_SIZE];
};
struct mlxsw_linecard {
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c
index a9568d72ba1b..771a3e43b8bb 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c
@@ -87,6 +87,27 @@ static const char *mlxsw_linecard_type_name(struct mlxsw_linecard *linecard)
return linecard->name;
}
+static int mlxsw_linecard_device_psid_get(struct mlxsw_linecard *linecard,
+ u8 device_index, char *psid)
+{
+ struct mlxsw_core *mlxsw_core = linecard->linecards->mlxsw_core;
+ char mddt_pl[MLXSW_REG_MDDT_LEN];
+ char *mgir_pl;
+ int err;
+
+ mlxsw_reg_mddt_pack(mddt_pl, linecard->slot_index, device_index,
+ MLXSW_REG_MDDT_METHOD_QUERY,
+ MLXSW_REG(mgir), &mgir_pl);
+
+ mlxsw_reg_mgir_pack(mgir_pl);
+ err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(mddt), mddt_pl);
+ if (err)
+ return err;
+
+ mlxsw_reg_mgir_fw_info_psid_memcpy_from(mgir_pl, psid);
+ return 0;
+}
+
static int mlxsw_linecard_device_info_update(struct mlxsw_linecard *linecard)
{
struct mlxsw_core *mlxsw_core = linecard->linecards->mlxsw_core;
@@ -121,6 +142,12 @@ static int mlxsw_linecard_device_info_update(struct mlxsw_linecard *linecard)
linecard->slot_index);
return 0;
}
+
+ err = mlxsw_linecard_device_psid_get(linecard, device_index,
+ info.psid);
+ if (err)
+ return err;
+
linecard->device.info = info;
flashable_found = true;
} while (msg_seq);
@@ -293,6 +320,10 @@ int mlxsw_linecard_devlink_info_get(struct mlxsw_linecard *linecard,
if (linecard->active) {
struct mlxsw_linecard_device_info *info = &linecard->device.info;
+ err = devlink_info_version_fixed_put(req,
+ DEVLINK_INFO_VERSION_GENERIC_FW_PSID,
+ info->psid);
+
sprintf(buf, "%u.%u.%u", info->fw_major, info->fw_minor,
info->fw_sub_minor);
err = devlink_info_version_running_put(req,
--
2.35.3
next prev parent reply other threads:[~2022-07-25 8:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 8:29 [patch net-next v4 00/12] Implement dev info and dev flash for line cards Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 01/12] net: devlink: make sure that devlink_try_get() works with valid pointer during xarray iteration Jiri Pirko
2022-07-26 1:47 ` Jakub Kicinski
2022-07-25 8:29 ` [patch net-next v4 02/12] net: devlink: move net check into devlinks_xa_for_each_registered_get() Jiri Pirko
2022-07-26 1:48 ` Jakub Kicinski
2022-07-25 8:29 ` [patch net-next v4 03/12] net: devlink: introduce nested devlink entity for line card Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 04/12] mlxsw: core_linecards: Introduce per line card auxiliary device Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 05/12] mlxsw: core_linecards: Expose HW revision and INI version Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 06/12] mlxsw: reg: Extend MDDQ by device_info Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 07/12] mlxsw: core_linecards: Probe active line cards for devices and expose FW version Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 08/12] mlxsw: reg: Add Management DownStream Device Tunneling Register Jiri Pirko
2022-07-25 8:29 ` Jiri Pirko [this message]
2022-07-25 8:29 ` [patch net-next v4 10/12] mlxsw: core_linecards: Implement line card device flashing Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 11/12] selftests: mlxsw: Check line card info on provisioned line card Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 12/12] selftests: mlxsw: Check line card info on activated " Jiri Pirko
2022-07-26 21:20 ` [patch net-next v4 00/12] Implement dev info and dev flash for line cards patchwork-bot+netdevbpf
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=20220725082925.366455-10-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=snelson@pensando.io \
/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).