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

spinler
2026-02-17T07:11:27Z

Report the firmware version, which is described
by project name and project version.

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

diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c
index 9065620922..9737ccc65b 100644
--- a/drivers/net/nfb/nfb_ethdev.c
+++ b/drivers/net/nfb/nfb_ethdev.c
@@ -502,6 +502,32 @@ 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 *intl = dev->process_private;
+
+ proj_name = nc_info_get_fw_project_name(intl->nfb, NULL);
+ proj_vers = nc_info_get_fw_project_version(intl->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 < 0)
+ return ret;
+
+ 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,
@@ -528,6 +554,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.53.0