From patchwork Fri Dec 14 08:35:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenzhuo Lu X-Patchwork-Id: 48831 X-Patchwork-Delegate: qi.z.zhang@intel.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 3A4BF1B9AC; Fri, 14 Dec 2018 09:31:21 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 8BA051B910 for ; Fri, 14 Dec 2018 09:31:05 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Dec 2018 00:31:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,352,1539673200"; d="scan'208";a="302131776" Received: from dpdk26.sh.intel.com ([10.67.110.164]) by fmsmga006.fm.intel.com with ESMTP; 14 Dec 2018 00:31:04 -0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu , Qiming Yang , Xiaoyun Li , Jingjing Wu Date: Fri, 14 Dec 2018 16:35:12 +0800 Message-Id: <1544776518-91047-27-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1544776518-91047-1-git-send-email-wenzhuo.lu@intel.com> References: <1542956179-80951-1-git-send-email-wenzhuo.lu@intel.com> <1544776518-91047-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH v4 26/32] net/ice: support FW version getting 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" Add ops fw_version_get. Signed-off-by: Wenzhuo Lu Signed-off-by: Qiming Yang Signed-off-by: Xiaoyun Li Signed-off-by: Jingjing Wu --- doc/guides/nics/features/ice.ini | 1 + drivers/net/ice/ice_ethdev.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini index 2844f4c..4867433 100644 --- a/doc/guides/nics/features/ice.ini +++ b/doc/guides/nics/features/ice.ini @@ -19,6 +19,7 @@ RSS reta update = Y VLAN filter = Y VLAN offload = Y QinQ offload = Y +FW version = Y BSD nic_uio = Y Linux UIO = Y Linux VFIO = Y diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 8eb96a0..9638678 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -52,6 +52,8 @@ static int ice_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int ice_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id); +static int ice_fw_version_get(struct rte_eth_dev *dev, char *fw_version, + size_t fw_size); static int ice_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on); @@ -92,6 +94,7 @@ static int ice_vlan_pvid_set(struct rte_eth_dev *dev, .rss_hash_conf_get = ice_rss_hash_conf_get, .rx_queue_intr_enable = ice_rx_queue_intr_enable, .rx_queue_intr_disable = ice_rx_queue_intr_disable, + .fw_version_get = ice_fw_version_get, .vlan_pvid_set = ice_vlan_pvid_set, }; @@ -2478,6 +2481,24 @@ static int ice_rx_queue_intr_disable(struct rte_eth_dev *dev, } static int +ice_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) +{ + struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + int ret; + + ret = snprintf(fw_version, fw_size, "%d.%d.%05d %d.%d", + hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build, + hw->api_maj_ver, hw->api_min_ver); + + /* add the size of '\0' */ + ret += 1; + if (fw_size < (u32)ret) + return ret; + else + return 0; +} + +static int ice_vsi_vlan_pvid_set(struct ice_vsi *vsi, struct ice_vsi_vlan_pvid_info *info) { struct ice_hw *hw;