From: "Renyong Wan" <wanry@yunsilicon.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <stephen@networkplumber.org>,
<qianr@yunsilicon.com>, <nana@yunsilicon.com>,
<zhangxx@yunsilicon.com>, <xudw@yunsilicon.com>,
<jacky@yunsilicon.com>, <weihg@yunsilicon.com>,
<zhenghy@yunsilicon.com>
Subject: [PATCH 01/14] net/xsc: add FW version get support
Date: Fri, 29 Aug 2025 16:24:07 +0800 [thread overview]
Message-ID: <20250829082406.24369-2-wanry@yunsilicon.com> (raw)
In-Reply-To: <20250829082406.24369-1-wanry@yunsilicon.com>
Add support for querying the firmware version of the xsc device.
Signed-off-by: Rong Qian <qianr@yunsilicon.com>
Signed-off-by: Renyong Wan <wanry@yunsilicon.com>
---
doc/guides/nics/features/xsc.ini | 1 +
drivers/net/xsc/xsc_dev.c | 13 +++++++++++++
drivers/net/xsc/xsc_dev.h | 4 ++++
drivers/net/xsc/xsc_ethdev.c | 9 +++++++++
drivers/net/xsc/xsc_vfio.c | 18 ++++++++++++++++++
5 files changed, 45 insertions(+)
diff --git a/doc/guides/nics/features/xsc.ini b/doc/guides/nics/features/xsc.ini
index 8d5c292b7f..e0f7b0bc1f 100644
--- a/doc/guides/nics/features/xsc.ini
+++ b/doc/guides/nics/features/xsc.ini
@@ -14,6 +14,7 @@ Inner L3 checksum = Y
Inner L4 checksum = Y
Basic stats = Y
Stats per queue = Y
+FW version = Y
Linux = Y
ARMv8 = Y
x86-64 = Y
diff --git a/drivers/net/xsc/xsc_dev.c b/drivers/net/xsc/xsc_dev.c
index fc9f1cddfc..66f98d2327 100644
--- a/drivers/net/xsc/xsc_dev.c
+++ b/drivers/net/xsc/xsc_dev.c
@@ -15,6 +15,7 @@
#include <rte_kvargs.h>
#include <rte_eal_paging.h>
#include <rte_bitops.h>
+#include <rte_string_fns.h>
#include "xsc_log.h"
#include "xsc_defs.h"
@@ -398,3 +399,15 @@ xsc_dev_is_vf(struct xsc_dev *xdev)
return false;
}
+
+int
+xsc_dev_fw_version_get(struct xsc_dev *xdev, char *fw_version, size_t fw_size)
+{
+ size_t size = strnlen(xdev->hwinfo.fw_ver, sizeof(xdev->hwinfo.fw_ver)) + 1;
+
+ if (fw_size < size)
+ return size;
+ rte_strlcpy(fw_version, xdev->hwinfo.fw_ver, fw_size);
+
+ return 0;
+}
diff --git a/drivers/net/xsc/xsc_dev.h b/drivers/net/xsc/xsc_dev.h
index cc5fa8aad8..274d6c6a2e 100644
--- a/drivers/net/xsc/xsc_dev.h
+++ b/drivers/net/xsc/xsc_dev.h
@@ -27,6 +27,8 @@
#define XSC_DEV_PCT_IDX_INVALID 0xFFFFFFFF
#define XSC_DEV_REPR_ID_INVALID 0x7FFFFFFF
+#define XSC_FW_VERS_LEN 64
+
enum xsc_queue_type {
XSC_QUEUE_TYPE_RDMA_RC = 0,
XSC_QUEUE_TYPE_RDMA_MAD = 1,
@@ -68,6 +70,7 @@ struct xsc_hwinfo {
uint8_t pct_compress_vld;
uint8_t mac_bit;
uint8_t esw_mode;
+ char fw_ver[XSC_FW_VERS_LEN];
};
struct xsc_devargs {
@@ -180,5 +183,6 @@ bool xsc_dev_is_vf(struct xsc_dev *xdev);
int xsc_dev_qp_set_id_get(struct xsc_dev *xdev, int repr_id);
int xsc_dev_set_mtu(struct xsc_dev *xdev, uint16_t mtu);
int xsc_dev_get_mac(struct xsc_dev *xdev, uint8_t *mac);
+int xsc_dev_fw_version_get(struct xsc_dev *xdev, char *fw_version, size_t fw_size);
#endif /* _XSC_DEV_H_ */
diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
index 3830c18c03..79c4e13cd4 100644
--- a/drivers/net/xsc/xsc_ethdev.c
+++ b/drivers/net/xsc/xsc_ethdev.c
@@ -674,6 +674,14 @@ xsc_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uin
return 0;
}
+static int
+xsc_ethdev_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+ struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
+
+ return xsc_dev_fw_version_get(priv->xdev, fw_version, fw_size);
+}
+
const struct eth_dev_ops xsc_eth_dev_ops = {
.dev_configure = xsc_ethdev_configure,
.dev_start = xsc_ethdev_start,
@@ -692,6 +700,7 @@ const struct eth_dev_ops xsc_eth_dev_ops = {
.mtu_set = xsc_ethdev_set_mtu,
.rss_hash_update = xsc_ethdev_rss_hash_update,
.rss_hash_conf_get = xsc_ethdev_rss_hash_conf_get,
+ .fw_version_get = xsc_ethdev_fw_version_get,
};
static int
diff --git a/drivers/net/xsc/xsc_vfio.c b/drivers/net/xsc/xsc_vfio.c
index 422d30efb9..857fa449f0 100644
--- a/drivers/net/xsc/xsc_vfio.c
+++ b/drivers/net/xsc/xsc_vfio.c
@@ -61,6 +61,23 @@ xsc_vfio_pcie_no_init(struct xsc_hwinfo *hwinfo)
hwinfo->pcie_no = XSC_SOC_PCIE_NO_DEFAULT;
}
+static void
+xsc_vfio_fw_version_init(char *hw_fw_ver, struct xsc_cmd_fw_version *cmd_fw_ver)
+{
+ uint16_t patch = rte_be_to_cpu_16(cmd_fw_ver->patch);
+ uint32_t tweak = rte_be_to_cpu_32(cmd_fw_ver->tweak);
+
+ if (tweak == 0) {
+ snprintf(hw_fw_ver, XSC_FW_VERS_LEN, "v%hhu.%hhu.%hu",
+ cmd_fw_ver->major, cmd_fw_ver->minor,
+ patch);
+ } else {
+ snprintf(hw_fw_ver, XSC_FW_VERS_LEN, "v%hhu.%hhu.%hu+%u",
+ cmd_fw_ver->major, cmd_fw_ver->minor,
+ patch, tweak);
+ }
+}
+
static int
xsc_vfio_hwinfo_init(struct xsc_dev *xdev)
{
@@ -126,6 +143,7 @@ xsc_vfio_hwinfo_init(struct xsc_dev *xdev)
xdev->hwinfo.hca_core_clock = rte_be_to_cpu_32(hca_cap->hca_core_clock);
xdev->hwinfo.mac_bit = hca_cap->mac_bit;
xsc_vfio_pcie_no_init(&xdev->hwinfo);
+ xsc_vfio_fw_version_init(xdev->hwinfo.fw_ver, &hca_cap->fw_ver);
exit:
free(cmd_buf);
--
2.25.1
next prev parent reply other threads:[~2025-08-29 8:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 8:24 [PATCH 00/14] net/xsc: PMD updates Renyong Wan
2025-08-29 8:24 ` Renyong Wan [this message]
2025-08-29 8:24 ` [PATCH 02/14] net/xsc: add TSO support Renyong Wan
2025-08-29 8:24 ` [PATCH 03/14] net/xsc: support module EEPROM dump Renyong Wan
2025-08-29 8:24 ` [PATCH 04/14] net/xsc: support promiscuous mode Renyong Wan
2025-08-29 8:24 ` [PATCH 05/14] net/xsc: add link status support Renyong Wan
2025-08-29 8:24 ` [PATCH 06/14] net/xsc: add link status event support Renyong Wan
2025-08-29 8:24 ` [PATCH 07/14] net/xsc: add FEC get and set support Renyong Wan
2025-08-29 8:24 ` [PATCH 08/14] net/xsc: optimize RSS queue creation Renyong Wan
2025-08-29 8:24 ` [PATCH 09/14] net/xsc: optimize QP and CQ memory allocation Renyong Wan
2025-08-29 8:24 ` [PATCH 10/14] net/xsc: optimize Rx path Renyong Wan
2025-08-29 8:24 ` [PATCH 11/14] net/xsc: optimize stop and close Renyong Wan
2025-08-29 8:24 ` [PATCH 12/14] net/xsc: support per port for multi-process Renyong Wan
2025-08-29 8:24 ` [PATCH 13/14] net/xsc: fix uninitialized value Renyong Wan
2025-08-29 8:24 ` [PATCH 14/14] net/xsc: update release notes for xsc PMD Renyong Wan
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=20250829082406.24369-2-wanry@yunsilicon.com \
--to=wanry@yunsilicon.com \
--cc=dev@dpdk.org \
--cc=jacky@yunsilicon.com \
--cc=nana@yunsilicon.com \
--cc=qianr@yunsilicon.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=weihg@yunsilicon.com \
--cc=xudw@yunsilicon.com \
--cc=zhangxx@yunsilicon.com \
--cc=zhenghy@yunsilicon.com \
/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;
as well as URLs for NNTP newsgroup(s).