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

ixgbe: add .info_get extension specific for E610 devices

E610 devices give possibility to show more detailed info than the previous
boards.
Extend reporting NVM info with following pieces:
fw.mgmt.api -> version number of the API
fw.mgmt.build -> identifier of the source for the FW
fw.mgmt.srev -> number defining FW's security revision
fw.psid.api -> version defining the format of the flash contents
fw.undi.srev -> number defining OROM's security revision
fw.netlist -> version of the netlist module
fw.netlist.build -> first 4 bytes of the netlist hash

Co-developed-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Co-developed-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>

authored by

Jedrzej Jagielski and committed by
Tony Nguyen
8210ff73 904c2b4c

+167 -3
+38
Documentation/networking/devlink/ixgbe.rst
··· 10 10 Info versions 11 11 ============= 12 12 13 + Any of the versions dealing with the security presented by ``devlink-info`` 14 + is purely informational. Devlink does not use a secure channel to communicate 15 + with the device. 16 + 13 17 The ``ixgbe`` driver reports the following versions 14 18 15 19 .. list-table:: devlink info versions implemented ··· 37 33 non-breaking changes and reset to 1 when the major version is 38 34 incremented. The patch version is normally 0 but is incremented when 39 35 a fix is delivered as a patch against an older base Option ROM. 36 + * - ``fw.undi.srev`` 37 + - running 38 + - 4 39 + - Number indicating the security revision of the Option ROM. 40 40 * - ``fw.bundle_id`` 41 41 - running 42 42 - 0x80000d0d 43 43 - Unique identifier of the firmware image file that was loaded onto 44 44 the device. Also referred to as the EETRACK identifier of the NVM. 45 + * - ``fw.mgmt.api`` 46 + - running 47 + - 1.5.1 48 + - 3-digit version number (major.minor.patch) of the API exported over 49 + the AdminQ by the management firmware. Used by the driver to 50 + identify what commands are supported. Historical versions of the 51 + kernel only displayed a 2-digit version number (major.minor). 52 + * - ``fw.mgmt.build`` 53 + - running 54 + - 0x305d955f 55 + - Unique identifier of the source for the management firmware. 56 + * - ``fw.mgmt.srev`` 57 + - running 58 + - 3 59 + - Number indicating the security revision of the firmware. 60 + * - ``fw.psid.api`` 61 + - running 62 + - 0.80 63 + - Version defining the format of the flash contents. 64 + * - ``fw.netlist`` 65 + - running 66 + - 1.1.2000-6.7.0 67 + - The version of the netlist module. This module defines the device's 68 + Ethernet capabilities and default settings, and is used by the 69 + management firmware as part of managing link and device 70 + connectivity. 71 + * - ``fw.netlist.build`` 72 + - running 73 + - 0xee16ced7 74 + - The first 4 bytes of the hash of the netlist module contents.
+125 -3
drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
··· 19 19 snprintf(ctx->buf, sizeof(ctx->buf), "%8phD", dsn); 20 20 } 21 21 22 - static void ixgbe_info_nvm_ver(struct ixgbe_adapter *adapter, 23 - struct ixgbe_info_ctx *ctx) 22 + static void ixgbe_info_orom_ver(struct ixgbe_adapter *adapter, 23 + struct ixgbe_info_ctx *ctx) 24 24 { 25 25 struct ixgbe_hw *hw = &adapter->hw; 26 26 struct ixgbe_nvm_version nvm_ver; 27 27 28 28 ctx->buf[0] = '\0'; 29 + 30 + if (hw->mac.type == ixgbe_mac_e610) { 31 + struct ixgbe_orom_info *orom = &adapter->hw.flash.orom; 32 + 33 + snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", 34 + orom->major, orom->build, orom->patch); 35 + return; 36 + } 29 37 30 38 ixgbe_get_oem_prod_version(hw, &nvm_ver); 31 39 if (nvm_ver.oem_valid) { ··· 56 48 struct ixgbe_hw *hw = &adapter->hw; 57 49 struct ixgbe_nvm_version nvm_ver; 58 50 51 + if (hw->mac.type == ixgbe_mac_e610) { 52 + snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", 53 + hw->flash.nvm.eetrack); 54 + return; 55 + } 56 + 59 57 ixgbe_get_oem_prod_version(hw, &nvm_ver); 60 58 61 59 /* No ETRACK version for OEM */ ··· 72 58 73 59 ixgbe_get_etk_id(hw, &nvm_ver); 74 60 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm_ver.etk_id); 61 + } 62 + 63 + static void ixgbe_info_fw_api(struct ixgbe_adapter *adapter, 64 + struct ixgbe_info_ctx *ctx) 65 + { 66 + struct ixgbe_hw *hw = &adapter->hw; 67 + 68 + snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", 69 + hw->api_maj_ver, hw->api_min_ver, hw->api_patch); 70 + } 71 + 72 + static void ixgbe_info_fw_build(struct ixgbe_adapter *adapter, 73 + struct ixgbe_info_ctx *ctx) 74 + { 75 + struct ixgbe_hw *hw = &adapter->hw; 76 + 77 + snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", hw->fw_build); 78 + } 79 + 80 + static void ixgbe_info_fw_srev(struct ixgbe_adapter *adapter, 81 + struct ixgbe_info_ctx *ctx) 82 + { 83 + struct ixgbe_nvm_info *nvm = &adapter->hw.flash.nvm; 84 + 85 + snprintf(ctx->buf, sizeof(ctx->buf), "%u", nvm->srev); 86 + } 87 + 88 + static void ixgbe_info_orom_srev(struct ixgbe_adapter *adapter, 89 + struct ixgbe_info_ctx *ctx) 90 + { 91 + struct ixgbe_orom_info *orom = &adapter->hw.flash.orom; 92 + 93 + snprintf(ctx->buf, sizeof(ctx->buf), "%u", orom->srev); 94 + } 95 + 96 + static void ixgbe_info_nvm_ver(struct ixgbe_adapter *adapter, 97 + struct ixgbe_info_ctx *ctx) 98 + { 99 + struct ixgbe_nvm_info *nvm = &adapter->hw.flash.nvm; 100 + 101 + snprintf(ctx->buf, sizeof(ctx->buf), "%x.%02x", nvm->major, nvm->minor); 102 + } 103 + 104 + static void ixgbe_info_netlist_ver(struct ixgbe_adapter *adapter, 105 + struct ixgbe_info_ctx *ctx) 106 + { 107 + struct ixgbe_netlist_info *netlist = &adapter->hw.flash.netlist; 108 + 109 + /* The netlist version fields are BCD formatted */ 110 + snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x-%x.%x.%x", 111 + netlist->major, netlist->minor, 112 + netlist->type >> 16, netlist->type & 0xFFFF, 113 + netlist->rev, netlist->cust_ver); 114 + } 115 + 116 + static void ixgbe_info_netlist_build(struct ixgbe_adapter *adapter, 117 + struct ixgbe_info_ctx *ctx) 118 + { 119 + struct ixgbe_netlist_info *netlist = &adapter->hw.flash.netlist; 120 + 121 + snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", netlist->hash); 122 + } 123 + 124 + static int ixgbe_devlink_info_get_e610(struct ixgbe_adapter *adapter, 125 + struct devlink_info_req *req, 126 + struct ixgbe_info_ctx *ctx) 127 + { 128 + int err; 129 + 130 + ixgbe_info_fw_api(adapter, ctx); 131 + err = devlink_info_version_running_put(req, 132 + DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API, 133 + ctx->buf); 134 + if (err) 135 + return err; 136 + 137 + ixgbe_info_fw_build(adapter, ctx); 138 + err = devlink_info_version_running_put(req, "fw.mgmt.build", ctx->buf); 139 + if (err) 140 + return err; 141 + 142 + ixgbe_info_fw_srev(adapter, ctx); 143 + err = devlink_info_version_running_put(req, "fw.mgmt.srev", ctx->buf); 144 + if (err) 145 + return err; 146 + 147 + ixgbe_info_orom_srev(adapter, ctx); 148 + err = devlink_info_version_running_put(req, "fw.undi.srev", ctx->buf); 149 + if (err) 150 + return err; 151 + 152 + ixgbe_info_nvm_ver(adapter, ctx); 153 + err = devlink_info_version_running_put(req, "fw.psid.api", ctx->buf); 154 + if (err) 155 + return err; 156 + 157 + ixgbe_info_netlist_ver(adapter, ctx); 158 + err = devlink_info_version_running_put(req, "fw.netlist", ctx->buf); 159 + if (err) 160 + return err; 161 + 162 + ixgbe_info_netlist_build(adapter, ctx); 163 + return devlink_info_version_running_put(req, "fw.netlist.build", 164 + ctx->buf); 75 165 } 76 166 77 167 static int ixgbe_devlink_info_get(struct devlink *devlink, ··· 206 88 if (err) 207 89 goto free_ctx; 208 90 209 - ixgbe_info_nvm_ver(adapter, ctx); 91 + ixgbe_info_orom_ver(adapter, ctx); 210 92 err = devlink_info_version_running_put(req, 211 93 DEVLINK_INFO_VERSION_GENERIC_FW_UNDI, 212 94 ctx->buf); ··· 217 99 err = devlink_info_version_running_put(req, 218 100 DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID, 219 101 ctx->buf); 102 + if (err || hw->mac.type != ixgbe_mac_e610) 103 + goto free_ctx; 104 + 105 + err = ixgbe_devlink_info_get_e610(adapter, req, ctx); 220 106 free_ctx: 221 107 kfree(ctx); 222 108 return err;