From: Qiming Yang <qiming.yang@intel.com>
To: dev@dpdk.org
Cc: qi.z.zhang@intel.com, paul.m.stillwell.jr@intel.com,
Qiming Yang <qiming.yang@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/4] net/ice: load OS default package
Date: Wed, 20 Mar 2019 23:50:22 +0800 [thread overview]
Message-ID: <20190320155025.138173-2-qiming.yang@intel.com> (raw)
Message-ID: <20190320155022.AZby1vrYKTzYs7P49mjBmj10E2Hf2jNfxAlhLZwpJKU@z> (raw)
In-Reply-To: <20190320155025.138173-1-qiming.yang@intel.com>
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 <qiming.yang@intel.com>
---
drivers/net/ice/ice_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a23c63a..13f2748 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,6 +2,11 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
#include <rte_ethdev_pci.h>
#include "base/ice_sched.h"
@@ -10,6 +15,7 @@
#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 +1265,62 @@ 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_path, "rb");
+ if (!file) {
+ PMD_INIT_LOG(ERR, "failed to open file: %s", pkg_file);
+ return -1;
+ }
+
+ err = stat(pkg_path, &fstat);
+ if (err) {
+ PMD_INIT_LOG(ERR, "failed to get file stats");
+ 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", 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");
+ fclose(file);
+ return -1;
+ }
+
+ 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);
+ return err;
+ }
+ err = ice_init_hw_tbls(hw);
+ if (err) {
+ PMD_INIT_LOG(ERR, "ice_init_hw_tbls failed: %d\n", err);
+ return err;
+ }
+
+ return 0;
+}
+
static int
ice_dev_init(struct rte_eth_dev *dev)
{
@@ -1298,6 +1360,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 +1411,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);
--
2.9.5
next prev parent reply other threads:[~2019-03-20 8:27 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 12:46 [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Qiming Yang
2019-03-01 12:46 ` [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode Qiming Yang
2019-03-01 18:38 ` Stephen Hemminger
2019-03-01 20:41 ` Stillwell Jr, Paul M
2019-03-01 13:40 ` [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Thomas Monjalon
2019-03-06 2:36 ` Yang, Qiming
2019-03-01 18:39 ` Stephen Hemminger
2019-03-01 18:40 ` Stephen Hemminger
2019-03-04 17:54 ` Stillwell Jr, Paul M
2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
2019-03-20 15:50 ` Qiming Yang
2019-03-20 15:50 ` Qiming Yang [this message]
2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 1/4] net/ice: load OS default package Qiming Yang
2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 2/4] net/ice: add safe mode Qiming Yang
2019-03-20 15:50 ` Qiming Yang
2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 3/4] net/ice: enable RSS when device init Qiming Yang
2019-03-20 15:50 ` Qiming Yang
2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 4/4] doc: add document update for package download Qiming Yang
2019-03-20 15:50 ` Qiming Yang
2019-03-20 17:59 ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
2019-03-20 17:59 ` Qiming Yang
2019-03-20 17:59 ` [dpdk-dev] [PATCH v3 1/3] net/ice: load OS default package Qiming Yang
2019-03-20 17:59 ` Qiming Yang
2019-03-20 17:59 ` [dpdk-dev] [PATCH v3 2/3] net/ice: add safe mode Qiming Yang
2019-03-20 17:59 ` Qiming Yang
2019-03-20 17:59 ` [dpdk-dev] [PATCH v3 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-20 17:59 ` Qiming Yang
2019-03-21 15:02 ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
2019-03-21 15:02 ` Qiming Yang
2019-03-21 15:02 ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
2019-03-21 15:02 ` Qiming Yang
2019-03-25 2:29 ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
2019-03-25 2:29 ` Qiming Yang
2019-03-25 2:29 ` [dpdk-dev] [PATCH v5 1/3] net/ice: load OS default package Qiming Yang
2019-03-25 2:29 ` Qiming Yang
2019-03-25 2:29 ` [dpdk-dev] [PATCH v5 2/3] net/ice: add safe mode Qiming Yang
2019-03-25 2:29 ` Qiming Yang
2019-03-25 2:29 ` [dpdk-dev] [PATCH v5 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-25 2:29 ` Qiming Yang
2019-03-25 4:25 ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Stillwell Jr, Paul M
2019-03-25 4:25 ` Stillwell Jr, Paul M
2019-03-25 9:00 ` [dpdk-dev] [PATCH v6 " Qiming Yang
2019-03-25 9:00 ` Qiming Yang
2019-03-25 9:01 ` [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package Qiming Yang
2019-03-25 9:01 ` Qiming Yang
2019-03-25 13:56 ` Zhang, Qi Z
2019-03-25 13:56 ` Zhang, Qi Z
2019-03-25 9:01 ` [dpdk-dev] [PATCH v6 2/3] net/ice: add safe mode Qiming Yang
2019-03-25 9:01 ` Qiming Yang
2019-03-25 9:01 ` [dpdk-dev] [PATCH v6 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-25 9:01 ` Qiming Yang
2019-03-25 14:00 ` [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver Zhang, Qi Z
2019-03-25 14:00 ` Zhang, Qi Z
2019-03-21 15:02 ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
2019-03-21 15:02 ` Qiming Yang
2019-03-21 15:02 ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-21 15:02 ` Qiming Yang
2019-03-21 15:02 ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
2019-03-21 15:02 ` Qiming Yang
2019-03-21 15:02 ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
2019-03-21 15:02 ` Qiming Yang
2019-03-21 15:02 ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
2019-03-21 15:02 ` Qiming Yang
2019-03-21 15:02 ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-21 15:02 ` Qiming Yang
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=20190320155025.138173-2-qiming.yang@intel.com \
--to=qiming.yang@intel.com \
--cc=dev@dpdk.org \
--cc=paul.m.stillwell.jr@intel.com \
--cc=qi.z.zhang@intel.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).