From patchwork Mon Mar 25 09:01:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiming Yang X-Patchwork-Id: 51615 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 1455237B0; Mon, 25 Mar 2019 10:01:11 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 234892BD3 for ; Mon, 25 Mar 2019 10:01:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 02:01:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="285623001" Received: from dpdk-qiming2.sh.intel.com ([10.67.119.132]) by orsmga004.jf.intel.com with ESMTP; 25 Mar 2019 02:01:06 -0700 From: Qiming Yang To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Qiming Yang Date: Mon, 25 Mar 2019 17:01:00 +0800 Message-Id: <20190325090102.85918-2-qiming.yang@intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190325090102.85918-1-qiming.yang@intel.com> References: <20190321150232.13536-2-qiming.yang@intel.com> <20190325090102.85918-1-qiming.yang@intel.com> Subject: [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package 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" This patch enables package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD. There is no per device package be supported so far, all the devices can only download the same package. This limitation will be removed in the future. Signed-off-by: Qiming Yang --- doc/guides/nics/ice.rst | 9 ++++ doc/guides/rel_notes/release_19_05.rst | 4 ++ drivers/net/ice/ice_ethdev.c | 77 ++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index 3998d5e..6410ec5 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -84,6 +84,15 @@ To start ``testpmd``, and add vlan 10 to port 0: Limitations or Known issues --------------------------- +The Intel E810 requires a programmable pipeline package be downloaded +by the driver to support normal operations. The E810 has a limited +functionality built in to allow PXE boot and other use cases, but the +driver must download a package file during the driver initialization +stage. The file must be in the /lib/firmware/intel/ice/ddp directory +and it must be named ice.pkg. A symbolic link to this file is also ok. +The same package file is used by both the kernel driver and the DPDK PMD. + + 19.02 limitation ~~~~~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index 61a2c73..b73938a 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -91,6 +91,10 @@ New Features * Added promiscuous mode support. +* **Updated the ice driver.** + + * Added package download support. + Removed Items ------------- diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index a23c63a..c2a03c3 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -4,12 +4,19 @@ #include + +#include +#include +#include +#include + #include "base/ice_sched.h" #include "ice_ethdev.h" #include "ice_rxtx.h" #define ICE_MAX_QP_NUM "max_queue_pair_num" #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 +#define ICE_DFLT_PKG_FILE "/lib/firmware/intel/ice/ddp/ice.pkg" int ice_logtype_init; int ice_logtype_driver; @@ -1259,6 +1266,69 @@ ice_pf_setup(struct ice_pf *pf) return 0; } +static int ice_load_pkg(struct rte_eth_dev *dev) +{ + struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + const char *pkg_file = ICE_DFLT_PKG_FILE; + int err; + uint8_t *buf; + int buf_len; + FILE *file; + struct stat fstat; + + file = fopen(pkg_file, "rb"); + if (!file) { + PMD_INIT_LOG(ERR, "failed to open file: %s\n", pkg_file); + return -1; + } + + err = stat(pkg_file, &fstat); + if (err) { + PMD_INIT_LOG(ERR, "failed to get file stats\n"); + fclose(file); + return err; + } + + buf_len = fstat.st_size; + buf = rte_malloc(NULL, buf_len, 0); + + if (!buf) { + PMD_INIT_LOG(ERR, "failed to allocate buf of size %d" + "for package\n", buf_len); + fclose(file); + return -1; + } + + err = fread(buf, buf_len, 1, file); + if (err != 1) { + PMD_INIT_LOG(ERR, "failed to read package data\n"); + fclose(file); + err = -1; + goto fail_exit; + } + + fclose(file); + + err = ice_copy_and_init_pkg(hw, buf, buf_len); + if (err) { + PMD_INIT_LOG(ERR, "ice_copy_and_init_hw failed: %d\n", err); + goto fail_exit; + } + err = ice_init_hw_tbls(hw); + if (err) { + PMD_INIT_LOG(ERR, "ice_init_hw_tbls failed: %d\n", err); + goto fail_init_tbls; + } + + return 0; + +fail_init_tbls: + rte_free(hw->pkg_copy); +fail_exit: + rte_free(buf); + return err; +} + static int ice_dev_init(struct rte_eth_dev *dev) { @@ -1298,6 +1368,12 @@ ice_dev_init(struct rte_eth_dev *dev) return -EINVAL; } + ret = ice_load_pkg(dev); + if (ret) { + PMD_INIT_LOG(ERR, "Failed to load the DDP package"); + goto err_load_pkg; + } + PMD_INIT_LOG(INFO, "FW %d.%d.%05d API %d.%d", hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build, hw->api_maj_ver, hw->api_min_ver); @@ -1343,6 +1419,7 @@ ice_dev_init(struct rte_eth_dev *dev) err_msix_pool_init: rte_free(dev->data->mac_addrs); err_init_mac: +err_load_pkg: ice_sched_cleanup_all(hw); rte_free(hw->port_info); ice_shutdown_all_ctrlq(hw);