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 3453745A68; Mon, 4 Nov 2024 10:54:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20313402AF; Mon, 4 Nov 2024 10:54:01 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mails.dpdk.org (Postfix) with ESMTP id 8C0244021F for ; Mon, 4 Nov 2024 10:53:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730714040; x=1762250040; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZFxK+nH5vt10mQAxlcvKMEuduLKqA8x63m3cAOI5kqk=; b=FMdFm/J6rCGQrl4frgzH8pZTVtgJlPSsIsGpCdsNgFoioEf8vC00nr+f SP7bPM8SWypQIWepuDMICq4PEU5TrCeMo22hFJhJrherenUz6BtHkvieI 9fLRMjhdw/gDTqPr0jOP1JJoykrY+FFuQWIKe4fsAjyUuiikNs3k2njgN aNKgh3EwVLkfxkQPZzAha8eBpWx5BHx4Co6xKCaGwTXTx775KvnL0g6SM O2fnvKvlVsIfwEP/x4KAsO9g6V1/4x1QKX5ElCt2Kih5Ffp+NSLhDOx1t jxJVbSLQ027nsNB5xmLgMoKYQjO7NTMjo83dvvZlFwntejglTob20fRdr w==; X-CSE-ConnectionGUID: YDxzTiYvTN2CiecW7PZwlw== X-CSE-MsgGUID: BkAmCS5ISeilZD70CKf3PQ== X-IronPort-AV: E=McAfee;i="6700,10204,11245"; a="40985339" X-IronPort-AV: E=Sophos;i="6.11,256,1725346800"; d="scan'208";a="40985339" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2024 01:53:59 -0800 X-CSE-ConnectionGUID: 02xcvGgxRc2MVCm7aZEdHw== X-CSE-MsgGUID: rjkohbyYRcmG0257SuPBVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,256,1725346800"; d="scan'208";a="83699870" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2024 01:53:57 -0800 From: Zhichao Zeng To: dev@dpdk.org Cc: Zhichao Zeng , Bruce Richardson , Anatoly Burakov Subject: [PATCH v2] net/ice: fix wrong DDP search path Date: Mon, 4 Nov 2024 18:09:34 +0800 Message-Id: <20241104100934.1116946-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241101084443.850674-1-zhichaox.zeng@intel.com> References: <20241101084443.850674-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 In the previous implementation, when the user did not enter any value in "/sys/module/firmware_class/parameters/path", it would incorrectly search for DDP packages under "/". This commit fixes this issue. Fixes: 9207f93640a7 ("net/ice: support custom search path for DDP package") Signed-off-by: Zhichao Zeng v2: change return code --- drivers/net/ice/ice_ethdev.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index d5e94a6685..cf06ac58ce 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -1917,18 +1917,14 @@ static int ice_read_customized_path(char *pkg_file, uint16_t buff_len) } n = read(fp, pkg_file, buff_len - 1); - if (n == 0) { - close(fp); - return -EIO; + if (n > 0) { + if (pkg_file[n - 1] == '\n') + n--; + pkg_file[n] = '\0'; } - if (pkg_file[n - 1] == '\n') - n--; - - pkg_file[n] = '\0'; - close(fp); - return 0; + return n; } int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn) @@ -1956,7 +1952,7 @@ int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn) snprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE, "ice-%016" PRIx64 ".pkg", dsn); - if (ice_read_customized_path(customized_path, ICE_MAX_PKG_FILENAME_SIZE) == 0) { + if (ice_read_customized_path(customized_path, ICE_MAX_PKG_FILENAME_SIZE) > 0) { if (use_dsn) { snprintf(pkg_file, RTE_DIM(pkg_file), "%s/%s", customized_path, opt_ddp_filename); -- 2.34.1