From: Zhichao Zeng <zhichaox.zeng@intel.com>
To: dev@dpdk.org
Cc: Zhichao Zeng <zhichaox.zeng@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [PATCH v2] net/ice: fix wrong DDP search path
Date: Mon, 4 Nov 2024 18:09:34 +0800 [thread overview]
Message-ID: <20241104100934.1116946-1-zhichaox.zeng@intel.com> (raw)
In-Reply-To: <20241101084443.850674-1-zhichaox.zeng@intel.com>
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 <zhichaox.zeng@intel.com>
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
next prev parent reply other threads:[~2024-11-04 9:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 8:44 [PATCH] " Zhichao Zeng
2024-11-01 9:36 ` Bruce Richardson
2024-11-04 9:57 ` Zeng, ZhichaoX
2024-11-04 10:09 ` Zhichao Zeng [this message]
2024-11-04 14:32 ` [PATCH v2] " Bruce Richardson
2024-11-05 2:41 ` Li, HongboX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241104100934.1116946-1-zhichaox.zeng@intel.com \
--to=zhichaox.zeng@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).