[PATCH v4 7/8] net/nfb: report firmware version

spinler
2026-01-22T07:28:10Z

The firmware is described by project name and project version.

Signed-off-by: Martin Spinler <spinler@cesnet.cz>
---
drivers/net/nfb/nfb_ethdev.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c
index e2959c3a04..85b05c99d0 100644
--- a/drivers/net/nfb/nfb_ethdev.c
+++ b/drivers/net/nfb/nfb_ethdev.c
@@ -498,6 +498,31 @@ nfb_eth_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
nc_rxmac_set_mac(internals->rxmac[i], index, 0, 0);
}

+static int
+nfb_eth_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size)
+{
+ int ret;
+ const char *proj_name, *proj_vers;
+ struct pmd_internals *priv = (struct pmd_internals *)
+ dev->process_private;
+
+ proj_name = nc_info_get_fw_project_name(priv->nfb, NULL);
+ proj_vers = nc_info_get_fw_project_version(priv->nfb, NULL);
+
+ if (proj_name == NULL)
+ proj_name = "";
+ if (proj_vers == NULL)
+ proj_vers = "";
+
+ ret = snprintf(fw_version, fw_size, "%s;%s", proj_name, proj_vers);
+
+ if (ret >= (signed int)fw_size)
+ return strlen(proj_name) + 1 + strlen(proj_vers) + 1;
+
+ return 0;
+}
+
static const struct eth_dev_ops ops = {
.dev_start = nfb_eth_dev_start,
.dev_stop = nfb_eth_dev_stop,
@@ -524,6 +549,7 @@ static const struct eth_dev_ops ops = {
.mac_addr_set = nfb_eth_mac_addr_set,
.mac_addr_add = nfb_eth_mac_addr_add,
.mac_addr_remove = nfb_eth_mac_addr_remove,
+ .fw_version_get = nfb_eth_fw_version_get,
};

/**
--
2.52.0