From patchwork Tue May 30 09:05:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 127694 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88DDE42BE1; Tue, 30 May 2023 11:08:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5345342D31; Tue, 30 May 2023 11:07:47 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id E229C42D17 for ; Tue, 30 May 2023 11:07:42 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QVmkX5pSdzSqTw; Tue, 30 May 2023 17:07:32 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 30 May 2023 17:07:41 +0800 From: Jie Hai To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , Subject: [PATCH 06/10] ethdev: add firmware version in telemetry info command Date: Tue, 30 May 2023 17:05:06 +0800 Message-ID: <20230530090510.56812-7-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230530090510.56812-1-haijie1@huawei.com> References: <20230530090510.56812-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500020.china.huawei.com (7.221.188.8) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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);