Skip to content

Commit 0246388

Browse files
ltragerPaolo Abeni
authored andcommitted
eth: fbnic: Add devlink firmware version info
This adds support to show firmware version information for both stored and running firmware versions. The version and commit is displayed separately to aid monitoring tools which only care about the version. Example output: # devlink dev info pci/0000:01:00.0: driver fbnic serial_number 88-25-08-ff-ff-01-50-92 versions: running: fw 24.07.15-017 fw.commit h999784ae9df0 fw.bootloader 24.07.10-000 fw.bootloader.commit hfef3ac835ce7 stored: fw 24.07.24-002 fw.commit hc9d14a68b3f2 fw.bootloader 24.07.22-000 fw.bootloader.commit h922f8493eb96 fw.undi 01.00.03-000 Signed-off-by: Lee Trager <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 9284594 commit 0246388

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

Documentation/networking/device_drivers/ethernet/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Contents:
4444
marvell/octeon_ep
4545
marvell/octeon_ep_vf
4646
mellanox/mlx5/index
47+
meta/fbnic
4748
microsoft/netvsc
4849
neterion/s2io
4950
netronome/nfp
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.. SPDX-License-Identifier: GPL-2.0+
2+
3+
=====================================
4+
Meta Platforms Host Network Interface
5+
=====================================
6+
7+
Firmware Versions
8+
-----------------
9+
10+
fbnic has three components stored on the flash which are provided in one PLDM
11+
image:
12+
13+
1. fw - The control firmware used to view and modify firmware settings, request
14+
firmware actions, and retrieve firmware counters outside of the data path.
15+
This is the firmware which fbnic_fw.c interacts with.
16+
2. bootloader - The firmware which validate firmware security and control basic
17+
operations including loading and updating the firmware. This is also known
18+
as the cmrt firmware.
19+
3. undi - This is the UEFI driver which is based on the Linux driver.
20+
21+
fbnic stores two copies of these three components on flash. This allows fbnic
22+
to fall back to an older version of firmware automatically in case firmware
23+
fails to boot. Version information for both is provided as running and stored.
24+
The undi is only provided in stored as it is not actively running once the Linux
25+
driver takes over.
26+
27+
devlink dev info provides version information for all three components. In
28+
addition to the version the hg commit hash of the build is included as a
29+
separate entry.

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14833,6 +14833,7 @@ M: Alexander Duyck <[email protected]>
1483314833
M: Jakub Kicinski <[email protected]>
1483414834
1483514835
S: Supported
14836+
F: Documentation/networking/device_drivers/ethernet/meta/
1483614837
F: drivers/net/ethernet/meta/
1483714838

1483814839
METHODE UDPU SUPPORT

drivers/net/ethernet/meta/fbnic/fbnic_devlink.c

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,88 @@
1010

1111
#define FBNIC_SN_STR_LEN 24
1212

13+
static int fbnic_version_running_put(struct devlink_info_req *req,
14+
struct fbnic_fw_ver *fw_ver,
15+
char *ver_name)
16+
{
17+
char running_ver[FBNIC_FW_VER_MAX_SIZE];
18+
int err;
19+
20+
fbnic_mk_fw_ver_str(fw_ver->version, running_ver);
21+
err = devlink_info_version_running_put(req, ver_name, running_ver);
22+
if (err)
23+
return err;
24+
25+
if (strlen(fw_ver->commit) > 0) {
26+
char commit_name[FBNIC_SN_STR_LEN];
27+
28+
snprintf(commit_name, FBNIC_SN_STR_LEN, "%s.commit", ver_name);
29+
err = devlink_info_version_running_put(req, commit_name,
30+
fw_ver->commit);
31+
if (err)
32+
return err;
33+
}
34+
35+
return 0;
36+
}
37+
38+
static int fbnic_version_stored_put(struct devlink_info_req *req,
39+
struct fbnic_fw_ver *fw_ver,
40+
char *ver_name)
41+
{
42+
char stored_ver[FBNIC_FW_VER_MAX_SIZE];
43+
int err;
44+
45+
fbnic_mk_fw_ver_str(fw_ver->version, stored_ver);
46+
err = devlink_info_version_stored_put(req, ver_name, stored_ver);
47+
if (err)
48+
return err;
49+
50+
if (strlen(fw_ver->commit) > 0) {
51+
char commit_name[FBNIC_SN_STR_LEN];
52+
53+
snprintf(commit_name, FBNIC_SN_STR_LEN, "%s.commit", ver_name);
54+
err = devlink_info_version_stored_put(req, commit_name,
55+
fw_ver->commit);
56+
if (err)
57+
return err;
58+
}
59+
60+
return 0;
61+
}
62+
1363
static int fbnic_devlink_info_get(struct devlink *devlink,
1464
struct devlink_info_req *req,
1565
struct netlink_ext_ack *extack)
1666
{
1767
struct fbnic_dev *fbd = devlink_priv(devlink);
1868
int err;
1969

70+
err = fbnic_version_running_put(req, &fbd->fw_cap.running.mgmt,
71+
DEVLINK_INFO_VERSION_GENERIC_FW);
72+
if (err)
73+
return err;
74+
75+
err = fbnic_version_running_put(req, &fbd->fw_cap.running.bootloader,
76+
DEVLINK_INFO_VERSION_GENERIC_FW_BOOTLOADER);
77+
if (err)
78+
return err;
79+
80+
err = fbnic_version_stored_put(req, &fbd->fw_cap.stored.mgmt,
81+
DEVLINK_INFO_VERSION_GENERIC_FW);
82+
if (err)
83+
return err;
84+
85+
err = fbnic_version_stored_put(req, &fbd->fw_cap.stored.bootloader,
86+
DEVLINK_INFO_VERSION_GENERIC_FW_BOOTLOADER);
87+
if (err)
88+
return err;
89+
90+
err = fbnic_version_stored_put(req, &fbd->fw_cap.stored.undi,
91+
DEVLINK_INFO_VERSION_GENERIC_FW_UNDI);
92+
if (err)
93+
return err;
94+
2095
if (fbd->dsn) {
2196
unsigned char serial[FBNIC_SN_STR_LEN];
2297
u8 dsn[8];

0 commit comments

Comments
 (0)