From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D5BB4596A; Thu, 12 Sep 2024 09:46:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B95D40B94; Thu, 12 Sep 2024 09:46:37 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by mails.dpdk.org (Postfix) with ESMTP id 9D3D44025E for ; Thu, 12 Sep 2024 09:46:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726127196; x=1757663196; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sd5x8miJXKedHg+G7bY107sn0iNviU1cCvtEqAyWgg8=; b=JbngUibLcqEZPIltmao1SE0LX9oqrjwvX7Ly/R26HlVa6uCGQ65GguDT ruJ2GkYCO/twihv7ziph95c9mWj0u1tPfC+h93EHDTuO98LNMN/CzuO2z dxYLlnX+YtxkuZQ77oTIA2HiMVSQ0Hl/ssa2edI8YZlFm9wEp6bHm9UoQ O5NJmcSek1TPrMCvbqXJCEAp8AwcsUMeZ2fIAA/JQ5z+um+5kQAIvhZ3K aaVBsD0dPG4Ok9aMKDQ0rbEPR51h5F9l9gmlJL+Sokctuf0pphXB8eK5v JOnlAERyGWSZrHUR1OII9wEsVPV7B9yrzYGAr3a7y8JN7nzDg/zJYJLrs Q==; X-CSE-ConnectionGUID: e3oAHLNHQyuNO+A2lTZNEQ== X-CSE-MsgGUID: Gpx7wS0/TVyn8dgHxddtlQ== X-IronPort-AV: E=McAfee;i="6700,10204,11192"; a="24842350" X-IronPort-AV: E=Sophos;i="6.10,222,1719903600"; d="scan'208";a="24842350" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2024 00:46:35 -0700 X-CSE-ConnectionGUID: /ntbO+2fQwCdaaPO2GbJ3A== X-CSE-MsgGUID: c2ZCnLe/SvikDA706bd8+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,222,1719903600"; d="scan'208";a="67245398" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2024 00:46:33 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: bruce.richardson@intel.com, Zhichao Zeng Subject: [PATCH v3] net/ice: support customized search path for DDP package Date: Thu, 12 Sep 2024 16:01:13 +0800 Message-Id: <20240912080114.1513773-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829034158.1584970-1-zhichaox.zeng@intel.com> References: <20240829034158.1584970-1-zhichaox.zeng@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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. Also, updates documentation for loading the DDP package in ice.rst. Signed-off-by: Zhichao Zeng --- v3: update doc, fix code error v2: separate the patch and rewrite the log --- doc/guides/nics/ice.rst | 64 ++++++++++++++++++++---------------- drivers/net/ice/ice_ethdev.c | 41 +++++++++++++++++++++++ drivers/net/ice/ice_ethdev.h | 1 + 3 files changed, 77 insertions(+), 29 deletions(-) diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index ae975d19ad..daf1e89cf6 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -80,6 +80,41 @@ are listed in the Tested Platforms section of the Release Notes for each release | 24.03 | 1.13.7 | 1.3.35 | 1.3.45 | 1.3.13 | 4.4 | +-----------+---------------+-----------------+-----------+--------------+-----------+ +Dynamic Device Personalization (DDP) package loading +---------------------------------------------------- + +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 default DDP package file name is ice.pkg. For a specific NIC, the +DDP package supposed to be loaded can have a filename: ice-xxxxxx.pkg, +where 'xxxxxx' is the 64-bit PCIe Device Serial Number of the NIC. For +example, if the NIC's device serial number is 00-CC-BB-FF-FF-AA-05-68, +the device-specific DDP package filename is ice-00ccbbffffaa0568.pkg +(in hex and all low case), please review README from +`IntelĀ® Ethernet 800 Series Dynamic Device Personalization (DDP) for +Telecommunication (Comms) Package`_ +for more information. A symbolic link to the DDP package file is also ok. +The same package file is used by both the kernel driver and the ICE PMD. + +ICE PMD support customized DDP search path, driver will read search path +from '/sys/module/firmware_class/parameters/path' as CUSTOMIZED_PATH. +During initialization, the driver searches in the following paths in order: +CUSTOMIZED_PATH(mentioned above), /lib/firmware/updates/intel/ice/ddp and +/lib/firmware/intel/ice/ddp. The corresponding device-specific DDP +package will be downloaded first if the file exists. If not, then the +driver tries to load the default package. The type of loaded package +is stored in ``ice_adapter->active_pkg_type``. + + .. Note:: + + Windows support: The DDP package is not supported on Windows so, + loading of the package is disabled on Windows. + Configuration ------------- @@ -487,32 +522,3 @@ Usage:: In "brief" mode, all scheduling nodes in the tree are displayed. In "detail" mode, each node's configuration parameters are also displayed. - -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 default DDP package file name is ice.pkg. For a specific NIC, the -DDP package supposed to be loaded can have a filename: ice-xxxxxx.pkg, -where 'xxxxxx' is the 64-bit PCIe Device Serial Number of the NIC. For -example, if the NIC's device serial number is 00-CC-BB-FF-FF-AA-05-68, -the device-specific DDP package filename is ice-00ccbbffffaa0568.pkg -(in hex and all low case). During initialization, the driver searches -in the following paths in order: /lib/firmware/updates/intel/ice/ddp -and /lib/firmware/intel/ice/ddp. The corresponding device-specific DDP -package will be downloaded first if the file exists. If not, then the -driver tries to load the default package. The type of loaded package -is stored in ``ice_adapter->active_pkg_type``. - -A symbolic link to the DDP package file is also ok. The same package -file is used by both the kernel driver and the DPDK PMD. - - .. Note:: - - Windows support: The DDP package is not supported on Windows so, - loading of the package is disabled on Windows. diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 304f959b7e..31beb935ce 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -1873,21 +1873,57 @@ ice_load_pkg_type(struct ice_hw *hw) return package_type; } +static int ice_read_customized_path(char *pkg_file, uint16_t buff_len) +{ + FILE *fp = fopen(ICE_PKG_FILE_CUSTOMIZED_PATH, "r"); + int ret = 0; + + if (fp == NULL) { + PMD_INIT_LOG(INFO, "Failed to read CUSTOMIZED_PATH"); + return -EIO; + } + + if (fgets(pkg_file, buff_len, fp) == NULL) { + ret = -EIO; + goto exit; + } + + if (pkg_file[strlen(pkg_file) - 2] == '/') { + pkg_file[strlen(pkg_file) - 1] = '\0'; + } else { + pkg_file[strlen(pkg_file) - 1] = '/'; + pkg_file[strlen(pkg_file)] = '\0'; + } + +exit: + fclose(fp); + return ret; +} + int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn) { struct ice_hw *hw = &adapter->hw; char pkg_file[ICE_MAX_PKG_FILENAME_SIZE]; + char customized_path[ICE_MAX_PKG_FILENAME_SIZE]; char opt_ddp_filename[ICE_MAX_PKG_FILENAME_SIZE]; void *buf; size_t bufsz; int err; + ice_read_customized_path(customized_path, ICE_MAX_PKG_FILENAME_SIZE); + if (!use_dsn) goto no_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); + + strlcpy(pkg_file, customized_path, ICE_MAX_PKG_FILENAME_SIZE); + strlcat(pkg_file, opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE); + 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 +1937,11 @@ int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn) goto load_fw; no_dsn: + strlcpy(pkg_file, customized_path, ICE_MAX_PKG_FILENAME_SIZE); + strlcat(pkg_file, "ice.pkg", ICE_MAX_PKG_FILENAME_SIZE); + 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; 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