From patchwork Tue Nov 14 08:24:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134192 X-Patchwork-Delegate: thomas@monjalon.net 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 B501843325; Tue, 14 Nov 2023 09:26:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9430040693; Tue, 14 Nov 2023 09:25:47 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 73CF3402CF for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzlr34qLzPpDq; Tue, 14 Nov 2023 16:21:28 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:40 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 01/43] devtools: forbid use of strerror Date: Tue, 14 Nov 2023 16:24:57 +0800 Message-ID: <20231114082539.1858594-2-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. rte_strerror() has been provided in DPDK to replace it. Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 066449d147..7fbd0df3b3 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -159,6 +159,14 @@ check_forbidden_additions() { # -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # refrain from using strerror() for drivers and libs + awk -v FOLDERS="lib drivers" \ + -v EXPRESSIONS="\\\sstrerror\\\(" \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using strerror, prefer rte_strerror' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # refrain from using RTE_LOG_REGISTER for drivers and libs awk -v FOLDERS='lib drivers' \ -v EXPRESSIONS='\\' \ From patchwork Tue Nov 14 08:24:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134199 X-Patchwork-Delegate: thomas@monjalon.net 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 5D83343325; Tue, 14 Nov 2023 09:26:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1331440A8A; Tue, 14 Nov 2023 09:25:56 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 8D36C402DF for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4STzlP6CgvzMmSM; Tue, 14 Nov 2023 16:21:05 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:40 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 02/43] eal: use rte strerror Date: Tue, 14 Nov 2023 16:24:58 +0800 Message-ID: <20231114082539.1858594-3-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/eal/common/eal_common_fbarray.c | 2 +- lib/eal/common/eal_common_options.c | 7 ++-- lib/eal/common/eal_common_proc.c | 12 +++---- lib/eal/common/eal_common_trace_utils.c | 6 ++-- lib/eal/freebsd/eal.c | 4 +-- lib/eal/freebsd/eal_interrupts.c | 8 ++--- lib/eal/freebsd/eal_memory.c | 2 +- lib/eal/freebsd/eal_timer.c | 6 ++-- lib/eal/linux/eal.c | 10 +++--- lib/eal/linux/eal_dev.c | 2 +- lib/eal/linux/eal_hugepage_info.c | 5 +-- lib/eal/linux/eal_interrupts.c | 18 +++++----- lib/eal/linux/eal_memalloc.c | 47 +++++++++++++------------ lib/eal/linux/eal_memory.c | 43 +++++++++++----------- lib/eal/linux/eal_timer.c | 2 +- lib/eal/linux/eal_vfio.c | 40 ++++++++++----------- lib/eal/unix/eal_filesystem.c | 5 +-- lib/eal/unix/eal_unix_memory.c | 6 ++-- lib/eal/unix/rte_thread.c | 6 ++-- 19 files changed, 118 insertions(+), 113 deletions(-) diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c index 2055bfa57d..a2936bbd91 100644 --- a/lib/eal/common/eal_common_fbarray.c +++ b/lib/eal/common/eal_common_fbarray.c @@ -1027,7 +1027,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr) eal_get_fbarray_path(path, sizeof(path), arr->name); if (unlink(path)) { RTE_LOG(DEBUG, EAL, "Cannot unlink fbarray: %s\n", - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; /* * we're still holding an exclusive lock, so drop it to diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index a6d21f1cba..8a09fe2719 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -44,6 +44,7 @@ #ifndef RTE_EXEC_ENV_WINDOWS #include "eal_trace.h" #endif +#include #define BITS_PER_HEX 4 #define LCORE_OPT_LST 1 @@ -391,7 +392,7 @@ eal_plugindir_init(const char *path) d = opendir(path); if (d == NULL) { RTE_LOG(ERR, EAL, "failed to open directory %s: %s\n", - path, strerror(errno)); + path, rte_strerror(errno)); return -1; } @@ -443,7 +444,7 @@ verify_perms(const char *dirpath) /* call stat to check for permissions and ensure not world writable */ if (stat(dirpath, &st) != 0) { RTE_LOG(ERR, EAL, "Error with stat on %s, %s\n", - dirpath, strerror(errno)); + dirpath, rte_strerror(errno)); return -1; } if (st.st_mode & S_IWOTH) { @@ -471,7 +472,7 @@ eal_dlopen(const char *pathname) } if (realp == NULL) { RTE_LOG(ERR, EAL, "Error with realpath for %s, %s\n", - pathname, strerror(errno)); + pathname, rte_strerror(errno)); goto out; } if (strnlen(realp, PATH_MAX) == PATH_MAX) { diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c index 728815c4a9..2e39180d40 100644 --- a/lib/eal/common/eal_common_proc.c +++ b/lib/eal/common/eal_common_proc.c @@ -291,7 +291,7 @@ read_msg(int fd, struct mp_msg_internal *m, struct sockaddr_un *s) if (errno == EINTR) goto retry; - RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", strerror(errno)); + RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", rte_strerror(errno)); return -1; } @@ -583,7 +583,7 @@ open_socket_fd(void) if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) { RTE_LOG(ERR, EAL, "failed to bind %s: %s\n", - un.sun_path, strerror(errno)); + un.sun_path, rte_strerror(errno)); close(mp_fd); return -1; } @@ -631,13 +631,13 @@ rte_mp_channel_init(void) dir_fd = open(mp_dir_path, O_RDONLY); if (dir_fd < 0) { RTE_LOG(ERR, EAL, "failed to open %s: %s\n", - mp_dir_path, strerror(errno)); + mp_dir_path, rte_strerror(errno)); return -1; } if (flock(dir_fd, LOCK_EX)) { RTE_LOG(ERR, EAL, "failed to lock %s: %s\n", - mp_dir_path, strerror(errno)); + mp_dir_path, rte_strerror(errno)); close(dir_fd); return -1; } @@ -650,7 +650,7 @@ rte_mp_channel_init(void) if (rte_thread_create_internal_control(&mp_handle_tid, "mp-msg", mp_handle, NULL) < 0) { RTE_LOG(ERR, EAL, "failed to create mp thread: %s\n", - strerror(errno)); + rte_strerror(errno)); close(dir_fd); close(rte_atomic_exchange_explicit(&mp_fd, -1, rte_memory_order_relaxed)); return -1; @@ -733,7 +733,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type) return 0; } RTE_LOG(ERR, EAL, "failed to send to (%s) due to %s\n", - dst_path, strerror(errno)); + dst_path, rte_strerror(errno)); return -1; } diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c index 8561a0e198..b74adf6589 100644 --- a/lib/eal/common/eal_common_trace_utils.c +++ b/lib/eal/common/eal_common_trace_utils.c @@ -244,7 +244,7 @@ eal_trace_dir_args_save(char const *val) int rc; if (asprintf(&dir_path, "%s/", val) == -1) { - trace_err("failed to copy directory: %s", strerror(errno)); + trace_err("failed to copy directory: %s", rte_strerror(errno)); return -ENOMEM; } @@ -328,7 +328,7 @@ trace_mkdir(void) /* Create the path if it t exist, no "mkdir -p" available here */ rc = mkdir(trace->dir, 0700); if (rc < 0 && errno != EEXIST) { - trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno)); + trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno)); rte_errno = errno; return -rte_errno; } @@ -343,7 +343,7 @@ trace_mkdir(void) rc = mkdir(trace->dir, 0700); if (rc < 0) { - trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno)); + trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno)); rte_errno = errno; return -rte_errno; } diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 568e06e9ed..a82f3ab8d0 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -203,7 +203,7 @@ rte_eal_config_attach(void) close(mem_cfg_fd); mem_cfg_fd = -1; RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -250,7 +250,7 @@ rte_eal_config_reattach(void) return -1; } RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c index 2b31dfb099..0672e88e4e 100644 --- a/lib/eal/freebsd/eal_interrupts.c +++ b/lib/eal/freebsd/eal_interrupts.c @@ -186,7 +186,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, else RTE_LOG(ERR, EAL, "Error adding fd %d kevent, %s\n", rte_intr_fd_get(src->intr_handle), - strerror(errno)); + rte_strerror(errno)); ret = -errno; goto fail; } @@ -323,7 +323,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) { RTE_LOG(ERR, EAL, "Error removing fd %d kevent, %s\n", rte_intr_fd_get(src->intr_handle), - strerror(errno)); + rte_strerror(errno)); /* removing non-existent even is an expected condition * in some circumstances (e.g. oneshot events). */ @@ -516,7 +516,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds) RTE_LOG(ERR, EAL, "Error reading from file " "descriptor %d: %s\n", event_fd, - strerror(errno)); + rte_strerror(errno)); } else if (bytes_read == 0) RTE_LOG(ERR, EAL, "Read nothing from file " "descriptor %d\n", event_fd); @@ -567,7 +567,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds) if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) { RTE_LOG(ERR, EAL, "Error removing fd %d kevent, %s\n", rte_intr_fd_get(src->intr_handle), - strerror(errno)); + rte_strerror(errno)); /* removing non-existent even is an expected * condition in some circumstances * (e.g. oneshot events). diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c index 5c6165c580..35e11970c6 100644 --- a/lib/eal/freebsd/eal_memory.c +++ b/lib/eal/freebsd/eal_memory.c @@ -85,7 +85,7 @@ rte_eal_hugepage_init(void) MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (addr == MAP_FAILED) { RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__, - strerror(errno)); + rte_strerror(errno)); return -1; } diff --git a/lib/eal/freebsd/eal_timer.c b/lib/eal/freebsd/eal_timer.c index beff755a47..7125e4e0e8 100644 --- a/lib/eal/freebsd/eal_timer.c +++ b/lib/eal/freebsd/eal_timer.c @@ -36,20 +36,20 @@ get_tsc_freq(void) tmp = 0; if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0)) - RTE_LOG(WARNING, EAL, "%s\n", strerror(errno)); + RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno)); else if (tmp != 1) RTE_LOG(WARNING, EAL, "TSC is not safe to use in SMP mode\n"); tmp = 0; if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0)) - RTE_LOG(WARNING, EAL, "%s\n", strerror(errno)); + RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno)); else if (tmp != 1) RTE_LOG(WARNING, EAL, "TSC is not invariant\n"); sz = sizeof(tsc_hz); if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) { - RTE_LOG(WARNING, EAL, "%s\n", strerror(errno)); + RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno)); return 0; } diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 57da058cec..0da0a000ac 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -160,7 +160,7 @@ eal_clean_runtime_dir(void) closedir(dir); RTE_LOG(ERR, EAL, "Error while clearing runtime dir: %s\n", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -288,7 +288,7 @@ rte_eal_config_attach(void) close(mem_cfg_fd); mem_cfg_fd = -1; RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -335,7 +335,7 @@ rte_eal_config_reattach(void) return -1; } RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1421,7 +1421,7 @@ rte_eal_check_module(const char *module_name) /* Check if there is sysfs mounted */ if (stat("/sys/module", &st) != 0) { RTE_LOG(DEBUG, EAL, "sysfs is not mounted! error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1434,7 +1434,7 @@ rte_eal_check_module(const char *module_name) if (stat(sysfs_mod_name, &st) != 0) { RTE_LOG(DEBUG, EAL, "Module %s not found! error %i (%s)\n", - sysfs_mod_name, errno, strerror(errno)); + sysfs_mod_name, errno, rte_strerror(errno)); return 0; } diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index ac76f6174d..ede68f32cf 100644 --- a/lib/eal/linux/eal_dev.c +++ b/lib/eal/linux/eal_dev.c @@ -73,7 +73,7 @@ static void sigbus_handler(int signum, siginfo_t *info, if (ret == -1) { rte_exit(EXIT_FAILURE, "Failed to handle SIGBUS for hot-unplug, " - "(rte_errno: %s)!", strerror(rte_errno)); + "(rte_errno: %s)!", rte_strerror(rte_errno)); } else if (ret == 1) { if (sigbus_action_old.sa_flags == SA_SIGINFO && sigbus_action_old.sa_sigaction) { diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c index 581d9dfc91..6286ab3efb 100644 --- a/lib/eal/linux/eal_hugepage_info.c +++ b/lib/eal/linux/eal_hugepage_info.c @@ -23,6 +23,7 @@ #include #include #include "rte_string_fns.h" +#include #include "eal_private.h" #include "eal_internal_cfg.h" @@ -378,7 +379,7 @@ walk_hugedir(const char *hugedir, walk_hugedir_t *cb, void *user_data) closedir(dir); RTE_LOG(ERR, EAL, "Error while walking hugepage dir: %s\n", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -404,7 +405,7 @@ inspect_hugedir_cb(const struct walk_hugedir_data *whd) if (fstat(whd->file_fd, &st) < 0) RTE_LOG(DEBUG, EAL, "%s(): stat(\"%s\") failed: %s", - __func__, whd->file_name, strerror(errno)); + __func__, whd->file_name, rte_strerror(errno)); else (*total_size) += st.st_size; } diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c index d4919dff45..660e64dd41 100644 --- a/lib/eal/linux/eal_interrupts.c +++ b/lib/eal/linux/eal_interrupts.c @@ -460,7 +460,7 @@ uio_intr_disable(const struct rte_intr_handle *intr_handle) if (rte_intr_fd_get(intr_handle) < 0 || write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) { RTE_LOG(ERR, EAL, "Error disabling interrupts for fd %d (%s)\n", - rte_intr_fd_get(intr_handle), strerror(errno)); + rte_intr_fd_get(intr_handle), rte_strerror(errno)); return -1; } return 0; @@ -474,7 +474,7 @@ uio_intr_enable(const struct rte_intr_handle *intr_handle) if (rte_intr_fd_get(intr_handle) < 0 || write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) { RTE_LOG(ERR, EAL, "Error enabling interrupts for fd %d (%s)\n", - rte_intr_fd_get(intr_handle), strerror(errno)); + rte_intr_fd_get(intr_handle), rte_strerror(errno)); return -1; } return 0; @@ -975,7 +975,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) RTE_LOG(ERR, EAL, "Error reading from file " "descriptor %d: %s\n", events[n].data.fd, - strerror(errno)); + rte_strerror(errno)); /* * The device is unplugged or buggy, remove * it as an interrupt source and return to @@ -1130,7 +1130,7 @@ eal_intr_thread_main(__rte_unused void *arg) if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd, &pipe_event) < 0) { rte_panic("Error adding fd to %d epoll_ctl, %s\n", - intr_pipe.readfd, strerror(errno)); + intr_pipe.readfd, rte_strerror(errno)); } numfds++; @@ -1153,7 +1153,7 @@ eal_intr_thread_main(__rte_unused void *arg) rte_intr_fd_get(src->intr_handle), &ev) < 0) { rte_panic("Error adding fd %d epoll_ctl, %s\n", rte_intr_fd_get(src->intr_handle), - strerror(errno)); + rte_strerror(errno)); } else numfds++; @@ -1244,7 +1244,7 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle) continue; RTE_LOG(ERR, EAL, "Error reading from fd %d: %s\n", - fd, strerror(errno)); + fd, rte_strerror(errno)); } else if (nbytes == 0) RTE_LOG(ERR, EAL, "Read nothing from fd %d\n", fd); return; @@ -1343,7 +1343,7 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events, } /* epoll_wait fail */ RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n", - strerror(errno)); + rte_strerror(errno)); rc = -1; break; } else { @@ -1412,7 +1412,7 @@ rte_epoll_ctl(int epfd, int op, int fd, ev.events = event->epdata.event; if (epoll_ctl(epfd, op, fd, &ev) < 0) { RTE_LOG(ERR, EAL, "Error op %d fd %d epoll_ctl, %s\n", - op, fd, strerror(errno)); + op, fd, rte_strerror(errno)); if (op == EPOLL_CTL_ADD) /* rollback status when CTL_ADD fail */ rte_atomic_store_explicit(&event->status, RTE_EPOLL_INVALID, @@ -1525,7 +1525,7 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd) if (fd < 0) { RTE_LOG(ERR, EAL, "can't setup eventfd, error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -errno; } diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c index 9853ec78a2..53a7e5dd3b 100644 --- a/lib/eal/linux/eal_memalloc.c +++ b/lib/eal/linux/eal_memalloc.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "eal_filesystem.h" #include "eal_internal_cfg.h" @@ -161,7 +162,7 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id) oldmask->size + 1, 0, 0) < 0) { RTE_LOG(ERR, EAL, "Failed to get current mempolicy: %s. " - "Assuming MPOL_DEFAULT.\n", strerror(errno)); + "Assuming MPOL_DEFAULT.\n", rte_strerror(errno)); *oldpolicy = MPOL_DEFAULT; } RTE_LOG(DEBUG, EAL, @@ -180,7 +181,7 @@ restore_numa(int *oldpolicy, struct bitmask *oldmask) } else if (set_mempolicy(*oldpolicy, oldmask->maskp, oldmask->size + 1) < 0) { RTE_LOG(ERR, EAL, "Failed to restore mempolicy: %s\n", - strerror(errno)); + rte_strerror(errno)); numa_set_localalloc(); } numa_free_cpumask(oldmask); @@ -224,7 +225,7 @@ static int lock(int fd, int type) return 0; } else if (ret) { RTE_LOG(ERR, EAL, "%s(): error calling flock(): %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return -1; } /* lock was successful */ @@ -252,7 +253,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused, fd = memfd_create(segname, flags); if (fd < 0) { RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return -1; } fd_list[list_idx].memseg_list_fd = fd; @@ -266,7 +267,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused, fd = memfd_create(segname, flags); if (fd < 0) { RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return -1; } fd_list[list_idx].fds[seg_idx] = fd; @@ -317,7 +318,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi, ret = stat(path, &st); if (ret < 0 && errno != ENOENT) { RTE_LOG(DEBUG, EAL, "%s(): stat() for '%s' failed: %s\n", - __func__, path, strerror(errno)); + __func__, path, rte_strerror(errno)); return -1; } if (!internal_conf->hugepage_file.unlink_existing && ret == 0 && @@ -343,7 +344,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi, /* coverity[toctou] */ if (unlink(path) < 0) { RTE_LOG(DEBUG, EAL, "%s(): could not remove '%s': %s\n", - __func__, path, strerror(errno)); + __func__, path, rte_strerror(errno)); return -1; } } @@ -352,13 +353,13 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi, fd = open(path, O_CREAT | O_RDWR, 0600); if (fd < 0) { RTE_LOG(ERR, EAL, "%s(): open '%s' failed: %s\n", - __func__, path, strerror(errno)); + __func__, path, rte_strerror(errno)); return -1; } /* take out a read lock */ if (lock(fd, LOCK_SH) < 0) { RTE_LOG(ERR, EAL, "%s(): lock '%s' failed: %s\n", - __func__, path, strerror(errno)); + __func__, path, rte_strerror(errno)); close(fd); return -1; } @@ -380,7 +381,7 @@ resize_hugefile_in_memory(int fd, uint64_t fa_offset, if (ret < 0) { RTE_LOG(DEBUG, EAL, "%s(): fallocate() failed: %s\n", __func__, - strerror(errno)); + rte_strerror(errno)); return -1; } return 0; @@ -415,7 +416,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz, if (new_size > cur_size && ftruncate(fd, new_size) < 0) { RTE_LOG(DEBUG, EAL, "%s(): ftruncate() failed: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return -1; } } else { @@ -451,7 +452,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz, } else { RTE_LOG(DEBUG, EAL, "%s(): fallocate() failed: %s\n", __func__, - strerror(errno)); + rte_strerror(errno)); return -1; } } else { @@ -484,7 +485,7 @@ close_hugefile(int fd, char *path, int list_idx) rte_eal_process_type() == RTE_PROC_PRIMARY && unlink(path)) RTE_LOG(ERR, EAL, "%s(): unlinking '%s' failed: %s\n", - __func__, path, strerror(errno)); + __func__, path, rte_strerror(errno)); close(fd); fd_list[list_idx].memseg_list_fd = -1; @@ -585,14 +586,14 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, map_offset = 0; if (ftruncate(fd, alloc_sz) < 0) { RTE_LOG(DEBUG, EAL, "%s(): ftruncate() failed: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); goto resized; } if (internal_conf->hugepage_file.unlink_before_mapping && !internal_conf->in_memory) { if (unlink(path)) { RTE_LOG(DEBUG, EAL, "%s(): unlink() failed: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); goto resized; } } @@ -611,7 +612,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, if (va == MAP_FAILED) { RTE_LOG(DEBUG, EAL, "%s(): mmap() failed: %s\n", __func__, - strerror(errno)); + rte_strerror(errno)); /* mmap failed, but the previous region might have been * unmapped anyway. try to remap it */ @@ -662,7 +663,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, MPOL_F_NODE | MPOL_F_ADDR); if (ret < 0) { RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); goto mapped; } else if (cur_socket_id != socket_id) { RTE_LOG(DEBUG, EAL, @@ -874,13 +875,13 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg) dir_fd = open(wa->hi->hugedir, O_RDONLY); if (dir_fd < 0) { RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, rte_strerror(errno)); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, rte_strerror(errno)); close(dir_fd); return -1; } @@ -981,13 +982,13 @@ free_seg_walk(const struct rte_memseg_list *msl, void *arg) dir_fd = open(wa->hi->hugedir, O_RDONLY); if (dir_fd < 0) { RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, rte_strerror(errno)); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, rte_strerror(errno)); close(dir_fd); return -1; } @@ -1345,13 +1346,13 @@ sync_existing(struct rte_memseg_list *primary_msl, dir_fd = open(hi->hugedir, O_RDONLY); if (dir_fd < 0) { RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n", __func__, - hi->hugedir, strerror(errno)); + hi->hugedir, rte_strerror(errno)); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n", __func__, - hi->hugedir, strerror(errno)); + hi->hugedir, rte_strerror(errno)); close(dir_fd); return -1; } diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c index 9b6f08fba8..db92d1a602 100644 --- a/lib/eal/linux/eal_memory.c +++ b/lib/eal/linux/eal_memory.c @@ -105,7 +105,7 @@ rte_mem_virt2phy(const void *virtaddr) fd = open("/proc/self/pagemap", O_RDONLY); if (fd < 0) { RTE_LOG(INFO, EAL, "%s(): cannot open /proc/self/pagemap: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return RTE_BAD_IOVA; } @@ -113,7 +113,7 @@ rte_mem_virt2phy(const void *virtaddr) offset = sizeof(uint64_t) * virt_pfn; if (lseek(fd, offset, SEEK_SET) == (off_t) -1) { RTE_LOG(INFO, EAL, "%s(): seek error in /proc/self/pagemap: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); close(fd); return RTE_BAD_IOVA; } @@ -122,7 +122,7 @@ rte_mem_virt2phy(const void *virtaddr) close(fd); if (retval < 0) { RTE_LOG(INFO, EAL, "%s(): cannot read /proc/self/pagemap: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return RTE_BAD_IOVA; } else if (retval != PFN_MASK_SIZE) { RTE_LOG(INFO, EAL, "%s(): read %d bytes from /proc/self/pagemap " @@ -237,7 +237,7 @@ static int huge_wrap_sigsetjmp(void) /* Callback for numa library. */ void numa_error(char *where) { - RTE_LOG(ERR, EAL, "%s failed: %s\n", where, strerror(errno)); + RTE_LOG(ERR, EAL, "%s failed: %s\n", where, rte_strerror(errno)); } #endif @@ -278,7 +278,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, oldmask->size + 1, 0, 0) < 0) { RTE_LOG(ERR, EAL, "Failed to get current mempolicy: %s. " - "Assuming MPOL_DEFAULT.\n", strerror(errno)); + "Assuming MPOL_DEFAULT.\n", rte_strerror(errno)); oldpolicy = MPOL_DEFAULT; } for (i = 0; i < RTE_MAX_NUMA_NODES; i++) @@ -333,7 +333,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, fd = open(hf->filepath, O_CREAT | O_RDWR, 0600); if (fd < 0) { RTE_LOG(DEBUG, EAL, "%s(): open failed: %s\n", __func__, - strerror(errno)); + rte_strerror(errno)); goto out; } @@ -346,7 +346,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, MAP_SHARED | MAP_POPULATE, fd, 0); if (virtaddr == MAP_FAILED) { RTE_LOG(DEBUG, EAL, "%s(): mmap failed: %s\n", __func__, - strerror(errno)); + rte_strerror(errno)); close(fd); goto out; } @@ -379,7 +379,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, /* set shared lock on the file. */ if (flock(fd, LOCK_SH) < 0) { RTE_LOG(DEBUG, EAL, "%s(): Locking file failed:%s \n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); close(fd); goto out; } @@ -397,7 +397,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, } else if (set_mempolicy(oldpolicy, oldmask->maskp, oldmask->size + 1) < 0) { RTE_LOG(ERR, EAL, "Failed to restore mempolicy: %s\n", - strerror(errno)); + rte_strerror(errno)); numa_set_localalloc(); } } @@ -590,7 +590,7 @@ unlink_hugepage_files(struct hugepage_file *hugepg_tbl, if (hp->orig_va != NULL && unlink(hp->filepath)) { RTE_LOG(WARNING, EAL, "%s(): Removing %s failed: %s\n", - __func__, hp->filepath, strerror(errno)); + __func__, hp->filepath, rte_strerror(errno)); } } return 0; @@ -640,7 +640,8 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl, hp->orig_va = NULL; if (unlink(hp->filepath) == -1) { RTE_LOG(ERR, EAL, "%s(): Removing %s failed: %s\n", - __func__, hp->filepath, strerror(errno)); + __func__, hp->filepath, + rte_strerror(errno)); return -1; } } else { @@ -736,13 +737,13 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end) fd = open(hfile->filepath, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Could not open '%s': %s\n", - hfile->filepath, strerror(errno)); + hfile->filepath, rte_strerror(errno)); return -1; } /* set shared lock on the file. */ if (flock(fd, LOCK_SH) < 0) { RTE_LOG(DEBUG, EAL, "Could not lock '%s': %s\n", - hfile->filepath, strerror(errno)); + hfile->filepath, rte_strerror(errno)); close(fd); return -1; } @@ -756,7 +757,7 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end) MAP_SHARED | MAP_POPULATE | MAP_FIXED, fd, 0); if (addr == MAP_FAILED) { RTE_LOG(ERR, EAL, "Couldn't remap '%s': %s\n", - hfile->filepath, strerror(errno)); + hfile->filepath, rte_strerror(errno)); close(fd); return -1; } @@ -1178,13 +1179,13 @@ eal_legacy_hugepage_init(void) memfd = memfd_create("nohuge", 0); if (memfd < 0) { RTE_LOG(DEBUG, EAL, "Cannot create memfd: %s\n", - strerror(errno)); + rte_strerror(errno)); RTE_LOG(DEBUG, EAL, "Falling back to anonymous map\n"); } else { /* we got an fd - now resize it */ if (ftruncate(memfd, internal_conf->memory) < 0) { RTE_LOG(ERR, EAL, "Cannot resize memfd: %s\n", - strerror(errno)); + rte_strerror(errno)); RTE_LOG(ERR, EAL, "Falling back to anonymous map\n"); close(memfd); } else { @@ -1212,7 +1213,7 @@ eal_legacy_hugepage_init(void) flags | MAP_FIXED, fd, 0); if (addr == MAP_FAILED || addr != prealloc_addr) { RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__, - strerror(errno)); + rte_strerror(errno)); munmap(prealloc_addr, mem_sz); return -1; } @@ -1571,7 +1572,7 @@ eal_legacy_hugepage_attach(void) fd = open(hf->filepath, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Could not open %s: %s\n", - hf->filepath, strerror(errno)); + hf->filepath, rte_strerror(errno)); goto error; } @@ -1579,14 +1580,14 @@ eal_legacy_hugepage_attach(void) MAP_SHARED | MAP_FIXED, fd, 0); if (map_addr == MAP_FAILED) { RTE_LOG(ERR, EAL, "Could not map %s: %s\n", - hf->filepath, strerror(errno)); + hf->filepath, rte_strerror(errno)); goto fd_error; } /* set shared lock on the file. */ if (flock(fd, LOCK_SH) < 0) { RTE_LOG(DEBUG, EAL, "%s(): Locking file failed: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); goto mmap_error; } @@ -1931,7 +1932,7 @@ rte_eal_memseg_init(void) if (setrlimit(RLIMIT_NOFILE, &lim) < 0) { RTE_LOG(DEBUG, EAL, "Setting maximum number of open files failed: %s\n", - strerror(errno)); + rte_strerror(errno)); } else { RTE_LOG(DEBUG, EAL, "Setting maximum number of open files to %" PRIu64 "\n", diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c index 3a30284e3a..c80e87309c 100644 --- a/lib/eal/linux/eal_timer.c +++ b/lib/eal/linux/eal_timer.c @@ -146,7 +146,7 @@ rte_eal_hpet_init(int make_default) fd = open(DEV_HPET, O_RDONLY); if (fd < 0) { RTE_LOG(ERR, EAL, "ERROR: Cannot open "DEV_HPET": %s!\n", - strerror(errno)); + rte_strerror(errno)); internal_conf->no_hpet = 1; return -1; } diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c index ad3c1654b2..c18d4ee8ab 100644 --- a/lib/eal/linux/eal_vfio.c +++ b/lib/eal/linux/eal_vfio.c @@ -368,7 +368,7 @@ vfio_open_group_fd(int iommu_group_num) /* if file not found, it's not an error */ if (errno != ENOENT) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - filename, strerror(errno)); + filename, rte_strerror(errno)); return -1; } @@ -381,7 +381,7 @@ vfio_open_group_fd(int iommu_group_num) if (errno != ENOENT) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - filename, strerror(errno)); + filename, rte_strerror(errno)); return -1; } return -ENOENT; @@ -791,7 +791,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status); if (ret) { RTE_LOG(ERR, EAL, "%s cannot get VFIO group status, " - "error %i (%s)\n", dev_addr, errno, strerror(errno)); + "error %i (%s)\n", dev_addr, errno, rte_strerror(errno)); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); return -1; @@ -819,7 +819,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, if (ret) { RTE_LOG(ERR, EAL, "%s cannot add VFIO group to container, error " - "%i (%s)\n", dev_addr, errno, strerror(errno)); + "%i (%s)\n", dev_addr, errno, rte_strerror(errno)); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); return -1; @@ -860,7 +860,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, RTE_LOG(ERR, EAL, "%s DMA remapping failed, error " "%i (%s)\n", - dev_addr, errno, strerror(errno)); + dev_addr, errno, rte_strerror(errno)); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); rte_mcfg_mem_read_unlock(); @@ -978,7 +978,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, if (ret) { RTE_LOG(ERR, EAL, "%s cannot get device info, " "error %i (%s)\n", dev_addr, errno, - strerror(errno)); + rte_strerror(errno)); close(*vfio_dev_fd); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); @@ -1216,7 +1216,7 @@ vfio_set_iommu_type(int vfio_container_fd) /* not an error, there may be more supported IOMMU types */ RTE_LOG(DEBUG, EAL, "Set IOMMU type %d (%s) failed, error " "%i (%s)\n", t->type_id, t->name, errno, - strerror(errno)); + rte_strerror(errno)); } /* if we didn't find a suitable IOMMU type, fail */ return NULL; @@ -1234,7 +1234,7 @@ vfio_has_supported_extensions(int vfio_container_fd) t->type_id); if (ret < 0) { RTE_LOG(ERR, EAL, "Could not get IOMMU type, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); close(vfio_container_fd); return -1; } else if (ret == 1) { @@ -1274,7 +1274,7 @@ rte_vfio_get_container_fd(void) RTE_LOG(ERR, EAL, "Cannot open VFIO container %s, error " "%i (%s)\n", VFIO_CONTAINER_PATH, - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1284,7 +1284,7 @@ rte_vfio_get_container_fd(void) if (ret < 0) RTE_LOG(ERR, EAL, "Could not get VFIO API version, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); else RTE_LOG(ERR, EAL, "Unsupported VFIO API version!\n"); close(vfio_container_fd); @@ -1416,7 +1416,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, } else { RTE_LOG(ERR, EAL, "Cannot set up DMA remapping, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } } @@ -1430,7 +1430,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, &dma_unmap); if (ret) { RTE_LOG(ERR, EAL, "Cannot clear DMA remapping, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } else if (dma_unmap.size != len) { RTE_LOG(ERR, EAL, "Unexpected size %"PRIu64 @@ -1479,7 +1479,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, if (ret) { RTE_LOG(ERR, EAL, "Cannot register vaddr for IOMMU, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } @@ -1494,7 +1494,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map); if (ret) { RTE_LOG(ERR, EAL, "Cannot map vaddr for IOMMU, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } @@ -1510,7 +1510,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, &dma_unmap); if (ret) { RTE_LOG(ERR, EAL, "Cannot unmap vaddr for IOMMU, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } @@ -1519,7 +1519,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, if (ret) { RTE_LOG(ERR, EAL, "Cannot unregister vaddr for IOMMU, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } } @@ -1704,7 +1704,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd) ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info); if (ret) { RTE_LOG(ERR, EAL, "Cannot get IOMMU info, error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1745,7 +1745,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd) #endif /* VFIO_IOMMU_SPAPR_INFO_DDW */ if (ret) { RTE_LOG(ERR, EAL, "Cannot create new DMA window, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); RTE_LOG(ERR, EAL, "Consider using a larger hugepage size if supported by the system\n"); return -1; @@ -2006,7 +2006,7 @@ rte_vfio_noiommu_is_enabled(void) if (fd < 0) { if (errno != ENOENT) { RTE_LOG(ERR, EAL, "Cannot open VFIO noiommu file " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } /* @@ -2020,7 +2020,7 @@ rte_vfio_noiommu_is_enabled(void) close(fd); if (cnt != 1) { RTE_LOG(ERR, EAL, "Unable to read from VFIO noiommu file " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } diff --git a/lib/eal/unix/eal_filesystem.c b/lib/eal/unix/eal_filesystem.c index afbab9368a..51b4d513f2 100644 --- a/lib/eal/unix/eal_filesystem.c +++ b/lib/eal/unix/eal_filesystem.c @@ -13,6 +13,7 @@ #include #include +#include #include "eal_private.h" #include "eal_filesystem.h" @@ -59,14 +60,14 @@ int eal_create_runtime_dir(void) ret = mkdir(tmp, 0700); if (ret < 0 && errno != EEXIST) { RTE_LOG(ERR, EAL, "Error creating '%s': %s\n", - tmp, strerror(errno)); + tmp, rte_strerror(errno)); return -1; } ret = mkdir(run_dir, 0700); if (ret < 0 && errno != EEXIST) { RTE_LOG(ERR, EAL, "Error creating '%s': %s\n", - run_dir, strerror(errno)); + run_dir, rte_strerror(errno)); return -1; } diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c index 68ae93bd6e..d9652496df 100644 --- a/lib/eal/unix/eal_unix_memory.c +++ b/lib/eal/unix/eal_unix_memory.c @@ -32,7 +32,7 @@ mem_map(void *requested_addr, size_t size, int prot, int flags, RTE_LOG(DEBUG, EAL, "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s\n", requested_addr, size, prot, flags, fd, offset, - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; return NULL; } @@ -45,7 +45,7 @@ mem_unmap(void *virt, size_t size) int ret = munmap(virt, size); if (ret < 0) { RTE_LOG(DEBUG, EAL, "Cannot munmap(%p, 0x%zx): %s\n", - virt, size, strerror(errno)); + virt, size, rte_strerror(errno)); rte_errno = errno; } return ret; @@ -84,7 +84,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump) int ret = madvise(virt, size, flags); if (ret) { RTE_LOG(DEBUG, EAL, "madvise(%p, %#zx, %d) failed: %s\n", - virt, size, flags, strerror(rte_errno)); + virt, size, flags, rte_strerror(rte_errno)); rte_errno = errno; } return ret; diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c index 36a21ab2f9..486fd72277 100644 --- a/lib/eal/unix/rte_thread.c +++ b/lib/eal/unix/rte_thread.c @@ -302,7 +302,7 @@ rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) err = pthread_key_create(&((*key)->thread_index), destructor); if (err) { RTE_LOG(DEBUG, EAL, "pthread_key_create failed: %s\n", - strerror(err)); + rte_strerror(err)); free(*key); rte_errno = ENOEXEC; return -1; @@ -323,7 +323,7 @@ rte_thread_key_delete(rte_thread_key key) err = pthread_key_delete(key->thread_index); if (err) { RTE_LOG(DEBUG, EAL, "pthread_key_delete failed: %s\n", - strerror(err)); + rte_strerror(err)); free(key); rte_errno = ENOEXEC; return -1; @@ -345,7 +345,7 @@ rte_thread_value_set(rte_thread_key key, const void *value) err = pthread_setspecific(key->thread_index, value); if (err) { RTE_LOG(DEBUG, EAL, "pthread_setspecific failed: %s\n", - strerror(err)); + rte_strerror(err)); rte_errno = ENOEXEC; return -1; } From patchwork Tue Nov 14 08:24:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134190 X-Patchwork-Delegate: thomas@monjalon.net 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 E1BF043325; Tue, 14 Nov 2023 09:25:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33BE9402E8; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 634FC402BD for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4STzlP6v1lzMmmn; Tue, 14 Nov 2023 16:21:05 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:40 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 03/43] eventdev: use rte strerror Date: Tue, 14 Nov 2023 16:24:59 +0800 Message-ID: <20231114082539.1858594-4-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index 6db03adf04..d45c2c899e 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -1106,7 +1106,7 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data) */ if (err) RTE_EDEV_LOG_ERR("Failed to enqueue interrupt" - " to ring: %s", strerror(-err)); + " to ring: %s", rte_strerror(-err)); else rte_eth_dev_rx_intr_disable(port_id, queue); } From patchwork Tue Nov 14 08:25:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134193 X-Patchwork-Delegate: thomas@monjalon.net 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 66E5F43325; Tue, 14 Nov 2023 09:26:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AFE644067E; Tue, 14 Nov 2023 09:25:49 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id A832A402EE for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmt4wnLz1P8Ls; Tue, 14 Nov 2023 16:22:22 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:40 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 04/43] latency: use rte strerror Date: Tue, 14 Nov 2023 16:25:00 +0800 Message-ID: <20231114082539.1858594-5-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/latencystats/rte_latencystats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c index 8985a377db..a395f9b3bc 100644 --- a/lib/latencystats/rte_latencystats.c +++ b/lib/latencystats/rte_latencystats.c @@ -265,7 +265,7 @@ rte_latencystats_init(uint64_t app_samp_intvl, if (ret != 0) { RTE_LOG(INFO, LATENCY_STATS, "Error during getting device (port %u) info: %s\n", - pid, strerror(-ret)); + pid, rte_strerror(-ret)); continue; } @@ -309,7 +309,7 @@ rte_latencystats_uninit(void) if (ret != 0) { RTE_LOG(INFO, LATENCY_STATS, "Error during getting device (port %u) info: %s\n", - pid, strerror(-ret)); + pid, rte_strerror(-ret)); continue; } From patchwork Tue Nov 14 08:25:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134189 X-Patchwork-Delegate: thomas@monjalon.net 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 8F09D43325; Tue, 14 Nov 2023 09:25:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 001C1402CF; Tue, 14 Nov 2023 09:25:43 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 56FB7402B0 for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrH4qkvzWhL1; Tue, 14 Nov 2023 16:25:19 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:40 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 05/43] node: use rte strerror Date: Tue, 14 Nov 2023 16:25:01 +0800 Message-ID: <20231114082539.1858594-6-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/node/kernel_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node/kernel_tx.c b/lib/node/kernel_tx.c index 27d1808c71..ab92f22cb9 100644 --- a/lib/node/kernel_tx.c +++ b/lib/node/kernel_tx.c @@ -36,7 +36,7 @@ kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t sin.sin_addr.s_addr = ip4->dst_addr; if (sendto(ctx->sock, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)) < 0) - node_err("kernel_tx", "Unable to send packets: %s\n", strerror(errno)); + node_err("kernel_tx", "Unable to send packets: %s\n", rte_strerror(errno)); } } From patchwork Tue Nov 14 08:25:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134191 X-Patchwork-Delegate: thomas@monjalon.net 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 3316843325; Tue, 14 Nov 2023 09:25:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 62BEA4067C; Tue, 14 Nov 2023 09:25:46 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 66894402CD for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4STzlQ3C8SzMmjK; Tue, 14 Nov 2023 16:21:06 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:41 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 06/43] pdump: use rte strerror Date: Tue, 14 Nov 2023 16:25:02 +0800 Message-ID: <20231114082539.1858594-7-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/pdump/rte_pdump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index 80b90c6f7d..7b7b87bbd1 100644 --- a/lib/pdump/rte_pdump.c +++ b/lib/pdump/rte_pdump.c @@ -340,7 +340,7 @@ set_pdump_rxtx_cbs(const struct pdump_request *p) if (ret != 0) { PDUMP_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-ret)); + port, rte_strerror(-ret)); return ret; } @@ -410,7 +410,7 @@ pdump_server(const struct rte_mp_msg *mp_msg, const void *peer) mp_resp.num_fds = 0; if (rte_mp_reply(&mp_resp, peer) < 0) { PDUMP_LOG(ERR, "failed to send to client:%s\n", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -1; } @@ -741,7 +741,7 @@ rte_pdump_stats(uint16_t port, struct rte_pdump_stats *stats) if (ret != 0) { PDUMP_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-ret)); + port, rte_strerror(-ret)); return ret; } From patchwork Tue Nov 14 08:25:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134195 X-Patchwork-Delegate: thomas@monjalon.net 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 AF24E43325; Tue, 14 Nov 2023 09:26:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D084E406FF; Tue, 14 Nov 2023 09:25:51 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id A67A8402E8 for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmv1L3Lz1P8J5; Tue, 14 Nov 2023 16:22:23 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:41 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 07/43] power: use rte strerror Date: Tue, 14 Nov 2023 16:25:03 +0800 Message-ID: <20231114082539.1858594-8-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/power/guest_channel.c | 7 ++++--- lib/power/power_kvm_vm.c | 3 ++- lib/power/power_pstate_cpufreq.c | 7 ++++--- lib/power/rte_power_pmd_mgmt.c | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c index 7b2ae0b650..1484b384df 100644 --- a/lib/power/guest_channel.c +++ b/lib/power/guest_channel.c @@ -14,6 +14,7 @@ #include #include +#include #include "guest_channel.h" @@ -75,7 +76,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) fd = open(fd_path, O_RDWR); if (fd < 0) { RTE_LOG(ERR, GUEST_CHANNEL, "Unable to connect to '%s' with error " - "%s\n", fd_path, strerror(errno)); + "%s\n", fd_path, rte_strerror(errno)); return -1; } @@ -104,7 +105,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) if (ret != 0) { RTE_LOG(ERR, GUEST_CHANNEL, "Error on channel '%s' communications test: %s\n", - fd_path, ret > 0 ? strerror(ret) : + fd_path, ret > 0 ? rte_strerror(ret) : "channel not connected"); goto error; } @@ -184,7 +185,7 @@ int power_guest_channel_read_msg(void *pkt, return -1; } else if (ret < 0) { RTE_LOG(ERR, GUEST_CHANNEL, "Error occurred during poll function: %s\n", - strerror(errno)); + rte_strerror(errno)); return -1; } diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c index 6a8109d449..bb9c9b95fe 100644 --- a/lib/power/power_kvm_vm.c +++ b/lib/power/power_kvm_vm.c @@ -5,6 +5,7 @@ #include #include +#include #include "rte_power_guest_channel.h" #include "guest_channel.h" @@ -82,7 +83,7 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction) if (ret == 0) return 1; RTE_LOG(DEBUG, POWER, "Error sending message: %s\n", - ret > 0 ? strerror(ret) : "channel not connected"); + ret > 0 ? rte_strerror(ret) : "channel not connected"); return -1; } diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c index 5ca5f60bcd..eeb0f3831b 100644 --- a/lib/power/power_pstate_cpufreq.c +++ b/lib/power/power_pstate_cpufreq.c @@ -13,6 +13,7 @@ #include #include +#include #include "rte_power_pmd_mgmt.h" #include "power_pstate_cpufreq.h" @@ -83,7 +84,7 @@ power_read_turbo_pct(uint64_t *outVal) if (fd < 0) { RTE_LOG(ERR, POWER, "Error opening '%s': %s\n", POWER_SYSFILE_TURBO_PCT, - strerror(errno)); + rte_strerror(errno)); return fd; } @@ -91,7 +92,7 @@ power_read_turbo_pct(uint64_t *outVal) if (ret < 0) { RTE_LOG(ERR, POWER, "Error reading '%s': %s\n", POWER_SYSFILE_TURBO_PCT, - strerror(errno)); + rte_strerror(errno)); goto out; } @@ -99,7 +100,7 @@ power_read_turbo_pct(uint64_t *outVal) *outVal = (uint64_t) strtol(val, &endptr, 10); if (errno != 0 || (*endptr != 0 && *endptr != '\n')) { RTE_LOG(ERR, POWER, "Error converting str to digits, read from %s: %s\n", - POWER_SYSFILE_TURBO_PCT, strerror(errno)); + POWER_SYSFILE_TURBO_PCT, rte_strerror(errno)); ret = -1; goto out; } diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c index 38f8384085..a61a5c8f98 100644 --- a/lib/power/rte_power_pmd_mgmt.c +++ b/lib/power/rte_power_pmd_mgmt.c @@ -574,7 +574,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id, ret = queue_list_add(lcore_cfg, &qdata); if (ret < 0) { RTE_LOG(DEBUG, POWER, "Failed to add queue to list: %s\n", - strerror(-ret)); + rte_strerror(-ret)); goto end; } /* new queue is always added last */ From patchwork Tue Nov 14 08:25:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134194 X-Patchwork-Delegate: thomas@monjalon.net 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 556F443325; Tue, 14 Nov 2023 09:26:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0444406B6; Tue, 14 Nov 2023 09:25:50 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 95483402E4 for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzls4110zPpC5; Tue, 14 Nov 2023 16:21:29 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:41 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 08/43] telemetry: replace strerror Date: Tue, 14 Nov 2023 16:25:04 +0800 Message-ID: <20231114082539.1858594-9-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/telemetry/telemetry.c | 28 ++++++++++++++++++++++------ lib/telemetry/telemetry_legacy.c | 5 ++++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 92982842a8..03be0d342a 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -411,6 +411,9 @@ client_handler(void *sock_id) static void * socket_listener(void *socket) { +#define ERR_BUFF_SZ 256 + char err_buf[ERR_BUFF_SZ] = {0}; + while (1) { pthread_t th; int rc; @@ -433,8 +436,9 @@ socket_listener(void *socket) rc = pthread_create(&th, NULL, s->fn, (void *)(uintptr_t)s_accepted); if (rc != 0) { + strerror_r(rc, err_buf, sizeof(err_buf)); TMTY_LOG(ERR, "Error with create client thread: %s\n", - strerror(rc)); + err_buf); close(s_accepted); if (s->num_clients != NULL) rte_atomic_fetch_sub_explicit(s->num_clients, 1, @@ -467,9 +471,13 @@ unlink_sockets(void) static int create_socket(char *path) { +#define ERR_BUFF_SZ 256 + char err_buf[ERR_BUFF_SZ] = {0}; + int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (sock < 0) { - TMTY_LOG(ERR, "Error with socket creation, %s\n", strerror(errno)); + strerror_r(errno, err_buf, sizeof(err_buf)); + TMTY_LOG(ERR, "Error with socket creation, %s\n", err_buf); return -1; } @@ -499,14 +507,16 @@ create_socket(char *path) TMTY_LOG(DEBUG, "Attempting unlink and retrying bind\n"); unlink(sun.sun_path); if (bind(sock, (void *) &sun, sizeof(sun)) < 0) { - TMTY_LOG(ERR, "Error binding socket: %s\n", strerror(errno)); + strerror_r(errno, err_buf, sizeof(err_buf)); + TMTY_LOG(ERR, "Error binding socket: %s\n", err_buf); close(sock); return -errno; /* if unlink failed, this will be -EADDRINUSE as above */ } } if (listen(sock, 1) < 0) { - TMTY_LOG(ERR, "Error calling listen for socket: %s\n", strerror(errno)); + strerror_r(errno, err_buf, sizeof(err_buf)); + TMTY_LOG(ERR, "Error calling listen for socket: %s\n", err_buf); unlink(sun.sun_path); close(sock); return -errno; @@ -531,6 +541,8 @@ set_thread_name(pthread_t id __rte_unused, const char *name __rte_unused) static int telemetry_legacy_init(void) { +#define ERR_BUFF_SZ 256 + char err_buf[ERR_BUFF_SZ] = {0}; pthread_t t_old; int rc; @@ -552,8 +564,9 @@ telemetry_legacy_init(void) } rc = pthread_create(&t_old, NULL, socket_listener, &v1_socket); if (rc != 0) { + strerror_r(rc, err_buf, sizeof(err_buf)); TMTY_LOG(ERR, "Error with create legacy socket thread: %s\n", - strerror(rc)); + err_buf); close(v1_socket.sock); v1_socket.sock = -1; unlink(v1_socket.path); @@ -570,7 +583,9 @@ telemetry_legacy_init(void) static int telemetry_v2_init(void) { +#define ERR_BUFF_SZ 256 char spath[sizeof(v2_socket.path)]; + char err_buf[ERR_BUFF_SZ] = {0}; pthread_t t_new; short suffix = 0; int rc; @@ -606,8 +621,9 @@ telemetry_v2_init(void) } rc = pthread_create(&t_new, NULL, socket_listener, &v2_socket); if (rc != 0) { + strerror_r(rc, err_buf, sizeof(err_buf)); TMTY_LOG(ERR, "Error with create socket thread: %s\n", - strerror(rc)); + err_buf); close(v2_socket.sock); v2_socket.sock = -1; unlink(v2_socket.path); diff --git a/lib/telemetry/telemetry_legacy.c b/lib/telemetry/telemetry_legacy.c index 4c1d1c353a..3253dd9c1f 100644 --- a/lib/telemetry/telemetry_legacy.c +++ b/lib/telemetry/telemetry_legacy.c @@ -81,6 +81,8 @@ register_client(const char *cmd __rte_unused, const char *params, char *buffer __rte_unused, int buf_len __rte_unused) { #ifndef RTE_EXEC_ENV_WINDOWS +#define ERR_BUFF_SZ 256 + char err_buf[ERR_BUFF_SZ] = {0}; pthread_t th; char data[BUF_SIZE]; int fd; @@ -117,8 +119,9 @@ register_client(const char *cmd __rte_unused, const char *params, rc = pthread_create(&th, NULL, &legacy_client_handler, (void *)(uintptr_t)fd); if (rc != 0) { + strerror_r(rc, err_buf, sizeof(err_buf)); fprintf(stderr, "Failed to create legacy client thread: %s\n", - strerror(rc)); + err_buf); close(fd); return -1; } From patchwork Tue Nov 14 08:25:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134197 X-Patchwork-Delegate: thomas@monjalon.net 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 0860B43325; Tue, 14 Nov 2023 09:26:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA1D640A79; Tue, 14 Nov 2023 09:25:53 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id C41E6402F0 for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzls56rzzPpKd; Tue, 14 Nov 2023 16:21:29 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:41 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 09/43] vhost: use rte strerror Date: Tue, 14 Nov 2023 16:25:05 +0800 Message-ID: <20231114082539.1858594-10-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/vhost/socket.c | 13 +++++++------ lib/vhost/vduse.c | 30 +++++++++++++++--------------- lib/vhost/vhost_user.c | 11 ++++++----- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index 5882e44176..0b030222d6 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -16,6 +16,7 @@ #include #include +#include #include "fd_man.h" #include "vduse.h" @@ -129,7 +130,7 @@ read_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int m if (ret <= 0) { if (ret) VHOST_LOG_CONFIG(ifname, ERR, "recvmsg failed on fd %d (%s)\n", - sockfd, strerror(errno)); + sockfd, rte_strerror(errno)); return ret; } @@ -200,7 +201,7 @@ send_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int f if (ret < 0) { VHOST_LOG_CONFIG(ifname, ERR, "sendmsg error on fd %d (%s)\n", - sockfd, strerror(errno)); + sockfd, rte_strerror(errno)); return ret; } @@ -358,7 +359,7 @@ create_unix_socket(struct vhost_user_socket *vsocket) if (!vsocket->is_server && fcntl(fd, F_SETFL, O_NONBLOCK)) { VHOST_LOG_CONFIG(vsocket->path, ERR, "vhost-user: can't set nonblocking mode for socket, fd: %d (%s)\n", - fd, strerror(errno)); + fd, rte_strerror(errno)); close(fd); return -1; } @@ -392,7 +393,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket) ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un)); if (ret < 0) { VHOST_LOG_CONFIG(path, ERR, "failed to bind: %s; remove it and try again\n", - strerror(errno)); + rte_strerror(errno)); goto err; } VHOST_LOG_CONFIG(path, INFO, "binding succeeded\n"); @@ -445,7 +446,7 @@ vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz) flags = fcntl(fd, F_GETFL, 0); if (flags < 0) { VHOST_LOG_CONFIG(path, ERR, "can't get flags for connfd %d (%s)\n", - fd, strerror(errno)); + fd, rte_strerror(errno)); return -2; } if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) { @@ -539,7 +540,7 @@ vhost_user_start_client(struct vhost_user_socket *vsocket) return 0; } - VHOST_LOG_CONFIG(path, WARNING, "failed to connect: %s\n", strerror(errno)); + VHOST_LOG_CONFIG(path, WARNING, "failed to connect: %s\n", rte_strerror(errno)); if (ret == -2 || !vsocket->reconnect) { close(fd); diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index 080b58f7de..12e4b9c891 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -135,7 +135,7 @@ vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused) ret = read(fd, &buf, sizeof(buf)); if (ret < 0) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to read control queue event: %s\n", - strerror(errno)); + rte_strerror(errno)); return; } @@ -157,7 +157,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index) ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_GET_INFO, &vq_info); if (ret) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to get VQ %u info: %s\n", - index, strerror(errno)); + index, rte_strerror(errno)); return; } @@ -183,7 +183,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index) vq->kickfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (vq->kickfd < 0) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to init kickfd for VQ %u: %s\n", - index, strerror(errno)); + index, rte_strerror(errno)); vq->kickfd = VIRTIO_INVALID_EVENTFD; return; } @@ -213,7 +213,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index) ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd); if (ret) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to setup kickfd for VQ %u: %s\n", - index, strerror(errno)); + index, rte_strerror(errno)); close(vq->kickfd); vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; return; @@ -224,7 +224,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index) if (ret) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to setup kickfd handler for VQ %u: %s\n", - index, strerror(errno)); + index, rte_strerror(errno)); vq_efd.fd = VDUSE_EVENTFD_DEASSIGN; ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd); close(vq->kickfd); @@ -254,7 +254,7 @@ vduse_vring_cleanup(struct virtio_net *dev, unsigned int index) ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd); if (ret) VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to cleanup kickfd for VQ %u: %s\n", - index, strerror(errno)); + index, rte_strerror(errno)); close(vq->kickfd); vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; @@ -291,7 +291,7 @@ vduse_device_start(struct virtio_net *dev) ret = ioctl(dev->vduse_dev_fd, VDUSE_DEV_GET_FEATURES, &dev->features); if (ret) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to get features: %s\n", - strerror(errno)); + rte_strerror(errno)); return; } @@ -358,7 +358,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused) ret = read(fd, &req, sizeof(req)); if (ret < 0) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to read request: %s\n", - strerror(errno)); + rte_strerror(errno)); return; } else if (ret < (int)sizeof(req)) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Incomplete to read request %d\n", ret); @@ -400,7 +400,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused) ret = write(dev->vduse_dev_fd, &resp, sizeof(resp)); if (ret != sizeof(resp)) { VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to write response %s\n", - strerror(errno)); + rte_strerror(errno)); return; } @@ -453,13 +453,13 @@ vduse_device_create(const char *path, bool compliant_ol_flags) control_fd = open(VDUSE_CTRL_PATH, O_RDWR); if (control_fd < 0) { VHOST_LOG_CONFIG(name, ERR, "Failed to open %s: %s\n", - VDUSE_CTRL_PATH, strerror(errno)); + VDUSE_CTRL_PATH, rte_strerror(errno)); return -1; } if (ioctl(control_fd, VDUSE_SET_API_VERSION, &ver)) { VHOST_LOG_CONFIG(name, ERR, "Failed to set API version: %" PRIu64 ": %s\n", - ver, strerror(errno)); + ver, rte_strerror(errno)); ret = -1; goto out_ctrl_close; } @@ -507,14 +507,14 @@ vduse_device_create(const char *path, bool compliant_ol_flags) ret = ioctl(control_fd, VDUSE_CREATE_DEV, dev_config); if (ret < 0) { VHOST_LOG_CONFIG(name, ERR, "Failed to create VDUSE device: %s\n", - strerror(errno)); + rte_strerror(errno)); goto out_free; } dev_fd = open(path, O_RDWR); if (dev_fd < 0) { VHOST_LOG_CONFIG(name, ERR, "Failed to open device %s: %s\n", - path, strerror(errno)); + path, rte_strerror(errno)); ret = -1; goto out_dev_close; } @@ -522,7 +522,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) ret = fcntl(dev_fd, F_SETFL, O_NONBLOCK); if (ret < 0) { VHOST_LOG_CONFIG(name, ERR, "Failed to set chardev as non-blocking: %s\n", - strerror(errno)); + rte_strerror(errno)); goto out_dev_close; } @@ -625,7 +625,7 @@ vduse_device_destroy(const char *path) ret = ioctl(dev->vduse_ctrl_fd, VDUSE_DESTROY_DEV, name); if (ret) VHOST_LOG_CONFIG(name, ERR, "Failed to destroy VDUSE device: %s\n", - strerror(errno)); + rte_strerror(errno)); close(dev->vduse_ctrl_fd); dev->vduse_ctrl_fd = -1; } diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index e36312181a..ebf5afe45d 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -772,7 +772,8 @@ mem_set_dump(void *ptr, size_t size, bool enable, uint64_t pagesz) if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) { rte_log(RTE_LOG_INFO, vhost_config_log_level, - "VHOST_CONFIG: could not set coredump preference (%s).\n", strerror(errno)); + "VHOST_CONFIG: could not set coredump preference (%s).\n", + rte_strerror(errno)); } #endif } @@ -1138,7 +1139,7 @@ vhost_user_postcopy_region_register(struct virtio_net *dev, (uint64_t)reg_struct.range.start + (uint64_t)reg_struct.range.len - 1, dev->postcopy_ufd, - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -1267,7 +1268,7 @@ vhost_user_mmap_region(struct virtio_net *dev, MAP_SHARED | populate, region->fd, 0); if (mmap_addr == MAP_FAILED) { - VHOST_LOG_CONFIG(dev->ifname, ERR, "mmap failed (%s).\n", strerror(errno)); + VHOST_LOG_CONFIG(dev->ifname, ERR, "mmap failed (%s).\n", rte_strerror(errno)); return -1; } @@ -2698,7 +2699,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev, if (dev->postcopy_ufd == -1) { VHOST_LOG_CONFIG(dev->ifname, ERR, "userfaultfd not available: %s\n", - strerror(errno)); + rte_strerror(errno)); return RTE_VHOST_MSG_RESULT_ERR; } api_struct.api = UFFD_API; @@ -2706,7 +2707,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev, if (ioctl(dev->postcopy_ufd, UFFDIO_API, &api_struct)) { VHOST_LOG_CONFIG(dev->ifname, ERR, "UFFDIO_API ioctl failure: %s\n", - strerror(errno)); + rte_strerror(errno)); close(dev->postcopy_ufd); dev->postcopy_ufd = -1; return RTE_VHOST_MSG_RESULT_ERR; From patchwork Tue Nov 14 08:25:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134196 X-Patchwork-Delegate: thomas@monjalon.net 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 6CC6243325; Tue, 14 Nov 2023 09:26:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBD7F40A6E; Tue, 14 Nov 2023 09:25:52 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id E3D46402B0 for ; Tue, 14 Nov 2023 09:25:42 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4STzrQ39XRzvQk2; Tue, 14 Nov 2023 16:25:26 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:41 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 10/43] bpf: use rte strerror Date: Tue, 14 Nov 2023 16:25:06 +0800 Message-ID: <20231114082539.1858594-11-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- lib/bpf/bpf_load_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bpf/bpf_load_elf.c b/lib/bpf/bpf_load_elf.c index 02a5d8ba0d..6fc7018ddf 100644 --- a/lib/bpf/bpf_load_elf.c +++ b/lib/bpf/bpf_load_elf.c @@ -310,7 +310,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, if (fd < 0) { rc = errno; RTE_BPF_LOG(ERR, "%s(%s) error code: %d(%s)\n", - __func__, fname, rc, strerror(rc)); + __func__, fname, rc, rte_strerror(rc)); rte_errno = EINVAL; return NULL; } From patchwork Tue Nov 14 08:25:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134200 X-Patchwork-Delegate: thomas@monjalon.net 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 6F18043325; Tue, 14 Nov 2023 09:26:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5177F406BC; Tue, 14 Nov 2023 09:25:57 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 1C7CD4027B for ; Tue, 14 Nov 2023 09:25:43 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrJ4V5HzWhKY; Tue, 14 Nov 2023 16:25:20 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:41 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 11/43] bus/cdx: use rte strerror Date: Tue, 14 Nov 2023 16:25:07 +0800 Message-ID: <20231114082539.1858594-12-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/bus/cdx/cdx.c | 2 +- drivers/bus/cdx/cdx_vfio.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c index 541aae76c3..a3161f8ee4 100644 --- a/drivers/bus/cdx/cdx.c +++ b/drivers/bus/cdx/cdx.c @@ -271,7 +271,7 @@ cdx_scan(void) dir = opendir(RTE_CDX_BUS_DEVICES_PATH); if (dir == NULL) { CDX_BUS_INFO("%s(): opendir failed: %s", __func__, - strerror(errno)); + rte_strerror(errno)); return 0; } diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c index 8a3ac0b995..6fb38abfac 100644 --- a/drivers/bus/cdx/cdx_vfio.c +++ b/drivers/bus/cdx/cdx_vfio.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "bus_cdx_driver.h" #include "cdx_logs.h" @@ -198,7 +199,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd, ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq); if (ret < 0) { CDX_BUS_ERR("Cannot get VFIO IRQ info, error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -216,7 +217,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd, fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { CDX_BUS_ERR("Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -252,7 +253,7 @@ cdx_vfio_setup_device(struct rte_cdx_device *dev, int vfio_dev_fd, */ if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) { CDX_BUS_ERR("Unable to reset device! Error: %d (%s)", errno, - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -410,7 +411,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev) ret = cdx_vfio_get_region_info(vfio_dev_fd, ®, i); if (ret < 0) { CDX_BUS_ERR("%s cannot get device region info error %i (%s)", - dev_name, errno, strerror(errno)); + dev_name, errno, rte_strerror(errno)); goto err_vfio_res; } @@ -438,7 +439,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev) ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, 0); if (ret < 0) { CDX_BUS_ERR("%s mapping region %i failed: %s", - cdx_addr, i, strerror(errno)); + cdx_addr, i, rte_strerror(errno)); free(reg); goto err_vfio_res; } @@ -506,7 +507,7 @@ cdx_vfio_map_resource_secondary(struct rte_cdx_device *dev) ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, MAP_FIXED); if (ret < 0) { CDX_BUS_ERR("%s mapping MMIO region %i failed: %s", - dev_name, i, strerror(errno)); + dev_name, i, rte_strerror(errno)); goto err_vfio_dev_fd; } From patchwork Tue Nov 14 08:25:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134198 X-Patchwork-Delegate: thomas@monjalon.net 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 0EFAC43325; Tue, 14 Nov 2023 09:26:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA88140A80; Tue, 14 Nov 2023 09:25:54 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 31C44402BD for ; Tue, 14 Nov 2023 09:25:43 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzlt1FnJzPpKw; Tue, 14 Nov 2023 16:21:30 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:42 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 12/43] bus/dpaa: use rte strerror Date: Tue, 14 Nov 2023 16:25:08 +0800 Message-ID: <20231114082539.1858594-13-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/dpaa_bus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 1814372a40..fe694e447c 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -725,7 +725,7 @@ fman_finish(void) if (unlikely(_errno < 0)) fprintf(stderr, "%s:%d:%s(): munmap() = %d (%s)\n", __FILE__, __LINE__, __func__, - -errno, strerror(errno)); + -errno, rte_strerror(errno)); printf("Tearing down %s\n", __if->node_path); list_del(&__if->__if.node); rte_free(__if); diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index e57159f5d8..ea80168b7c 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -605,7 +605,7 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle) fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { DPAA_BUS_ERR("Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return errno; } From patchwork Tue Nov 14 08:25:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134201 X-Patchwork-Delegate: thomas@monjalon.net 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 853AD43325; Tue, 14 Nov 2023 09:27:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6553D40DDA; Tue, 14 Nov 2023 09:25:58 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7088B402B0 for ; Tue, 14 Nov 2023 09:25:43 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzlt2TqfzPpL3; Tue, 14 Nov 2023 16:21:30 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:42 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 13/43] bus/fslmc: use rte strerror Date: Tue, 14 Nov 2023 16:25:09 +0800 Message-ID: <20231114082539.1858594-14-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/bus/fslmc/fslmc_vfio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 5966776a85..1cbbcf9019 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -481,7 +481,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr, if (ret) { DPAA2_BUS_ERR(" %s cannot get group status, " "error %i (%s)\n", dev_addr, - errno, strerror(errno)); + errno, rte_strerror(errno)); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); return -1; @@ -504,7 +504,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr, if (ret) { DPAA2_BUS_ERR(" %s cannot add VFIO group to container, " "error %i (%s)\n", dev_addr, - errno, strerror(errno)); + errno, rte_strerror(errno)); close(vfio_group_fd); close(vfio_container_fd); rte_vfio_clear_group(vfio_group_fd); @@ -551,7 +551,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr, ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info); if (ret) { DPAA2_BUS_ERR(" %s cannot get device info, error %i (%s)", - dev_addr, errno, strerror(errno)); + dev_addr, errno, rte_strerror(errno)); close(*vfio_dev_fd); close(vfio_group_fd); close(vfio_container_fd); @@ -617,7 +617,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index) if (ret) { DPAA2_BUS_ERR("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)", rte_intr_fd_get(intr_handle), errno, - strerror(errno)); + rte_strerror(errno)); return ret; } @@ -667,7 +667,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle, ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq_info); if (ret < 0) { DPAA2_BUS_ERR("Cannot get IRQ(%d) info, error %i (%s)", - i, errno, strerror(errno)); + i, errno, rte_strerror(errno)); return -1; } @@ -682,7 +682,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle, fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { DPAA2_BUS_ERR("Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } From patchwork Tue Nov 14 08:25:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134204 X-Patchwork-Delegate: thomas@monjalon.net 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 EA38943325; Tue, 14 Nov 2023 09:27:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE9B040ED3; Tue, 14 Nov 2023 09:26:02 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 98CEC402CD for ; Tue, 14 Nov 2023 09:25:43 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4STzrR0kt0zvQkl; Tue, 14 Nov 2023 16:25:27 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:42 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 14/43] bus/pci: use rte strerror Date: Tue, 14 Nov 2023 16:25:10 +0800 Message-ID: <20231114082539.1858594-15-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/bus/pci/bsd/pci.c | 8 ++++---- drivers/bus/pci/linux/pci.c | 7 ++++--- drivers/bus/pci/linux/pci_uio.c | 23 ++++++++++++----------- drivers/bus/pci/linux/pci_vfio.c | 23 ++++++++++++----------- drivers/bus/pci/pci_common_uio.c | 3 ++- 5 files changed, 34 insertions(+), 30 deletions(-) diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c index 27f12590d4..ce08372931 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -125,7 +125,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, if (rte_intr_fd_get(dev->intr_handle) < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - devname, strerror(errno)); + devname, rte_strerror(errno)); goto error; } @@ -169,7 +169,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0); if (maps[map_idx].path == NULL) { RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -179,7 +179,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, fd = open(devname, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - devname, strerror(errno)); + devname, rte_strerror(errno)); goto error; } @@ -353,7 +353,7 @@ rte_pci_scan(void) unsigned i; if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) { RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); goto error; } diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 3d237398d9..7d870b43d2 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "eal_filesystem.h" @@ -455,7 +456,7 @@ rte_pci_scan(void) dir = opendir(rte_pci_get_sysfs_path()); if (dir == NULL) { RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return -1; } @@ -506,7 +507,7 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev) return true; RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n", - __func__, filename, strerror(errno)); + __func__, filename, rte_strerror(errno)); return false; } @@ -557,7 +558,7 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev) if (fp == NULL) { RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n", - __func__, filename, strerror(errno)); + __func__, filename, rte_strerror(errno)); return ret; } diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 97d740dfe5..2ee0179ea2 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "eal_filesystem.h" #include "pci_init.h" @@ -111,7 +112,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num) ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev); if (ret != 0) { RTE_LOG(ERR, EAL, "%s(): mknod() failed %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return -1; } @@ -241,7 +242,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, fd = open(devname, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - devname, strerror(errno)); + devname, rte_strerror(errno)); goto error; } @@ -254,7 +255,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, uio_cfg_fd = open(cfgname, O_RDWR); if (uio_cfg_fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - cfgname, strerror(errno)); + cfgname, rte_strerror(errno)); goto error; } @@ -314,7 +315,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0); if (maps[map_idx].path == NULL) { RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -348,7 +349,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, fd = open(devname, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - devname, strerror(errno)); + devname, rte_strerror(errno)); goto error; } } @@ -404,7 +405,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, f = fopen(filename, "r"); if (f == NULL) { RTE_LOG(ERR, EAL, "%s(): Cannot open sysfs resource: %s\n", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return -1; } @@ -446,7 +447,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0); if (uio_num < 0) { RTE_LOG(ERR, EAL, "cannot open %s: %s\n", - dirname, strerror(errno)); + dirname, rte_strerror(errno)); goto error; } @@ -454,7 +455,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, fd = open(filename, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - filename, strerror(errno)); + filename, rte_strerror(errno)); goto error; } if (rte_intr_fd_set(dev->intr_handle, fd)) @@ -494,7 +495,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, f = fopen(filename, "r"); if (f == NULL) { RTE_LOG(ERR, EAL, "Cannot open sysfs resource: %s\n", - strerror(errno)); + rte_strerror(errno)); return -1; } for (i = 0; i < bar + 1; i++) { @@ -518,7 +519,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, fd = open(filename, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", filename, - strerror(errno)); + rte_strerror(errno)); goto error; } addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE, @@ -526,7 +527,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, close(fd); if (addr == MAP_FAILED) { RTE_LOG(ERR, EAL, "Cannot mmap IO port resource: %s\n", - strerror(errno)); + rte_strerror(errno)); goto error; } diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 3f3201daf2..671b0f36bc 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "eal_filesystem.h" @@ -225,7 +226,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq); if (ret < 0) { RTE_LOG(ERR, EAL, "Cannot get VFIO IRQ info, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } @@ -252,7 +253,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot set up eventfd, error " - "%i (%s)\n", errno, strerror(errno)); + "%i (%s)\n", errno, rte_strerror(errno)); return -1; } @@ -336,7 +337,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd) fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot set up eventfd, error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -460,7 +461,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) */ if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) { RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -742,7 +743,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd, ret = pci_vfio_get_region_info(vfio_dev_fd, ®, i); if (ret < 0) { RTE_LOG(DEBUG, EAL, "%s cannot get device region info error %i (%s)\n", - dev->name, errno, strerror(errno)); + dev->name, errno, rte_strerror(errno)); return -1; } @@ -811,7 +812,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) VFIO_PCI_CONFIG_REGION_INDEX); if (ret < 0) { RTE_LOG(ERR, EAL, "%s cannot get device region info error %i (%s)\n", - dev->name, errno, strerror(errno)); + dev->name, errno, rte_strerror(errno)); goto err_vfio_res; } pdev->region[VFIO_PCI_CONFIG_REGION_INDEX].size = reg->size; @@ -851,7 +852,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) if (ret < 0) { RTE_LOG(ERR, EAL, "%s cannot get device region info error " - "%i (%s)\n", pci_addr, errno, strerror(errno)); + "%i (%s)\n", pci_addr, errno, rte_strerror(errno)); goto err_map; } @@ -914,7 +915,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, 0); if (ret < 0) { RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n", - pci_addr, i, strerror(errno)); + pci_addr, i, rte_strerror(errno)); free(reg); goto err_map; } @@ -922,7 +923,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0); if (ret < 0) { RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n", - pci_addr, i, strerror(errno)); + pci_addr, i, rte_strerror(errno)); free(reg); goto err_map; } @@ -1019,14 +1020,14 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED); if (ret < 0) { RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n", - pci_addr, i, strerror(errno)); + pci_addr, i, rte_strerror(errno)); goto err_vfio_dev_fd; } } else { ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED); if (ret < 0) { RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n", - pci_addr, i, strerror(errno)); + pci_addr, i, rte_strerror(errno)); goto err_vfio_dev_fd; } } diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c index 76c661f054..5d59a90b33 100644 --- a/drivers/bus/pci/pci_common_uio.c +++ b/drivers/bus/pci/pci_common_uio.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "private.h" @@ -44,7 +45,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev) fd = open(uio_res->maps[i].path, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - uio_res->maps[i].path, strerror(errno)); + uio_res->maps[i].path, rte_strerror(errno)); return -1; } From patchwork Tue Nov 14 08:25:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134202 X-Patchwork-Delegate: thomas@monjalon.net 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 8037443325; Tue, 14 Nov 2023 09:27:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65A1840EA5; Tue, 14 Nov 2023 09:26:00 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id CE7F0402BD for ; Tue, 14 Nov 2023 09:25:43 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmw30TSz1P8LR; Tue, 14 Nov 2023 16:22:24 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:42 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 15/43] bus/vdev: use rte strerror Date: Tue, 14 Nov 2023 16:25:11 +0800 Message-ID: <20231114082539.1858594-16-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/bus/vdev/vdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 7974b27295..bdb5fa8fce 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -432,7 +432,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer) strlcpy(ou->name, devname, RTE_DEV_NAME_MAX_LEN); if (rte_mp_sendmsg(&mp_resp) < 0) VDEV_LOG(ERR, "send vdev, %s, failed, %s", - devname, strerror(rte_errno)); + devname, rte_strerror(rte_errno)); num++; } rte_spinlock_recursive_unlock(&vdev_device_list_lock); From patchwork Tue Nov 14 08:25:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134203 X-Patchwork-Delegate: thomas@monjalon.net 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 11FD443325; Tue, 14 Nov 2023 09:27:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84EA040E0F; Tue, 14 Nov 2023 09:26:01 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id CCFF44027B for ; Tue, 14 Nov 2023 09:25:43 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrK2zYSzWhMd; Tue, 14 Nov 2023 16:25:21 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:42 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 16/43] bus/vmbus: use rte strerror Date: Tue, 14 Nov 2023 16:25:12 +0800 Message-ID: <20231114082539.1858594-17-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/bus/vmbus/linux/vmbus_bus.c | 7 ++++--- drivers/bus/vmbus/linux/vmbus_uio.c | 21 +++++++++++---------- drivers/bus/vmbus/vmbus_common.c | 4 ++-- drivers/bus/vmbus/vmbus_common_uio.c | 3 ++- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c index 01d8111b85..0c92c1d4dd 100644 --- a/drivers/bus/vmbus/linux/vmbus_bus.c +++ b/drivers/bus/vmbus/linux/vmbus_bus.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "eal_filesystem.h" #include "private.h" @@ -50,7 +51,7 @@ parse_sysfs_uuid(const char *filename, rte_uuid_t uu) f = fopen(filename, "r"); if (f == NULL) { VMBUS_LOG(ERR, "cannot open sysfs value %s: %s", - filename, strerror(errno)); + filename, rte_strerror(errno)); return -1; } @@ -92,7 +93,7 @@ get_sysfs_string(const char *filename, char *buf, size_t buflen) f = fopen(filename, "r"); if (f == NULL) { VMBUS_LOG(ERR, "cannot open sysfs value %s:%s", - filename, strerror(errno)); + filename, rte_strerror(errno)); return -1; } @@ -350,7 +351,7 @@ rte_vmbus_scan(void) return 0; VMBUS_LOG(ERR, "opendir %s failed: %s", - SYSFS_VMBUS_DEVICES, strerror(errno)); + SYSFS_VMBUS_DEVICES, rte_strerror(errno)); return -1; } diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 26edef342d..5fce68d880 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "private.h" @@ -34,7 +35,7 @@ void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff) sizeof(onoff)) < 0) { VMBUS_LOG(ERR, "cannot write to %d:%s", rte_intr_fd_get(dev->intr_handle), - strerror(errno)); + rte_strerror(errno)); } } @@ -51,7 +52,7 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev) if (cc < (int)sizeof(count)) { if (cc < 0) { VMBUS_LOG(ERR, "IRQ read failed %s", - strerror(errno)); + rte_strerror(errno)); return -errno; } VMBUS_LOG(ERR, "can't read IRQ count"); @@ -91,7 +92,7 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, fd = open(devname, O_RDWR); if (fd < 0) { VMBUS_LOG(ERR, "Cannot open %s: %s", - devname, strerror(errno)); + devname, rte_strerror(errno)); goto error; } @@ -158,7 +159,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx, fd = open(uio_res->path, O_RDWR); if (fd < 0) { VMBUS_LOG(ERR, "Cannot open %s: %s", - uio_res->path, strerror(errno)); + uio_res->path, rte_strerror(errno)); return -1; } @@ -256,13 +257,13 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev, fd = open(ring_path, O_RDWR); if (fd < 0) { VMBUS_LOG(ERR, "Cannot open %s: %s", - ring_path, strerror(errno)); + ring_path, rte_strerror(errno)); return -errno; } if (fstat(fd, &sb) < 0) { VMBUS_LOG(ERR, "Cannot state %s: %s", - ring_path, strerror(errno)); + ring_path, rte_strerror(errno)); close(fd); return -errno; } @@ -342,7 +343,7 @@ static int vmbus_uio_sysfs_read(const char *dir, const char *name, f = fopen(path, "r"); if (!f) { VMBUS_LOG(ERR, "can't open %s:%s", - path, strerror(errno)); + path, rte_strerror(errno)); return -errno; } @@ -404,7 +405,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, chan_dir = opendir(chan_path); if (!chan_dir) { VMBUS_LOG(ERR, "cannot open %s: %s", - chan_path, strerror(errno)); + chan_path, rte_strerror(errno)); return -errno; } @@ -441,7 +442,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, &subid, UINT16_MAX); if (err) { VMBUS_LOG(NOTICE, "no subchannel_id in %s:%s", - subchan_path, strerror(-err)); + subchan_path, rte_strerror(-err)); goto fail; } @@ -452,7 +453,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, &monid, UINT8_MAX); if (err) { VMBUS_LOG(NOTICE, "no monitor_id in %s:%s", - subchan_path, strerror(-err)); + subchan_path, rte_strerror(-err)); goto fail; } diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c index b9139c6e6c..e1a80c9587 100644 --- a/drivers/bus/vmbus/vmbus_common.c +++ b/drivers/bus/vmbus/vmbus_common.c @@ -38,7 +38,7 @@ vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size, VMBUS_LOG(ERR, "mmap(%d, %p, %zu, %ld) failed: %s", fd, requested_addr, size, (long)offset, - strerror(errno)); + rte_strerror(errno)); } else { VMBUS_LOG(DEBUG, " VMBUS memory mapped at %p", mapaddr); @@ -57,7 +57,7 @@ vmbus_unmap_resource(void *requested_addr, size_t size) if (munmap(requested_addr, size)) { VMBUS_LOG(ERR, "munmap(%p, 0x%lx) failed: %s", requested_addr, (unsigned long)size, - strerror(errno)); + rte_strerror(errno)); } else { VMBUS_LOG(DEBUG, " VMBUS memory unmapped at %p", requested_addr); diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c index 4d4613513c..54c1187026 100644 --- a/drivers/bus/vmbus/vmbus_common_uio.c +++ b/drivers/bus/vmbus/vmbus_common_uio.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "private.h" @@ -56,7 +57,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev) fd = open(uio_res->path, O_RDWR); if (fd < 0) { VMBUS_LOG(ERR, "Cannot open %s: %s", - uio_res->path, strerror(errno)); + uio_res->path, rte_strerror(errno)); return -1; } From patchwork Tue Nov 14 08:25:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134205 X-Patchwork-Delegate: thomas@monjalon.net 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 BD97F43325; Tue, 14 Nov 2023 09:27:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA93740EDC; Tue, 14 Nov 2023 09:26:03 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 3DEBF402E8 for ; Tue, 14 Nov 2023 09:25:44 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4STzmv71MQzrVDl; Tue, 14 Nov 2023 16:22:23 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:42 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 17/43] common/cnxk: use rte strerror Date: Tue, 14 Nov 2023 16:25:13 +0800 Message-ID: <20231114082539.1858594-18-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/common/cnxk/roc_dev.c | 4 +++- drivers/common/cnxk/roc_model.c | 4 +++- drivers/common/cnxk/roc_utils.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index e7e89bf3d6..812e6890f0 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -8,6 +8,8 @@ #include #include +#include + #include "roc_api.h" #include "roc_priv.h" @@ -1313,7 +1315,7 @@ dev_lmt_setup(struct dev *dev) mz = plt_lmt_region_reserve_aligned(name, LMT_REGION_SIZE, LMT_REGION_SIZE); if (!mz) { - plt_err("Memory alloc failed: %s", strerror(errno)); + plt_err("Memory alloc failed: %s", rte_strerror(errno)); goto fail; } diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c index 6dc2afe7f0..647af4b7ab 100644 --- a/drivers/common/cnxk/roc_model.c +++ b/drivers/common/cnxk/roc_model.c @@ -6,6 +6,8 @@ #include #include +#include + #include "roc_api.h" #include "roc_priv.h" @@ -154,7 +156,7 @@ cn10k_part_pass_get(uint32_t *part, uint32_t *pass) dir = opendir(SYSFS_PCI_DEVICES); if (dir == NULL) { plt_err("%s(): opendir failed: %s\n", __func__, - strerror(errno)); + rte_strerror(errno)); return -errno; } diff --git a/drivers/common/cnxk/roc_utils.c b/drivers/common/cnxk/roc_utils.c index 9af2ae9b69..418cd6b477 100644 --- a/drivers/common/cnxk/roc_utils.c +++ b/drivers/common/cnxk/roc_utils.c @@ -2,6 +2,8 @@ * Copyright(C) 2021 Marvell. */ +#include + #include "roc_api.h" #include "roc_priv.h" @@ -245,7 +247,7 @@ roc_error_msg_get(int errorcode) * Handle general error (as defined in linux errno.h) */ if (abs(errorcode) < 300) - err_msg = strerror(abs(errorcode)); + err_msg = rte_strerror(abs(errorcode)); else err_msg = "Unknown error code"; break; From patchwork Tue Nov 14 08:25:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134206 X-Patchwork-Delegate: thomas@monjalon.net 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 C7EE143325; Tue, 14 Nov 2023 09:27:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF74740EE2; Tue, 14 Nov 2023 09:26:04 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 2656E402E4 for ; Tue, 14 Nov 2023 09:25:44 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzlv0p29zPnjf; Tue, 14 Nov 2023 16:21:31 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:42 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 18/43] common/mlx5: use rte strerror Date: Tue, 14 Nov 2023 16:25:14 +0800 Message-ID: <20231114082539.1858594-19-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/common/mlx5/linux/mlx5_nl.c | 12 ++++++------ drivers/common/mlx5/mlx5_common.c | 6 +++--- drivers/common/mlx5/mlx5_devx_cmds.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index 28a1f56dba..1de867089f 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -547,7 +547,7 @@ mlx5_nl_mac_addr_list(int nlsk_fd, unsigned int iface_idx, return 0; error: DRV_LOG(DEBUG, "Interface %u cannot retrieve MAC address list %s", - iface_idx, strerror(rte_errno)); + iface_idx, rte_strerror(rte_errno)); return -rte_errno; } @@ -617,7 +617,7 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx, DRV_LOG(DEBUG, "Interface %u cannot %s MAC address %s %s", iface_idx, - add ? "add" : "remove", m, strerror(rte_errno)); + add ? "add" : "remove", m, rte_strerror(rte_errno)); } #endif return -rte_errno; @@ -704,7 +704,7 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx, RTE_ETHER_ADDR_PRT_FMT " : %s", vf_index, RTE_ETHER_ADDR_BYTES(mac), - strerror(rte_errno)); + rte_strerror(rte_errno)); return -rte_errno; } @@ -929,7 +929,7 @@ mlx5_nl_promisc(int nlsk_fd, unsigned int iface_idx, int enable) DRV_LOG(DEBUG, "Interface %u cannot %s promisc mode: Netlink error %s", iface_idx, enable ? "enable" : "disable", - strerror(rte_errno)); + rte_strerror(rte_errno)); return ret; } @@ -956,7 +956,7 @@ mlx5_nl_allmulti(int nlsk_fd, unsigned int iface_idx, int enable) DRV_LOG(DEBUG, "Interface %u cannot %s allmulti : Netlink error %s", iface_idx, enable ? "enable" : "disable", - strerror(rte_errno)); + rte_strerror(rte_errno)); return ret; } @@ -1934,7 +1934,7 @@ mlx5_nl_read_events(int nlsk_fd, mlx5_nl_event_cb *cb, void *cb_arg) if (errno == EINTR) continue; DRV_LOG(DEBUG, "Failed to receive netlink message: %s", - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; return -rte_errno; } diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index ca8543e36e..7aafd0083d 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -762,7 +762,7 @@ mlx5_common_dev_create(struct rte_device *eal_dev, uint32_t classes, ret = mlx5_common_config_get(mkvlist, &cdev->config); if (ret < 0) { DRV_LOG(ERR, "Failed to process device arguments: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); rte_free(cdev); return NULL; } @@ -837,7 +837,7 @@ mlx5_common_probe_again_args_validate(struct mlx5_common_device *cdev, ret = mlx5_common_config_get(mkvlist, config); if (ret) { DRV_LOG(ERR, "Failed to process device configure: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); mlx5_free(config); return ret; } @@ -1011,7 +1011,7 @@ mlx5_common_dev_probe(struct rte_device *eal_dev) if (ret) { DRV_LOG(ERR, "Probe again parameters aren't compatible : %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto class_err; } } diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 4d8818924a..b33b5d3044 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -640,7 +640,7 @@ mlx5_devx_cmd_match_sample_info_query(void *ctx, uint32_t sample_field_id, rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out)); if (rc) { DRV_LOG(ERR, "Failed to query match sample info using DevX: %s", - strerror(rc)); + rte_strerror(rc)); rte_errno = rc; return -rc; } From patchwork Tue Nov 14 08:25:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134207 X-Patchwork-Delegate: thomas@monjalon.net 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 4BC8043325; Tue, 14 Nov 2023 09:27:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3413040EE5; Tue, 14 Nov 2023 09:26:06 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 77A37402EE for ; Tue, 14 Nov 2023 09:25:44 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4STzlS3HqHzMmLj; Tue, 14 Nov 2023 16:21:08 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:43 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 19/43] crypto/caam_jr: use rte strerror Date: Tue, 14 Nov 2023 16:25:15 +0800 Message-ID: <20231114082539.1858594-20-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/crypto/caam_jr/caam_jr_uio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c index 583ba3b523..b612407c41 100644 --- a/drivers/crypto/caam_jr/caam_jr_uio.c +++ b/drivers/crypto/caam_jr/caam_jr_uio.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -355,7 +356,7 @@ free_job_ring(int uio_fd) if (munmap(job_ring->register_base_addr, job_ring->map_size)) { CAAM_JR_INFO("cannot munmap(%p, 0x%lx): %s", job_ring->register_base_addr, - (unsigned long)job_ring->map_size, strerror(errno)); + (unsigned long)job_ring->map_size, rte_strerror(errno)); } else CAAM_JR_DEBUG("JR UIO memory is unmapped"); @@ -419,7 +420,7 @@ sec_configure(void) d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH); if (d == NULL) { printf("\nError opening directory '%s': %s\n", - SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno)); + SEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno)); return -1; } From patchwork Tue Nov 14 08:25:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134208 X-Patchwork-Delegate: thomas@monjalon.net 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 5D34A43325; Tue, 14 Nov 2023 09:27:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55F8940F16; Tue, 14 Nov 2023 09:26:07 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 70904402BD for ; Tue, 14 Nov 2023 09:25:44 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmx1D6dz1P8ML; Tue, 14 Nov 2023 16:22:25 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:43 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 20/43] dma/idxd: use rte strerror Date: Tue, 14 Nov 2023 16:25:16 +0800 Message-ID: <20231114082539.1858594-21-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/dma/idxd/idxd_bus.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c index 3b2d4c2b65..a230976c98 100644 --- a/drivers/dma/idxd/idxd_bus.c +++ b/drivers/dma/idxd/idxd_bus.c @@ -145,7 +145,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename, fd = open(sysfs_node, O_RDONLY); if (fd < 0) { IDXD_PMD_ERR("%s(): opening file '%s' failed: %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, rte_strerror(errno)); return -1; } @@ -153,7 +153,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename, close(fd); if (len < 0) { IDXD_PMD_ERR("%s(): error reading file '%s': %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, rte_strerror(errno)); return -1; } value[len] = '\0'; @@ -173,13 +173,13 @@ read_wq_int(struct rte_dsa_device *dev, const char *filename, f = fopen(sysfs_node, "r"); if (f == NULL) { IDXD_PMD_ERR("%s(): opening file '%s' failed: %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, rte_strerror(errno)); return -1; } if (fscanf(f, "%d", value) != 1) { IDXD_PMD_ERR("%s(): error reading file '%s': %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, rte_strerror(errno)); ret = -1; } @@ -200,13 +200,13 @@ read_device_int(struct rte_dsa_device *dev, const char *filename, f = fopen(sysfs_node, "r"); if (f == NULL) { IDXD_PMD_ERR("%s(): opening file '%s' failed: %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, rte_strerror(errno)); return -1; } if (fscanf(f, "%d", value) != 1) { IDXD_PMD_ERR("%s(): error reading file '%s': %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, rte_strerror(errno)); ret = -1; } @@ -317,7 +317,7 @@ dsa_scan(void) if (errno == ENOENT) return 0; /* no bus, return without error */ IDXD_PMD_ERR("%s(): opendir '%s' failed: %s", - __func__, path, strerror(errno)); + __func__, path, rte_strerror(errno)); return -1; } From patchwork Tue Nov 14 08:25:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134209 X-Patchwork-Delegate: thomas@monjalon.net 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 1842043325; Tue, 14 Nov 2023 09:27:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 715CC410D0; Tue, 14 Nov 2023 09:26:08 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id A54264027B for ; Tue, 14 Nov 2023 09:25:44 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzlv41qWzPnZd; Tue, 14 Nov 2023 16:21:31 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:43 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 21/43] net/af_packet: use rte strerror Date: Tue, 14 Nov 2023 16:25:17 +0800 Message-ID: <20231114082539.1858594-22-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 397a32db58..2f884d4b7f 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -108,7 +108,7 @@ RTE_LOG_REGISTER_DEFAULT(af_packet_logtype, NOTICE); #define PMD_LOG_ERRNO(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, af_packet_logtype, \ - "%s(): " fmt ":%s\n", __func__, ##args, strerror(errno)) + "%s(): " fmt ":%s\n", __func__, ##args, rte_strerror(errno)) static uint16_t eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) From patchwork Tue Nov 14 08:25:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134223 X-Patchwork-Delegate: thomas@monjalon.net 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 1262343325; Tue, 14 Nov 2023 09:29:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB0B542830; Tue, 14 Nov 2023 09:26:23 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 34D99402EE for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmx50Vgz1P8Jb; Tue, 14 Nov 2023 16:22:25 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:43 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 22/43] net/bnxt: use rte strerror Date: Tue, 14 Nov 2023 16:25:18 +0800 Message-ID: <20231114082539.1858594-23-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/bnxt/bnxt_stats.c | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 26 +- drivers/net/bnxt/tf_core/tf_core.c | 240 +++++++++--------- drivers/net/bnxt/tf_core/tf_em_common.c | 26 +- .../net/bnxt/tf_core/tf_em_hash_internal.c | 4 +- drivers/net/bnxt/tf_core/tf_em_host.c | 24 +- drivers/net/bnxt/tf_core/tf_em_internal.c | 14 +- drivers/net/bnxt/tf_core/tf_global_cfg.c | 10 +- drivers/net/bnxt/tf_core/tf_identifier.c | 8 +- drivers/net/bnxt/tf_core/tf_if_tbl.c | 6 +- drivers/net/bnxt/tf_core/tf_msg.c | 160 ++++++------ drivers/net/bnxt/tf_core/tf_rm.c | 6 +- drivers/net/bnxt/tf_core/tf_session.c | 72 +++--- drivers/net/bnxt/tf_core/tf_sram_mgr.c | 22 +- drivers/net/bnxt/tf_core/tf_tbl.c | 28 +- drivers/net/bnxt/tf_core/tf_tbl_sram.c | 48 ++-- drivers/net/bnxt/tf_core/tf_tcam.c | 24 +- 17 files changed, 360 insertions(+), 360 deletions(-) diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c index 0e25207fc3..4212065b32 100644 --- a/drivers/net/bnxt/bnxt_stats.c +++ b/drivers/net/bnxt/bnxt_stats.c @@ -942,7 +942,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev) ret = bnxt_hwrm_port_clr_stats(bp); if (ret != 0) PMD_DRV_LOG(ERR, "Failed to reset xstats: %s\n", - strerror(-ret)); + rte_strerror(-ret)); bnxt_clear_prev_stat(bp); diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index 964a5aeb05..558085ec0c 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.c +++ b/drivers/net/bnxt/rte_pmd_bnxt.c @@ -149,7 +149,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -191,7 +191,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf, if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -249,7 +249,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on) if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -308,7 +308,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on) if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -365,7 +365,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on) if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -409,7 +409,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf, if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -600,7 +600,7 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port, if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -636,7 +636,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port, if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -670,7 +670,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id) if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -705,7 +705,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -744,7 +744,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -827,7 +827,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf, if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } @@ -871,7 +871,7 @@ int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on) if (rc != 0) { PMD_DRV_LOG(ERR, "Error during getting device (port %u) info: %s\n", - port, strerror(-rc)); + port, rte_strerror(-rc)); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index 3a812bee3a..2c7ee09888 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -205,7 +205,7 @@ int tf_insert_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -215,7 +215,7 @@ int tf_insert_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -232,7 +232,7 @@ int tf_insert_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: EM insert failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -261,7 +261,7 @@ int tf_delete_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -271,7 +271,7 @@ int tf_delete_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -285,7 +285,7 @@ int tf_delete_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: EM delete failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -313,7 +313,7 @@ int tf_get_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -323,7 +323,7 @@ int tf_get_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -338,7 +338,7 @@ int tf_get_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -347,7 +347,7 @@ int tf_get_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Global Cfg get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -375,7 +375,7 @@ int tf_set_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -385,7 +385,7 @@ int tf_set_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -400,7 +400,7 @@ int tf_set_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -409,7 +409,7 @@ int tf_set_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Global Cfg set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -437,7 +437,7 @@ tf_alloc_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -447,7 +447,7 @@ tf_alloc_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -456,7 +456,7 @@ tf_alloc_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -468,7 +468,7 @@ tf_alloc_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Identifier allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -497,7 +497,7 @@ tf_free_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -507,7 +507,7 @@ tf_free_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -516,7 +516,7 @@ tf_free_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -529,7 +529,7 @@ tf_free_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Identifier free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -556,7 +556,7 @@ tf_search_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -566,7 +566,7 @@ tf_search_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -575,7 +575,7 @@ tf_search_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -589,7 +589,7 @@ tf_search_identifier(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Identifier search failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -615,7 +615,7 @@ tf_search_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -625,7 +625,7 @@ tf_search_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -634,7 +634,7 @@ tf_search_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -656,7 +656,7 @@ tf_search_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: TCAM allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -688,7 +688,7 @@ tf_alloc_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -698,7 +698,7 @@ tf_alloc_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -707,7 +707,7 @@ tf_alloc_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -720,7 +720,7 @@ tf_alloc_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: TCAM allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -748,7 +748,7 @@ tf_set_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -758,7 +758,7 @@ tf_set_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -768,7 +768,7 @@ tf_set_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -786,7 +786,7 @@ tf_set_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: TCAM set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } TFP_DRV_LOG(DEBUG, @@ -816,7 +816,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -826,7 +826,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -835,7 +835,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -853,7 +853,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused, TFP_DRV_LOG(ERR, "%s: TCAM get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } parms->key_sz_in_bits = gparms.key_size * 8; @@ -881,7 +881,7 @@ tf_free_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -891,7 +891,7 @@ tf_free_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -900,7 +900,7 @@ tf_free_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -912,7 +912,7 @@ tf_free_tcam_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: TCAM free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -935,7 +935,7 @@ tf_move_tcam_shared_entries(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -945,7 +945,7 @@ tf_move_tcam_shared_entries(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -954,7 +954,7 @@ tf_move_tcam_shared_entries(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -963,7 +963,7 @@ tf_move_tcam_shared_entries(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: TCAM shared entries move failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -986,7 +986,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -996,7 +996,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1005,7 +1005,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1014,7 +1014,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: TCAM shared entries clear failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1042,7 +1042,7 @@ tf_alloc_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1052,7 +1052,7 @@ tf_alloc_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1067,7 +1067,7 @@ tf_alloc_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1076,7 +1076,7 @@ tf_alloc_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: External table allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { @@ -1085,7 +1085,7 @@ tf_alloc_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: SRAM table allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } else { @@ -1094,7 +1094,7 @@ tf_alloc_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Table allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } @@ -1124,7 +1124,7 @@ tf_free_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1134,7 +1134,7 @@ tf_free_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1149,7 +1149,7 @@ tf_free_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1158,7 +1158,7 @@ tf_free_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Table free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { @@ -1167,7 +1167,7 @@ tf_free_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: SRAM table free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } else { @@ -1177,7 +1177,7 @@ tf_free_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Table free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } @@ -1204,7 +1204,7 @@ tf_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1214,7 +1214,7 @@ tf_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1231,7 +1231,7 @@ tf_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1240,7 +1240,7 @@ tf_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Table set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { @@ -1249,7 +1249,7 @@ tf_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: SRAM table set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } else { @@ -1258,7 +1258,7 @@ tf_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1267,7 +1267,7 @@ tf_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Table set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } @@ -1295,7 +1295,7 @@ tf_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1305,7 +1305,7 @@ tf_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } gparms.dir = parms->dir; @@ -1320,7 +1320,7 @@ tf_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: SRAM table get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } else { @@ -1329,7 +1329,7 @@ tf_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1338,7 +1338,7 @@ tf_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Table get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } @@ -1366,7 +1366,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1376,7 +1376,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1393,7 +1393,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s, External table type not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { @@ -1402,7 +1402,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: SRAM table bulk get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); } return rc; } @@ -1412,7 +1412,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1421,7 +1421,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Table get bulk failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } return rc; @@ -1442,7 +1442,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1452,7 +1452,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1463,7 +1463,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1472,7 +1472,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Get table increment not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1494,7 +1494,7 @@ tf_alloc_tbl_scope(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1503,7 +1503,7 @@ tf_alloc_tbl_scope(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1532,7 +1532,7 @@ tf_map_tbl_scope(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1541,7 +1541,7 @@ tf_map_tbl_scope(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1571,7 +1571,7 @@ tf_free_tbl_scope(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1580,7 +1580,7 @@ tf_free_tbl_scope(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1612,7 +1612,7 @@ tf_set_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1622,7 +1622,7 @@ tf_set_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1631,7 +1631,7 @@ tf_set_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1646,7 +1646,7 @@ tf_set_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: If_tbl set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1670,7 +1670,7 @@ tf_get_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1680,7 +1680,7 @@ tf_get_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1689,7 +1689,7 @@ tf_get_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1704,7 +1704,7 @@ tf_get_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: If_tbl get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1725,7 +1725,7 @@ int tf_get_session_info(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1734,7 +1734,7 @@ int tf_get_session_info(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1744,7 +1744,7 @@ int tf_get_session_info(struct tf *tfp, rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1752,14 +1752,14 @@ int tf_get_session_info(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Ident get resc info failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } if (dev->ops->tf_dev_get_tbl_resc_info == NULL) { rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1767,14 +1767,14 @@ int tf_get_session_info(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Tbl get resc info failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } if (dev->ops->tf_dev_get_tcam_resc_info == NULL) { rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1782,14 +1782,14 @@ int tf_get_session_info(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "TCAM get resc info failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } if (dev->ops->tf_dev_get_em_resc_info == NULL) { rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1797,7 +1797,7 @@ int tf_get_session_info(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "EM get resc info failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } return 0; @@ -1861,7 +1861,7 @@ int tf_query_sram_resources(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1870,7 +1870,7 @@ int tf_query_sram_resources(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Get SRAM resc info failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1901,7 +1901,7 @@ int tf_query_sram_resources(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EOPNOTSUPP; } @@ -1911,7 +1911,7 @@ int tf_query_sram_resources(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Get SRAM resc info failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1943,7 +1943,7 @@ int tf_set_sram_policy(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1952,7 +1952,7 @@ int tf_set_sram_policy(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: SRAM policy set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1984,7 +1984,7 @@ int tf_get_sram_policy(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1993,7 +1993,7 @@ int tf_get_sram_policy(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: SRAM policy get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c index c518150d1f..162bc275b9 100644 --- a/drivers/net/bnxt/tf_core/tf_em_common.c +++ b/drivers/net/bnxt/tf_core/tf_em_common.c @@ -51,7 +51,7 @@ tf_create_tbl_pool_external(enum tf_dir dir, if (tfp_calloc(&parms) != 0) { TFP_DRV_LOG(ERR, "%s: TBL: external pool failure %s\n", - tf_dir_2_str(dir), strerror(ENOMEM)); + tf_dir_2_str(dir), rte_strerror(ENOMEM)); return -ENOMEM; } @@ -61,7 +61,7 @@ tf_create_tbl_pool_external(enum tf_dir dir, if (rc != 0) { TFP_DRV_LOG(ERR, "%s: TBL: stack init failure %s\n", - tf_dir_2_str(dir), strerror(-rc)); + tf_dir_2_str(dir), rte_strerror(-rc)); goto cleanup; } @@ -78,7 +78,7 @@ tf_create_tbl_pool_external(enum tf_dir dir, rc = stack_push(pool, j); if (rc != 0) { TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n", - tf_dir_2_str(dir), strerror(-rc)); + tf_dir_2_str(dir), rte_strerror(-rc)); goto cleanup; } @@ -93,7 +93,7 @@ tf_create_tbl_pool_external(enum tf_dir dir, if (!stack_is_full(pool)) { rc = -EINVAL; TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n", - tf_dir_2_str(dir), strerror(-rc)); + tf_dir_2_str(dir), rte_strerror(-rc)); goto cleanup; } return 0; @@ -921,7 +921,7 @@ tf_em_ext_common_bind(struct tf *tfp, cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { TFP_DRV_LOG(ERR, "em_ext_db alloc error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } @@ -980,7 +980,7 @@ tf_em_ext_common_unbind(struct tf *tfp) rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -989,7 +989,7 @@ tf_em_ext_common_unbind(struct tf *tfp) if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -997,7 +997,7 @@ tf_em_ext_common_unbind(struct tf *tfp) if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1157,7 +1157,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "Map table scope operation not supported, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1167,14 +1167,14 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, if (tfp_calloc(&aparms) != 0) { TFP_DRV_LOG(ERR, "Map tbl scope alloc data error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } data = aparms.mem_va; if (tfp_calloc(&aparms) != 0) { TFP_DRV_LOG(ERR, "Map tbl scope alloc mask error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); rc = -ENOMEM; goto clean; } @@ -1188,7 +1188,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Map table scope config failure, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleaner; } @@ -1203,7 +1203,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Map tbl scope, set failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } cleaner: tfp_free(mask); diff --git a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c index d72ac83295..fe9c710f26 100644 --- a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c +++ b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c @@ -130,7 +130,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -165,7 +165,7 @@ tf_em_move_int_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c index 9efffe4ee5..55d27b88a2 100644 --- a/drivers/net/bnxt/tf_core/tf_em_host.c +++ b/drivers/net/bnxt/tf_core/tf_em_host.c @@ -182,7 +182,7 @@ tf_em_alloc_page_table(struct hcapi_cfa_em_table *tbl) TFP_DRV_LOG(WARNING, "Failed to allocate page table: lvl: %d, rc:%s\n", i, - strerror(-rc)); + rte_strerror(-rc)); goto cleanup; } @@ -379,7 +379,7 @@ tf_em_ext_alloc(struct tf *tfp, rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -387,7 +387,7 @@ tf_em_ext_alloc(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } ext_db = (struct em_ext_db *)ext_ptr; @@ -396,7 +396,7 @@ tf_em_ext_alloc(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "EEM: PF query error rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup; } @@ -420,7 +420,7 @@ tf_em_ext_alloc(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate session table scope, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup; } @@ -436,7 +436,7 @@ tf_em_ext_alloc(struct tf *tfp, TFP_DRV_LOG(ERR, "EEM: Unable to query for EEM capability," " rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup_ts; } } @@ -456,7 +456,7 @@ tf_em_ext_alloc(struct tf *tfp, TFP_DRV_LOG(ERR, "EEM: Unable to register for EEM ctx," " rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup_ts; } @@ -473,7 +473,7 @@ tf_em_ext_alloc(struct tf *tfp, TFP_DRV_LOG(ERR, "TBL: Unable to configure EEM in firmware" " rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup_full; } @@ -485,7 +485,7 @@ tf_em_ext_alloc(struct tf *tfp, TFP_DRV_LOG(ERR, "EEM: Unable to enable EEM in firmware" " rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup_full; } @@ -501,7 +501,7 @@ tf_em_ext_alloc(struct tf *tfp, TFP_DRV_LOG(ERR, "%s TBL: Unable to allocate idx pools %s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); goto cleanup_full; } } @@ -547,7 +547,7 @@ tf_em_ext_free(struct tf *tfp, rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return -EINVAL; } @@ -555,7 +555,7 @@ tf_em_ext_free(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } ext_db = (struct em_ext_db *)ext_ptr; diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c index 46de63a9da..21cf19c45e 100644 --- a/drivers/net/bnxt/tf_core/tf_em_internal.c +++ b/drivers/net/bnxt/tf_core/tf_em_internal.c @@ -49,7 +49,7 @@ tf_em_insert_int_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -113,7 +113,7 @@ tf_em_delete_int_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -153,7 +153,7 @@ tf_em_move_callback(void *user_data, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms.dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -163,7 +163,7 @@ tf_em_move_callback(void *user_data, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms.dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -202,7 +202,7 @@ tf_em_int_bind(struct tf *tfp, cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { TFP_DRV_LOG(ERR, "em_rm_db alloc error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } @@ -232,7 +232,7 @@ tf_em_int_bind(struct tf *tfp, "%s, EM Allocation must be in blocks of %d, failure %s\n", tf_dir_2_str(i), TF_SESSION_EM_ENTRY_SIZE, - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -278,7 +278,7 @@ tf_em_int_bind(struct tf *tfp, TFP_DRV_LOG(ERR, "%s, EM stack allocation failure %s\n", tf_dir_2_str(i), - strerror(-rc)); + rte_strerror(-rc)); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c index 3a8030a2fb..ba748fdc23 100644 --- a/drivers/net/bnxt/tf_core/tf_global_cfg.c +++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c @@ -83,7 +83,7 @@ tf_global_cfg_bind(struct tf *tfp, cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { TFP_DRV_LOG(ERR, "global_rm_db alloc error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } @@ -141,7 +141,7 @@ tf_global_cfg_set(struct tf *tfp, "%s, Failed type lookup, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -151,7 +151,7 @@ tf_global_cfg_set(struct tf *tfp, "%s, Set failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + rte_strerror(-rc)); } return 0; @@ -185,7 +185,7 @@ tf_global_cfg_get(struct tf *tfp, "%s, Failed type lookup, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -196,7 +196,7 @@ tf_global_cfg_get(struct tf *tfp, "%s, Get failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + rte_strerror(-rc)); } return 0; diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c index 7d9d9595dd..21e60a8ad5 100644 --- a/drivers/net/bnxt/tf_core/tf_identifier.c +++ b/drivers/net/bnxt/tf_core/tf_identifier.c @@ -39,7 +39,7 @@ tf_ident_bind(struct tf *tfp, cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { TFP_DRV_LOG(ERR, "ident_rm_db alloc error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } @@ -124,7 +124,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get ident_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } ident_db = (struct ident_rm_db *)ident_db_ptr; @@ -164,7 +164,7 @@ tf_ident_free(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get ident_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } ident_db = (struct ident_rm_db *)ident_db_ptr; @@ -222,7 +222,7 @@ tf_ident_search(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get ident_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } ident_db = (struct ident_rm_db *)ident_db_ptr; diff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c index 578d361417..4d85b77b4e 100644 --- a/drivers/net/bnxt/tf_core/tf_if_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c @@ -65,7 +65,7 @@ tf_if_tbl_bind(struct tf *tfp, cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { TFP_DRV_LOG(ERR, "if_tbl_rm_db alloc error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } @@ -143,7 +143,7 @@ tf_if_tbl_set(struct tf *tfp, "%s, If Tbl set failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + rte_strerror(-rc)); } return 0; @@ -187,7 +187,7 @@ tf_if_tbl_get(struct tf *tfp, "%s, If Tbl get failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + rte_strerror(-rc)); } return 0; diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c index 1c66c7e01a..5e180813d8 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.c +++ b/drivers/net/bnxt/tf_core/tf_msg.c @@ -216,7 +216,7 @@ tf_msg_session_client_register(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -224,7 +224,7 @@ tf_msg_session_client_register(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -291,7 +291,7 @@ tf_msg_session_client_unregister(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -299,7 +299,7 @@ tf_msg_session_client_unregister(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -361,7 +361,7 @@ tf_msg_session_qcfg(struct tf *tfp) if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -370,7 +370,7 @@ tf_msg_session_qcfg(struct tf *tfp) if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -378,7 +378,7 @@ tf_msg_session_qcfg(struct tf *tfp) if (rc) { TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -447,7 +447,7 @@ tf_msg_session_resc_qcaps(struct tf *tfp, TFP_DRV_LOG(WARNING, "%s: QCAPS message size error, rc:%s, request %d vs response %d\n", tf_dir_2_str(dir), - strerror(EINVAL), + rte_strerror(EINVAL), size, resp.size); } @@ -498,7 +498,7 @@ tf_msg_session_resc_alloc(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -509,7 +509,7 @@ tf_msg_session_resc_alloc(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -559,7 +559,7 @@ tf_msg_session_resc_alloc(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Alloc message size error, rc:%s\n", tf_dir_2_str(dir), - strerror(EINVAL)); + rte_strerror(EINVAL)); rc = -EINVAL; goto cleanup; } @@ -605,7 +605,7 @@ tf_msg_session_resc_info(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -616,7 +616,7 @@ tf_msg_session_resc_info(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -666,7 +666,7 @@ tf_msg_session_resc_info(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Alloc message size error, rc:%s\n", tf_dir_2_str(dir), - strerror(EINVAL)); + rte_strerror(EINVAL)); rc = -EINVAL; goto cleanup; } @@ -712,7 +712,7 @@ tf_msg_session_resc_flush(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -722,7 +722,7 @@ tf_msg_session_resc_flush(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -731,7 +731,7 @@ tf_msg_session_resc_flush(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -797,7 +797,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -807,7 +807,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -816,7 +816,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -830,7 +830,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Invalid parameters for msg type, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -893,7 +893,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -903,7 +903,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -912,7 +912,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -927,7 +927,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Record size to large, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -982,7 +982,7 @@ tf_msg_delete_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -992,7 +992,7 @@ tf_msg_delete_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1001,7 +1001,7 @@ tf_msg_delete_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1050,7 +1050,7 @@ tf_msg_move_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1060,7 +1060,7 @@ tf_msg_move_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1069,7 +1069,7 @@ tf_msg_move_em_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1120,7 +1120,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1129,7 +1129,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } /* Retrieve the session information */ @@ -1149,7 +1149,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp, rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms); if (rc) { TFP_DRV_LOG(ERR, "Failed ext_em_alloc error rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1180,7 +1180,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1189,7 +1189,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } /* Retrieve the session information */ @@ -1231,7 +1231,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1240,7 +1240,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } fw_se_id = tfs->session_id.internal.fw_session_id; @@ -1284,7 +1284,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1293,7 +1293,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1334,7 +1334,7 @@ tf_msg_em_qcaps(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } fw_se_id = tfs->session_id.internal.fw_session_id; @@ -1345,7 +1345,7 @@ tf_msg_em_qcaps(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1401,7 +1401,7 @@ tf_msg_em_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1411,7 +1411,7 @@ tf_msg_em_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1465,7 +1465,7 @@ tf_msg_ext_em_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1475,7 +1475,7 @@ tf_msg_ext_em_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } fw_se_id = tfs->session_id.internal.fw_session_id; @@ -1534,7 +1534,7 @@ tf_msg_em_op(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1544,7 +1544,7 @@ tf_msg_em_op(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1585,7 +1585,7 @@ tf_msg_tcam_entry_set(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1594,7 +1594,7 @@ tf_msg_tcam_entry_set(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1664,7 +1664,7 @@ tf_msg_tcam_entry_get(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1673,7 +1673,7 @@ tf_msg_tcam_entry_get(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1705,7 +1705,7 @@ tf_msg_tcam_entry_get(struct tf *tfp, tf_dir_2_str(parms->dir), parms->key_size, resp.key_size, - strerror(-rc)); + rte_strerror(-rc)); return rc; } parms->key_size = resp.key_size; @@ -1734,7 +1734,7 @@ tf_msg_tcam_entry_free(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1743,7 +1743,7 @@ tf_msg_tcam_entry_free(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(in_parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1793,7 +1793,7 @@ tf_msg_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1803,7 +1803,7 @@ tf_msg_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1812,7 +1812,7 @@ tf_msg_set_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1877,7 +1877,7 @@ tf_msg_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1887,7 +1887,7 @@ tf_msg_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1896,7 +1896,7 @@ tf_msg_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } flags = (dir == TF_DIR_TX ? @@ -1964,7 +1964,7 @@ tf_msg_get_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1974,7 +1974,7 @@ tf_msg_get_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1983,7 +1983,7 @@ tf_msg_get_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2043,7 +2043,7 @@ tf_msg_set_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2053,7 +2053,7 @@ tf_msg_set_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2062,7 +2062,7 @@ tf_msg_set_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2082,7 +2082,7 @@ tf_msg_set_global_cfg(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Invalid parameters for msg type, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2140,7 +2140,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2150,7 +2150,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2159,7 +2159,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } flags = (dir == TF_DIR_TX ? @@ -2217,7 +2217,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2227,7 +2227,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2278,7 +2278,7 @@ tf_msg_set_if_tbl_entry(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2366,7 +2366,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state) if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2375,7 +2375,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state) if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2383,7 +2383,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state) if (rc) { TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2421,7 +2421,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2430,7 +2430,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -2438,7 +2438,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c index 9b85f5397d..05d05befaa 100644 --- a/drivers/net/bnxt/tf_core/tf_rm.c +++ b/drivers/net/bnxt/tf_core/tf_rm.c @@ -1059,7 +1059,7 @@ tf_rm_get_pool(struct tf_rm_new_db *rm_db, "%s: Invalid pool for this type:%d, rc:%s\n", tf_dir_2_str(rm_db->dir), tmp_subtype, - strerror(-rc)); + rte_strerror(-rc)); return rc; } *new_subtype = tmp_subtype; @@ -1106,7 +1106,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms) TFP_DRV_LOG(ERR, "%s: Allocation failed, rc:%s\n", tf_dir_2_str(rm_db->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1120,7 +1120,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms) TFP_DRV_LOG(ERR, "%s: Alloc adjust of base index failed, rc:%s\n", tf_dir_2_str(rm_db->dir), - strerror(-rc)); + rte_strerror(-rc)); return -EINVAL; } diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c index 253d716572..a1f9848aed 100644 --- a/drivers/net/bnxt/tf_core/tf_session.c +++ b/drivers/net/bnxt/tf_core/tf_session.c @@ -78,11 +78,11 @@ tf_session_create(struct tf *tfp, if (rc == -EEXIST) TFP_DRV_LOG(ERR, "Session is already open, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); else TFP_DRV_LOG(ERR, "Open message send failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); parms->open_cfg->session_id.id = TF_FW_SESSION_ID_INVALID; return rc; @@ -97,7 +97,7 @@ tf_session_create(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate session info, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup; } tfp->session = (struct tf_session_info *)cparms.mem_va; @@ -111,7 +111,7 @@ tf_session_create(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate session data, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup; } tfp->session->core_data = cparms.mem_va; @@ -154,7 +154,7 @@ tf_session_create(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate session client, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup; } client = cparms.mem_va; @@ -226,7 +226,7 @@ tf_session_create(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "FW Session close failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } if (tfp->session) { tfp_free(tfp->session->core_data); @@ -268,7 +268,7 @@ tf_session_client_create(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -289,7 +289,7 @@ tf_session_client_create(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to create client on session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -303,7 +303,7 @@ tf_session_client_create(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to allocate session client, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); goto cleanup; } client = cparms.mem_va; @@ -320,7 +320,7 @@ tf_session_client_create(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Session Firmware id lookup failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -373,7 +373,7 @@ tf_session_client_destroy(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -405,7 +405,7 @@ tf_session_client_destroy(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Client destroy on FW Failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } ll_delete(&tfs->client_ll, &client->ll_entry); @@ -435,7 +435,7 @@ tf_session_open_session(struct tf *tfp, TFP_DRV_LOG(ERR, "Failed to create session, ctrl_chan_name:%s, rc:%s\n", parms->open_cfg->ctrl_chan_name, - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -457,7 +457,7 @@ tf_session_open_session(struct tf *tfp, TFP_DRV_LOG(ERR, "Failed to create client on session 0x%x, rc:%s\n", parms->open_cfg->session_id.id, - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -480,7 +480,7 @@ tf_session_attach_session(struct tf *tfp __rte_unused, TFP_DRV_LOG(ERR, "Attach not yet supported, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -503,7 +503,7 @@ tf_session_close_session(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Session lookup failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -511,7 +511,7 @@ tf_session_close_session(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Invalid session id, unable to close, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -531,7 +531,7 @@ tf_session_close_session(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Client not part of the session, unable to close, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -556,7 +556,7 @@ tf_session_close_session(struct tf *tfp, TFP_DRV_LOG(ERR, "Failed to unregister Client %d, rc:%s\n", client->session_client_id.id, - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -576,7 +576,7 @@ tf_session_close_session(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Device lookup failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -586,7 +586,7 @@ tf_session_close_session(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -596,7 +596,7 @@ tf_session_close_session(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "Device unbind failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } rc = tf_msg_session_close(tfp, fw_session_id, mailbox); @@ -604,7 +604,7 @@ tf_session_close_session(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "FW Session close failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } /* Final cleanup as we're last user of the session thus we @@ -658,7 +658,7 @@ tf_session_get_session_internal(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Session not created, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -689,7 +689,7 @@ tf_session_get_session(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Internal FID lookup\n, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -698,7 +698,7 @@ tf_session_get_session(struct tf *tfp, TFP_DRV_LOG (ERR, "Ctrl channel not registered with session\n, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return -EINVAL; } @@ -810,7 +810,7 @@ tf_session_get_fw_session_id(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Session not created, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -818,7 +818,7 @@ tf_session_get_fw_session_id(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Invalid Argument(s), rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -842,7 +842,7 @@ tf_session_get_session_id(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Session not created, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -850,7 +850,7 @@ tf_session_get_session_id(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Invalid Argument(s), rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1152,7 +1152,7 @@ tf_session_set_hotup_state(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Session lookup failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1160,7 +1160,7 @@ tf_session_set_hotup_state(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Only shared session able to set state, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1169,7 +1169,7 @@ tf_session_set_hotup_state(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "Set session hot upgrade state failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } return rc; @@ -1186,7 +1186,7 @@ tf_session_get_hotup_state(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Session lookup failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1194,7 +1194,7 @@ tf_session_get_hotup_state(struct tf *tfp, rc = -EINVAL; TFP_DRV_LOG(ERR, "Only shared session able to get state, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -1203,7 +1203,7 @@ tf_session_get_hotup_state(struct tf *tfp, /* Log error */ TFP_DRV_LOG(ERR, "Get session hot upgrade state failed, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); } return rc; diff --git a/drivers/net/bnxt/tf_core/tf_sram_mgr.c b/drivers/net/bnxt/tf_core/tf_sram_mgr.c index 87e8882fed..afbc3a3e46 100644 --- a/drivers/net/bnxt/tf_core/tf_sram_mgr.c +++ b/drivers/net/bnxt/tf_core/tf_sram_mgr.c @@ -494,7 +494,7 @@ static struct tf_sram_block /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate block, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return NULL; } block = (struct tf_sram_block *)cparms.mem_va; @@ -588,7 +588,7 @@ tf_sram_mgr_bind(void **sram_handle) /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate SRAM mgmt data, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } sram = (struct tf_sram *)cparms.mem_va; @@ -628,7 +628,7 @@ tf_sram_mgr_unbind(void *sram_handle) /* Log error */ TFP_DRV_LOG(ERR, "No SRAM slice list, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } if (tf_sram_get_block_cnt(slice_list)) @@ -670,7 +670,7 @@ int tf_sram_mgr_alloc(void *sram_handle, /* Log error */ TFP_DRV_LOG(ERR, "No SRAM slice list, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -759,7 +759,7 @@ tf_sram_mgr_free(void *sram_handle, /* Log error */ TFP_DRV_LOG(ERR, "No SRAM slice list, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -781,7 +781,7 @@ tf_sram_mgr_free(void *sram_handle, rc = tf_sram_free_slice(parms->slice_size, slice_offset, block, &block_is_empty); if (rc) { - TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", strerror(-rc)); + TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", rte_strerror(-rc)); return rc; } #if (STATS_CLEAR_ON_READ_SUPPORT == 0) @@ -805,7 +805,7 @@ tf_sram_mgr_free(void *sram_handle, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->tbl_type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } /* Clear the counter @@ -821,7 +821,7 @@ tf_sram_mgr_free(void *sram_handle, "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->tbl_type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } @@ -836,14 +836,14 @@ tf_sram_mgr_free(void *sram_handle, if (rc) { TFP_DRV_LOG(ERR, "Free block_id(%d) failed error(%s)\n", - block_id, strerror(-rc)); + block_id, rte_strerror(-rc)); } fparms.index = block_id + 1; rc = tf_rm_free(&fparms); if (rc) { TFP_DRV_LOG(ERR, "Free next block_id(%d) failed error(%s)\n", - block_id + 1, strerror(-rc)); + block_id + 1, rte_strerror(-rc)); } /* Free local entry regardless */ tf_sram_free_block(slice_list, block); @@ -937,7 +937,7 @@ int tf_sram_mgr_is_allocated(void *sram_handle, /* Log error */ TFP_DRV_LOG(ERR, "No SRAM slice list, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c index f5f3889934..0fbcba6c76 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_tbl.c @@ -45,7 +45,7 @@ tf_tbl_bind(struct tf *tfp, cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { TFP_DRV_LOG(ERR, "tbl_rm_db alloc error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } @@ -143,7 +143,7 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get tbl_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -195,7 +195,7 @@ tf_tbl_free(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -234,7 +234,7 @@ tf_tbl_free(struct tf *tfp __rte_unused, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } /* Clear the counter @@ -250,7 +250,7 @@ tf_tbl_free(struct tf *tfp __rte_unused, "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } } @@ -302,7 +302,7 @@ tf_tbl_set(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -341,7 +341,7 @@ tf_tbl_set(struct tf *tfp, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -356,7 +356,7 @@ tf_tbl_set(struct tf *tfp, "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -393,7 +393,7 @@ tf_tbl_get(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -432,7 +432,7 @@ tf_tbl_get(struct tf *tfp, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -449,7 +449,7 @@ tf_tbl_get(struct tf *tfp, "%s, Get failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -485,7 +485,7 @@ tf_tbl_bulk_get(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -517,7 +517,7 @@ tf_tbl_bulk_get(struct tf *tfp, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -535,7 +535,7 @@ tf_tbl_bulk_get(struct tf *tfp, "%s, Bulk get failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); } return rc; diff --git a/drivers/net/bnxt/tf_core/tf_tbl_sram.c b/drivers/net/bnxt/tf_core/tf_tbl_sram.c index 3a6f1c68c7..39dbe11610 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl_sram.c +++ b/drivers/net/bnxt/tf_core/tf_tbl_sram.c @@ -114,7 +114,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms) "%s: Failed to get hcapi_type %s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->tbl_type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } parms->bank_id = tf_tbl_sram_hcapi_2_bank[hcapi_type]; @@ -129,7 +129,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms) "%s: Failed to get slice cnt %s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->tbl_type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } if (slices) @@ -168,7 +168,7 @@ tf_tbl_sram_unbind(struct tf *tfp __rte_unused) if (rc) { TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } if (sram_handle) @@ -204,7 +204,7 @@ tf_tbl_sram_alloc(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get tbl_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -214,7 +214,7 @@ tf_tbl_sram_alloc(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -290,7 +290,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -299,7 +299,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -345,7 +345,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused, tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), parms->idx, - strerror(-rc)); + rte_strerror(-rc)); rc = -ENOMEM; return rc; } @@ -417,7 +417,7 @@ tf_tbl_sram_set(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -426,7 +426,7 @@ tf_tbl_sram_set(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -489,7 +489,7 @@ tf_tbl_sram_set(struct tf *tfp, tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), parms->idx, - strerror(-rc)); + rte_strerror(-rc)); rc = -ENOMEM; return rc; } @@ -504,7 +504,7 @@ tf_tbl_sram_set(struct tf *tfp, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -519,7 +519,7 @@ tf_tbl_sram_set(struct tf *tfp, "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } return rc; @@ -553,7 +553,7 @@ tf_tbl_sram_get(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -562,7 +562,7 @@ tf_tbl_sram_get(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -592,7 +592,7 @@ tf_tbl_sram_get(struct tf *tfp, tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), parms->idx, - strerror(-rc)); + rte_strerror(-rc)); rc = -ENOMEM; return rc; } @@ -607,7 +607,7 @@ tf_tbl_sram_get(struct tf *tfp, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } if (parms->type == TF_TBL_TYPE_ACT_STATS_64) @@ -626,7 +626,7 @@ tf_tbl_sram_get(struct tf *tfp, "%s, Get failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } return rc; @@ -661,7 +661,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -670,7 +670,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -703,7 +703,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp, tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), parms->starting_idx, - strerror(-rc)); + rte_strerror(-rc)); rc = -ENOMEM; return rc; } @@ -716,7 +716,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp, tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), idx, - strerror(-rc)); + rte_strerror(-rc)); rc = -ENOMEM; return rc; } @@ -730,7 +730,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -751,7 +751,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp, "%s, Bulk get failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + rte_strerror(-rc)); } return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c index 9e0671d47b..5924c5e6c1 100644 --- a/drivers/net/bnxt/tf_core/tf_tcam.c +++ b/drivers/net/bnxt/tf_core/tf_tcam.c @@ -57,7 +57,7 @@ tf_tcam_bind(struct tf *tfp, rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -91,7 +91,7 @@ tf_tcam_bind(struct tf *tfp, cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { TFP_DRV_LOG(ERR, "tcam_rm_db alloc error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } @@ -301,7 +301,7 @@ tf_tcam_alloc(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -320,7 +320,7 @@ tf_tcam_alloc(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get tcam_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr; @@ -385,7 +385,7 @@ tf_tcam_free(struct tf *tfp, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -417,7 +417,7 @@ tf_tcam_free(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr; @@ -477,7 +477,7 @@ tf_tcam_free(struct tf *tfp, tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx, - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -515,7 +515,7 @@ tf_tcam_set(struct tf *tfp __rte_unused, TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + rte_strerror(-rc)); return rc; } @@ -535,7 +535,7 @@ tf_tcam_set(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr; @@ -579,7 +579,7 @@ tf_tcam_set(struct tf *tfp __rte_unused, tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx, - strerror(-rc)); + rte_strerror(-rc)); return rc; } return 0; @@ -618,7 +618,7 @@ tf_tcam_get(struct tf *tfp __rte_unused, if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + rte_strerror(-rc)); return rc; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr; @@ -662,7 +662,7 @@ tf_tcam_get(struct tf *tfp __rte_unused, tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx, - strerror(-rc)); + rte_strerror(-rc)); return rc; } From patchwork Tue Nov 14 08:25:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134211 X-Patchwork-Delegate: thomas@monjalon.net 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 A740443325; Tue, 14 Nov 2023 09:28:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD478410F2; Tue, 14 Nov 2023 09:26:10 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 04170402CD for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmx5Mv3z1P8Mc; Tue, 14 Nov 2023 16:22:25 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:43 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 23/43] net/af_xdp: use rte strerror Date: Tue, 14 Nov 2023 16:25:19 +0800 Message-ID: <20231114082539.1858594-24-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 353c8688ec..087b6e33db 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1165,7 +1165,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, &rxq->fq, &rxq->cq, &usr_config); if (ret) { AF_XDP_LOG(ERR, "Failed to create umem [%d]: [%s]\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); goto err; } umem->buffer = base_addr; @@ -1367,7 +1367,7 @@ init_uds_sock(struct sockaddr_un *server) if (connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr_un)) < 0) { close(sock); AF_XDP_LOG(ERR, "Error connecting stream socket errno = [%d]: [%s]\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1451,7 +1451,7 @@ read_msg(int sock, char *response, struct sockaddr_un *s, int *fd) return 0; if (msglen < 0) { - AF_XDP_LOG(ERR, "recvmsg failed, %s\n", strerror(errno)); + AF_XDP_LOG(ERR, "recvmsg failed, %s\n", rte_strerror(errno)); return -1; } @@ -1486,7 +1486,7 @@ make_request_cni(int sock, struct sockaddr_un *server, char *request, rval = send_msg(sock, request, req_fd); if (rval < 0) { - AF_XDP_LOG(ERR, "Write error %s\n", strerror(errno)); + AF_XDP_LOG(ERR, "Write error %s\n", rte_strerror(errno)); return -1; } @@ -1970,7 +1970,7 @@ parse_prog_arg(const char *key __rte_unused, if (access(value, F_OK) != 0) { AF_XDP_LOG(ERR, "Error accessing %s: %s\n", - value, strerror(errno)); + value, rte_strerror(errno)); return -EINVAL; } @@ -2421,7 +2421,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev) ret = rte_mp_action_register(ETH_AF_XDP_MP_KEY, afxdp_mp_send_fds); if (ret < 0 && rte_errno != ENOTSUP) { AF_XDP_LOG(ERR, "%s: Failed to register multi-process IPC callback: %s\n", - name, strerror(rte_errno)); + name, rte_strerror(rte_errno)); return -1; } } From patchwork Tue Nov 14 08:25:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134216 X-Patchwork-Delegate: thomas@monjalon.net 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 4B4EE43325; Tue, 14 Nov 2023 09:28:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77BB040DD8; Tue, 14 Nov 2023 09:26:16 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 6379740648 for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4STzlT2YWVzMmtL; Tue, 14 Nov 2023 16:21:09 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:43 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 24/43] net/bonding: use rte strerror Date: Tue, 14 Nov 2023 16:25:20 +0800 Message-ID: <20231114082539.1858594-25-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/bonding/bonding_testpmd.c | 4 ++-- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_flow.c | 4 ++-- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c index 8fcd6cadd0..111f9de0e7 100644 --- a/drivers/net/bonding/bonding_testpmd.c +++ b/drivers/net/bonding/bonding_testpmd.c @@ -551,7 +551,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result, /* check the return value and print it if is < 0 */ if (ret < 0) fprintf(stderr, "set_bond_mac_addr error: (%s)\n", - strerror(-ret)); + rte_strerror(-ret)); } static cmdline_parse_token_string_t cmd_set_bond_mac_addr_set = @@ -604,7 +604,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result, /* check the return value and print it if is < 0 */ if (ret < 0) fprintf(stderr, "set_bond_mac_addr error: (%s)\n", - strerror(-ret)); + rte_strerror(-ret)); } static cmdline_parse_token_string_t cmd_set_bond_mon_period_set = diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 99e496556a..1d20d421bc 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -483,7 +483,7 @@ __eth_bond_member_add_lock_free(uint16_t bonding_port_id, uint16_t member_port_i if (ret != 0) { RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s\n", - __func__, member_port_id, strerror(-ret)); + __func__, member_port_id, rte_strerror(-ret)); return ret; } diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c index 71a91675f7..b7e966f393 100644 --- a/drivers/net/bonding/rte_eth_bond_flow.c +++ b/drivers/net/bonding/rte_eth_bond_flow.c @@ -31,7 +31,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr, if (ret < 0) { RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s", error.message ? error.message : "unspecified", - strerror(rte_errno)); + rte_strerror(rte_errno)); return NULL; } flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret, @@ -45,7 +45,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr, if (ret < 0) { RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s", error.message ? error.message : "unspecified", - strerror(rte_errno)); + rte_strerror(rte_errno)); rte_free(flow); return NULL; } diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index c40d18d128..fdf152a51a 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -192,7 +192,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev, if (ret != 0) { RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s\n", - __func__, member_port, strerror(-ret)); + __func__, member_port, rte_strerror(-ret)); return ret; } @@ -223,7 +223,7 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) { RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s\n", __func__, bond_dev->data->port_id, - strerror(-ret)); + rte_strerror(-ret)); return ret; } @@ -2292,7 +2292,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) "%s: Error during getting device (port %u) info: %s\n", __func__, member.port_id, - strerror(-ret)); + rte_strerror(-ret)); return ret; } From patchwork Tue Nov 14 08:25:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134213 X-Patchwork-Delegate: thomas@monjalon.net 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 1E69D43325; Tue, 14 Nov 2023 09:28:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DEBF4111C; Tue, 14 Nov 2023 09:26:13 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 4FC3A40647 for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4STzmx2C2dzrVDy; Tue, 14 Nov 2023 16:22:25 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:44 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 25/43] net/dpaa: use rte strerror Date: Tue, 14 Nov 2023 16:25:21 +0800 Message-ID: <20231114082539.1858594-26-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/dpaa/dpaa_ethdev.c | 4 ++-- drivers/net/dpaa/fmlib/fm_lib.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index ef4c06db6a..214627986f 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1080,7 +1080,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, ret = qman_init_fq(rxq, flags, &opts); if (ret) { DPAA_PMD_ERR("Channel/Q association failed. fqid 0x%x " - "ret:%d(%s)", rxq->fqid, ret, strerror(ret)); + "ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret)); return ret; } if (dpaa_svr_family == SVR_LS1043A_FAMILY) { @@ -1210,7 +1210,7 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev, ret = qman_init_fq(rxq, flags, &opts); if (ret) { DPAA_PMD_ERR("Ev-Channel/Q association failed. fqid 0x%x " - "ret:%d(%s)", rxq->fqid, ret, strerror(ret)); + "ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret)); return ret; } diff --git a/drivers/net/dpaa/fmlib/fm_lib.c b/drivers/net/dpaa/fmlib/fm_lib.c index 1d6816050c..d4382d7065 100644 --- a/drivers/net/dpaa/fmlib/fm_lib.c +++ b/drivers/net/dpaa/fmlib/fm_lib.c @@ -103,7 +103,7 @@ fm_get_api_version(t_handle h_fm, ioc_fm_api_version_t *p_version) ret = ioctl(p_dev->fd, FM_IOC_GET_API_VERSION, p_version); if (ret) { DPAA_PMD_ERR("cannot get API version, error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } _fml_dbg("Finishing.\n"); @@ -276,7 +276,7 @@ fm_pcd_kg_scheme_set(t_handle h_fm_pcd, ret = ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_SET, params); if (ret) { DPAA_PMD_ERR(" cannot set kg scheme, error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); return NULL; } @@ -310,7 +310,7 @@ fm_pcd_kg_scheme_delete(t_handle h_scheme) if (ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_DELETE, &id)) { DPAA_PMD_WARN("cannot delete kg scheme, error %i (%s)\n", - errno, strerror(errno)); + errno, rte_strerror(errno)); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } From patchwork Tue Nov 14 08:25:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134212 X-Patchwork-Delegate: thomas@monjalon.net 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 234E943325; Tue, 14 Nov 2023 09:28:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04A08410FD; Tue, 14 Nov 2023 09:26:12 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 796AA4027B for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrM0CR0zWhL7; Tue, 14 Nov 2023 16:25:23 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:44 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 26/43] net/dpaa2: use rte strerror Date: Tue, 14 Nov 2023 16:25:22 +0800 Message-ID: <20231114082539.1858594-27-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 8e610b6bba..48f1a2fafb 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1166,7 +1166,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable) irq_index, mask); if (err < 0) { DPAA2_PMD_ERR("Error: dpni_set_irq_mask():%d (%s)", err, - strerror(-err)); + rte_strerror(-err)); return err; } @@ -1174,7 +1174,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable) irq_index, enable); if (err < 0) DPAA2_PMD_ERR("Error: dpni_set_irq_enable():%d (%s)", err, - strerror(-err)); + rte_strerror(-err)); return err; } From patchwork Tue Nov 14 08:25:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134210 X-Patchwork-Delegate: thomas@monjalon.net 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 BDBB843325; Tue, 14 Nov 2023 09:28:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BC95410E4; Tue, 14 Nov 2023 09:26:09 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 213F5402F2 for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzlw4Hw3zPpHp; Tue, 14 Nov 2023 16:21:32 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:44 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 27/43] net/enetfec: use rte strerror Date: Tue, 14 Nov 2023 16:25:23 +0800 Message-ID: <20231114082539.1858594-28-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/enetfec/enet_uio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/enetfec/enet_uio.c b/drivers/net/enetfec/enet_uio.c index 6539cbb354..93520e9760 100644 --- a/drivers/net/enetfec/enet_uio.c +++ b/drivers/net/enetfec/enet_uio.c @@ -231,7 +231,7 @@ enetfec_configure(void) d = opendir(FEC_UIO_DEVICE_SYS_ATTR_PATH); if (d == NULL) { ENETFEC_PMD_ERR("\nError opening directory '%s': %s\n", - FEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno)); + FEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno)); return -1; } From patchwork Tue Nov 14 08:25:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134215 X-Patchwork-Delegate: thomas@monjalon.net 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 338F643325; Tue, 14 Nov 2023 09:28:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64E8041140; Tue, 14 Nov 2023 09:26:15 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 4C561402BD for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmy3kK5z1P8J5; Tue, 14 Nov 2023 16:22:26 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:44 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 28/43] net/failsafe: use rte strerror Date: Tue, 14 Nov 2023 16:25:24 +0800 Message-ID: <20231114082539.1858594-29-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/failsafe/failsafe.c | 8 ++++---- drivers/net/failsafe/failsafe_args.c | 4 ++-- drivers/net/failsafe/failsafe_eal.c | 4 ++-- drivers/net/failsafe/failsafe_flow.c | 4 ++-- drivers/net/failsafe/failsafe_ops.c | 2 +- drivers/net/failsafe/failsafe_private.h | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 32811403b4..f89c946ce4 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -92,7 +92,7 @@ failsafe_hotplug_alarm_cancel(struct rte_eth_dev *dev) rte_eal_alarm_cancel(fs_hotplug_alarm, dev); if (rte_errno) { ERROR("rte_eal_alarm_cancel failed (errno: %s)", - strerror(rte_errno)); + rte_strerror(rte_errno)); ret = -rte_errno; } else { PRIV(dev)->pending_alarm = 0; @@ -138,18 +138,18 @@ fs_mutex_init(struct fs_priv *priv) ret = pthread_mutexattr_init(&attr); if (ret) { - ERROR("Cannot initiate mutex attributes - %s", strerror(ret)); + ERROR("Cannot initiate mutex attributes - %s", rte_strerror(ret)); return ret; } /* Allow mutex relocks for the thread holding the mutex. */ ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); if (ret) { - ERROR("Cannot set mutex type - %s", strerror(ret)); + ERROR("Cannot set mutex type - %s", rte_strerror(ret)); return ret; } ret = pthread_mutex_init(&priv->hotplug_mutex, &attr); if (ret) { - ERROR("Cannot initiate mutex - %s", strerror(ret)); + ERROR("Cannot initiate mutex - %s", rte_strerror(ret)); return ret; } return 0; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index b203e02d9a..77169b7bbe 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -112,7 +112,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) fp = popen(sdev->cmdline, "r"); if (fp == NULL) { ret = -errno; - ERROR("popen: %s", strerror(errno)); + ERROR("popen: %s", rte_strerror(errno)); return ret; } /* We only read one line */ @@ -131,7 +131,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) ERROR("Parsing device '%s' failed", output); ret_pclose: if (pclose(fp) == -1) - ERROR("pclose: %s", strerror(errno)); + ERROR("pclose: %s", rte_strerror(errno)); return ret; } diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index d71b512f81..b06579692a 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -52,7 +52,7 @@ fs_bus_init(struct rte_eth_dev *dev) if (ret < 0) { ERROR("sub_device %d probe failed %s%s%s", i, rte_errno ? "(" : "", - rte_errno ? strerror(rte_errno) : "", + rte_errno ? rte_strerror(rte_errno) : "", rte_errno ? ")" : ""); continue; } @@ -100,7 +100,7 @@ fs_bus_init(struct rte_eth_dev *dev) ret = rte_eth_dev_owner_set(pid, &PRIV(dev)->my_owner); if (ret < 0) { INFO("sub_device %d owner set failed (%s), " - "will try again later", i, strerror(-ret)); + "will try again later", i, rte_strerror(-ret)); continue; } else if (strncmp(rte_eth_devices[pid].device->name, da->name, strlen(da->name)) != 0) { diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c index 707e6c63b5..5d17182cc5 100644 --- a/drivers/net/failsafe/failsafe_flow.c +++ b/drivers/net/failsafe/failsafe_flow.c @@ -33,7 +33,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr, if (ret < 0) { ERROR("Unable to process flow rule (%s): %s", error.message ? error.message : "unspecified", - strerror(rte_errno)); + rte_strerror(rte_errno)); return NULL; } flow = rte_zmalloc(NULL, offsetof(struct rte_flow, rule) + ret, @@ -47,7 +47,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr, if (ret < 0) { ERROR("Failed to copy flow rule (%s): %s", error.message ? error.message : "unspecified", - strerror(rte_errno)); + rte_strerror(rte_errno)); rte_free(flow); return NULL; } diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 35649b6244..40bea1d6bf 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -452,7 +452,7 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, #ifdef RTE_EXEC_ENV_LINUX rxq->event_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (rxq->event_fd < 0) { - ERROR("Failed to create an eventfd: %s", strerror(errno)); + ERROR("Failed to create an eventfd: %s", rte_strerror(errno)); fs_unlock(dev, 0); return -errno; } diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 53a451c1b1..5961222400 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -410,14 +410,14 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm) ret = pthread_mutex_trylock(&PRIV(dev)->hotplug_mutex); if (ret) { DEBUG("Hot-plug mutex lock trying failed(%s), will try" - " again later...", strerror(ret)); + " again later...", rte_strerror(ret)); return ret; } PRIV(dev)->alarm_lock = 1; } else { ret = pthread_mutex_lock(&PRIV(dev)->hotplug_mutex); if (ret) { - ERROR("Cannot lock mutex(%s)", strerror(ret)); + ERROR("Cannot lock mutex(%s)", rte_strerror(ret)); return ret; } } @@ -439,7 +439,7 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm) } ret = pthread_mutex_unlock(&PRIV(dev)->hotplug_mutex); if (ret) - ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret)); + ERROR("Cannot unlock hot-plug mutex(%s)", rte_strerror(ret)); } /* From patchwork Tue Nov 14 08:25:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134217 X-Patchwork-Delegate: thomas@monjalon.net 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 F158E43325; Tue, 14 Nov 2023 09:28:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 80E674114B; Tue, 14 Nov 2023 09:26:17 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id E475A402CD for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4STzmx6XRgzrVCs; Tue, 14 Nov 2023 16:22:25 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:44 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 29/43] net/i40e: use rte strerror Date: Tue, 14 Nov 2023 16:25:25 +0800 Message-ID: <20231114082539.1858594-30-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/i40e/i40e_testpmd.c | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c index b6ef5d6e42..d0995531bc 100644 --- a/drivers/net/i40e/i40e_testpmd.c +++ b/drivers/net/i40e/i40e_testpmd.c @@ -53,7 +53,7 @@ cmd_queue_region_parsed(void *parsed_result, break; default: fprintf(stderr, "queue region config error: (%s)\n", - strerror(-ret)); + rte_strerror(-ret)); } } @@ -148,7 +148,7 @@ cmd_region_flowtype_parsed(void *parsed_result, break; default: fprintf(stderr, "region flowtype config error: (%s)\n", - strerror(-ret)); + rte_strerror(-ret)); } } @@ -233,7 +233,7 @@ cmd_user_priority_region_parsed(void *parsed_result, break; default: fprintf(stderr, "user_priority region config error: (%s)\n", - strerror(-ret)); + rte_strerror(-ret)); } } @@ -320,7 +320,7 @@ cmd_flush_queue_region_parsed(void *parsed_result, break; default: fprintf(stderr, "queue region config flush error: (%s)\n", - strerror(-ret)); + rte_strerror(-ret)); } } @@ -433,7 +433,7 @@ cmd_show_queue_region_info_parsed(void *parsed_result, break; default: fprintf(stderr, "queue region config info show error: (%s)\n", - strerror(-ret)); + rte_strerror(-ret)); } } @@ -536,7 +536,7 @@ cmd_flow_director_filter_parsed(void *parsed_result, add); if (ret < 0) fprintf(stderr, "flow director config error: (%s)\n", - strerror(-ret)); + rte_strerror(-ret)); close_file(conf.input.packet); } @@ -666,7 +666,7 @@ cmd_set_vf_promisc_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -745,7 +745,7 @@ cmd_set_vf_allmulti_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -825,7 +825,7 @@ cmd_set_vf_broadcast_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -908,7 +908,7 @@ cmd_set_vf_vlan_tag_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -1013,7 +1013,7 @@ cmd_vf_max_bw_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -1108,7 +1108,7 @@ cmd_vf_tc_min_bw_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -1158,7 +1158,7 @@ cmd_vf_tc_max_bw_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -1207,7 +1207,7 @@ cmd_strict_link_prio_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -1928,7 +1928,7 @@ cmd_pctype_mapping_reset_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -2000,7 +2000,7 @@ cmd_pctype_mapping_get_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); return; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); return; } @@ -2111,7 +2111,7 @@ cmd_pctype_mapping_update_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -2191,7 +2191,7 @@ cmd_ptype_mapping_get_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } if (!ret) { @@ -2280,7 +2280,7 @@ cmd_ptype_mapping_replace_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -2347,7 +2347,7 @@ cmd_ptype_mapping_reset_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -2427,7 +2427,7 @@ cmd_ptype_mapping_update_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } From patchwork Tue Nov 14 08:25:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134214 X-Patchwork-Delegate: thomas@monjalon.net 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 7E7DB43325; Tue, 14 Nov 2023 09:28:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A81340DFB; Tue, 14 Nov 2023 09:26:14 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 96ADC4064C for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzlx0JfBzPpJy; Tue, 14 Nov 2023 16:21:33 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:44 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 30/43] net/ice: use rte strerror Date: Tue, 14 Nov 2023 16:25:26 +0800 Message-ID: <20231114082539.1858594-31-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/ice/ice_testpmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_testpmd.c b/drivers/net/ice/ice_testpmd.c index a7a8d0c53c..e1392059e0 100644 --- a/drivers/net/ice/ice_testpmd.c +++ b/drivers/net/ice/ice_testpmd.c @@ -60,7 +60,7 @@ cmd_ddp_dump_parsed(void *parsed_result, default: fprintf(stderr, "Failed to dump DDP runtime configure," - " error: (%s)\n", strerror(-ret)); + " error: (%s)\n", rte_strerror(-ret)); } } free(buff); @@ -127,7 +127,7 @@ cmd_ddp_dump_switch_parsed(void *parsed_result, default: fprintf(stderr, "Failed to dump DDP switch runtime configure," - " error: (%s)\n", strerror(-ret)); + " error: (%s)\n", rte_strerror(-ret)); } } free(buff); From patchwork Tue Nov 14 08:25:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134218 X-Patchwork-Delegate: thomas@monjalon.net 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 E24A843325; Tue, 14 Nov 2023 09:28:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 913D4415D7; Tue, 14 Nov 2023 09:26:18 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id C37714067B for ; Tue, 14 Nov 2023 09:25:45 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4STzlV2tClzMmSM; Tue, 14 Nov 2023 16:21:10 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:45 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 31/43] net/ixgbe: use rte strerror Date: Tue, 14 Nov 2023 16:25:27 +0800 Message-ID: <20231114082539.1858594-32-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/ixgbe/ixgbe_testpmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_testpmd.c b/drivers/net/ixgbe/ixgbe_testpmd.c index e0d161eafe..3c6d648844 100644 --- a/drivers/net/ixgbe/ixgbe_testpmd.c +++ b/drivers/net/ixgbe/ixgbe_testpmd.c @@ -141,7 +141,7 @@ cmd_set_vf_split_drop_en_parsed(void *parsed_result, fprintf(stderr, "not supported on port %d\n", res->port_id); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -243,7 +243,7 @@ cmd_set_macsec_offload_on_parsed(void *parsed_result, fprintf(stderr, "not supported on port %d\n", port_id); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -327,7 +327,7 @@ cmd_set_macsec_offload_off_parsed(void *parsed_result, fprintf(stderr, "not supported on port %d\n", port_id); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -402,7 +402,7 @@ cmd_set_macsec_sc_parsed(void *parsed_result, fprintf(stderr, "not supported on port %d\n", res->port_id); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -510,7 +510,7 @@ cmd_set_macsec_sa_parsed(void *parsed_result, fprintf(stderr, "not supported on port %d\n", res->port_id); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -599,7 +599,7 @@ cmd_tc_min_bw_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } From patchwork Tue Nov 14 08:25:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134219 X-Patchwork-Delegate: thomas@monjalon.net 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 C56A043325; Tue, 14 Nov 2023 09:28:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5C2C427D7; Tue, 14 Nov 2023 09:26:19 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 710B14027B for ; Tue, 14 Nov 2023 09:25:46 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4STzmy2kmJzrTf6; Tue, 14 Nov 2023 16:22:26 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:45 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 32/43] net/memif: use rte strerror Date: Tue, 14 Nov 2023 16:25:28 +0800 Message-ID: <20231114082539.1858594-33-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/memif/memif_socket.c | 4 ++-- drivers/net/memif/rte_eth_memif.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c index 649f8d0e61..592b71979a 100644 --- a/drivers/net/memif/memif_socket.c +++ b/drivers/net/memif/memif_socket.c @@ -71,7 +71,7 @@ memif_msg_send_from_queue(struct memif_control_channel *cc) size = memif_msg_send(rte_intr_fd_get(cc->intr_handle), &e->msg, e->fd); if (size != sizeof(memif_msg_t)) { - MIF_LOG(ERR, "sendmsg fail: %s.", strerror(errno)); + MIF_LOG(ERR, "sendmsg fail: %s.", rte_strerror(errno)); ret = -1; } else { MIF_LOG(DEBUG, "Sent msg type %u.", e->msg.type); @@ -975,7 +975,7 @@ memif_socket_create(char *key, uint8_t listener, bool is_abstract, uid_t owner_u return sock; error: - MIF_LOG(ERR, "Failed to setup socket %s: %s", key, strerror(errno)); + MIF_LOG(ERR, "Failed to setup socket %s: %s", key, rte_strerror(errno)); if (sock != NULL) { rte_intr_instance_free(sock->intr_handle); rte_free(sock); diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index 7cc8c0da91..f7697394f1 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -805,7 +805,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) sizeof(a)); if (unlikely(size < 0)) { MIF_LOG(WARNING, - "Failed to send interrupt. %s", strerror(errno)); + "Failed to send interrupt. %s", rte_strerror(errno)); } } @@ -960,7 +960,7 @@ eth_memif_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) &a, sizeof(a)); if (unlikely(size < 0)) { MIF_LOG(WARNING, - "Failed to send interrupt. %s", strerror(errno)); + "Failed to send interrupt. %s", rte_strerror(errno)); } } @@ -1082,27 +1082,27 @@ memif_region_init_shm(struct rte_eth_dev *dev, uint8_t has_buffers) r->fd = memfd_create(shm_name, MFD_ALLOW_SEALING); if (r->fd < 0) { - MIF_LOG(ERR, "Failed to create shm file: %s.", strerror(errno)); + MIF_LOG(ERR, "Failed to create shm file: %s.", rte_strerror(errno)); ret = -1; goto error; } ret = fcntl(r->fd, F_ADD_SEALS, F_SEAL_SHRINK); if (ret < 0) { - MIF_LOG(ERR, "Failed to add seals to shm file: %s.", strerror(errno)); + MIF_LOG(ERR, "Failed to add seals to shm file: %s.", rte_strerror(errno)); goto error; } ret = ftruncate(r->fd, r->region_size); if (ret < 0) { - MIF_LOG(ERR, "Failed to truncate shm file: %s.", strerror(errno)); + MIF_LOG(ERR, "Failed to truncate shm file: %s.", rte_strerror(errno)); goto error; } r->addr = mmap(NULL, r->region_size, PROT_READ | PROT_WRITE, MAP_SHARED, r->fd, 0); if (r->addr == MAP_FAILED) { - MIF_LOG(ERR, "Failed to mmap shm region: %s.", strerror(ret)); + MIF_LOG(ERR, "Failed to mmap shm region: %s.", rte_strerror(ret)); ret = -1; goto error; } @@ -1223,7 +1223,7 @@ memif_init_queues(struct rte_eth_dev *dev) if (rte_intr_fd_get(mq->intr_handle) < 0) { MIF_LOG(WARNING, "Failed to create eventfd for tx queue %d: %s.", i, - strerror(errno)); + rte_strerror(errno)); } mq->buffers = NULL; if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) { @@ -1247,7 +1247,7 @@ memif_init_queues(struct rte_eth_dev *dev) if (rte_intr_fd_get(mq->intr_handle) < 0) { MIF_LOG(WARNING, "Failed to create eventfd for rx queue %d: %s.", i, - strerror(errno)); + rte_strerror(errno)); } mq->buffers = NULL; if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) { @@ -1299,7 +1299,7 @@ memif_connect(struct rte_eth_dev *dev) MAP_SHARED, mr->fd, 0); if (mr->addr == MAP_FAILED) { MIF_LOG(ERR, "mmap failed: %s\n", - strerror(errno)); + rte_strerror(errno)); return -1; } } @@ -1983,7 +1983,7 @@ rte_pmd_memif_probe(struct rte_vdev_device *vdev) */ if (ret < 0 && rte_errno != EEXIST) MIF_LOG(WARNING, "Failed to register mp action callback: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); /* use abstract address by default */ flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT; From patchwork Tue Nov 14 08:25:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134222 X-Patchwork-Delegate: thomas@monjalon.net 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 3AE7043325; Tue, 14 Nov 2023 09:29:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD632427E4; Tue, 14 Nov 2023 09:26:22 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id C1343402CD for ; Tue, 14 Nov 2023 09:25:46 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrN0ntGzWhNB; Tue, 14 Nov 2023 16:25:24 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:45 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 33/43] net/mlx4: use rte strerror Date: Tue, 14 Nov 2023 16:25:29 +0800 Message-ID: <20231114082539.1858594-34-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/mlx4/mlx4.c | 14 +++++++------- drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++--------- drivers/net/mlx4/mlx4_rxq.c | 10 +++++----- drivers/net/mlx4/mlx4_txq.c | 10 +++++----- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index a1a7e93288..f06a6fee6e 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -255,7 +255,7 @@ mlx4_dev_configure(struct rte_eth_dev *dev) if (ret) { ERROR("cannot set up internal flow rules (code %d, \"%s\")," " flow error type %d, cause %p, message: %s", - -ret, strerror(-ret), error.type, error.cause, + -ret, rte_strerror(-ret), error.type, error.cause, error.message ? error.message : "(unspecified)"); goto exit; } @@ -302,7 +302,7 @@ mlx4_dev_start(struct rte_eth_dev *dev) ret = mlx4_rss_init(priv); if (ret) { ERROR("%p: cannot initialize RSS resources: %s", - (void *)dev, strerror(-ret)); + (void *)dev, rte_strerror(-ret)); goto err; } #ifdef RTE_LIBRTE_MLX4_DEBUG @@ -319,7 +319,7 @@ mlx4_dev_start(struct rte_eth_dev *dev) ERROR("%p: cannot attach flow rules (code %d, \"%s\")," " flow error type %d, cause %p, message: %s", (void *)dev, - -ret, strerror(-ret), error.type, error.cause, + -ret, rte_strerror(-ret), error.type, error.cause, error.message ? error.message : "(unspecified)"); goto err; } @@ -793,7 +793,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) err = mlx4_init_once(); if (err) { ERROR("unable to init PMD global data: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -rte_errno; } MLX4_ASSERT(pci_drv == &mlx4_driver); @@ -946,7 +946,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) err = mlx4_glue->query_port(ctx, port, &port_attr); if (err) { err = ENODEV; - ERROR("port query failed: %s", strerror(err)); + ERROR("port query failed: %s", rte_strerror(err)); goto port_error; } if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { @@ -963,7 +963,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) err = mlx4_fd_set_non_blocking(ctx->async_fd); if (err) { ERROR("cannot make asynchronous FD non-blocking: %s", - strerror(err)); + rte_strerror(err)); goto port_error; } /* Allocate protection domain. */ @@ -1024,7 +1024,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) err = mlx4_get_mac(priv, &mac.addr_bytes); if (err) { ERROR("cannot get MAC address, is mlx4_en loaded?" - " (error: %s)", strerror(err)); + " (error: %s)", rte_strerror(err)); goto port_error; } INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT, diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index bb1dd33e7c..a1cd345aae 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -373,7 +373,7 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle) ERROR("cannot toggle %s mode (code %d, \"%s\")," " flow error type %d, cause %p, message: %s", - mode, rte_errno, strerror(rte_errno), error.type, error.cause, + mode, rte_errno, rte_strerror(rte_errno), error.type, error.cause, error.message ? error.message : "(unspecified)"); return ret; } @@ -462,7 +462,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ERROR("failed to synchronize flow rules after removing MAC address" " at index %d (code %d, \"%s\")," " flow error type %d, cause %p, message: %s", - index, rte_errno, strerror(rte_errno), error.type, error.cause, + index, rte_errno, rte_strerror(rte_errno), error.type, error.cause, error.message ? error.message : "(unspecified)"); } @@ -501,7 +501,7 @@ mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, ERROR("failed to synchronize flow rules after adding MAC address" " at index %d (code %d, \"%s\")," " flow error type %d, cause %p, message: %s", - index, rte_errno, strerror(rte_errno), error.type, error.cause, + index, rte_errno, rte_strerror(rte_errno), error.type, error.cause, error.message ? error.message : "(unspecified)"); return ret; } @@ -558,7 +558,7 @@ mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list, return 0; ERROR("failed to synchronize flow rules after modifying MC list," " (code %d, \"%s\"), flow error type %d, cause %p, message: %s", - rte_errno, strerror(rte_errno), error.type, error.cause, + rte_errno, rte_strerror(rte_errno), error.type, error.cause, error.message ? error.message : "(unspecified)"); return ret; } @@ -600,7 +600,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) " (code %d, \"%s\"), " " flow error type %d, cause %p, message: %s", on ? "enabling" : "disabling", vlan_id, - rte_errno, strerror(rte_errno), error.type, error.cause, + rte_errno, rte_strerror(rte_errno), error.type, error.cause, error.message ? error.message : "(unspecified)"); return ret; } @@ -807,7 +807,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete) } (void)wait_to_complete; if (mlx4_ifreq(priv, SIOCGIFFLAGS, &ifr)) { - WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(rte_errno)); + WARN("ioctl(SIOCGIFFLAGS) failed: %s", rte_strerror(rte_errno)); return -rte_errno; } memset(&dev_link, 0, sizeof(dev_link)); @@ -816,7 +816,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete) ifr.ifr_data = (void *)&edata; if (mlx4_ifreq(priv, SIOCETHTOOL, &ifr)) { WARN("ioctl(SIOCETHTOOL, ETHTOOL_GSET) failed: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -rte_errno; } link_speed = ethtool_cmd_speed(&edata); @@ -858,7 +858,7 @@ mlx4_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) ret = rte_errno; WARN("ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM)" " failed: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto out; } fc_conf->autoneg = ethpause.autoneg; @@ -913,7 +913,7 @@ mlx4_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) ret = rte_errno; WARN("ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)" " failed: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto out; } ret = 0; diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c index 781ee256df..d0ec84201e 100644 --- a/drivers/net/mlx4/mlx4_rxq.c +++ b/drivers/net/mlx4/mlx4_rxq.c @@ -353,7 +353,7 @@ mlx4_rss_init(struct mlx4_priv *priv) if (ret) { ERROR("cannot set up range size for RSS context to %u" " (for %u Rx queues), error: %s", - 1 << log2_range, dev->data->nb_rx_queues, strerror(ret)); + 1 << log2_range, dev->data->nb_rx_queues, rte_strerror(ret)); rte_errno = ret; return -ret; } @@ -431,7 +431,7 @@ mlx4_rss_init(struct mlx4_priv *priv) return 0; error: ERROR("cannot initialize common RSS resources (queue %u): %s: %s", - i, msg, strerror(ret)); + i, msg, rte_strerror(ret)); while (i--) { struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i]; @@ -631,7 +631,7 @@ mlx4_rxq_attach(struct rxq *rxq) --rxq->usecnt; rte_errno = ret; ERROR("error while attaching Rx queue %p: %s: %s", - (void *)rxq, msg, strerror(ret)); + (void *)rxq, msg, rte_strerror(ret)); priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_NONE; return -ret; } @@ -882,13 +882,13 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, rte_errno = ENOMEM; ERROR("%p: Rx interrupt completion channel creation" " failure: %s", - (void *)dev, strerror(rte_errno)); + (void *)dev, rte_strerror(rte_errno)); goto error; } if (mlx4_fd_set_non_blocking(rxq->channel->fd) < 0) { ERROR("%p: unable to make Rx interrupt completion" " channel non-blocking: %s", - (void *)dev, strerror(rte_errno)); + (void *)dev, rte_strerror(rte_errno)); goto error; } } diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c index 0db2e55bef..f08c152d5e 100644 --- a/drivers/net/mlx4/mlx4_txq.c +++ b/drivers/net/mlx4/mlx4_txq.c @@ -411,7 +411,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, if (!txq->cq) { rte_errno = ENOMEM; ERROR("%p: CQ creation failure: %s", - (void *)dev, strerror(rte_errno)); + (void *)dev, rte_strerror(rte_errno)); goto error; } qp_init_attr = (struct ibv_qp_init_attr){ @@ -431,7 +431,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, if (!txq->qp) { rte_errno = errno ? errno : EINVAL; ERROR("%p: QP creation failure: %s", - (void *)dev, strerror(rte_errno)); + (void *)dev, rte_strerror(rte_errno)); goto error; } txq->max_inline = qp_init_attr.cap.max_inline_data; @@ -445,7 +445,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, if (ret) { rte_errno = ret; ERROR("%p: QP state to IBV_QPS_INIT failed: %s", - (void *)dev, strerror(rte_errno)); + (void *)dev, rte_strerror(rte_errno)); goto error; } ret = mlx4_glue->modify_qp @@ -457,7 +457,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, if (ret) { rte_errno = ret; ERROR("%p: QP state to IBV_QPS_RTR failed: %s", - (void *)dev, strerror(rte_errno)); + (void *)dev, rte_strerror(rte_errno)); goto error; } ret = mlx4_glue->modify_qp @@ -469,7 +469,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, if (ret) { rte_errno = ret; ERROR("%p: QP state to IBV_QPS_RTS failed: %s", - (void *)dev, strerror(rte_errno)); + (void *)dev, rte_strerror(rte_errno)); goto error; } /* Retrieve device queue information. */ From patchwork Tue Nov 14 08:25:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134226 X-Patchwork-Delegate: thomas@monjalon.net 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 CC0FF43325; Tue, 14 Nov 2023 09:29:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AC0242D35; Tue, 14 Nov 2023 09:26:27 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id BFF6D402BD for ; Tue, 14 Nov 2023 09:25:46 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrN25QZzWhNP; Tue, 14 Nov 2023 16:25:24 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:45 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 34/43] net/mlx5: use rte strerror Date: Tue, 14 Nov 2023 16:25:30 +0800 Message-ID: <20231114082539.1858594-35-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 20 ++++++++++---------- drivers/net/mlx5/linux/mlx5_os.c | 18 +++++++++--------- drivers/net/mlx5/linux/mlx5_socket.c | 16 ++++++++-------- drivers/net/mlx5/linux/mlx5_verbs.c | 8 ++++---- drivers/net/mlx5/mlx5.c | 8 ++++---- drivers/net/mlx5/mlx5_devx.c | 4 ++-- drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_rxmode.c | 8 ++++---- drivers/net/mlx5/mlx5_rxq.c | 4 ++-- drivers/net/mlx5/mlx5_rxtx.c | 2 +- drivers/net/mlx5/mlx5_stats.c | 4 ++-- drivers/net/mlx5/mlx5_testpmd.c | 14 +++++++------- drivers/net/mlx5/mlx5_trigger.c | 12 ++++++------ drivers/net/mlx5/mlx5_vlan.c | 2 +- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 2 +- drivers/net/mlx5/windows/mlx5_os.c | 12 ++++++------ 17 files changed, 69 insertions(+), 69 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 4ea161eae6..e5247c1295 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -1421,7 +1421,7 @@ mlx5dr_match_template_create(const struct rte_flow_item items[], if (ret <= 0) { DR_LOG(ERR, "Unable to process items (%s): %s", error.message ? error.message : "unspecified", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto free_template; } diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c index dd5a0c546d..f2364ff44e 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -398,7 +398,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return ret; } dev_link = (struct rte_eth_link) { @@ -435,7 +435,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL," " ETHTOOL_GSET) failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return ret; } } @@ -490,7 +490,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return ret; } dev_link = (struct rte_eth_link) { @@ -525,7 +525,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, DRV_LOG(DEBUG, "port %u ioctl(SIOCETHTOOL," " ETHTOOL_GLINKSETTINGS) failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return ret; } } @@ -543,7 +543,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, DRV_LOG(DEBUG, "port %u ioctl(SIOCETHTOOL," "ETHTOOL_GLINKSETTINGS) failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return ret; } dev_link.link_speed = (ecmd->speed == UINT32_MAX) ? @@ -674,7 +674,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM) failed:" " %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return ret; } fc_conf->autoneg = ethpause.autoneg; @@ -727,7 +727,7 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)" " failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return ret; } return 0; @@ -1209,7 +1209,7 @@ mlx5_get_module_info(struct rte_eth_dev *dev, ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return ret; } modinfo->type = info.type; @@ -1258,7 +1258,7 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev, ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); if (ret) DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); else rte_memcpy(info->data, eeprom->data, info->length); mlx5_free(eeprom); @@ -1662,7 +1662,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_counters(dev, xstats_ctrl->base); if (ret) DRV_LOG(ERR, "port %u cannot read device counters: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base); stats_ctrl->imissed = 0; free: diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 07f31de5ae..108de96cf7 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1176,7 +1176,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, err = mlx5_glue->query_port(sh->cdev->ctx, spawn->phys_port, &port_attr); if (err) { - DRV_LOG(ERR, "port query failed: %s", strerror(err)); + DRV_LOG(ERR, "port query failed: %s", rte_strerror(err)); goto error; } if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { @@ -1191,7 +1191,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, spawn->phys_port); if (err < 0) { DRV_LOG(INFO, "Failed to get netlink port state: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); err = -rte_errno; goto error; } @@ -1342,7 +1342,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, if (err) { err = rte_errno; DRV_LOG(ERR, "unable to allocate switch domain: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto error; } own_domain_id = 1; @@ -1433,7 +1433,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, if (err) { err = rte_errno; DRV_LOG(ERR, "Failed to process port configure: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto error; } eth_dev = rte_eth_dev_allocate(name); @@ -1479,7 +1479,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, DRV_LOG(ERR, "port %u cannot get MAC address, is mlx5_en" " loaded? (errno: %s)", - eth_dev->data->port_id, strerror(rte_errno)); + eth_dev->data->port_id, rte_strerror(rte_errno)); err = ENODEV; goto error; } @@ -1973,7 +1973,7 @@ mlx5_device_bond_pci_match(const char *ibdev_name, bond_info->ifname); if (ret) DRV_LOG(ERR, "unable to get bond info: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); else DRV_LOG(INFO, "PF device %u, bond device %u(%s)", ifindex, bond_info->ifindex, bond_info->ifname); @@ -2688,7 +2688,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, " encountering an error: %s", owner_pci.domain, owner_pci.bus, owner_pci.devid, owner_pci.function, - strerror(rte_errno)); + rte_strerror(rte_errno)); ret = -rte_errno; /* Roll back. */ while (i--) { @@ -2868,13 +2868,13 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev, ret = mlx5_init_once(); if (ret) { DRV_LOG(ERR, "Unable to init PMD global data: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -rte_errno; } ret = mlx5_probe_again_args_validate(cdev, mkvlist); if (ret) { DRV_LOG(ERR, "Probe again parameters are not compatible : %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -rte_errno; } if (mlx5_dev_is_pci(cdev->dev)) diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c index 6ce0e59643..cfcbd5a099 100644 --- a/drivers/net/mlx5/linux/mlx5_socket.c +++ b/drivers/net/mlx5/linux/mlx5_socket.c @@ -61,13 +61,13 @@ mlx5_pmd_socket_handle(void *cb __rte_unused) /* Accept the connection from the client. */ conn_sock = accept(server_socket, NULL, NULL); if (conn_sock < 0) { - DRV_LOG(WARNING, "connection failed: %s", strerror(errno)); + DRV_LOG(WARNING, "connection failed: %s", rte_strerror(errno)); return; } ret = recvmsg(conn_sock, &msg, MSG_WAITALL); if (ret != sizeof(struct mlx5_flow_dump_req)) { DRV_LOG(WARNING, "wrong message received: %s", - strerror(errno)); + rte_strerror(errno)); goto error; } @@ -138,7 +138,7 @@ mlx5_pmd_socket_handle(void *cb __rte_unused) } while (ret < 0 && errno == EINTR); if (ret < 0) DRV_LOG(WARNING, "failed to send response %s", - strerror(errno)); + rte_strerror(errno)); error: if (conn_sock >= 0) close(conn_sock); @@ -167,7 +167,7 @@ mlx5_pmd_socket_init(void) ret = socket(AF_UNIX, SOCK_STREAM, 0); if (ret < 0) { DRV_LOG(WARNING, "Failed to open mlx5 socket: %s", - strerror(errno)); + rte_strerror(errno)); goto error; } server_socket = ret; @@ -183,13 +183,13 @@ mlx5_pmd_socket_init(void) ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun)); if (ret < 0) { DRV_LOG(WARNING, - "cannot bind mlx5 socket: %s", strerror(errno)); + "cannot bind mlx5 socket: %s", rte_strerror(errno)); goto remove; } ret = listen(server_socket, 0); if (ret < 0) { DRV_LOG(WARNING, "cannot listen on mlx5 socket: %s", - strerror(errno)); + rte_strerror(errno)); goto remove; } server_intr_handle = mlx5_os_interrupt_handler_create @@ -197,7 +197,7 @@ mlx5_pmd_socket_init(void) server_socket, mlx5_pmd_socket_handle, NULL); if (server_intr_handle == NULL) { DRV_LOG(WARNING, "cannot register interrupt handler for mlx5 socket: %s", - strerror(errno)); + rte_strerror(errno)); goto remove; } return 0; @@ -207,7 +207,7 @@ mlx5_pmd_socket_init(void) claim_zero(close(server_socket)); server_socket = -1; error: - DRV_LOG(ERR, "Cannot initialize socket: %s", strerror(errno)); + DRV_LOG(ERR, "Cannot initialize socket: %s", rte_strerror(errno)); return -errno; } diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c index b54f3ccd9a..9d41f6fbdf 100644 --- a/drivers/net/mlx5/linux/mlx5_verbs.c +++ b/drivers/net/mlx5/linux/mlx5_verbs.c @@ -100,7 +100,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE); if (ret) { DRV_LOG(ERR, "Cannot change Tx QP state to RESET %s", - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; return ret; } @@ -111,7 +111,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE | IBV_QP_PORT); if (ret) { DRV_LOG(ERR, "Cannot change Tx QP state to INIT %s", - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; return ret; } @@ -119,7 +119,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE); if (ret) { DRV_LOG(ERR, "Cannot change Tx QP state to RTR %s", - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; return ret; } @@ -127,7 +127,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE); if (ret) { DRV_LOG(ERR, "Cannot change Tx QP state to RTS %s", - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; return ret; } diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 2cf21a1921..7f95c0db85 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1504,7 +1504,7 @@ mlx5_shared_dev_ctx_args_config(struct mlx5_dev_ctx_shared *sh, mlx5_dev_args_check_handler, config); if (ret) { DRV_LOG(ERR, "Failed to process device arguments: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -rte_errno; } } @@ -1756,7 +1756,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn, err = mlx5_shared_dev_ctx_args_config(sh, mkvlist, &sh->config); if (err) { DRV_LOG(ERR, "Failed to process device configure: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto error; } sh->refcnt = 1; @@ -2716,7 +2716,7 @@ mlx5_port_args_config(struct mlx5_priv *priv, struct mlx5_kvargs_ctrl *mkvlist, mlx5_port_args_check_handler, config); if (ret) { DRV_LOG(ERR, "Failed to process port arguments: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -rte_errno; } } @@ -2947,7 +2947,7 @@ mlx5_probe_again_args_validate(struct mlx5_common_device *cdev, ret = mlx5_shared_dev_ctx_args_config(sh, mkvlist, config); if (ret) { DRV_LOG(ERR, "Failed to process device configure: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); mlx5_free(config); return ret; } diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c index 9fa400fc48..95bed87103 100644 --- a/drivers/net/mlx5/mlx5_devx.c +++ b/drivers/net/mlx5/mlx5_devx.c @@ -134,7 +134,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr); if (ret) { DRV_LOG(ERR, "Cannot change the Tx SQ state to RESET" - " %s", strerror(errno)); + " %s", rte_strerror(errno)); rte_errno = errno; return ret; } @@ -146,7 +146,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr); if (ret) { DRV_LOG(ERR, "Cannot change the Tx SQ state to READY" - " %s", strerror(errno)); + " %s", rte_strerror(errno)); rte_errno = errno; return ret; } diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 22a756a52b..f73b7bc394 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -100,7 +100,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = mlx5_traffic_restart(dev); if (ret) DRV_LOG(ERR, "port %u cannot restart traffic: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); } } diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index f44906e1a7..fae684defb 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -44,7 +44,7 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev) ret = mlx5_traffic_restart(dev); if (ret) DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); /* * rte_eth_dev_promiscuous_enable() rollback @@ -77,7 +77,7 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev) ret = mlx5_traffic_restart(dev); if (ret) DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); /* * rte_eth_dev_promiscuous_disable() rollback @@ -117,7 +117,7 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev) ret = mlx5_traffic_restart(dev); if (ret) DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); error: /* * rte_eth_allmulticast_enable() rollback @@ -150,7 +150,7 @@ mlx5_allmulticast_disable(struct rte_eth_dev *dev) ret = mlx5_traffic_restart(dev); if (ret) DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); error: /* * rte_eth_allmulticast_disable() rollback diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 88b2dc54b3..341714965b 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -488,7 +488,7 @@ mlx5_rx_queue_stop_primary(struct rte_eth_dev *dev, uint16_t idx) ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RDY2RST); if (ret) { DRV_LOG(ERR, "Cannot change Rx WQ state to RESET: %s", - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; return ret; } @@ -587,7 +587,7 @@ mlx5_rx_queue_start_primary(struct rte_eth_dev *dev, uint16_t idx) ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RST2RDY); if (ret) { DRV_LOG(ERR, "Cannot change Rx WQ state to READY: %s", - strerror(errno)); + rte_strerror(errno)); rte_errno = errno; return ret; } diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 54d410b513..59e49aa5af 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -378,7 +378,7 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev, ret = priv->obj_ops.rxq_obj_modify(rxq, sm->state); if (ret) { DRV_LOG(ERR, "Cannot change Rx WQ state to %u - %s", - sm->state, strerror(errno)); + sm->state, rte_strerror(errno)); rte_errno = errno; return ret; } diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c index 615e1d073d..d2a8b8e852 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -233,7 +233,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev) stats_n = mlx5_os_get_stats_n(dev); if (stats_n < 0) { DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id, - strerror(-stats_n)); + rte_strerror(-stats_n)); return stats_n; } if (xstats_ctrl->stats_n != stats_n) @@ -251,7 +251,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_counters(dev, counters); if (ret) { DRV_LOG(ERR, "port %u cannot read device counters: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); mlx5_free(counters); return ret; } diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c index 403f3a8f83..70d4d0039f 100644 --- a/drivers/net/mlx5/mlx5_testpmd.c +++ b/drivers/net/mlx5/mlx5_testpmd.c @@ -199,13 +199,13 @@ mlx5_test_extend_devargs(char *identifier, char *extend) socket_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (socket_fd < 0) { TESTPMD_LOG(ERR, "Failed to create unix socket: %s\n", - strerror(errno)); + rte_strerror(errno)); return -1; } rte_strlcpy(un.sun_path, path, sizeof(un.sun_path)); if (connect(socket_fd, (struct sockaddr *)&un, sizeof(un)) < 0) { TESTPMD_LOG(ERR, "Failed to connect %s: %s\n", un.sun_path, - strerror(errno)); + rte_strerror(errno)); close(socket_fd); return -1; } @@ -216,7 +216,7 @@ mlx5_test_extend_devargs(char *identifier, char *extend) } while (ret < 0 && errno == EINTR); if (ret < 0) { TESTPMD_LOG(ERR, "Failed to send request to (%s): %s\n", path, - strerror(errno)); + rte_strerror(errno)); close(socket_fd); return -1; } @@ -333,7 +333,7 @@ static void cmd_port_host_shaper_parsed(void *parsed_result, ret = mlx5_test_set_port_host_shaper(res->port_num, res->fr, res->rate_num); if (ret < 0) - printf("cmd_port_host_shaper error: (%s)\n", strerror(-ret)); + printf("cmd_port_host_shaper error: (%s)\n", rte_strerror(-ret)); } static cmdline_parse_token_string_t cmd_port_host_shaper_mlx5 = @@ -492,7 +492,7 @@ mlx5_cmd_map_ext_rxq_parsed(void *parsed_result, res->sw_queue_id); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -565,7 +565,7 @@ mlx5_cmd_unmap_ext_rxq_parsed(void *parsed_result, fprintf(stderr, "function not implemented or supported\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret)); } } @@ -648,7 +648,7 @@ mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result, if (ret < 0) fprintf(stderr, "Fail to set flow_engine to %s mode with flag 0x%x, error %s\n", mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag, - strerror(-ret)); + rte_strerror(-ret)); else TESTPMD_LOG(DEBUG, "Set %d ports flow_engine to %s mode with flag 0x%x\n", ret, mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag); diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 7bdb897612..eecd39d8a7 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -1190,14 +1190,14 @@ mlx5_dev_start(struct rte_eth_dev *dev) ret = mlx5_dev_configure_rss_reta(dev); if (ret) { DRV_LOG(ERR, "port %u reta config failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return -rte_errno; } } ret = mlx5_txpp_start(dev); if (ret) { DRV_LOG(ERR, "port %u Tx packet pacing init failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); goto error; } if (mlx5_devx_obj_ops_en(priv->sh) && @@ -1209,7 +1209,7 @@ mlx5_dev_start(struct rte_eth_dev *dev) ret = mlx5_txq_start(dev); if (ret) { DRV_LOG(ERR, "port %u Tx queue allocation failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); goto error; } if (priv->config.std_delay_drop || priv->config.hp_delay_drop) { @@ -1233,7 +1233,7 @@ mlx5_dev_start(struct rte_eth_dev *dev) ret = mlx5_rxq_start(dev); if (ret) { DRV_LOG(ERR, "port %u Rx queue allocation failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); goto error; } /* @@ -1243,7 +1243,7 @@ mlx5_dev_start(struct rte_eth_dev *dev) ret = mlx5_hairpin_auto_bind(dev); if (ret) { DRV_LOG(ERR, "port %u hairpin auto binding failed: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); goto error; } /* Set started flag here for the following steps like control flow. */ @@ -1296,7 +1296,7 @@ mlx5_dev_start(struct rte_eth_dev *dev) ret = mlx5_flow_start_default(dev); if (ret) { DRV_LOG(DEBUG, "port %u failed to start default actions: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); goto error; } if (mlx5_dev_ctx_shared_mempool_subscribe(dev) != 0) { diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c index e7161b66fe..e2914844c6 100644 --- a/drivers/net/mlx5/mlx5_vlan.c +++ b/drivers/net/mlx5/mlx5_vlan.c @@ -118,7 +118,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on) ret = priv->obj_ops.rxq_obj_modify_vlan_strip(rxq, on); if (ret) { DRV_LOG(ERR, "Port %u failed to modify object stripping mode:" - " %s", dev->data->port_id, strerror(rte_errno)); + " %s", dev->data->port_id, rte_strerror(rte_errno)); return; } /* Update related bits in RX queue. */ diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c index a31e1b5494..9e31ad9be7 100644 --- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c @@ -212,7 +212,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base); if (ret) DRV_LOG(ERR, "port %u cannot read device counters: %s", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); stats_ctrl->imissed = 0; } diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index b731bdff06..9afc240b46 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -379,7 +379,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, err = mlx5_glue->devx_init_showdown_event(sh->cdev->ctx); if (err) { DRV_LOG(ERR, "failed to init showdown event: %s", - strerror(errno)); + rte_strerror(errno)); goto error; } /* Allocate private eth device data. */ @@ -427,7 +427,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, if (err) { err = rte_errno; DRV_LOG(ERR, "unable to allocate switch domain: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto error; } own_domain_id = 1; @@ -437,7 +437,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, if (err) { err = rte_errno; DRV_LOG(ERR, "Failed to process port configure: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto error; } eth_dev = rte_eth_dev_allocate(name); @@ -480,7 +480,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, DRV_LOG(ERR, "port %u cannot get MAC address, is mlx5_en" " loaded? (errno: %s).", - eth_dev->data->port_id, strerror(rte_errno)); + eth_dev->data->port_id, rte_strerror(rte_errno)); err = ENODEV; goto error; } @@ -730,7 +730,7 @@ mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, DRV_LOG(ERR, "port %u cannot get MAC address, is mlx5_en" " loaded? (errno: %s)", - dev->data->port_id, strerror(rte_errno)); + dev->data->port_id, rte_strerror(rte_errno)); return rte_errno; } if (!rte_is_same_ether_addr(&lmac, mac)) { @@ -849,7 +849,7 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev, ret = mlx5_init_once(); if (ret) { DRV_LOG(ERR, "unable to init PMD global data: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -rte_errno; } spawn.eth_dev = mlx5_dev_spawn(cdev->dev, &spawn, mkvlist); From patchwork Tue Nov 14 08:25:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134220 X-Patchwork-Delegate: thomas@monjalon.net 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 358E943325; Tue, 14 Nov 2023 09:28:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ADA2B427D9; Tue, 14 Nov 2023 09:26:20 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id CDB2F40648 for ; Tue, 14 Nov 2023 09:25:46 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4STzrV2vpFzvQk7; Tue, 14 Nov 2023 16:25:30 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:45 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 35/43] net/qede: use rte strerror Date: Tue, 14 Nov 2023 16:25:31 +0800 Message-ID: <20231114082539.1858594-36-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/qede/qede_regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/qede/qede_regs.c b/drivers/net/qede/qede_regs.c index d2ea1c9108..3aa31a42c2 100644 --- a/drivers/net/qede/qede_regs.c +++ b/drivers/net/qede/qede_regs.c @@ -221,7 +221,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len) if (!f) { fprintf(stderr, "Can't open file %s: %s\n", - dump_file, strerror(errno)); + dump_file, rte_strerror(errno)); return 1; } bytes = fwrite(dump, 1, len, f); @@ -234,7 +234,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len) if (fclose(f)) { fprintf(stderr, "Can't close file %s: %s\n", - dump_file, strerror(errno)); + dump_file, rte_strerror(errno)); err = 1; } From patchwork Tue Nov 14 08:25:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134221 X-Patchwork-Delegate: thomas@monjalon.net 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 24FA043325; Tue, 14 Nov 2023 09:29:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7B7E427DD; Tue, 14 Nov 2023 09:26:21 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 892CA4067D for ; Tue, 14 Nov 2023 09:25:46 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmz5Swxz1P8Kg; Tue, 14 Nov 2023 16:22:27 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:45 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 36/43] net/sfc: use rte strerror Date: Tue, 14 Nov 2023 16:25:32 +0800 Message-ID: <20231114082539.1858594-37-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/sfc/sfc_flow_tunnel.c | 2 +- drivers/net/sfc/sfc_mae.c | 58 +++++++++++++++---------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 1b50aefe5c..304628026d 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1403,7 +1403,7 @@ sfc_flow_parse_pattern(struct sfc_adapter *sa, rc = item->parse(pattern, parse_ctx, error); if (rc != 0) { sfc_err(sa, "failed to parse item %s: %s", - item->name, strerror(-rc)); + item->name, rte_strerror(-rc)); return rc; } diff --git a/drivers/net/sfc/sfc_flow_tunnel.c b/drivers/net/sfc/sfc_flow_tunnel.c index 889fee569a..898d00dd6d 100644 --- a/drivers/net/sfc/sfc_flow_tunnel.c +++ b/drivers/net/sfc/sfc_flow_tunnel.c @@ -120,7 +120,7 @@ sfc_ft_tunnel_rule_detect(struct sfc_adapter *sa, if (rc != 0) { /* The loop above might have spotted wrong actions. */ sfc_err(sa, "FT: TUNNEL: invalid actions: %s", - strerror(rc)); + rte_strerror(rc)); goto fail; } diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index e5ec0ae49d..accde9bcb0 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -429,7 +429,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa, &fw_rsrc->rule_id); if (rc != 0) { sfc_err(sa, "failed to enable outer_rule=%p: %s", - rule, strerror(rc)); + rule, rte_strerror(rc)); return rc; } } @@ -446,7 +446,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa, fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID; } - sfc_err(sa, "can't match on outer rule ID: %s", strerror(rc)); + sfc_err(sa, "can't match on outer rule ID: %s", rte_strerror(rc)); return rc; } @@ -485,7 +485,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa, &invalid_rule_id); if (rc != 0) { sfc_err(sa, "cannot restore match on invalid outer rule ID: %s", - strerror(rc)); + rte_strerror(rc)); return; } @@ -504,7 +504,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa, rule, fw_rsrc->rule_id.id); } else { sfc_err(sa, "failed to disable outer_rule=%p with OR_ID=0x%08x: %s", - rule, fw_rsrc->rule_id.id, strerror(rc)); + rule, fw_rsrc->rule_id.id, rte_strerror(rc)); } fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -618,7 +618,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa, &fw_rsrc->mac_id); if (rc != 0) { sfc_err(sa, "failed to enable mac_addr=%p: %s", - mac_addr, strerror(rc)); + mac_addr, rte_strerror(rc)); return rc; } } @@ -644,7 +644,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa, } sfc_err(sa, "cannot fill in MAC address entry ID: %s", - strerror(rc)); + rte_strerror(rc)); return rc; } @@ -687,7 +687,7 @@ sfc_mae_mac_addr_disable(struct sfc_adapter *sa, mac_addr, fw_rsrc->mac_id.id); } else { sfc_err(sa, "failed to disable mac_addr=%p with MAC_ID=0x%08x: %s", - mac_addr, fw_rsrc->mac_id.id, strerror(rc)); + mac_addr, fw_rsrc->mac_id.id, rte_strerror(rc)); } fw_rsrc->mac_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -820,7 +820,7 @@ sfc_mae_encap_header_update(struct sfc_adapter *sa, bounce_eh->size); if (ret != 0) { sfc_err(sa, "failed to update encap_header=%p: %s", - encap_header, strerror(ret)); + encap_header, rte_strerror(ret)); rte_free(buf); return ret; } @@ -861,7 +861,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa, &fw_rsrc->eh_id); if (rc != 0) { sfc_err(sa, "failed to enable encap_header=%p: %s", - encap_header, strerror(rc)); + encap_header, rte_strerror(rc)); return rc; } } @@ -875,7 +875,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa, fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID; } - sfc_err(sa, "can't fill in encap. header ID: %s", strerror(rc)); + sfc_err(sa, "can't fill in encap. header ID: %s", rte_strerror(rc)); return rc; } @@ -918,7 +918,7 @@ sfc_mae_encap_header_disable(struct sfc_adapter *sa, encap_header, fw_rsrc->eh_id.id); } else { sfc_err(sa, "failed to disable encap_header=%p with EH_ID=0x%08x: %s", - encap_header, fw_rsrc->eh_id.id, strerror(rc)); + encap_header, fw_rsrc->eh_id.id, rte_strerror(rc)); } fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -1023,7 +1023,7 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter, } sfc_err(sa, "cannot fill in counter ID: %s", - strerror(rc)); + rte_strerror(rc)); return rc; } } @@ -1067,7 +1067,7 @@ sfc_mae_counter_disable(struct sfc_adapter *sa, struct sfc_mae_counter *counter) counter, counter->type, counter_id); } else { sfc_err(sa, "failed to disable counter=%p with COUNTER_ID=0x%x-#%u: %s", - counter, counter->type, counter_id, strerror(rc)); + counter, counter->type, counter_id, rte_strerror(rc)); } fw_rsrc->counter_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1242,7 +1242,7 @@ sfc_mae_action_set_enable(struct sfc_adapter *sa, &fw_rsrc->aset_id); if (rc != 0) { sfc_err(sa, "failed to enable action_set=%p: %s", - action_set, strerror(rc)); + action_set, rte_strerror(rc)); sfc_mae_encap_header_disable(sa, encap_header); sfc_mae_mac_addr_disable(sa, src_mac_addr); @@ -1290,7 +1290,7 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa, action_set, fw_rsrc->aset_id.id); } else { sfc_err(sa, "failed to disable action_set=%p with AS_ID=0x%08x: %s", - action_set, fw_rsrc->aset_id.id, strerror(rc)); + action_set, fw_rsrc->aset_id.id, rte_strerror(rc)); } fw_rsrc->aset_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1446,7 +1446,7 @@ sfc_mae_action_set_list_enable(struct sfc_adapter *sa, &fw_rsrc->aset_list_id); if (rc != 0) { sfc_err(sa, "failed to enable action_set_list=%p: %s", - action_set_list, strerror(rc)); + action_set_list, rte_strerror(rc)); goto fail_action_set_list_alloc; } @@ -1499,7 +1499,7 @@ sfc_mae_action_set_list_disable(struct sfc_adapter *sa, } else { sfc_err(sa, "failed to disable action_set_list=%p with ASL_ID=0x%08x: %s", action_set_list, fw_rsrc->aset_list_id.id, - strerror(rc)); + rte_strerror(rc)); } fw_rsrc->aset_list_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1710,7 +1710,7 @@ sfc_mae_action_rule_enable(struct sfc_adapter *sa, as_idp, &fw_rsrc->rule_id); if (rc != 0) { sfc_err(sa, "failed to enable action_rule=%p: %s", - rule, strerror(rc)); + rule, rte_strerror(rc)); goto fail_action_rule_insert; } @@ -1761,7 +1761,7 @@ sfc_mae_action_rule_disable(struct sfc_adapter *sa, rule, fw_rsrc->rule_id.id); } else { sfc_err(sa, "failed to disable action_rule=%p with AR_ID=0x%08x: %s", - rule, fw_rsrc->rule_id.id, strerror(rc)); + rule, fw_rsrc->rule_id.id, rte_strerror(rc)); } fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -4398,7 +4398,7 @@ sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa, rc = efx_mae_action_set_populate_mark(spec, conf->id); if (rc != 0) - sfc_err(sa, "failed to request action MARK: %s", strerror(rc)); + sfc_err(sa, "failed to request action MARK: %s", rte_strerror(rc)); return rc; } @@ -4570,14 +4570,14 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa, if (rc != 0) { sfc_err(sa, "failed to convert PF %u VF %d to m-port: %s", encp->enc_pf, (vf != EFX_PCI_VF_INVALID) ? (int)vf : -1, - strerror(rc)); + rte_strerror(rc)); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, rte_strerror(rc)); } return rc; @@ -4606,14 +4606,14 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa, port_id, type_mask, &mport); if (rc != 0) { sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - port_id, strerror(rc)); + port_id, rte_strerror(rc)); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, rte_strerror(rc)); } return rc; @@ -4632,14 +4632,14 @@ sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa, conf->port_id, type_mask, &mport); if (rc != 0) { sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - conf->port_id, strerror(rc)); + conf->port_id, rte_strerror(rc)); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, rte_strerror(rc)); } return rc; @@ -4658,14 +4658,14 @@ sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa, conf->port_id, &mport); if (rc != 0) { sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - conf->port_id, strerror(rc)); + conf->port_id, rte_strerror(rc)); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, rte_strerror(rc)); } return rc; @@ -4758,7 +4758,7 @@ sfc_mae_rule_parse_action_rc(struct sfc_adapter *sa, if (action_name != NULL) { sfc_err(sa, "action %s was rejected: %s", - action_name, strerror(rc)); + action_name, rte_strerror(rc)); } } rc = rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ACTION, From patchwork Tue Nov 14 08:25:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134227 X-Patchwork-Delegate: thomas@monjalon.net 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 9666943325; Tue, 14 Nov 2023 09:29:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8505E42D68; Tue, 14 Nov 2023 09:26:28 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 488044067E for ; Tue, 14 Nov 2023 09:25:47 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzly1334zPpKn; Tue, 14 Nov 2023 16:21:34 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:45 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 37/43] net/tap: use rte strerror Date: Tue, 14 Nov 2023 16:25:33 +0800 Message-ID: <20231114082539.1858594-38-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/tap/rte_eth_tap.c | 26 +++++++++++++------------- drivers/net/tap/tap_flow.c | 18 +++++++++--------- drivers/net/tap/tap_netlink.c | 5 +++-- drivers/net/tap/tap_tcmsgs.c | 6 ++++-- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index b41fa971cb..ff290ea5bf 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -196,7 +196,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) /* Set the TUN/TAP configuration and set the name if needed */ if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) { TAP_LOG(WARNING, "Unable to set TUNSETIFF for %s: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, rte_strerror(errno)); goto error; } @@ -204,7 +204,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) if (persistent && ioctl(fd, TUNSETPERSIST, 1) < 0) { TAP_LOG(WARNING, "Unable to set persist %s: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, rte_strerror(errno)); goto error; } @@ -224,7 +224,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) if (ioctl(fd, TUNSETQUEUE, (void *)&ifr) < 0) { TAP_LOG(WARNING, "Unable to detach keep-alive queue for %s: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, rte_strerror(errno)); goto error; } } @@ -242,7 +242,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) if (fcntl(fd, F_SETFL, flags) < 0) { TAP_LOG(WARNING, "Unable to set %s to nonblocking: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, rte_strerror(errno)); goto error; } @@ -295,18 +295,18 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) /* Enable signal on file descriptor */ if (fcntl(fd, F_SETSIG, signo) < 0) { TAP_LOG(WARNING, "Unable to set signo %d for fd %d: %s", - signo, fd, strerror(errno)); + signo, fd, rte_strerror(errno)); goto error; } if (fcntl(fd, F_SETFL, flags | O_ASYNC) < 0) { TAP_LOG(WARNING, "Unable to set fcntl flags: %s", - strerror(errno)); + rte_strerror(errno)); goto error; } if (fcntl(fd, F_SETOWN, getpid()) < 0) { TAP_LOG(WARNING, "Unable to set fcntl owner: %s", - strerror(errno)); + rte_strerror(errno)); goto error; } } @@ -821,7 +821,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request, error: TAP_LOG(DEBUG, "%s(%s) failed: %s(%d)", ifr->ifr_name, - tap_ioctl_req2str(request), strerror(errno), errno); + tap_ioctl_req2str(request), rte_strerror(errno), errno); return -errno; } @@ -1966,7 +1966,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, if (pmd->ioctl_sock == -1) { TAP_LOG(ERR, "%s Unable to get a socket for management: %s", - tuntap_name, strerror(errno)); + tuntap_name, rte_strerror(errno)); goto error_exit; } @@ -2127,7 +2127,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, disable_rte_flow: TAP_LOG(ERR, " Disabling rte flow support: %s(%d)", - strerror(errno), errno); + rte_strerror(errno), errno); if (strlen(remote_iface)) { TAP_LOG(ERR, "Remote feature requires flow support."); goto error_exit; @@ -2137,7 +2137,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, error_remote: TAP_LOG(ERR, " Can't set up remote feature: %s(%d)", - strerror(errno), errno); + rte_strerror(errno), errno); tap_flow_implicit_flush(pmd, NULL); error_exit: @@ -2475,7 +2475,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) ret = rte_mp_action_register(TAP_MP_REQ_START_RXTX, tap_mp_req_start_rxtx); if (ret < 0 && rte_errno != ENOTSUP) { TAP_LOG(ERR, "tap: Failed to register IPC callback: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -1; } } @@ -2535,7 +2535,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) ret = rte_mp_action_register(TAP_MP_KEY, tap_mp_sync_queues); if (ret < 0 && rte_errno != ENOTSUP) { TAP_LOG(ERR, "tap: Failed to register IPC callback: %s", - strerror(rte_errno)); + rte_strerror(rte_errno)); goto leave; } } diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index ed4d42f92f..9d6b84f5c7 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -1409,7 +1409,7 @@ tap_flow_create(struct rte_eth_dev *dev, if (err < 0) { TAP_LOG(ERR, "Kernel refused TC filter rule creation (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); rte_flow_error_set(error, EEXIST, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "overlapping rules or Kernel too old for flower support"); @@ -1454,7 +1454,7 @@ tap_flow_create(struct rte_eth_dev *dev, if (err < 0) { TAP_LOG(ERR, "Kernel refused TC filter rule creation (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); rte_flow_error_set( error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -1508,7 +1508,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd, if (ret < 0) { TAP_LOG(ERR, "Kernel refused TC filter rule deletion (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); rte_flow_error_set( error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "couldn't receive kernel ack to our request"); @@ -1532,7 +1532,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd, if (ret < 0) { TAP_LOG(ERR, "Kernel refused TC filter rule deletion (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); rte_flow_error_set( error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Failure trying to receive nl ack"); @@ -1755,7 +1755,7 @@ int tap_flow_implicit_create(struct pmd_internals *pmd, goto success; TAP_LOG(ERR, "Kernel refused TC filter rule creation (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); goto fail; } LIST_INSERT_HEAD(&pmd->implicit_flows, remote_flow, next); @@ -1871,7 +1871,7 @@ static int rss_enable(struct pmd_internals *pmd, if (pmd->map_fd < 0) { TAP_LOG(ERR, "Failed to create BPF map (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); rte_flow_error_set( error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Kernel too old or not configured " @@ -1946,7 +1946,7 @@ static int rss_enable(struct pmd_internals *pmd, if (err < 0) { TAP_LOG(ERR, "Kernel refused TC filter rule creation (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); return err; } LIST_INSERT_HEAD(&pmd->rss_flows, rss_flow, next); @@ -2111,7 +2111,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd, if (err) { TAP_LOG(ERR, "Failed to update BPF map entry #%u (%d): %s", - flow->key_idx, errno, strerror(errno)); + flow->key_idx, errno, rte_strerror(errno)); rte_flow_error_set( error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Kernel too old or not configured " @@ -2130,7 +2130,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd, if (flow->bpf_fd[SEC_L3_L4] < 0) { TAP_LOG(ERR, "Failed to load BPF section %s (%d): %s", - sec_name[SEC_L3_L4], errno, strerror(errno)); + sec_name[SEC_L3_L4], errno, rte_strerror(errno)); rte_flow_error_set( error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Kernel too old or not configured " diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c index 75af3404b0..354574ba29 100644 --- a/drivers/net/tap/tap_netlink.c +++ b/drivers/net/tap/tap_netlink.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "tap_log.h" @@ -97,7 +98,7 @@ tap_nl_final(int nlsk_fd) { if (close(nlsk_fd)) { TAP_LOG(ERR, "Failed to close netlink socket: %s (%d)", - strerror(errno), errno); + rte_strerror(errno), errno); return -1; } return 0; @@ -129,7 +130,7 @@ tap_nl_send(int nlsk_fd, struct nlmsghdr *nh) goto retry; TAP_LOG(ERR, "Failed to send netlink message: %s (%d)", - strerror(errno), errno); + rte_strerror(errno), errno); return -1; } return send_bytes; diff --git a/drivers/net/tap/tap_tcmsgs.c b/drivers/net/tap/tap_tcmsgs.c index a3aae3c814..28d4809360 100644 --- a/drivers/net/tap/tap_tcmsgs.c +++ b/drivers/net/tap/tap_tcmsgs.c @@ -8,6 +8,8 @@ #include #include +#include + #include #include #include "tap_log.h" @@ -263,7 +265,7 @@ qdisc_create_multiq(int nlsk_fd, unsigned int ifindex) err = qdisc_add_multiq(nlsk_fd, ifindex); if (err < 0 && errno != -EEXIST) { TAP_LOG(ERR, "Could not add multiq qdisc (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } return 0; @@ -289,7 +291,7 @@ qdisc_create_ingress(int nlsk_fd, unsigned int ifindex) err = qdisc_add_ingress(nlsk_fd, ifindex); if (err < 0 && errno != -EEXIST) { TAP_LOG(ERR, "Could not add ingress qdisc (%d): %s", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } return 0; From patchwork Tue Nov 14 08:25:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134224 X-Patchwork-Delegate: thomas@monjalon.net 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 A1D7443325; Tue, 14 Nov 2023 09:29:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 223AA42C24; Tue, 14 Nov 2023 09:26:25 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 5E0A64027B for ; Tue, 14 Nov 2023 09:25:47 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrN6GyxzWhKY; Tue, 14 Nov 2023 16:25:24 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:46 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 38/43] net/vhost: use rte strerror Date: Tue, 14 Nov 2023 16:25:34 +0800 Message-ID: <20231114082539.1858594-39-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/vhost/rte_eth_vhost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 21bbb008e0..75b48dc31e 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -567,7 +567,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx) if (vq->kickfd >= 0 && vq->kickfd != vring.kickfd) { if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) { VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n", - vq->kickfd, rxq_idx, strerror(errno)); + vq->kickfd, rxq_idx, rte_strerror(errno)); } else { VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n", vq->kickfd, rxq_idx); @@ -579,7 +579,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx) if (vq->kickfd != vring.kickfd && vring.kickfd >= 0) { if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_ADD, vring.kickfd, &vq->ev) < 0) { VHOST_LOG(ERR, "Failed to register %d in rxq-%d epoll: %s\n", - vring.kickfd, rxq_idx, strerror(errno)); + vring.kickfd, rxq_idx, rte_strerror(errno)); } else { vq->kickfd = vring.kickfd; VHOST_LOG(DEBUG, "Registered %d in rxq-%d epoll\n", @@ -730,7 +730,7 @@ eth_vhost_unconfigure_intr(struct rte_eth_dev *eth_dev) if (vq->kickfd >= 0) { if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) { VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n", - vq->kickfd, i, strerror(errno)); + vq->kickfd, i, rte_strerror(errno)); } else { VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n", vq->kickfd, i); From patchwork Tue Nov 14 08:25:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134228 X-Patchwork-Delegate: thomas@monjalon.net 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 A525543325; Tue, 14 Nov 2023 09:29:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7D4F42D7D; Tue, 14 Nov 2023 09:26:29 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 8247F4068A for ; Tue, 14 Nov 2023 09:25:47 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrP0NlkzWhL1; Tue, 14 Nov 2023 16:25:25 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:46 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 39/43] net/virtio: use rte strerror Date: Tue, 14 Nov 2023 16:25:35 +0800 Message-ID: <20231114082539.1858594-40-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/net/virtio/virtio_user/vhost_kernel.c | 8 +++--- .../net/virtio/virtio_user/vhost_kernel_tap.c | 25 ++++++++++--------- drivers/net/virtio/virtio_user/vhost_user.c | 20 +++++++-------- drivers/net/virtio/virtio_user/vhost_vdpa.c | 12 ++++----- .../net/virtio/virtio_user/virtio_user_dev.c | 8 +++--- drivers/net/virtio/virtio_user_ethdev.c | 6 ++--- 6 files changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c index e42bb35935..b1dec119fc 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -92,7 +92,7 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg) ret = ioctl(fd, request, arg); if (ret) { PMD_DRV_LOG(ERR, "Vhost-kernel ioctl %"PRIu64" failed (%s)", - request, strerror(errno)); + request, rte_strerror(errno)); return -1; } @@ -428,7 +428,7 @@ vhost_kernel_setup(struct virtio_user_dev *dev) for (i = 0; i < dev->max_queue_pairs; ++i) { vhostfd = open(dev->path, O_RDWR); if (vhostfd < 0) { - PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, strerror(errno)); + PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, rte_strerror(errno)); goto err_tapfds; } data->vhostfds[i] = vhostfd; @@ -511,14 +511,14 @@ vhost_kernel_set_backend(int vhostfd, int tapfd) f.index = 0; if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) { PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s", - strerror(errno)); + rte_strerror(errno)); return -1; } f.index = 1; if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) { PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s", - strerror(errno)); + rte_strerror(errno)); return -1; } diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c index 611e2e25ec..4542ccbf04 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c @@ -13,6 +13,7 @@ #include #include +#include #include "vhost_kernel_tap.h" #include "../virtio_logs.h" @@ -27,12 +28,12 @@ tap_support_features(unsigned int *tap_features) tapfd = open(PATH_NET_TUN, O_RDWR); if (tapfd < 0) { PMD_DRV_LOG(ERR, "fail to open %s: %s", - PATH_NET_TUN, strerror(errno)); + PATH_NET_TUN, rte_strerror(errno)); return -1; } if (ioctl(tapfd, TUNGETFEATURES, tap_features) == -1) { - PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", rte_strerror(errno)); close(tapfd); return -1; } @@ -49,11 +50,11 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue) tapfd = open(PATH_NET_TUN, O_RDWR); if (tapfd < 0) { - PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, strerror(errno)); + PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, rte_strerror(errno)); return -1; } if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) { - PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", rte_strerror(errno)); close(tapfd); return -1; } @@ -68,12 +69,12 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue) if (multi_queue) { PMD_DRV_LOG(DEBUG, "TUNSETIFF failed (will retry without IFF_MULTI_QUEUE): %s", - strerror(errno)); + rte_strerror(errno)); multi_queue = false; goto retry_mono_q; } - PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", rte_strerror(errno)); close(tapfd); tapfd = -1; } @@ -88,7 +89,7 @@ tap_get_name(int tapfd, char **name) memset(&ifr, 0, sizeof(ifr)); if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) { - PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno)); return -1; } ret = asprintf(name, "%s", ifr.ifr_name); @@ -104,7 +105,7 @@ tap_get_flags(int tapfd, unsigned int *tap_flags) memset(&ifr, 0, sizeof(ifr)); if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) { - PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno)); return -1; } *tap_flags = ifr.ifr_flags; @@ -120,7 +121,7 @@ tap_set_mac(int tapfd, uint8_t *mac) ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; memcpy(ifr.ifr_hwaddr.sa_data, mac, RTE_ETHER_ADDR_LEN); if (ioctl(tapfd, SIOCSIFHWADDR, (void *)&ifr) == -1) { - PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", rte_strerror(errno)); return -1; } return 0; @@ -155,7 +156,7 @@ vhost_kernel_tap_set_offload(int fd, uint64_t features) offload &= ~TUN_F_UFO; if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) { PMD_DRV_LOG(ERR, "TUNSETOFFLOAD ioctl() failed: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } } @@ -175,12 +176,12 @@ vhost_kernel_tap_setup(int tapfd, int hdr_size, uint64_t features) * max_mem_regions, supported in newer version linux kernel */ if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) { - PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", rte_strerror(errno)); return -1; } if (ioctl(tapfd, TUNSETSNDBUF, &sndbuf) < 0) { - PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", rte_strerror(errno)); return -1; } diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c index 3c05ac9cc0..e079c726da 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -135,7 +135,7 @@ vhost_user_write(int fd, struct vhost_user_msg *msg, int *fds, int fd_num) } while (r < 0 && errno == EINTR); if (r < 0) - PMD_DRV_LOG(ERR, "Failed to send msg: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "Failed to send msg: %s", rte_strerror(errno)); return r; } @@ -148,7 +148,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg) ret = recv(fd, (void *)msg, sz_hdr, 0); if (ret < 0) { - PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", rte_strerror(errno)); return -1; } else if (ret < sz_hdr) { PMD_DRV_LOG(ERR, "Failed to recv msg hdr: %d instead of %d.", @@ -174,7 +174,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg) if (sz_payload) { ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0); if (ret < 0) { - PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", strerror(errno)); + PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", rte_strerror(errno)); return -1; } else if (ret < sz_payload) { PMD_DRV_LOG(ERR, "Failed to recv msg payload: %d instead of %u.", @@ -749,7 +749,7 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un) ret = bind(fd, (struct sockaddr *)un, sizeof(*un)); if (ret < 0) { PMD_DRV_LOG(ERR, "failed to bind to %s: %s; remove it and try again", - dev->path, strerror(errno)); + dev->path, rte_strerror(errno)); return -1; } ret = listen(fd, MAX_VIRTIO_USER_BACKLOG); @@ -760,13 +760,13 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un) data->vhostfd = accept(fd, NULL, NULL); if (data->vhostfd < 0) { PMD_DRV_LOG(ERR, "Failed to accept initial client connection (%s)", - strerror(errno)); + rte_strerror(errno)); return -1; } flag = fcntl(fd, F_GETFL); if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) { - PMD_DRV_LOG(ERR, "fcntl failed, %s", strerror(errno)); + PMD_DRV_LOG(ERR, "fcntl failed, %s", rte_strerror(errno)); return -1; } @@ -834,15 +834,15 @@ vhost_user_setup(struct virtio_user_dev *dev) fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { - PMD_DRV_LOG(ERR, "socket() error, %s", strerror(errno)); + PMD_DRV_LOG(ERR, "socket() error, %s", rte_strerror(errno)); goto err_data; } flag = fcntl(fd, F_GETFD); if (flag == -1) - PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", strerror(errno)); + PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", rte_strerror(errno)); else if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0) - PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", strerror(errno)); + PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", rte_strerror(errno)); memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; @@ -856,7 +856,7 @@ vhost_user_setup(struct virtio_user_dev *dev) } } else { if (connect(fd, (struct sockaddr *)&un, sizeof(un)) < 0) { - PMD_DRV_LOG(ERR, "connect error, %s", strerror(errno)); + PMD_DRV_LOG(ERR, "connect error, %s", rte_strerror(errno)); goto err_socket; } data->vhostfd = fd; diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c index 2c36b26224..ac0ef2c3f9 100644 --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c @@ -92,7 +92,7 @@ vhost_vdpa_ioctl(int fd, uint64_t request, void *arg) ret = ioctl(fd, request, arg); if (ret) { PMD_DRV_LOG(ERR, "Vhost-vDPA ioctl %"PRIu64" failed (%s)", - request, strerror(errno)); + request, rte_strerror(errno)); return -1; } @@ -186,7 +186,7 @@ vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev) if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) { PMD_DRV_LOG(ERR, "Failed to send IOTLB batch begin (%s)", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -212,7 +212,7 @@ vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev) if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) { PMD_DRV_LOG(ERR, "Failed to send IOTLB batch end (%s)", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -243,7 +243,7 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr, if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) { PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -272,7 +272,7 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr, if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) { PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -530,7 +530,7 @@ vhost_vdpa_setup(struct virtio_user_dev *dev) data->vhostfd = open(dev->path, O_RDWR); if (data->vhostfd < 0) { PMD_DRV_LOG(ERR, "Failed to open %s: %s", - dev->path, strerror(errno)); + dev->path, rte_strerror(errno)); free(data); return -1; } diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index af1f8c8237..ad7537a746 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -401,13 +401,13 @@ virtio_user_dev_init_notify(struct virtio_user_dev *dev) */ callfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (callfd < 0) { - PMD_DRV_LOG(ERR, "(%s) callfd error, %s", dev->path, strerror(errno)); + PMD_DRV_LOG(ERR, "(%s) callfd error, %s", dev->path, rte_strerror(errno)); goto err; } kickfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (kickfd < 0) { close(callfd); - PMD_DRV_LOG(ERR, "(%s) kickfd error, %s", dev->path, strerror(errno)); + PMD_DRV_LOG(ERR, "(%s) kickfd error, %s", dev->path, rte_strerror(errno)); goto err; } dev->callfds[i] = callfd; @@ -1043,7 +1043,7 @@ virtio_user_control_queue_notify(struct virtqueue *vq, void *cookie) if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0) PMD_DRV_LOG(ERR, "failed to kick backend: %s", - strerror(errno)); + rte_strerror(errno)); } int @@ -1264,7 +1264,7 @@ virtio_user_dev_server_reconnect(struct virtio_user_dev *dev) if (dev->ops->get_features(dev, &dev->device_features) < 0) { PMD_INIT_LOG(ERR, "get_features failed: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 3a31642899..908afde4fc 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -273,7 +273,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq) if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0) PMD_DRV_LOG(ERR, "failed to kick backend: %s", - strerror(errno)); + rte_strerror(errno)); } static int @@ -382,7 +382,7 @@ vdpa_dynamic_major_num(void) fp = fopen("/proc/devices", "r"); if (fp == NULL) { PMD_INIT_LOG(ERR, "Cannot open /proc/devices: %s", - strerror(errno)); + rte_strerror(errno)); return UNNAMED_MAJOR; } @@ -409,7 +409,7 @@ virtio_user_backend_type(const char *path) return VIRTIO_USER_BACKEND_VHOST_USER; PMD_INIT_LOG(ERR, "Stat fails: %s (%s)", path, - strerror(errno)); + rte_strerror(errno)); return VIRTIO_USER_BACKEND_UNKNOWN; } From patchwork Tue Nov 14 08:25:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134225 X-Patchwork-Delegate: thomas@monjalon.net 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 B680D43325; Tue, 14 Nov 2023 09:29:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B5EB42D27; Tue, 14 Nov 2023 09:26:26 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 1E3924067B for ; Tue, 14 Nov 2023 09:25:47 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4STzmz4NxbzrVDl; Tue, 14 Nov 2023 16:22:27 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:46 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 40/43] raw/ifpga: use rte strerror Date: Tue, 14 Nov 2023 16:25:36 +0800 Message-ID: <20231114082539.1858594-41-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/raw/ifpga/afu_pmd_n3000.c | 5 +++-- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +++++++----- drivers/raw/ifpga/ifpga_rawdev.c | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c index 67b3941265..d7302edc3f 100644 --- a/drivers/raw/ifpga/afu_pmd_n3000.c +++ b/drivers/raw/ifpga/afu_pmd_n3000.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "afu_pmd_core.h" #include "afu_pmd_n3000.h" @@ -693,7 +694,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx) pfd.events = POLLIN; poll_ret = poll(&pfd, 1, DMA_TIMEOUT_MSEC); if (poll_ret < 0) { - IFPGA_RAWDEV_PMD_ERR("Error %s", strerror(errno)); + IFPGA_RAWDEV_PMD_ERR("Error %s", rte_strerror(errno)); ret = -EFAULT; goto out; } else if (poll_ret == 0) { @@ -708,7 +709,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx) ret = 0; } else { IFPGA_RAWDEV_PMD_ERR("Failed %s", bytes_read > 0 ? - strerror(errno) : "zero bytes read"); + rte_strerror(errno) : "zero bytes read"); ret = -EIO; } } diff --git a/drivers/raw/ifpga/base/ifpga_fme_rsu.c b/drivers/raw/ifpga/base/ifpga_fme_rsu.c index f147aaa1e8..8e8a611f9a 100644 --- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c +++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c @@ -7,6 +7,8 @@ #include #include "ifpga_sec_mgr.h" +#include + static struct ifpga_sec_mgr *sec_mgr; static void set_rsu_control(struct ifpga_sec_mgr *smgr, uint32_t ctrl) @@ -112,7 +114,7 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image, if (fd < 0) { dev_err(smgr, "Failed to open \'%s\' for RD [e:%s]\n", - image, strerror(errno)); + image, rte_strerror(errno)); return -EIO; } @@ -130,14 +132,14 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image, IFPGA_RSU_DATA_BLK_SIZE : length; if (lseek(fd, offset, SEEK_SET) < 0) { dev_err(smgr, "Failed to seek in \'%s\' [e:%s]\n", - image, strerror(errno)); + image, rte_strerror(errno)); ret = -EIO; goto end; } read_size = read(fd, buf, to_transfer); if (read_size < 0) { dev_err(smgr, "Failed to read from \'%s\' [e:%s]\n", - image, strerror(errno)); + image, rte_strerror(errno)); ret = -EIO; goto end; } @@ -316,7 +318,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image, if (fd < 0) { dev_err(smgr, "Failed to open \'%s\' for RD [e:%s]\n", - image, strerror(errno)); + image, rte_strerror(errno)); return -EIO; } len = lseek(fd, 0, SEEK_END); @@ -325,7 +327,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image, if (len < 0) { dev_err(smgr, "Failed to get file length of \'%s\' [e:%s]\n", - image, strerror(errno)); + image, rte_strerror(errno)); return -EIO; } if (len == 0) { diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index f89bd3f9e2..56d3ec02eb 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -847,7 +847,7 @@ rte_fpga_do_pr(struct rte_rawdev *rawdev, int port_id, if (file_fd < 0) { IFPGA_RAWDEV_PMD_ERR("%s: open file error: %s\n", __func__, file_name); - IFPGA_RAWDEV_PMD_ERR("Message : %s\n", strerror(errno)); + IFPGA_RAWDEV_PMD_ERR("Message : %s\n", rte_strerror(errno)); return -EINVAL; } ret = stat(file_name, &file_stat); From patchwork Tue Nov 14 08:25:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134231 X-Patchwork-Delegate: thomas@monjalon.net 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 32A9443325; Tue, 14 Nov 2023 09:30:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11D3F42D95; Tue, 14 Nov 2023 09:26:33 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id E3C43402CD for ; Tue, 14 Nov 2023 09:25:47 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrP2MnRzWhMd; Tue, 14 Nov 2023 16:25:25 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:46 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 41/43] vdpa/ifc: use rte strerror Date: Tue, 14 Nov 2023 16:25:37 +0800 Message-ID: <20231114082539.1858594-42-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/vdpa/ifc/ifcvf_vdpa.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index f034bd59ba..34ea450d00 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "base/ifcvf.h" @@ -446,7 +447,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx) fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { DRV_LOG(ERR, "can't setup eventfd: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } internal->intr_fd[i] = fd; @@ -457,7 +458,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx) ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set); if (ret) { DRV_LOG(ERR, "Error enabling MSI-X interrupts: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -489,7 +490,7 @@ vdpa_disable_vfio_intr(struct ifcvf_internal *internal) ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set); if (ret) { DRV_LOG(ERR, "Error disabling MSI-X interrupts: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -526,7 +527,7 @@ notify_relay(void *arg) rte_vhost_get_vhost_vring(internal->vid, qid, &vring); ev.data.u64 = qid | (uint64_t)vring.kickfd << 32; if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) { - DRV_LOG(ERR, "epoll add error: %s", strerror(errno)); + DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno)); return 1; } } @@ -552,7 +553,7 @@ notify_relay(void *arg) continue; DRV_LOG(INFO, "Error reading " "kickfd: %s", - strerror(errno)); + rte_strerror(errno)); } break; } while (1); @@ -628,7 +629,7 @@ intr_relay(void *arg) ev.data.fd = rte_intr_fd_get(internal->pdev->intr_handle); if (epoll_ctl(csc_epfd, EPOLL_CTL_ADD, rte_intr_fd_get(internal->pdev->intr_handle), &ev) < 0) { - DRV_LOG(ERR, "epoll add error: %s", strerror(errno)); + DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno)); goto out; } @@ -653,7 +654,7 @@ intr_relay(void *arg) continue; DRV_LOG(ERR, "Error reading from file descriptor %d: %s\n", csc_event.data.fd, - strerror(errno)); + rte_strerror(errno)); goto out; } else if (nbytes == 0) { DRV_LOG(ERR, "Read nothing from file descriptor %d\n", @@ -947,7 +948,7 @@ vring_relay(void *arg) rte_vhost_get_vhost_vring(vid, qid, &vring); ev.data.u64 = qid << 1 | (uint64_t)vring.kickfd << 32; if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) { - DRV_LOG(ERR, "epoll add error: %s", strerror(errno)); + DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno)); return 1; } } @@ -961,7 +962,7 @@ vring_relay(void *arg) (uint64_t)internal->intr_fd[qid] << 32; if (epoll_ctl(epfd, EPOLL_CTL_ADD, internal->intr_fd[qid], &ev) < 0) { - DRV_LOG(ERR, "epoll add error: %s", strerror(errno)); + DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno)); return 1; } update_used_ring(internal, qid); @@ -992,7 +993,7 @@ vring_relay(void *arg) continue; DRV_LOG(INFO, "Error reading " "kickfd: %s", - strerror(errno)); + rte_strerror(errno)); } break; } while (1); @@ -1265,7 +1266,7 @@ ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size) ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, ®); if (ret) { DRV_LOG(ERR, "Get not get device region info: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } From patchwork Tue Nov 14 08:25:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134230 X-Patchwork-Delegate: thomas@monjalon.net 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 716E543325; Tue, 14 Nov 2023 09:30:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E174242D87; Tue, 14 Nov 2023 09:26:31 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id D7BDD402B0 for ; Tue, 14 Nov 2023 09:25:47 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4STzlX0X0NzMmmt; Tue, 14 Nov 2023 16:21:12 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:46 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 42/43] vdpa/mlx5: use rte strerror Date: Tue, 14 Nov 2023 16:25:38 +0800 Message-ID: <20231114082539.1858594-43-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index 607e290995..243abef588 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -44,7 +44,7 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg) errno == EAGAIN) continue; DRV_LOG(ERR, "Failed to read kickfd of virtq %d: %s.", - virtq->index, strerror(errno)); + virtq->index, rte_strerror(errno)); } break; } From patchwork Tue Nov 14 08:25:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dengdui Huang X-Patchwork-Id: 134229 X-Patchwork-Delegate: thomas@monjalon.net 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 0CF3A43325; Tue, 14 Nov 2023 09:29:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE53C42D72; Tue, 14 Nov 2023 09:26:30 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 1961A402EE for ; Tue, 14 Nov 2023 09:25:48 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4STzrP4WPpzWhMr; Tue, 14 Nov 2023 16:25:25 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:46 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 43/43] vdpa/sfc: use rte strerror Date: Tue, 14 Nov 2023 16:25:39 +0800 Message-ID: <20231114082539.1858594-44-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it. Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Acked-by: Chengwen Feng --- drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c index 00f9a4b04c..56fb7f96d8 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c @@ -137,7 +137,7 @@ sfc_vdpa_enable_vfio_intr(struct sfc_vdpa_ops_data *ops_data) if (rc) { sfc_vdpa_err(ops_data->dev_handle, "error enabling MSI-X interrupts: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -165,7 +165,7 @@ sfc_vdpa_disable_vfio_intr(struct sfc_vdpa_ops_data *ops_data) if (rc) { sfc_vdpa_err(ops_data->dev_handle, "error disabling MSI-X interrupts: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -841,7 +841,7 @@ sfc_vdpa_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size) ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, ®); if (ret != 0) { sfc_vdpa_err(dev, "could not get device region info: %s", - strerror(errno)); + rte_strerror(errno)); return ret; }