Skip to content

Commit 8210ff7

Browse files
jjagielskanguy11
authored andcommitted
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>
1 parent 904c2b4 commit 8210ff7

File tree

3 files changed

+167
-3
lines changed

3 files changed

+167
-3
lines changed

Documentation/networking/devlink/devlink-info.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ In case software/firmware components are loaded from the disk (e.g.
8686
``/lib/firmware``) only the running version should be reported via
8787
the kernel API.
8888

89+
Please note that any security versions reported via devlink are purely
90+
informational. Devlink does not use a secure channel to communicate with
91+
the device.
92+
8993
Generic Versions
9094
================
9195

Documentation/networking/devlink/ixgbe.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ device driver.
1010
Info versions
1111
=============
1212

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+
1317
The ``ixgbe`` driver reports the following versions
1418

1519
.. list-table:: devlink info versions implemented
@@ -33,8 +37,42 @@ The ``ixgbe`` driver reports the following versions
3337
non-breaking changes and reset to 1 when the major version is
3438
incremented. The patch version is normally 0 but is incremented when
3539
a fix is delivered as a patch against an older base Option ROM.
40+
* - ``fw.undi.srev``
41+
- running
42+
- 4
43+
- Number indicating the security revision of the Option ROM.
3644
* - ``fw.bundle_id``
3745
- running
3846
- 0x80000d0d
3947
- Unique identifier of the firmware image file that was loaded onto
4048
the device. Also referred to as the EETRACK identifier of the NVM.
49+
* - ``fw.mgmt.api``
50+
- running
51+
- 1.5.1
52+
- 3-digit version number (major.minor.patch) of the API exported over
53+
the AdminQ by the management firmware. Used by the driver to
54+
identify what commands are supported. Historical versions of the
55+
kernel only displayed a 2-digit version number (major.minor).
56+
* - ``fw.mgmt.build``
57+
- running
58+
- 0x305d955f
59+
- Unique identifier of the source for the management firmware.
60+
* - ``fw.mgmt.srev``
61+
- running
62+
- 3
63+
- Number indicating the security revision of the firmware.
64+
* - ``fw.psid.api``
65+
- running
66+
- 0.80
67+
- Version defining the format of the flash contents.
68+
* - ``fw.netlist``
69+
- running
70+
- 1.1.2000-6.7.0
71+
- The version of the netlist module. This module defines the device's
72+
Ethernet capabilities and default settings, and is used by the
73+
management firmware as part of managing link and device
74+
connectivity.
75+
* - ``fw.netlist.build``
76+
- running
77+
- 0xee16ced7
78+
- The first 4 bytes of the hash of the netlist module contents.

drivers/net/ethernet/intel/ixgbe/devlink/devlink.c

Lines changed: 125 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,22 @@ static void ixgbe_info_get_dsn(struct ixgbe_adapter *adapter,
1919
snprintf(ctx->buf, sizeof(ctx->buf), "%8phD", dsn);
2020
}
2121

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)
2424
{
2525
struct ixgbe_hw *hw = &adapter->hw;
2626
struct ixgbe_nvm_version nvm_ver;
2727

2828
ctx->buf[0] = '\0';
2929

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+
}
37+
3038
ixgbe_get_oem_prod_version(hw, &nvm_ver);
3139
if (nvm_ver.oem_valid) {
3240
snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x",
@@ -48,6 +56,12 @@ static void ixgbe_info_eetrack(struct ixgbe_adapter *adapter,
4856
struct ixgbe_hw *hw = &adapter->hw;
4957
struct ixgbe_nvm_version nvm_ver;
5058

59+
if (hw->mac.type == ixgbe_mac_e610) {
60+
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x",
61+
hw->flash.nvm.eetrack);
62+
return;
63+
}
64+
5165
ixgbe_get_oem_prod_version(hw, &nvm_ver);
5266

5367
/* No ETRACK version for OEM */
@@ -60,6 +74,110 @@ static void ixgbe_info_eetrack(struct ixgbe_adapter *adapter,
6074
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm_ver.etk_id);
6175
}
6276

77+
static void ixgbe_info_fw_api(struct ixgbe_adapter *adapter,
78+
struct ixgbe_info_ctx *ctx)
79+
{
80+
struct ixgbe_hw *hw = &adapter->hw;
81+
82+
snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
83+
hw->api_maj_ver, hw->api_min_ver, hw->api_patch);
84+
}
85+
86+
static void ixgbe_info_fw_build(struct ixgbe_adapter *adapter,
87+
struct ixgbe_info_ctx *ctx)
88+
{
89+
struct ixgbe_hw *hw = &adapter->hw;
90+
91+
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", hw->fw_build);
92+
}
93+
94+
static void ixgbe_info_fw_srev(struct ixgbe_adapter *adapter,
95+
struct ixgbe_info_ctx *ctx)
96+
{
97+
struct ixgbe_nvm_info *nvm = &adapter->hw.flash.nvm;
98+
99+
snprintf(ctx->buf, sizeof(ctx->buf), "%u", nvm->srev);
100+
}
101+
102+
static void ixgbe_info_orom_srev(struct ixgbe_adapter *adapter,
103+
struct ixgbe_info_ctx *ctx)
104+
{
105+
struct ixgbe_orom_info *orom = &adapter->hw.flash.orom;
106+
107+
snprintf(ctx->buf, sizeof(ctx->buf), "%u", orom->srev);
108+
}
109+
110+
static void ixgbe_info_nvm_ver(struct ixgbe_adapter *adapter,
111+
struct ixgbe_info_ctx *ctx)
112+
{
113+
struct ixgbe_nvm_info *nvm = &adapter->hw.flash.nvm;
114+
115+
snprintf(ctx->buf, sizeof(ctx->buf), "%x.%02x", nvm->major, nvm->minor);
116+
}
117+
118+
static void ixgbe_info_netlist_ver(struct ixgbe_adapter *adapter,
119+
struct ixgbe_info_ctx *ctx)
120+
{
121+
struct ixgbe_netlist_info *netlist = &adapter->hw.flash.netlist;
122+
123+
/* The netlist version fields are BCD formatted */
124+
snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x-%x.%x.%x",
125+
netlist->major, netlist->minor,
126+
netlist->type >> 16, netlist->type & 0xFFFF,
127+
netlist->rev, netlist->cust_ver);
128+
}
129+
130+
static void ixgbe_info_netlist_build(struct ixgbe_adapter *adapter,
131+
struct ixgbe_info_ctx *ctx)
132+
{
133+
struct ixgbe_netlist_info *netlist = &adapter->hw.flash.netlist;
134+
135+
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", netlist->hash);
136+
}
137+
138+
static int ixgbe_devlink_info_get_e610(struct ixgbe_adapter *adapter,
139+
struct devlink_info_req *req,
140+
struct ixgbe_info_ctx *ctx)
141+
{
142+
int err;
143+
144+
ixgbe_info_fw_api(adapter, ctx);
145+
err = devlink_info_version_running_put(req,
146+
DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API,
147+
ctx->buf);
148+
if (err)
149+
return err;
150+
151+
ixgbe_info_fw_build(adapter, ctx);
152+
err = devlink_info_version_running_put(req, "fw.mgmt.build", ctx->buf);
153+
if (err)
154+
return err;
155+
156+
ixgbe_info_fw_srev(adapter, ctx);
157+
err = devlink_info_version_running_put(req, "fw.mgmt.srev", ctx->buf);
158+
if (err)
159+
return err;
160+
161+
ixgbe_info_orom_srev(adapter, ctx);
162+
err = devlink_info_version_running_put(req, "fw.undi.srev", ctx->buf);
163+
if (err)
164+
return err;
165+
166+
ixgbe_info_nvm_ver(adapter, ctx);
167+
err = devlink_info_version_running_put(req, "fw.psid.api", ctx->buf);
168+
if (err)
169+
return err;
170+
171+
ixgbe_info_netlist_ver(adapter, ctx);
172+
err = devlink_info_version_running_put(req, "fw.netlist", ctx->buf);
173+
if (err)
174+
return err;
175+
176+
ixgbe_info_netlist_build(adapter, ctx);
177+
return devlink_info_version_running_put(req, "fw.netlist.build",
178+
ctx->buf);
179+
}
180+
63181
static int ixgbe_devlink_info_get(struct devlink *devlink,
64182
struct devlink_info_req *req,
65183
struct netlink_ext_ack *extack)
@@ -88,7 +206,7 @@ static int ixgbe_devlink_info_get(struct devlink *devlink,
88206
if (err)
89207
goto free_ctx;
90208

91-
ixgbe_info_nvm_ver(adapter, ctx);
209+
ixgbe_info_orom_ver(adapter, ctx);
92210
err = devlink_info_version_running_put(req,
93211
DEVLINK_INFO_VERSION_GENERIC_FW_UNDI,
94212
ctx->buf);
@@ -99,6 +217,10 @@ static int ixgbe_devlink_info_get(struct devlink *devlink,
99217
err = devlink_info_version_running_put(req,
100218
DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID,
101219
ctx->buf);
220+
if (err || hw->mac.type != ixgbe_mac_e610)
221+
goto free_ctx;
222+
223+
err = ixgbe_devlink_info_get_e610(adapter, req, ctx);
102224
free_ctx:
103225
kfree(ctx);
104226
return err;

0 commit comments

Comments
 (0)