This patch adds firmware version in telemetry info command.
An example is like:
--> /ethdev/info,0
{
  "/ethdev/info": {
    "name": "0000:bd:00.0",
    "fw_version": "1.20.0.17",
    ....
   }
}

Signed-off-by: Jie Hai <haij...@huawei.com>
---
 lib/ethdev/rte_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 315334321cb3..d906cc66d2f9 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -6640,6 +6640,7 @@ eth_dev_handle_port_info(const char *cmd __rte_unused,
 {
        struct rte_tel_data *rx_offload, *tx_offload;
        struct rte_tel_data *rxq_state, *txq_state;
+       char fw_version[RTE_TEL_MAX_STRING_LEN];
        char mac_addr[RTE_ETHER_ADDR_FMT_SIZE];
        struct rte_eth_dev *eth_dev;
        char *end_param;
@@ -6677,6 +6678,11 @@ eth_dev_handle_port_info(const char *cmd __rte_unused,
 
        rte_tel_data_start_dict(d);
        rte_tel_data_add_dict_string(d, "name", eth_dev->data->name);
+
+       if (rte_eth_dev_fw_version_get(port_id, fw_version,
+                                        RTE_TEL_MAX_STRING_LEN) == 0)
+               rte_tel_data_add_dict_string(d, "fw_version", fw_version);
+
        rte_tel_data_add_dict_int(d, "state", eth_dev->state);
        rte_tel_data_add_dict_int(d, "nb_rx_queues",
                        eth_dev->data->nb_rx_queues);
-- 
2.33.0

Reply via email to