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 3FDB845890; Thu, 29 Aug 2024 05:27:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7E4A427B0; Thu, 29 Aug 2024 05:27:38 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mails.dpdk.org (Postfix) with ESMTP id 5B0D140295 for ; Thu, 29 Aug 2024 05:27:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724902056; x=1756438056; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2lOpuIKN84vH1asbytf7TV8gLVju1s9FH9FQJlU4KW4=; b=CGo+miYCHQdEXppnOLZS3xNnOyRYtnUMdET94SQkL+jFnMqTybSuMMH6 Tf5HD4tshj0PzI4w1kZcDU+w9ar6n4wd1SrcRx3c7Qu5gA4udIbSLH2sg hirXZVwiCqPpauczOnutq/7JirJD+WZZegtWKId3OpenGwTHtZAYlRMxA pV8J11qc41qeefR6SpJsJjijLzztjw+DYWRdmPSd+RwkvRpOvEXDuwREo 9Bjgl68KX+QbelPjQefZHHCoqAnAh4ONmkuOa/N5qRLGTI513AeQJNCfx FPRggI1tjM+tsHsTzZM/xvXTrp2jAn+JICu6XD7Qh0sVCkFWq6KJee8Aq w==; X-CSE-ConnectionGUID: kFI5p8PDRZOlADeVplJ41A== X-CSE-MsgGUID: /K6IA0+oThqV4bIsul0RXQ== X-IronPort-AV: E=McAfee;i="6700,10204,11178"; a="23615130" X-IronPort-AV: E=Sophos;i="6.10,184,1719903600"; d="scan'208";a="23615130" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2024 20:27:35 -0700 X-CSE-ConnectionGUID: 3VEA+t/xQIePc8fmf8hT7g== X-CSE-MsgGUID: 8PFEUt5YRQGH44VDOKrtew== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,184,1719903600"; d="scan'208";a="63510933" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2024 20:27:34 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: bruce.richardson@intel.com, Zhichao Zeng Subject: [PATCH v2] net/ice: support customized search path for DDP package Date: Thu, 29 Aug 2024 11:41:58 +0800 Message-Id: <20240829034158.1584970-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828035335.1069153-1-zhichaox.zeng@intel.com> References: <20240828035335.1069153-1-zhichaox.zeng@intel.com> MIME-Version: 1.0 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. Signed-off-by: Zhichao Zeng --- v2: separate the patch and rewrite the log --- doc/guides/nics/ice.rst | 5 +++++ drivers/net/ice/ice_ethdev.c | 26 ++++++++++++++++++++++++++ drivers/net/ice/ice_ethdev.h | 1 + 3 files changed, 32 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..5dfb3d9c21 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; 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