[v2] net/ice: support customized search path for DDP package
Checks
Commit Message
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(+)
@@ -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
@@ -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);
@@ -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