DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hyong Youb Kim <hyonkim@cisco.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>,
	Hyong Youb Kim <hyonkim@cisco.com>
Subject: [dpdk-dev] [PATCH 2/4] net/enic: add handler to return firmware version string
Date: Mon, 10 Dec 2018 10:28:54 -0800	[thread overview]
Message-ID: <20181210182857.13043-3-hyonkim@cisco.com> (raw)
In-Reply-To: <20181210182857.13043-1-hyonkim@cisco.com>

Cisco VIC adapters run firmware. Add the fw_version_get handler to
help diagnostics.

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 doc/guides/nics/features/enic.ini |  1 +
 drivers/net/enic/base/vnic_dev.c  | 26 ++++++++++++++++++++++++++
 drivers/net/enic/enic_ethdev.c    | 21 +++++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/doc/guides/nics/features/enic.ini b/doc/guides/nics/features/enic.ini
index 8a4bad29f..020b75cf0 100644
--- a/doc/guides/nics/features/enic.ini
+++ b/doc/guides/nics/features/enic.ini
@@ -31,6 +31,7 @@ Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
 Basic stats          = Y
+FW version           = Y
 Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
diff --git a/drivers/net/enic/base/vnic_dev.c b/drivers/net/enic/base/vnic_dev.c
index fd303fece..1e5b12a80 100644
--- a/drivers/net/enic/base/vnic_dev.c
+++ b/drivers/net/enic/base/vnic_dev.c
@@ -458,6 +458,32 @@ int vnic_dev_cmd_args(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	}
 }
 
+int vnic_dev_fw_info(struct vnic_dev *vdev,
+		     struct vnic_devcmd_fw_info **fw_info)
+{
+	char name[NAME_MAX];
+	u64 a0, a1 = 0;
+	int wait = 1000;
+	int err = 0;
+	static u32 instance;
+
+	if (!vdev->fw_info) {
+		snprintf((char *)name, sizeof(name), "vnic_fw_info-%u",
+			 instance++);
+		vdev->fw_info = vdev->alloc_consistent(vdev->priv,
+			sizeof(struct vnic_devcmd_fw_info),
+			&vdev->fw_info_pa, (u8 *)name);
+		if (!vdev->fw_info)
+			return -ENOMEM;
+		a0 = vdev->fw_info_pa;
+		a1 = sizeof(struct vnic_devcmd_fw_info);
+		err = vnic_dev_cmd(vdev, CMD_MCPU_FW_INFO,
+				   &a0, &a1, wait);
+	}
+	*fw_info = vdev->fw_info;
+	return err;
+}
+
 static int vnic_dev_advanced_filters_cap(struct vnic_dev *vdev, u64 *args,
 		int nargs)
 {
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index ed8dda568..9b206e8f0 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -887,6 +887,26 @@ static int enicpmd_dev_udp_tunnel_port_del(struct rte_eth_dev *eth_dev,
 	return update_vxlan_port(enic, ENIC_DEFAULT_VXLAN_PORT);
 }
 
+static int enicpmd_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+				      char *fw_version, size_t fw_size)
+{
+	struct vnic_devcmd_fw_info *info;
+	struct enic *enic;
+	int ret;
+
+	ENICPMD_FUNC_TRACE();
+	if (fw_version == NULL || fw_size <= 0)
+		return -EINVAL;
+	enic = pmd_priv(eth_dev);
+	ret = vnic_dev_fw_info(enic->vdev, &info);
+	if (ret)
+		return ret;
+	snprintf(fw_version, fw_size, "%s %s",
+		 info->fw_version, info->fw_build);
+	fw_version[fw_size - 1] = '\0';
+	return 0;
+}
+
 static const struct eth_dev_ops enicpmd_eth_dev_ops = {
 	.dev_configure        = enicpmd_dev_configure,
 	.dev_start            = enicpmd_dev_start,
@@ -938,6 +958,7 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = {
 	.rss_hash_update      = enicpmd_dev_rss_hash_update,
 	.udp_tunnel_port_add  = enicpmd_dev_udp_tunnel_port_add,
 	.udp_tunnel_port_del  = enicpmd_dev_udp_tunnel_port_del,
+	.fw_version_get       = enicpmd_dev_fw_version_get,
 };
 
 static int enic_parse_zero_one(const char *key,
-- 
2.16.2

  parent reply	other threads:[~2018-12-10 18:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 18:28 [dpdk-dev] [PATCH 0/4] net/enic: minor updates Hyong Youb Kim
2018-12-10 18:28 ` [dpdk-dev] [PATCH 1/4] net/enic: release port upon close Hyong Youb Kim
2018-12-10 18:28 ` Hyong Youb Kim [this message]
2018-12-10 18:28 ` [dpdk-dev] [PATCH 3/4] net/enic: support multicast filtering Hyong Youb Kim
2019-01-11 15:46   ` Ferruh Yigit
2019-01-12  4:49     ` Hyong Youb Kim
2019-01-14 10:29       ` Ferruh Yigit
2018-12-10 18:28 ` [dpdk-dev] [PATCH 4/4] doc: update release notes for enic Hyong Youb Kim
2018-12-11  2:44   ` Varghese, Vipin
2018-12-11 16:08     ` Hyong Youb Kim
2018-12-11 16:31       ` Varghese, Vipin
2018-12-11 16:40         ` Hyong Youb Kim
2018-12-11 16:49           ` Varghese, Vipin
2018-12-11 17:25             ` Hyong Youb Kim
2018-12-12  2:23               ` Varghese, Vipin
2018-12-12 11:56 ` [dpdk-dev] [PATCH 0/4] net/enic: minor updates 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=20181210182857.13043-3-hyonkim@cisco.com \
    --to=hyonkim@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=johndale@cisco.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).