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

Configure Feed

Select the types of activity you want to include in your feed.

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 <lee@trager.us>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20240905233820.1713043-1-lee@trager.us
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Lee Trager and committed by
Paolo Abeni
0246388b 92845948

+106
+1
Documentation/networking/device_drivers/ethernet/index.rst
··· 44 44 marvell/octeon_ep 45 45 marvell/octeon_ep_vf 46 46 mellanox/mlx5/index 47 + meta/fbnic 47 48 microsoft/netvsc 48 49 neterion/s2io 49 50 netronome/nfp
+29
Documentation/networking/device_drivers/ethernet/meta/fbnic.rst
··· 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.
+1
MAINTAINERS
··· 14833 14833 M: Jakub Kicinski <kuba@kernel.org> 14834 14834 R: kernel-team@meta.com 14835 14835 S: Supported 14836 + F: Documentation/networking/device_drivers/ethernet/meta/ 14836 14837 F: drivers/net/ethernet/meta/ 14837 14838 14838 14839 METHODE UDPU SUPPORT
+75
drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
··· 10 10 11 11 #define FBNIC_SN_STR_LEN 24 12 12 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 + 13 63 static int fbnic_devlink_info_get(struct devlink *devlink, 14 64 struct devlink_info_req *req, 15 65 struct netlink_ext_ack *extack) 16 66 { 17 67 struct fbnic_dev *fbd = devlink_priv(devlink); 18 68 int err; 69 + 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; 19 94 20 95 if (fbd->dsn) { 21 96 unsigned char serial[FBNIC_SN_STR_LEN];