Skip to contentSkip to conversation

net/ice: enable DDP loading from FreeBSD kernel module

PATCH New Bruce Richardson 1 participant 1 message Nov 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: enable DDP loading from FreeBSD kernel module

On FreeBSD, the DDP package can be contained inside a kernel module called "ice_ddp.ko", rather than as a .pkg file in /lib/firmware as on linux. Add support for loading from the kmod as a final fallback option for BSD systems only.

---
 doc/guides/nics/ice.rst              |   4 +
 drivers/net/intel/ice/ice_ddp_kmod.c | 264 +++++++++++++++++++++++++++
 drivers/net/intel/ice/ice_ethdev.c   |  14 +-
 drivers/net/intel/ice/ice_ethdev.h   |   3 +
 drivers/net/intel/ice/meson.build    |   1 +
 5 files changed, 282 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/intel/ice/ice_ddp_kmod.c
doc/guides/nics/ice.rst +4 -0
index faebfdcb63..a4acf9a957 100644
@@ -97,6 +97,10 @@ During initialization, the driver searches in the following paths in order:
 ``CUSTOMIZED_PATH``, ``/lib/firmware/updates/intel/ice/ddp`` and ``/lib/firmware/intel/ice/ddp``.
 The device-specific DDP package has a higher loading priority than default DDP package, ``ice.pkg``.
 
+On FreeBSD, if no package file is found in the above paths,
+the driver uses the package embedded in the ``ice_ddp.ko`` kernel module,
+which is the package used by the FreeBSD kernel ice driver.
+
 .. note::
 
    Windows support: DDP packages are not supported on Windows.
drivers/net/intel/ice/ice_ddp_kmod.c new file +264 -0

264 lines not on this page · raw message

drivers/net/intel/ice/ice_ethdev.c +10 -4
index 457c955b2e..0824d83b8a 100644
@@ -2132,10 +2132,16 @@ int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn)
 		goto load_fw;
 
 	strlcpy(pkg_file, ICE_PKG_FILE_DEFAULT, ICE_MAX_PKG_FILENAME_SIZE);
-	if (ice_firmware_read(pkg_file, &buf, &bufsz) < 0) {
-		PMD_INIT_LOG(ERR, "Failed to load default DDP package " ICE_PKG_FILE_DEFAULT);
-		return -1;
-	}
+	if (ice_firmware_read(pkg_file, &buf, &bufsz) == 0)
+		goto load_fw;
+
+	/* use the same package as the kernel driver, on OSes providing it as a module */
+	strlcpy(pkg_file, ICE_PKG_KMOD_NAME " kernel module", ICE_MAX_PKG_FILENAME_SIZE);
+	if (ice_ddp_read_kmod(&buf, &bufsz) == 0)
+		goto load_fw;
+
+	PMD_INIT_LOG(ERR, "Failed to load default DDP package " ICE_PKG_FILE_DEFAULT);
+	return -1;
 
 load_fw:
 	PMD_INIT_LOG(DEBUG, "DDP package name: %s", pkg_file);
drivers/net/intel/ice/ice_ethdev.h +3 -0
index 7a3d164143..bd6b1991b0 100644
@@ -53,6 +53,7 @@
 #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_PKG_KMOD_NAME "ice_ddp"
 #define ICE_MAX_PKG_FILENAME_SIZE   256
 
 #define MAX_ACL_NORMAL_ENTRIES    256
@@ -752,6 +753,8 @@ struct ice_vsi_vlan_pvid_info {
 bool is_ice_supported(struct rte_eth_dev *dev);
 int
 ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn);
+int
+ice_ddp_read_kmod(void **buf, size_t *bufsz);
 struct ice_vsi *
 ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type);
 int
drivers/net/intel/ice/meson.build +1 -0
index 00077be30a..d776276612 100644
@@ -8,6 +8,7 @@ sources = files(
         'ice_dcf_ethdev.c',
         'ice_dcf_parent.c',
         'ice_dcf_sched.c',
+        'ice_ddp_kmod.c',
         'ice_diagnose.c',
         'ice_ethdev.c',
         'ice_fdir_filter.c',
Signature · 1 line
2.55.0