From: Zhichao Zeng <zhichaox.zeng@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, Zhichao Zeng <zhichaox.zeng@intel.com>
Subject: [PATCH v2] net/ice: support customized search path for DDP package
Date: Thu, 29 Aug 2024 11:35:01 +0800 [thread overview]
Message-ID: <20240829033501.1580854-1-zhichaox.zeng@intel.com> (raw)
In-Reply-To: <20240828035335.1069153-1-zhichaox.zeng@intel.com>
This patch adds support for customizing firmware search path for
DDP package like the kernel behavior, it will read the search path
from "/sys/module/firmware_class/parameters/path",
and try to load DDP package.
Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
v2: separate the patch and rewrite the log
---
doc/guides/nics/ice.rst | 5 +++++
drivers/net/ice/ice_ethdev.c | 27 +++++++++++++++++++++++++++
drivers/net/ice/ice_ethdev.h | 1 +
3 files changed, 33 insertions(+)
diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index ae975d19ad..741cd42cb7 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -108,6 +108,11 @@ Runtime Configuration
-a 80:00.0,default-mac-disable=1
+- ``DDP Package File``
+
+ Support for customizing the firmware search path, will read the search path
+ from "/sys/module/firmware_class/parameters/path" and try to load DDP package.
+
- ``Protocol extraction for per queue``
Configure the RX queues to do protocol extraction into mbuf for protocol
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 304f959b7e..fc0954ff34 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1873,6 +1873,22 @@ ice_load_pkg_type(struct ice_hw *hw)
return package_type;
}
+static int ice_read_customized_path(char *pkg_file)
+{
+ char buf[ICE_MAX_PKG_FILENAME_SIZE];
+ FILE *fp = fopen(ICE_PKG_FILE_CUSTOMIZED_PATH, "r");
+ if (fp == NULL) {
+ PMD_INIT_LOG(ERR, "Failed to read CUSTOMIZED_PATH");
+ return -EIO;
+ }
+ if (fscanf(fp, "%s\n", buf) > 0)
+ strncpy(pkg_file, buf, ICE_MAX_PKG_FILENAME_SIZE);
+ else
+ return -EIO;
+
+ return 0;
+}
+
int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn)
{
struct ice_hw *hw = &adapter->hw;
@@ -1888,6 +1904,12 @@ int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn)
memset(opt_ddp_filename, 0, ICE_MAX_PKG_FILENAME_SIZE);
snprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE,
"ice-%016" PRIx64 ".pkg", dsn);
+
+ ice_read_customized_path(pkg_file);
+ strcat(pkg_file, opt_ddp_filename);
+ if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
+ goto load_fw;
+
strncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_UPDATES,
ICE_MAX_PKG_FILENAME_SIZE);
strcat(pkg_file, opt_ddp_filename);
@@ -1901,6 +1923,10 @@ int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn)
goto load_fw;
no_dsn:
+ ice_read_customized_path(pkg_file);
+ if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
+ goto load_fw;
+
strncpy(pkg_file, ICE_PKG_FILE_UPDATES, ICE_MAX_PKG_FILENAME_SIZE);
if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
goto load_fw;
@@ -6981,6 +7007,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp|ip_offset>"
ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>"
ICE_DEFAULT_MAC_DISABLE "=<0|1>"
+ ICE_DDP_FILENAME "=</path/to/file>"
ICE_RX_LOW_LATENCY_ARG "=<0|1>");
RTE_LOG_REGISTER_SUFFIX(ice_logtype_init, init, NOTICE);
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 3ea9f37dc8..8b644ed700 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -51,6 +51,7 @@
#define ICE_PKG_FILE_UPDATES "/lib/firmware/updates/intel/ice/ddp/ice.pkg"
#define ICE_PKG_FILE_SEARCH_PATH_DEFAULT "/lib/firmware/intel/ice/ddp/"
#define ICE_PKG_FILE_SEARCH_PATH_UPDATES "/lib/firmware/updates/intel/ice/ddp/"
+#define ICE_PKG_FILE_CUSTOMIZED_PATH "/sys/module/firmware_class/parameters/path"
#define ICE_MAX_PKG_FILENAME_SIZE 256
#define MAX_ACL_NORMAL_ENTRIES 256
--
2.34.1
next prev parent reply other threads:[~2024-08-29 3:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 3:53 [PATCH] net/ice: support for more flexible loading of " Zhichao Zeng
2024-08-28 7:55 ` Bruce Richardson
2024-08-28 8:53 ` Zeng, ZhichaoX
2024-08-29 3:35 ` Zhichao Zeng [this message]
2024-08-29 3:41 ` [PATCH v2] net/ice: support customized search path for " Zhichao Zeng
2024-09-09 12:13 ` Bruce Richardson
2024-09-12 7:47 ` [PATCH v3] " Zhichao Zeng
2024-09-12 8:01 ` Zhichao Zeng
2024-09-13 6:15 ` [PATCH v4] " Zhichao Zeng
2024-09-13 10:57 ` Bruce Richardson
2024-09-19 3:29 ` [PATCH v5] " Zhichao Zeng
2024-09-19 7:49 ` Bruce Richardson
2024-09-20 8:34 ` Zeng, ZhichaoX
2024-09-20 9:04 ` Bruce Richardson
2024-09-20 10:05 ` [PATCH v6] " Zhichao Zeng
2024-10-01 13:54 ` Bruce Richardson
2024-10-01 14:03 ` Bruce Richardson
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=20240829033501.1580854-1-zhichaox.zeng@intel.com \
--to=zhichaox.zeng@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/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).