DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: liujie5@linkdatatechnology.com
To: stephen@networkplumber.org
Cc: dev@dpdk.org, Jie Liu <liujie5@linkdatatechnology.com>
Subject: [PATCH v9 15/23] net/sxe2: support firmware version reading
Date: Fri, 26 Jun 2026 14:45:48 +0800	[thread overview]
Message-ID: <20260626064548.361185-1-liujie5@linkdatatechnology.com> (raw)
In-Reply-To: <220260625133139.207632-1-liujie5@linkdatatechnology.com>

From: Jie Liu <liujie5@linkdatatechnology.com>

This patch implements the logic to retrieve the firmware version and
Build ID from the hardware during device initialization.

The version is exposed to applications through the dev_info_get API.

Signed-off-by: Jie Liu <liujie5@linkdatatechnology.com>
---
 drivers/net/sxe2/sxe2_ethdev.c | 35 +++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index 9bff741961..02ff6be322 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -119,7 +119,8 @@ static int32_t sxe2_udp_tunnel_port_add(struct rte_eth_dev *dev,
 					struct rte_eth_udp_tunnel *tunnel_udp);
 static int32_t sxe2_udp_tunnel_port_del(struct rte_eth_dev *dev,
 					struct rte_eth_udp_tunnel *tunnel_udp);
-
+static int32_t sxe2_fw_version_string_get(struct rte_eth_dev *dev,
+				      char *fw_version, size_t fw_size);
 
 static const struct eth_dev_ops sxe2_eth_dev_ops = {
 	.dev_configure              = sxe2_dev_configure,
@@ -180,6 +181,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = {
 	.xstats_reset               = sxe2_stats_info_reset,
 
 	.queue_stats_mapping_set    = sxe2_queue_stats_mapping_set,
+
+	.fw_version_get             = sxe2_fw_version_string_get,
 };
 
 static int32_t sxe2_dev_configure(struct rte_eth_dev *dev)
@@ -1556,6 +1559,36 @@ static int32_t sxe2_eth_pmd_remove(struct sxe2_common_device *cdev)
 	return ret;
 }
 
+static int32_t sxe2_fw_version_string_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct sxe2_adapter *adapter =
+		SXE2_DEV_PRIVATE_TO_ADAPTER(dev);
+	struct sxe2_fw_info *fw_info = &adapter->dev_info.fw;
+	int32_t ret_len;
+	int32_t ret;
+
+	ret_len = snprintf(fw_version, fw_size,
+			   "%u.%u.%u.%u",
+			   fw_info->main_version_id,
+			   fw_info->sub_version_id,
+			   fw_info->fix_version_id,
+			   fw_info->build_id);
+
+	if (ret_len < 0) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret_len += 1;
+	if (fw_size < (size_t)ret_len)
+		ret = -EINVAL;
+	else
+		ret = 0;
+
+out:
+	return ret;
+}
+
 static uint16_t sxe2_switchdev_repr_id_encode_get(struct sxe2_switchdev_info *switchdev_info)
 {
 	enum rte_eth_representor_type type;
-- 
2.52.0


  parent reply	other threads:[~2026-06-26  6:45 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <220260625133139.207632-1-liujie5@linkdatatechnology.com>
2026-06-26  6:38 ` [PATCH v9 00/23] net/sxe2: added Linkdata sxe2 ethernet driver liujie5
2026-06-26 18:18   ` Stephen Hemminger
2026-06-26  6:38 ` [PATCH v9 01/23] net/sxe2: remove software statistics devargs liujie5
2026-06-26  6:39 ` [PATCH v9 02/23] net/sxe2: add Rx framework and packet types callback liujie5
2026-06-26  6:39 ` [PATCH v9 03/23] net/sxe2: support AVX512 vectorized path for Rx and Tx liujie5
2026-06-26  6:40 ` [PATCH v9 04/23] net/sxe2: add AVX2 vector data " liujie5
2026-06-26  6:40 ` [PATCH v9 05/23] net/sxe2: add link update callback liujie5
2026-06-26  6:41 ` [PATCH v9 06/23] net/sxe2: support L2 filtering and MAC config liujie5
2026-06-26  6:41 ` [PATCH v9 07/23] drivers: support RSS feature liujie5
2026-06-26  6:42 ` [PATCH v9 08/23] net/sxe2: support TM hierarchy and shaping liujie5
2026-06-26  6:42 ` [PATCH v9 09/23] net/sxe2: support IPsec inline protocol offload liujie5
2026-06-26  6:43 ` [PATCH v9 10/23] net/sxe2: support statistics and multi-process liujie5
2026-06-26  6:43 ` [PATCH v9 11/23] drivers: interrupt handling liujie5
2026-06-26  6:44 ` [PATCH v9 12/23] net/sxe2: add NEON vec Rx/Tx burst functions liujie5
2026-06-26  6:44 ` [PATCH v9 13/23] drivers: add support for VF representors liujie5
2026-06-26  6:45 ` [PATCH v9 14/23] net/sxe2: add support for custom UDP tunnel ports liujie5
2026-06-26  6:45 ` liujie5 [this message]
2026-06-26  6:46 ` [PATCH v9 16/23] net/sxe2: implement get monitor address liujie5
2026-06-26  6:46 ` [PATCH v9 17/23] common/sxe2: add shared SFP module definitions liujie5
2026-06-26  6:47 ` [PATCH v9 18/23] net/sxe2: support SFP module info and EEPROM access liujie5
2026-06-26  6:47 ` [PATCH v9 19/23] net/sxe2: add mbuf validation in Tx debug mode liujie5
2026-06-26 18:21   ` Stephen Hemminger
2026-06-27  4:00     ` liujie5
2026-06-26  6:48 ` [PATCH v9 20/23] common/sxe2: add callback for memory event handling liujie5
2026-06-26  6:48 ` [PATCH v9 21/23] net/sxe2: add private devargs parsing liujie5
2026-06-26  6:49 ` [PATCH v9 22/23] net/sxe2: implement private dump info liujie5
2026-06-26  6:49 ` [PATCH v9 23/23] net/sxe2: update sxe2 feature matrix docs liujie5
2026-06-27  4:04   ` [PATCH v10 00/23] et/sxe2: added Linkdata sxe2 ethernet driver liujie5
2026-06-27  4:05   ` [PATCH v10 01/23] net/sxe2: remove software statistics devargs liujie5
2026-06-27  4:06   ` [PATCH v10 02/23] net/sxe2: add Rx framework and packet types callback liujie5
2026-06-27  4:06   ` [PATCH v10 03/23] net/sxe2: support AVX512 vectorized path for Rx and Tx liujie5
2026-06-27  4:07   ` [PATCH v10 04/23] net/sxe2: add AVX2 vector data " liujie5
2026-06-27  4:07   ` [PATCH v10 05/23] net/sxe2: add link update callback liujie5
2026-06-27  4:08   ` [PATCH v10 06/23] net/sxe2: support L2 filtering and MAC config liujie5
2026-06-27  4:08   ` [PATCH v10 07/23] drivers: support RSS feature liujie5
2026-06-27  4:09   ` [PATCH v10 08/23] net/sxe2: support TM hierarchy and shaping liujie5
2026-06-27  4:09   ` [PATCH v10 09/23] net/sxe2: support IPsec inline protocol offload liujie5
2026-06-27  4:10   ` [PATCH v10 10/23] net/sxe2: support statistics and multi-process liujie5
2026-06-27  4:10   ` [PATCH v10 11/23] drivers: interrupt handling liujie5
2026-06-27  4:11   ` [PATCH v10 12/23] net/sxe2: add NEON vec Rx/Tx burst functions liujie5
2026-06-27  4:11   ` [PATCH v10 13/23] drivers: add support for VF representors liujie5
2026-06-27  4:12   ` [PATCH v10 14/23] net/sxe2: add support for custom UDP tunnel ports liujie5
2026-06-27  4:12   ` [PATCH v10 15/23] net/sxe2: support firmware version reading liujie5
2026-06-27  4:13   ` [PATCH v10 16/23] net/sxe2: implement get monitor address liujie5
2026-06-27  4:13   ` [PATCH v10 17/23] common/sxe2: add shared SFP module definitions liujie5
2026-06-27  4:14   ` [PATCH v10 18/23] net/sxe2: support SFP module info and EEPROM access liujie5
2026-06-27  4:14   ` [PATCH v10 19/23] net/sxe2: add mbuf validation in Tx debug mode liujie5
2026-06-27  4:15   ` [PATCH v10 20/23] common/sxe2: add callback for memory event handling liujie5
2026-06-27  4:15   ` [PATCH v10 21/23] net/sxe2: add private devargs parsing liujie5
2026-06-27  4:16   ` [PATCH v10 22/23] net/sxe2: implement private dump info liujie5
2026-06-27  4:16   ` [PATCH v10 23/23] net/sxe2: update sxe2 feature matrix docs liujie5

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260626064548.361185-1-liujie5@linkdatatechnology.com \
    --to=liujie5@linkdatatechnology.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox