From patchwork Thu Aug 29 03:35:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 143423 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6035C45890; Thu, 29 Aug 2024 05:20:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC47C402BE; Thu, 29 Aug 2024 05:20:41 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by mails.dpdk.org (Postfix) with ESMTP id 1584140295 for ; Thu, 29 Aug 2024 05:20:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724901641; x=1756437641; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nfPP5engd/PLwdDkqBhPrwm0HU2qo1BMFMkyLfQbwjA=; b=JXhmq9HlBmduGv7jPMj5jtaD21r+nU0gF35vRdQ4i7nPaKiAiBN+HjpJ SKDm/3stiHC+INgdoephfgx9YduYxdyzl/koqlRvgsTeoi6QEDCzmSar4 ziU5iOklaOlv87HF0SmeoxRIY6+OfDCFjbAT0UezGxlNO02w6RViVmPGA 6X+JoX1YZb0Nggdq9zJEuE6KB+AK9FuLpuO6Wq0Hir4f2HwhrD9S1g140 t83QCEM9ugKAz1LOnqa4NdfDkp1p5FrwhB4T97rMVA0Yz9X0ja6Rp6kqU XtRhhvrDPEEi2NgZQeyqFxMlL6sZE3dFrtir1L2tqRVx5SqsbVmH4WhnP g==; X-CSE-ConnectionGUID: DPIJ6iAZRSa5rsFHs7k+BQ== X-CSE-MsgGUID: FZIkRmVSRoKZEDMEKv5/dA== X-IronPort-AV: E=McAfee;i="6700,10204,11178"; a="27344744" X-IronPort-AV: E=Sophos;i="6.10,184,1719903600"; d="scan'208";a="27344744" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2024 20:20:39 -0700 X-CSE-ConnectionGUID: II0cYTbwSJyxPmM9RysmAw== X-CSE-MsgGUID: J0DglOzDRnGBVGn0YK4NHQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,184,1719903600"; d="scan'208";a="94248455" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2024 20:20:37 -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:35:01 +0800 Message-Id: <20240829033501.1580854-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 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 | 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:]" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" ICE_DEFAULT_MAC_DISABLE "=<0|1>" + ICE_DDP_FILENAME "=" 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