Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mlxsw: core_linecards: Expose device PSID over device info

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>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jiri Pirko and committed by
Jakub Kicinski
3fc0c519 8f9b0513

+35
+3
Documentation/networking/devlink/mlxsw.rst
··· 75 75 * - ``ini.version`` 76 76 - running 77 77 - Version of line card INI loaded 78 + * - ``fw.psid`` 79 + - fixed 80 + - Line card device PSID 78 81 * - ``fw.version`` 79 82 - running 80 83 - Three digit firmware version of line card device
+1
drivers/net/ethernet/mellanox/mlxsw/core.h
··· 570 570 u16 fw_major; 571 571 u16 fw_minor; 572 572 u16 fw_sub_minor; 573 + char psid[MLXSW_REG_MGIR_FW_INFO_PSID_SIZE]; 573 574 }; 574 575 575 576 struct mlxsw_linecard {
+31
drivers/net/ethernet/mellanox/mlxsw/core_linecards.c
··· 87 87 return linecard->name; 88 88 } 89 89 90 + static int mlxsw_linecard_device_psid_get(struct mlxsw_linecard *linecard, 91 + u8 device_index, char *psid) 92 + { 93 + struct mlxsw_core *mlxsw_core = linecard->linecards->mlxsw_core; 94 + char mddt_pl[MLXSW_REG_MDDT_LEN]; 95 + char *mgir_pl; 96 + int err; 97 + 98 + mlxsw_reg_mddt_pack(mddt_pl, linecard->slot_index, device_index, 99 + MLXSW_REG_MDDT_METHOD_QUERY, 100 + MLXSW_REG(mgir), &mgir_pl); 101 + 102 + mlxsw_reg_mgir_pack(mgir_pl); 103 + err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(mddt), mddt_pl); 104 + if (err) 105 + return err; 106 + 107 + mlxsw_reg_mgir_fw_info_psid_memcpy_from(mgir_pl, psid); 108 + return 0; 109 + } 110 + 90 111 static int mlxsw_linecard_device_info_update(struct mlxsw_linecard *linecard) 91 112 { 92 113 struct mlxsw_core *mlxsw_core = linecard->linecards->mlxsw_core; ··· 142 121 linecard->slot_index); 143 122 return 0; 144 123 } 124 + 125 + err = mlxsw_linecard_device_psid_get(linecard, device_index, 126 + info.psid); 127 + if (err) 128 + return err; 129 + 145 130 linecard->device.info = info; 146 131 flashable_found = true; 147 132 } while (msg_seq); ··· 319 292 320 293 if (linecard->active) { 321 294 struct mlxsw_linecard_device_info *info = &linecard->device.info; 295 + 296 + err = devlink_info_version_fixed_put(req, 297 + DEVLINK_INFO_VERSION_GENERIC_FW_PSID, 298 + info->psid); 322 299 323 300 sprintf(buf, "%u.%u.%u", info->fw_major, info->fw_minor, 324 301 info->fw_sub_minor);