* [PATCH net-next 0/2] mlxsw: Add support for devlink info command
@ 2019-03-26 13:46 Ido Schimmel
2019-03-26 13:46 ` [PATCH net-next 1/2] mlxsw: reg: Add MGIR register Ido Schimmel
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Ido Schimmel @ 2019-03-26 13:46 UTC (permalink / raw)
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Jiri Pirko, Shalom Toledo, mlxsw,
Ido Schimmel
Shalom says:
Expose the following ASIC information via devlink info command:
- Hardware revision
- Firmware PSID
- Running firmware version
Standard output example:
$ devlink dev info pci/0000:03:00.0
pci/0000:03:00.0:
versions:
fixed:
hw.revision A0
fw.psid MT_2750110033
running:
fw.version 13.1910.622
Pretty JSON example:
$ devlink -jp dev info pci/0000:03:00.0
{
"info": {
"pci/0000:03:00.0": {
"versions": {
"fixed": {
"hw.revision": "A0",
"fw.psid": "MT_2750110033"
},
"running": {
"fw.version": "13.1910.622"
}
}
}
}
}
Shalom Toledo (2):
mlxsw: reg: Add MGIR register
mlxsw: core: Add support for devlink info command
drivers/net/ethernet/mellanox/mlxsw/core.c | 36 ++++++++++++++
drivers/net/ethernet/mellanox/mlxsw/reg.h | 55 ++++++++++++++++++++++
2 files changed, 91 insertions(+)
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH net-next 1/2] mlxsw: reg: Add MGIR register 2019-03-26 13:46 [PATCH net-next 0/2] mlxsw: Add support for devlink info command Ido Schimmel @ 2019-03-26 13:46 ` Ido Schimmel 2019-03-26 13:46 ` [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command Ido Schimmel 2019-03-27 20:58 ` [PATCH net-next 0/2] mlxsw: " David Miller 2 siblings, 0 replies; 11+ messages in thread From: Ido Schimmel @ 2019-03-26 13:46 UTC (permalink / raw) To: netdev@vger.kernel.org Cc: davem@davemloft.net, Jiri Pirko, Shalom Toledo, mlxsw, Ido Schimmel From: Shalom Toledo <shalomt@mellanox.com> Add MGIR register. MGIR, Management General Information Register, allows software to query the hardware and firmware general information. Signed-off-by: Shalom Toledo <shalomt@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 55 +++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index eb4c5e8964cd..e1ee7f4994db 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -8534,6 +8534,60 @@ static inline void mlxsw_reg_mpar_pack(char *payload, u8 local_port, mlxsw_reg_mpar_pa_id_set(payload, pa_id); } +/* MGIR - Management General Information Register + * ---------------------------------------------- + * MGIR register allows software to query the hardware and firmware general + * information. + */ +#define MLXSW_REG_MGIR_ID 0x9020 +#define MLXSW_REG_MGIR_LEN 0x9C + +MLXSW_REG_DEFINE(mgir, MLXSW_REG_MGIR_ID, MLXSW_REG_MGIR_LEN); + +/* reg_mgir_hw_info_device_hw_revision + * Access: RO + */ +MLXSW_ITEM32(reg, mgir, hw_info_device_hw_revision, 0x0, 16, 16); + +#define MLXSW_REG_MGIR_FW_INFO_PSID_SIZE 16 + +/* reg_mgir_fw_info_psid + * PSID (ASCII string). + * Access: RO + */ +MLXSW_ITEM_BUF(reg, mgir, fw_info_psid, 0x30, MLXSW_REG_MGIR_FW_INFO_PSID_SIZE); + +/* reg_mgir_fw_info_extended_major + * Access: RO + */ +MLXSW_ITEM32(reg, mgir, fw_info_extended_major, 0x44, 0, 32); + +/* reg_mgir_fw_info_extended_minor + * Access: RO + */ +MLXSW_ITEM32(reg, mgir, fw_info_extended_minor, 0x48, 0, 32); + +/* reg_mgir_fw_info_extended_sub_minor + * Access: RO + */ +MLXSW_ITEM32(reg, mgir, fw_info_extended_sub_minor, 0x4C, 0, 32); + +static inline void mlxsw_reg_mgir_pack(char *payload) +{ + MLXSW_REG_ZERO(mgir, payload); +} + +static inline void +mlxsw_reg_mgir_unpack(char *payload, u32 *hw_rev, char *fw_info_psid, + u32 *fw_major, u32 *fw_minor, u32 *fw_sub_minor) +{ + *hw_rev = mlxsw_reg_mgir_hw_info_device_hw_revision_get(payload); + mlxsw_reg_mgir_fw_info_psid_memcpy_from(payload, fw_info_psid); + *fw_major = mlxsw_reg_mgir_fw_info_extended_major_get(payload); + *fw_minor = mlxsw_reg_mgir_fw_info_extended_minor_get(payload); + *fw_sub_minor = mlxsw_reg_mgir_fw_info_extended_sub_minor_get(payload); +} + /* MRSR - Management Reset and Shutdown Register * --------------------------------------------- * MRSR register is used to reset or shutdown the switch or @@ -9958,6 +10012,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { MLXSW_REG(mcia), MLXSW_REG(mpat), MLXSW_REG(mpar), + MLXSW_REG(mgir), MLXSW_REG(mrsr), MLXSW_REG(mlcr), MLXSW_REG(mpsc), -- 2.20.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command 2019-03-26 13:46 [PATCH net-next 0/2] mlxsw: Add support for devlink info command Ido Schimmel 2019-03-26 13:46 ` [PATCH net-next 1/2] mlxsw: reg: Add MGIR register Ido Schimmel @ 2019-03-26 13:46 ` Ido Schimmel 2019-03-26 20:48 ` Jakub Kicinski 2019-03-27 20:58 ` [PATCH net-next 0/2] mlxsw: " David Miller 2 siblings, 1 reply; 11+ messages in thread From: Ido Schimmel @ 2019-03-26 13:46 UTC (permalink / raw) To: netdev@vger.kernel.org Cc: davem@davemloft.net, Jiri Pirko, Shalom Toledo, mlxsw, Ido Schimmel From: Shalom Toledo <shalomt@mellanox.com> Expose the following ASIC information via devlink info command: - Hardware revision - Firmware PSID - Running firmware version Standard output example: $ devlink dev info pci/0000:03:00.0 pci/0000:03:00.0: versions: fixed: hw.revision A0 fw.psid MT_2750110033 running: fw.version 13.1910.622 Pretty JSON example: $ devlink -jp dev info pci/0000:03:00.0 { "info": { "pci/0000:03:00.0": { "versions": { "fixed": { "hw.revision": "A0", "fw.psid": "MT_2750110033" }, "running": { "fw.version": "13.1910.622" } } } } } Signed-off-by: Shalom Toledo <shalomt@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> --- drivers/net/ethernet/mellanox/mlxsw/core.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index e70bb673eeec..61ab3fea2376 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -934,6 +934,41 @@ mlxsw_devlink_sb_occ_tc_port_bind_get(struct devlink_port *devlink_port, pool_type, p_cur, p_max); } +static int +mlxsw_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req, + struct netlink_ext_ack *extack) +{ + struct mlxsw_core *mlxsw_core = devlink_priv(devlink); + char fw_info_psid[MLXSW_REG_MGIR_FW_INFO_PSID_SIZE]; + u32 hw_rev, fw_major, fw_minor, fw_sub_minor; + char mgir_pl[MLXSW_REG_MGIR_LEN]; + char buf[32]; + int err; + + mlxsw_reg_mgir_pack(mgir_pl); + err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(mgir), mgir_pl); + if (err) + return err; + mlxsw_reg_mgir_unpack(mgir_pl, &hw_rev, fw_info_psid, &fw_major, + &fw_minor, &fw_sub_minor); + + sprintf(buf, "%X", hw_rev); + err = devlink_info_version_fixed_put(req, "hw.revision", buf); + if (err) + return err; + + err = devlink_info_version_fixed_put(req, "fw.psid", fw_info_psid); + if (err) + return err; + + sprintf(buf, "%d.%d.%d", fw_major, fw_minor, fw_sub_minor); + err = devlink_info_version_running_put(req, "fw.version", buf); + if (err) + return err; + + return 0; +} + static int mlxsw_devlink_core_bus_device_reload(struct devlink *devlink, struct netlink_ext_ack *extack) { @@ -968,6 +1003,7 @@ static const struct devlink_ops mlxsw_devlink_ops = { .sb_occ_max_clear = mlxsw_devlink_sb_occ_max_clear, .sb_occ_port_pool_get = mlxsw_devlink_sb_occ_port_pool_get, .sb_occ_tc_port_bind_get = mlxsw_devlink_sb_occ_tc_port_bind_get, + .info_get = mlxsw_devlink_info_get, }; static int -- 2.20.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command 2019-03-26 13:46 ` [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command Ido Schimmel @ 2019-03-26 20:48 ` Jakub Kicinski 2019-03-27 9:47 ` Petr Machata 2019-03-27 11:08 ` Jiri Pirko 0 siblings, 2 replies; 11+ messages in thread From: Jakub Kicinski @ 2019-03-26 20:48 UTC (permalink / raw) To: Ido Schimmel Cc: netdev@vger.kernel.org, davem@davemloft.net, Jiri Pirko, Shalom Toledo, mlxsw On Tue, 26 Mar 2019 13:46:26 +0000, Ido Schimmel wrote: > From: Shalom Toledo <shalomt@mellanox.com> > > Expose the following ASIC information via devlink info command: > - Hardware revision > - Firmware PSID > - Running firmware version > > Standard output example: > $ devlink dev info pci/0000:03:00.0 > pci/0000:03:00.0: > versions: > fixed: > hw.revision A0 > fw.psid MT_2750110033 > running: > fw.version 13.1910.622 > > Pretty JSON example: > $ devlink -jp dev info pci/0000:03:00.0 > { > "info": { > "pci/0000:03:00.0": { > "versions": { > "fixed": { > "hw.revision": "A0", > "fw.psid": "MT_2750110033" > }, > "running": { > "fw.version": "13.1910.622" > } > } > } > } > } > > Signed-off-by: Shalom Toledo <shalomt@mellanox.com> > Acked-by: Jiri Pirko <jiri@mellanox.com> > Signed-off-by: Ido Schimmel <idosch@mellanox.com> Looks good & glad to see it, but what's a PSID? ;) I found this after 5 seconds of googling: http://www.mellanox.com/page/firmware_HCA_FW_identification But it still just say "PSID" without explaining what the acronym stands for :) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command 2019-03-26 20:48 ` Jakub Kicinski @ 2019-03-27 9:47 ` Petr Machata 2019-03-27 17:53 ` Jakub Kicinski 2019-03-27 11:08 ` Jiri Pirko 1 sibling, 1 reply; 11+ messages in thread From: Petr Machata @ 2019-03-27 9:47 UTC (permalink / raw) To: Jakub Kicinski Cc: Ido Schimmel, netdev@vger.kernel.org, davem@davemloft.net, Jiri Pirko, Shalom Toledo, mlxsw Jakub Kicinski <jakub.kicinski@netronome.com> writes: > Looks good & glad to see it, but what's a PSID? ;) > > I found this after 5 seconds of googling: > > http://www.mellanox.com/page/firmware_HCA_FW_identification > > But it still just say "PSID" without explaining what the acronym stands > for :) "Parameter Set ID" http://www.mellanox.com/pdf/MFT/MFT_Windows_user_manual.pdf ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command 2019-03-27 9:47 ` Petr Machata @ 2019-03-27 17:53 ` Jakub Kicinski 2019-03-27 19:44 ` Ido Schimmel 0 siblings, 1 reply; 11+ messages in thread From: Jakub Kicinski @ 2019-03-27 17:53 UTC (permalink / raw) To: Petr Machata, Jiri Pirko Cc: Ido Schimmel, netdev@vger.kernel.org, davem@davemloft.net, Shalom Toledo, mlxsw On Wed, 27 Mar 2019 09:47:14 +0000, Petr Machata wrote: > Jakub Kicinski <jakub.kicinski@netronome.com> writes: > > > Looks good & glad to see it, but what's a PSID? ;) > > > > I found this after 5 seconds of googling: > > > > http://www.mellanox.com/page/firmware_HCA_FW_identification > > > > But it still just say "PSID" without explaining what the acronym stands > > for :) > > "Parameter Set ID" > http://www.mellanox.com/pdf/MFT/MFT_Windows_user_manual.pdf Thanks, would it be okay for you guys to spell that out, or at least add a description to the doc? Hopefully that can help with reuse and on the flip side avoiding using the same acronym for completely different things.. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command 2019-03-27 17:53 ` Jakub Kicinski @ 2019-03-27 19:44 ` Ido Schimmel 2019-03-27 20:36 ` Jakub Kicinski 0 siblings, 1 reply; 11+ messages in thread From: Ido Schimmel @ 2019-03-27 19:44 UTC (permalink / raw) To: Jakub Kicinski Cc: Petr Machata, Jiri Pirko, netdev@vger.kernel.org, davem@davemloft.net, Shalom Toledo, mlxsw On Wed, Mar 27, 2019 at 10:53:37AM -0700, Jakub Kicinski wrote: > On Wed, 27 Mar 2019 09:47:14 +0000, Petr Machata wrote: > > Jakub Kicinski <jakub.kicinski@netronome.com> writes: > > > > > Looks good & glad to see it, but what's a PSID? ;) > > > > > > I found this after 5 seconds of googling: > > > > > > http://www.mellanox.com/page/firmware_HCA_FW_identification > > > > > > But it still just say "PSID" without explaining what the acronym stands > > > for :) > > > > "Parameter Set ID" > > http://www.mellanox.com/pdf/MFT/MFT_Windows_user_manual.pdf > > Thanks, would it be okay for you guys to spell that out, or at least > add a description to the doc? Hopefully that can help with reuse and > on the flip side avoiding using the same acronym for completely > different things.. OK. We can add fw.psid to Documentation/networking/devlink-info-versions.rst ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command 2019-03-27 19:44 ` Ido Schimmel @ 2019-03-27 20:36 ` Jakub Kicinski 0 siblings, 0 replies; 11+ messages in thread From: Jakub Kicinski @ 2019-03-27 20:36 UTC (permalink / raw) To: Ido Schimmel Cc: Petr Machata, Jiri Pirko, netdev@vger.kernel.org, davem@davemloft.net, Shalom Toledo, mlxsw On Wed, 27 Mar 2019 19:44:11 +0000, Ido Schimmel wrote: > On Wed, Mar 27, 2019 at 10:53:37AM -0700, Jakub Kicinski wrote: > > On Wed, 27 Mar 2019 09:47:14 +0000, Petr Machata wrote: > > > Jakub Kicinski <jakub.kicinski@netronome.com> writes: > > > > > > > Looks good & glad to see it, but what's a PSID? ;) > > > > > > > > I found this after 5 seconds of googling: > > > > > > > > http://www.mellanox.com/page/firmware_HCA_FW_identification > > > > > > > > But it still just say "PSID" without explaining what the acronym stands > > > > for :) > > > > > > "Parameter Set ID" > > > http://www.mellanox.com/pdf/MFT/MFT_Windows_user_manual.pdf > > > > Thanks, would it be okay for you guys to spell that out, or at least > > add a description to the doc? Hopefully that can help with reuse and > > on the flip side avoiding using the same acronym for completely > > different things.. > > OK. We can add fw.psid to > Documentation/networking/devlink-info-versions.rst Thanks! ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command 2019-03-26 20:48 ` Jakub Kicinski 2019-03-27 9:47 ` Petr Machata @ 2019-03-27 11:08 ` Jiri Pirko 1 sibling, 0 replies; 11+ messages in thread From: Jiri Pirko @ 2019-03-27 11:08 UTC (permalink / raw) To: Jakub Kicinski Cc: Ido Schimmel, netdev@vger.kernel.org, davem@davemloft.net, Jiri Pirko, Shalom Toledo, mlxsw Tue, Mar 26, 2019 at 09:48:07PM CET, jakub.kicinski@netronome.com wrote: >On Tue, 26 Mar 2019 13:46:26 +0000, Ido Schimmel wrote: >> From: Shalom Toledo <shalomt@mellanox.com> >> >> Expose the following ASIC information via devlink info command: >> - Hardware revision >> - Firmware PSID >> - Running firmware version >> >> Standard output example: >> $ devlink dev info pci/0000:03:00.0 >> pci/0000:03:00.0: >> versions: >> fixed: >> hw.revision A0 >> fw.psid MT_2750110033 >> running: >> fw.version 13.1910.622 >> >> Pretty JSON example: >> $ devlink -jp dev info pci/0000:03:00.0 >> { >> "info": { >> "pci/0000:03:00.0": { >> "versions": { >> "fixed": { >> "hw.revision": "A0", >> "fw.psid": "MT_2750110033" >> }, >> "running": { >> "fw.version": "13.1910.622" >> } >> } >> } >> } >> } >> >> Signed-off-by: Shalom Toledo <shalomt@mellanox.com> >> Acked-by: Jiri Pirko <jiri@mellanox.com> >> Signed-off-by: Ido Schimmel <idosch@mellanox.com> > >Looks good & glad to see it, but what's a PSID? ;) > >I found this after 5 seconds of googling: > >http://www.mellanox.com/page/firmware_HCA_FW_identification > >But it still just say "PSID" without explaining what the acronym stands >for :) It's Mellanox board/setup identification. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 0/2] mlxsw: Add support for devlink info command 2019-03-26 13:46 [PATCH net-next 0/2] mlxsw: Add support for devlink info command Ido Schimmel 2019-03-26 13:46 ` [PATCH net-next 1/2] mlxsw: reg: Add MGIR register Ido Schimmel 2019-03-26 13:46 ` [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command Ido Schimmel @ 2019-03-27 20:58 ` David Miller 2019-03-27 21:31 ` Ido Schimmel 2 siblings, 1 reply; 11+ messages in thread From: David Miller @ 2019-03-27 20:58 UTC (permalink / raw) To: idosch; +Cc: netdev, jiri, shalomt, mlxsw From: Ido Schimmel <idosch@mellanox.com> Date: Tue, 26 Mar 2019 13:46:24 +0000 > Shalom says: > > Expose the following ASIC information via devlink info command: > - Hardware revision > - Firmware PSID > - Running firmware version > > Standard output example: > $ devlink dev info pci/0000:03:00.0 > pci/0000:03:00.0: > versions: > fixed: > hw.revision A0 > fw.psid MT_2750110033 > running: > fw.version 13.1910.622 Are you going to respin this to add the psid documentation? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 0/2] mlxsw: Add support for devlink info command 2019-03-27 20:58 ` [PATCH net-next 0/2] mlxsw: " David Miller @ 2019-03-27 21:31 ` Ido Schimmel 0 siblings, 0 replies; 11+ messages in thread From: Ido Schimmel @ 2019-03-27 21:31 UTC (permalink / raw) To: David Miller; +Cc: netdev@vger.kernel.org, Jiri Pirko, Shalom Toledo, mlxsw On Wed, Mar 27, 2019 at 01:58:02PM -0700, David Miller wrote: > Are you going to respin this to add the psid documentation? Yes ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-03-27 21:31 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-03-26 13:46 [PATCH net-next 0/2] mlxsw: Add support for devlink info command Ido Schimmel 2019-03-26 13:46 ` [PATCH net-next 1/2] mlxsw: reg: Add MGIR register Ido Schimmel 2019-03-26 13:46 ` [PATCH net-next 2/2] mlxsw: core: Add support for devlink info command Ido Schimmel 2019-03-26 20:48 ` Jakub Kicinski 2019-03-27 9:47 ` Petr Machata 2019-03-27 17:53 ` Jakub Kicinski 2019-03-27 19:44 ` Ido Schimmel 2019-03-27 20:36 ` Jakub Kicinski 2019-03-27 11:08 ` Jiri Pirko 2019-03-27 20:58 ` [PATCH net-next 0/2] mlxsw: " David Miller 2019-03-27 21:31 ` Ido Schimmel
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).