From: Alfredo Cardigliano <cardigliano@ntop.org>
To: Alfredo Cardigliano <cardigliano@ntop.org>,
John McNamara <john.mcnamara@intel.com>,
Marko Kovacevic <marko.kovacevic@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 17/17] net/ionic: read fw version
Date: Mon, 9 Dec 2019 22:46:56 +0100 [thread overview]
Message-ID: <20191209214656.27347-18-cardigliano@ntop.org> (raw)
In-Reply-To: <20191209214656.27347-1-cardigliano@ntop.org>
Add support for reading the firmware version.
Signed-off-by: Alfredo Cardigliano <cardigliano@ntop.org>
Reviewed-by: Shannon Nelson <snelson@pensando.io>
---
doc/guides/nics/features/ionic.ini | 1 +
drivers/net/ionic/ionic.h | 1 +
drivers/net/ionic/ionic_dev.c | 8 ++++++++
drivers/net/ionic/ionic_ethdev.c | 20 ++++++++++++++++++++
4 files changed, 30 insertions(+)
diff --git a/doc/guides/nics/features/ionic.ini b/doc/guides/nics/features/ionic.ini
index f4ec04c73..32e9bce55 100644
--- a/doc/guides/nics/features/ionic.ini
+++ b/doc/guides/nics/features/ionic.ini
@@ -30,6 +30,7 @@ Packet type parsing = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
+FW version = Y
Linux UIO = Y
Linux VFIO = Y
x86-64 = Y
diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h
index ae4f6acc7..45a7879c9 100644
--- a/drivers/net/ionic/ionic.h
+++ b/drivers/net/ionic/ionic.h
@@ -60,6 +60,7 @@ struct ionic_adapter {
bool intrs[IONIC_INTR_CTRL_REGS_MAX];
bool is_mgmt_nic;
bool link_up;
+ char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
struct rte_pci_device *pci_dev;
LIST_ENTRY(ionic_adapter) pci_adapters;
};
diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c
index 1c5a4425b..0b63c234d 100644
--- a/drivers/net/ionic/ionic_dev.c
+++ b/drivers/net/ionic/ionic_dev.c
@@ -16,6 +16,7 @@ ionic_dev_setup(struct ionic_adapter *adapter)
struct ionic_dev *idev = &adapter->idev;
uint32_t sig;
u_char *bar0_base;
+ unsigned int i;
/* BAR0: dev_cmd and interrupts */
if (num_bars < 1) {
@@ -47,6 +48,13 @@ ionic_dev_setup(struct ionic_adapter *adapter)
return -EFAULT;
}
+ for (i = 0; i < IONIC_DEVINFO_FWVERS_BUFLEN; i++)
+ adapter->fw_version[i] =
+ ioread8(&idev->dev_info->fw_version[i]);
+ adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0';
+
+ IONIC_PRINT(DEBUG, "Firmware version: %s", adapter->fw_version);
+
/* BAR1: doorbells */
bar++;
if (num_bars < 2) {
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 7c8e70872..34b01f526 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -56,6 +56,8 @@ static int ionic_dev_xstats_get_names(struct rte_eth_dev *dev,
static int ionic_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
unsigned int limit);
+static int ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+ char *fw_version, size_t fw_size);
int ionic_logtype_driver;
@@ -122,6 +124,7 @@ static const struct eth_dev_ops ionic_eth_dev_ops = {
.xstats_reset = ionic_dev_xstats_reset,
.xstats_get_names = ionic_dev_xstats_get_names,
.xstats_get_names_by_id = ionic_dev_xstats_get_names_by_id,
+ .fw_version_get = ionic_dev_fw_version_get,
};
/*
@@ -219,6 +222,23 @@ static const struct rte_ionic_xstats_name_off rte_ionic_xstats_strings[] = {
#define IONIC_NB_HW_STATS (sizeof(rte_ionic_xstats_strings) / \
sizeof(rte_ionic_xstats_strings[0]))
+static int
+ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+ char *fw_version, size_t fw_size)
+{
+ struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
+ struct ionic_adapter *adapter = lif->adapter;
+
+ if (fw_version == NULL || fw_size <= 0)
+ return -EINVAL;
+
+ snprintf(fw_version, fw_size, "%s",
+ adapter->fw_version);
+ fw_version[fw_size - 1] = '\0';
+
+ return 0;
+}
+
/*
* Set device link up, enable tx.
*/
--
2.17.1
next prev parent reply other threads:[~2019-12-09 21:51 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 21:46 [dpdk-dev] [PATCH v3 00/17] Introduces net/ionic PMD Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 01/17] net/ionic: add skeleton Alfredo Cardigliano
2019-12-10 18:48 ` Ferruh Yigit
2019-12-12 12:01 ` Alfredo Cardigliano
2019-12-12 12:39 ` Ferruh Yigit
2019-12-12 14:09 ` Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 02/17] net/ionic: add hardware structures definitions Alfredo Cardigliano
2019-12-10 18:48 ` Ferruh Yigit
2019-12-13 10:25 ` Hemant Agrawal
2019-12-17 19:46 ` Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 03/17] net/ionic: add log Alfredo Cardigliano
2019-12-10 18:49 ` Ferruh Yigit
2019-12-13 10:22 ` Hemant Agrawal
2019-12-10 18:49 ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 04/17] net/ionic: register and initialize the adapter Alfredo Cardigliano
2019-12-10 18:50 ` Ferruh Yigit
2019-12-12 12:04 ` Alfredo Cardigliano
2019-12-12 12:42 ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 05/17] net/ionic: add port management commands Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 06/17] net/ionic: add basic lif support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 07/17] net/ionic: add doorbells Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 08/17] net/ionic: add adminq support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 09/17] net/ionic: add notifyq support Alfredo Cardigliano
2019-12-10 18:53 ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 10/17] net/ionic: add basic port operations Alfredo Cardigliano
2019-12-10 18:50 ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 11/17] net/ionic: add RX filters support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 12/17] net/ionic: add Flow Control support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 13/17] net/ionic: add RX and TX handling Alfredo Cardigliano
2019-12-10 18:51 ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 14/17] net/ionic: add RSS support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 15/17] net/ionic: add stats Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 16/17] net/ionic: add TX checksum support Alfredo Cardigliano
2019-12-10 18:52 ` Ferruh Yigit
2019-12-09 21:46 ` Alfredo Cardigliano [this message]
2019-12-10 18:57 ` [dpdk-dev] [PATCH v3 00/17] Introduces net/ionic PMD 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=20191209214656.27347-18-cardigliano@ntop.org \
--to=cardigliano@ntop.org \
--cc=dev@dpdk.org \
--cc=john.mcnamara@intel.com \
--cc=marko.kovacevic@intel.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).