From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: nikhil.vasoya@chelsio.com
Subject: [dpdk-dev] [PATCH v2 2/2] net/cxgbe: add support to get firmware version
Date: Thu, 30 Sep 2021 22:39:59 +0530 [thread overview]
Message-ID: <a1904a4f077524cb29236c6058d3a54bc6aae98c.1633018789.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1633018789.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1633018789.git.rahul.lakkireddy@chelsio.com>
From: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Implement eth_dev_ops callback to get firmware version.
Signed-off-by: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
v2:
- Update FW version feature in cxgbe.ini and cxgbevf.ini
doc/guides/nics/features/cxgbe.ini | 1 +
doc/guides/nics/features/cxgbevf.ini | 1 +
drivers/net/cxgbe/cxgbe_ethdev.c | 26 ++++++++++++++++++++++++++
drivers/net/cxgbe/cxgbe_pfvf.h | 2 ++
drivers/net/cxgbe/cxgbevf_ethdev.c | 1 +
5 files changed, 31 insertions(+)
diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini
index 6721740fbd..f41fc14825 100644
--- a/doc/guides/nics/features/cxgbe.ini
+++ b/doc/guides/nics/features/cxgbe.ini
@@ -26,6 +26,7 @@ Packet type parsing = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
+FW version = Y
EEPROM dump = Y
Registers dump = Y
Multiprocess aware = Y
diff --git a/doc/guides/nics/features/cxgbevf.ini b/doc/guides/nics/features/cxgbevf.ini
index c8a25c9a8b..a3174ef399 100644
--- a/doc/guides/nics/features/cxgbevf.ini
+++ b/doc/guides/nics/features/cxgbevf.ini
@@ -22,6 +22,7 @@ Packet type parsing = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
+FW version = Y
Multiprocess aware = Y
Linux = Y
x86-32 = Y
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index a6b5c0110a..304fafed25 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1620,6 +1620,31 @@ static int cxgbe_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa)
return ret;
}
+int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size)
+{
+ struct port_info *pi = dev->data->dev_private;
+ struct adapter *adapter = pi->adapter;
+ int ret;
+
+ if (adapter->params.fw_vers == 0)
+ return -EIO;
+
+ ret = snprintf(fw_version, fw_size, "%u.%u.%u.%u",
+ G_FW_HDR_FW_VER_MAJOR(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_MINOR(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_MICRO(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_BUILD(adapter->params.fw_vers));
+ if (ret < 0)
+ return -EINVAL;
+
+ ret += 1;
+ if (fw_size < (size_t)ret)
+ return ret;
+
+ return 0;
+}
+
static const struct eth_dev_ops cxgbe_eth_dev_ops = {
.dev_start = cxgbe_dev_start,
.dev_stop = cxgbe_dev_stop,
@@ -1665,6 +1690,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = {
.fec_get_capability = cxgbe_fec_get_capability,
.fec_get = cxgbe_fec_get,
.fec_set = cxgbe_fec_set,
+ .fw_version_get = cxgbe_fw_version_get,
};
/*
diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h
index 3c7aee0ae7..81d0fce2e5 100644
--- a/drivers/net/cxgbe/cxgbe_pfvf.h
+++ b/drivers/net/cxgbe/cxgbe_pfvf.h
@@ -63,4 +63,6 @@ int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
unsigned int n);
int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned int n);
+int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size);
#endif /* _CXGBE_PFVF_H_ */
diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c
index 4c809991b7..a62c56c2b9 100644
--- a/drivers/net/cxgbe/cxgbevf_ethdev.c
+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c
@@ -92,6 +92,7 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
.xstats_get_names = cxgbe_dev_xstats_get_names,
.xstats_get_names_by_id = cxgbe_dev_xstats_get_names_by_id,
.mac_addr_set = cxgbe_mac_addr_set,
+ .fw_version_get = cxgbe_fw_version_get,
};
/*
--
2.27.0
next prev parent reply other threads:[~2021-09-30 17:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 18:01 [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and " Rahul Lakkireddy
2021-09-27 18:01 ` [dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
2021-09-30 16:09 ` Ferruh Yigit
2021-09-27 18:01 ` [dpdk-dev] [PATCH 2/2] net/cxgbe: add support to get firmware version Rahul Lakkireddy
2021-09-30 16:12 ` Ferruh Yigit
2021-09-30 16:23 ` [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and " Ferruh Yigit
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add " Rahul Lakkireddy
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
2021-09-30 17:09 ` Rahul Lakkireddy [this message]
2021-10-05 17:35 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add VF xstats and firmware version Ferruh Yigit
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=a1904a4f077524cb29236c6058d3a54bc6aae98c.1633018789.git.rahul.lakkireddy@chelsio.com \
--to=rahul.lakkireddy@chelsio.com \
--cc=dev@dpdk.org \
--cc=nikhil.vasoya@chelsio.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).