summaryrefslogtreecommitdiff
path: root/drivers/net/enic
diff options
context:
space:
mode:
authorHyong Youb Kim <hyonkim@cisco.com>2018-12-10 10:28:54 -0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-12-13 17:52:04 +0000
commit293430677e9cd91638db9fd4ad1472b40383074c (patch)
tree90171691b79ce673fb8a7bae4b599943c754f8b9 /drivers/net/enic
parent7f34bb52028fdfc4ac97a7d828476b93a9a5a3e1 (diff)
downloaddpdk-next-eventdev-293430677e9cd91638db9fd4ad1472b40383074c.zip
dpdk-next-eventdev-293430677e9cd91638db9fd4ad1472b40383074c.tar.gz
dpdk-next-eventdev-293430677e9cd91638db9fd4ad1472b40383074c.tar.xz
net/enic: add handler to return firmware version
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>
Diffstat (limited to 'drivers/net/enic')
-rw-r--r--drivers/net/enic/base/vnic_dev.c26
-rw-r--r--drivers/net/enic/enic_ethdev.c21
2 files changed, 47 insertions, 0 deletions
diff --git a/drivers/net/enic/base/vnic_dev.c b/drivers/net/enic/base/vnic_dev.c
index fd303fe..1e5b12a 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 ed8dda5..9b206e8 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,