From patchwork Mon Dec 10 18:28:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hyong Youb Kim (hyonkim)" X-Patchwork-Id: 48622 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5C29E1B39F; Mon, 10 Dec 2018 19:29:32 +0100 (CET) Received: from alln-iport-2.cisco.com (alln-iport-2.cisco.com [173.37.142.89]) by dpdk.org (Postfix) with ESMTP id 91C4D1B39E for ; Mon, 10 Dec 2018 19:29:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3325; q=dns/txt; s=iport; t=1544466570; x=1545676170; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=rASS8Rg/k/MLjEE8g42V0QtbPbNm3Y4YrU0UuoMlhFQ=; b=B+X4wX6TYuOV8R6mXotNtsqbteX3kEWqKRi/aliV1qVIRApbGE2RjMIM kaulep4fpiF7Z5fr7MZ5tGFwbbZ15N3BzrvgaySYhPutdOhGeMjB60hnH 8cN8vD8/maXW6tBPMkqxajvNp/b7EE5gq39xoWryL3QgJf0nwUAslBdgY E=; X-IronPort-AV: E=Sophos;i="5.56,339,1539648000"; d="scan'208";a="211058453" Received: from rcdn-core-3.cisco.com ([173.37.93.154]) by alln-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2018 18:29:28 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-3.cisco.com (8.15.2/8.15.2) with ESMTP id wBAITS1g022186; Mon, 10 Dec 2018 18:29:28 GMT Received: by cisco.com (Postfix, from userid 508933) id 463F920F2001; Mon, 10 Dec 2018 10:29:28 -0800 (PST) From: Hyong Youb Kim To: Ferruh Yigit Cc: dev@dpdk.org, John Daley , Hyong Youb Kim Date: Mon, 10 Dec 2018 10:28:54 -0800 Message-Id: <20181210182857.13043-3-hyonkim@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20181210182857.13043-1-hyonkim@cisco.com> References: <20181210182857.13043-1-hyonkim@cisco.com> X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: rcdn-core-3.cisco.com Subject: [dpdk-dev] [PATCH 2/4] net/enic: add handler to return firmware version string X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Cisco VIC adapters run firmware. Add the fw_version_get handler to help diagnostics. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- 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,