* [PATCH 00/43] replace strerror @ 2023-11-14 8:24 Dengdui Huang 2023-11-14 8:24 ` [PATCH 01/43] devtools: forbid use of strerror Dengdui Huang ` (46 more replies) 0 siblings, 47 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong The function strerror() is insecure in a multi-thread environment. This series of patches fix it. In this patchset, only the libs and drivers are modified. Dengdui Huang (43): devtools: forbid use of strerror eal: use rte strerror eventdev: use rte strerror latency: use rte strerror node: use rte strerror pdump: use rte strerror power: use rte strerror telemetry: replace strerror vhost: use rte strerror bpf: use rte strerror bus/cdx: use rte strerror bus/dpaa: use rte strerror bus/fslmc: use rte strerror bus/pci: use rte strerror bus/vdev: use rte strerror bus/vmbus: use rte strerror common/cnxk: use rte strerror common/mlx5: use rte strerror crypto/caam_jr: use rte strerror dma/idxd: use rte strerror net/af_packet: use rte strerror net/bnxt: use rte strerror net/af_xdp: use rte strerror net/bonding: use rte strerror net/dpaa: use rte strerror net/dpaa2: use rte strerror net/enetfec: use rte strerror net/failsafe: use rte strerror net/i40e: use rte strerror net/ice: use rte strerror net/ixgbe: use rte strerror net/memif: use rte strerror net/mlx4: use rte strerror net/mlx5: use rte strerror net/qede: use rte strerror net/sfc: use rte strerror net/tap: use rte strerror net/vhost: use rte strerror net/virtio: use rte strerror raw/ifpga: use rte strerror vdpa/ifc: use rte strerror vdpa/mlx5: use rte strerror vdpa/sfc: use rte strerror devtools/checkpatches.sh | 8 + drivers/bus/cdx/cdx.c | 2 +- drivers/bus/cdx/cdx_vfio.c | 13 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/dpaa_bus.c | 2 +- drivers/bus/fslmc/fslmc_vfio.c | 12 +- 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 +- drivers/bus/vdev/vdev.c | 2 +- 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 +- drivers/common/cnxk/roc_dev.c | 4 +- drivers/common/cnxk/roc_model.c | 4 +- drivers/common/cnxk/roc_utils.c | 4 +- drivers/common/mlx5/linux/mlx5_nl.c | 12 +- drivers/common/mlx5/mlx5_common.c | 6 +- drivers/common/mlx5/mlx5_devx_cmds.c | 2 +- drivers/crypto/caam_jr/caam_jr_uio.c | 5 +- drivers/dma/idxd/idxd_bus.c | 14 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 12 +- 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 +- 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 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +- drivers/net/dpaa/fmlib/fm_lib.c | 6 +- drivers/net/dpaa2/dpaa2_ethdev.c | 4 +- drivers/net/enetfec/enet_uio.c | 2 +- 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 +- drivers/net/i40e/i40e_testpmd.c | 42 +-- drivers/net/ice/ice_testpmd.c | 4 +- drivers/net/ixgbe/ixgbe_testpmd.c | 12 +- drivers/net/memif/memif_socket.c | 4 +- drivers/net/memif/rte_eth_memif.c | 20 +- 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 +- 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 +- drivers/net/qede/qede_regs.c | 4 +- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/sfc/sfc_flow_tunnel.c | 2 +- drivers/net/sfc/sfc_mae.c | 58 ++--- 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 +- drivers/net/vhost/rte_eth_vhost.c | 6 +- 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 +- drivers/raw/ifpga/afu_pmd_n3000.c | 5 +- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +- drivers/raw/ifpga/ifpga_rawdev.c | 2 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 23 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +- drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +- lib/bpf/bpf_load_elf.c | 2 +- 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 +- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- lib/latencystats/rte_latencystats.c | 4 +- lib/node/kernel_tx.c | 2 +- lib/pdump/rte_pdump.c | 6 +- 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 +- lib/telemetry/telemetry.c | 28 +- lib/telemetry/telemetry_legacy.c | 5 +- lib/vhost/socket.c | 13 +- lib/vhost/vduse.c | 30 +-- lib/vhost/vhost_user.c | 11 +- 137 files changed, 963 insertions(+), 903 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 01/43] devtools: forbid use of strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang @ 2023-11-14 8:24 ` Dengdui Huang 2023-11-14 8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang ` (45 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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() { # <patch> -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='\\<RTE_LOG_REGISTER\\>' \ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 02/43] eal: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang 2023-11-14 8:24 ` [PATCH 01/43] devtools: forbid use of strerror Dengdui Huang @ 2023-11-14 8:24 ` Dengdui Huang 2023-11-15 0:18 ` Stephen Hemminger 2023-11-15 0:22 ` Stephen Hemminger 2023-11-14 8:24 ` [PATCH 03/43] eventdev: " Dengdui Huang ` (44 subsequent siblings) 46 siblings, 2 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_errno.h> #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 <rte_log.h> #include <rte_common.h> #include "rte_string_fns.h" +#include <rte_errno.h> #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 <rte_log.h> #include <rte_eal.h> #include <rte_memory.h> +#include <rte_errno.h> #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 <unistd.h> #include <rte_log.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH 02/43] eal: use rte strerror 2023-11-14 8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang @ 2023-11-15 0:18 ` Stephen Hemminger 2023-11-15 11:16 ` Morten Brørup 2023-11-15 0:22 ` Stephen Hemminger 1 sibling, 1 reply; 264+ messages in thread From: Stephen Hemminger @ 2023-11-15 0:18 UTC (permalink / raw) To: Dengdui Huang; +Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong On Tue, 14 Nov 2023 16:24:58 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > 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 <huangdengdui@huawei.com> > Acked-by: Chengwen Feng <fengchengwen@huawei.com> NAK. rte_strerror() is no more thrad safe than strerror() and only is appropriate for rte_errno, ie errors from DPDK. It is not originally designed as strerror() replacement. ^ permalink raw reply [flat|nested] 264+ messages in thread
* RE: [PATCH 02/43] eal: use rte strerror 2023-11-15 0:18 ` Stephen Hemminger @ 2023-11-15 11:16 ` Morten Brørup 2024-02-01 21:49 ` Stephen Hemminger 0 siblings, 1 reply; 264+ messages in thread From: Morten Brørup @ 2023-11-15 11:16 UTC (permalink / raw) To: Stephen Hemminger, Dengdui Huang Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Wednesday, 15 November 2023 01.18 > > On Tue, 14 Nov 2023 16:24:58 +0800 > Dengdui Huang <huangdengdui@huawei.com> wrote: > > > 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 <huangdengdui@huawei.com> > > Acked-by: Chengwen Feng <fengchengwen@huawei.com> > > NAK. > rte_strerror() is no more thrad safe than strerror() It is thread safe: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/common/eal_common_errno.c#L31 > and only > is appropriate for rte_errno, ie errors from DPDK. > It is not originally designed as strerror() replacement. I can buy this argument. However, if we ensure that DPDK specific error numbers don't overlap POSIX (and Windows specific, if any) error numbers, I would consider rte_strerror() an excellent alternative to strerror(). We could then consider deeming strerror() unsafe, and add it to checkpatches to recommend rte_strerror() as the general replacement. ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH 02/43] eal: use rte strerror 2023-11-15 11:16 ` Morten Brørup @ 2024-02-01 21:49 ` Stephen Hemminger 0 siblings, 0 replies; 264+ messages in thread From: Stephen Hemminger @ 2024-02-01 21:49 UTC (permalink / raw) To: Morten Brørup Cc: Dengdui Huang, dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong On Wed, 15 Nov 2023 12:16:18 +0100 Morten Brørup <mb@smartsharesystems.com> wrote: > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Wednesday, 15 November 2023 01.18 > > > > On Tue, 14 Nov 2023 16:24:58 +0800 > > Dengdui Huang <huangdengdui@huawei.com> wrote: > > > > > 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 <huangdengdui@huawei.com> > > > Acked-by: Chengwen Feng <fengchengwen@huawei.com> > > > > NAK. > > rte_strerror() is no more thrad safe than strerror() > > It is thread safe: > https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/common/eal_common_errno.c#L31 Thread safe, but not signal safe. a per-core buffer is not safe against preemption in an interrupt. ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH 02/43] eal: use rte strerror 2023-11-14 8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang 2023-11-15 0:18 ` Stephen Hemminger @ 2023-11-15 0:22 ` Stephen Hemminger 2023-11-15 11:23 ` Morten Brørup 1 sibling, 1 reply; 264+ messages in thread From: Stephen Hemminger @ 2023-11-15 0:22 UTC (permalink / raw) To: Dengdui Huang; +Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong On Tue, 14 Nov 2023 16:24:58 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > 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 <huangdengdui@huawei.com> > Acked-by: Chengwen Feng <fengchengwen@huawei.com> > --- Look at implementation of rte_strerror(), it still has issues if used from non-DPDK registered threads. ^ permalink raw reply [flat|nested] 264+ messages in thread
* RE: [PATCH 02/43] eal: use rte strerror 2023-11-15 0:22 ` Stephen Hemminger @ 2023-11-15 11:23 ` Morten Brørup 2023-11-15 15:06 ` Stephen Hemminger 0 siblings, 1 reply; 264+ messages in thread From: Morten Brørup @ 2023-11-15 11:23 UTC (permalink / raw) To: Stephen Hemminger, Dengdui Huang Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Wednesday, 15 November 2023 01.23 > > On Tue, 14 Nov 2023 16:24:58 +0800 > Dengdui Huang <huangdengdui@huawei.com> wrote: > > > 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 <huangdengdui@huawei.com> > > Acked-by: Chengwen Feng <fengchengwen@huawei.com> > > --- > > Look at implementation of rte_strerror(), it still has issues if > used from non-DPDK registered threads. The macro names RTE_DEFINE_PER_LCORE() and RTE_PER_LCORE() strongly indicate that the variables are instantiated per lcore. But they are not; they are instantiated per thread [1]: #define RTE_DEFINE_PER_LCORE(type, name) \ __thread __typeof__(type) per_lcore_##name [1]: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_per_lcore.h#L37 ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH 02/43] eal: use rte strerror 2023-11-15 11:23 ` Morten Brørup @ 2023-11-15 15:06 ` Stephen Hemminger 0 siblings, 0 replies; 264+ messages in thread From: Stephen Hemminger @ 2023-11-15 15:06 UTC (permalink / raw) To: Morten Brørup Cc: Dengdui Huang, dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong On Wed, 15 Nov 2023 12:23:13 +0100 Morten Brørup <mb@smartsharesystems.com> wrote: > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Wednesday, 15 November 2023 01.23 > > > > On Tue, 14 Nov 2023 16:24:58 +0800 > > Dengdui Huang <huangdengdui@huawei.com> wrote: > > > > > 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 <huangdengdui@huawei.com> > > > Acked-by: Chengwen Feng <fengchengwen@huawei.com> > > > --- > > > > Look at implementation of rte_strerror(), it still has issues if > > used from non-DPDK registered threads. > > The macro names RTE_DEFINE_PER_LCORE() and RTE_PER_LCORE() strongly indicate that the variables are instantiated per lcore. > > But they are not; they are instantiated per thread [1]: So rte_strerror() is thread safe (good). It make sense to use it, take back my original negative comments. We could improve documentation of rte_strerror() to help. ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 03/43] eventdev: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang 2023-11-14 8:24 ` [PATCH 01/43] devtools: forbid use of strerror Dengdui Huang 2023-11-14 8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang @ 2023-11-14 8:24 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 04/43] latency: " Dengdui Huang ` (43 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 04/43] latency: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (2 preceding siblings ...) 2023-11-14 8:24 ` [PATCH 03/43] eventdev: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 05/43] node: " Dengdui Huang ` (42 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 05/43] node: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (3 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 04/43] latency: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 06/43] pdump: " Dengdui Huang ` (41 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 06/43] pdump: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (4 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 05/43] node: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 07/43] power: " Dengdui Huang ` (40 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 07/43] power: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (5 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 06/43] pdump: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 08/43] telemetry: replace strerror Dengdui Huang ` (39 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_log.h> #include <rte_power.h> +#include <rte_errno.h> #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 <string.h> #include <rte_log.h> +#include <rte_errno.h> #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 <rte_memcpy.h> #include <rte_stdatomic.h> +#include <rte_errno.h> #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 */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 08/43] telemetry: replace strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (6 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 07/43] power: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 09/43] vhost: use rte strerror Dengdui Huang ` (38 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 09/43] vhost: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (7 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 08/43] telemetry: replace strerror Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 10/43] bpf: " Dengdui Huang ` (37 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_thread.h> #include <rte_log.h> +#include <rte_errno.h> #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 10/43] bpf: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (8 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 09/43] vhost: use rte strerror Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 11/43] bus/cdx: " Dengdui Huang ` (36 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 11/43] bus/cdx: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (9 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 10/43] bpf: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 12/43] bus/dpaa: " Dengdui Huang ` (35 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_eal_paging.h> #include <rte_malloc.h> #include <rte_vfio.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 12/43] bus/dpaa: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (10 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 11/43] bus/cdx: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 13/43] bus/fslmc: " Dengdui Huang ` (34 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 13/43] bus/fslmc: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (11 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 12/43] bus/dpaa: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 14/43] bus/pci: " Dengdui Huang ` (33 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 14/43] bus/pci: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (12 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 13/43] bus/fslmc: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 15/43] bus/vdev: " Dengdui Huang ` (32 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_devargs.h> #include <rte_memcpy.h> #include <rte_vfio.h> +#include <rte_errno.h> #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 <rte_bus_pci.h> #include <rte_common.h> #include <rte_malloc.h> +#include <rte_errno.h> #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 <bus_driver.h> #include <rte_spinlock.h> #include <rte_tailq.h> +#include <rte_errno.h> #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 <rte_tailq.h> #include <rte_log.h> #include <rte_malloc.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 15/43] bus/vdev: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (13 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 14/43] bus/pci: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 16/43] bus/vmbus: " Dengdui Huang ` (31 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 16/43] bus/vmbus: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (14 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 15/43] bus/vdev: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 17/43] common/cnxk: " Dengdui Huang ` (30 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_memory.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #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 <rte_malloc.h> #include <rte_bus_vmbus.h> #include <rte_string_fns.h> +#include <rte_errno.h> #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 <rte_log.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 17/43] common/cnxk: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (15 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 16/43] bus/vmbus: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 18/43] common/mlx5: " Dengdui Huang ` (29 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <sys/mman.h> #include <unistd.h> +#include <rte_errno.h> + #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 <fcntl.h> #include <unistd.h> +#include <rte_errno.h> + #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 <rte_errno.h> + #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 18/43] common/mlx5: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (16 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 17/43] common/cnxk: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 19/43] crypto/caam_jr: " Dengdui Huang ` (28 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 19/43] crypto/caam_jr: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (17 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 18/43] common/mlx5: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 20/43] dma/idxd: " Dengdui Huang ` (27 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_malloc.h> #include <rte_crypto.h> #include <rte_security.h> +#include <rte_errno.h> #include <caam_jr_config.h> #include <caam_jr_hw_specific.h> @@ -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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 20/43] dma/idxd: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (18 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 19/43] crypto/caam_jr: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 21/43] net/af_packet: " Dengdui Huang ` (26 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 21/43] net/af_packet: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (19 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 20/43] dma/idxd: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 22/43] net/bnxt: " Dengdui Huang ` (25 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 22/43] net/bnxt: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (20 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 21/43] net/af_packet: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 23/43] net/af_xdp: " Dengdui Huang ` (24 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 23/43] net/af_xdp: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (21 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 22/43] net/bnxt: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 24/43] net/bonding: " Dengdui Huang ` (23 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 24/43] net/bonding: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (22 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 23/43] net/af_xdp: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 25/43] net/dpaa: " Dengdui Huang ` (22 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 25/43] net/dpaa: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (23 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 24/43] net/bonding: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 26/43] net/dpaa2: " Dengdui Huang ` (21 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 26/43] net/dpaa2: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (24 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 25/43] net/dpaa: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 27/43] net/enetfec: " Dengdui Huang ` (20 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 27/43] net/enetfec: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (25 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 26/43] net/dpaa2: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 28/43] net/failsafe: " Dengdui Huang ` (19 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 28/43] net/failsafe: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (26 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 27/43] net/enetfec: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 29/43] net/i40e: " Dengdui Huang ` (18 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } /* -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 29/43] net/i40e: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (27 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 28/43] net/failsafe: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 30/43] net/ice: " Dengdui Huang ` (17 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 30/43] net/ice: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (28 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 29/43] net/i40e: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 31/43] net/ixgbe: " Dengdui Huang ` (16 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 31/43] net/ixgbe: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (29 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 30/43] net/ice: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 32/43] net/memif: " Dengdui Huang ` (15 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 32/43] net/memif: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (30 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 31/43] net/ixgbe: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 33/43] net/mlx4: " Dengdui Huang ` (14 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 33/43] net/mlx4: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (31 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 32/43] net/memif: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 34/43] net/mlx5: " Dengdui Huang ` (13 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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. */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 34/43] net/mlx5: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (32 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 33/43] net/mlx4: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 35/43] net/qede: " Dengdui Huang ` (12 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 35/43] net/qede: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (33 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 34/43] net/mlx5: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 36/43] net/sfc: " Dengdui Huang ` (11 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 36/43] net/sfc: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (34 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 35/43] net/qede: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 37/43] net/tap: " Dengdui Huang ` (10 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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, -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 37/43] net/tap: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (35 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 36/43] net/sfc: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 38/43] net/vhost: " Dengdui Huang ` (9 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_malloc.h> #include <tap_netlink.h> #include <rte_random.h> +#include <rte_errno.h> #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 <net/if.h> #include <string.h> +#include <rte_errno.h> + #include <rte_log.h> #include <tap_tcmsgs.h> #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 38/43] net/vhost: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (36 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 37/43] net/tap: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 39/43] net/virtio: " Dengdui Huang ` (8 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 39/43] net/virtio: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (37 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 38/43] net/vhost: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 40/43] raw/ifpga: " Dengdui Huang ` (7 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <limits.h> #include <rte_ether.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 40/43] raw/ifpga: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (38 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 39/43] net/virtio: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 41/43] vdpa/ifc: " Dengdui Huang ` (6 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <bus_pci_driver.h> #include <bus_ifpga_driver.h> #include <rte_rawdev.h> +#include <rte_errno.h> #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 <unistd.h> #include "ifpga_sec_mgr.h" +#include <rte_errno.h> + 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 41/43] vdpa/ifc: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (39 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 40/43] raw/ifpga: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 42/43] vdpa/mlx5: " Dengdui Huang ` (5 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_log.h> #include <rte_kvargs.h> #include <rte_devargs.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 42/43] vdpa/mlx5: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (40 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 41/43] vdpa/ifc: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang ` (4 subsequent siblings) 46 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH 43/43] vdpa/sfc: use rte strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (41 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 42/43] vdpa/mlx5: " Dengdui Huang @ 2023-11-14 8:25 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (2 more replies) 2023-11-15 0:16 ` [PATCH 00/43] " Stephen Hemminger ` (3 subsequent siblings) 46 siblings, 3 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 8:25 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 00/43] replace strerror 2023-11-14 8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 01/43] devtools: forbid use of strerror Dengdui Huang ` (42 more replies) 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang 2 siblings, 43 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong The function strerror() is insecure in a multi-thread environment. This series of patches fix it. In this patchset, only the libs and drivers are modified. chang log: v1-v2 fix ci error Dengdui Huang (43): devtools: forbid use of strerror eal: use rte strerror eventdev: use rte strerror latency: use rte strerror node: use rte strerror pdump: use rte strerror power: use rte strerror telemetry: replace strerror vhost: use rte strerror bpf: use rte strerror bus/cdx: use rte strerror bus/dpaa: use rte strerror bus/fslmc: use rte strerror bus/pci: use rte strerror bus/vdev: use rte strerror bus/vmbus: use rte strerror common/cnxk: use rte strerror common/mlx5: use rte strerror crypto/caam_jr: use rte strerror dma/idxd: use rte strerror net/af_packet: use rte strerror net/bnxt: use rte strerror net/af_xdp: use rte strerror net/bonding: use rte strerror net/dpaa: use rte strerror net/dpaa2: use rte strerror net/enetfec: use rte strerror net/failsafe: use rte strerror net/i40e: use rte strerror net/ice: use rte strerror net/ixgbe: use rte strerror net/memif: use rte strerror net/mlx4: use rte strerror net/mlx5: use rte strerror net/qede: use rte strerror net/sfc: use rte strerror net/tap: use rte strerror net/vhost: use rte strerror net/virtio: use rte strerror raw/ifpga: use rte strerror vdpa/ifc: use rte strerror vdpa/mlx5: use rte strerror vdpa/sfc: use rte strerror devtools/checkpatches.sh | 8 + drivers/bus/cdx/cdx.c | 2 +- drivers/bus/cdx/cdx_vfio.c | 13 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/dpaa_bus.c | 2 +- drivers/bus/fslmc/fslmc_vfio.c | 12 +- 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 +- drivers/bus/vdev/vdev.c | 2 +- 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 +- drivers/common/cnxk/roc_dev.c | 4 +- drivers/common/cnxk/roc_model.c | 4 +- drivers/common/cnxk/roc_utils.c | 4 +- drivers/common/mlx5/linux/mlx5_nl.c | 12 +- drivers/common/mlx5/mlx5_common.c | 6 +- drivers/common/mlx5/mlx5_devx_cmds.c | 2 +- drivers/crypto/caam_jr/caam_jr_uio.c | 5 +- drivers/dma/idxd/idxd_bus.c | 15 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 12 +- 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 +- 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 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +- drivers/net/dpaa/fmlib/fm_lib.c | 6 +- drivers/net/dpaa2/dpaa2_ethdev.c | 4 +- drivers/net/enetfec/enet_uio.c | 2 +- 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 +- drivers/net/i40e/i40e_testpmd.c | 42 +-- drivers/net/ice/ice_testpmd.c | 4 +- drivers/net/ixgbe/ixgbe_testpmd.c | 12 +- drivers/net/memif/memif_socket.c | 4 +- drivers/net/memif/rte_eth_memif.c | 20 +- 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 +- 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 +- drivers/net/qede/qede_regs.c | 4 +- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/sfc/sfc_flow_tunnel.c | 2 +- drivers/net/sfc/sfc_mae.c | 58 ++--- 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 +- drivers/net/vhost/rte_eth_vhost.c | 6 +- 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 +- drivers/raw/ifpga/afu_pmd_n3000.c | 5 +- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +- drivers/raw/ifpga/ifpga_rawdev.c | 2 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 23 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +- drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +- lib/bpf/bpf_load_elf.c | 2 +- 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 +- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- lib/latencystats/rte_latencystats.c | 4 +- lib/node/kernel_tx.c | 2 +- lib/pdump/rte_pdump.c | 6 +- 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 +- lib/telemetry/telemetry.c | 28 +- lib/telemetry/telemetry_legacy.c | 5 +- lib/vhost/socket.c | 13 +- lib/vhost/vduse.c | 31 +-- lib/vhost/vhost_user.c | 11 +- 137 files changed, 965 insertions(+), 903 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 01/43] devtools: forbid use of strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 02/43] eal: use rte strerror Dengdui Huang ` (41 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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() { # <patch> -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='\\<RTE_LOG_REGISTER\\>' \ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 02/43] eal: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 01/43] devtools: forbid use of strerror Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 03/43] eventdev: " Dengdui Huang ` (40 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_errno.h> #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 <rte_log.h> #include <rte_common.h> #include "rte_string_fns.h" +#include <rte_errno.h> #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 <rte_log.h> #include <rte_eal.h> #include <rte_memory.h> +#include <rte_errno.h> #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 <unistd.h> #include <rte_log.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 03/43] eventdev: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 01/43] devtools: forbid use of strerror Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 02/43] eal: use rte strerror Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 04/43] latency: " Dengdui Huang ` (39 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 04/43] latency: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (2 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 03/43] eventdev: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 05/43] node: " Dengdui Huang ` (38 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 05/43] node: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (3 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 04/43] latency: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 06/43] pdump: " Dengdui Huang ` (37 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 06/43] pdump: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (4 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 05/43] node: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 07/43] power: " Dengdui Huang ` (36 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 07/43] power: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (5 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 06/43] pdump: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 08/43] telemetry: replace strerror Dengdui Huang ` (35 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_log.h> #include <rte_power.h> +#include <rte_errno.h> #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 <string.h> #include <rte_log.h> +#include <rte_errno.h> #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 <rte_memcpy.h> #include <rte_stdatomic.h> +#include <rte_errno.h> #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 */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 08/43] telemetry: replace strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (6 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 07/43] power: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 09/43] vhost: use rte strerror Dengdui Huang ` (34 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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..27c19979fb 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) { + (void)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)); + (void)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)); + (void)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)); + (void)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) { + (void)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) { + (void)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..09e8d220ca 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) { + (void)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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 09/43] vhost: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (7 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 08/43] telemetry: replace strerror Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 10/43] bpf: " Dengdui Huang ` (33 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- lib/vhost/socket.c | 13 +++++++------ lib/vhost/vduse.c | 31 ++++++++++++++++--------------- lib/vhost/vhost_user.c | 11 ++++++----- 3 files changed, 29 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 <rte_thread.h> #include <rte_log.h> +#include <rte_errno.h> #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..e2e056754c 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -17,6 +17,7 @@ #include <rte_common.h> #include <rte_thread.h> +#include <rte_errno.h> #include "fd_man.h" #include "iotlb.h" @@ -135,7 +136,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 +158,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 +184,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 +214,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 +225,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 +255,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 +292,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 +359,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 +401,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 +454,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 +508,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 +523,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 +626,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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 10/43] bpf: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (8 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 09/43] vhost: use rte strerror Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 11/43] bus/cdx: " Dengdui Huang ` (32 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 11/43] bus/cdx: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (9 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 10/43] bpf: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 12/43] bus/dpaa: " Dengdui Huang ` (31 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_eal_paging.h> #include <rte_malloc.h> #include <rte_vfio.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 12/43] bus/dpaa: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (10 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 11/43] bus/cdx: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 13/43] bus/fslmc: " Dengdui Huang ` (30 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 13/43] bus/fslmc: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (11 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 12/43] bus/dpaa: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 14/43] bus/pci: " Dengdui Huang ` (29 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 14/43] bus/pci: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (12 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 13/43] bus/fslmc: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 15/43] bus/vdev: " Dengdui Huang ` (28 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_devargs.h> #include <rte_memcpy.h> #include <rte_vfio.h> +#include <rte_errno.h> #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 <rte_bus_pci.h> #include <rte_common.h> #include <rte_malloc.h> +#include <rte_errno.h> #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 <bus_driver.h> #include <rte_spinlock.h> #include <rte_tailq.h> +#include <rte_errno.h> #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 <rte_tailq.h> #include <rte_log.h> #include <rte_malloc.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 15/43] bus/vdev: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (13 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 14/43] bus/pci: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 16/43] bus/vmbus: " Dengdui Huang ` (27 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 16/43] bus/vmbus: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (14 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 15/43] bus/vdev: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 17/43] common/cnxk: " Dengdui Huang ` (26 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_memory.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #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 <rte_malloc.h> #include <rte_bus_vmbus.h> #include <rte_string_fns.h> +#include <rte_errno.h> #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 <rte_log.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 17/43] common/cnxk: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (15 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 16/43] bus/vmbus: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 18/43] common/mlx5: " Dengdui Huang ` (25 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <sys/mman.h> #include <unistd.h> +#include <rte_errno.h> + #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 <fcntl.h> #include <unistd.h> +#include <rte_errno.h> + #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 <rte_errno.h> + #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 18/43] common/mlx5: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (16 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 17/43] common/cnxk: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 19/43] crypto/caam_jr: " Dengdui Huang ` (24 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 19/43] crypto/caam_jr: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (17 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 18/43] common/mlx5: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 20/43] dma/idxd: " Dengdui Huang ` (23 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_malloc.h> #include <rte_crypto.h> #include <rte_security.h> +#include <rte_errno.h> #include <caam_jr_config.h> #include <caam_jr_hw_specific.h> @@ -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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 20/43] dma/idxd: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (18 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 19/43] crypto/caam_jr: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 21/43] net/af_packet: " Dengdui Huang ` (22 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/dma/idxd/idxd_bus.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c index 3b2d4c2b65..d0919504af 100644 --- a/drivers/dma/idxd/idxd_bus.c +++ b/drivers/dma/idxd/idxd_bus.c @@ -16,6 +16,7 @@ #include <rte_log.h> #include <rte_dmadev_pmd.h> #include <rte_string_fns.h> +#include <rte_errno.h> #include "idxd_internal.h" @@ -145,7 +146,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 +154,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 +174,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 +201,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 +318,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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 21/43] net/af_packet: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (19 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 20/43] dma/idxd: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 22/43] net/bnxt: " Dengdui Huang ` (21 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 22/43] net/bnxt: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (20 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 21/43] net/af_packet: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 23/43] net/af_xdp: " Dengdui Huang ` (20 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 23/43] net/af_xdp: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (21 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 22/43] net/bnxt: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 24/43] net/bonding: " Dengdui Huang ` (19 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 24/43] net/bonding: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (22 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 23/43] net/af_xdp: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 25/43] net/dpaa: " Dengdui Huang ` (18 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 25/43] net/dpaa: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (23 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 24/43] net/bonding: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 26/43] net/dpaa2: " Dengdui Huang ` (17 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 26/43] net/dpaa2: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (24 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 25/43] net/dpaa: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 27/43] net/enetfec: " Dengdui Huang ` (16 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 27/43] net/enetfec: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (25 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 26/43] net/dpaa2: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 28/43] net/failsafe: " Dengdui Huang ` (15 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 28/43] net/failsafe: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (26 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 27/43] net/enetfec: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 29/43] net/i40e: " Dengdui Huang ` (14 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } /* -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 29/43] net/i40e: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (27 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 28/43] net/failsafe: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 30/43] net/ice: " Dengdui Huang ` (13 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 30/43] net/ice: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (28 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 29/43] net/i40e: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 31/43] net/ixgbe: " Dengdui Huang ` (12 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 31/43] net/ixgbe: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (29 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 30/43] net/ice: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 32/43] net/memif: " Dengdui Huang ` (11 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 32/43] net/memif: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (30 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 31/43] net/ixgbe: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 33/43] net/mlx4: " Dengdui Huang ` (10 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 33/43] net/mlx4: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (31 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 32/43] net/memif: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 34/43] net/mlx5: " Dengdui Huang ` (9 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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. */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 34/43] net/mlx5: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (32 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 33/43] net/mlx4: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 35/43] net/qede: " Dengdui Huang ` (8 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 35/43] net/qede: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (33 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 34/43] net/mlx5: " Dengdui Huang @ 2023-11-14 11:23 ` Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 36/43] net/sfc: " Dengdui Huang ` (7 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 36/43] net/sfc: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (34 preceding siblings ...) 2023-11-14 11:23 ` [PATCH v2 35/43] net/qede: " Dengdui Huang @ 2023-11-14 11:24 ` Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 37/43] net/tap: " Dengdui Huang ` (6 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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, -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 37/43] net/tap: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (35 preceding siblings ...) 2023-11-14 11:24 ` [PATCH v2 36/43] net/sfc: " Dengdui Huang @ 2023-11-14 11:24 ` Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 38/43] net/vhost: " Dengdui Huang ` (5 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_malloc.h> #include <tap_netlink.h> #include <rte_random.h> +#include <rte_errno.h> #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 <net/if.h> #include <string.h> +#include <rte_errno.h> + #include <rte_log.h> #include <tap_tcmsgs.h> #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 38/43] net/vhost: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (36 preceding siblings ...) 2023-11-14 11:24 ` [PATCH v2 37/43] net/tap: " Dengdui Huang @ 2023-11-14 11:24 ` Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 39/43] net/virtio: " Dengdui Huang ` (4 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 39/43] net/virtio: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (37 preceding siblings ...) 2023-11-14 11:24 ` [PATCH v2 38/43] net/vhost: " Dengdui Huang @ 2023-11-14 11:24 ` Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 40/43] raw/ifpga: " Dengdui Huang ` (3 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <limits.h> #include <rte_ether.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 40/43] raw/ifpga: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (38 preceding siblings ...) 2023-11-14 11:24 ` [PATCH v2 39/43] net/virtio: " Dengdui Huang @ 2023-11-14 11:24 ` Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 41/43] vdpa/ifc: " Dengdui Huang ` (2 subsequent siblings) 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <bus_pci_driver.h> #include <bus_ifpga_driver.h> #include <rte_rawdev.h> +#include <rte_errno.h> #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 <unistd.h> #include "ifpga_sec_mgr.h" +#include <rte_errno.h> + 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 41/43] vdpa/ifc: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (39 preceding siblings ...) 2023-11-14 11:24 ` [PATCH v2 40/43] raw/ifpga: " Dengdui Huang @ 2023-11-14 11:24 ` Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 42/43] vdpa/mlx5: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 43/43] vdpa/sfc: " Dengdui Huang 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_log.h> #include <rte_kvargs.h> #include <rte_devargs.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 42/43] vdpa/mlx5: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (40 preceding siblings ...) 2023-11-14 11:24 ` [PATCH v2 41/43] vdpa/ifc: " Dengdui Huang @ 2023-11-14 11:24 ` Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 43/43] vdpa/sfc: " Dengdui Huang 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v2 43/43] vdpa/sfc: use rte strerror 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang ` (41 preceding siblings ...) 2023-11-14 11:24 ` [PATCH v2 42/43] vdpa/mlx5: " Dengdui Huang @ 2023-11-14 11:24 ` Dengdui Huang 42 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 00/42] replace strerror 2023-11-14 8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 01/42] devtools: forbid use of strerror Dengdui Huang ` (41 more replies) 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang 2 siblings, 42 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong The function strerror() is insecure in a multi-thread environment. This series of patches fix it. In this patchset, only the libs and drivers are modified. chang log: v2->v3 drop patch "telemetry: replace strerror" due to compile fail v1-v2 fix ci error Dengdui Huang (42): devtools: forbid use of strerror eal: use rte strerror eventdev: use rte strerror latency: use rte strerror node: use rte strerror pdump: use rte strerror power: use rte strerror vhost: use rte strerror bpf: use rte strerror bus/cdx: use rte strerror bus/dpaa: use rte strerror bus/fslmc: use rte strerror bus/pci: use rte strerror bus/vdev: use rte strerror bus/vmbus: use rte strerror common/cnxk: use rte strerror common/mlx5: use rte strerror crypto/caam_jr: use rte strerror dma/idxd: use rte strerror net/af_packet: use rte strerror net/bnxt: use rte strerror net/af_xdp: use rte strerror net/bonding: use rte strerror net/dpaa: use rte strerror net/dpaa2: use rte strerror net/enetfec: use rte strerror net/failsafe: use rte strerror net/i40e: use rte strerror net/ice: use rte strerror net/ixgbe: use rte strerror net/memif: use rte strerror net/mlx4: use rte strerror net/mlx5: use rte strerror net/qede: use rte strerror net/sfc: use rte strerror net/tap: use rte strerror net/vhost: use rte strerror net/virtio: use rte strerror raw/ifpga: use rte strerror vdpa/ifc: use rte strerror vdpa/mlx5: use rte strerror vdpa/sfc: use rte strerror devtools/checkpatches.sh | 8 + drivers/bus/cdx/cdx.c | 2 +- drivers/bus/cdx/cdx_vfio.c | 13 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/dpaa_bus.c | 2 +- drivers/bus/fslmc/fslmc_vfio.c | 12 +- 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 +- drivers/bus/vdev/vdev.c | 2 +- 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 +- drivers/common/cnxk/roc_dev.c | 4 +- drivers/common/cnxk/roc_model.c | 4 +- drivers/common/cnxk/roc_utils.c | 4 +- drivers/common/mlx5/linux/mlx5_nl.c | 12 +- drivers/common/mlx5/mlx5_common.c | 6 +- drivers/common/mlx5/mlx5_devx_cmds.c | 2 +- drivers/crypto/caam_jr/caam_jr_uio.c | 5 +- drivers/dma/idxd/idxd_bus.c | 15 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 12 +- 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 +- 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 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +- drivers/net/dpaa/fmlib/fm_lib.c | 6 +- drivers/net/dpaa2/dpaa2_ethdev.c | 4 +- drivers/net/enetfec/enet_uio.c | 2 +- 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 +- drivers/net/i40e/i40e_testpmd.c | 42 +-- drivers/net/ice/ice_testpmd.c | 4 +- drivers/net/ixgbe/ixgbe_testpmd.c | 12 +- drivers/net/memif/memif_socket.c | 4 +- drivers/net/memif/rte_eth_memif.c | 20 +- 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 +- 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 +- drivers/net/qede/qede_regs.c | 4 +- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/sfc/sfc_flow_tunnel.c | 2 +- drivers/net/sfc/sfc_mae.c | 58 ++--- 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 +- drivers/net/vhost/rte_eth_vhost.c | 6 +- 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 +- drivers/raw/ifpga/afu_pmd_n3000.c | 5 +- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +- drivers/raw/ifpga/ifpga_rawdev.c | 2 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 23 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +- drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +- lib/bpf/bpf_load_elf.c | 2 +- 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 +- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- lib/latencystats/rte_latencystats.c | 4 +- lib/node/kernel_tx.c | 2 +- lib/pdump/rte_pdump.c | 6 +- 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 +- lib/vhost/socket.c | 13 +- lib/vhost/vduse.c | 31 +-- lib/vhost/vhost_user.c | 11 +- 135 files changed, 939 insertions(+), 896 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 01/42] devtools: forbid use of strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 02/42] eal: use rte strerror Dengdui Huang ` (40 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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() { # <patch> -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='\\<RTE_LOG_REGISTER\\>' \ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 02/42] eal: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 01/42] devtools: forbid use of strerror Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 03/42] eventdev: " Dengdui Huang ` (39 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_errno.h> #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 <rte_log.h> #include <rte_common.h> #include "rte_string_fns.h" +#include <rte_errno.h> #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 <rte_log.h> #include <rte_eal.h> #include <rte_memory.h> +#include <rte_errno.h> #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 <unistd.h> #include <rte_log.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 03/42] eventdev: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 01/42] devtools: forbid use of strerror Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 02/42] eal: use rte strerror Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 04/42] latency: " Dengdui Huang ` (38 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 04/42] latency: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (2 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 03/42] eventdev: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 05/42] node: " Dengdui Huang ` (37 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 05/42] node: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (3 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 04/42] latency: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 06/42] pdump: " Dengdui Huang ` (36 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 06/42] pdump: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (4 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 05/42] node: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 07/42] power: " Dengdui Huang ` (35 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 07/42] power: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (5 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 06/42] pdump: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 08/42] vhost: " Dengdui Huang ` (34 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_log.h> #include <rte_power.h> +#include <rte_errno.h> #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 <string.h> #include <rte_log.h> +#include <rte_errno.h> #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 <rte_memcpy.h> #include <rte_stdatomic.h> +#include <rte_errno.h> #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 */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 08/42] vhost: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (6 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 07/42] power: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 09/42] bpf: " Dengdui Huang ` (33 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- lib/vhost/socket.c | 13 +++++++------ lib/vhost/vduse.c | 31 ++++++++++++++++--------------- lib/vhost/vhost_user.c | 11 ++++++----- 3 files changed, 29 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 <rte_thread.h> #include <rte_log.h> +#include <rte_errno.h> #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..e2e056754c 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -17,6 +17,7 @@ #include <rte_common.h> #include <rte_thread.h> +#include <rte_errno.h> #include "fd_man.h" #include "iotlb.h" @@ -135,7 +136,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 +158,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 +184,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 +214,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 +225,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 +255,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 +292,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 +359,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 +401,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 +454,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 +508,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 +523,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 +626,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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 09/42] bpf: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (7 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 08/42] vhost: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 10/42] bus/cdx: " Dengdui Huang ` (32 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 10/42] bus/cdx: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (8 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 09/42] bpf: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 11/42] bus/dpaa: " Dengdui Huang ` (31 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_eal_paging.h> #include <rte_malloc.h> #include <rte_vfio.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 11/42] bus/dpaa: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (9 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 10/42] bus/cdx: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 12/42] bus/fslmc: " Dengdui Huang ` (30 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 12/42] bus/fslmc: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (10 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 11/42] bus/dpaa: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 13/42] bus/pci: " Dengdui Huang ` (29 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 13/42] bus/pci: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (11 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 12/42] bus/fslmc: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 14/42] bus/vdev: " Dengdui Huang ` (28 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_devargs.h> #include <rte_memcpy.h> #include <rte_vfio.h> +#include <rte_errno.h> #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 <rte_bus_pci.h> #include <rte_common.h> #include <rte_malloc.h> +#include <rte_errno.h> #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 <bus_driver.h> #include <rte_spinlock.h> #include <rte_tailq.h> +#include <rte_errno.h> #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 <rte_tailq.h> #include <rte_log.h> #include <rte_malloc.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 14/42] bus/vdev: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (12 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 13/42] bus/pci: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 15/42] bus/vmbus: " Dengdui Huang ` (27 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 15/42] bus/vmbus: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (13 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 14/42] bus/vdev: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 16/42] common/cnxk: " Dengdui Huang ` (26 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_memory.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #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 <rte_malloc.h> #include <rte_bus_vmbus.h> #include <rte_string_fns.h> +#include <rte_errno.h> #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 <rte_log.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 16/42] common/cnxk: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (14 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 15/42] bus/vmbus: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 17/42] common/mlx5: " Dengdui Huang ` (25 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <sys/mman.h> #include <unistd.h> +#include <rte_errno.h> + #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 <fcntl.h> #include <unistd.h> +#include <rte_errno.h> + #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 <rte_errno.h> + #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 17/42] common/mlx5: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (15 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 16/42] common/cnxk: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 18/42] crypto/caam_jr: " Dengdui Huang ` (24 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 18/42] crypto/caam_jr: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (16 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 17/42] common/mlx5: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 19/42] dma/idxd: " Dengdui Huang ` (23 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_malloc.h> #include <rte_crypto.h> #include <rte_security.h> +#include <rte_errno.h> #include <caam_jr_config.h> #include <caam_jr_hw_specific.h> @@ -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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 19/42] dma/idxd: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (17 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 18/42] crypto/caam_jr: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 20/42] net/af_packet: " Dengdui Huang ` (22 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/dma/idxd/idxd_bus.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c index 3b2d4c2b65..d0919504af 100644 --- a/drivers/dma/idxd/idxd_bus.c +++ b/drivers/dma/idxd/idxd_bus.c @@ -16,6 +16,7 @@ #include <rte_log.h> #include <rte_dmadev_pmd.h> #include <rte_string_fns.h> +#include <rte_errno.h> #include "idxd_internal.h" @@ -145,7 +146,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 +154,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 +174,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 +201,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 +318,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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 20/42] net/af_packet: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (18 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 19/42] dma/idxd: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 21/42] net/bnxt: " Dengdui Huang ` (21 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 21/42] net/bnxt: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (19 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 20/42] net/af_packet: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 22/42] net/af_xdp: " Dengdui Huang ` (20 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 22/42] net/af_xdp: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (20 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 21/42] net/bnxt: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 23/42] net/bonding: " Dengdui Huang ` (19 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 23/42] net/bonding: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (21 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 22/42] net/af_xdp: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 24/42] net/dpaa: " Dengdui Huang ` (18 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 24/42] net/dpaa: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (22 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 23/42] net/bonding: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 25/42] net/dpaa2: " Dengdui Huang ` (17 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 25/42] net/dpaa2: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (23 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 24/42] net/dpaa: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 26/42] net/enetfec: " Dengdui Huang ` (16 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 26/42] net/enetfec: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (24 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 25/42] net/dpaa2: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 27/42] net/failsafe: " Dengdui Huang ` (15 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 27/42] net/failsafe: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (25 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 26/42] net/enetfec: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 28/42] net/i40e: " Dengdui Huang ` (14 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } /* -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 28/42] net/i40e: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (26 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 27/42] net/failsafe: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 29/42] net/ice: " Dengdui Huang ` (13 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 29/42] net/ice: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (27 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 28/42] net/i40e: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 30/42] net/ixgbe: " Dengdui Huang ` (12 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 30/42] net/ixgbe: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (28 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 29/42] net/ice: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 31/42] net/memif: " Dengdui Huang ` (11 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 31/42] net/memif: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (29 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 30/42] net/ixgbe: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 32/42] net/mlx4: " Dengdui Huang ` (10 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 32/42] net/mlx4: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (30 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 31/42] net/memif: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 33/42] net/mlx5: " Dengdui Huang ` (9 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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. */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 33/42] net/mlx5: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (31 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 32/42] net/mlx4: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 34/42] net/qede: " Dengdui Huang ` (8 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 34/42] net/qede: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (32 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 33/42] net/mlx5: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 35/42] net/sfc: " Dengdui Huang ` (7 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 35/42] net/sfc: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (33 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 34/42] net/qede: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 36/42] net/tap: " Dengdui Huang ` (6 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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, -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 36/42] net/tap: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (34 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 35/42] net/sfc: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 37/42] net/vhost: " Dengdui Huang ` (5 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_malloc.h> #include <tap_netlink.h> #include <rte_random.h> +#include <rte_errno.h> #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 <net/if.h> #include <string.h> +#include <rte_errno.h> + #include <rte_log.h> #include <tap_tcmsgs.h> #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 37/42] net/vhost: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (35 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 36/42] net/tap: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 38/42] net/virtio: " Dengdui Huang ` (4 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 38/42] net/virtio: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (36 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 37/42] net/vhost: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 39/42] raw/ifpga: " Dengdui Huang ` (3 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <limits.h> #include <rte_ether.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 39/42] raw/ifpga: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (37 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 38/42] net/virtio: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 40/42] vdpa/ifc: " Dengdui Huang ` (2 subsequent siblings) 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <bus_pci_driver.h> #include <bus_ifpga_driver.h> #include <rte_rawdev.h> +#include <rte_errno.h> #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 <unistd.h> #include "ifpga_sec_mgr.h" +#include <rte_errno.h> + 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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 40/42] vdpa/ifc: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (38 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 39/42] raw/ifpga: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 41/42] vdpa/mlx5: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 42/42] vdpa/sfc: " Dengdui Huang 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 <rte_log.h> #include <rte_kvargs.h> #include <rte_devargs.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 41/42] vdpa/mlx5: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (39 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 40/42] vdpa/ifc: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 42/42] vdpa/sfc: " Dengdui Huang 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v3 42/42] vdpa/sfc: use rte strerror 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang ` (40 preceding siblings ...) 2023-11-14 12:35 ` [PATCH v3 41/42] vdpa/mlx5: " Dengdui Huang @ 2023-11-14 12:35 ` Dengdui Huang 41 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 00/42] replace strerror 2023-11-14 8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 01/42] devtools: forbid use of strerror Dengdui Huang ` (44 more replies) 2 siblings, 45 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. It is better to use rte_strerror() instead of strerror(). In this patchset, only the libs and drivers are modified. chang log: v3->v4 fix ci error v2->v3 drop patch "telemetry: replace strerror" due to compile fail v1-v2 fix ci error Dengdui Huang (42): devtools: forbid use of strerror eal: use rte strerror eventdev: use rte strerror latency: use rte strerror node: use rte strerror pdump: use rte strerror power: use rte strerror vhost: use rte strerror bpf: use rte strerror bus/cdx: use rte strerror bus/dpaa: use rte strerror bus/fslmc: use rte strerror bus/pci: use rte strerror bus/vdev: use rte strerror bus/vmbus: use rte strerror common/cnxk: use rte strerror common/mlx5: use rte strerror crypto/caam_jr: use rte strerror dma/idxd: use rte strerror net/af_packet: use rte strerror net/bnxt: use rte strerror net/af_xdp: use rte strerror net/bonding: use rte strerror net/dpaa: use rte strerror net/dpaa2: use rte strerror net/enetfec: use rte strerror net/failsafe: use rte strerror net/i40e: use rte strerror net/ice: use rte strerror net/ixgbe: use rte strerror net/memif: use rte strerror net/mlx4: use rte strerror net/mlx5: use rte strerror net/qede: use rte strerror net/sfc: use rte strerror net/tap: use rte strerror net/vhost: use rte strerror net/virtio: use rte strerror raw/ifpga: use rte strerror vdpa/ifc: use rte strerror vdpa/mlx5: use rte strerror vdpa/sfc: use rte strerror devtools/checkpatches.sh | 8 + drivers/bus/cdx/cdx.c | 2 +- drivers/bus/cdx/cdx_vfio.c | 13 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/dpaa_bus.c | 2 +- drivers/bus/fslmc/fslmc_vfio.c | 12 +- 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 +- drivers/bus/vdev/vdev.c | 2 +- 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 +- drivers/common/cnxk/roc_dev.c | 6 +- drivers/common/cnxk/roc_model.c | 4 +- drivers/common/cnxk/roc_utils.c | 4 +- drivers/common/mlx5/linux/mlx5_nl.c | 12 +- drivers/common/mlx5/mlx5_common.c | 6 +- drivers/crypto/caam_jr/caam_jr_uio.c | 5 +- drivers/dma/idxd/idxd_bus.c | 15 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 12 +- 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 +- 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 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +- drivers/net/dpaa/fmlib/fm_lib.c | 6 +- drivers/net/dpaa2/dpaa2_ethdev.c | 4 +- drivers/net/enetfec/enet_uio.c | 2 +- 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 +- drivers/net/i40e/i40e_testpmd.c | 42 +-- drivers/net/ice/ice_testpmd.c | 4 +- drivers/net/ixgbe/ixgbe_testpmd.c | 12 +- drivers/net/memif/memif_socket.c | 4 +- drivers/net/memif/rte_eth_memif.c | 20 +- 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 +- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +- 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 | 26 +- 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 +- drivers/net/qede/qede_regs.c | 4 +- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/sfc/sfc_flow_tunnel.c | 2 +- drivers/net/sfc/sfc_mae.c | 58 ++--- drivers/net/tap/rte_eth_tap.c | 28 +- drivers/net/tap/tap_flow.c | 14 +- drivers/net/tap/tap_netlink.c | 5 +- drivers/net/tap/tap_tcmsgs.c | 6 +- drivers/net/vhost/rte_eth_vhost.c | 6 +- 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 +- drivers/raw/ifpga/afu_pmd_n3000.c | 5 +- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +- drivers/raw/ifpga/ifpga_rawdev.c | 2 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 23 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +- drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +- lib/bpf/bpf_load_elf.c | 2 +- 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 | 7 +- 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 | 42 +-- lib/eal/linux/eal_timer.c | 2 +- lib/eal/linux/eal_vfio.c | 42 +-- lib/eal/unix/eal_filesystem.c | 5 +- lib/eal/unix/eal_unix_memory.c | 6 +- lib/eal/unix/rte_thread.c | 6 +- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- lib/latencystats/rte_latencystats.c | 4 +- lib/node/kernel_tx.c | 2 +- lib/pdump/rte_pdump.c | 6 +- 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 +- lib/vhost/fd_man.c | 7 +- lib/vhost/socket.c | 13 +- lib/vhost/vduse.c | 45 ++-- lib/vhost/vhost_user.c | 10 +- 135 files changed, 956 insertions(+), 913 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 01/42] devtools: forbid use of strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 02/42] eal: use rte strerror Dengdui Huang ` (43 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index d860f19045..078d5714da 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -209,6 +209,14 @@ check_forbidden_additions() { # <patch> -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='\\<RTE_LOG_REGISTER\\>' \ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 02/42] eal: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 01/42] devtools: forbid use of strerror Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 03/42] eventdev: " Dengdui Huang ` (42 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 | 7 ++-- 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 | 42 +++++++++++----------- lib/eal/linux/eal_timer.c | 2 +- lib/eal/linux/eal_vfio.c | 42 +++++++++++----------- 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, 119 insertions(+), 114 deletions(-) diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c index 22b43073c6..8b3ab3cb19 100644 --- a/lib/eal/common/eal_common_fbarray.c +++ b/lib/eal/common/eal_common_fbarray.c @@ -1041,7 +1041,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr) eal_get_fbarray_path(path, sizeof(path), arr->name); if (unlink(path)) { EAL_LOG(DEBUG, "Cannot unlink fbarray: %s", - 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 f1a5e329a5..2aee5a7dad 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 <rte_errno.h> #define BITS_PER_HEX 4 #define LCORE_OPT_LST 1 @@ -411,7 +412,7 @@ eal_plugindir_init(const char *path) d = opendir(path); if (d == NULL) { EAL_LOG(ERR, "failed to open directory %s: %s", - path, strerror(errno)); + path, rte_strerror(errno)); return -1; } @@ -463,7 +464,7 @@ verify_perms(const char *dirpath) /* call stat to check for permissions and ensure not world writable */ if (stat(dirpath, &st) != 0) { EAL_LOG(ERR, "Error with stat on %s, %s", - dirpath, strerror(errno)); + dirpath, rte_strerror(errno)); return -1; } if (st.st_mode & S_IWOTH) { @@ -491,7 +492,7 @@ eal_dlopen(const char *pathname) } if (realp == NULL) { EAL_LOG(ERR, "Error with realpath for %s, %s", - 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 d24093937c..07ccf68118 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; - EAL_LOG(ERR, "recvmsg failed, %s", strerror(errno)); + EAL_LOG(ERR, "recvmsg failed, %s", rte_strerror(errno)); return -1; } @@ -583,7 +583,7 @@ open_socket_fd(void) if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) { EAL_LOG(ERR, "failed to bind %s: %s", - 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) { EAL_LOG(ERR, "failed to open %s: %s", - mp_dir_path, strerror(errno)); + mp_dir_path, rte_strerror(errno)); return -1; } if (flock(dir_fd, LOCK_EX)) { EAL_LOG(ERR, "failed to lock %s: %s", - 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) { EAL_LOG(ERR, "failed to create mp thread: %s", - 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; } EAL_LOG(ERR, "failed to send to (%s) due to %s", - 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 7282715b11..ee5fe6f7b3 100644 --- a/lib/eal/common/eal_common_trace_utils.c +++ b/lib/eal/common/eal_common_trace_utils.c @@ -245,7 +245,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; } @@ -329,7 +329,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; } @@ -344,7 +344,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 1229230063..083867babd 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; EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -250,7 +250,7 @@ rte_eal_config_reattach(void) return -1; } EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)", - 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 23747babc2..1fbcdc2f2d 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 EAL_LOG(ERR, "Error adding fd %d kevent, %s", 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) { EAL_LOG(ERR, "Error removing fd %d kevent, %s", 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) EAL_LOG(ERR, "Error reading from file " "descriptor %d: %s", event_fd, - strerror(errno)); + rte_strerror(errno)); } else if (bytes_read == 0) EAL_LOG(ERR, "Read nothing from file " "descriptor %d", event_fd); @@ -567,7 +567,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds) if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) { EAL_LOG(ERR, "Error removing fd %d kevent, %s", 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 a6f3ba226e..029c84f7b2 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) { EAL_LOG(ERR, "%s: mmap() failed: %s", __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 4eba66eadb..ccd07072c6 100644 --- a/lib/eal/freebsd/eal_timer.c +++ b/lib/eal/freebsd/eal_timer.c @@ -15,6 +15,7 @@ #include <rte_memory.h> #include <rte_eal.h> #include <rte_debug.h> +#include <rte_errno.h> #include "eal_private.h" #include "eal_internal_cfg.h" @@ -36,20 +37,20 @@ get_tsc_freq(uint64_t arch_hz) tmp = 0; if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0)) - EAL_LOG(WARNING, "%s", strerror(errno)); + EAL_LOG(WARNING, "%s", rte_strerror(errno)); else if (tmp != 1) EAL_LOG(WARNING, "TSC is not safe to use in SMP mode"); tmp = 0; if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0)) - EAL_LOG(WARNING, "%s", strerror(errno)); + EAL_LOG(WARNING, "%s", rte_strerror(errno)); else if (tmp != 1) EAL_LOG(WARNING, "TSC is not invariant"); sz = sizeof(tsc_hz); if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) { - EAL_LOG(WARNING, "%s", strerror(errno)); + EAL_LOG(WARNING, "%s", rte_strerror(errno)); return arch_hz; } diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 54577b7718..ded2222d49 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -160,7 +160,7 @@ eal_clean_runtime_dir(void) closedir(dir); EAL_LOG(ERR, "Error while clearing runtime dir: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } @@ -288,7 +288,7 @@ rte_eal_config_attach(void) close(mem_cfg_fd); mem_cfg_fd = -1; EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -335,7 +335,7 @@ rte_eal_config_reattach(void) return -1; } EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1412,7 +1412,7 @@ rte_eal_check_module(const char *module_name) /* Check if there is sysfs mounted */ if (stat("/sys/module", &st) != 0) { EAL_LOG(DEBUG, "sysfs is not mounted! error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1425,7 +1425,7 @@ rte_eal_check_module(const char *module_name) if (stat(sysfs_mod_name, &st) != 0) { EAL_LOG(DEBUG, "Module %s not found! error %i (%s)", - 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 e63f24d108..95b1d02c9f 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 d47a19c56a..8d4e28fb58 100644 --- a/lib/eal/linux/eal_hugepage_info.c +++ b/lib/eal/linux/eal_hugepage_info.c @@ -23,6 +23,7 @@ #include <rte_log.h> #include <rte_common.h> #include "rte_string_fns.h" +#include <rte_errno.h> #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); EAL_LOG(ERR, "Error while walking hugepage dir: %s", - 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) EAL_LOG(DEBUG, "%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 6436f796eb..629d012436 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) { EAL_LOG(ERR, "Error disabling interrupts for fd %d (%s)", - 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) { EAL_LOG(ERR, "Error enabling interrupts for fd %d (%s)", - 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) EAL_LOG(ERR, "Error reading from file " "descriptor %d: %s", 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; EAL_LOG(ERR, "Error reading from fd %d: %s", - fd, strerror(errno)); + fd, rte_strerror(errno)); } else if (nbytes == 0) EAL_LOG(ERR, "Read nothing from fd %d", fd); return; @@ -1343,7 +1343,7 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events, } /* epoll_wait fail */ EAL_LOG(ERR, "epoll_wait returns with fail %s", - 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) { EAL_LOG(ERR, "Error op %d fd %d epoll_ctl, %s", - 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) { EAL_LOG(ERR, "can't setup eventfd, error %i (%s)", - 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 e354efc95d..08cb502a5a 100644 --- a/lib/eal/linux/eal_memalloc.c +++ b/lib/eal/linux/eal_memalloc.c @@ -31,6 +31,7 @@ #include <rte_log.h> #include <rte_eal.h> #include <rte_memory.h> +#include <rte_errno.h> #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) { EAL_LOG(ERR, "Failed to get current mempolicy: %s. " - "Assuming MPOL_DEFAULT.", strerror(errno)); + "Assuming MPOL_DEFAULT.", rte_strerror(errno)); *oldpolicy = MPOL_DEFAULT; } EAL_LOG(DEBUG, @@ -180,7 +181,7 @@ restore_numa(int *oldpolicy, struct bitmask *oldmask) } else if (set_mempolicy(*oldpolicy, oldmask->maskp, oldmask->size + 1) < 0) { EAL_LOG(ERR, "Failed to restore mempolicy: %s", - 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) { EAL_LOG(ERR, "%s(): error calling flock(): %s", - __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) { EAL_LOG(DEBUG, "%s(): memfd create failed: %s", - __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) { EAL_LOG(DEBUG, "%s(): memfd create failed: %s", - __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) { EAL_LOG(DEBUG, "%s(): stat() for '%s' failed: %s", - __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) { EAL_LOG(DEBUG, "%s(): could not remove '%s': %s", - __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) { EAL_LOG(ERR, "%s(): open '%s' failed: %s", - __func__, path, strerror(errno)); + __func__, path, rte_strerror(errno)); return -1; } /* take out a read lock */ if (lock(fd, LOCK_SH) < 0) { EAL_LOG(ERR, "%s(): lock '%s' failed: %s", - __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) { EAL_LOG(DEBUG, "%s(): fallocate() failed: %s", __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) { EAL_LOG(DEBUG, "%s(): ftruncate() failed: %s", - __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 { EAL_LOG(DEBUG, "%s(): fallocate() failed: %s", __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)) EAL_LOG(ERR, "%s(): unlinking '%s' failed: %s", - __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) { EAL_LOG(DEBUG, "%s(): ftruncate() failed: %s", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); goto resized; } if (internal_conf->hugepage_file.unlink_before_mapping && !internal_conf->in_memory) { if (unlink(path)) { EAL_LOG(DEBUG, "%s(): unlink() failed: %s", - __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) { EAL_LOG(DEBUG, "%s(): mmap() failed: %s", __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) { EAL_LOG(DEBUG, "%s(): get_mempolicy: %s", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); goto mapped; } else if (cur_socket_id != socket_id) { EAL_LOG(DEBUG, @@ -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) { EAL_LOG(ERR, "%s(): Cannot open '%s': %s", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, rte_strerror(errno)); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { EAL_LOG(ERR, "%s(): Cannot lock '%s': %s", - __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) { EAL_LOG(ERR, "%s(): Cannot open '%s': %s", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, rte_strerror(errno)); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { EAL_LOG(ERR, "%s(): Cannot lock '%s': %s", - __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) { EAL_LOG(ERR, "%s(): Cannot open '%s': %s", __func__, - hi->hugedir, strerror(errno)); + hi->hugedir, rte_strerror(errno)); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { EAL_LOG(ERR, "%s(): Cannot lock '%s': %s", __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 45879ca743..30568335f8 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) { EAL_LOG(INFO, "%s(): cannot open /proc/self/pagemap: %s", - __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) { EAL_LOG(INFO, "%s(): seek error in /proc/self/pagemap: %s", - __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) { EAL_LOG(INFO, "%s(): cannot read /proc/self/pagemap: %s", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); return RTE_BAD_IOVA; } else if (retval != PFN_MASK_SIZE) { EAL_LOG(INFO, "%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) { - EAL_LOG(ERR, "%s failed: %s", where, strerror(errno)); + EAL_LOG(ERR, "%s failed: %s", 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) { EAL_LOG(ERR, "Failed to get current mempolicy: %s. " - "Assuming MPOL_DEFAULT.", strerror(errno)); + "Assuming MPOL_DEFAULT.", 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) { EAL_LOG(DEBUG, "%s(): open failed: %s", __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) { EAL_LOG(DEBUG, "%s(): mmap failed: %s", __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) { EAL_LOG(DEBUG, "%s(): Locking file failed:%s ", - __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) { EAL_LOG(ERR, "Failed to restore mempolicy: %s", - 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)) { EAL_LOG(WARNING, "%s(): Removing %s failed: %s", - __func__, hp->filepath, strerror(errno)); + __func__, hp->filepath, rte_strerror(errno)); } } return 0; @@ -640,7 +640,7 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl, hp->orig_va = NULL; if (unlink(hp->filepath) == -1) { EAL_LOG(ERR, "%s(): Removing %s failed: %s", - __func__, hp->filepath, strerror(errno)); + __func__, hp->filepath, rte_strerror(errno)); return -1; } } else { @@ -736,13 +736,13 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end) fd = open(hfile->filepath, O_RDWR); if (fd < 0) { EAL_LOG(ERR, "Could not open '%s': %s", - hfile->filepath, strerror(errno)); + hfile->filepath, rte_strerror(errno)); return -1; } /* set shared lock on the file. */ if (flock(fd, LOCK_SH) < 0) { EAL_LOG(DEBUG, "Could not lock '%s': %s", - hfile->filepath, strerror(errno)); + hfile->filepath, rte_strerror(errno)); close(fd); return -1; } @@ -756,7 +756,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) { EAL_LOG(ERR, "Couldn't remap '%s': %s", - hfile->filepath, strerror(errno)); + hfile->filepath, rte_strerror(errno)); close(fd); return -1; } @@ -1178,13 +1178,13 @@ eal_legacy_hugepage_init(void) memfd = memfd_create("nohuge", 0); if (memfd < 0) { EAL_LOG(DEBUG, "Cannot create memfd: %s", - strerror(errno)); + rte_strerror(errno)); EAL_LOG(DEBUG, "Falling back to anonymous map"); } else { /* we got an fd - now resize it */ if (ftruncate(memfd, internal_conf->memory) < 0) { EAL_LOG(ERR, "Cannot resize memfd: %s", - strerror(errno)); + rte_strerror(errno)); EAL_LOG(ERR, "Falling back to anonymous map"); close(memfd); } else { @@ -1212,7 +1212,7 @@ eal_legacy_hugepage_init(void) flags | MAP_FIXED, fd, 0); if (addr == MAP_FAILED || addr != prealloc_addr) { EAL_LOG(ERR, "%s: mmap() failed: %s", __func__, - strerror(errno)); + rte_strerror(errno)); munmap(prealloc_addr, mem_sz); return -1; } @@ -1571,7 +1571,7 @@ eal_legacy_hugepage_attach(void) fd = open(hf->filepath, O_RDWR); if (fd < 0) { EAL_LOG(ERR, "Could not open %s: %s", - hf->filepath, strerror(errno)); + hf->filepath, rte_strerror(errno)); goto error; } @@ -1579,14 +1579,14 @@ eal_legacy_hugepage_attach(void) MAP_SHARED | MAP_FIXED, fd, 0); if (map_addr == MAP_FAILED) { EAL_LOG(ERR, "Could not map %s: %s", - hf->filepath, strerror(errno)); + hf->filepath, rte_strerror(errno)); goto fd_error; } /* set shared lock on the file. */ if (flock(fd, LOCK_SH) < 0) { EAL_LOG(DEBUG, "%s(): Locking file failed: %s", - __func__, strerror(errno)); + __func__, rte_strerror(errno)); goto mmap_error; } @@ -1931,7 +1931,7 @@ rte_eal_memseg_init(void) if (setrlimit(RLIMIT_NOFILE, &lim) < 0) { EAL_LOG(DEBUG, "Setting maximum number of open files failed: %s", - strerror(errno)); + rte_strerror(errno)); } else { EAL_LOG(DEBUG, "Setting maximum number of open files to %" PRIu64, diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c index 489732c116..3aecff7f47 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) { EAL_LOG(ERR, "ERROR: Cannot open "DEV_HPET": %s!", - 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 7132e24cba..f04fbca2df 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) { EAL_LOG(ERR, "Cannot open %s: %s", - filename, strerror(errno)); + filename, rte_strerror(errno)); return -1; } @@ -381,7 +381,7 @@ vfio_open_group_fd(int iommu_group_num) if (errno != ENOENT) { EAL_LOG(ERR, "Cannot open %s: %s", - 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) { EAL_LOG(ERR, "%s cannot get VFIO group status, " - "error %i (%s)", dev_addr, errno, strerror(errno)); + "error %i (%s)", 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) { EAL_LOG(ERR, "%s cannot add VFIO group to container, error " - "%i (%s)", dev_addr, errno, strerror(errno)); + "%i (%s)", 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, EAL_LOG(ERR, "%s DMA remapping failed, error " "%i (%s)", - 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) { EAL_LOG(ERR, "%s cannot get device info, " "error %i (%s)", dev_addr, errno, - strerror(errno)); + rte_strerror(errno)); close(*vfio_dev_fd); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); @@ -1219,7 +1219,7 @@ vfio_set_iommu_type(int vfio_container_fd) /* not an error, there may be more supported IOMMU types */ EAL_LOG(DEBUG, "Set IOMMU type %d (%s) failed, error " "%i (%s)", t->type_id, t->name, errno, - strerror(errno)); + rte_strerror(errno)); } /* if we didn't find a suitable IOMMU type, fail */ return NULL; @@ -1243,7 +1243,7 @@ rte_vfio_get_device_info(const char *sysfs_base, const char *dev_addr, ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info); if (ret) { EAL_LOG(ERR, "%s cannot get device info, error %i (%s)", - dev_addr, errno, strerror(errno)); + dev_addr, errno, rte_strerror(errno)); return -1; } } @@ -1263,7 +1263,7 @@ vfio_has_supported_extensions(int vfio_container_fd) t->type_id); if (ret < 0) { EAL_LOG(ERR, "Could not get IOMMU type, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); close(vfio_container_fd); return -1; } else if (ret == 1) { @@ -1303,7 +1303,7 @@ rte_vfio_get_container_fd(void) EAL_LOG(ERR, "Cannot open VFIO container %s, error " "%i (%s)", VFIO_CONTAINER_PATH, - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1313,7 +1313,7 @@ rte_vfio_get_container_fd(void) if (ret < 0) EAL_LOG(ERR, "Could not get VFIO API version, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); else EAL_LOG(ERR, "Unsupported VFIO API version!"); close(vfio_container_fd); @@ -1445,7 +1445,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, } else { EAL_LOG(ERR, "Cannot set up DMA remapping, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); return -1; } } @@ -1459,7 +1459,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, &dma_unmap); if (ret) { EAL_LOG(ERR, "Cannot clear DMA remapping, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); return -1; } else if (dma_unmap.size != len) { EAL_LOG(ERR, "Unexpected size %"PRIu64 @@ -1508,7 +1508,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, if (ret) { EAL_LOG(ERR, "Cannot register vaddr for IOMMU, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); return -1; } @@ -1523,7 +1523,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) { EAL_LOG(ERR, "Cannot map vaddr for IOMMU, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); return -1; } @@ -1539,7 +1539,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, &dma_unmap); if (ret) { EAL_LOG(ERR, "Cannot unmap vaddr for IOMMU, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); return -1; } @@ -1548,7 +1548,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, if (ret) { EAL_LOG(ERR, "Cannot unregister vaddr for IOMMU, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); return -1; } } @@ -1733,7 +1733,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd) ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info); if (ret) { EAL_LOG(ERR, "Cannot get IOMMU info, error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1774,7 +1774,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd) #endif /* VFIO_IOMMU_SPAPR_INFO_DDW */ if (ret) { EAL_LOG(ERR, "Cannot create new DMA window, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); EAL_LOG(ERR, "Consider using a larger hugepage size if supported by the system"); return -1; @@ -2035,7 +2035,7 @@ rte_vfio_noiommu_is_enabled(void) if (fd < 0) { if (errno != ENOENT) { EAL_LOG(ERR, "Cannot open VFIO noiommu file " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); return -1; } /* @@ -2049,7 +2049,7 @@ rte_vfio_noiommu_is_enabled(void) close(fd); if (cnt != 1) { EAL_LOG(ERR, "Unable to read from VFIO noiommu file " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, rte_strerror(errno)); return -1; } diff --git a/lib/eal/unix/eal_filesystem.c b/lib/eal/unix/eal_filesystem.c index 6cd5f1492c..0d08b996f8 100644 --- a/lib/eal/unix/eal_filesystem.c +++ b/lib/eal/unix/eal_filesystem.c @@ -13,6 +13,7 @@ #include <unistd.h> #include <rte_log.h> +#include <rte_errno.h> #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) { EAL_LOG(ERR, "Error creating '%s': %s", - tmp, strerror(errno)); + tmp, rte_strerror(errno)); return -1; } ret = mkdir(run_dir, 0700); if (ret < 0 && errno != EEXIST) { EAL_LOG(ERR, "Error creating '%s': %s", - 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 97969a401b..a1cdbd1537 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, EAL_LOG(DEBUG, "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s", 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) { EAL_LOG(DEBUG, "Cannot munmap(%p, 0x%zx): %s", - 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) { EAL_LOG(DEBUG, "madvise(%p, %#zx, %d) failed: %s", - 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 1b4c73f58e..f0dae50549 100644 --- a/lib/eal/unix/rte_thread.c +++ b/lib/eal/unix/rte_thread.c @@ -304,7 +304,7 @@ rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) err = pthread_key_create(&((*key)->thread_index), destructor); if (err) { EAL_LOG(DEBUG, "pthread_key_create failed: %s", - strerror(err)); + rte_strerror(err)); free(*key); rte_errno = ENOEXEC; return -1; @@ -325,7 +325,7 @@ rte_thread_key_delete(rte_thread_key key) err = pthread_key_delete(key->thread_index); if (err) { EAL_LOG(DEBUG, "pthread_key_delete failed: %s", - strerror(err)); + rte_strerror(err)); free(key); rte_errno = ENOEXEC; return -1; @@ -347,7 +347,7 @@ rte_thread_value_set(rte_thread_key key, const void *value) err = pthread_setspecific(key->thread_index, value); if (err) { EAL_LOG(DEBUG, "pthread_setspecific failed: %s", - strerror(err)); + rte_strerror(err)); rte_errno = ENOEXEC; return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 03/42] eventdev: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 01/42] devtools: forbid use of strerror Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 02/42] eal: use rte strerror Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 04/42] latency: " Dengdui Huang ` (41 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 3ee20d95f3..1aef2458b6 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); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 04/42] latency: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (2 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 03/42] eventdev: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 05/42] node: " Dengdui Huang ` (40 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 6a261309f9..1ae95a52ae 100644 --- a/lib/latencystats/rte_latencystats.c +++ b/lib/latencystats/rte_latencystats.c @@ -268,7 +268,7 @@ rte_latencystats_init(uint64_t app_samp_intvl, if (ret != 0) { LATENCY_STATS_LOG(INFO, "Error during getting device (port %u) info: %s", - pid, strerror(-ret)); + pid, rte_strerror(-ret)); continue; } @@ -312,7 +312,7 @@ rte_latencystats_uninit(void) if (ret != 0) { LATENCY_STATS_LOG(INFO, "Error during getting device (port %u) info: %s", - pid, strerror(-ret)); + pid, rte_strerror(-ret)); continue; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 05/42] node: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (3 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 04/42] latency: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 06/42] pdump: " Dengdui Huang ` (39 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 3a96741622..c99a3ebbe2 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", strerror(errno)); + node_err("kernel_tx", "Unable to send packets: %s", rte_strerror(errno)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 06/42] pdump: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (4 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 05/42] node: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 07/42] power: " Dengdui Huang ` (38 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 679c3dd0b5..ebf6498b82 100644 --- a/lib/pdump/rte_pdump.c +++ b/lib/pdump/rte_pdump.c @@ -337,7 +337,7 @@ set_pdump_rxtx_cbs(const struct pdump_request *p) if (ret != 0) { PDUMP_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-ret)); + port, rte_strerror(-ret)); return ret; } @@ -407,7 +407,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_LINE(ERR, "failed to send to client:%s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -1; } @@ -739,7 +739,7 @@ rte_pdump_stats(uint16_t port, struct rte_pdump_stats *stats) if (ret != 0) { PDUMP_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-ret)); + port, rte_strerror(-ret)); return ret; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 07/42] power: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (5 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 06/42] pdump: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 08/42] vhost: " Dengdui Huang ` (37 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 bc3f55b6bf..a197113b90 100644 --- a/lib/power/guest_channel.c +++ b/lib/power/guest_channel.c @@ -14,6 +14,7 @@ #include <rte_log.h> #include <rte_power.h> +#include <rte_errno.h> #include "guest_channel.h" @@ -78,7 +79,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) fd = open(fd_path, O_RDWR); if (fd < 0) { GUEST_CHANNEL_LOG(ERR, "Unable to connect to '%s' with error " - "%s", fd_path, strerror(errno)); + "%s", fd_path, rte_strerror(errno)); return -1; } @@ -107,7 +108,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) if (ret != 0) { GUEST_CHANNEL_LOG(ERR, "Error on channel '%s' communications test: %s", - fd_path, ret > 0 ? strerror(ret) : + fd_path, ret > 0 ? rte_strerror(ret) : "channel not connected"); goto error; } @@ -187,7 +188,7 @@ int power_guest_channel_read_msg(void *pkt, return -1; } else if (ret < 0) { GUEST_CHANNEL_LOG(ERR, "Error occurred during poll function: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c index f15be8fac5..5e5532832e 100644 --- a/lib/power/power_kvm_vm.c +++ b/lib/power/power_kvm_vm.c @@ -5,6 +5,7 @@ #include <string.h> #include <rte_log.h> +#include <rte_errno.h> #include "rte_power_guest_channel.h" #include "guest_channel.h" @@ -83,7 +84,7 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction) if (ret == 0) return 1; POWER_LOG(DEBUG, "Error sending message: %s", - 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 4755909466..acc922ea2f 100644 --- a/lib/power/power_pstate_cpufreq.c +++ b/lib/power/power_pstate_cpufreq.c @@ -13,6 +13,7 @@ #include <rte_memcpy.h> #include <rte_stdatomic.h> +#include <rte_errno.h> #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) { POWER_LOG(ERR, "Error opening '%s': %s", 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) { POWER_LOG(ERR, "Error reading '%s': %s", 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')) { POWER_LOG(ERR, "Error converting str to digits, read from %s: %s", - 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 5e50613f5b..f52c2c08d5 100644 --- a/lib/power/rte_power_pmd_mgmt.c +++ b/lib/power/rte_power_pmd_mgmt.c @@ -575,7 +575,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) { POWER_LOG(DEBUG, "Failed to add queue to list: %s", - strerror(-ret)); + rte_strerror(-ret)); goto end; } /* new queue is always added last */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 08/42] vhost: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (6 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 07/42] power: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 09/42] bpf: " Dengdui Huang ` (36 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- lib/vhost/fd_man.c | 7 ++++--- lib/vhost/socket.c | 13 ++++++------ lib/vhost/vduse.c | 45 +++++++++++++++++++++--------------------- lib/vhost/vhost_user.c | 10 +++++----- 4 files changed, 39 insertions(+), 36 deletions(-) diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c index 9bc7e50b93..e9367fabee 100644 --- a/lib/vhost/fd_man.c +++ b/lib/vhost/fd_man.c @@ -13,6 +13,7 @@ #include <rte_malloc.h> #include <rte_string_fns.h> #include <rte_thread.h> +#include <rte_errno.h> #include "fd_man.h" @@ -238,7 +239,7 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat) ret = epoll_ctl(pfdset->epfd, EPOLL_CTL_ADD, fd, &ev); if (ret < 0) { VHOST_FDMAN_LOG(ERR, "could not add %d fd to %d epfd: %s", - fd, pfdset->epfd, strerror(errno)); + fd, pfdset->epfd, rte_strerror(errno)); goto out_remove; } @@ -259,10 +260,10 @@ fdset_del_locked(struct fdset *pfdset, struct fdentry *pfdentry) if (epoll_ctl(pfdset->epfd, EPOLL_CTL_DEL, pfdentry->fd, NULL) == -1) { if (errno == EBADF) /* File might have already been closed. */ VHOST_FDMAN_LOG(DEBUG, "could not remove %d fd from %d epfd: %s", - pfdentry->fd, pfdset->epfd, strerror(errno)); + pfdentry->fd, pfdset->epfd, rte_strerror(errno)); else VHOST_FDMAN_LOG(ERR, "could not remove %d fd from %d epfd: %s", - pfdentry->fd, pfdset->epfd, strerror(errno)); + pfdentry->fd, pfdset->epfd, rte_strerror(errno)); } fdset_remove_entry(pfdset, pfdentry); diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index d29d15494c..07ae2167ea 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -16,6 +16,7 @@ #include <rte_thread.h> #include <rte_log.h> +#include <rte_errno.h> #include "fd_man.h" #include "vduse.h" @@ -124,7 +125,7 @@ read_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int m if (ret <= 0) { if (ret) VHOST_CONFIG_LOG(ifname, ERR, "recvmsg failed on fd %d (%s)", - sockfd, strerror(errno)); + sockfd, rte_strerror(errno)); return ret; } @@ -195,7 +196,7 @@ send_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int f if (ret < 0) { VHOST_CONFIG_LOG(ifname, ERR, "sendmsg error on fd %d (%s)", - sockfd, strerror(errno)); + sockfd, rte_strerror(errno)); return ret; } @@ -352,7 +353,7 @@ create_unix_socket(struct vhost_user_socket *vsocket) if (!vsocket->is_server && fcntl(fd, F_SETFL, O_NONBLOCK)) { VHOST_CONFIG_LOG(vsocket->path, ERR, "vhost-user: can't set nonblocking mode for socket, fd: %d (%s)", - fd, strerror(errno)); + fd, rte_strerror(errno)); close(fd); return -1; } @@ -386,7 +387,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket) ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un)); if (ret < 0) { VHOST_CONFIG_LOG(path, ERR, "failed to bind: %s; remove it and try again", - strerror(errno)); + rte_strerror(errno)); goto err; } VHOST_CONFIG_LOG(path, INFO, "binding succeeded"); @@ -439,7 +440,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_CONFIG_LOG(path, ERR, "can't get flags for connfd %d (%s)", - fd, strerror(errno)); + fd, rte_strerror(errno)); return -2; } if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) { @@ -534,7 +535,7 @@ vhost_user_start_client(struct vhost_user_socket *vsocket) return 0; } - VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno)); + VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", rte_strerror(errno)); if (ret == -2 || !vsocket->reconnect) { close(fd); diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index f9ac317438..9b241cc311 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -17,6 +17,7 @@ #include <rte_common.h> #include <rte_thread.h> +#include <rte_errno.h> #include "fd_man.h" #include "iotlb.h" @@ -126,7 +127,7 @@ vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused) ret = read(fd, &buf, sizeof(buf)); if (ret < 0) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to read control queue event: %s", - strerror(errno)); + rte_strerror(errno)); return; } @@ -148,7 +149,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect) ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_GET_INFO, &vq_info); if (ret) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to get VQ %u info: %s", - index, strerror(errno)); + index, rte_strerror(errno)); return; } @@ -179,7 +180,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect) vq->kickfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (vq->kickfd < 0) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to init kickfd for VQ %u: %s", - index, strerror(errno)); + index, rte_strerror(errno)); vq->kickfd = VIRTIO_INVALID_EVENTFD; return; } @@ -211,7 +212,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect) ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd); if (ret) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to setup kickfd for VQ %u: %s", - index, strerror(errno)); + index, rte_strerror(errno)); close(vq->kickfd); vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; return; @@ -222,7 +223,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect) if (ret) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to setup kickfd handler for VQ %u: %s", - 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); @@ -249,7 +250,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_CONFIG_LOG(dev->ifname, ERR, "Failed to cleanup kickfd for VQ %u: %s", - index, strerror(errno)); + index, rte_strerror(errno)); close(vq->kickfd); vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; @@ -288,7 +289,7 @@ vduse_device_start(struct virtio_net *dev, bool reconnect) ret = ioctl(dev->vduse_dev_fd, VDUSE_DEV_GET_FEATURES, &dev->features); if (ret) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to get features: %s", - strerror(errno)); + rte_strerror(errno)); return; } @@ -364,7 +365,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused) ret = read(fd, &req, sizeof(req)); if (ret < 0) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to read request: %s", - strerror(errno)); + rte_strerror(errno)); return; } else if (ret < (int)sizeof(req)) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Incomplete to read request %d", ret); @@ -407,7 +408,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_CONFIG_LOG(dev->ifname, ERR, "Failed to write response %s", - strerror(errno)); + rte_strerror(errno)); return; } @@ -455,7 +456,7 @@ vduse_reconnect_path_init(void) ret = mkdir(vduse_reconnect_dir, 0700); if (ret < 0 && errno != EEXIST) { VHOST_CONFIG_LOG("vduse", ERR, "Error creating '%s': %s", - vduse_reconnect_dir, strerror(errno)); + vduse_reconnect_dir, rte_strerror(errno)); return -1; } @@ -516,13 +517,13 @@ vduse_device_create(const char *path, bool compliant_ol_flags) control_fd = open(VDUSE_CTRL_PATH, O_RDWR); if (control_fd < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to open %s: %s", - VDUSE_CTRL_PATH, strerror(errno)); + VDUSE_CTRL_PATH, rte_strerror(errno)); return -1; } if (ioctl(control_fd, VDUSE_SET_API_VERSION, &ver)) { VHOST_CONFIG_LOG(name, ERR, "Failed to set API version: %" PRIu64 ": %s", - ver, strerror(errno)); + ver, rte_strerror(errno)); ret = -1; goto out_ctrl_close; } @@ -558,7 +559,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) reconnect_file); else VHOST_CONFIG_LOG(name, ERR, "Failed to open reconnect file %s (%s)", - reconnect_file, strerror(errno)); + reconnect_file, rte_strerror(errno)); ret = -1; goto out_ctrl_close; } @@ -568,7 +569,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) close(reco_fd); if (reconnect_log == MAP_FAILED) { VHOST_CONFIG_LOG(name, ERR, "Failed to mmap reconnect file %s (%s)", - reconnect_file, strerror(errno)); + reconnect_file, rte_strerror(errno)); ret = -1; goto out_ctrl_close; } @@ -602,7 +603,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) reconnect_file); } else { VHOST_CONFIG_LOG(name, ERR, "Failed to open reconnect file %s (%s)", - reconnect_file, strerror(errno)); + reconnect_file, rte_strerror(errno)); } ret = -1; goto out_ctrl_close; @@ -611,7 +612,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) ret = ftruncate(reco_fd, sizeof(*reconnect_log)); if (ret < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to truncate reconnect file %s (%s)", - reconnect_file, strerror(errno)); + reconnect_file, rte_strerror(errno)); close(reco_fd); goto out_ctrl_close; } @@ -621,7 +622,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) close(reco_fd); if (reconnect_log == MAP_FAILED) { VHOST_CONFIG_LOG(name, ERR, "Failed to mmap reconnect file %s (%s)", - reconnect_file, strerror(errno)); + reconnect_file, rte_strerror(errno)); ret = -1; goto out_ctrl_close; } @@ -651,7 +652,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) ret = ioctl(control_fd, VDUSE_CREATE_DEV, dev_config); if (ret < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to create VDUSE device: %s", - strerror(errno)); + rte_strerror(errno)); goto out_free; } @@ -664,7 +665,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) dev_fd = open(path, O_RDWR); if (dev_fd < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to open device %s: %s", - path, strerror(errno)); + path, rte_strerror(errno)); ret = -1; goto out_dev_close; } @@ -672,7 +673,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) ret = fcntl(dev_fd, F_SETFL, O_NONBLOCK); if (ret < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to set chardev as non-blocking: %s", - strerror(errno)); + rte_strerror(errno)); goto out_dev_close; } @@ -741,7 +742,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) reco_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (reco_fd < 0) { VHOST_CONFIG_LOG(name, ERR, "Failed to create reco_fd: %s", - strerror(errno)); + rte_strerror(errno)); ret = -1; goto out_dev_destroy; } @@ -814,7 +815,7 @@ vduse_device_destroy(const char *path) ret = ioctl(dev->vduse_ctrl_fd, VDUSE_DESTROY_DEV, name); if (ret) { VHOST_CONFIG_LOG(name, ERR, "Failed to destroy VDUSE device: %s", - strerror(errno)); + rte_strerror(errno)); } else { /* * VDUSE device was no more attached to the vDPA bus, diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 6d92ad904e..32b5f46749 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -832,7 +832,7 @@ mem_set_dump(struct virtio_net *dev, void *ptr, size_t size, bool enable, uint64 if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) { VHOST_CONFIG_LOG(dev->ifname, INFO, - "could not set coredump preference (%s).", strerror(errno)); + "could not set coredump preference (%s).", rte_strerror(errno)); } #endif } @@ -1210,7 +1210,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; } @@ -1339,7 +1339,7 @@ vhost_user_mmap_region(struct virtio_net *dev, MAP_SHARED | populate, region->fd, 0); if (mmap_addr == MAP_FAILED) { - VHOST_CONFIG_LOG(dev->ifname, ERR, "mmap failed (%s).", strerror(errno)); + VHOST_CONFIG_LOG(dev->ifname, ERR, "mmap failed (%s).", rte_strerror(errno)); return -1; } @@ -2776,7 +2776,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev, if (dev->postcopy_ufd == -1) { VHOST_CONFIG_LOG(dev->ifname, ERR, "userfaultfd not available: %s", - strerror(errno)); + rte_strerror(errno)); return RTE_VHOST_MSG_RESULT_ERR; } api_struct.api = UFFD_API; @@ -2784,7 +2784,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev, if (ioctl(dev->postcopy_ufd, UFFDIO_API, &api_struct)) { VHOST_CONFIG_LOG(dev->ifname, ERR, "UFFDIO_API ioctl failure: %s", - strerror(errno)); + rte_strerror(errno)); close(dev->postcopy_ufd); dev->postcopy_ufd = -1; return RTE_VHOST_MSG_RESULT_ERR; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 09/42] bpf: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (7 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 08/42] vhost: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 10/42] bus/cdx: " Dengdui Huang ` (35 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 e0abd3c856..fb3c18cb5f 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_LINE(ERR, "%s(%s) error code: %d(%s)", - __func__, fname, rc, strerror(rc)); + __func__, fname, rc, rte_strerror(rc)); rte_errno = EINVAL; return NULL; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 10/42] bus/cdx: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (8 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 09/42] bpf: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 11/42] bus/dpaa: " Dengdui Huang ` (34 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 62b108e082..747f53b17f 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 664f267471..87e69e0082 100644 --- a/drivers/bus/cdx/cdx_vfio.c +++ b/drivers/bus/cdx/cdx_vfio.c @@ -20,6 +20,7 @@ #include <rte_eal_paging.h> #include <rte_malloc.h> #include <rte_vfio.h> +#include <rte_errno.h> #include "bus_cdx_driver.h" #include "cdx_logs.h" @@ -204,7 +205,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; } @@ -222,7 +223,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; } @@ -255,7 +256,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; } @@ -423,7 +424,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; } @@ -451,7 +452,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; } @@ -519,7 +520,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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 11/42] bus/dpaa: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (9 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 10/42] bus/cdx: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 12/42] bus/fslmc: " Dengdui Huang ` (33 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 d49339d81e..eb0a4dc398 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -1154,7 +1154,7 @@ fman_finish(void) /* release the mapping */ _errno = munmap(__if->ccsr_map, __if->regs_size); if (unlikely(_errno < 0)) - FMAN_ERR(_errno, "munmap() = (%s)", strerror(errno)); + FMAN_ERR(_errno, "munmap() = (%s)", rte_strerror(errno)); DPAA_BUS_INFO("Tearing down %s", __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 9ffbe07c93..a97e2e375f 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -632,7 +632,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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 12/42] bus/fslmc: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (10 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 11/42] bus/dpaa: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 13/42] bus/pci: " Dengdui Huang ` (32 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 6981679a2d..46f598593c 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)", 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)", 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 13/42] bus/pci: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (11 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 12/42] bus/fslmc: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 14/42] bus/vdev: " Dengdui Huang ` (31 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 2f88252418..cf10a3b66a 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -122,7 +122,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, } if (rte_intr_fd_get(dev->intr_handle) < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + PCI_LOG(ERR, "Cannot open %s: %s", devname, rte_strerror(errno)); goto error; } @@ -164,7 +164,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, /* allocate memory to keep path */ maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0); if (maps[map_idx].path == NULL) { - PCI_LOG(ERR, "Cannot allocate memory for path: %s", strerror(errno)); + PCI_LOG(ERR, "Cannot allocate memory for path: %s", rte_strerror(errno)); return -1; } @@ -173,7 +173,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, */ fd = open(devname, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + PCI_LOG(ERR, "Cannot open %s: %s", devname, rte_strerror(errno)); goto error; } @@ -347,7 +347,7 @@ rte_pci_scan(void) unsigned i; if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) { PCI_LOG(ERR, "%s(): error with ioctl on /dev/pci: %s", - __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 9056035b33..1350412610 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -12,6 +12,7 @@ #include <rte_devargs.h> #include <rte_memcpy.h> #include <rte_vfio.h> +#include <rte_errno.h> #include "eal_filesystem.h" @@ -449,7 +450,7 @@ rte_pci_scan(void) dir = opendir(rte_pci_get_sysfs_path()); if (dir == NULL) { - PCI_LOG(ERR, "%s(): opendir failed: %s", __func__, strerror(errno)); + PCI_LOG(ERR, "%s(): opendir failed: %s", __func__, rte_strerror(errno)); return -1; } @@ -500,7 +501,7 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev) return true; PCI_LOG(ERR, "%s(): can't open %s: %s", - __func__, filename, strerror(errno)); + __func__, filename, rte_strerror(errno)); return false; } @@ -551,7 +552,7 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev) if (fp == NULL) { PCI_LOG(ERR, "%s(): can't open %s: %s", - __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 4c1d3327a9..58039176ce 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -21,6 +21,7 @@ #include <rte_bus_pci.h> #include <rte_common.h> #include <rte_malloc.h> +#include <rte_errno.h> #include "eal_filesystem.h" #include "pci_init.h" @@ -108,7 +109,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num) dev = makedev(major, minor); ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev); if (ret != 0) { - PCI_LOG(ERR, "%s(): mknod() failed %s", __func__, strerror(errno)); + PCI_LOG(ERR, "%s(): mknod() failed %s", __func__, rte_strerror(errno)); return -1; } @@ -237,7 +238,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, /* save fd */ fd = open(devname, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + PCI_LOG(ERR, "Cannot open %s: %s", devname, rte_strerror(errno)); goto error; } @@ -249,7 +250,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, uio_cfg_fd = open(cfgname, O_RDWR); if (uio_cfg_fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", cfgname, strerror(errno)); + PCI_LOG(ERR, "Cannot open %s: %s", cfgname, rte_strerror(errno)); goto error; } @@ -310,7 +311,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, /* allocate memory to keep path */ maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0); if (maps[map_idx].path == NULL) { - PCI_LOG(ERR, "Cannot allocate memory for path: %s", strerror(errno)); + PCI_LOG(ERR, "Cannot allocate memory for path: %s", rte_strerror(errno)); return -1; } @@ -342,7 +343,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, /* then try to map resource file */ fd = open(devname, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + PCI_LOG(ERR, "Cannot open %s: %s", devname, rte_strerror(errno)); goto error; } } @@ -397,7 +398,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, dev->addr.devid, dev->addr.function); f = fopen(filename, "r"); if (f == NULL) { - PCI_LOG(ERR, "%s(): Cannot open sysfs resource: %s", __func__, strerror(errno)); + PCI_LOG(ERR, "%s(): Cannot open sysfs resource: %s", __func__, rte_strerror(errno)); return -1; } @@ -438,14 +439,14 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, RTE_INTR_HANDLE_UNKNOWN) { int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0); if (uio_num < 0) { - PCI_LOG(ERR, "cannot open %s: %s", dirname, strerror(errno)); + PCI_LOG(ERR, "cannot open %s: %s", dirname, rte_strerror(errno)); goto error; } snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num); fd = open(filename, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno)); + PCI_LOG(ERR, "Cannot open %s: %s", filename, rte_strerror(errno)); goto error; } if (rte_intr_fd_set(dev->intr_handle, fd)) @@ -484,7 +485,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, dev->addr.devid, dev->addr.function); f = fopen(filename, "r"); if (f == NULL) { - PCI_LOG(ERR, "Cannot open sysfs resource: %s", strerror(errno)); + PCI_LOG(ERR, "Cannot open sysfs resource: %s", rte_strerror(errno)); return -1; } for (i = 0; i < bar + 1; i++) { @@ -507,14 +508,14 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, /* mmap the pci resource */ fd = open(filename, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno)); + PCI_LOG(ERR, "Cannot open %s: %s", filename, rte_strerror(errno)); goto error; } addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); close(fd); if (addr == MAP_FAILED) { - PCI_LOG(ERR, "Cannot mmap IO port resource: %s", strerror(errno)); + PCI_LOG(ERR, "Cannot mmap IO port resource: %s", rte_strerror(errno)); goto error; } diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 5317170231..6ccf097fb7 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -21,6 +21,7 @@ #include <bus_driver.h> #include <rte_spinlock.h> #include <rte_tailq.h> +#include <rte_errno.h> #include "eal_filesystem.h" @@ -223,7 +224,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) { PCI_LOG(ERR, "Cannot get VFIO IRQ info, error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -249,7 +250,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -330,7 +331,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd) fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -451,7 +452,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) * then it updates errno as EINVAL. */ if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) { - PCI_LOG(ERR, "Unable to reset device! Error: %d (%s)", errno, strerror(errno)); + PCI_LOG(ERR, "Unable to reset device! Error: %d (%s)", errno, rte_strerror(errno)); return -1; } @@ -724,7 +725,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) { PCI_LOG(DEBUG, "%s cannot get device region info error %i (%s)", - dev->name, errno, strerror(errno)); + dev->name, errno, rte_strerror(errno)); return -1; } @@ -792,7 +793,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) VFIO_PCI_CONFIG_REGION_INDEX); if (ret < 0) { PCI_LOG(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; } pdev->region[VFIO_PCI_CONFIG_REGION_INDEX].size = reg->size; @@ -830,7 +831,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) ret = pci_vfio_get_region_info(vfio_dev_fd, ®, i); if (ret < 0) { PCI_LOG(ERR, "%s cannot get device region info error %i (%s)", - pci_addr, errno, strerror(errno)); + pci_addr, errno, rte_strerror(errno)); goto err_map; } @@ -891,7 +892,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) { PCI_LOG(ERR, "%s sparse mapping BAR%i failed: %s", - pci_addr, i, strerror(errno)); + pci_addr, i, rte_strerror(errno)); free(reg); goto err_map; } @@ -899,7 +900,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) { PCI_LOG(ERR, "%s mapping BAR%i failed: %s", - pci_addr, i, strerror(errno)); + pci_addr, i, rte_strerror(errno)); free(reg); goto err_map; } @@ -995,14 +996,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) { PCI_LOG(ERR, "%s sparse mapping BAR%i failed: %s", - 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) { PCI_LOG(ERR, "%s mapping BAR%i failed: %s", - 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 30503bd23a..b2b0ba798d 100644 --- a/drivers/bus/pci/pci_common_uio.c +++ b/drivers/bus/pci/pci_common_uio.c @@ -15,6 +15,7 @@ #include <rte_tailq.h> #include <rte_log.h> #include <rte_malloc.h> +#include <rte_errno.h> #include "private.h" @@ -52,7 +53,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev) fd = open(uio_res->maps[i].path, O_RDWR); if (fd < 0) { PCI_LOG(ERR, "Cannot open %s: %s", - uio_res->maps[i].path, strerror(errno)); + uio_res->maps[i].path, rte_strerror(errno)); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 14/42] bus/vdev: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (12 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 13/42] bus/pci: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 15/42] bus/vmbus: " Dengdui Huang ` (30 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 ec7abe7cda..299f8c2873 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -437,7 +437,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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 15/42] bus/vmbus: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (13 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 14/42] bus/vdev: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 16/42] common/cnxk: " Dengdui Huang ` (29 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 <rte_memory.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #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 <rte_malloc.h> #include <rte_bus_vmbus.h> #include <rte_string_fns.h> +#include <rte_errno.h> #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 8a965d10d9..ef05d62714 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 <rte_log.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 16/42] common/cnxk: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (14 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 15/42] bus/vmbus: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 17/42] common/mlx5: " Dengdui Huang ` (28 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- drivers/common/cnxk/roc_dev.c | 6 ++++-- drivers/common/cnxk/roc_model.c | 4 +++- drivers/common/cnxk/roc_utils.c | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index c905d35ea6..94a4f62ce1 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -8,6 +8,8 @@ #include <sys/mman.h> #include <unistd.h> +#include <rte_errno.h> + #include "roc_api.h" #include "roc_priv.h" @@ -1323,7 +1325,7 @@ cn20k_pfvf_mbox_alloc(struct dev *dev, uint16_t max_vfs) mz = plt_memzone_reserve_aligned(name, vf_mbox_region, 0, MBOX_SIZE); if (!mz) { - plt_err("Memory alloc failed: %s", strerror(errno)); + plt_err("Memory alloc failed: %s", rte_strerror(errno)); goto fail; } @@ -1445,7 +1447,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 6289461db4..da0664afdb 100644 --- a/drivers/common/cnxk/roc_model.c +++ b/drivers/common/cnxk/roc_model.c @@ -6,6 +6,8 @@ #include <fcntl.h> #include <unistd.h> +#include <rte_errno.h> + #include "roc_api.h" #include "roc_priv.h" @@ -157,7 +159,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", __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 <rte_errno.h> + #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 17/42] common/mlx5: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (15 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 16/42] common/cnxk: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 18/42] crypto/caam_jr: " Dengdui Huang ` (27 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- drivers/common/mlx5/linux/mlx5_nl.c | 12 ++++++------ drivers/common/mlx5/mlx5_common.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index a5ac4dc543..568c7826c3 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -548,7 +548,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; } @@ -618,7 +618,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; @@ -705,7 +705,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; } @@ -930,7 +930,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; } @@ -957,7 +957,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; } @@ -1935,7 +1935,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; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 18/42] crypto/caam_jr: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (16 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 17/42] common/mlx5: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 19/42] dma/idxd: " Dengdui Huang ` (26 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 8956f7750d..cdd027aeae 100644 --- a/drivers/crypto/caam_jr/caam_jr_uio.c +++ b/drivers/crypto/caam_jr/caam_jr_uio.c @@ -17,6 +17,7 @@ #include <rte_malloc.h> #include <rte_crypto.h> #include <rte_security.h> +#include <rte_errno.h> #include <caam_jr_config.h> #include <caam_jr_hw_specific.h> @@ -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) { CAAM_JR_ERR("Error opening directory '%s': %s", - SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno)); + SEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno)); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 19/42] dma/idxd: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (17 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 18/42] crypto/caam_jr: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 20/42] net/af_packet: " Dengdui Huang ` (25 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- drivers/dma/idxd/idxd_bus.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c index ba8076715d..c4a2c6bb54 100644 --- a/drivers/dma/idxd/idxd_bus.c +++ b/drivers/dma/idxd/idxd_bus.c @@ -16,6 +16,7 @@ #include <rte_log.h> #include <rte_dmadev_pmd.h> #include <rte_string_fns.h> +#include <rte_errno.h> #include "idxd_internal.h" @@ -145,7 +146,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 +154,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 +174,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 +201,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; } @@ -323,7 +324,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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 20/42] net/af_packet: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (18 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 19/42] dma/idxd: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 21/42] net/bnxt: " Dengdui Huang ` (24 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 bfd3bd1eb1..cb3be4f906 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -114,7 +114,7 @@ RTE_LOG_REGISTER_DEFAULT(af_packet_logtype, NOTICE); #define PMD_LOG_ERRNO(level, fmt, ...) \ RTE_LOG_LINE(level, AFPACKET, "%s(): " fmt ":%s", __func__, \ - ## __VA_ARGS__, strerror(errno)) + ## __VA_ARGS__, rte_strerror(errno)) static uint16_t eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 21/42] net/bnxt: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (19 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 20/42] net/af_packet: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 20:24 ` Ajit Khaparde 2024-10-23 8:28 ` [PATCH v4 22/42] net/af_xdp: " Dengdui Huang ` (23 subsequent siblings) 44 siblings, 1 reply; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 5e59afe79f..3f89f42bbb 100644 --- a/drivers/net/bnxt/bnxt_stats.c +++ b/drivers/net/bnxt/bnxt_stats.c @@ -1187,7 +1187,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_LINE(ERR, "Failed to reset xstats: %s", - 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 e9b5739050..fedea23a74 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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_LINE(ERR, "Error during getting device (port %u) info: %s", - 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 9c527e152d..92dba8c4f9 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 7f7a663789..2fea8adb4b 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v4 21/42] net/bnxt: use rte strerror 2024-10-23 8:28 ` [PATCH v4 21/42] net/bnxt: " Dengdui Huang @ 2024-10-23 20:24 ` Ajit Khaparde 0 siblings, 0 replies; 264+ messages in thread From: Ajit Khaparde @ 2024-10-23 20:24 UTC (permalink / raw) To: Dengdui Huang Cc: dev, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong [-- Attachment #1: Type: text/plain, Size: 140719 bytes --] On Wed, Oct 23, 2024 at 1:32 AM Dengdui Huang <huangdengdui@huawei.com> wrote: > > 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 <huangdengdui@huawei.com> > Acked-by: Chengwen Feng <fengchengwen@huawei.com> > Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com> > --- > 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 5e59afe79f..3f89f42bbb 100644 > --- a/drivers/net/bnxt/bnxt_stats.c > +++ b/drivers/net/bnxt/bnxt_stats.c > @@ -1187,7 +1187,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_LINE(ERR, "Failed to reset xstats: %s", > - 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 e9b5739050..fedea23a74 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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_LINE(ERR, > "Error during getting device (port %u) info: %s", > - 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 9c527e152d..92dba8c4f9 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 7f7a663789..2fea8adb4b 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; > } > > -- > 2.33.0 > [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 4218 bytes --] ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 22/42] net/af_xdp: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (20 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 21/42] net/bnxt: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-24 17:05 ` Maryam Tahhan 2024-10-23 8:28 ` [PATCH v4 23/42] net/bonding: " Dengdui Huang ` (22 subsequent siblings) 44 siblings, 1 reply; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 814398ba4b..0b561b6683 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1191,7 +1191,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, &rxq->fq, &rxq->cq, &usr_config); if (ret) { AF_XDP_LOG_LINE(ERR, "Failed to create umem [%d]: [%s]", - errno, strerror(errno)); + errno, rte_strerror(errno)); goto err; } umem->buffer = aligned_addr; @@ -1408,7 +1408,7 @@ init_uds_sock(struct sockaddr_un *server, const char *dp_path) if (connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr_un)) < 0) { close(sock); AF_XDP_LOG_LINE(ERR, "Error connecting stream socket errno = [%d]: [%s]", - errno, strerror(errno)); + errno, rte_strerror(errno)); return -1; } @@ -1492,7 +1492,7 @@ read_msg(int sock, char *response, struct sockaddr_un *s, int *fd) return 0; if (msglen < 0) { - AF_XDP_LOG_LINE(ERR, "recvmsg failed, %s", strerror(errno)); + AF_XDP_LOG_LINE(ERR, "recvmsg failed, %s", rte_strerror(errno)); return -1; } @@ -1527,7 +1527,7 @@ make_request_dp(int sock, struct sockaddr_un *server, char *request, rval = send_msg(sock, request, req_fd, dp_path); if (rval < 0) { - AF_XDP_LOG_LINE(ERR, "Write error %s", strerror(errno)); + AF_XDP_LOG_LINE(ERR, "Write error %s", rte_strerror(errno)); return -1; } @@ -2023,7 +2023,7 @@ parse_prog_arg(const char *key __rte_unused, if (access(value, F_OK) != 0) { AF_XDP_LOG_LINE(ERR, "Error accessing %s: %s", - value, strerror(errno)); + value, rte_strerror(errno)); return -EINVAL; } @@ -2518,7 +2518,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_LINE(ERR, "%s: Failed to register multi-process IPC callback: %s", - name, strerror(rte_errno)); + name, rte_strerror(rte_errno)); return -1; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v4 22/42] net/af_xdp: use rte strerror 2024-10-23 8:28 ` [PATCH v4 22/42] net/af_xdp: " Dengdui Huang @ 2024-10-24 17:05 ` Maryam Tahhan 0 siblings, 0 replies; 264+ messages in thread From: Maryam Tahhan @ 2024-10-24 17:05 UTC (permalink / raw) To: dev > 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 <huangdengdui@huawei.com> > Acked-by: Chengwen Feng <fengchengwen@huawei.com> > Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Maryam Tahhan <mtahhan@redhat.com> ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 23/42] net/bonding: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (21 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 22/42] net/af_xdp: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 24/42] net/dpaa: " Dengdui Huang ` (21 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 ffc1322047..dbb642dc4c 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", - __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 5d0be5caf5..a38cc84f56 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 cda1c37124..95049eead6 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", - __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", __func__, bond_dev->data->port_id, - strerror(-ret)); + rte_strerror(-ret)); return ret; } @@ -2290,7 +2290,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", __func__, member.port_id, - strerror(-ret)); + rte_strerror(-ret)); return ret; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 24/42] net/dpaa: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (22 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 23/42] net/bonding: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 25/42] net/dpaa2: " Dengdui Huang ` (20 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 e8d34e5898..ddf61395d6 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1218,7 +1218,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) { @@ -1353,7 +1353,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 b35feba004..fe19a5d8cb 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)", - errno, strerror(errno)); + errno, rte_strerror(errno)); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } _fml_dbg("Finishing."); @@ -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)", - 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)", - errno, strerror(errno)); + errno, rte_strerror(errno)); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 25/42] net/dpaa2: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (23 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 24/42] net/dpaa: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 26/42] net/enetfec: " Dengdui Huang ` (19 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 7b3e587a8d..ef34bce88f 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1170,7 +1170,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; } @@ -1178,7 +1178,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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 26/42] net/enetfec: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (24 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 25/42] net/dpaa2: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 27/42] net/failsafe: " Dengdui Huang ` (18 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 9f4e896985..3967f95e82 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("Error opening directory '%s': %s", - FEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno)); + FEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno)); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 27/42] net/failsafe: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (25 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 26/42] net/enetfec: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 28/42] net/i40e: " Dengdui Huang ` (17 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 1b8f1d3050..cc15428b7b 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 e79d3b4120..07fa802653 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 9c013e0419..f3b2daf400 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 babea6016e..fcbb1b771e 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -407,14 +407,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; } } @@ -436,7 +436,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)); } /* -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 28/42] net/i40e: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (26 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 27/42] net/failsafe: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 29/42] net/ice: " Dengdui Huang ` (16 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 29/42] net/ice: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (27 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 28/42] net/i40e: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 30/42] net/ixgbe: " Dengdui Huang ` (15 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 98c02d68c6..25e3d63163 100644 --- a/drivers/net/ice/ice_testpmd.c +++ b/drivers/net/ice/ice_testpmd.c @@ -61,7 +61,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); @@ -128,7 +128,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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 30/42] net/ixgbe: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (28 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 29/42] net/ice: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 31/42] net/memif: " Dengdui Huang ` (14 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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)); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 31/42] net/memif: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (29 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 30/42] net/ixgbe: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 32/42] net/mlx4: " Dengdui Huang ` (13 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 cd722f254f..4b1d2010a2 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -807,7 +807,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)); } } @@ -958,7 +958,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)); } } @@ -1080,27 +1080,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; } @@ -1221,7 +1221,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) { @@ -1245,7 +1245,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) { @@ -1301,7 +1301,7 @@ memif_connect(struct rte_eth_dev *dev) MAP_SHARED, mr->fd, 0); if (mr->addr == MAP_FAILED) { MIF_LOG(ERR, "mmap failed: %s", - strerror(errno)); + rte_strerror(errno)); return -1; } } @@ -1985,7 +1985,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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 32/42] net/mlx4: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (30 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 31/42] net/memif: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 33/42] net/mlx5: " Dengdui Huang ` (12 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 9c2872429f..54073057e8 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 f11c6b4373..d52d2f5511 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. */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 33/42] net/mlx5: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (31 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 32/42] net/mlx4: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 34/42] net/qede: " Dengdui Huang ` (11 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +++++++++---------- 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 | 26 +++++++++++------------ 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, 76 insertions(+), 76 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index dfa2cd435c..063f6b871e 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -1516,7 +1516,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 5d64984022..c874303722 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -314,7 +314,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) { @@ -351,7 +351,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; } } @@ -395,7 +395,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) { @@ -430,7 +430,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; } } @@ -448,7 +448,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; } @@ -538,7 +538,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) DRV_LOG(DEBUG, "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; @@ -591,7 +591,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; @@ -666,7 +666,7 @@ mlx5_link_update_bond(struct rte_eth_dev *dev) ret = mlx5_ifreq_by_ifname(bond->ifname, SIOCGIFFLAGS, &ifr); if (ret) { DRV_LOG(WARNING, "ifname %s ioctl(SIOCGIFFLAGS) failed: %s", - bond->ifname, strerror(rte_errno)); + bond->ifname, rte_strerror(rte_errno)); return; } dev->data->dev_link.link_status = @@ -1118,7 +1118,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; @@ -1167,7 +1167,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); @@ -1725,7 +1725,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_counters(dev, bond_master, 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 0a8de88759..3bbc28bd55 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1256,7 +1256,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) { @@ -1271,7 +1271,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; } @@ -1431,7 +1431,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; @@ -1522,7 +1522,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); @@ -1568,7 +1568,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; } @@ -2034,7 +2034,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); @@ -2748,7 +2748,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--) { @@ -2928,13 +2928,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 454bd7c77e..b6d4f31c6d 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 e36fa651a1..8ea53c4d28 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1506,7 +1506,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; } } @@ -1835,7 +1835,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; @@ -2833,7 +2833,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; } } @@ -3064,7 +3064,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 8ebe784000..11e6d708e2 100644 --- a/drivers/net/mlx5/mlx5_devx.c +++ b/drivers/net/mlx5/mlx5_devx.c @@ -174,7 +174,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; } @@ -186,7 +186,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 c6655b7db4..e5ef5632dc 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 eadadcdffb..fa01a9e658 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -402,7 +402,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 f4ac58e2f9..ad81d11b48 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -247,7 +247,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev) ret = mlx5_os_get_stats_n(dev, bond_master, &stats_n, &stats_n_2nd); if (ret < 0) { DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id, - strerror(-ret)); + rte_strerror(-ret)); return ret; } if (xstats_ctrl->stats_n != stats_n || @@ -265,7 +265,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_counters(dev, bond_master, 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 1bb5a89559..6cc3cedfa3 100644 --- a/drivers/net/mlx5/mlx5_testpmd.c +++ b/drivers/net/mlx5/mlx5_testpmd.c @@ -215,13 +215,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; } @@ -232,7 +232,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; } @@ -431,7 +431,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 = @@ -590,7 +590,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)); } } @@ -663,7 +663,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)); } } @@ -746,7 +746,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); @@ -1108,7 +1108,7 @@ mlx5_cmd_apply_tlv_options_parsed(void *parsed_result, if (handle == NULL) { fprintf(stderr, "Fail to create GENEVE TLV parser, nb_option=%u: %s\n", - tlv_mng.nb_options, strerror(rte_errno)); + tlv_mng.nb_options, rte_strerror(rte_errno)); return; } @@ -1177,7 +1177,7 @@ mlx5_cmd_destroy_tlv_options_parsed(void *parsed_result, ret = rte_pmd_mlx5_destroy_geneve_tlv_parser(port->geneve_tlv_parser_handle); if (ret < 0) { fprintf(stderr, "Fail to destroy GENEVE TLV parser: %s\n", - strerror(-ret)); + rte_strerror(-ret)); return; } @@ -1259,10 +1259,10 @@ mlx5_cmd_dump_sq_context_options_parsed(void *parsed_result, fprintf(stderr, "invalid port_id %u\n", res->port_id); break; case -EIO: - fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); + fprintf(stderr, "File Access Error (%s)\n", rte_strerror(rte_errno)); break; default: - fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", strerror(rte_errno)); + fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", rte_strerror(rte_errno)); } } @@ -1341,10 +1341,10 @@ mlx5_cmd_dump_rq_context_options_parsed(void *parsed_result, fprintf(stderr, "invalid port_id %u\n", res->port_id); break; case -EIO: - fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); + fprintf(stderr, "File Access Error (%s)\n", rte_strerror(rte_errno)); break; default: - fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", strerror(rte_errno)); + fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", rte_strerror(rte_errno)); } } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index bf836c92fc..8ac91e6c71 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -1201,14 +1201,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) && @@ -1220,7 +1220,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) { @@ -1244,7 +1244,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; } /* @@ -1254,7 +1254,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. */ @@ -1307,7 +1307,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 49f750be68..cd0a02d76b 100644 --- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c @@ -221,7 +221,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 0ebd233595..3d3419965a 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -382,7 +382,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. */ @@ -430,7 +430,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; @@ -440,7 +440,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); @@ -483,7 +483,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; } @@ -737,7 +737,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)) { @@ -856,7 +856,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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 34/42] net/qede: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (32 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 33/42] net/mlx5: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 35/42] net/sfc: " Dengdui Huang ` (10 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 35/42] net/sfc: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (33 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 34/42] net/qede: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 36/42] net/tap: " Dengdui Huang ` (9 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 1006243539..db3a2fbc8f 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1397,7 +1397,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 b0e8b02b41..2813189f67 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -428,7 +428,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; } } @@ -445,7 +445,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; } @@ -484,7 +484,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; } @@ -503,7 +503,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; } @@ -616,7 +616,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; } } @@ -642,7 +642,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; } @@ -685,7 +685,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; } @@ -818,7 +818,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; } @@ -859,7 +859,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; } } @@ -873,7 +873,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; } @@ -916,7 +916,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; @@ -1241,7 +1241,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); @@ -1289,7 +1289,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; @@ -1445,7 +1445,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; } @@ -1498,7 +1498,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; @@ -1708,7 +1708,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; } @@ -1759,7 +1759,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; @@ -4396,7 +4396,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, -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 36/42] net/tap: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (34 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 35/42] net/sfc: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 37/42] net/vhost: " Dengdui Huang ` (8 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- drivers/net/tap/rte_eth_tap.c | 28 ++++++++++++++-------------- drivers/net/tap/tap_flow.c | 14 +++++++------- drivers/net/tap/tap_netlink.c | 5 +++-- drivers/net/tap/tap_tcmsgs.c | 6 ++++-- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 36b06b3ac5..629f577f7b 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -198,7 +198,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; } @@ -206,7 +206,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; } @@ -226,7 +226,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; } } @@ -234,7 +234,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) flags = fcntl(fd, F_GETFL); if (flags == -1) { TAP_LOG(WARNING, "Unable to get %s current flags: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, rte_strerror(errno)); goto error; } @@ -243,7 +243,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; } @@ -296,18 +296,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; } } @@ -822,7 +822,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; } @@ -1946,7 +1946,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; } @@ -2109,7 +2109,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; @@ -2120,7 +2120,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, #ifdef HAVE_TCA_FLOWER 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); #endif @@ -2454,7 +2454,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; } } @@ -2514,7 +2514,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 51ec07eb5a..0c9a643492 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -1317,7 +1317,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"); @@ -1362,7 +1362,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, @@ -1416,7 +1416,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"); @@ -1440,7 +1440,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"); @@ -1664,7 +1664,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); @@ -1754,7 +1754,7 @@ static int rss_enable(struct pmd_internals *pmd, struct rte_flow_error *error) /* Load the BPF program (defined in tap_bpf.h from skeleton) */ pmd->rss = tap_rss__open_and_load(); if (pmd->rss == NULL) { - TAP_LOG(ERR, "Failed to load BPF object: %s", strerror(errno)); + TAP_LOG(ERR, "Failed to load BPF object: %s", rte_strerror(errno)); rte_flow_error_set(error, errno, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "BPF object could not be loaded"); return -errno; @@ -1885,7 +1885,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 %#x (%d): %s", - handle, errno, strerror(errno)); + handle, 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 35c491ac37..6011f6c61d 100644 --- a/drivers/net/tap/tap_netlink.c +++ b/drivers/net/tap/tap_netlink.c @@ -14,6 +14,7 @@ #include <rte_malloc.h> #include <tap_netlink.h> #include <rte_random.h> +#include <rte_errno.h> #include "tap_log.h" @@ -98,7 +99,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; @@ -130,7 +131,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 <net/if.h> #include <string.h> +#include <rte_errno.h> + #include <rte_log.h> #include <tap_tcmsgs.h> #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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 37/42] net/vhost: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (35 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 36/42] net/tap: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 38/42] net/virtio: " Dengdui Huang ` (7 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 87c05caccd..d1bb124a69 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -568,7 +568,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_LINE(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s", - vq->kickfd, rxq_idx, strerror(errno)); + vq->kickfd, rxq_idx, rte_strerror(errno)); } else { VHOST_LOG_LINE(DEBUG, "Unregistered %d from rxq-%d epoll", vq->kickfd, rxq_idx); @@ -580,7 +580,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_LINE(ERR, "Failed to register %d in rxq-%d epoll: %s", - vring.kickfd, rxq_idx, strerror(errno)); + vring.kickfd, rxq_idx, rte_strerror(errno)); } else { vq->kickfd = vring.kickfd; VHOST_LOG_LINE(DEBUG, "Registered %d in rxq-%d epoll", @@ -731,7 +731,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_LINE(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s", - vq->kickfd, i, strerror(errno)); + vq->kickfd, i, rte_strerror(errno)); } else { VHOST_LOG_LINE(DEBUG, "Unregistered %d from rxq-%d epoll", vq->kickfd, i); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 38/42] net/virtio: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (36 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 37/42] net/vhost: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 39/42] raw/ifpga: " Dengdui Huang ` (6 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 <limits.h> #include <rte_ether.h> +#include <rte_errno.h> #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 c10252506b..d3742c6c62 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -136,7 +136,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; } @@ -149,7 +149,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.", @@ -175,7 +175,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.", @@ -750,7 +750,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); @@ -761,13 +761,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; } @@ -835,15 +835,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; @@ -857,7 +857,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 bc3e2a9af5..f8c883ee64 100644 --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c @@ -93,7 +93,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; } @@ -187,7 +187,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; } @@ -213,7 +213,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; } @@ -244,7 +244,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; } @@ -273,7 +273,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; } @@ -531,7 +531,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 2997d2bd26..33389c702e 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -60,13 +60,13 @@ virtio_user_init_notify_queue(struct virtio_user_dev *dev, uint32_t queue_sel) dev->callfds[queue_sel] = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (dev->callfds[queue_sel] < 0) { PMD_DRV_LOG(ERR, "(%s) Failed to setup callfd for queue %u: %s", - dev->path, queue_sel, strerror(errno)); + dev->path, queue_sel, rte_strerror(errno)); return -1; } dev->kickfds[queue_sel] = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (dev->kickfds[queue_sel] < 0) { PMD_DRV_LOG(ERR, "(%s) Failed to setup kickfd for queue %u: %s", - dev->path, queue_sel, strerror(errno)); + dev->path, queue_sel, rte_strerror(errno)); return -1; } @@ -1113,7 +1113,7 @@ virtio_user_control_queue_notify(struct virtqueue *vq, void *cookie) if (!dev->notify_area) { if (write(dev->kickfds[vq->vq_queue_index], ¬ify_data, sizeof(notify_data)) < 0) PMD_DRV_LOG(ERR, "failed to kick backend: %s", - strerror(errno)); + rte_strerror(errno)); return; } else if (!virtio_with_feature(&dev->hw, VIRTIO_F_NOTIFICATION_DATA)) { rte_write16(vq->vq_queue_index, vq->notify_addr); @@ -1358,7 +1358,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 747dddeb2e..5a23d63012 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -285,7 +285,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq) if (write(dev->kickfds[vq->vq_queue_index], ¬ify_data, sizeof(notify_data)) < 0) PMD_DRV_LOG(ERR, "failed to kick backend: %s", - strerror(errno)); + rte_strerror(errno)); return; } else if (!virtio_with_feature(hw, VIRTIO_F_NOTIFICATION_DATA)) { rte_write16(vq->vq_queue_index, vq->notify_addr); @@ -417,7 +417,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; } @@ -444,7 +444,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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 39/42] raw/ifpga: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (37 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 38/42] net/virtio: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 40/42] vdpa/ifc: " Dengdui Huang ` (5 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 6aae1b224e..a67a427985 100644 --- a/drivers/raw/ifpga/afu_pmd_n3000.c +++ b/drivers/raw/ifpga/afu_pmd_n3000.c @@ -21,6 +21,7 @@ #include <bus_pci_driver.h> #include <bus_ifpga_driver.h> #include <rte_rawdev.h> +#include <rte_errno.h> #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 <unistd.h> #include "ifpga_sec_mgr.h" +#include <rte_errno.h> + 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 5b9b596435..5982621373 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -848,7 +848,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", __func__, file_name); - IFPGA_RAWDEV_PMD_ERR("Message : %s", strerror(errno)); + IFPGA_RAWDEV_PMD_ERR("Message : %s", rte_strerror(errno)); return -EINVAL; } ret = stat(file_name, &file_stat); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 40/42] vdpa/ifc: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (38 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 39/42] raw/ifpga: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 41/42] vdpa/mlx5: " Dengdui Huang ` (4 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 65de383b95..8cea354674 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -23,6 +23,7 @@ #include <rte_log.h> #include <rte_kvargs.h> #include <rte_devargs.h> +#include <rte_errno.h> #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", csc_event.data.fd, - strerror(errno)); + rte_strerror(errno)); goto out; } else if (nbytes == 0) { DRV_LOG(ERR, "Read nothing from file descriptor %d", @@ -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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 41/42] vdpa/mlx5: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (39 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 40/42] vdpa/ifc: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 42/42] vdpa/sfc: " Dengdui Huang ` (3 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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 093cdd08d2..d1069088a4 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v4 42/42] vdpa/sfc: use rte strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (40 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 41/42] vdpa/mlx5: " Dengdui Huang @ 2024-10-23 8:28 ` Dengdui Huang 2024-10-23 15:42 ` [PATCH v4 00/42] replace strerror Stephen Hemminger ` (2 subsequent siblings) 44 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-10-23 8:28 UTC (permalink / raw) To: dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 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 <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v4 00/42] replace strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (41 preceding siblings ...) 2024-10-23 8:28 ` [PATCH v4 42/42] vdpa/sfc: " Dengdui Huang @ 2024-10-23 15:42 ` Stephen Hemminger 2024-10-24 6:47 ` huangdengdui 2024-10-29 1:16 ` lihuisong (C) 2024-11-04 18:22 ` Stephen Hemminger 44 siblings, 1 reply; 264+ messages in thread From: Stephen Hemminger @ 2024-10-23 15:42 UTC (permalink / raw) To: Dengdui Huang Cc: dev, ferruh.yigit, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong On Wed, 23 Oct 2024 16:28:10 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > The function strerror() is insecure in a multi-thread environment. > It is better to use rte_strerror() instead of strerror(). > In this patchset, only the libs and drivers are modified. > > chang log: > v3->v4 fix ci error > v2->v3 drop patch "telemetry: replace strerror" due to compile fail > v1-v2 fix ci error Even rte_strerror is not completely safe. It depends on the calling thread being a registered lcore. It would be better to use a coccinelle script to do direct replacement with strerror_r(). Also, rte_strerror is not signal safe. ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v4 00/42] replace strerror 2024-10-23 15:42 ` [PATCH v4 00/42] replace strerror Stephen Hemminger @ 2024-10-24 6:47 ` huangdengdui 2024-10-25 21:56 ` Thomas Monjalon 0 siblings, 1 reply; 264+ messages in thread From: huangdengdui @ 2024-10-24 6:47 UTC (permalink / raw) To: Stephen Hemminger Cc: dev, ferruh.yigit, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong Hi, Stephen Hemminger On 2024/10/23 23:42, Stephen Hemminger wrote: > On Wed, 23 Oct 2024 16:28:10 +0800 > Dengdui Huang <huangdengdui@huawei.com> wrote: > >> The function strerror() is insecure in a multi-thread environment. >> It is better to use rte_strerror() instead of strerror(). >> In this patchset, only the libs and drivers are modified. >> >> chang log: >> v3->v4 fix ci error >> v2->v3 drop patch "telemetry: replace strerror" due to compile fail >> v1-v2 fix ci error > > Even rte_strerror is not completely safe. It depends on the calling > thread being a registered lcore. As discussed earlier, it is still safe if used from non-DPDK registered threads[1]: #define RTE_DEFINE_PER_LCORE(type, name) \ __thread __typeof__(type) per_lcore_##name [1]: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_per_lcore.h#L37 > > It would be better to use a coccinelle script to do direct replacement > with strerror_r(). > > Also, rte_strerror is not signal safe. Can we use strerror_r() in the signal processing context and replace it with rte_strerror() everywhere else? ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v4 00/42] replace strerror 2024-10-24 6:47 ` huangdengdui @ 2024-10-25 21:56 ` Thomas Monjalon 2024-11-01 9:16 ` huangdengdui 0 siblings, 1 reply; 264+ messages in thread From: Thomas Monjalon @ 2024-10-25 21:56 UTC (permalink / raw) To: huangdengdui Cc: Stephen Hemminger, dev, ferruh.yigit, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong 24/10/2024 08:47, huangdengdui: > On 2024/10/23 23:42, Stephen Hemminger wrote: > > On Wed, 23 Oct 2024 16:28:10 +0800 > > Dengdui Huang <huangdengdui@huawei.com> wrote: > > > >> The function strerror() is insecure in a multi-thread environment. > >> It is better to use rte_strerror() instead of strerror(). > >> In this patchset, only the libs and drivers are modified. > > > > Even rte_strerror is not completely safe. It depends on the calling > > thread being a registered lcore. > > As discussed earlier, it is still safe if used from non-DPDK registered threads[1]: > > #define RTE_DEFINE_PER_LCORE(type, name) \ > __thread __typeof__(type) per_lcore_##name > > [1]: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_per_lcore.h#L37 > > > > > It would be better to use a coccinelle script to do direct replacement > > with strerror_r(). > > > > Also, rte_strerror is not signal safe. > > Can we use strerror_r() in the signal processing context and replace it with rte_strerror() everywhere else? It does not make sense to use rte_strerror after libc functions. Please restrict the use of rte_strerror for error numbers from DPDK functions. ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v4 00/42] replace strerror 2024-10-25 21:56 ` Thomas Monjalon @ 2024-11-01 9:16 ` huangdengdui 0 siblings, 0 replies; 264+ messages in thread From: huangdengdui @ 2024-11-01 9:16 UTC (permalink / raw) To: Thomas Monjalon Cc: Stephen Hemminger, dev, ferruh.yigit, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong On 2024/10/26 5:56, Thomas Monjalon wrote: > 24/10/2024 08:47, huangdengdui: >> On 2024/10/23 23:42, Stephen Hemminger wrote: >>> On Wed, 23 Oct 2024 16:28:10 +0800 >>> Dengdui Huang <huangdengdui@huawei.com> wrote: >>> >>>> The function strerror() is insecure in a multi-thread environment. >>>> It is better to use rte_strerror() instead of strerror(). >>>> In this patchset, only the libs and drivers are modified. >>> >>> Even rte_strerror is not completely safe. It depends on the calling >>> thread being a registered lcore. >> >> As discussed earlier, it is still safe if used from non-DPDK registered threads[1]: >> >> #define RTE_DEFINE_PER_LCORE(type, name) \ >> __thread __typeof__(type) per_lcore_##name >> >> [1]: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_per_lcore.h#L37 >> >>> >>> It would be better to use a coccinelle script to do direct replacement >>> with strerror_r(). >>> >>> Also, rte_strerror is not signal safe. >> >> Can we use strerror_r() in the signal processing context and replace it with rte_strerror() everywhere else? > > It does not make sense to use rte_strerror after libc functions. > Please restrict the use of rte_strerror for error numbers from DPDK functions. > > The Windows platform does not support strerror_r(). Using strerror_r() instead of strerror() is not a good idea, Platform differences have been handled in rte_strerror()[1]. The rte_strerror() can also handle errno from libc functions[2][3]. So is it better to use rte_strerror() instead of strerror()? [1]https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/common/eal_common_errno.c#L15 [2]https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/common/eal_common_errno.c#L49 [3]https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_errno.h#L32 ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v4 00/42] replace strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (42 preceding siblings ...) 2024-10-23 15:42 ` [PATCH v4 00/42] replace strerror Stephen Hemminger @ 2024-10-29 1:16 ` lihuisong (C) 2024-11-04 18:22 ` Stephen Hemminger 44 siblings, 0 replies; 264+ messages in thread From: lihuisong (C) @ 2024-10-29 1:16 UTC (permalink / raw) To: Dengdui Huang, dev Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, fengchengwen, haijie1, liuyonglong For series, Acked-by: Huisong Li <lihuisong@huawei.com> 在 2024/10/23 16:28, Dengdui Huang 写道: > The function strerror() is insecure in a multi-thread environment. > It is better to use rte_strerror() instead of strerror(). > In this patchset, only the libs and drivers are modified. > > chang log: > v3->v4 fix ci error > v2->v3 drop patch "telemetry: replace strerror" due to compile fail > v1-v2 fix ci error > > Dengdui Huang (42): > devtools: forbid use of strerror > eal: use rte strerror > eventdev: use rte strerror > latency: use rte strerror > node: use rte strerror > pdump: use rte strerror > power: use rte strerror > vhost: use rte strerror > bpf: use rte strerror > bus/cdx: use rte strerror > bus/dpaa: use rte strerror > bus/fslmc: use rte strerror > bus/pci: use rte strerror > bus/vdev: use rte strerror > bus/vmbus: use rte strerror > common/cnxk: use rte strerror > common/mlx5: use rte strerror > crypto/caam_jr: use rte strerror > dma/idxd: use rte strerror > net/af_packet: use rte strerror > net/bnxt: use rte strerror > net/af_xdp: use rte strerror > net/bonding: use rte strerror > net/dpaa: use rte strerror > net/dpaa2: use rte strerror > net/enetfec: use rte strerror > net/failsafe: use rte strerror > net/i40e: use rte strerror > net/ice: use rte strerror > net/ixgbe: use rte strerror > net/memif: use rte strerror > net/mlx4: use rte strerror > net/mlx5: use rte strerror > net/qede: use rte strerror > net/sfc: use rte strerror > net/tap: use rte strerror > net/vhost: use rte strerror > net/virtio: use rte strerror > raw/ifpga: use rte strerror > vdpa/ifc: use rte strerror > vdpa/mlx5: use rte strerror > vdpa/sfc: use rte strerror > > devtools/checkpatches.sh | 8 + > drivers/bus/cdx/cdx.c | 2 +- > drivers/bus/cdx/cdx_vfio.c | 13 +- > drivers/bus/dpaa/base/fman/fman.c | 2 +- > drivers/bus/dpaa/dpaa_bus.c | 2 +- > drivers/bus/fslmc/fslmc_vfio.c | 12 +- > 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 +- > drivers/bus/vdev/vdev.c | 2 +- > 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 +- > drivers/common/cnxk/roc_dev.c | 6 +- > drivers/common/cnxk/roc_model.c | 4 +- > drivers/common/cnxk/roc_utils.c | 4 +- > drivers/common/mlx5/linux/mlx5_nl.c | 12 +- > drivers/common/mlx5/mlx5_common.c | 6 +- > drivers/crypto/caam_jr/caam_jr_uio.c | 5 +- > drivers/dma/idxd/idxd_bus.c | 15 +- > drivers/net/af_packet/rte_eth_af_packet.c | 2 +- > drivers/net/af_xdp/rte_eth_af_xdp.c | 12 +- > 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 +- > 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 +- > drivers/net/dpaa/dpaa_ethdev.c | 4 +- > drivers/net/dpaa/fmlib/fm_lib.c | 6 +- > drivers/net/dpaa2/dpaa2_ethdev.c | 4 +- > drivers/net/enetfec/enet_uio.c | 2 +- > 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 +- > drivers/net/i40e/i40e_testpmd.c | 42 +-- > drivers/net/ice/ice_testpmd.c | 4 +- > drivers/net/ixgbe/ixgbe_testpmd.c | 12 +- > drivers/net/memif/memif_socket.c | 4 +- > drivers/net/memif/rte_eth_memif.c | 20 +- > 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 +- > drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- > drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +- > 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 | 26 +- > 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 +- > drivers/net/qede/qede_regs.c | 4 +- > drivers/net/sfc/sfc_flow.c | 2 +- > drivers/net/sfc/sfc_flow_tunnel.c | 2 +- > drivers/net/sfc/sfc_mae.c | 58 ++--- > drivers/net/tap/rte_eth_tap.c | 28 +- > drivers/net/tap/tap_flow.c | 14 +- > drivers/net/tap/tap_netlink.c | 5 +- > drivers/net/tap/tap_tcmsgs.c | 6 +- > drivers/net/vhost/rte_eth_vhost.c | 6 +- > 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 +- > drivers/raw/ifpga/afu_pmd_n3000.c | 5 +- > drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +- > drivers/raw/ifpga/ifpga_rawdev.c | 2 +- > drivers/vdpa/ifc/ifcvf_vdpa.c | 23 +- > drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +- > drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +- > lib/bpf/bpf_load_elf.c | 2 +- > 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 | 7 +- > 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 | 42 +-- > lib/eal/linux/eal_timer.c | 2 +- > lib/eal/linux/eal_vfio.c | 42 +-- > lib/eal/unix/eal_filesystem.c | 5 +- > lib/eal/unix/eal_unix_memory.c | 6 +- > lib/eal/unix/rte_thread.c | 6 +- > lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- > lib/latencystats/rte_latencystats.c | 4 +- > lib/node/kernel_tx.c | 2 +- > lib/pdump/rte_pdump.c | 6 +- > 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 +- > lib/vhost/fd_man.c | 7 +- > lib/vhost/socket.c | 13 +- > lib/vhost/vduse.c | 45 ++-- > lib/vhost/vhost_user.c | 10 +- > 135 files changed, 956 insertions(+), 913 deletions(-) > ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v4 00/42] replace strerror 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang ` (43 preceding siblings ...) 2024-10-29 1:16 ` lihuisong (C) @ 2024-11-04 18:22 ` Stephen Hemminger 44 siblings, 0 replies; 264+ messages in thread From: Stephen Hemminger @ 2024-11-04 18:22 UTC (permalink / raw) To: Dengdui Huang Cc: dev, ferruh.yigit, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong On Wed, 23 Oct 2024 16:28:10 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > The function strerror() is insecure in a multi-thread environment. > It is better to use rte_strerror() instead of strerror(). > In this patchset, only the libs and drivers are modified. > > chang log: > v3->v4 fix ci error > v2->v3 drop patch "telemetry: replace strerror" due to compile fail > v1-v2 fix ci error > > Dengdui Huang (42): > devtools: forbid use of strerror > eal: use rte strerror > eventdev: use rte strerror > latency: use rte strerror > node: use rte strerror > pdump: use rte strerror > power: use rte strerror > vhost: use rte strerror > bpf: use rte strerror > bus/cdx: use rte strerror > bus/dpaa: use rte strerror > bus/fslmc: use rte strerror > bus/pci: use rte strerror > bus/vdev: use rte strerror > bus/vmbus: use rte strerror > common/cnxk: use rte strerror > common/mlx5: use rte strerror > crypto/caam_jr: use rte strerror > dma/idxd: use rte strerror > net/af_packet: use rte strerror > net/bnxt: use rte strerror > net/af_xdp: use rte strerror > net/bonding: use rte strerror > net/dpaa: use rte strerror > net/dpaa2: use rte strerror > net/enetfec: use rte strerror > net/failsafe: use rte strerror > net/i40e: use rte strerror > net/ice: use rte strerror > net/ixgbe: use rte strerror > net/memif: use rte strerror > net/mlx4: use rte strerror > net/mlx5: use rte strerror > net/qede: use rte strerror > net/sfc: use rte strerror > net/tap: use rte strerror > net/vhost: use rte strerror > net/virtio: use rte strerror > raw/ifpga: use rte strerror > vdpa/ifc: use rte strerror > vdpa/mlx5: use rte strerror > vdpa/sfc: use rte strerror > > devtools/checkpatches.sh | 8 + > drivers/bus/cdx/cdx.c | 2 +- > drivers/bus/cdx/cdx_vfio.c | 13 +- > drivers/bus/dpaa/base/fman/fman.c | 2 +- > drivers/bus/dpaa/dpaa_bus.c | 2 +- > drivers/bus/fslmc/fslmc_vfio.c | 12 +- > 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 +- > drivers/bus/vdev/vdev.c | 2 +- > 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 +- > drivers/common/cnxk/roc_dev.c | 6 +- > drivers/common/cnxk/roc_model.c | 4 +- > drivers/common/cnxk/roc_utils.c | 4 +- > drivers/common/mlx5/linux/mlx5_nl.c | 12 +- > drivers/common/mlx5/mlx5_common.c | 6 +- > drivers/crypto/caam_jr/caam_jr_uio.c | 5 +- > drivers/dma/idxd/idxd_bus.c | 15 +- > drivers/net/af_packet/rte_eth_af_packet.c | 2 +- > drivers/net/af_xdp/rte_eth_af_xdp.c | 12 +- > 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 +- > 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 +- > drivers/net/dpaa/dpaa_ethdev.c | 4 +- > drivers/net/dpaa/fmlib/fm_lib.c | 6 +- > drivers/net/dpaa2/dpaa2_ethdev.c | 4 +- > drivers/net/enetfec/enet_uio.c | 2 +- > 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 +- > drivers/net/i40e/i40e_testpmd.c | 42 +-- > drivers/net/ice/ice_testpmd.c | 4 +- > drivers/net/ixgbe/ixgbe_testpmd.c | 12 +- > drivers/net/memif/memif_socket.c | 4 +- > drivers/net/memif/rte_eth_memif.c | 20 +- > 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 +- > drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- > drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +- > 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 | 26 +- > 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 +- > drivers/net/qede/qede_regs.c | 4 +- > drivers/net/sfc/sfc_flow.c | 2 +- > drivers/net/sfc/sfc_flow_tunnel.c | 2 +- > drivers/net/sfc/sfc_mae.c | 58 ++--- > drivers/net/tap/rte_eth_tap.c | 28 +- > drivers/net/tap/tap_flow.c | 14 +- > drivers/net/tap/tap_netlink.c | 5 +- > drivers/net/tap/tap_tcmsgs.c | 6 +- > drivers/net/vhost/rte_eth_vhost.c | 6 +- > 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 +- > drivers/raw/ifpga/afu_pmd_n3000.c | 5 +- > drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +- > drivers/raw/ifpga/ifpga_rawdev.c | 2 +- > drivers/vdpa/ifc/ifcvf_vdpa.c | 23 +- > drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +- > drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +- > lib/bpf/bpf_load_elf.c | 2 +- > 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 | 7 +- > 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 | 42 +-- > lib/eal/linux/eal_timer.c | 2 +- > lib/eal/linux/eal_vfio.c | 42 +-- > lib/eal/unix/eal_filesystem.c | 5 +- > lib/eal/unix/eal_unix_memory.c | 6 +- > lib/eal/unix/rte_thread.c | 6 +- > lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- > lib/latencystats/rte_latencystats.c | 4 +- > lib/node/kernel_tx.c | 2 +- > lib/pdump/rte_pdump.c | 6 +- > 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 +- > lib/vhost/fd_man.c | 7 +- > lib/vhost/socket.c | 13 +- > lib/vhost/vduse.c | 45 ++-- > lib/vhost/vhost_user.c | 10 +- > 135 files changed, 956 insertions(+), 913 deletions(-) > I don't think this is necessary because strerror() does not have the same problems as strtok does. The function is documented to return a pointer to an immutable string; there is no thread safety issue here. Internally, Glibc uses TLS to make sure that it either returns a value from the error list, or it a pointer to an internal TLS error buffer. Can't see the justification. ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH 00/43] replace strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (42 preceding siblings ...) 2023-11-14 8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang @ 2023-11-15 0:16 ` Stephen Hemminger 2024-02-01 11:03 ` David Marchand 2024-10-22 10:48 ` Morten Brørup 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (2 subsequent siblings) 46 siblings, 2 replies; 264+ messages in thread From: Stephen Hemminger @ 2023-11-15 0:16 UTC (permalink / raw) To: Dengdui Huang; +Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong On Tue, 14 Nov 2023 16:24:56 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > The function strerror() is insecure in a multi-thread environment. > This series of patches fix it. In this patchset, only the libs and > drivers are modified. Doing such a global replace seems like a lot of changes for many cases that are not multi-threaded. ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH 00/43] replace strerror 2023-11-15 0:16 ` [PATCH 00/43] " Stephen Hemminger @ 2024-02-01 11:03 ` David Marchand 2024-10-22 10:48 ` Morten Brørup 1 sibling, 0 replies; 264+ messages in thread From: David Marchand @ 2024-02-01 11:03 UTC (permalink / raw) To: Stephen Hemminger, Dengdui Huang Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong On Wed, Nov 15, 2023 at 1:17 AM Stephen Hemminger <stephen@networkplumber.org> wrote: > > On Tue, 14 Nov 2023 16:24:56 +0800 > Dengdui Huang <huangdengdui@huawei.com> wrote: > > > The function strerror() is insecure in a multi-thread environment. > > This series of patches fix it. In this patchset, only the libs and > > drivers are modified. > > Doing such a global replace seems like a lot of changes for many > cases that are not multi-threaded. > Is there an actual fix mixed somewhere in this series? If so, it should be clearly identified for backports. -- David Marchand ^ permalink raw reply [flat|nested] 264+ messages in thread
* RE: [PATCH 00/43] replace strerror 2023-11-15 0:16 ` [PATCH 00/43] " Stephen Hemminger 2024-02-01 11:03 ` David Marchand @ 2024-10-22 10:48 ` Morten Brørup 1 sibling, 0 replies; 264+ messages in thread From: Morten Brørup @ 2024-10-22 10:48 UTC (permalink / raw) To: Stephen Hemminger, Dengdui Huang Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Wednesday, 15 November 2023 01.17 > > On Tue, 14 Nov 2023 16:24:56 +0800 > Dengdui Huang <huangdengdui@huawei.com> wrote: > > > The function strerror() is insecure in a multi-thread environment. > > This series of patches fix it. In this patchset, only the libs and > > drivers are modified. > > Doing such a global replace seems like a lot of changes for many > cases that are not multi-threaded. +1 to doing this, also in functions that are supposed to be single threaded; because it allows the addition to checkpatches. Acked-by: Morten Brørup <mb@smartsharesystems.com> ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 00/52] replace strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (43 preceding siblings ...) 2023-11-15 0:16 ` [PATCH 00/43] " Stephen Hemminger @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 01/52] eal: fix use rte errno for libc function Dengdui Huang ` (52 more replies) 2024-11-06 18:57 ` [PATCH 00/43] " Stephen Hemminger 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang 46 siblings, 53 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. It is better to use strerror_r() instead of strerror(). In addition, rte_errno should obtain the error description through rte_strerror() instead of strerror(). In this patchset, only the libs and drivers are modified. v4->v5 strerror_r(errno) replace strerror(errno), and rte_strerror replace strerror(rte_errno). v3->v4 fix ci error v2->v3 drop patch "telemetry: replace strerror" due to compile fail v1-v2 fix ci error Dengdui Huang (52): eal: fix use rte errno for libc function devtools: forbid use of strerror eal: replace strerror with reentrant version eventdev: replace strerror with reentrant version latency: replace strerror with reentrant version node: replace strerror with reentrant version pdump: replace strerror with reentrant version pdump: use rte strerror power: replace strerror with reentrant version vhost: replace strerror with reentrant version bpf: replace strerror with reentrant version bus/cdx: replace strerror with reentrant version bus/dpaa: replace strerror with reentrant version bus/fslmc: replace strerror with reentrant version bus/pci: replace strerror with reentrant version bus/vmbus: replace strerror with reentrant version bus/vdev: use rte strerror common/cnxk: replace strerror with reentrant version common/mlx5: replace strerror with reentrant version common/mlx5: use rte strerror crypto/caam_jr: replace strerror with reentrant version dma/idxd: replace strerror with reentrant version net/bnxt: replace strerror with reentrant version net/af_xdp: replace strerror with reentrant version net/af_xdp: use rte strerror net/bonding: replace strerror with reentrant version net/bonding: use rte strerror net/cnxk: replace strerror with reentrant version net/dpaa: replace strerror with reentrant version net/dpaa2: replace strerror with reentrant version net/enetfec: replace strerror with reentrant version net/failsafe: replace strerror with reentrant version net/failsafe: use rte strerror net/i40e: replace strerror with reentrant version net/ice: replace strerror with reentrant version net/ixgbe: replace strerror with reentrant version net/memif: replace strerror with reentrant version net/memif: use rte strerror net/mlx4: replace strerror with reentrant version net/mlx4: use rte strerror net/mlx5: replace strerror with reentrant version net/mlx5: use rte strerror net/qede: replace strerror with reentrant version net/sfc: replace strerror with reentrant version net/tap: replace strerror with reentrant version net/tap: use rte strerror net/vhost: replace strerror with reentrant version net/virtio: replace strerror with reentrant version raw/ifpga: replace strerror with reentrant version vdpa/ifc: replace strerror with reentrant version vdpa/mlx5: replace strerror with reentrant version vdpa/sfc: replace strerror with reentrant version devtools/checkpatches.sh | 8 + drivers/bus/cdx/cdx.c | 6 +- drivers/bus/cdx/cdx_vfio.c | 58 +- drivers/bus/dpaa/base/fman/fman.c | 8 +- drivers/bus/dpaa/dpaa_bus.c | 5 +- drivers/bus/fslmc/fslmc_vfio.c | 28 +- drivers/bus/pci/bsd/pci.c | 20 +- drivers/bus/pci/linux/pci.c | 16 +- drivers/bus/pci/linux/pci_uio.c | 50 +- drivers/bus/pci/linux/pci_vfio.c | 52 +- drivers/bus/pci/pci_common_uio.c | 6 +- drivers/bus/vdev/vdev.c | 2 +- drivers/bus/vmbus/linux/vmbus_bus.c | 16 +- drivers/bus/vmbus/linux/vmbus_uio.c | 55 +- drivers/bus/vmbus/vmbus_common.c | 13 +- drivers/bus/vmbus/vmbus_common_uio.c | 7 +- drivers/common/cnxk/roc_dev.c | 12 +- drivers/common/cnxk/roc_model.c | 8 +- drivers/common/mlx5/linux/mlx5_nl.c | 15 +- drivers/common/mlx5/mlx5_common.c | 6 +- drivers/crypto/caam_jr/caam_jr_uio.c | 11 +- drivers/dma/idxd/idxd_bus.c | 33 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 27 +- drivers/net/bnxt/bnxt_stats.c | 8 +- drivers/net/bnxt/rte_pmd_bnxt.c | 65 ++- drivers/net/bnxt/tf_core/tf_core.c | 509 +++++++++++++----- drivers/net/bnxt/tf_core/tf_em_common.c | 56 +- .../net/bnxt/tf_core/tf_em_hash_internal.c | 10 +- drivers/net/bnxt/tf_core/tf_em_host.c | 51 +- drivers/net/bnxt/tf_core/tf_em_internal.c | 32 +- drivers/net/bnxt/tf_core/tf_global_cfg.c | 23 +- drivers/net/bnxt/tf_core/tf_identifier.c | 20 +- drivers/net/bnxt/tf_core/tf_if_tbl.c | 15 +- drivers/net/bnxt/tf_core/tf_msg.c | 347 +++++++++--- drivers/net/bnxt/tf_core/tf_rm.c | 14 +- drivers/net/bnxt/tf_core/tf_session.c | 161 ++++-- drivers/net/bnxt/tf_core/tf_sram_mgr.c | 51 +- drivers/net/bnxt/tf_core/tf_tbl.c | 62 ++- drivers/net/bnxt/tf_core/tf_tbl_sram.c | 103 +++- drivers/net/bnxt/tf_core/tf_tcam.c | 53 +- drivers/net/bonding/bonding_testpmd.c | 18 +- drivers/net/bonding/rte_eth_bond_api.c | 5 +- drivers/net/bonding/rte_eth_bond_flow.c | 4 +- drivers/net/bonding/rte_eth_bond_pmd.c | 16 +- drivers/net/cnxk/cnxk_rep_msg.c | 9 +- drivers/net/dpaa/dpaa_ethdev.c | 10 +- drivers/net/dpaa/fmlib/fm_lib.c | 15 +- drivers/net/dpaa2/dpaa2_ethdev.c | 12 +- drivers/net/enetfec/enet_uio.c | 5 +- drivers/net/failsafe/failsafe.c | 15 +- drivers/net/failsafe/failsafe_args.c | 12 +- drivers/net/failsafe/failsafe_eal.c | 7 +- drivers/net/failsafe/failsafe_flow.c | 4 +- drivers/net/failsafe/failsafe_ops.c | 5 +- drivers/net/failsafe/failsafe_private.h | 17 +- drivers/net/i40e/i40e_testpmd.c | 109 +++- drivers/net/ice/ice_testpmd.c | 10 +- drivers/net/ixgbe/ixgbe_testpmd.c | 30 +- drivers/net/memif/memif_socket.c | 10 +- drivers/net/memif/rte_eth_memif.c | 45 +- drivers/net/mlx4/mlx4.c | 29 +- drivers/net/mlx4/mlx4_ethdev.c | 18 +- drivers/net/mlx4/mlx4_rxq.c | 18 +- drivers/net/mlx4/mlx4_txq.c | 10 +- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +- drivers/net/mlx5/linux/mlx5_os.c | 21 +- drivers/net/mlx5/linux/mlx5_socket.c | 40 +- drivers/net/mlx5/linux/mlx5_verbs.c | 20 +- drivers/net/mlx5/mlx5.c | 8 +- drivers/net/mlx5/mlx5_devx.c | 9 +- drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_rxmode.c | 8 +- drivers/net/mlx5/mlx5_rxq.c | 12 +- drivers/net/mlx5/mlx5_rxtx.c | 5 +- drivers/net/mlx5/mlx5_stats.c | 7 +- drivers/net/mlx5/mlx5_testpmd.c | 58 +- 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 | 16 +- drivers/net/qede/qede_regs.c | 9 +- drivers/net/sfc/sfc_flow.c | 5 +- drivers/net/sfc/sfc_flow_tunnel.c | 6 +- drivers/net/sfc/sfc_mae.c | 152 ++++-- drivers/net/tap/rte_eth_tap.c | 55 +- drivers/net/tap/tap_flow.c | 33 +- drivers/net/tap/tap_netlink.c | 12 +- drivers/net/tap/tap_tcmsgs.c | 12 +- drivers/net/vhost/rte_eth_vhost.c | 14 +- drivers/net/virtio/virtio_user/vhost_kernel.c | 21 +- .../net/virtio/virtio_user/vhost_kernel_tap.c | 56 +- drivers/net/virtio/virtio_user/vhost_user.c | 52 +- drivers/net/virtio/virtio_user/vhost_vdpa.c | 30 +- .../net/virtio/virtio_user/virtio_user_dev.c | 26 +- drivers/net/virtio/virtio_user_ethdev.c | 21 +- drivers/raw/ifpga/afu_pmd_n3000.c | 10 +- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 24 +- drivers/raw/ifpga/ifpga_rawdev.c | 5 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 57 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 5 +- drivers/vdpa/sfc/sfc_vdpa_ops.c | 15 +- lib/bpf/bpf_load_elf.c | 5 +- lib/eal/common/eal_common_fbarray.c | 6 +- lib/eal/common/eal_common_options.c | 19 +- lib/eal/common/eal_common_proc.c | 32 +- lib/eal/common/eal_common_trace_utils.c | 14 +- lib/eal/freebsd/eal.c | 10 +- lib/eal/freebsd/eal_interrupts.c | 26 +- lib/eal/freebsd/eal_memory.c | 6 +- lib/eal/freebsd/eal_timer.c | 22 +- lib/eal/include/rte_errno.h | 3 + lib/eal/linux/eal.c | 25 +- lib/eal/linux/eal_dev.c | 5 +- lib/eal/linux/eal_hugepage_info.c | 17 +- lib/eal/linux/eal_interrupts.c | 51 +- lib/eal/linux/eal_memalloc.c | 118 ++-- lib/eal/linux/eal_memory.c | 102 +++- lib/eal/linux/eal_timer.c | 6 +- lib/eal/linux/eal_vfio.c | 102 +++- lib/eal/unix/eal_filesystem.c | 12 +- lib/eal/unix/eal_unix_memory.c | 19 +- lib/eal/unix/rte_thread.c | 18 +- lib/eal/windows/include/rte_os_shim.h | 1 + lib/eventdev/rte_event_eth_rx_adapter.c | 8 +- lib/latencystats/rte_latencystats.c | 10 +- lib/node/kernel_tx.c | 8 +- lib/pdump/rte_pdump.c | 12 +- lib/power/guest_channel.c | 15 +- lib/power/power_kvm_vm.c | 6 +- lib/power/power_pstate_cpufreq.c | 14 +- lib/power/rte_power_pmd_mgmt.c | 6 +- lib/vhost/fd_man.c | 14 +- lib/vhost/socket.c | 34 +- lib/vhost/vduse.c | 105 +++- lib/vhost/vhost_user.c | 25 +- 136 files changed, 3172 insertions(+), 1045 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 01/52] eal: fix use rte errno for libc function 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 02/52] devtools: forbid use of strerror Dengdui Huang ` (51 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong In the libc function, rte_errno is not assigned a value. Therefore, errno should be used instead of it. Fixes: c4b89ecb64ea ("eal: introduce memory management wrappers") Cc: stable@dpdk.org Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/eal/unix/eal_unix_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c index 97969a401b..4fd066a290 100644 --- a/lib/eal/unix/eal_unix_memory.c +++ b/lib/eal/unix/eal_unix_memory.c @@ -84,7 +84,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump) int ret = madvise(virt, size, flags); if (ret) { EAL_LOG(DEBUG, "madvise(%p, %#zx, %d) failed: %s", - virt, size, flags, strerror(rte_errno)); + virt, size, flags, strerror(errno)); rte_errno = errno; } return ret; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 02/52] devtools: forbid use of strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 01/52] eal: fix use rte errno for libc function Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 03/52] eal: replace strerror with reentrant version Dengdui Huang ` (50 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. rte_strerror() or strerror_r() has been provided in DPDK to replace it. In addition, replace strerror_s with strerror_r on the Windows platform. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- devtools/checkpatches.sh | 8 ++++++++ lib/eal/windows/include/rte_os_shim.h | 1 + 2 files changed, 9 insertions(+) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 4a8591be22..c9ee3550c1 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -210,6 +210,14 @@ check_forbidden_additions() { # <patch> -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 or strerror_r' \ + -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='\\<RTE_LOG_REGISTER\\>' \ diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h index eda8113662..2bac31e716 100644 --- a/lib/eal/windows/include/rte_os_shim.h +++ b/lib/eal/windows/include/rte_os_shim.h @@ -20,6 +20,7 @@ #define strdup(str) _strdup(str) #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr) +#define strerror_r(errnum, buf, buflen) strerror_s(buf, buflen, errnum) #ifndef RTE_TOOLCHAIN_GCC #define strcasecmp(s1, s2) _stricmp(s1, s2) #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 03/52] eal: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 01/52] eal: fix use rte errno for libc function Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 02/52] devtools: forbid use of strerror Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 04/52] eventdev: " Dengdui Huang ` (49 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/eal/common/eal_common_fbarray.c | 6 +- lib/eal/common/eal_common_options.c | 19 ++-- lib/eal/common/eal_common_proc.c | 32 +++++-- lib/eal/common/eal_common_trace_utils.c | 14 ++- lib/eal/freebsd/eal.c | 10 +- lib/eal/freebsd/eal_interrupts.c | 26 ++++-- lib/eal/freebsd/eal_memory.c | 6 +- lib/eal/freebsd/eal_timer.c | 22 +++-- lib/eal/include/rte_errno.h | 3 + lib/eal/linux/eal.c | 25 +++-- lib/eal/linux/eal_dev.c | 5 +- lib/eal/linux/eal_hugepage_info.c | 17 ++-- lib/eal/linux/eal_interrupts.c | 51 +++++++--- lib/eal/linux/eal_memalloc.c | 118 ++++++++++++++++++------ lib/eal/linux/eal_memory.c | 102 ++++++++++++++------ lib/eal/linux/eal_timer.c | 6 +- lib/eal/linux/eal_vfio.c | 102 ++++++++++++++------ lib/eal/unix/eal_filesystem.c | 12 ++- lib/eal/unix/eal_unix_memory.c | 19 +++- lib/eal/unix/rte_thread.c | 18 ++-- 20 files changed, 446 insertions(+), 167 deletions(-) diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c index 22b43073c6..f288bd9163 100644 --- a/lib/eal/common/eal_common_fbarray.c +++ b/lib/eal/common/eal_common_fbarray.c @@ -985,6 +985,7 @@ rte_fbarray_detach(struct rte_fbarray *arr) int rte_fbarray_destroy(struct rte_fbarray *arr) { + char errmsg[RTE_STRERR_BUFSIZE]; struct mem_area *tmp = NULL; size_t mmap_len; int fd, ret; @@ -1040,8 +1041,9 @@ rte_fbarray_destroy(struct rte_fbarray *arr) /* we're OK to destroy the file */ eal_get_fbarray_path(path, sizeof(path), arr->name); if (unlink(path)) { - EAL_LOG(DEBUG, "Cannot unlink fbarray: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "Cannot unlink fbarray: %s", errmsg); 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 f1a5e329a5..f516b72fbf 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 <rte_errno.h> #define BITS_PER_HEX 4 #define LCORE_OPT_LST 1 @@ -401,6 +402,7 @@ eal_plugins_init(void) static int eal_plugindir_init(const char *path) { + char errmsg[RTE_STRERR_BUFSIZE]; DIR *d = NULL; struct dirent *dent = NULL; char sopath[PATH_MAX]; @@ -410,8 +412,9 @@ eal_plugindir_init(const char *path) d = opendir(path); if (d == NULL) { - EAL_LOG(ERR, "failed to open directory %s: %s", - path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "failed to open directory %s: %s", path, errmsg); return -1; } @@ -443,6 +446,7 @@ eal_plugindir_init(const char *path) static int verify_perms(const char *dirpath) { + char errmsg[RTE_STRERR_BUFSIZE]; struct stat st; /* if not root, check down one level first */ @@ -462,8 +466,9 @@ verify_perms(const char *dirpath) /* call stat to check for permissions and ensure not world writable */ if (stat(dirpath, &st) != 0) { - EAL_LOG(ERR, "Error with stat on %s, %s", - dirpath, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Error with stat on %s, %s", dirpath, errmsg); return -1; } if (st.st_mode & S_IWOTH) { @@ -479,6 +484,7 @@ verify_perms(const char *dirpath) static void * eal_dlopen(const char *pathname) { + char errmsg[RTE_STRERR_BUFSIZE]; void *retval = NULL; char *realp = realpath(pathname, NULL); @@ -490,8 +496,9 @@ eal_dlopen(const char *pathname) return retval; } if (realp == NULL) { - EAL_LOG(ERR, "Error with realpath for %s, %s", - pathname, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Error with realpath for %s, %s", pathname, errmsg); 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 d24093937c..0e857102c6 100644 --- a/lib/eal/common/eal_common_proc.c +++ b/lib/eal/common/eal_common_proc.c @@ -268,6 +268,7 @@ read_msg(int fd, struct mp_msg_internal *m, struct sockaddr_un *s) char control[CMSG_SPACE(sizeof(m->msg.fds))]; struct cmsghdr *cmsg; int buflen = sizeof(*m) - sizeof(m->msg.fds); + char errmsg[RTE_STRERR_BUFSIZE]; memset(&msgh, 0, sizeof(msgh)); iov.iov_base = m; @@ -291,7 +292,9 @@ read_msg(int fd, struct mp_msg_internal *m, struct sockaddr_un *s) if (errno == EINTR) goto retry; - EAL_LOG(ERR, "recvmsg failed, %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "recvmsg failed, %s", errmsg); return -1; } @@ -561,6 +564,7 @@ async_reply_handle(void *arg) static int open_socket_fd(void) { + char errmsg[RTE_STRERR_BUFSIZE]; struct sockaddr_un un; peer_name[0] = '\0'; @@ -582,8 +586,9 @@ open_socket_fd(void) unlink(un.sun_path); /* May still exist since last run */ if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) { - EAL_LOG(ERR, "failed to bind %s: %s", - un.sun_path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "failed to bind %s: %s", un.sun_path, errmsg); close(mp_fd); return -1; } @@ -605,6 +610,7 @@ close_socket_fd(int fd) int rte_mp_channel_init(void) { + char errmsg[RTE_STRERR_BUFSIZE]; char path[PATH_MAX]; int dir_fd; const struct internal_config *internal_conf = @@ -630,14 +636,16 @@ rte_mp_channel_init(void) /* lock the directory */ dir_fd = open(mp_dir_path, O_RDONLY); if (dir_fd < 0) { - EAL_LOG(ERR, "failed to open %s: %s", - mp_dir_path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "failed to open %s: %s", mp_dir_path, errmsg); return -1; } if (flock(dir_fd, LOCK_EX)) { - EAL_LOG(ERR, "failed to lock %s: %s", - mp_dir_path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "failed to lock %s: %s", mp_dir_path, errmsg); close(dir_fd); return -1; } @@ -649,8 +657,9 @@ rte_mp_channel_init(void) if (rte_thread_create_internal_control(&mp_handle_tid, "mp-msg", mp_handle, NULL) < 0) { - EAL_LOG(ERR, "failed to create mp thread: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "failed to create mp thread: %s", errmsg); close(dir_fd); close(rte_atomic_exchange_explicit(&mp_fd, -1, rte_memory_order_relaxed)); return -1; @@ -691,6 +700,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type) struct cmsghdr *cmsg; struct sockaddr_un dst; struct mp_msg_internal m; + char errmsg[RTE_STRERR_BUFSIZE]; int fd_size = msg->num_fds * sizeof(int); char control[CMSG_SPACE(fd_size)]; @@ -732,8 +742,10 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type) unlink(dst_path); return 0; } + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "failed to send to (%s) due to %s", - dst_path, strerror(errno)); + dst_path, errmsg); return -1; } diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c index 7282715b11..868b28490c 100644 --- a/lib/eal/common/eal_common_trace_utils.c +++ b/lib/eal/common/eal_common_trace_utils.c @@ -241,11 +241,14 @@ eal_trace_mode_args_save(const char *val) int eal_trace_dir_args_save(char const *val) { + char errmsg[RTE_STRERR_BUFSIZE]; char *dir_path; int rc; if (asprintf(&dir_path, "%s/", val) == -1) { - trace_err("failed to copy directory: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + trace_err("failed to copy directory: %s", errmsg); return -ENOMEM; } @@ -304,6 +307,7 @@ static int trace_mkdir(void) { struct trace *trace = trace_obj_get(); + char errmsg[RTE_STRERR_BUFSIZE]; static bool already_done; char *session; int rc; @@ -329,7 +333,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + trace_err("mkdir %s failed [%s]", trace->dir, errmsg); rte_errno = errno; return -rte_errno; } @@ -344,7 +350,9 @@ trace_mkdir(void) rc = mkdir(trace->dir, 0700); if (rc < 0) { - trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + trace_err("mkdir %s failed [%s]", trace->dir, errmsg); rte_errno = errno; return -rte_errno; } diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 1229230063..0fc318acdb 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -177,6 +177,7 @@ rte_eal_config_create(void) static int rte_eal_config_attach(void) { + char errmsg[RTE_STRERR_BUFSIZE]; void *rte_mem_cfg_addr; const char *pathname = eal_runtime_config_path(); struct rte_config *config = rte_eal_get_configuration(); @@ -202,8 +203,10 @@ rte_eal_config_attach(void) if (rte_mem_cfg_addr == MAP_FAILED) { close(mem_cfg_fd); mem_cfg_fd = -1; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -217,6 +220,7 @@ static int rte_eal_config_reattach(void) { struct rte_mem_config *mem_config; + char errmsg[RTE_STRERR_BUFSIZE]; void *rte_mem_cfg_addr; struct rte_config *config = rte_eal_get_configuration(); const struct internal_config *internal_conf = @@ -249,8 +253,10 @@ rte_eal_config_reattach(void) munmap(mem_config, sizeof(struct rte_mem_config)); return -1; } + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c index 23747babc2..73fb732c01 100644 --- a/lib/eal/freebsd/eal_interrupts.c +++ b/lib/eal/freebsd/eal_interrupts.c @@ -85,6 +85,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, rte_intr_callback_fn cb, void *cb_arg) { struct rte_intr_callback *callback; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_intr_source *src; int ret = 0, add_event = 0; @@ -183,10 +184,13 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, if (errno == ENODEV) EAL_LOG(DEBUG, "Interrupt handle %d not supported", rte_intr_fd_get(src->intr_handle)); - else + else { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Error adding fd %d kevent, %s", rte_intr_fd_get(src->intr_handle), - strerror(errno)); + errmsg); + } ret = -errno; goto fail; } @@ -273,6 +277,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, { int ret; struct rte_intr_source *src; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_intr_callback *cb, *next; /* do parameter checking first */ @@ -321,9 +326,10 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, * remove intr file descriptor from wait list. */ if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Error removing fd %d kevent, %s", - rte_intr_fd_get(src->intr_handle), - strerror(errno)); + rte_intr_fd_get(src->intr_handle), errmsg); /* removing non-existent even is an expected condition * in some circumstances (e.g. oneshot events). */ @@ -462,6 +468,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds) struct rte_intr_callback active_cb; union rte_intr_read_buffer buf; struct rte_intr_callback *cb, *next; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_intr_source *src; bool call = false; int n, bytes_read; @@ -513,10 +520,10 @@ eal_intr_process_interrupts(struct kevent *events, int nfds) if (errno == EINTR || errno == EWOULDBLOCK) continue; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Error reading from file " - "descriptor %d: %s", - event_fd, - strerror(errno)); + "descriptor %d: %s", event_fd, errmsg); } else if (bytes_read == 0) EAL_LOG(ERR, "Read nothing from file " "descriptor %d", event_fd); @@ -565,9 +572,12 @@ eal_intr_process_interrupts(struct kevent *events, int nfds) * remove intr file descriptor from wait list. */ if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), + "Unknown error %d", errno); EAL_LOG(ERR, "Error removing fd %d kevent, %s", rte_intr_fd_get(src->intr_handle), - strerror(errno)); + errmsg); /* 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 a6f3ba226e..840995799b 100644 --- a/lib/eal/freebsd/eal_memory.c +++ b/lib/eal/freebsd/eal_memory.c @@ -53,6 +53,7 @@ rte_mem_virt2iova(const void *virtaddr) int rte_eal_hugepage_init(void) { + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_mem_config *mcfg; uint64_t total_mem = 0; void *addr; @@ -84,8 +85,9 @@ rte_eal_hugepage_init(void) addr = mmap(NULL, mem_sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (addr == MAP_FAILED) { - EAL_LOG(ERR, "%s: mmap() failed: %s", __func__, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "%s: mmap() failed: %s", __func__, errmsg); return -1; } diff --git a/lib/eal/freebsd/eal_timer.c b/lib/eal/freebsd/eal_timer.c index 4eba66eadb..ec5f4bf98d 100644 --- a/lib/eal/freebsd/eal_timer.c +++ b/lib/eal/freebsd/eal_timer.c @@ -15,6 +15,7 @@ #include <rte_memory.h> #include <rte_eal.h> #include <rte_debug.h> +#include <rte_errno.h> #include "eal_private.h" #include "eal_internal_cfg.h" @@ -28,6 +29,7 @@ enum timer_source eal_timer_source = EAL_TIMER_TSC; uint64_t get_tsc_freq(uint64_t arch_hz) { + char errmsg[RTE_STRERR_BUFSIZE]; size_t sz; int tmp; uint64_t tsc_hz; @@ -35,21 +37,27 @@ get_tsc_freq(uint64_t arch_hz) sz = sizeof(tmp); tmp = 0; - if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0)) - EAL_LOG(WARNING, "%s", strerror(errno)); - else if (tmp != 1) + if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(WARNING, "%s", errmsg); + } else if (tmp != 1) EAL_LOG(WARNING, "TSC is not safe to use in SMP mode"); tmp = 0; - if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0)) - EAL_LOG(WARNING, "%s", strerror(errno)); - else if (tmp != 1) + if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(WARNING, "%s", errmsg); + } else if (tmp != 1) EAL_LOG(WARNING, "TSC is not invariant"); sz = sizeof(tsc_hz); if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) { - EAL_LOG(WARNING, "%s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(WARNING, "%s", errmsg); return arch_hz; } diff --git a/lib/eal/include/rte_errno.h b/lib/eal/include/rte_errno.h index c49818a40e..10a04edbda 100644 --- a/lib/eal/include/rte_errno.h +++ b/lib/eal/include/rte_errno.h @@ -19,6 +19,9 @@ extern "C" { RTE_DECLARE_PER_LCORE(int, _rte_errno); /**< Per core error number. */ +/* For the buffer size of strerror_r */ +#define RTE_STRERR_BUFSIZE 256 + /** * Error number value, stored per-thread, which can be queried after * calls to certain functions to determine why those functions failed. diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 54577b7718..1da56b9595 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -90,6 +90,7 @@ eal_clean_runtime_dir(void) "fbarray_*", "mp_socket_*" }; + char errmsg[RTE_STRERR_BUFSIZE]; /* open directory */ dir = opendir(runtime_dir); @@ -159,8 +160,9 @@ eal_clean_runtime_dir(void) if (dir) closedir(dir); - EAL_LOG(ERR, "Error while clearing runtime dir: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Error while clearing runtime dir: %s", errmsg); return -1; } @@ -266,6 +268,7 @@ rte_eal_config_attach(void) struct rte_mem_config *mem_config; const struct internal_config *internal_conf = eal_get_internal_configuration(); + char errmsg[RTE_STRERR_BUFSIZE]; const char *pathname = eal_runtime_config_path(); @@ -287,8 +290,10 @@ rte_eal_config_attach(void) if (mem_config == MAP_FAILED) { close(mem_cfg_fd); mem_cfg_fd = -1; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -306,6 +311,7 @@ rte_eal_config_reattach(void) void *rte_mem_cfg_addr; const struct internal_config *internal_conf = eal_get_internal_configuration(); + char errmsg[RTE_STRERR_BUFSIZE]; if (internal_conf->no_shconf) return 0; @@ -334,8 +340,10 @@ rte_eal_config_reattach(void) munmap(mem_config, sizeof(struct rte_mem_config)); return -1; } + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -1402,6 +1410,7 @@ rte_eal_vfio_get_vf_token(rte_uuid_t vf_token) int rte_eal_check_module(const char *module_name) { + char errmsg[RTE_STRERR_BUFSIZE]; char sysfs_mod_name[PATH_MAX]; struct stat st; int n; @@ -1411,8 +1420,10 @@ rte_eal_check_module(const char *module_name) /* Check if there is sysfs mounted */ if (stat("/sys/module", &st) != 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "sysfs is not mounted! error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -1424,8 +1435,10 @@ rte_eal_check_module(const char *module_name) } if (stat(sysfs_mod_name, &st) != 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "Module %s not found! error %i (%s)", - sysfs_mod_name, errno, strerror(errno)); + sysfs_mod_name, errno, errmsg); return 0; } diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index e63f24d108..77688b2b19 100644 --- a/lib/eal/linux/eal_dev.c +++ b/lib/eal/linux/eal_dev.c @@ -62,6 +62,7 @@ sigbus_action_recover(void) static void sigbus_handler(int signum, siginfo_t *info, void *ctx __rte_unused) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; EAL_LOG(DEBUG, "Thread catch SIGBUS, fault address:%p", @@ -71,9 +72,11 @@ static void sigbus_handler(int signum, siginfo_t *info, ret = rte_bus_sigbus_handler(info->si_addr); rte_spinlock_unlock(&failure_handle_lock); if (ret == -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); rte_exit(EXIT_FAILURE, "Failed to handle SIGBUS for hot-unplug, " - "(rte_errno: %s)!", strerror(rte_errno)); + "(rte_errno: %s)!", errmsg); } 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 d47a19c56a..cb2a24e46d 100644 --- a/lib/eal/linux/eal_hugepage_info.c +++ b/lib/eal/linux/eal_hugepage_info.c @@ -23,6 +23,7 @@ #include <rte_log.h> #include <rte_common.h> #include "rte_string_fns.h" +#include <rte_errno.h> #include "eal_private.h" #include "eal_internal_cfg.h" @@ -322,6 +323,7 @@ walk_hugedir(const char *hugedir, walk_hugedir_t *cb, void *user_data) struct dirent *dirent; int dir_fd, fd, lck_result; const char filter[] = "*map_*"; /* matches hugepage files */ + char errmsg[RTE_STRERR_BUFSIZE]; dir = opendir(hugedir); if (!dir) { @@ -376,9 +378,9 @@ walk_hugedir(const char *hugedir, walk_hugedir_t *cb, void *user_data) error: if (dir) closedir(dir); - - EAL_LOG(ERR, "Error while walking hugepage dir: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Error while walking hugepage dir: %s", errmsg); return -1; } @@ -400,12 +402,15 @@ static void inspect_hugedir_cb(const struct walk_hugedir_data *whd) { uint64_t *total_size = whd->user_data; + char errmsg[RTE_STRERR_BUFSIZE]; struct stat st; - if (fstat(whd->file_fd, &st) < 0) + if (fstat(whd->file_fd, &st) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): stat(\"%s\") failed: %s", - __func__, whd->file_name, strerror(errno)); - else + __func__, whd->file_name, errmsg); + } else (*total_size) += st.st_size; } diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c index 6436f796eb..fc0476d948 100644 --- a/lib/eal/linux/eal_interrupts.c +++ b/lib/eal/linux/eal_interrupts.c @@ -455,12 +455,15 @@ uio_intx_intr_enable(const struct rte_intr_handle *intr_handle) static int uio_intr_disable(const struct rte_intr_handle *intr_handle) { + char errmsg[RTE_STRERR_BUFSIZE]; const int value = 0; if (rte_intr_fd_get(intr_handle) < 0 || write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Error disabling interrupts for fd %d (%s)", - rte_intr_fd_get(intr_handle), strerror(errno)); + rte_intr_fd_get(intr_handle), errmsg); return -1; } return 0; @@ -469,12 +472,15 @@ uio_intr_disable(const struct rte_intr_handle *intr_handle) static int uio_intr_enable(const struct rte_intr_handle *intr_handle) { + char errmsg[RTE_STRERR_BUFSIZE]; const int value = 1; if (rte_intr_fd_get(intr_handle) < 0 || write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Error enabling interrupts for fd %d (%s)", - rte_intr_fd_get(intr_handle), strerror(errno)); + rte_intr_fd_get(intr_handle), errmsg); return -1; } return 0; @@ -903,6 +909,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) struct rte_intr_callback *cb, *next; union rte_intr_read_buffer buf; struct rte_intr_callback active_cb; + char errmsg[RTE_STRERR_BUFSIZE]; for (n = 0; n < nfds; n++) { @@ -972,10 +979,11 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) if (errno == EINTR || errno == EWOULDBLOCK) continue; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Error reading from file " "descriptor %d: %s", - events[n].data.fd, - strerror(errno)); + events[n].data.fd, errmsg); /* * The device is unplugged or buggy, remove * it as an interrupt source and return to @@ -1114,6 +1122,7 @@ eal_intr_thread_main(__rte_unused void *arg) static struct epoll_event pipe_event = { .events = EPOLLIN | EPOLLPRI, }; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_intr_source *src; unsigned numfds = 0; @@ -1129,8 +1138,10 @@ eal_intr_thread_main(__rte_unused void *arg) */ if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd, &pipe_event) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); rte_panic("Error adding fd to %d epoll_ctl, %s\n", - intr_pipe.readfd, strerror(errno)); + intr_pipe.readfd, errmsg); } numfds++; @@ -1151,9 +1162,10 @@ eal_intr_thread_main(__rte_unused void *arg) */ if (epoll_ctl(pfd, EPOLL_CTL_ADD, rte_intr_fd_get(src->intr_handle), &ev) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); rte_panic("Error adding fd %d epoll_ctl, %s\n", - rte_intr_fd_get(src->intr_handle), - strerror(errno)); + rte_intr_fd_get(src->intr_handle), errmsg); } else numfds++; @@ -1202,6 +1214,7 @@ rte_eal_intr_init(void) static void eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle) { + char errmsg[RTE_STRERR_BUFSIZE]; union rte_intr_read_buffer buf; int bytes_read = 0; int nbytes; @@ -1242,9 +1255,10 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle) if (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN) continue; - EAL_LOG(ERR, - "Error reading from fd %d: %s", - fd, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Error reading from fd %d: %s", + fd, errmsg); } else if (nbytes == 0) EAL_LOG(ERR, "Read nothing from fd %d", fd); return; @@ -1317,6 +1331,7 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events, int maxevents, int timeout, bool interruptible) { struct epoll_event evs[maxevents]; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (!events) { @@ -1341,9 +1356,10 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events, else continue; } + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); /* epoll_wait fail */ - EAL_LOG(ERR, "epoll_wait returns with fail %s", - strerror(errno)); + EAL_LOG(ERR, "epoll_wait returns with fail %s", errmsg); rc = -1; break; } else { @@ -1390,6 +1406,7 @@ int rte_epoll_ctl(int epfd, int op, int fd, struct rte_epoll_event *event) { + char errmsg[RTE_STRERR_BUFSIZE]; struct epoll_event ev; if (!event) { @@ -1411,8 +1428,9 @@ rte_epoll_ctl(int epfd, int op, int fd, ev.events = event->epdata.event; if (epoll_ctl(epfd, op, fd, &ev) < 0) { - EAL_LOG(ERR, "Error op %d fd %d epoll_ctl, %s", - op, fd, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Error op %d fd %d epoll_ctl, %s", op, fd, errmsg); if (op == EPOLL_CTL_ADD) /* rollback status when CTL_ADD fail */ rte_atomic_store_explicit(&event->status, RTE_EPOLL_INVALID, @@ -1513,6 +1531,7 @@ rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle) int rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd) { + char errmsg[RTE_STRERR_BUFSIZE]; uint32_t i; int fd; uint32_t n = RTE_MIN(nb_efd, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID); @@ -1523,9 +1542,11 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd) for (i = 0; i < n; i++) { fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "can't setup eventfd, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -errno; } diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c index e354efc95d..1bad18b4c0 100644 --- a/lib/eal/linux/eal_memalloc.c +++ b/lib/eal/linux/eal_memalloc.c @@ -31,6 +31,7 @@ #include <rte_log.h> #include <rte_eal.h> #include <rte_memory.h> +#include <rte_errno.h> #include "eal_filesystem.h" #include "eal_internal_cfg.h" @@ -156,12 +157,16 @@ check_numa(void) static void prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id) { + char errmsg[RTE_STRERR_BUFSIZE]; + EAL_LOG(DEBUG, "Trying to obtain current memory policy."); if (get_mempolicy(oldpolicy, oldmask->maskp, oldmask->size + 1, 0, 0) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Failed to get current mempolicy: %s. " - "Assuming MPOL_DEFAULT.", strerror(errno)); + "Assuming MPOL_DEFAULT.", errmsg); *oldpolicy = MPOL_DEFAULT; } EAL_LOG(DEBUG, @@ -173,14 +178,17 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id) static void restore_numa(int *oldpolicy, struct bitmask *oldmask) { + char errmsg[RTE_STRERR_BUFSIZE]; + EAL_LOG(DEBUG, "Restoring previous memory policy: %d", *oldpolicy); if (*oldpolicy == MPOL_DEFAULT) { numa_set_localalloc(); } else if (set_mempolicy(*oldpolicy, oldmask->maskp, oldmask->size + 1) < 0) { - EAL_LOG(ERR, "Failed to restore mempolicy: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Failed to restore mempolicy: %s", errmsg); numa_set_localalloc(); } numa_free_cpumask(oldmask); @@ -212,6 +220,7 @@ pagesz_flags(uint64_t page_sz) /* returns 1 on successful lock, 0 on unsuccessful lock, -1 on error */ static int lock(int fd, int type) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; /* flock may be interrupted */ @@ -223,8 +232,10 @@ static int lock(int fd, int type) /* couldn't lock */ return 0; } else if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): error calling flock(): %s", - __func__, strerror(errno)); + __func__, errmsg); return -1; } /* lock was successful */ @@ -237,6 +248,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused, unsigned int seg_idx __rte_unused) { #ifdef MEMFD_SUPPORTED + char errmsg[RTE_STRERR_BUFSIZE]; int fd; char segname[250]; /* as per manpage, limit is 249 bytes plus null */ @@ -251,8 +263,10 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused, snprintf(segname, sizeof(segname), "seg_%i", list_idx); fd = memfd_create(segname, flags); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): memfd create failed: %s", - __func__, strerror(errno)); + __func__, errmsg); return -1; } fd_list[list_idx].memseg_list_fd = fd; @@ -265,8 +279,10 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused, list_idx, seg_idx); fd = memfd_create(segname, flags); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): memfd create failed: %s", - __func__, strerror(errno)); + __func__, errmsg); return -1; } fd_list[list_idx].fds[seg_idx] = fd; @@ -282,6 +298,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi, unsigned int list_idx, unsigned int seg_idx, bool *dirty) { + char errmsg[RTE_STRERR_BUFSIZE]; int fd; int *out_fd; struct stat st; @@ -316,8 +333,10 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi, */ ret = stat(path, &st); if (ret < 0 && errno != ENOENT) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): stat() for '%s' failed: %s", - __func__, path, strerror(errno)); + __func__, path, errmsg); return -1; } if (!internal_conf->hugepage_file.unlink_existing && ret == 0 && @@ -342,8 +361,10 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi, ret == 0) { /* coverity[toctou] */ if (unlink(path) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): could not remove '%s': %s", - __func__, path, strerror(errno)); + __func__, path, errmsg); return -1; } } @@ -351,14 +372,18 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi, /* coverity[toctou] */ fd = open(path, O_CREAT | O_RDWR, 0600); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): open '%s' failed: %s", - __func__, path, strerror(errno)); + __func__, path, errmsg); return -1; } /* take out a read lock */ if (lock(fd, LOCK_SH) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): lock '%s' failed: %s", - __func__, path, strerror(errno)); + __func__, path, errmsg); close(fd); return -1; } @@ -372,15 +397,16 @@ resize_hugefile_in_memory(int fd, uint64_t fa_offset, { int flags = grow ? 0 : FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; /* grow or shrink the file */ ret = fallocate(fd, flags, fa_offset, page_sz); if (ret < 0) { - EAL_LOG(DEBUG, "%s(): fallocate() failed: %s", - __func__, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "%s(): fallocate() failed: %s", __func__, errmsg); return -1; } return 0; @@ -392,6 +418,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz, { const struct internal_config *internal_conf = eal_get_internal_configuration(); + char errmsg[RTE_STRERR_BUFSIZE]; bool again = false; do { @@ -414,8 +441,10 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz, *dirty = new_size <= cur_size; if (new_size > cur_size && ftruncate(fd, new_size) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): ftruncate() failed: %s", - __func__, strerror(errno)); + __func__, errmsg); return -1; } } else { @@ -449,9 +478,11 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz, again = true; fallocate_supported = 0; } else { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), + "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): fallocate() failed: %s", - __func__, - strerror(errno)); + __func__, errmsg); return -1; } } else { @@ -476,15 +507,20 @@ close_hugefile(int fd, char *path, int list_idx) { const struct internal_config *internal_conf = eal_get_internal_configuration(); + char errmsg[RTE_STRERR_BUFSIZE]; + /* * primary process must unlink the file, but only when not in in-memory * mode (as in that case there is no file to unlink). */ if (!internal_conf->in_memory && rte_eal_process_type() == RTE_PROC_PRIMARY && - unlink(path)) + unlink(path)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): unlinking '%s' failed: %s", - __func__, path, strerror(errno)); + __func__, path, errmsg); + } close(fd); fd_list[list_idx].memseg_list_fd = -1; @@ -519,6 +555,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES int cur_socket_id = 0; #endif + char errmsg[RTE_STRERR_BUFSIZE]; uint64_t map_offset; rte_iova_t iova; void *va; @@ -584,15 +621,19 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, } else { map_offset = 0; if (ftruncate(fd, alloc_sz) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): ftruncate() failed: %s", - __func__, strerror(errno)); + __func__, errmsg); goto resized; } if (internal_conf->hugepage_file.unlink_before_mapping && !internal_conf->in_memory) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); if (unlink(path)) { EAL_LOG(DEBUG, "%s(): unlink() failed: %s", - __func__, strerror(errno)); + __func__, errmsg); goto resized; } } @@ -610,8 +651,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, map_offset); if (va == MAP_FAILED) { - EAL_LOG(DEBUG, "%s(): mmap() failed: %s", __func__, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "%s(): mmap() failed: %s", __func__, errmsg); /* mmap failed, but the previous region might have been * unmapped anyway. try to remap it */ @@ -661,8 +703,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, ret = get_mempolicy(&cur_socket_id, NULL, 0, addr, MPOL_F_NODE | MPOL_F_ADDR); if (ret < 0) { - EAL_LOG(DEBUG, "%s(): get_mempolicy: %s", - __func__, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "%s(): get_mempolicy: %s", __func__, errmsg); goto mapped; } else if (cur_socket_id != socket_id) { EAL_LOG(DEBUG, @@ -821,6 +864,7 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg) unsigned int msl_idx, need, i; const struct internal_config *internal_conf = eal_get_internal_configuration(); + char errmsg[RTE_STRERR_BUFSIZE]; if (msl->page_sz != wa->page_sz) return 0; @@ -873,14 +917,18 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg) if (wa->hi->lock_descriptor == -1 && !internal_conf->in_memory) { dir_fd = open(wa->hi->hugedir, O_RDONLY); if (dir_fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): Cannot open '%s': %s", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, errmsg); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): Cannot lock '%s': %s", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, errmsg); close(dir_fd); return -1; } @@ -951,6 +999,7 @@ free_seg_walk(const struct rte_memseg_list *msl, void *arg) struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; struct rte_memseg_list *found_msl; struct free_walk_param *wa = arg; + char errmsg[RTE_STRERR_BUFSIZE]; uintptr_t start_addr, end_addr; int msl_idx, seg_idx, ret, dir_fd = -1; const struct internal_config *internal_conf = @@ -980,14 +1029,18 @@ free_seg_walk(const struct rte_memseg_list *msl, void *arg) if (wa->hi->lock_descriptor == -1 && !internal_conf->in_memory) { dir_fd = open(wa->hi->hugedir, O_RDONLY); if (dir_fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): Cannot open '%s': %s", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, errmsg); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): Cannot lock '%s': %s", - __func__, wa->hi->hugedir, strerror(errno)); + __func__, wa->hi->hugedir, errmsg); close(dir_fd); return -1; } @@ -1335,6 +1388,7 @@ sync_existing(struct rte_memseg_list *primary_msl, struct rte_memseg_list *local_msl, struct hugepage_info *hi, unsigned int msl_idx) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret, dir_fd; /* do not allow any page allocations during the time we're allocating, @@ -1344,14 +1398,18 @@ sync_existing(struct rte_memseg_list *primary_msl, */ dir_fd = open(hi->hugedir, O_RDONLY); if (dir_fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): Cannot open '%s': %s", __func__, - hi->hugedir, strerror(errno)); + hi->hugedir, errmsg); return -1; } /* blocking writelock */ if (flock(dir_fd, LOCK_EX)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s(): Cannot lock '%s': %s", __func__, - hi->hugedir, strerror(errno)); + hi->hugedir, errmsg); close(dir_fd); return -1; } diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c index 45879ca743..59be005b4b 100644 --- a/lib/eal/linux/eal_memory.c +++ b/lib/eal/linux/eal_memory.c @@ -90,6 +90,7 @@ uint64_t eal_get_baseaddr(void) phys_addr_t rte_mem_virt2phy(const void *virtaddr) { + char errmsg[RTE_STRERR_BUFSIZE]; int fd, retval; uint64_t page, physaddr; unsigned long virt_pfn; @@ -104,16 +105,20 @@ rte_mem_virt2phy(const void *virtaddr) fd = open("/proc/self/pagemap", O_RDONLY); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(INFO, "%s(): cannot open /proc/self/pagemap: %s", - __func__, strerror(errno)); + __func__, errmsg); return RTE_BAD_IOVA; } virt_pfn = (unsigned long)virtaddr / page_size; offset = sizeof(uint64_t) * virt_pfn; if (lseek(fd, offset, SEEK_SET) == (off_t) -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(INFO, "%s(): seek error in /proc/self/pagemap: %s", - __func__, strerror(errno)); + __func__, errmsg); close(fd); return RTE_BAD_IOVA; } @@ -121,8 +126,10 @@ rte_mem_virt2phy(const void *virtaddr) retval = read(fd, &page, PFN_MASK_SIZE); close(fd); if (retval < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(INFO, "%s(): cannot read /proc/self/pagemap: %s", - __func__, strerror(errno)); + __func__, errmsg); return RTE_BAD_IOVA; } else if (retval != PFN_MASK_SIZE) { EAL_LOG(INFO, "%s(): read %d bytes from /proc/self/pagemap " @@ -237,7 +244,11 @@ static int huge_wrap_sigsetjmp(void) /* Callback for numa library. */ void numa_error(char *where) { - EAL_LOG(ERR, "%s failed: %s", where, strerror(errno)); + char errmsg[RTE_STRERR_BUFSIZE]; + + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "%s failed: %s", where, errmsg); } #endif @@ -262,6 +273,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, struct bitmask *oldmask = NULL; bool have_numa = true; unsigned long maxnode = 0; + char errmsg[RTE_STRERR_BUFSIZE]; const struct internal_config *internal_conf = eal_get_internal_configuration(); @@ -276,9 +288,11 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, oldmask = numa_allocate_nodemask(); if (get_mempolicy(&oldpolicy, oldmask->maskp, oldmask->size + 1, 0, 0) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Failed to get current mempolicy: %s. " - "Assuming MPOL_DEFAULT.", strerror(errno)); + "Assuming MPOL_DEFAULT.", errmsg); oldpolicy = MPOL_DEFAULT; } for (i = 0; i < RTE_MAX_NUMA_NODES; i++) @@ -332,8 +346,9 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, /* try to create hugepage file */ fd = open(hf->filepath, O_CREAT | O_RDWR, 0600); if (fd < 0) { - EAL_LOG(DEBUG, "%s(): open failed: %s", __func__, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "%s(): open failed: %s", __func__, errmsg); goto out; } @@ -345,8 +360,9 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, virtaddr = mmap(NULL, hugepage_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd, 0); if (virtaddr == MAP_FAILED) { - EAL_LOG(DEBUG, "%s(): mmap failed: %s", __func__, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "%s(): mmap failed: %s", __func__, errmsg); close(fd); goto out; } @@ -378,8 +394,10 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, /* set shared lock on the file. */ if (flock(fd, LOCK_SH) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): Locking file failed:%s ", - __func__, strerror(errno)); + __func__, errmsg); close(fd); goto out; } @@ -396,8 +414,9 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, numa_set_localalloc(); } else if (set_mempolicy(oldpolicy, oldmask->maskp, oldmask->size + 1) < 0) { - EAL_LOG(ERR, "Failed to restore mempolicy: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Failed to restore mempolicy: %s", errmsg); numa_set_localalloc(); } } @@ -576,6 +595,7 @@ unlink_hugepage_files(struct hugepage_file *hugepg_tbl, { unsigned socket, size; int page, nrpages = 0; + char errmsg[RTE_STRERR_BUFSIZE]; const struct internal_config *internal_conf = eal_get_internal_configuration(); @@ -589,8 +609,10 @@ unlink_hugepage_files(struct hugepage_file *hugepg_tbl, struct hugepage_file *hp = &hugepg_tbl[page]; if (hp->orig_va != NULL && unlink(hp->filepath)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(WARNING, "%s(): Removing %s failed: %s", - __func__, hp->filepath, strerror(errno)); + __func__, hp->filepath, errmsg); } } return 0; @@ -607,6 +629,7 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl, { unsigned socket, size; int page, nrpages = 0; + char errmsg[RTE_STRERR_BUFSIZE]; const struct internal_config *internal_conf = eal_get_internal_configuration(); @@ -639,8 +662,12 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl, hp->orig_va = NULL; if (unlink(hp->filepath) == -1) { + if (strerror_r(errno, errmsg, + sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), + "Unknown error %d", errno); EAL_LOG(ERR, "%s(): Removing %s failed: %s", - __func__, hp->filepath, strerror(errno)); + __func__, hp->filepath, errmsg); return -1; } } else { @@ -660,6 +687,7 @@ static int remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end) { struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_memseg_list *msl; struct rte_fbarray *arr; int cur_page, seg_len; @@ -735,14 +763,18 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end) fd = open(hfile->filepath, O_RDWR); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Could not open '%s': %s", - hfile->filepath, strerror(errno)); + hfile->filepath, errmsg); return -1; } /* set shared lock on the file. */ if (flock(fd, LOCK_SH) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "Could not lock '%s': %s", - hfile->filepath, strerror(errno)); + hfile->filepath, errmsg); close(fd); return -1; } @@ -755,8 +787,10 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end) addr = mmap(addr, page_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE | MAP_FIXED, fd, 0); if (addr == MAP_FAILED) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Couldn't remap '%s': %s", - hfile->filepath, strerror(errno)); + hfile->filepath, errmsg); close(fd); return -1; } @@ -1129,6 +1163,7 @@ eal_legacy_hugepage_init(void) eal_get_internal_configuration(); uint64_t memory[RTE_MAX_NUMA_NODES]; + char errmsg[RTE_STRERR_BUFSIZE]; unsigned hp_offset; int i, j; @@ -1177,14 +1212,16 @@ eal_legacy_hugepage_init(void) /* create a memfd and store it in the segment fd table */ memfd = memfd_create("nohuge", 0); if (memfd < 0) { - EAL_LOG(DEBUG, "Cannot create memfd: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "Cannot create memfd: %s", errmsg); EAL_LOG(DEBUG, "Falling back to anonymous map"); } else { /* we got an fd - now resize it */ if (ftruncate(memfd, internal_conf->memory) < 0) { - EAL_LOG(ERR, "Cannot resize memfd: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Cannot resize memfd: %s", errmsg); EAL_LOG(ERR, "Falling back to anonymous map"); close(memfd); } else { @@ -1211,8 +1248,9 @@ eal_legacy_hugepage_init(void) addr = mmap(prealloc_addr, mem_sz, PROT_READ | PROT_WRITE, flags | MAP_FIXED, fd, 0); if (addr == MAP_FAILED || addr != prealloc_addr) { - EAL_LOG(ERR, "%s: mmap() failed: %s", __func__, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "%s: mmap() failed: %s", __func__, errmsg); munmap(prealloc_addr, mem_sz); return -1; } @@ -1520,6 +1558,7 @@ eal_legacy_hugepage_attach(void) { struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; struct hugepage_file *hp = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; unsigned int num_hp = 0; unsigned int i = 0; unsigned int cur_seg; @@ -1570,23 +1609,29 @@ eal_legacy_hugepage_attach(void) fd = open(hf->filepath, O_RDWR); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Could not open %s: %s", - hf->filepath, strerror(errno)); + hf->filepath, errmsg); goto error; } map_addr = mmap(map_addr, map_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); if (map_addr == MAP_FAILED) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Could not map %s: %s", - hf->filepath, strerror(errno)); + hf->filepath, errmsg); goto fd_error; } /* set shared lock on the file. */ if (flock(fd, LOCK_SH) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "%s(): Locking file failed: %s", - __func__, strerror(errno)); + __func__, errmsg); goto mmap_error; } @@ -1918,6 +1963,7 @@ memseg_secondary_init(void) int rte_eal_memseg_init(void) { + char errmsg[RTE_STRERR_BUFSIZE]; /* increase rlimit to maximum */ struct rlimit lim; @@ -1930,8 +1976,10 @@ rte_eal_memseg_init(void) lim.rlim_cur = lim.rlim_max; if (setrlimit(RLIMIT_NOFILE, &lim) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "Setting maximum number of open files failed: %s", - strerror(errno)); + errmsg); } else { EAL_LOG(DEBUG, "Setting maximum number of open files to %" PRIu64, diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c index 489732c116..1ea4d82bb2 100644 --- a/lib/eal/linux/eal_timer.c +++ b/lib/eal/linux/eal_timer.c @@ -137,6 +137,7 @@ rte_eal_hpet_init(int make_default) int fd, ret; struct internal_config *internal_conf = eal_get_internal_configuration(); + char errmsg[RTE_STRERR_BUFSIZE]; if (internal_conf->no_hpet) { EAL_LOG(NOTICE, "HPET is disabled"); @@ -145,8 +146,9 @@ rte_eal_hpet_init(int make_default) fd = open(DEV_HPET, O_RDONLY); if (fd < 0) { - EAL_LOG(ERR, "ERROR: Cannot open "DEV_HPET": %s!", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "ERROR: Cannot open "DEV_HPET": %s!", errmsg); internal_conf->no_hpet = 1; return -1; } diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c index 7132e24cba..ed8eba76eb 100644 --- a/lib/eal/linux/eal_vfio.c +++ b/lib/eal/linux/eal_vfio.c @@ -351,6 +351,7 @@ vfio_open_group_fd(int iommu_group_num) { int vfio_group_fd; char filename[PATH_MAX]; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_mp_msg mp_req, *mp_rep; struct rte_mp_reply mp_reply = {0}; struct timespec ts = {.tv_sec = 5, .tv_nsec = 0}; @@ -367,8 +368,9 @@ vfio_open_group_fd(int iommu_group_num) if (vfio_group_fd < 0) { /* if file not found, it's not an error */ if (errno != ENOENT) { - EAL_LOG(ERR, "Cannot open %s: %s", - filename, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Cannot open %s: %s", filename, errmsg); return -1; } @@ -379,9 +381,12 @@ vfio_open_group_fd(int iommu_group_num) vfio_group_fd = open(filename, O_RDWR); if (vfio_group_fd < 0) { if (errno != ENOENT) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), + "Unknown error %d", errno); EAL_LOG(ERR, "Cannot open %s: %s", - filename, strerror(errno)); + filename, errmsg); return -1; } return -ENOENT; @@ -745,6 +750,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, }; struct vfio_config *vfio_cfg; struct user_mem_maps *user_mem_maps; + char errmsg[RTE_STRERR_BUFSIZE]; int vfio_container_fd; int vfio_group_fd; int iommu_group_num; @@ -790,8 +796,10 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, /* check if the group is viable */ ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s cannot get VFIO group status, " - "error %i (%s)", dev_addr, errno, strerror(errno)); + "error %i (%s)", dev_addr, errno, errmsg); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); return -1; @@ -817,9 +825,11 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, ret = ioctl(vfio_group_fd, VFIO_GROUP_SET_CONTAINER, &vfio_container_fd); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s cannot add VFIO group to container, error " - "%i (%s)", dev_addr, errno, strerror(errno)); + "%i (%s)", dev_addr, errno, errmsg); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); return -1; @@ -857,10 +867,12 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, else ret = 0; if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s DMA remapping failed, error " "%i (%s)", - dev_addr, errno, strerror(errno)); + dev_addr, errno, errmsg); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); rte_mcfg_mem_read_unlock(); @@ -976,9 +988,10 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, dev_get_info: ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "%s cannot get device info, " - "error %i (%s)", dev_addr, errno, - strerror(errno)); + "error %i (%s)", dev_addr, errno, errmsg); close(*vfio_dev_fd); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); @@ -1205,6 +1218,7 @@ vfio_get_iommu_type(void) const struct vfio_iommu_type * vfio_set_iommu_type(int vfio_container_fd) { + char errmsg[RTE_STRERR_BUFSIZE]; unsigned idx; for (idx = 0; idx < RTE_DIM(iommu_types); idx++) { const struct vfio_iommu_type *t = &iommu_types[idx]; @@ -1216,10 +1230,11 @@ vfio_set_iommu_type(int vfio_container_fd) t->type_id, t->name); return t; } + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); /* not an error, there may be more supported IOMMU types */ EAL_LOG(DEBUG, "Set IOMMU type %d (%s) failed, error " - "%i (%s)", t->type_id, t->name, errno, - strerror(errno)); + "%i (%s)", t->type_id, t->name, errno, errmsg); } /* if we didn't find a suitable IOMMU type, fail */ return NULL; @@ -1229,6 +1244,7 @@ int rte_vfio_get_device_info(const char *sysfs_base, const char *dev_addr, int *vfio_dev_fd, struct vfio_device_info *device_info) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (device_info == NULL || *vfio_dev_fd < 0) @@ -1241,9 +1257,11 @@ rte_vfio_get_device_info(const char *sysfs_base, const char *dev_addr, return -1; } else { ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); if (ret) { EAL_LOG(ERR, "%s cannot get device info, error %i (%s)", - dev_addr, errno, strerror(errno)); + dev_addr, errno, errmsg); return -1; } } @@ -1254,6 +1272,7 @@ rte_vfio_get_device_info(const char *sysfs_base, const char *dev_addr, int vfio_has_supported_extensions(int vfio_container_fd) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; unsigned idx, n_extensions = 0; for (idx = 0; idx < RTE_DIM(iommu_types); idx++) { @@ -1262,8 +1281,10 @@ vfio_has_supported_extensions(int vfio_container_fd) ret = ioctl(vfio_container_fd, VFIO_CHECK_EXTENSION, t->type_id); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Could not get IOMMU type, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); close(vfio_container_fd); return -1; } else if (ret == 1) { @@ -1288,6 +1309,7 @@ int rte_vfio_get_container_fd(void) { int ret, vfio_container_fd; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_mp_msg mp_req, *mp_rep; struct rte_mp_reply mp_reply = {0}; struct timespec ts = {.tv_sec = 5, .tv_nsec = 0}; @@ -1300,21 +1322,25 @@ rte_vfio_get_container_fd(void) if (internal_conf->process_type == RTE_PROC_PRIMARY) { vfio_container_fd = open(VFIO_CONTAINER_PATH, O_RDWR); if (vfio_container_fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot open VFIO container %s, error " "%i (%s)", VFIO_CONTAINER_PATH, - errno, strerror(errno)); + errno, errmsg); return -1; } /* check VFIO API version */ ret = ioctl(vfio_container_fd, VFIO_GET_API_VERSION); if (ret != VFIO_API_VERSION) { - if (ret < 0) + if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Could not get VFIO API version, error " - "%i (%s)", errno, strerror(errno)); - else + "%i (%s)", errno, errmsg); + } else EAL_LOG(ERR, "Unsupported VFIO API version!"); close(vfio_container_fd); return -1; @@ -1422,6 +1448,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, { struct vfio_iommu_type1_dma_map dma_map; struct vfio_iommu_type1_dma_unmap dma_unmap; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (do_map != 0) { @@ -1443,9 +1470,11 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, EAL_LOG(DEBUG, "Memory segment is already mapped, skipping"); } else { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot set up DMA remapping, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); return -1; } } @@ -1458,8 +1487,10 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, ret = ioctl(vfio_container_fd, VFIO_IOMMU_UNMAP_DMA, &dma_unmap); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot clear DMA remapping, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); return -1; } else if (dma_unmap.size != len) { EAL_LOG(ERR, "Unexpected size %"PRIu64 @@ -1493,6 +1524,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, .size = len, .flags = 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (do_map != 0) { @@ -1506,9 +1538,11 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_REGISTER_MEMORY, ®); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot register vaddr for IOMMU, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); return -1; } @@ -1522,8 +1556,10 @@ 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) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot map vaddr for IOMMU, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); return -1; } @@ -1538,17 +1574,21 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova, ret = ioctl(vfio_container_fd, VFIO_IOMMU_UNMAP_DMA, &dma_unmap); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot unmap vaddr for IOMMU, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); return -1; } ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY, ®); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot unregister vaddr for IOMMU, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); return -1; } } @@ -1724,6 +1764,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd) .argsz = sizeof(remove), }; struct vfio_iommu_spapr_tce_info info = { .argsz = sizeof(info), }; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; ret = spapr_dma_win_size(); @@ -1732,8 +1773,10 @@ vfio_spapr_create_dma_window(int vfio_container_fd) ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot get IOMMU info, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -1773,8 +1816,10 @@ vfio_spapr_create_dma_window(int vfio_container_fd) } #endif /* VFIO_IOMMU_SPAPR_INFO_DDW */ if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot create new DMA window, error " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); EAL_LOG(ERR, "Consider using a larger hugepage size if supported by the system"); return -1; @@ -2027,6 +2072,7 @@ container_dma_unmap(struct vfio_config *vfio_cfg, uint64_t vaddr, uint64_t iova, int rte_vfio_noiommu_is_enabled(void) { + char errmsg[RTE_STRERR_BUFSIZE]; int fd; ssize_t cnt; char c; @@ -2034,8 +2080,10 @@ rte_vfio_noiommu_is_enabled(void) fd = open(VFIO_NOIOMMU_MODE, O_RDONLY); if (fd < 0) { if (errno != ENOENT) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Cannot open VFIO noiommu file " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); return -1; } /* @@ -2048,8 +2096,10 @@ rte_vfio_noiommu_is_enabled(void) cnt = read(fd, &c, 1); close(fd); if (cnt != 1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(ERR, "Unable to read from VFIO noiommu file " - "%i (%s)", errno, strerror(errno)); + "%i (%s)", errno, errmsg); return -1; } diff --git a/lib/eal/unix/eal_filesystem.c b/lib/eal/unix/eal_filesystem.c index 6cd5f1492c..d87924fe79 100644 --- a/lib/eal/unix/eal_filesystem.c +++ b/lib/eal/unix/eal_filesystem.c @@ -13,12 +13,14 @@ #include <unistd.h> #include <rte_log.h> +#include <rte_errno.h> #include "eal_private.h" #include "eal_filesystem.h" int eal_create_runtime_dir(void) { + char errmsg[RTE_STRERR_BUFSIZE]; const char *directory; char run_dir[PATH_MAX]; char tmp[PATH_MAX]; @@ -58,15 +60,17 @@ int eal_create_runtime_dir(void) */ ret = mkdir(tmp, 0700); if (ret < 0 && errno != EEXIST) { - EAL_LOG(ERR, "Error creating '%s': %s", - tmp, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Error creating '%s': %s", tmp, errmsg); return -1; } ret = mkdir(run_dir, 0700); if (ret < 0 && errno != EEXIST) { - EAL_LOG(ERR, "Error creating '%s': %s", - run_dir, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(ERR, "Error creating '%s': %s", run_dir, errmsg); return -1; } diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c index 4fd066a290..6bcbfe3091 100644 --- a/lib/eal/unix/eal_unix_memory.c +++ b/lib/eal/unix/eal_unix_memory.c @@ -27,12 +27,15 @@ static void * mem_map(void *requested_addr, size_t size, int prot, int flags, int fd, uint64_t offset) { + char errmsg[RTE_STRERR_BUFSIZE]; + void *virt = mmap(requested_addr, size, prot, flags, fd, offset); if (virt == MAP_FAILED) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s", - requested_addr, size, prot, flags, fd, offset, - strerror(errno)); + requested_addr, size, prot, flags, fd, offset, errmsg); rte_errno = errno; return NULL; } @@ -42,10 +45,14 @@ mem_map(void *requested_addr, size_t size, int prot, int flags, static int mem_unmap(void *virt, size_t size) { + char errmsg[RTE_STRERR_BUFSIZE]; + int ret = munmap(virt, size); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "Cannot munmap(%p, 0x%zx): %s", - virt, size, strerror(errno)); + virt, size, errmsg); rte_errno = errno; } return ret; @@ -80,11 +87,15 @@ eal_mem_free(void *virt, size_t size) int eal_mem_set_dump(void *virt, size_t size, bool dump) { + char errmsg[RTE_STRERR_BUFSIZE]; + int flags = dump ? EAL_DODUMP : EAL_DONTDUMP; int ret = madvise(virt, size, flags); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); EAL_LOG(DEBUG, "madvise(%p, %#zx, %d) failed: %s", - virt, size, flags, strerror(errno)); + virt, size, flags, errmsg); rte_errno = errno; } return ret; diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c index 1b4c73f58e..c24fae8ea5 100644 --- a/lib/eal/unix/rte_thread.c +++ b/lib/eal/unix/rte_thread.c @@ -293,6 +293,7 @@ rte_thread_set_priority(rte_thread_t thread_id, int rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) { + char errmsg[RTE_STRERR_BUFSIZE]; int err; *key = malloc(sizeof(**key)); @@ -303,8 +304,9 @@ rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) } err = pthread_key_create(&((*key)->thread_index), destructor); if (err) { - EAL_LOG(DEBUG, "pthread_key_create failed: %s", - strerror(err)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "pthread_key_create failed: %s", errmsg); free(*key); rte_errno = ENOEXEC; return -1; @@ -315,6 +317,7 @@ rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) int rte_thread_key_delete(rte_thread_key key) { + char errmsg[RTE_STRERR_BUFSIZE]; int err; if (!key) { @@ -324,8 +327,9 @@ rte_thread_key_delete(rte_thread_key key) } err = pthread_key_delete(key->thread_index); if (err) { - EAL_LOG(DEBUG, "pthread_key_delete failed: %s", - strerror(err)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "pthread_key_delete failed: %s", errmsg); free(key); rte_errno = ENOEXEC; return -1; @@ -337,6 +341,7 @@ rte_thread_key_delete(rte_thread_key key) int rte_thread_value_set(rte_thread_key key, const void *value) { + char errmsg[RTE_STRERR_BUFSIZE]; int err; if (!key) { @@ -346,8 +351,9 @@ rte_thread_value_set(rte_thread_key key, const void *value) } err = pthread_setspecific(key->thread_index, value); if (err) { - EAL_LOG(DEBUG, "pthread_setspecific failed: %s", - strerror(err)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + EAL_LOG(DEBUG, "pthread_setspecific failed: %s", errmsg); rte_errno = ENOEXEC; return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 04/52] eventdev: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (2 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 03/52] eal: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 05/52] latency: " Dengdui Huang ` (48 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/eventdev/rte_event_eth_rx_adapter.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index 3ee20d95f3..01fa862334 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -1082,6 +1082,7 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data) union queue_data qd; struct eth_device_info *dev_info; struct eth_rx_queue_info *queue_info; + char errmsg[RTE_STRERR_BUFSIZE]; int *intr_enabled; qd.ptr = data; @@ -1104,9 +1105,12 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data) * vectors supported (an interrupt vector is shared in * case of shared interrupts) */ - if (err) + if (err) { + if (strerror_r(-err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -err); RTE_EDEV_LOG_ERR("Failed to enqueue interrupt" - " to ring: %s", strerror(-err)); + " to ring: %s", errmsg); + } else rte_eth_dev_rx_intr_disable(port_id, queue); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 05/52] latency: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (3 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 04/52] eventdev: " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 06/52] node: " Dengdui Huang ` (47 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/latencystats/rte_latencystats.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c index 6a261309f9..8957f6f6ac 100644 --- a/lib/latencystats/rte_latencystats.c +++ b/lib/latencystats/rte_latencystats.c @@ -220,6 +220,7 @@ rte_latencystats_init(uint64_t app_samp_intvl, struct rxtx_cbs *cbs = NULL; const char *ptr_strings[NUM_LATENCY_STATS] = {0}; const struct rte_memzone *mz = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; const unsigned int flags = 0; int ret; @@ -266,9 +267,11 @@ rte_latencystats_init(uint64_t app_samp_intvl, ret = rte_eth_dev_info_get(pid, &dev_info); if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); LATENCY_STATS_LOG(INFO, "Error during getting device (port %u) info: %s", - pid, strerror(-ret)); + pid, errmsg); continue; } @@ -303,6 +306,7 @@ rte_latencystats_uninit(void) int ret = 0; struct rxtx_cbs *cbs = NULL; const struct rte_memzone *mz = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; /** De register Rx/Tx callbacks */ RTE_ETH_FOREACH_DEV(pid) { @@ -310,9 +314,11 @@ rte_latencystats_uninit(void) ret = rte_eth_dev_info_get(pid, &dev_info); if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); LATENCY_STATS_LOG(INFO, "Error during getting device (port %u) info: %s", - pid, strerror(-ret)); + pid, errmsg); continue; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 06/52] node: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (4 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 05/52] latency: " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 07/52] pdump: " Dengdui Huang ` (46 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/node/kernel_tx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node/kernel_tx.c b/lib/node/kernel_tx.c index 3a96741622..3a76522799 100644 --- a/lib/node/kernel_tx.c +++ b/lib/node/kernel_tx.c @@ -20,6 +20,7 @@ static __rte_always_inline void kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t cnt) { kernel_tx_node_ctx_t *ctx = (kernel_tx_node_ctx_t *)node->ctx; + char errmsg[RTE_STRERR_BUFSIZE]; struct sockaddr_in sin = {0}; struct rte_ipv4_hdr *ip4; size_t len; @@ -35,8 +36,11 @@ kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t sin.sin_port = 0; 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", strerror(errno)); + if (sendto(ctx->sock, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + node_err("kernel_tx", "Unable to send packets: %s", errmsg); + } } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 07/52] pdump: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (5 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 06/52] node: " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 08/52] pdump: use rte strerror Dengdui Huang ` (45 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/pdump/rte_pdump.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index 679c3dd0b5..83cb8b75d8 100644 --- a/lib/pdump/rte_pdump.c +++ b/lib/pdump/rte_pdump.c @@ -284,6 +284,7 @@ static int set_pdump_rxtx_cbs(const struct pdump_request *p) { uint16_t nb_rx_q = 0, nb_tx_q = 0, end_q, queue; + char errmsg[RTE_STRERR_BUFSIZE]; uint16_t port; int ret = 0; struct rte_bpf *filter = NULL; @@ -335,9 +336,11 @@ set_pdump_rxtx_cbs(const struct pdump_request *p) ret = rte_eth_dev_info_get(port, &dev_info); if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); PDUMP_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-ret)); + port, errmsg); return ret; } @@ -731,15 +734,18 @@ int rte_pdump_stats(uint16_t port, struct rte_pdump_stats *stats) { struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; const struct rte_memzone *mz; int ret; memset(stats, 0, sizeof(*stats)); ret = rte_eth_dev_info_get(port, &dev_info); if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); PDUMP_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-ret)); + port, errmsg); return ret; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 08/52] pdump: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (6 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 07/52] pdump: " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 09/52] power: replace strerror with reentrant version Dengdui Huang ` (44 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/pdump/rte_pdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index 83cb8b75d8..49d8b712a8 100644 --- a/lib/pdump/rte_pdump.c +++ b/lib/pdump/rte_pdump.c @@ -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_LINE(ERR, "failed to send to client:%s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 09/52] power: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (7 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 08/52] pdump: use rte strerror Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 10/52] vhost: " Dengdui Huang ` (43 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/power/guest_channel.c | 15 ++++++++++++--- lib/power/power_kvm_vm.c | 6 +++++- lib/power/power_pstate_cpufreq.c | 14 +++++++++++--- lib/power/rte_power_pmd_mgmt.c | 6 ++++-- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c index bc3f55b6bf..33e6ea612e 100644 --- a/lib/power/guest_channel.c +++ b/lib/power/guest_channel.c @@ -14,6 +14,7 @@ #include <rte_log.h> #include <rte_power.h> +#include <rte_errno.h> #include "guest_channel.h" @@ -57,6 +58,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) { int flags, ret; struct rte_power_channel_packet pkt; + char errmsg[RTE_STRERR_BUFSIZE]; char fd_path[PATH_MAX]; int fd = -1; @@ -77,8 +79,10 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) fd_path, lcore_id); fd = open(fd_path, O_RDWR); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); GUEST_CHANNEL_LOG(ERR, "Unable to connect to '%s' with error " - "%s", fd_path, strerror(errno)); + "%s", fd_path, errmsg); return -1; } @@ -105,9 +109,11 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) global_fds[lcore_id] = fd; ret = guest_channel_send_msg(&pkt, lcore_id); if (ret != 0) { + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); GUEST_CHANNEL_LOG(ERR, "Error on channel '%s' communications test: %s", - fd_path, ret > 0 ? strerror(ret) : + fd_path, ret > 0 ? errmsg : "channel not connected"); goto error; } @@ -161,6 +167,7 @@ int power_guest_channel_read_msg(void *pkt, size_t pkt_len, unsigned int lcore_id) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; struct pollfd fds; @@ -186,8 +193,10 @@ int power_guest_channel_read_msg(void *pkt, GUEST_CHANNEL_LOG(DEBUG, "Timeout occurred during poll function."); return -1; } else if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); GUEST_CHANNEL_LOG(ERR, "Error occurred during poll function: %s", - strerror(errno)); + errmsg); return -1; } diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c index f15be8fac5..c1e6b3cec4 100644 --- a/lib/power/power_kvm_vm.c +++ b/lib/power/power_kvm_vm.c @@ -5,6 +5,7 @@ #include <string.h> #include <rte_log.h> +#include <rte_errno.h> #include "rte_power_guest_channel.h" #include "guest_channel.h" @@ -71,6 +72,7 @@ power_kvm_vm_set_freq(__rte_unused unsigned int lcore_id, static inline int send_msg(unsigned int lcore_id, uint32_t scale_direction) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (lcore_id >= RTE_MAX_LCORE) { @@ -82,8 +84,10 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction) ret = guest_channel_send_msg(&pkt[lcore_id], lcore_id); if (ret == 0) return 1; + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); POWER_LOG(DEBUG, "Error sending message: %s", - ret > 0 ? strerror(ret) : "channel not connected"); + ret > 0 ? errmsg : "channel not connected"); return -1; } diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c index 4755909466..5538f3209b 100644 --- a/lib/power/power_pstate_cpufreq.c +++ b/lib/power/power_pstate_cpufreq.c @@ -13,6 +13,7 @@ #include <rte_memcpy.h> #include <rte_stdatomic.h> +#include <rte_errno.h> #include "rte_power_pmd_mgmt.h" #include "power_pstate_cpufreq.h" @@ -75,6 +76,7 @@ static struct pstate_power_info lcore_power_info[RTE_MAX_LCORE]; static int32_t power_read_turbo_pct(uint64_t *outVal) { + char errmsg[RTE_STRERR_BUFSIZE]; int fd, ret; char val[4] = {0}; char *endptr; @@ -82,24 +84,30 @@ power_read_turbo_pct(uint64_t *outVal) fd = open(POWER_SYSFILE_TURBO_PCT, O_RDONLY); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); POWER_LOG(ERR, "Error opening '%s': %s", POWER_SYSFILE_TURBO_PCT, - strerror(errno)); + errmsg); return fd; } ret = read(fd, val, sizeof(val)); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); POWER_LOG(ERR, "Error reading '%s': %s", POWER_SYSFILE_TURBO_PCT, - strerror(errno)); + errmsg); goto out; } errno = 0; *outVal = (uint64_t) strtol(val, &endptr, 10); if (errno != 0 || (*endptr != 0 && *endptr != '\n')) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); POWER_LOG(ERR, "Error converting str to digits, read from %s: %s", - POWER_SYSFILE_TURBO_PCT, strerror(errno)); + POWER_SYSFILE_TURBO_PCT, errmsg); ret = -1; goto out; } diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c index 5e50613f5b..308129cad0 100644 --- a/lib/power/rte_power_pmd_mgmt.c +++ b/lib/power/rte_power_pmd_mgmt.c @@ -487,6 +487,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id, uint16_t queue_id, enum rte_power_pmd_mgmt_type mode) { const union queue qdata = {.portid = port_id, .qid = queue_id}; + char errmsg[RTE_STRERR_BUFSIZE]; struct pmd_core_cfg *lcore_cfg; struct queue_list_entry *queue_cfg; struct rte_eth_dev_info info; @@ -574,8 +575,9 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id, /* add this queue to the list */ ret = queue_list_add(lcore_cfg, &qdata); if (ret < 0) { - POWER_LOG(DEBUG, "Failed to add queue to list: %s", - strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + POWER_LOG(DEBUG, "Failed to add queue to list: %s", errmsg); goto end; } /* new queue is always added last */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 10/52] vhost: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (8 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 09/52] power: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 11/52] bpf: " Dengdui Huang ` (42 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/vhost/fd_man.c | 14 ++++-- lib/vhost/socket.c | 34 ++++++++++--- lib/vhost/vduse.c | 105 +++++++++++++++++++++++++++++++---------- lib/vhost/vhost_user.c | 25 +++++++--- 4 files changed, 138 insertions(+), 40 deletions(-) diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c index 9bc7e50b93..db913f8c1c 100644 --- a/lib/vhost/fd_man.c +++ b/lib/vhost/fd_man.c @@ -13,6 +13,7 @@ #include <rte_malloc.h> #include <rte_string_fns.h> #include <rte_thread.h> +#include <rte_errno.h> #include "fd_man.h" @@ -212,6 +213,7 @@ fdset_find_entry_locked(struct fdset *pfdset, int fd) int fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat) { + char errmsg[RTE_STRERR_BUFSIZE]; struct epoll_event ev; struct fdentry *pfdentry; int ret = 0; @@ -237,8 +239,10 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat) ret = epoll_ctl(pfdset->epfd, EPOLL_CTL_ADD, fd, &ev); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_FDMAN_LOG(ERR, "could not add %d fd to %d epfd: %s", - fd, pfdset->epfd, strerror(errno)); + fd, pfdset->epfd, errmsg); goto out_remove; } @@ -256,13 +260,17 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat) static void fdset_del_locked(struct fdset *pfdset, struct fdentry *pfdentry) { + char errmsg[RTE_STRERR_BUFSIZE]; + if (epoll_ctl(pfdset->epfd, EPOLL_CTL_DEL, pfdentry->fd, NULL) == -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); if (errno == EBADF) /* File might have already been closed. */ VHOST_FDMAN_LOG(DEBUG, "could not remove %d fd from %d epfd: %s", - pfdentry->fd, pfdset->epfd, strerror(errno)); + pfdentry->fd, pfdset->epfd, errmsg); else VHOST_FDMAN_LOG(ERR, "could not remove %d fd from %d epfd: %s", - pfdentry->fd, pfdset->epfd, strerror(errno)); + pfdentry->fd, pfdset->epfd, errmsg); } fdset_remove_entry(pfdset, pfdentry); diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index d29d15494c..96a9b84194 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -16,6 +16,7 @@ #include <rte_thread.h> #include <rte_log.h> +#include <rte_errno.h> #include "fd_man.h" #include "vduse.h" @@ -105,6 +106,7 @@ read_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int m struct iovec iov; struct msghdr msgh; char control[CMSG_SPACE(max_fds * sizeof(int))]; + char errmsg[RTE_STRERR_BUFSIZE]; struct cmsghdr *cmsg; int got_fds = 0; int ret; @@ -122,9 +124,12 @@ read_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int m ret = recvmsg(sockfd, &msgh, 0); if (ret <= 0) { - if (ret) + if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(ifname, ERR, "recvmsg failed on fd %d (%s)", - sockfd, strerror(errno)); + sockfd, errmsg); + } return ret; } @@ -161,6 +166,7 @@ send_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int f struct msghdr msgh; size_t fdsize = fd_num * sizeof(int); char control[CMSG_SPACE(fdsize)]; + char errmsg[RTE_STRERR_BUFSIZE]; struct cmsghdr *cmsg; int ret; @@ -194,8 +200,10 @@ send_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int f } while (ret < 0 && errno == EINTR); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(ifname, ERR, "sendmsg error on fd %d (%s)", - sockfd, strerror(errno)); + sockfd, errmsg); return ret; } @@ -341,6 +349,7 @@ static int create_unix_socket(struct vhost_user_socket *vsocket) { int fd; + char errmsg[RTE_STRERR_BUFSIZE]; struct sockaddr_un *un = &vsocket->un; fd = socket(AF_UNIX, SOCK_STREAM, 0); @@ -350,9 +359,11 @@ create_unix_socket(struct vhost_user_socket *vsocket) vsocket->is_server ? "server" : "client", fd); if (!vsocket->is_server && fcntl(fd, F_SETFL, O_NONBLOCK)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(vsocket->path, ERR, "vhost-user: can't set nonblocking mode for socket, fd: %d (%s)", - fd, strerror(errno)); + fd, errmsg); close(fd); return -1; } @@ -371,6 +382,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket) { int ret; int fd = vsocket->socket_fd; + char errmsg[RTE_STRERR_BUFSIZE]; const char *path = vsocket->path; /* @@ -385,8 +397,10 @@ vhost_user_start_server(struct vhost_user_socket *vsocket) */ ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un)); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(path, ERR, "failed to bind: %s; remove it and try again", - strerror(errno)); + errmsg); goto err; } VHOST_CONFIG_LOG(path, INFO, "binding succeeded"); @@ -430,6 +444,7 @@ static rte_thread_t reconn_tid; static int vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret, flags; ret = connect(fd, un, sz); @@ -438,8 +453,10 @@ vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz) flags = fcntl(fd, F_GETFL, 0); if (flags < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(path, ERR, "can't get flags for connfd %d (%s)", - fd, strerror(errno)); + fd, errmsg); return -2; } if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) { @@ -523,6 +540,7 @@ vhost_user_start_client(struct vhost_user_socket *vsocket) { int ret; int fd = vsocket->socket_fd; + char errmsg[RTE_STRERR_BUFSIZE]; const char *path = vsocket->path; struct vhost_user_reconnect *reconn; @@ -534,7 +552,9 @@ vhost_user_start_client(struct vhost_user_socket *vsocket) return 0; } - VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", errmsg); if (ret == -2 || !vsocket->reconnect) { close(fd); diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index eaf3146b95..58bf065e66 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -17,6 +17,7 @@ #include <rte_common.h> #include <rte_thread.h> +#include <rte_errno.h> #include "fd_man.h" #include "iotlb.h" @@ -119,14 +120,17 @@ static struct vhost_backend_ops vduse_backend_ops = { static void vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused) { + char errmsg[RTE_STRERR_BUFSIZE]; struct virtio_net *dev = arg; uint64_t buf; int ret; ret = read(fd, &buf, sizeof(buf)); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to read control queue event: %s", - strerror(errno)); + errmsg); return; } @@ -142,13 +146,16 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect) struct vhost_vring_addr *ra = &vq->ring_addrs; struct vduse_vq_info vq_info; struct vduse_vq_eventfd vq_efd; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; vq_info.index = index; ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_GET_INFO, &vq_info); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to get VQ %u info: %s", - index, strerror(errno)); + index, errmsg); return; } @@ -178,8 +185,10 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect) VHOST_CONFIG_LOG(dev->ifname, INFO, "\tready: %u", vq_info.ready); vq->kickfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (vq->kickfd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to init kickfd for VQ %u: %s", - index, strerror(errno)); + index, errmsg); vq->kickfd = VIRTIO_INVALID_EVENTFD; return; } @@ -210,8 +219,10 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect) ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to setup kickfd for VQ %u: %s", - index, strerror(errno)); + index, errmsg); close(vq->kickfd); vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; return; @@ -220,9 +231,11 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect) if (vq == dev->cvq) { ret = fdset_add(vduse.fdset, vq->kickfd, vduse_control_queue_event, NULL, dev); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to setup kickfd handler for VQ %u: %s", - index, strerror(errno)); + index, errmsg); vq_efd.fd = VDUSE_EVENTFD_DEASSIGN; ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd); close(vq->kickfd); @@ -237,6 +250,7 @@ static void vduse_vring_cleanup(struct virtio_net *dev, unsigned int index) { struct vhost_virtqueue *vq = dev->virtqueue[index]; + char errmsg[RTE_STRERR_BUFSIZE]; struct vduse_vq_eventfd vq_efd; int ret; @@ -247,9 +261,12 @@ vduse_vring_cleanup(struct virtio_net *dev, unsigned int index) vq_efd.fd = VDUSE_EVENTFD_DEASSIGN; ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd); - if (ret) + if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to cleanup kickfd for VQ %u: %s", - index, strerror(errno)); + index, errmsg); + } close(vq->kickfd); vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; @@ -274,6 +291,7 @@ vduse_vring_cleanup(struct virtio_net *dev, unsigned int index) static void vduse_device_start(struct virtio_net *dev, bool reconnect) { + char errmsg[RTE_STRERR_BUFSIZE]; unsigned int i, ret; VHOST_CONFIG_LOG(dev->ifname, INFO, "Starting device..."); @@ -287,8 +305,10 @@ vduse_device_start(struct virtio_net *dev, bool reconnect) ret = ioctl(dev->vduse_dev_fd, VDUSE_DEV_GET_FEATURES, &dev->features); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to get features: %s", - strerror(errno)); + errmsg); return; } @@ -357,14 +377,17 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused) struct vduse_dev_response resp; struct vhost_virtqueue *vq; uint8_t old_status = dev->status; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; memset(&resp, 0, sizeof(resp)); ret = read(fd, &req, sizeof(req)); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to read request: %s", - strerror(errno)); + errmsg); return; } else if (ret < (int)sizeof(req)) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Incomplete to read request %d", ret); @@ -406,8 +429,10 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused) ret = write(dev->vduse_dev_fd, &resp, sizeof(resp)); if (ret != sizeof(resp)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to write response %s", - strerror(errno)); + errmsg); return; } @@ -428,6 +453,7 @@ static bool vduse_reconnect_path_set; static int vduse_reconnect_path_init(void) { + char errmsg[RTE_STRERR_BUFSIZE]; const char *directory; int ret; @@ -457,8 +483,10 @@ vduse_reconnect_path_init(void) ret = mkdir(vduse_reconnect_dir, 0700); if (ret < 0 && errno != EEXIST) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG("vduse", ERR, "Error creating '%s': %s", - vduse_reconnect_dir, strerror(errno)); + vduse_reconnect_dir, errmsg); return -1; } @@ -473,6 +501,7 @@ vduse_reconnect_path_init(void) static int vduse_reconnect_log_map(struct virtio_net *dev, bool create) { + char errmsg[RTE_STRERR_BUFSIZE]; char reco_file[PATH_MAX]; int fd, ret; const char *name = dev->ifname + strlen("/dev/vduse/"); @@ -495,16 +524,20 @@ vduse_reconnect_log_map(struct virtio_net *dev, bool create) VHOST_CONFIG_LOG(dev->ifname, ERR, "Reconnect file %s exists but not the device", reco_file); } else { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to open reconnect file %s (%s)", - reco_file, strerror(errno)); + reco_file, errmsg); } return -1; } ret = ftruncate(fd, sizeof(*dev->reconnect_log)); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to truncate reconnect file %s (%s)", - reco_file, strerror(errno)); + reco_file, errmsg); goto out_close; } } else { @@ -512,9 +545,12 @@ vduse_reconnect_log_map(struct virtio_net *dev, bool create) if (fd < 0) { if (errno == ENOENT) VHOST_CONFIG_LOG(dev->ifname, ERR, "Missing reconnect file (%s)", reco_file); - else + else { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to open reconnect file %s (%s)", - reco_file, strerror(errno)); + reco_file, errmsg); + } return -1; } } @@ -522,8 +558,10 @@ vduse_reconnect_log_map(struct virtio_net *dev, bool create) dev->reconnect_log = mmap(NULL, sizeof(*dev->reconnect_log), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (dev->reconnect_log == MAP_FAILED) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to mmap reconnect file %s (%s)", - reco_file, strerror(errno)); + reco_file, errmsg); ret = -1; goto out_close; } @@ -576,6 +614,7 @@ vduse_reconnect_handler(int fd, void *arg, int *remove) static int vduse_reconnect_start_device(struct virtio_net *dev) { + char errmsg[RTE_STRERR_BUFSIZE]; int fd, ret; /* @@ -584,8 +623,10 @@ vduse_reconnect_start_device(struct virtio_net *dev) */ fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to create reconnect efd: %s", - strerror(errno)); + errmsg); ret = -1; goto out_err; } @@ -624,6 +665,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags) uint64_t features; const char *name = path + strlen("/dev/vduse/"); bool reconnect = false; + char errmsg[RTE_STRERR_BUFSIZE]; if (vduse.fdset == NULL) { vduse.fdset = fdset_init("vduse-evt"); @@ -635,14 +677,18 @@ vduse_device_create(const char *path, bool compliant_ol_flags) control_fd = open(VDUSE_CTRL_PATH, O_RDWR); if (control_fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(name, ERR, "Failed to open %s: %s", - VDUSE_CTRL_PATH, strerror(errno)); + VDUSE_CTRL_PATH, errmsg); return -1; } if (ioctl(control_fd, VDUSE_SET_API_VERSION, &ver)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(name, ERR, "Failed to set API version: %" PRIu64 ": %s", - ver, strerror(errno)); + ver, errmsg); ret = -1; goto out_ctrl_close; } @@ -698,29 +744,37 @@ vduse_device_create(const char *path, bool compliant_ol_flags) free(dev_config); dev_config = NULL; if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(name, ERR, "Failed to create VDUSE device: %s", - strerror(errno)); + errmsg); goto out_ctrl_close; } dev_fd = open(path, O_RDWR); if (dev_fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(name, ERR, "Failed to open newly created device %s: %s", - path, strerror(errno)); + path, errmsg); ret = -1; goto out_ctrl_close; } } else { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(name, ERR, "Failed to open device %s: %s", - path, strerror(errno)); + path, errmsg); ret = -1; goto out_ctrl_close; } ret = fcntl(dev_fd, F_SETFL, O_NONBLOCK); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(name, ERR, "Failed to set chardev as non-blocking: %s", - strerror(errno)); + errmsg); goto out_dev_close; } @@ -820,6 +874,7 @@ int vduse_device_destroy(const char *path) { const char *name = path + strlen("/dev/vduse/"); + char errmsg[RTE_STRERR_BUFSIZE]; struct virtio_net *dev; int vid, ret; @@ -853,8 +908,10 @@ vduse_device_destroy(const char *path) ret = ioctl(dev->vduse_ctrl_fd, VDUSE_DESTROY_DEV, name); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(name, ERR, "Failed to destroy VDUSE device: %s", - strerror(errno)); + errmsg); } else { /* * VDUSE device was no more attached to the vDPA bus, diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 6d92ad904e..6cde684a6e 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -829,10 +829,13 @@ mem_set_dump(struct virtio_net *dev, void *ptr, size_t size, bool enable, uint64 void *start = RTE_PTR_ALIGN_FLOOR(ptr, pagesz); uintptr_t end = RTE_ALIGN_CEIL((uintptr_t)ptr + size, pagesz); size_t len = end - (uintptr_t)start; + char errmsg[RTE_STRERR_BUFSIZE]; if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, INFO, - "could not set coredump preference (%s).", strerror(errno)); + "could not set coredump preference (%s).", errmsg); } #endif } @@ -1192,6 +1195,7 @@ vhost_user_postcopy_region_register(struct virtio_net *dev, struct rte_vhost_mem_region *reg) { struct uffdio_register reg_struct; + char errmsg[RTE_STRERR_BUFSIZE]; /* * Let's register all the mmapped area to ensure @@ -1203,6 +1207,8 @@ vhost_user_postcopy_region_register(struct virtio_net *dev, if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, ®_struct)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "failed to register ufd for region " "%" PRIx64 " - %" PRIx64 " (ufd = %d) %s", @@ -1210,7 +1216,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)); + errmsg); return -1; } @@ -1292,6 +1298,7 @@ vhost_user_mmap_region(struct virtio_net *dev, struct rte_vhost_mem_region *region, uint64_t mmap_offset) { + char errmsg[RTE_STRERR_BUFSIZE]; void *mmap_addr; uint64_t mmap_size; uint64_t alignment; @@ -1339,7 +1346,9 @@ vhost_user_mmap_region(struct virtio_net *dev, MAP_SHARED | populate, region->fd, 0); if (mmap_addr == MAP_FAILED) { - VHOST_CONFIG_LOG(dev->ifname, ERR, "mmap failed (%s).", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VHOST_CONFIG_LOG(dev->ifname, ERR, "mmap failed (%s).", errmsg); return -1; } @@ -2770,21 +2779,25 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev, struct virtio_net *dev = *pdev; #ifdef RTE_LIBRTE_VHOST_POSTCOPY struct uffdio_api api_struct; + char errmsg[RTE_STRERR_BUFSIZE]; dev->postcopy_ufd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); if (dev->postcopy_ufd == -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, - "userfaultfd not available: %s", - strerror(errno)); + "userfaultfd not available: %s", errmsg); return RTE_VHOST_MSG_RESULT_ERR; } api_struct.api = UFFD_API; api_struct.features = 0; if (ioctl(dev->postcopy_ufd, UFFDIO_API, &api_struct)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_CONFIG_LOG(dev->ifname, ERR, "UFFDIO_API ioctl failure: %s", - strerror(errno)); + errmsg); close(dev->postcopy_ufd); dev->postcopy_ufd = -1; return RTE_VHOST_MSG_RESULT_ERR; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 11/52] bpf: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (9 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 10/52] vhost: " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 12/52] bus/cdx: " Dengdui Huang ` (41 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- lib/bpf/bpf_load_elf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/bpf/bpf_load_elf.c b/lib/bpf/bpf_load_elf.c index e0abd3c856..569a9f4446 100644 --- a/lib/bpf/bpf_load_elf.c +++ b/lib/bpf/bpf_load_elf.c @@ -300,6 +300,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, { int32_t fd, rc; struct rte_bpf *bpf; + char errmsg[RTE_STRERR_BUFSIZE]; if (prm == NULL || fname == NULL || sname == NULL) { rte_errno = EINVAL; @@ -309,8 +310,10 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, fd = open(fname, O_RDONLY); if (fd < 0) { rc = errno; + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); RTE_BPF_LOG_LINE(ERR, "%s(%s) error code: %d(%s)", - __func__, fname, rc, strerror(rc)); + __func__, fname, rc, errmsg); rte_errno = EINVAL; return NULL; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 12/52] bus/cdx: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (10 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 11/52] bpf: " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 13/52] bus/dpaa: " Dengdui Huang ` (40 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/bus/cdx/cdx.c | 6 ++-- drivers/bus/cdx/cdx_vfio.c | 58 +++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c index 62b108e082..3e8ac81766 100644 --- a/drivers/bus/cdx/cdx.c +++ b/drivers/bus/cdx/cdx.c @@ -264,14 +264,16 @@ cdx_scan_one(const char *dirname, const char *dev_name) static int cdx_scan(void) { + char errmsg[RTE_STRERR_BUFSIZE]; struct dirent *e; DIR *dir; char dirname[PATH_MAX]; dir = opendir(RTE_CDX_BUS_DEVICES_PATH); if (dir == NULL) { - CDX_BUS_INFO("%s(): opendir failed: %s", __func__, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + CDX_BUS_INFO("%s(): opendir failed: %s", __func__, errmsg); return 0; } diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c index 664f267471..a17da30701 100644 --- a/drivers/bus/cdx/cdx_vfio.c +++ b/drivers/bus/cdx/cdx_vfio.c @@ -20,6 +20,7 @@ #include <rte_eal_paging.h> #include <rte_malloc.h> #include <rte_vfio.h> +#include <rte_errno.h> #include "bus_cdx_driver.h" #include "cdx_logs.h" @@ -186,6 +187,7 @@ static int cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd, int num_irqs) { + char errmsg[RTE_STRERR_BUFSIZE]; int i, ret; if (rte_intr_dev_fd_set(dev->intr_handle, vfio_dev_fd)) @@ -203,8 +205,10 @@ 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) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("Cannot get VFIO IRQ info, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -221,8 +225,10 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd, /* set up an eventfd for interrupts */ fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -244,6 +250,8 @@ static int cdx_vfio_setup_device(struct rte_cdx_device *dev, int vfio_dev_fd, int num_irqs) { + char errmsg[RTE_STRERR_BUFSIZE]; + if (cdx_vfio_setup_interrupts(dev, vfio_dev_fd, num_irqs) != 0) { CDX_BUS_ERR("Error setting up interrupts!"); return -1; @@ -254,8 +262,10 @@ cdx_vfio_setup_device(struct rte_cdx_device *dev, int vfio_dev_fd, * then it updates errno as EINVAL. */ if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("Unable to reset device! Error: %d (%s)", errno, - strerror(errno)); + errmsg); return -1; } @@ -264,8 +274,10 @@ cdx_vfio_setup_device(struct rte_cdx_device *dev, int vfio_dev_fd, * device does not support configuring bus master. */ if (rte_cdx_vfio_bm_enable(dev) && (errno != -ENOTTY)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("Bus master enable failure! Error: %d (%s)", errno, - strerror(errno)); + errmsg); return -1; } @@ -393,6 +405,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev) const char *dev_name = dev->device.name; struct cdx_map *maps; int vfio_dev_fd, i, ret; + char errmsg[RTE_STRERR_BUFSIZE]; if (rte_intr_fd_set(dev->intr_handle, -1)) return -1; @@ -422,8 +435,10 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev) ret = cdx_vfio_get_region_info(vfio_dev_fd, ®, i); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("%s cannot get device region info error %i (%s)", - dev_name, errno, strerror(errno)); + dev_name, errno, errmsg); goto err_vfio_res; } @@ -450,8 +465,10 @@ 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) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("%s mapping region %i failed: %s", - cdx_addr, i, strerror(errno)); + cdx_addr, i, errmsg); free(reg); goto err_vfio_res; } @@ -489,6 +506,7 @@ cdx_vfio_map_resource_secondary(struct rte_cdx_device *dev) struct mapped_cdx_res_list *vfio_res_list = RTE_TAILQ_CAST(cdx_vfio_tailq.head, mapped_cdx_res_list); const char *dev_name = dev->device.name; + char errmsg[RTE_STRERR_BUFSIZE]; struct cdx_map *maps; if (rte_intr_fd_set(dev->intr_handle, -1)) @@ -518,8 +536,10 @@ cdx_vfio_map_resource_secondary(struct rte_cdx_device *dev) for (i = 0; i < vfio_res->nb_maps; i++) { ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, MAP_FIXED); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("%s mapping MMIO region %i failed: %s", - dev_name, i, strerror(errno)); + dev_name, i, errmsg); goto err_vfio_dev_fd; } @@ -617,6 +637,7 @@ rte_cdx_vfio_bm_enable(struct rte_cdx_device *dev) struct vfio_device_info device_info = { .argsz = sizeof(device_info) }; struct vfio_device_feature_bus_master *vfio_bm_feature; struct vfio_device_feature *feature; + char errmsg[RTE_STRERR_BUFSIZE]; int vfio_dev_fd, ret; size_t argsz; @@ -638,8 +659,10 @@ rte_cdx_vfio_bm_enable(struct rte_cdx_device *dev) feature->flags |= VFIO_DEVICE_FEATURE_SET; ret = ioctl(vfio_dev_fd, RTE_VFIO_DEVICE_FEATURE, feature); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("Bus Master configuring not supported for device: %s, error: %d (%s)", - dev->name, errno, strerror(errno)); + dev->name, errno, errmsg); free(feature); return ret; } @@ -647,9 +670,12 @@ rte_cdx_vfio_bm_enable(struct rte_cdx_device *dev) feature->flags = RTE_VFIO_DEVICE_FEATURE_BUS_MASTER | VFIO_DEVICE_FEATURE_SET; vfio_bm_feature->op = VFIO_DEVICE_FEATURE_SET_MASTER; ret = ioctl(vfio_dev_fd, RTE_VFIO_DEVICE_FEATURE, feature); - if (ret < 0) + if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("BM Enable Error for device: %s, Error: %d (%s)", - dev->name, errno, strerror(errno)); + dev->name, errno, errmsg); + } free(feature); return ret; @@ -661,6 +687,7 @@ rte_cdx_vfio_bm_disable(struct rte_cdx_device *dev) { struct vfio_device_feature_bus_master *vfio_bm_feature; struct vfio_device_feature *feature; + char errmsg[RTE_STRERR_BUFSIZE]; int vfio_dev_fd, ret; size_t argsz; @@ -682,8 +709,10 @@ rte_cdx_vfio_bm_disable(struct rte_cdx_device *dev) feature->flags |= VFIO_DEVICE_FEATURE_SET; ret = ioctl(vfio_dev_fd, RTE_VFIO_DEVICE_FEATURE, feature); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("Bus Master configuring not supported for device: %s, Error: %d (%s)", - dev->name, errno, strerror(errno)); + dev->name, errno, errmsg); free(feature); return ret; } @@ -691,9 +720,12 @@ rte_cdx_vfio_bm_disable(struct rte_cdx_device *dev) feature->flags = RTE_VFIO_DEVICE_FEATURE_BUS_MASTER | VFIO_DEVICE_FEATURE_SET; vfio_bm_feature->op = VFIO_DEVICE_FEATURE_CLEAR_MASTER; ret = ioctl(vfio_dev_fd, RTE_VFIO_DEVICE_FEATURE, feature); - if (ret < 0) + if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CDX_BUS_ERR("BM Disable Error for device: %s, Error: %d (%s)", - dev->name, errno, strerror(errno)); + dev->name, errno, errmsg); + } free(feature); return ret; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 13/52] bus/dpaa: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (11 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 12/52] bus/cdx: " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 14/52] bus/fslmc: " Dengdui Huang ` (39 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/bus/dpaa/base/fman/fman.c | 8 ++++++-- drivers/bus/dpaa/dpaa_bus.c | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index d49339d81e..d9593cf459 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -1132,6 +1132,7 @@ fman_init(void) void fman_finish(void) { + char errmsg[RTE_STRERR_BUFSIZE]; struct __fman_if *__if, *tmpif; assert(fman_ccsr_map_fd != -1); @@ -1153,8 +1154,11 @@ fman_finish(void) in_be32(__if->ccsr_map + 8) & ~(u32)3); /* release the mapping */ _errno = munmap(__if->ccsr_map, __if->regs_size); - if (unlikely(_errno < 0)) - FMAN_ERR(_errno, "munmap() = (%s)", strerror(errno)); + if (unlikely(_errno < 0)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + FMAN_ERR(_errno, "munmap() = (%s)", errmsg); + } DPAA_BUS_INFO("Tearing down %s", __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 9ffbe07c93..8fabd74899 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -627,12 +627,15 @@ rte_dpaa_bus_dev_build(void) static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle) { + char errmsg[RTE_STRERR_BUFSIZE]; int fd; fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA_BUS_ERR("Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return errno; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 14/52] bus/fslmc: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (12 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 13/52] bus/dpaa: " Dengdui Huang @ 2024-11-04 11:09 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 15/52] bus/pci: " Dengdui Huang ` (38 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:09 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/bus/fslmc/fslmc_vfio.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 6981679a2d..b6647dc38d 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -448,6 +448,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr, .argsz = sizeof(group_status) }; int vfio_group_fd, vfio_container_fd, iommu_group_no, ret; + char errmsg[RTE_STRERR_BUFSIZE]; /* get group number */ ret = rte_vfio_get_group_num(sysfs_base, dev_addr, &iommu_group_no); @@ -479,9 +480,11 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr, /* check if the group is viable */ ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA2_BUS_ERR(" %s cannot get group status, " "error %i (%s)", dev_addr, - errno, strerror(errno)); + errno, errmsg); close(vfio_group_fd); rte_vfio_clear_group(vfio_group_fd); return -1; @@ -502,9 +505,11 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr, ret = ioctl(vfio_group_fd, VFIO_GROUP_SET_CONTAINER, &vfio_container_fd); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA2_BUS_ERR(" %s cannot add VFIO group to container, " "error %i (%s)", dev_addr, - errno, strerror(errno)); + errno, errmsg); close(vfio_group_fd); close(vfio_container_fd); rte_vfio_clear_group(vfio_group_fd); @@ -550,8 +555,10 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr, /* test and setup the device */ ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA2_BUS_ERR(" %s cannot get device info, error %i (%s)", - dev_addr, errno, strerror(errno)); + dev_addr, errno, errmsg); close(*vfio_dev_fd); close(vfio_group_fd); close(vfio_container_fd); @@ -599,6 +606,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index) char irq_set_buf[IRQ_SET_BUF_LEN]; struct vfio_irq_set *irq_set; int *fd_ptr, vfio_dev_fd; + char errmsg[RTE_STRERR_BUFSIZE]; len = sizeof(irq_set_buf); @@ -615,9 +623,10 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index) vfio_dev_fd = rte_intr_dev_fd_get(intr_handle); ret = ioctl(vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA2_BUS_ERR("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)", - rte_intr_fd_get(intr_handle), errno, - strerror(errno)); + rte_intr_fd_get(intr_handle), errno, errmsg); return ret; } @@ -655,6 +664,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle, int vfio_dev_fd, int num_irqs) { + char errmsg[RTE_STRERR_BUFSIZE]; int i, ret; /* start from MSI-X interrupt type */ @@ -666,8 +676,10 @@ 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) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA2_BUS_ERR("Cannot get IRQ(%d) info, error %i (%s)", - i, errno, strerror(errno)); + i, errno, errmsg); return -1; } @@ -681,8 +693,10 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle, /* set up an eventfd for interrupts */ fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA2_BUS_ERR("Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 15/52] bus/pci: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (13 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 14/52] bus/fslmc: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 16/52] bus/vmbus: " Dengdui Huang ` (37 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/bus/pci/bsd/pci.c | 20 +++++++++--- drivers/bus/pci/linux/pci.c | 16 ++++++++-- drivers/bus/pci/linux/pci_uio.c | 50 +++++++++++++++++++++++------- drivers/bus/pci/linux/pci_vfio.c | 52 +++++++++++++++++++++++++------- drivers/bus/pci/pci_common_uio.c | 6 +++- 5 files changed, 114 insertions(+), 30 deletions(-) diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c index 2f88252418..916832af7e 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -38,6 +38,7 @@ #include <rte_string_fns.h> #include <rte_debug.h> #include <rte_devargs.h> +#include <rte_errno.h> #include "eal_filesystem.h" #include "private.h" @@ -101,6 +102,7 @@ int pci_uio_alloc_resource(struct rte_pci_device *dev, struct mapped_pci_resource **uio_res) { + char errmsg[RTE_STRERR_BUFSIZE]; char devname[PATH_MAX]; /* contains the /dev/uioX */ struct rte_pci_addr *loc; @@ -122,7 +124,9 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, } if (rte_intr_fd_get(dev->intr_handle) < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot open %s: %s", devname, errmsg); goto error; } @@ -156,6 +160,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, uint64_t offset; uint64_t pagesz; struct pci_map *maps; + char errmsg[RTE_STRERR_BUFSIZE]; maps = uio_res->maps; devname = uio_res->path; @@ -164,7 +169,9 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, /* allocate memory to keep path */ maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0); if (maps[map_idx].path == NULL) { - PCI_LOG(ERR, "Cannot allocate memory for path: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot allocate memory for path: %s", errmsg); return -1; } @@ -173,7 +180,9 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, */ fd = open(devname, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot open %s: %s", devname, errmsg); goto error; } @@ -331,6 +340,7 @@ rte_pci_scan(void) .match_buf_len = sizeof(matches), .matches = &matches[0], }; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_pci_addr pci_addr; /* for debug purposes, PCI can be disabled */ @@ -346,8 +356,10 @@ rte_pci_scan(void) do { unsigned i; if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s(): error with ioctl on /dev/pci: %s", - __func__, strerror(errno)); + __func__, errmsg); goto error; } diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 9056035b33..2ef17a288e 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -12,6 +12,7 @@ #include <rte_devargs.h> #include <rte_memcpy.h> #include <rte_vfio.h> +#include <rte_errno.h> #include "eal_filesystem.h" @@ -442,6 +443,7 @@ rte_pci_scan(void) DIR *dir; char dirname[PATH_MAX]; struct rte_pci_addr addr; + char errmsg[RTE_STRERR_BUFSIZE]; /* for debug purposes, PCI can be disabled */ if (!rte_eal_has_pci()) @@ -449,7 +451,9 @@ rte_pci_scan(void) dir = opendir(rte_pci_get_sysfs_path()); if (dir == NULL) { - PCI_LOG(ERR, "%s(): opendir failed: %s", __func__, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "%s(): opendir failed: %s", __func__, errmsg); return -1; } @@ -487,6 +491,7 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev) char filename[PATH_MAX]; FILE *fp; uint64_t mgaw, vtd_cap_reg = 0; + char errmsg[RTE_STRERR_BUFSIZE]; snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT "/iommu/intel-iommu/cap", @@ -499,8 +504,10 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev) if (errno == ENOENT) return true; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s(): can't open %s: %s", - __func__, filename, strerror(errno)); + __func__, filename, errmsg); return false; } @@ -547,11 +554,14 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev) char filename[PATH_MAX] = "/proc/cpuinfo"; FILE *fp = fopen(filename, "r"); bool pseries = false, powernv = false, qemu = false; + char errmsg[RTE_STRERR_BUFSIZE]; bool ret = false; if (fp == NULL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s(): can't open %s: %s", - __func__, filename, strerror(errno)); + __func__, filename, errmsg); return ret; } diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 4c1d3327a9..77a41beb77 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -21,6 +21,7 @@ #include <rte_bus_pci.h> #include <rte_common.h> #include <rte_malloc.h> +#include <rte_errno.h> #include "eal_filesystem.h" #include "pci_init.h" @@ -79,6 +80,7 @@ pci_uio_mmio_write(const struct rte_pci_device *dev, int bar, static int pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num) { + char errmsg[RTE_STRERR_BUFSIZE]; FILE *f; char filename[PATH_MAX]; int ret; @@ -108,7 +110,9 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num) dev = makedev(major, minor); ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev); if (ret != 0) { - PCI_LOG(ERR, "%s(): mknod() failed %s", __func__, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "%s(): mknod() failed %s", __func__, errmsg); return -1; } @@ -217,6 +221,7 @@ int pci_uio_alloc_resource(struct rte_pci_device *dev, struct mapped_pci_resource **uio_res) { + char errmsg[RTE_STRERR_BUFSIZE]; char dirname[PATH_MAX]; char cfgname[PATH_MAX]; char devname[PATH_MAX]; /* contains the /dev/uioX */ @@ -237,7 +242,9 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, /* save fd */ fd = open(devname, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot open %s: %s", devname, errmsg); goto error; } @@ -249,7 +256,9 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, uio_cfg_fd = open(cfgname, O_RDWR); if (uio_cfg_fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", cfgname, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot open %s: %s", cfgname, errmsg); goto error; } @@ -294,6 +303,7 @@ int pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, struct mapped_pci_resource *uio_res, int map_idx) { + char errmsg[RTE_STRERR_BUFSIZE]; int fd = -1; char devname[PATH_MAX]; void *mapaddr; @@ -310,7 +320,9 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, /* allocate memory to keep path */ maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0); if (maps[map_idx].path == NULL) { - PCI_LOG(ERR, "Cannot allocate memory for path: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot allocate memory for path: %s", errmsg); return -1; } @@ -342,7 +354,9 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, /* then try to map resource file */ fd = open(devname, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot open %s: %s", devname, errmsg); goto error; } } @@ -383,6 +397,7 @@ int pci_uio_ioport_map(struct rte_pci_device *dev, int bar, struct rte_pci_ioport *p) { + char errmsg[RTE_STRERR_BUFSIZE]; FILE *f = NULL; char dirname[PATH_MAX]; char filename[PATH_MAX]; @@ -397,7 +412,9 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, dev->addr.devid, dev->addr.function); f = fopen(filename, "r"); if (f == NULL) { - PCI_LOG(ERR, "%s(): Cannot open sysfs resource: %s", __func__, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "%s(): Cannot open sysfs resource: %s", __func__, errmsg); return -1; } @@ -438,14 +455,18 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, RTE_INTR_HANDLE_UNKNOWN) { int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0); if (uio_num < 0) { - PCI_LOG(ERR, "cannot open %s: %s", dirname, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "cannot open %s: %s", dirname, errmsg); goto error; } snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num); fd = open(filename, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot open %s: %s", filename, errmsg); goto error; } if (rte_intr_fd_set(dev->intr_handle, fd)) @@ -474,6 +495,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, FILE *f; char buf[BUFSIZ]; char filename[PATH_MAX]; + char errmsg[RTE_STRERR_BUFSIZE]; uint64_t phys_addr, end_addr, flags; int fd, i; void *addr; @@ -484,7 +506,9 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, dev->addr.devid, dev->addr.function); f = fopen(filename, "r"); if (f == NULL) { - PCI_LOG(ERR, "Cannot open sysfs resource: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot open sysfs resource: %s", errmsg); return -1; } for (i = 0; i < bar + 1; i++) { @@ -507,14 +531,18 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, /* mmap the pci resource */ fd = open(filename, O_RDWR); if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot open %s: %s", filename, errmsg); goto error; } addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); close(fd); if (addr == MAP_FAILED) { - PCI_LOG(ERR, "Cannot mmap IO port resource: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Cannot mmap IO port resource: %s", errmsg); goto error; } diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 5317170231..ed1b458a9d 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -21,6 +21,7 @@ #include <bus_driver.h> #include <rte_spinlock.h> #include <rte_tailq.h> +#include <rte_errno.h> #include "eal_filesystem.h" @@ -180,6 +181,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) { int i, ret, intr_idx; enum rte_intr_mode intr_mode; + char errmsg[RTE_STRERR_BUFSIZE]; /* default to invalid index */ intr_idx = VFIO_PCI_NUM_IRQS; @@ -222,8 +224,10 @@ 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) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "Cannot get VFIO IRQ info, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -248,8 +252,10 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) /* set up an eventfd for interrupts */ fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -323,14 +329,17 @@ pci_vfio_req_handler(void *param) static int pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; int fd = -1; /* set up an eventfd for req notifier */ fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -431,6 +440,8 @@ pci_vfio_is_ioport_bar(const struct rte_pci_device *dev, int vfio_dev_fd, static int pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) { + char errmsg[RTE_STRERR_BUFSIZE]; + if (pci_vfio_setup_interrupts(dev, vfio_dev_fd) != 0) { PCI_LOG(ERR, "Error setting up interrupts!"); return -1; @@ -451,7 +462,9 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) * then it updates errno as EINVAL. */ if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) { - PCI_LOG(ERR, "Unable to reset device! Error: %d (%s)", errno, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PCI_LOG(ERR, "Unable to reset device! Error: %d (%s)", errno, errmsg); return -1; } @@ -715,6 +728,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd, { struct rte_pci_device_internal *pdev = RTE_PCI_DEVICE_INTERNAL(dev); struct vfio_region_info *reg = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; int nb_maps, i, ret; nb_maps = RTE_MIN((int)device_info->num_regions, @@ -723,8 +737,10 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd, for (i = 0; i < nb_maps; i++) { ret = pci_vfio_get_region_info(vfio_dev_fd, ®, i); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(DEBUG, "%s cannot get device region info error %i (%s)", - dev->name, errno, strerror(errno)); + dev->name, errno, errmsg); return -1; } @@ -750,6 +766,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) struct mapped_pci_resource *vfio_res = NULL; struct mapped_pci_res_list *vfio_res_list = RTE_TAILQ_CAST(rte_vfio_tailq.head, mapped_pci_res_list); + char errmsg[RTE_STRERR_BUFSIZE]; struct pci_map *maps; @@ -791,8 +808,10 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) ret = pci_vfio_get_region_info(vfio_dev_fd, ®, VFIO_PCI_CONFIG_REGION_INDEX); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s cannot get device region info error %i (%s)", - dev->name, errno, strerror(errno)); + dev->name, errno, errmsg); goto err_vfio_res; } pdev->region[VFIO_PCI_CONFIG_REGION_INDEX].size = reg->size; @@ -829,8 +848,10 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) ret = pci_vfio_get_region_info(vfio_dev_fd, ®, i); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s cannot get device region info error %i (%s)", - pci_addr, errno, strerror(errno)); + pci_addr, errno, errmsg); goto err_map; } @@ -890,16 +911,20 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) if (maps[i].nr_areas > 0) { ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, 0); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s sparse mapping BAR%i failed: %s", - pci_addr, i, strerror(errno)); + pci_addr, i, errmsg); free(reg); goto err_map; } } else { ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s mapping BAR%i failed: %s", - pci_addr, i, strerror(errno)); + pci_addr, i, errmsg); free(reg); goto err_map; } @@ -951,6 +976,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) struct mapped_pci_resource *vfio_res = NULL; struct mapped_pci_res_list *vfio_res_list = RTE_TAILQ_CAST(rte_vfio_tailq.head, mapped_pci_res_list); + char errmsg[RTE_STRERR_BUFSIZE]; struct pci_map *maps; @@ -994,15 +1020,19 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) if (maps[i].nr_areas > 0) { ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s sparse mapping BAR%i failed: %s", - pci_addr, i, strerror(errno)); + pci_addr, i, errmsg); goto err_vfio_dev_fd; } } else { ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "%s mapping BAR%i failed: %s", - pci_addr, i, strerror(errno)); + pci_addr, i, errmsg); goto err_vfio_dev_fd; } } diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c index 30503bd23a..87f134385c 100644 --- a/drivers/bus/pci/pci_common_uio.c +++ b/drivers/bus/pci/pci_common_uio.c @@ -15,6 +15,7 @@ #include <rte_tailq.h> #include <rte_log.h> #include <rte_malloc.h> +#include <rte_errno.h> #include "private.h" @@ -27,6 +28,7 @@ static int pci_uio_map_secondary(struct rte_pci_device *dev) { int fd, i = 0, j, res_idx; + char errmsg[RTE_STRERR_BUFSIZE]; struct mapped_pci_resource *uio_res; struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); @@ -51,8 +53,10 @@ pci_uio_map_secondary(struct rte_pci_device *dev) */ fd = open(uio_res->maps[i].path, O_RDWR); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PCI_LOG(ERR, "Cannot open %s: %s", - uio_res->maps[i].path, strerror(errno)); + uio_res->maps[i].path, errmsg); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 16/52] bus/vmbus: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (14 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 15/52] bus/pci: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 17/52] bus/vdev: use rte strerror Dengdui Huang ` (36 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/bus/vmbus/linux/vmbus_bus.c | 16 ++++++-- drivers/bus/vmbus/linux/vmbus_uio.c | 55 +++++++++++++++++++--------- drivers/bus/vmbus/vmbus_common.c | 13 +++++-- drivers/bus/vmbus/vmbus_common_uio.c | 7 +++- 4 files changed, 65 insertions(+), 26 deletions(-) diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c index 01d8111b85..feb80518bf 100644 --- a/drivers/bus/vmbus/linux/vmbus_bus.c +++ b/drivers/bus/vmbus/linux/vmbus_bus.c @@ -18,6 +18,7 @@ #include <rte_memory.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #include "eal_filesystem.h" #include "private.h" @@ -43,14 +44,17 @@ extern struct rte_vmbus_bus rte_vmbus_bus; static int parse_sysfs_uuid(const char *filename, rte_uuid_t uu) { + char errmsg[RTE_STRERR_BUFSIZE]; char buf[BUFSIZ]; char *cp, *in = buf; FILE *f; f = fopen(filename, "r"); if (f == NULL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VMBUS_LOG(ERR, "cannot open sysfs value %s: %s", - filename, strerror(errno)); + filename, errmsg); return -1; } @@ -86,13 +90,16 @@ parse_sysfs_uuid(const char *filename, rte_uuid_t uu) static int get_sysfs_string(const char *filename, char *buf, size_t buflen) { + char errmsg[RTE_STRERR_BUFSIZE]; char *cp; FILE *f; f = fopen(filename, "r"); if (f == NULL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VMBUS_LOG(ERR, "cannot open sysfs value %s:%s", - filename, strerror(errno)); + filename, errmsg); return -1; } @@ -341,6 +348,7 @@ vmbus_scan_one(const char *name) int rte_vmbus_scan(void) { + char errmsg[RTE_STRERR_BUFSIZE]; struct dirent *e; DIR *dir; @@ -349,8 +357,10 @@ rte_vmbus_scan(void) if (errno == ENOENT) return 0; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VMBUS_LOG(ERR, "opendir %s failed: %s", - SYSFS_VMBUS_DEVICES, strerror(errno)); + SYSFS_VMBUS_DEVICES, errmsg); return -1; } diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 26edef342d..3e7bc618e4 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -18,6 +18,7 @@ #include <rte_malloc.h> #include <rte_bus_vmbus.h> #include <rte_string_fns.h> +#include <rte_errno.h> #include "private.h" @@ -29,17 +30,21 @@ static void *vmbus_map_addr; /* Control interrupts */ void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff) { + char errmsg[RTE_STRERR_BUFSIZE]; if ((rte_intr_fd_get(dev->intr_handle) < 0) || write(rte_intr_fd_get(dev->intr_handle), &onoff, sizeof(onoff)) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VMBUS_LOG(ERR, "cannot write to %d:%s", rte_intr_fd_get(dev->intr_handle), - strerror(errno)); + errmsg); } } int vmbus_uio_irq_read(struct rte_vmbus_device *dev) { + char errmsg[RTE_STRERR_BUFSIZE]; int32_t count; int cc; @@ -50,8 +55,9 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev) sizeof(count)); if (cc < (int)sizeof(count)) { if (cc < 0) { - VMBUS_LOG(ERR, "IRQ read failed %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VMBUS_LOG(ERR, "IRQ read failed %s", errmsg); return -errno; } VMBUS_LOG(ERR, "can't read IRQ count"); @@ -83,6 +89,7 @@ int vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, struct mapped_vmbus_resource **uio_res) { + char errmsg[RTE_STRERR_BUFSIZE]; char devname[PATH_MAX]; /* contains the /dev/uioX */ int fd; @@ -90,8 +97,9 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, snprintf(devname, sizeof(devname), "/dev/uio%u", dev->uio_num); fd = open(devname, O_RDWR); if (fd < 0) { - VMBUS_LOG(ERR, "Cannot open %s: %s", - devname, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VMBUS_LOG(ERR, "Cannot open %s: %s", devname, errmsg); goto error; } @@ -150,6 +158,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx, { size_t size = dev->resource[idx].len; struct vmbus_map *maps = uio_res->maps; + char errmsg[RTE_STRERR_BUFSIZE]; void *mapaddr; off_t offset; int fd; @@ -157,8 +166,9 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx, /* devname for mmap */ fd = open(uio_res->path, O_RDWR); if (fd < 0) { - VMBUS_LOG(ERR, "Cannot open %s: %s", - uio_res->path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VMBUS_LOG(ERR, "Cannot open %s: %s", uio_res->path, errmsg); return -1; } @@ -211,6 +221,7 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev, const struct vmbus_channel *chan, void **ring_buf, uint32_t *ring_size) { + char errmsg[RTE_STRERR_BUFSIZE]; char ring_path[PATH_MAX]; size_t file_size; struct stat sb; @@ -255,14 +266,16 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VMBUS_LOG(ERR, "Cannot open %s: %s", ring_path, errmsg); return -errno; } if (fstat(fd, &sb) < 0) { - VMBUS_LOG(ERR, "Cannot state %s: %s", - ring_path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VMBUS_LOG(ERR, "Cannot state %s: %s", ring_path, errmsg); close(fd); return -errno; } @@ -334,6 +347,7 @@ int vmbus_uio_map_rings(struct vmbus_channel *chan) static int vmbus_uio_sysfs_read(const char *dir, const char *name, unsigned long *val, unsigned long max_range) { + char errmsg[RTE_STRERR_BUFSIZE]; char path[PATH_MAX]; FILE *f; int ret; @@ -341,8 +355,9 @@ static int vmbus_uio_sysfs_read(const char *dir, const char *name, snprintf(path, sizeof(path), "%s/%s", dir, name); f = fopen(path, "r"); if (!f) { - VMBUS_LOG(ERR, "can't open %s:%s", - path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VMBUS_LOG(ERR, "can't open %s:%s", path, errmsg); return -errno; } @@ -393,6 +408,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, { const struct rte_vmbus_device *dev = primary->device; char chan_path[PATH_MAX], subchan_path[PATH_MAX]; + char errmsg[RTE_STRERR_BUFSIZE]; struct dirent *ent; DIR *chan_dir; int err; @@ -403,8 +419,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VMBUS_LOG(ERR, "cannot open %s: %s", chan_path, errmsg); return -errno; } @@ -440,8 +457,10 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, err = vmbus_uio_sysfs_read(subchan_path, "subchannel_id", &subid, UINT16_MAX); if (err) { + if (strerror_r(-err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -err); VMBUS_LOG(NOTICE, "no subchannel_id in %s:%s", - subchan_path, strerror(-err)); + subchan_path, errmsg); goto fail; } @@ -451,8 +470,10 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, err = vmbus_uio_sysfs_read(subchan_path, "monitor_id", &monid, UINT8_MAX); if (err) { + if (strerror_r(-err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -err); VMBUS_LOG(NOTICE, "no monitor_id in %s:%s", - subchan_path, strerror(-err)); + subchan_path, errmsg); goto fail; } diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c index 8a965d10d9..017ead03e5 100644 --- a/drivers/bus/vmbus/vmbus_common.c +++ b/drivers/bus/vmbus/vmbus_common.c @@ -29,16 +29,18 @@ void * vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size, int flags) { + char errmsg[RTE_STRERR_BUFSIZE]; void *mapaddr; /* Map the memory resource of device */ mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE, MAP_SHARED | flags, fd, offset); if (mapaddr == MAP_FAILED) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VMBUS_LOG(ERR, "mmap(%d, %p, %zu, %ld) failed: %s", - fd, requested_addr, size, (long)offset, - strerror(errno)); + fd, requested_addr, size, (long)offset, errmsg); } else { VMBUS_LOG(DEBUG, " VMBUS memory mapped at %p", mapaddr); @@ -50,14 +52,17 @@ vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size, void vmbus_unmap_resource(void *requested_addr, size_t size) { + char errmsg[RTE_STRERR_BUFSIZE]; + if (requested_addr == NULL) return; /* Unmap the VMBUS memory resource of device */ if (munmap(requested_addr, size)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VMBUS_LOG(ERR, "munmap(%p, 0x%lx) failed: %s", - requested_addr, (unsigned long)size, - strerror(errno)); + requested_addr, (unsigned long)size, errmsg); } 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..d5f187c459 100644 --- a/drivers/bus/vmbus/vmbus_common_uio.c +++ b/drivers/bus/vmbus/vmbus_common_uio.c @@ -14,6 +14,7 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_errno.h> #include "private.h" @@ -43,6 +44,7 @@ static int vmbus_uio_map_secondary(struct rte_vmbus_device *dev) { struct mapped_vmbus_resource *uio_res; + char errmsg[RTE_STRERR_BUFSIZE]; struct vmbus_channel *chan; int fd, i; @@ -55,8 +57,9 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev) /* open /dev/uioX */ fd = open(uio_res->path, O_RDWR); if (fd < 0) { - VMBUS_LOG(ERR, "Cannot open %s: %s", - uio_res->path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + VMBUS_LOG(ERR, "Cannot open %s: %s", uio_res->path, errmsg); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 17/52] bus/vdev: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (15 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 16/52] bus/vmbus: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 18/52] common/cnxk: replace strerror with reentrant version Dengdui Huang ` (35 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- 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 ec7abe7cda..299f8c2873 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -437,7 +437,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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 18/52] common/cnxk: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (16 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 17/52] bus/vdev: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 19/52] common/mlx5: " Dengdui Huang ` (34 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/common/cnxk/roc_dev.c | 12 ++++++++++-- drivers/common/cnxk/roc_model.c | 8 ++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index 45f007325e..74c71036fe 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -8,6 +8,8 @@ #include <sys/mman.h> #include <unistd.h> +#include <rte_errno.h> + #include "roc_api.h" #include "roc_priv.h" @@ -1303,6 +1305,7 @@ dev_vf_hwcap_update(struct plt_pci_device *pci_dev, struct dev *dev) static uintptr_t cn20k_pfvf_mbox_alloc(struct dev *dev, uint16_t max_vfs) { + char errmsg[RTE_STRERR_BUFSIZE]; char name[PLT_MEMZONE_NAMESIZE]; const struct plt_memzone *mz; uint32_t vf_mbox_region; @@ -1313,7 +1316,9 @@ cn20k_pfvf_mbox_alloc(struct dev *dev, uint16_t max_vfs) mz = plt_memzone_reserve_aligned(name, vf_mbox_region, 0, MBOX_SIZE); if (!mz) { - plt_err("Memory alloc failed: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + plt_err("Memory alloc failed: %s", errmsg); goto fail; } @@ -1397,6 +1402,7 @@ dev_setup_shared_lmt_region(struct mbox *mbox, bool valid_iova, uint64_t iova) static int dev_lmt_setup(struct dev *dev) { + char errmsg[RTE_STRERR_BUFSIZE]; char name[PLT_MEMZONE_NAMESIZE]; const struct plt_memzone *mz; struct idev_cfg *idev; @@ -1435,7 +1441,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + plt_err("Memory alloc failed: %s", errmsg); goto fail; } diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c index 6289461db4..63288e53ff 100644 --- a/drivers/common/cnxk/roc_model.c +++ b/drivers/common/cnxk/roc_model.c @@ -6,6 +6,8 @@ #include <fcntl.h> #include <unistd.h> +#include <rte_errno.h> + #include "roc_api.h" #include "roc_priv.h" @@ -149,6 +151,7 @@ static int cn10k_part_pass_get(uint32_t *part, uint32_t *pass) { #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices" + char errmsg[RTE_STRERR_BUFSIZE]; char dirname[PATH_MAX]; struct dirent *e; int ret = -1; @@ -156,8 +159,9 @@ cn10k_part_pass_get(uint32_t *part, uint32_t *pass) dir = opendir(SYSFS_PCI_DEVICES); if (dir == NULL) { - plt_err("%s(): opendir failed: %s", __func__, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + plt_err("%s(): opendir failed: %s", __func__, errmsg); return -errno; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 19/52] common/mlx5: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (17 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 18/52] common/cnxk: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 20/52] common/mlx5: use rte strerror Dengdui Huang ` (33 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/common/mlx5/linux/mlx5_nl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index a5ac4dc543..67fc6c08d9 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -1924,18 +1924,21 @@ mlx5_nl_read_events(int nlsk_fd, mlx5_nl_event_cb *cb, void *cb_arg) .msg_iov = &iov, .msg_iovlen = 1, }; + char errmsg[RTE_STRERR_BUFSIZE]; struct nlmsghdr *hdr; ssize_t size; while (1) { size = recvmsg(nlsk_fd, &msg, MSG_DONTWAIT); if (size < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); if (errno == EAGAIN) return 0; if (errno == EINTR) continue; DRV_LOG(DEBUG, "Failed to receive netlink message: %s", - strerror(errno)); + errmsg); rte_errno = errno; return -rte_errno; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 20/52] common/mlx5: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (18 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 19/52] common/mlx5: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 21/52] crypto/caam_jr: replace strerror with reentrant version Dengdui Huang ` (32 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/common/mlx5/linux/mlx5_nl.c | 10 +++++----- drivers/common/mlx5/mlx5_common.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index 67fc6c08d9..165b793cc3 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -548,7 +548,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; } @@ -618,7 +618,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; @@ -705,7 +705,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; } @@ -930,7 +930,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; } @@ -957,7 +957,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; } 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; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 21/52] crypto/caam_jr: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (19 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 20/52] common/mlx5: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 22/52] dma/idxd: " Dengdui Huang ` (31 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/crypto/caam_jr/caam_jr_uio.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c index 8956f7750d..13e982c9f4 100644 --- a/drivers/crypto/caam_jr/caam_jr_uio.c +++ b/drivers/crypto/caam_jr/caam_jr_uio.c @@ -17,6 +17,7 @@ #include <rte_malloc.h> #include <rte_crypto.h> #include <rte_security.h> +#include <rte_errno.h> #include <caam_jr_config.h> #include <caam_jr_hw_specific.h> @@ -325,6 +326,7 @@ void free_job_ring(int uio_fd) { struct uio_job_ring *job_ring = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; int i; if (uio_fd == -1) @@ -353,9 +355,11 @@ free_job_ring(int uio_fd) /* Unmap the PCI memory resource of device */ if (munmap(job_ring->register_base_addr, job_ring->map_size)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); 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, errmsg); } else CAAM_JR_DEBUG("JR UIO memory is unmapped"); @@ -409,6 +413,7 @@ uio_job_ring *config_job_ring(void) int sec_configure(void) { + char errmsg[RTE_STRERR_BUFSIZE]; char uio_name[32]; int config_jr_no = 0, jr_id = -1; int uio_minor_number = -1; @@ -418,8 +423,10 @@ sec_configure(void) d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH); if (d == NULL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); CAAM_JR_ERR("Error opening directory '%s': %s", - SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno)); + SEC_UIO_DEVICE_SYS_ATTR_PATH, errmsg); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 22/52] dma/idxd: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (20 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 21/52] crypto/caam_jr: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 23/52] net/bnxt: " Dengdui Huang ` (30 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/dma/idxd/idxd_bus.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c index ba8076715d..78137f3531 100644 --- a/drivers/dma/idxd/idxd_bus.c +++ b/drivers/dma/idxd/idxd_bus.c @@ -16,6 +16,7 @@ #include <rte_log.h> #include <rte_dmadev_pmd.h> #include <rte_string_fns.h> +#include <rte_errno.h> #include "idxd_internal.h" @@ -136,6 +137,7 @@ static int read_wq_string(struct rte_dsa_device *dev, const char *filename, char *value, size_t valuelen) { + char errmsg[RTE_STRERR_BUFSIZE]; char sysfs_node[PATH_MAX]; int len; int fd; @@ -144,16 +146,20 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename, dsa_get_sysfs_path(), dev->wq_name, filename); fd = open(sysfs_node, O_RDONLY); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); IDXD_PMD_ERR("%s(): opening file '%s' failed: %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, errmsg); return -1; } len = read(fd, value, valuelen - 1); close(fd); if (len < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); IDXD_PMD_ERR("%s(): error reading file '%s': %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, errmsg); return -1; } value[len] = '\0'; @@ -164,6 +170,7 @@ static int read_wq_int(struct rte_dsa_device *dev, const char *filename, int *value) { + char errmsg[RTE_STRERR_BUFSIZE]; char sysfs_node[PATH_MAX]; FILE *f; int ret = 0; @@ -172,14 +179,18 @@ read_wq_int(struct rte_dsa_device *dev, const char *filename, dsa_get_sysfs_path(), dev->wq_name, filename); f = fopen(sysfs_node, "r"); if (f == NULL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); IDXD_PMD_ERR("%s(): opening file '%s' failed: %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, errmsg); return -1; } if (fscanf(f, "%d", value) != 1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); IDXD_PMD_ERR("%s(): error reading file '%s': %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, errmsg); ret = -1; } @@ -191,6 +202,7 @@ static int read_device_int(struct rte_dsa_device *dev, const char *filename, int *value) { + char errmsg[RTE_STRERR_BUFSIZE]; char sysfs_node[PATH_MAX]; FILE *f; int ret = 0; @@ -199,14 +211,18 @@ read_device_int(struct rte_dsa_device *dev, const char *filename, dsa_get_sysfs_path(), dev->addr.device_id, filename); f = fopen(sysfs_node, "r"); if (f == NULL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); IDXD_PMD_ERR("%s(): opening file '%s' failed: %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, errmsg); return -1; } if (fscanf(f, "%d", value) != 1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); IDXD_PMD_ERR("%s(): error reading file '%s': %s", - __func__, sysfs_node, strerror(errno)); + __func__, sysfs_node, errmsg); ret = -1; } @@ -315,6 +331,7 @@ static int dsa_scan(void) { const char *path = dsa_get_dev_path(); + char errmsg[RTE_STRERR_BUFSIZE]; struct dirent *wq; DIR *dev_dir; @@ -322,8 +339,10 @@ dsa_scan(void) if (dev_dir == NULL) { if (errno == ENOENT) return 0; /* no bus, return without error */ + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); IDXD_PMD_ERR("%s(): opendir '%s' failed: %s", - __func__, path, strerror(errno)); + __func__, path, errmsg); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 23/52] net/bnxt: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (21 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 22/52] dma/idxd: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 24/52] net/af_xdp: " Dengdui Huang ` (29 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com> --- drivers/net/bnxt/bnxt_stats.c | 8 +- drivers/net/bnxt/rte_pmd_bnxt.c | 65 ++- drivers/net/bnxt/tf_core/tf_core.c | 509 +++++++++++++----- drivers/net/bnxt/tf_core/tf_em_common.c | 56 +- .../net/bnxt/tf_core/tf_em_hash_internal.c | 10 +- drivers/net/bnxt/tf_core/tf_em_host.c | 51 +- drivers/net/bnxt/tf_core/tf_em_internal.c | 32 +- drivers/net/bnxt/tf_core/tf_global_cfg.c | 23 +- drivers/net/bnxt/tf_core/tf_identifier.c | 20 +- drivers/net/bnxt/tf_core/tf_if_tbl.c | 15 +- drivers/net/bnxt/tf_core/tf_msg.c | 347 +++++++++--- drivers/net/bnxt/tf_core/tf_rm.c | 14 +- drivers/net/bnxt/tf_core/tf_session.c | 161 ++++-- drivers/net/bnxt/tf_core/tf_sram_mgr.c | 51 +- drivers/net/bnxt/tf_core/tf_tbl.c | 62 ++- drivers/net/bnxt/tf_core/tf_tbl_sram.c | 103 +++- drivers/net/bnxt/tf_core/tf_tcam.c | 53 +- 17 files changed, 1217 insertions(+), 363 deletions(-) diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c index 5e59afe79f..07d38668f3 100644 --- a/drivers/net/bnxt/bnxt_stats.c +++ b/drivers/net/bnxt/bnxt_stats.c @@ -1172,6 +1172,7 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev, int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev) { struct bnxt *bp = eth_dev->data->dev_private; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; ret = is_bnxt_in_error(bp); @@ -1185,9 +1186,12 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev) } ret = bnxt_hwrm_port_clr_stats(bp); - if (ret != 0) + if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); PMD_DRV_LOG_LINE(ERR, "Failed to reset xstats: %s", - strerror(-ret)); + errmsg); + } bnxt_clear_prev_stat(bp); diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index e9b5739050..1b388792a3 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.c +++ b/drivers/net/bnxt/rte_pmd_bnxt.c @@ -136,6 +136,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct bnxt *bp; int rc; @@ -147,9 +148,11 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -176,6 +179,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf, { struct rte_eth_dev *eth_dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct bnxt *bp; uint32_t tot_rate = 0; uint64_t idx; @@ -189,9 +193,11 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf, rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -231,6 +237,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf, int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on) { struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_eth_dev *dev; uint32_t func_flags; struct bnxt *bp; @@ -247,9 +254,11 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on) rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -291,6 +300,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on) int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on) { struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_eth_dev *dev; struct bnxt *bp; int rc; @@ -306,9 +316,11 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on) rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -352,6 +364,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on) { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct bnxt *bp; int rc; @@ -363,9 +376,11 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on) rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -395,6 +410,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; uint16_t flag = 0; struct bnxt *bp; int rc; @@ -407,9 +423,11 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf, rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -589,6 +607,7 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct bnxt *bp; int rc; @@ -598,9 +617,11 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port, rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -625,6 +646,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct bnxt *bp; int rc; @@ -634,9 +656,11 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port, rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -659,6 +683,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id) { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct bnxt *bp; int rc; @@ -668,9 +693,11 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id) rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -694,6 +721,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct bnxt *bp; int rc; @@ -703,9 +731,11 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -734,6 +764,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, struct bnxt_filter_info *filter; struct bnxt_vnic_info vnic; struct rte_ether_addr dflt_mac; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; dev = &rte_eth_devices[port]; @@ -742,9 +773,11 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -814,6 +847,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct bnxt *bp; int rc; @@ -825,9 +859,11 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf, rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } @@ -856,6 +892,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf, int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on) { struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_eth_dev *dev; uint32_t func_flags; struct bnxt *bp; @@ -869,9 +906,11 @@ int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on) dev = &rte_eth_devices[port]; rc = rte_eth_dev_info_get(port, &dev_info); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); PMD_DRV_LOG_LINE(ERR, "Error during getting device (port %u) info: %s", - port, strerror(-rc)); + port, errmsg); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index 3a812bee3a..18c8ea3ff0 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -193,6 +193,7 @@ tf_close_session(struct tf *tfp) int tf_insert_em_entry(struct tf *tfp, struct tf_insert_em_entry_parms *parms) { + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_session *tfs; struct tf_dev_info *dev; int rc; @@ -202,20 +203,24 @@ int tf_insert_em_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -229,10 +234,12 @@ int tf_insert_em_entry(struct tf *tfp, return -EINVAL; if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: EM insert failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -248,6 +255,7 @@ int tf_insert_em_entry(struct tf *tfp, int tf_delete_em_entry(struct tf *tfp, struct tf_delete_em_entry_parms *parms) { + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_session *tfs; struct tf_dev_info *dev; int rc; @@ -258,20 +266,24 @@ int tf_delete_em_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -282,10 +294,12 @@ int tf_delete_em_entry(struct tf *tfp, rc = dev->ops->tf_dev_delete_ext_em_entry(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: EM delete failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -304,26 +318,31 @@ int tf_get_global_cfg(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -335,19 +354,23 @@ int tf_get_global_cfg(struct tf *tfp, if (dev->ops->tf_dev_get_global_cfg == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_get_global_cfg(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Global Cfg get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -366,26 +389,31 @@ int tf_set_global_cfg(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -397,19 +425,23 @@ int tf_set_global_cfg(struct tf *tfp, if (dev->ops->tf_dev_set_global_cfg == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_set_global_cfg(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Global Cfg set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -423,6 +455,7 @@ tf_alloc_identifier(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_ident_alloc_parms aparms; uint16_t id; @@ -434,29 +467,35 @@ tf_alloc_identifier(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_alloc_ident == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } @@ -465,10 +504,12 @@ tf_alloc_identifier(struct tf *tfp, aparms.id = &id; rc = dev->ops->tf_dev_alloc_ident(tfp, &aparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Identifier allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -484,6 +525,7 @@ tf_free_identifier(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_ident_free_parms fparms; TF_CHECK_PARMS2(tfp, parms); @@ -494,29 +536,35 @@ tf_free_identifier(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_free_ident == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } @@ -526,10 +574,12 @@ tf_free_identifier(struct tf *tfp, fparms.ref_cnt = &parms->ref_cnt; rc = dev->ops->tf_dev_free_ident(tfp, &fparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Identifier free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -543,6 +593,7 @@ tf_search_identifier(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_ident_search_parms sparms; TF_CHECK_PARMS2(tfp, parms); @@ -553,29 +604,35 @@ tf_search_identifier(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_search_ident == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -586,10 +643,12 @@ tf_search_identifier(struct tf *tfp, sparms.ref_cnt = &parms->ref_cnt; rc = dev->ops->tf_dev_search_ident(tfp, &sparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Identifier search failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -603,6 +662,7 @@ tf_search_tcam_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tcam_alloc_search_parms sparms; TF_CHECK_PARMS2(tfp, parms); @@ -612,29 +672,35 @@ tf_search_tcam_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_alloc_search_tcam == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -653,10 +719,12 @@ tf_search_tcam_entry(struct tf *tfp, rc = dev->ops->tf_dev_alloc_search_tcam(tfp, &sparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: TCAM allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -676,6 +744,7 @@ tf_alloc_tcam_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tcam_alloc_parms aparms; TF_CHECK_PARMS2(tfp, parms); @@ -685,29 +754,35 @@ tf_alloc_tcam_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_alloc_tcam == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -717,10 +792,12 @@ tf_alloc_tcam_entry(struct tf *tfp, aparms.priority = parms->priority; rc = dev->ops->tf_dev_alloc_tcam(tfp, &aparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: TCAM allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -736,6 +813,7 @@ tf_set_tcam_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tcam_set_parms sparms; TF_CHECK_PARMS2(tfp, parms); @@ -745,30 +823,36 @@ tf_set_tcam_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_set_tcam == NULL || dev->ops->tf_dev_word_align == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -783,10 +867,12 @@ tf_set_tcam_entry(struct tf *tfp, rc = dev->ops->tf_dev_set_tcam(tfp, &sparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: TCAM set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } TFP_DRV_LOG(DEBUG, @@ -804,6 +890,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tcam_get_parms gparms; TF_CHECK_PARMS2(tfp, parms); @@ -813,29 +900,35 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_get_tcam == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -850,10 +943,12 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused, rc = dev->ops->tf_dev_get_tcam(tfp, &gparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: TCAM get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } parms->key_sz_in_bits = gparms.key_size * 8; @@ -869,6 +964,7 @@ tf_free_tcam_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tcam_free_parms fparms; TF_CHECK_PARMS2(tfp, parms); @@ -878,29 +974,35 @@ tf_free_tcam_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_free_tcam == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -909,10 +1011,12 @@ tf_free_tcam_entry(struct tf *tfp, fparms.idx = parms->idx; rc = dev->ops->tf_dev_free_tcam(tfp, &fparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: TCAM free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -926,44 +1030,53 @@ tf_move_tcam_shared_entries(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_move_tcam == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } rc = dev->ops->tf_dev_move_tcam(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: TCAM shared entries move failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -977,44 +1090,53 @@ tf_clear_tcam_shared_entries(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_clear_tcam == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } rc = dev->ops->tf_dev_clear_tcam(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: TCAM shared entries clear failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1028,6 +1150,7 @@ tf_alloc_tbl_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_alloc_parms aparms; uint32_t idx; @@ -1039,20 +1162,24 @@ tf_alloc_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1064,37 +1191,45 @@ tf_alloc_tbl_entry(struct tf *tfp, if (parms->type == TF_TBL_TYPE_EXT) { if (dev->ops->tf_dev_alloc_ext_tbl == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_alloc_ext_tbl(tfp, &aparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: External table allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { rc = dev->ops->tf_dev_alloc_sram_tbl(tfp, &aparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: SRAM table allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } else { rc = dev->ops->tf_dev_alloc_tbl(tfp, &aparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Table allocation failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } @@ -1111,6 +1246,7 @@ tf_free_tbl_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_free_parms fparms; TF_CHECK_PARMS2(tfp, parms); @@ -1121,20 +1257,24 @@ tf_free_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1146,38 +1286,46 @@ tf_free_tbl_entry(struct tf *tfp, if (parms->type == TF_TBL_TYPE_EXT) { if (dev->ops->tf_dev_free_ext_tbl == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_free_ext_tbl(tfp, &fparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Table free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { rc = dev->ops->tf_dev_free_sram_tbl(tfp, &fparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: SRAM table free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } else { rc = dev->ops->tf_dev_free_tbl(tfp, &fparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Table free failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } @@ -1191,6 +1339,7 @@ tf_set_tbl_entry(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_set_parms sparms; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -1201,20 +1350,24 @@ tf_set_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1228,46 +1381,56 @@ tf_set_tbl_entry(struct tf *tfp, if (parms->type == TF_TBL_TYPE_EXT) { if (dev->ops->tf_dev_set_ext_tbl == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_set_ext_tbl(tfp, &sparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Table set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { rc = dev->ops->tf_dev_set_sram_tbl(tfp, &sparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: SRAM table set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } else { if (dev->ops->tf_dev_set_tbl == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_set_tbl(tfp, &sparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Table set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } @@ -1282,6 +1445,7 @@ tf_get_tbl_entry(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_get_parms gparms; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -1292,20 +1456,24 @@ tf_get_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } gparms.dir = parms->dir; @@ -1317,28 +1485,34 @@ tf_get_tbl_entry(struct tf *tfp, if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { rc = dev->ops->tf_dev_get_sram_tbl(tfp, &gparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: SRAM table get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } else { if (dev->ops->tf_dev_get_tbl == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_get_tbl(tfp, &gparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Table get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } } @@ -1353,6 +1527,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_get_bulk_parms bparms; TF_CHECK_PARMS2(tfp, parms); @@ -1363,20 +1538,24 @@ tf_bulk_get_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1390,38 +1569,46 @@ tf_bulk_get_tbl_entry(struct tf *tfp, if (parms->type == TF_TBL_TYPE_EXT) { /* Not supported, yet */ rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, External table type not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) { rc = dev->ops->tf_dev_get_bulk_sram_tbl(tfp, &bparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: SRAM table bulk get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); } return rc; } if (dev->ops->tf_dev_get_bulk_tbl == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_get_bulk_tbl(tfp, &bparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Table get bulk failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } return rc; @@ -1433,26 +1620,31 @@ int tf_get_shared_tbl_increment(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1460,19 +1652,23 @@ int tf_get_shared_tbl_increment(struct tf *tfp, if (dev->ops->tf_dev_get_shared_tbl_increment == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } rc = dev->ops->tf_dev_get_shared_tbl_increment(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Get table increment not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1485,6 +1681,7 @@ tf_alloc_tbl_scope(struct tf *tfp, { struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; TF_CHECK_PARMS2(tfp, parms); @@ -1492,18 +1689,22 @@ tf_alloc_tbl_scope(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1523,6 +1724,7 @@ tf_map_tbl_scope(struct tf *tfp, { struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; TF_CHECK_PARMS2(tfp, parms); @@ -1530,18 +1732,22 @@ tf_map_tbl_scope(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1562,6 +1768,7 @@ tf_free_tbl_scope(struct tf *tfp, { struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; TF_CHECK_PARMS2(tfp, parms); @@ -1569,18 +1776,22 @@ tf_free_tbl_scope(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1602,6 +1813,7 @@ tf_set_if_tbl_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_if_tbl_set_parms sparms = { 0 }; TF_CHECK_PARMS2(tfp, parms); @@ -1609,29 +1821,35 @@ tf_set_if_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_set_if_tbl == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1643,10 +1861,12 @@ tf_set_if_tbl_entry(struct tf *tfp, rc = dev->ops->tf_dev_set_if_tbl(tfp, &sparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: If_tbl set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1660,6 +1880,7 @@ tf_get_if_tbl_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_if_tbl_get_parms gparms = { 0 }; TF_CHECK_PARMS2(tfp, parms); @@ -1667,29 +1888,35 @@ tf_get_if_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } if (dev->ops->tf_dev_get_if_tbl == NULL) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1701,10 +1928,12 @@ tf_get_if_tbl_entry(struct tf *tfp, rc = dev->ops->tf_dev_get_if_tbl(tfp, &gparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: If_tbl get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1717,24 +1946,29 @@ int tf_get_session_info(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1742,62 +1976,78 @@ int tf_get_session_info(struct tf *tfp, if (dev->ops->tf_dev_get_ident_resc_info == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = dev->ops->tf_dev_get_ident_resc_info(tfp, parms->session_info.ident); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Ident get resc info failed, rc:%s\n", - strerror(-rc)); + errmsg); } if (dev->ops->tf_dev_get_tbl_resc_info == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = dev->ops->tf_dev_get_tbl_resc_info(tfp, parms->session_info.tbl); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Tbl get resc info failed, rc:%s\n", - strerror(-rc)); + errmsg); } if (dev->ops->tf_dev_get_tcam_resc_info == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = dev->ops->tf_dev_get_tcam_resc_info(tfp, parms->session_info.tcam); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "TCAM get resc info failed, rc:%s\n", - strerror(-rc)); + errmsg); } if (dev->ops->tf_dev_get_em_resc_info == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = dev->ops->tf_dev_get_em_resc_info(tfp, parms->session_info.em); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "EM get resc info failed, rc:%s\n", - strerror(-rc)); + errmsg); } return 0; @@ -1839,6 +2089,7 @@ int tf_query_sram_resources(struct tf *tfp, struct tf_dev_info dev; uint16_t max_types; struct tfp_calloc_parms cparms; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_rm_resc_req_entry *query; enum tf_rm_resc_resv_strategy resv_strategy; @@ -1858,19 +2109,23 @@ int tf_query_sram_resources(struct tf *tfp, if (dev.ops->tf_dev_get_max_types == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } /* Need device max number of elements for the RM QCAPS */ rc = dev.ops->tf_dev_get_max_types(tfp, &max_types); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Get SRAM resc info failed, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1898,10 +2153,12 @@ int tf_query_sram_resources(struct tf *tfp, if (dev.ops->tf_dev_get_sram_resources == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return -EOPNOTSUPP; } @@ -1909,9 +2166,11 @@ int tf_query_sram_resources(struct tf *tfp, parms->bank_resc_count, &parms->dynamic_sram_capable); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Get SRAM resc info failed, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1923,6 +2182,7 @@ int tf_set_sram_policy(struct tf *tfp, { int rc = 0; struct tf_dev_info dev; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -1940,19 +2200,23 @@ int tf_set_sram_policy(struct tf *tfp, if (dev.ops->tf_dev_set_sram_policy == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } rc = dev.ops->tf_dev_set_sram_policy(parms->dir, parms->bank_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: SRAM policy set failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1964,6 +2228,7 @@ int tf_get_sram_policy(struct tf *tfp, { int rc = 0; struct tf_dev_info dev; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -1981,19 +2246,23 @@ int tf_get_sram_policy(struct tf *tfp, if (dev.ops->tf_dev_get_sram_policy == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } rc = dev.ops->tf_dev_get_sram_policy(parms->dir, parms->bank_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: SRAM policy get failed, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); 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..2d5e32816c 100644 --- a/drivers/net/bnxt/tf_core/tf_em_common.c +++ b/drivers/net/bnxt/tf_core/tf_em_common.c @@ -43,6 +43,7 @@ tf_create_tbl_pool_external(enum tf_dir dir, uint32_t i; int32_t j; int rc = 0; + char errmsg[RTE_STRERR_BUFSIZE]; struct stack *pool = &tbl_scope_cb->ext_act_pool[dir]; parms.nitems = num_entries; @@ -50,8 +51,10 @@ tf_create_tbl_pool_external(enum tf_dir dir, parms.alignment = 0; if (tfp_calloc(&parms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "%s: TBL: external pool failure %s\n", - tf_dir_2_str(dir), strerror(ENOMEM)); + tf_dir_2_str(dir), errmsg); return -ENOMEM; } @@ -60,8 +63,10 @@ tf_create_tbl_pool_external(enum tf_dir dir, rc = stack_init(num_entries, parms.mem_va, pool); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: TBL: stack init failure %s\n", - tf_dir_2_str(dir), strerror(-rc)); + tf_dir_2_str(dir), errmsg); goto cleanup; } @@ -77,8 +82,10 @@ tf_create_tbl_pool_external(enum tf_dir dir, for (i = 0; i < num_entries; i++) { rc = stack_push(pool, j); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n", - tf_dir_2_str(dir), strerror(-rc)); + tf_dir_2_str(dir), errmsg); goto cleanup; } @@ -92,8 +99,10 @@ tf_create_tbl_pool_external(enum tf_dir dir, if (!stack_is_full(pool)) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n", - tf_dir_2_str(dir), strerror(-rc)); + tf_dir_2_str(dir), errmsg); goto cleanup; } return 0; @@ -913,6 +922,7 @@ tf_em_ext_common_bind(struct tf *tfp, struct tf_rm_create_db_parms db_cfg = { 0 }; struct em_ext_db *ext_db; struct tfp_calloc_parms cparms; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -920,8 +930,10 @@ tf_em_ext_common_bind(struct tf *tfp, cparms.size = sizeof(struct em_ext_db); cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "em_ext_db alloc error %s\n", - strerror(ENOMEM)); + errmsg); return -ENOMEM; } @@ -974,30 +986,37 @@ tf_em_ext_common_unbind(struct tf *tfp) struct tf_tbl_scope_cb *tbl_scope_cb = NULL; void *ext_ptr = NULL; struct tf_free_tbl_scope_parms tparms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS1(tfp); rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_em_ext_db(tfp, &ext_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1129,6 +1148,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, { int rc = 0; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_scope_cb *tbl_scope_cb; struct tf_global_cfg_parms gcfg_parms = { 0 }; struct tfp_calloc_parms aparms; @@ -1155,9 +1175,11 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, if (dev->ops->tf_dev_map_tbl_scope == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Map table scope operation not supported, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1166,15 +1188,19 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, aparms.alignment = 0; if (tfp_calloc(&aparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "Map tbl scope alloc data error %s\n", - strerror(ENOMEM)); + errmsg); return -ENOMEM; } data = aparms.mem_va; if (tfp_calloc(&aparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "Map tbl scope alloc mask error %s\n", - strerror(ENOMEM)); + errmsg); rc = -ENOMEM; goto clean; } @@ -1186,9 +1212,11 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, sz_in_bytes); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Map table scope config failure, rc:%s\n", - strerror(-rc)); + errmsg); goto cleaner; } @@ -1201,9 +1229,11 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, rc = tf_msg_set_global_cfg(tfp, &gcfg_parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Map tbl scope, set failed, rc:%s\n", - strerror(-rc)); + errmsg); } 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 9c527e152d..f18097a76b 100644 --- a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c +++ b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c @@ -124,13 +124,16 @@ tf_em_hash_delete_int_entry(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct dpool *pool; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -158,14 +161,17 @@ tf_em_move_int_entry(struct tf *tfp, int rc = 0; struct dpool *pool; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); 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..1b31032fe8 100644 --- a/drivers/net/bnxt/tf_core/tf_em_host.c +++ b/drivers/net/bnxt/tf_core/tf_em_host.c @@ -168,6 +168,7 @@ static int tf_em_alloc_page_table(struct hcapi_cfa_em_table *tbl) { struct hcapi_cfa_em_page_tbl *tp; + char errmsg[RTE_STRERR_BUFSIZE]; int rc = 0; int i; uint32_t j; @@ -179,10 +180,12 @@ tf_em_alloc_page_table(struct hcapi_cfa_em_table *tbl) tbl->page_cnt[i], TF_EM_PAGE_SIZE); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(WARNING, "Failed to allocate page table: lvl: %d, rc:%s\n", i, - strerror(-rc)); + errmsg); goto cleanup; } @@ -365,6 +368,7 @@ tf_em_ext_alloc(struct tf *tfp, { int rc; enum tf_dir dir; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_scope_cb *tbl_scope_cb; struct hcapi_cfa_em_table *em_tables; struct tf_free_tbl_scope_parms free_parms; @@ -378,25 +382,31 @@ tf_em_ext_alloc(struct tf *tfp, rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_em_ext_db(tfp, &ext_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } ext_db = (struct em_ext_db *)ext_ptr; rc = tfp_get_pf(tfp, &pf); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "EEM: PF query error rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup; } @@ -417,10 +427,12 @@ tf_em_ext_alloc(struct tf *tfp, cparms.alignment = 0; rc = tfp_calloc(&cparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate session table scope, rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup; } @@ -433,10 +445,12 @@ tf_em_ext_alloc(struct tf *tfp, dir, &tbl_scope_cb->em_caps[dir]); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "EEM: Unable to query for EEM capability," " rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup_ts; } } @@ -453,10 +467,12 @@ tf_em_ext_alloc(struct tf *tfp, */ rc = tf_em_ctx_reg(tfp, tbl_scope_cb, dir); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "EEM: Unable to register for EEM ctx," " rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup_ts; } @@ -470,10 +486,12 @@ tf_em_ext_alloc(struct tf *tfp, parms->hw_flow_cache_flush_timer, dir); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "TBL: Unable to configure EEM in firmware" " rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup_full; } @@ -482,10 +500,12 @@ tf_em_ext_alloc(struct tf *tfp, HWRM_TF_EXT_EM_OP_INPUT_OP_EXT_EM_ENABLE); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "EEM: Unable to enable EEM in firmware" " rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup_full; } @@ -498,10 +518,12 @@ tf_em_ext_alloc(struct tf *tfp, em_tables[TF_RECORD_TABLE].num_entries, em_tables[TF_RECORD_TABLE].entry_size); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s TBL: Unable to allocate idx pools %s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); goto cleanup_full; } } @@ -538,6 +560,7 @@ tf_em_ext_free(struct tf *tfp, { int rc = 0; enum tf_dir dir; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_scope_cb *tbl_scope_cb; struct tf_session *tfs; struct em_ext_db *ext_db = NULL; @@ -546,16 +569,20 @@ tf_em_ext_free(struct tf *tfp, rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n", - strerror(-rc)); + errmsg); return -EINVAL; } rc = tf_session_get_em_ext_db(tfp, &ext_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); 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 7f7a663789..0145c4778d 100644 --- a/drivers/net/bnxt/tf_core/tf_em_internal.c +++ b/drivers/net/bnxt/tf_core/tf_em_internal.c @@ -38,6 +38,7 @@ tf_em_insert_int_entry(struct tf *tfp, uint32_t gfid; uint16_t rptr_index = 0; uint8_t rptr_entry = 0; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t num_of_entries = 0; struct tf_session *tfs; struct dpool *pool; @@ -46,10 +47,12 @@ tf_em_insert_int_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -107,13 +110,16 @@ tf_em_delete_int_entry(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct dpool *pool; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -136,6 +142,7 @@ tf_em_move_callback(void *user_data, int rc; struct tf *tfp = (struct tf *)user_data; struct tf_move_em_entry_parms parms; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_dev_info *dev; struct tf_session *tfs; @@ -150,20 +157,24 @@ tf_em_move_callback(void *user_data, /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(parms.dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(parms.dir), - strerror(-rc)); + errmsg); return rc; } @@ -184,6 +195,7 @@ tf_em_int_bind(struct tf *tfp, int i; struct tf_rm_create_db_parms db_cfg = { 0 }; struct tf_rm_get_alloc_info_parms iparms; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_rm_alloc_info info; struct em_rm_db *em_db; struct tfp_calloc_parms cparms; @@ -201,8 +213,10 @@ tf_em_int_bind(struct tf *tfp, cparms.size = sizeof(struct em_rm_db); cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "em_rm_db alloc error %s\n", - strerror(ENOMEM)); + errmsg); return -ENOMEM; } @@ -228,11 +242,13 @@ tf_em_int_bind(struct tf *tfp, if (db_cfg.alloc_cnt[TF_EM_TBL_TYPE_EM_RECORD] % TF_SESSION_EM_ENTRY_SIZE != 0) { rc = -ENOMEM; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, EM Allocation must be in blocks of %d, failure %s\n", tf_dir_2_str(i), TF_SESSION_EM_ENTRY_SIZE, - strerror(-rc)); + errmsg); return rc; } @@ -275,10 +291,12 @@ tf_em_int_bind(struct tf *tfp, rc = tfp_calloc(&cparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, EM stack allocation failure %s\n", tf_dir_2_str(i), - strerror(-rc)); + errmsg); 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..356165de89 100644 --- a/drivers/net/bnxt/tf_core/tf_global_cfg.c +++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c @@ -74,6 +74,7 @@ tf_global_cfg_bind(struct tf *tfp, struct tf_global_cfg_cfg_parms *parms) { struct tfp_calloc_parms cparms; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_global_cfg_db *global_cfg_db; TF_CHECK_PARMS2(tfp, parms); @@ -82,8 +83,10 @@ tf_global_cfg_bind(struct tf *tfp, cparms.size = sizeof(struct tf_global_cfg_db); cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "global_rm_db alloc error %s\n", - strerror(ENOMEM)); + errmsg); return -ENOMEM; } @@ -121,6 +124,7 @@ tf_global_cfg_set(struct tf *tfp, int rc; struct tf_global_cfg_get_hcapi_parms hparms; struct tf_global_cfg_db *global_cfg_db_ptr; + char errmsg[RTE_STRERR_BUFSIZE]; uint16_t hcapi_type; TF_CHECK_PARMS3(tfp, parms, parms->config); @@ -137,21 +141,25 @@ tf_global_cfg_set(struct tf *tfp, hparms.hcapi_type = &hcapi_type; rc = tf_global_cfg_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + errmsg); return rc; } rc = tf_msg_set_global_cfg(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Set failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + errmsg); } return 0; @@ -165,6 +173,7 @@ tf_global_cfg_get(struct tf *tfp, int rc; struct tf_global_cfg_get_hcapi_parms hparms; struct tf_global_cfg_db *global_cfg_db_ptr; + char errmsg[RTE_STRERR_BUFSIZE]; uint16_t hcapi_type; TF_CHECK_PARMS3(tfp, parms, parms->config); @@ -181,22 +190,26 @@ tf_global_cfg_get(struct tf *tfp, hparms.hcapi_type = &hcapi_type; rc = tf_global_cfg_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + errmsg); return rc; } /* Get the entry */ rc = tf_msg_get_global_cfg(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Get failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + errmsg); } return 0; diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c index 7d9d9595dd..b89d9c0da0 100644 --- a/drivers/net/bnxt/tf_core/tf_identifier.c +++ b/drivers/net/bnxt/tf_core/tf_identifier.c @@ -24,6 +24,7 @@ tf_ident_bind(struct tf *tfp, struct tf_rm_create_db_parms db_cfg = { 0 }; struct ident_rm_db *ident_db; struct tfp_calloc_parms cparms; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_session *tfs; TF_CHECK_PARMS2(tfp, parms); @@ -38,8 +39,10 @@ tf_ident_bind(struct tf *tfp, cparms.size = sizeof(struct ident_rm_db); cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "ident_rm_db alloc error %s\n", - strerror(ENOMEM)); + rte_strerror(ENOMEM)); return -ENOMEM; } @@ -114,6 +117,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused, int rc; uint32_t id; uint32_t base_id; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_rm_allocate_parms aparms = { 0 }; struct ident_rm_db *ident_db; void *ident_db_ptr = NULL; @@ -122,9 +126,11 @@ tf_ident_alloc(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get ident_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } ident_db = (struct ident_rm_db *)ident_db_ptr; @@ -153,6 +159,7 @@ tf_ident_free(struct tf *tfp __rte_unused, int rc; struct tf_rm_is_allocated_parms aparms = { 0 }; struct tf_rm_free_parms fparms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; int allocated = 0; uint32_t base_id; struct ident_rm_db *ident_db; @@ -162,9 +169,11 @@ tf_ident_free(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get ident_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } ident_db = (struct ident_rm_db *)ident_db_ptr; @@ -211,6 +220,7 @@ tf_ident_search(struct tf *tfp __rte_unused, { int rc; struct tf_rm_is_allocated_parms aparms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; int allocated = 0; uint32_t base_id; struct ident_rm_db *ident_db; @@ -220,9 +230,11 @@ tf_ident_search(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get ident_db from session, rc:%s\n", - strerror(-rc)); + errmsg); 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..cbbade789e 100644 --- a/drivers/net/bnxt/tf_core/tf_if_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c @@ -57,6 +57,7 @@ tf_if_tbl_bind(struct tf *tfp, { struct tfp_calloc_parms cparms; struct tf_if_tbl_db *if_tbl_db; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -64,8 +65,10 @@ tf_if_tbl_bind(struct tf *tfp, cparms.size = sizeof(struct tf_if_tbl_db); cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "if_tbl_rm_db alloc error %s\n", - strerror(ENOMEM)); + errmsg); return -ENOMEM; } @@ -111,6 +114,7 @@ tf_if_tbl_set(struct tf *tfp, struct tf_if_tbl_set_parms *parms) { int rc; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_if_tbl_db *if_tbl_db_ptr = NULL; struct tf_if_tbl_get_hcapi_parms hparms; @@ -139,11 +143,13 @@ tf_if_tbl_set(struct tf *tfp, rc = tf_msg_set_if_tbl_entry(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, If Tbl set failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + errmsg); } return 0; @@ -154,6 +160,7 @@ tf_if_tbl_get(struct tf *tfp, struct tf_if_tbl_get_parms *parms) { int rc = 0; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_if_tbl_db *if_tbl_db_ptr = NULL; struct tf_if_tbl_get_hcapi_parms hparms; @@ -183,11 +190,13 @@ tf_if_tbl_get(struct tf *tfp, /* Get the entry */ rc = tf_msg_get_if_tbl_entry(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, If Tbl get failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, - strerror(-rc)); + errmsg); } return 0; diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c index 1c66c7e01a..9793918519 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.c +++ b/drivers/net/bnxt/tf_core/tf_msg.c @@ -205,6 +205,7 @@ tf_msg_session_client_register(struct tf *tfp, struct hwrm_tf_session_register_input req = { 0 }; struct hwrm_tf_session_register_output resp = { 0 }; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t fw_session_id; struct tf_dev_info *dev; char *session_name; @@ -214,17 +215,21 @@ tf_msg_session_client_register(struct tf *tfp, /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -283,23 +288,28 @@ tf_msg_session_client_unregister(struct tf *tfp, struct hwrm_tf_session_unregister_input req = { 0 }; struct hwrm_tf_session_unregister_output resp = { 0 }; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t fw_session_id; struct tf_dev_info *dev; /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -352,6 +362,7 @@ tf_msg_session_qcfg(struct tf *tfp) struct hwrm_tf_session_qcfg_input req = { 0 }; struct hwrm_tf_session_qcfg_output resp = { 0 }; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; @@ -359,26 +370,32 @@ tf_msg_session_qcfg(struct tf *tfp) /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -413,6 +430,7 @@ tf_msg_session_resc_qcaps(struct tf *tfp, struct hwrm_tf_session_resc_qcaps_output resp = { 0 }; struct tf_msg_dma_buf qcaps_buf = { 0 }; struct tf_rm_resc_req_entry *data; + char errmsg[RTE_STRERR_BUFSIZE]; int dma_size; TF_CHECK_PARMS3(tfp, query, resv_strategy); @@ -444,10 +462,12 @@ tf_msg_session_resc_qcaps(struct tf *tfp, * Should always get expected number of entries */ if (tfp_le_to_cpu_32(resp.size) != size) { + if (strerror_r(EINVAL, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", EINVAL); TFP_DRV_LOG(WARNING, "%s: QCAPS message size error, rc:%s, request %d vs response %d\n", tf_dir_2_str(dir), - strerror(EINVAL), + errmsg, size, resp.size); } @@ -490,15 +510,18 @@ tf_msg_session_resc_alloc(struct tf *tfp, struct tf_msg_dma_buf resv_buf = { 0 }; struct tf_rm_resc_req_entry *req_data; struct tf_rm_resc_entry *resv_data; + char errmsg[RTE_STRERR_BUFSIZE]; int dma_size; struct tf_session *tfs; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -506,10 +529,12 @@ tf_msg_session_resc_alloc(struct tf *tfp, rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } @@ -556,10 +581,12 @@ tf_msg_session_resc_alloc(struct tf *tfp, * Should always get expected number of entries */ if (tfp_le_to_cpu_32(resp.size) != size) { + if (strerror_r(EINVAL, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", EINVAL); TFP_DRV_LOG(ERR, "%s: Alloc message size error, rc:%s\n", tf_dir_2_str(dir), - strerror(EINVAL)); + errmsg); rc = -EINVAL; goto cleanup; } @@ -597,15 +624,18 @@ tf_msg_session_resc_info(struct tf *tfp, struct tf_msg_dma_buf resv_buf = { 0 }; struct tf_rm_resc_req_entry *req_data; struct tf_rm_resc_entry *resv_data; + char errmsg[RTE_STRERR_BUFSIZE]; int dma_size; struct tf_session *tfs; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -613,10 +643,12 @@ tf_msg_session_resc_info(struct tf *tfp, rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } @@ -663,10 +695,12 @@ tf_msg_session_resc_info(struct tf *tfp, * Should always get expected number of entries */ if (tfp_le_to_cpu_32(resp.size) != size) { + if (strerror_r(EINVAL, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", EINVAL); TFP_DRV_LOG(ERR, "%s: Alloc message size error, rc:%s\n", tf_dir_2_str(dir), - strerror(EINVAL)); + errmsg); rc = -EINVAL; goto cleanup; } @@ -703,16 +737,19 @@ tf_msg_session_resc_flush(struct tf *tfp, int dma_size; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, resv); /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } @@ -722,16 +759,18 @@ 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)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } @@ -787,6 +826,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp, uint8_t msg_key_size; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; RTE_BUILD_BUG_ON(sizeof(struct hwrm_tf_em_insert_input) != TF_MSG_SIZE_HWRM_TF_EM_INSERT); @@ -794,29 +834,35 @@ tf_msg_insert_em_internal_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -827,10 +873,12 @@ tf_msg_insert_em_internal_entry(struct tf *tfp, msg_key_size = (em_parms->key_sz_in_bits + 7) / 8; if (msg_key_size > TF_MSG_EM_INSERT_KEY_SIZE) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Invalid parameters for msg type, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -886,33 +934,40 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp, uint8_t msg_record_size; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -924,10 +979,12 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp, if (msg_record_size > TF_MSG_EM_INSERT_RECORD_SIZE) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Record size to large, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -975,33 +1032,40 @@ tf_msg_delete_em_entry(struct tf *tfp, uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1043,33 +1107,40 @@ tf_msg_move_em_entry(struct tf *tfp, uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(em_parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1114,22 +1185,27 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp, struct tf_dev_info *dev; struct tf_session *tfs; uint32_t fw_se_id; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the session information */ @@ -1148,8 +1224,10 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp, parms.mailbox = dev->ops->tf_dev_get_mailbox(); rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed ext_em_alloc error rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1174,22 +1252,27 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp, struct tf_dev_info *dev; struct tf_session *tfs; uint32_t fw_se_id; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the session information */ @@ -1222,6 +1305,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp, struct hwrm_tf_ctxt_mem_rgtr_input req = { 0 }; struct hwrm_tf_ctxt_mem_rgtr_output resp = { 0 }; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_dev_info *dev; struct tf_session *tfs; uint32_t fw_se_id; @@ -1229,18 +1313,22 @@ tf_msg_em_mem_rgtr(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } fw_se_id = tfs->session_id.internal.fw_session_id; @@ -1275,6 +1363,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp, struct hwrm_tf_ctxt_mem_unrgtr_input req = {0}; struct hwrm_tf_ctxt_mem_unrgtr_output resp = {0}; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_dev_info *dev; struct tf_session *tfs; uint32_t fw_se_id; @@ -1282,18 +1371,22 @@ tf_msg_em_mem_unrgtr(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1324,6 +1417,7 @@ tf_msg_em_qcaps(struct tf *tfp, struct hwrm_tf_ext_em_qcaps_output resp = { 0 }; uint32_t flags; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_dev_info *dev; struct tf_session *tfs; uint32_t fw_se_id; @@ -1331,10 +1425,12 @@ tf_msg_em_qcaps(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } fw_se_id = tfs->session_id.internal.fw_session_id; @@ -1342,10 +1438,12 @@ tf_msg_em_qcaps(struct tf *tfp, /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } @@ -1392,26 +1490,31 @@ tf_msg_em_cfg(struct tf *tfp, struct hwrm_tf_ext_em_cfg_output resp = {0}; uint32_t flags; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_dev_info *dev; struct tf_session *tfs; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } @@ -1453,6 +1556,7 @@ tf_msg_ext_em_cfg(struct tf *tfp, struct hwrm_tf_ext_em_cfg_input req = {0}; struct hwrm_tf_ext_em_cfg_output resp = {0}; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint32_t flags; struct tf_dev_info *dev; struct tf_session *tfs; @@ -1462,20 +1566,24 @@ tf_msg_ext_em_cfg(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } fw_se_id = tfs->session_id.internal.fw_session_id; @@ -1527,24 +1635,29 @@ tf_msg_em_op(struct tf *tfp, struct tfp_send_msg_parms parms = { 0 }; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } @@ -1575,6 +1688,7 @@ tf_msg_tcam_entry_set(struct tf *tfp, struct hwrm_tf_tcam_set_input req = { 0 }; struct hwrm_tf_tcam_set_output resp = { 0 }; struct tf_msg_dma_buf buf = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t *data = NULL; int data_size = 0; uint8_t fw_session_id; @@ -1583,18 +1697,22 @@ tf_msg_tcam_entry_set(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1656,24 +1774,29 @@ tf_msg_tcam_entry_get(struct tf *tfp, struct tfp_send_msg_parms mparms = { 0 }; struct hwrm_tf_tcam_get_input req = { 0 }; struct hwrm_tf_tcam_get_output resp = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t fw_session_id; struct tf_session *tfs; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1700,12 +1823,14 @@ tf_msg_tcam_entry_get(struct tf *tfp, if (parms->key_size < resp.key_size || parms->result_size < resp.result_size) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Key buffer(%d) is smaller than the key(%d), rc:%s\n", tf_dir_2_str(parms->dir), parms->key_size, resp.key_size, - strerror(-rc)); + errmsg); return rc; } parms->key_size = resp.key_size; @@ -1726,6 +1851,7 @@ tf_msg_tcam_entry_free(struct tf *tfp, struct hwrm_tf_tcam_free_input req = { 0 }; struct hwrm_tf_tcam_free_output resp = { 0 }; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t fw_session_id; struct tf_session *tfs; @@ -1734,16 +1860,18 @@ tf_msg_tcam_entry_free(struct tf *tfp, if (rc) { TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(in_parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1780,6 +1908,7 @@ tf_msg_set_tbl_entry(struct tf *tfp, struct hwrm_tf_tbl_type_set_output resp = { 0 }; struct tfp_send_msg_parms parms = { 0 }; struct tf_msg_dma_buf buf = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; @@ -1790,29 +1919,35 @@ tf_msg_set_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } @@ -1866,6 +2001,7 @@ tf_msg_get_tbl_entry(struct tf *tfp, struct hwrm_tf_tbl_type_get_input req = { 0 }; struct hwrm_tf_tbl_type_get_output resp = { 0 }; struct tfp_send_msg_parms parms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; @@ -1874,29 +2010,35 @@ tf_msg_get_tbl_entry(struct tf *tfp, /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } flags = (dir == TF_DIR_TX ? @@ -1957,33 +2099,40 @@ tf_msg_get_global_cfg(struct tf *tfp, uint16_t resp_size = 0; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } @@ -2036,33 +2185,40 @@ tf_msg_set_global_cfg(struct tf *tfp, uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } @@ -2079,10 +2235,12 @@ tf_msg_set_global_cfg(struct tf *tfp, /* Check for data size conformity */ if (params->config_sz_in_bytes > TF_MSG_SET_GLOBAL_CFG_DATA_SIZE) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Invalid parameters for msg type, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } @@ -2133,33 +2291,40 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp, struct tf_dev_info *dev; struct tf_session *tfs; uint32_t flags = 0; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Unable to lookup FW id, rc:%s\n", tf_dir_2_str(dir), - strerror(-rc)); + errmsg); return rc; } flags = (dir == TF_DIR_TX ? @@ -2210,24 +2375,29 @@ tf_msg_get_if_tbl_entry(struct tf *tfp, uint32_t flags = 0; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup device, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } @@ -2271,14 +2441,17 @@ tf_msg_set_if_tbl_entry(struct tf *tfp, uint32_t flags = 0; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Failed to lookup session, rc:%s\n", tf_dir_2_str(params->dir), - strerror(-rc)); + errmsg); return rc; } @@ -2360,30 +2533,37 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state) uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -2415,30 +2595,37 @@ tf_msg_session_get_hotup_state(struct tf *tfp, uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } /* Retrieve the device information */ rc = tf_session_get_device(tfs, &dev); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup device, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c index 9b85f5397d..8d6ef5277c 100644 --- a/drivers/net/bnxt/tf_core/tf_rm.c +++ b/drivers/net/bnxt/tf_core/tf_rm.c @@ -1045,6 +1045,7 @@ tf_rm_get_pool(struct tf_rm_new_db *rm_db, { int rc = 0; uint16_t tmp_subtype = subtype; + char errmsg[RTE_STRERR_BUFSIZE]; /* If we are a child, get the parent table index */ if (rm_db->db[subtype].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD) @@ -1055,11 +1056,13 @@ tf_rm_get_pool(struct tf_rm_new_db *rm_db, /* Bail out if the pool is not valid, should never happen */ if (rm_db->db[tmp_subtype].pool == NULL) { rc = -ENOTSUP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Invalid pool for this type:%d, rc:%s\n", tf_dir_2_str(rm_db->dir), tmp_subtype, - strerror(-rc)); + errmsg); return rc; } *new_subtype = tmp_subtype; @@ -1073,6 +1076,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms) int id; uint32_t index; struct tf_rm_new_db *rm_db; + char errmsg[RTE_STRERR_BUFSIZE]; enum tf_rm_elem_cfg_type cfg_type; struct bitalloc *pool; uint16_t subtype; @@ -1103,10 +1107,12 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms) id = ba_alloc(pool); if (id == BA_FAIL) { rc = -ENOMEM; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Allocation failed, rc:%s\n", tf_dir_2_str(rm_db->dir), - strerror(-rc)); + errmsg); return rc; } @@ -1117,10 +1123,12 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms) id, &index); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Alloc adjust of base index failed, rc:%s\n", tf_dir_2_str(rm_db->dir), - strerror(-rc)); + errmsg); return -EINVAL; } diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c index 253d716572..bd047643cf 100644 --- a/drivers/net/bnxt/tf_core/tf_session.c +++ b/drivers/net/bnxt/tf_core/tf_session.c @@ -60,6 +60,7 @@ tf_session_create(struct tf *tfp, char *shared_name; char *tcam_session_name; char *pool_session_name; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -75,14 +76,19 @@ tf_session_create(struct tf *tfp, &shared_session_creator); if (rc) { /* Log error */ - if (rc == -EEXIST) + if (rc == -EEXIST) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Session is already open, rc:%s\n", - strerror(-rc)); - else + errmsg); + } else { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Open message send failed, rc:%s\n", - strerror(-rc)); + errmsg); + } parms->open_cfg->session_id.id = TF_FW_SESSION_ID_INVALID; return rc; @@ -94,10 +100,12 @@ tf_session_create(struct tf *tfp, cparms.alignment = 0; rc = tfp_calloc(&cparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate session info, rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup; } tfp->session = (struct tf_session_info *)cparms.mem_va; @@ -108,10 +116,12 @@ tf_session_create(struct tf *tfp, cparms.alignment = 0; rc = tfp_calloc(&cparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate session data, rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup; } tfp->session->core_data = cparms.mem_va; @@ -151,10 +161,12 @@ tf_session_create(struct tf *tfp, cparms.alignment = 0; rc = tfp_calloc(&cparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); /* Log error */ TFP_DRV_LOG(ERR, "Failed to allocate session client, rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup; } client = cparms.mem_va; @@ -224,9 +236,11 @@ tf_session_create(struct tf *tfp, dev.ops->tf_dev_get_mailbox()); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "FW Session close failed, rc:%s\n", - strerror(-rc)); + errmsg); } if (tfp->session) { tfp_free(tfp->session->core_data); @@ -259,6 +273,7 @@ tf_session_client_create(struct tf *tfp, struct tf_session *session = NULL; struct tf_session_client *client; struct tfp_calloc_parms cparms; + char errmsg[RTE_STRERR_BUFSIZE]; union tf_session_client_id session_client_id; TF_CHECK_PARMS2(tfp, parms); @@ -266,9 +281,11 @@ tf_session_client_create(struct tf *tfp, /* Using internal version as session client may not exist yet */ rc = tf_session_get_session_internal(tfp, &session); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -287,9 +304,11 @@ tf_session_client_create(struct tf *tfp, parms->ctrl_chan_name, &session_client_id.internal.fw_session_client_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to create client on session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -301,9 +320,11 @@ tf_session_client_create(struct tf *tfp, cparms.alignment = 0; rc = tfp_calloc(&cparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to allocate session client, rc:%s\n", - strerror(-rc)); + errmsg); goto cleanup; } client = cparms.mem_va; @@ -318,9 +339,11 @@ tf_session_client_create(struct tf *tfp, (tfp, &session_client_id.internal.fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Session Firmware id lookup failed, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -365,15 +388,18 @@ tf_session_client_destroy(struct tf *tfp, { int rc; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_session_client *client; TF_CHECK_PARMS2(tfp, parms); rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to lookup session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -403,9 +429,11 @@ tf_session_client_destroy(struct tf *tfp, * thus we remove from the session. */ if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Client destroy on FW Failed, rc:%s\n", - strerror(-rc)); + errmsg); } ll_delete(&tfs->client_ll, &client->ll_entry); @@ -423,6 +451,7 @@ tf_session_open_session(struct tf *tfp, struct tf_session_open_session_parms *parms) { int rc; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_session_client_create_parms scparms; TF_CHECK_PARMS3(tfp, parms, parms->open_cfg->bp); @@ -432,10 +461,12 @@ tf_session_open_session(struct tf *tfp, if (tfp->session == NULL) { rc = tf_session_create(tfp, parms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to create session, ctrl_chan_name:%s, rc:%s\n", parms->open_cfg->ctrl_chan_name, - strerror(-rc)); + errmsg); return rc; } @@ -454,10 +485,12 @@ tf_session_open_session(struct tf *tfp, */ rc = tf_session_client_create(tfp, &scparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to create client on session 0x%x, rc:%s\n", parms->open_cfg->session_id.id, - strerror(-rc)); + errmsg); return rc; } @@ -475,12 +508,15 @@ tf_session_attach_session(struct tf *tfp __rte_unused, struct tf_session_attach_session_parms *parms __rte_unused) { int rc = -EOPNOTSUPP; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Attach not yet supported, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -492,6 +528,7 @@ tf_session_close_session(struct tf *tfp, struct tf_session *tfs = NULL; struct tf_session_client *client; struct tf_dev_info *tfd = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_session_client_destroy_parms scdparms; uint16_t fid; uint8_t fw_session_id = 1; @@ -501,17 +538,21 @@ tf_session_close_session(struct tf *tfp, rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Session lookup failed, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } if (tfs->session_id.id == TF_SESSION_ID_INVALID) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Invalid session id, unable to close, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -529,9 +570,11 @@ tf_session_close_session(struct tf *tfp, fid); if (!client) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Client not part of the session, unable to close, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -553,10 +596,12 @@ tf_session_close_session(struct tf *tfp, */ rc = tf_session_client_destroy(tfp, &scdparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to unregister Client %d, rc:%s\n", client->session_client_id.id, - strerror(-rc)); + errmsg); return rc; } @@ -574,9 +619,11 @@ tf_session_close_session(struct tf *tfp, rc = tf_session_get_device(tfs, &tfd); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Device lookup failed, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -584,9 +631,11 @@ tf_session_close_session(struct tf *tfp, rc = tf_session_get_fw_session_id(tfp, &fw_session_id); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Unable to lookup FW id, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -594,17 +643,21 @@ tf_session_close_session(struct tf *tfp, rc = tf_dev_unbind(tfp, tfd); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Device unbind failed, rc:%s\n", - strerror(-rc)); + errmsg); } rc = tf_msg_session_close(tfp, fw_session_id, mailbox); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "FW Session close failed, rc:%s\n", - strerror(-rc)); + errmsg); } /* Final cleanup as we're last user of the session thus we @@ -652,13 +705,16 @@ tf_session_get_session_internal(struct tf *tfp, struct tf_session **tfs) { int rc = 0; + char errmsg[RTE_STRERR_BUFSIZE]; /* Skip using the check macro as we want to control the error msg */ if (tfp->session == NULL || tfp->session->core_data == NULL) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Session not created, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -674,6 +730,7 @@ tf_session_get_session(struct tf *tfp, int rc; uint16_t fw_fid; bool supported = false; + char errmsg[RTE_STRERR_BUFSIZE]; rc = tf_session_get_session_internal(tfp, tfs); @@ -687,18 +744,22 @@ tf_session_get_session(struct tf *tfp, */ rc = tfp_get_fid(tfp, &fw_fid); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Internal FID lookup\n, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } supported = tf_session_is_fid_supported(*tfs, fw_fid); if (!supported) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG (ERR, "Ctrl channel not registered with session\n, rc:%s\n", - strerror(-rc)); + errmsg); return -EINVAL; } @@ -804,21 +865,26 @@ tf_session_get_fw_session_id(struct tf *tfp, { int rc; struct tf_session *tfs = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; /* Skip using the check macro as we want to control the error msg */ if (tfp->session == NULL) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Session not created, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } if (fw_session_id == NULL) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Invalid Argument(s), rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -837,20 +903,25 @@ tf_session_get_session_id(struct tf *tfp, { int rc; struct tf_session *tfs = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; if (tfp->session == NULL) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Session not created, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } if (session_id == NULL) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Invalid Argument(s), rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -1147,29 +1218,36 @@ tf_session_set_hotup_state(struct tf *tfp, { int rc = 0; struct tf_session *tfs = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Session lookup failed, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } if (!tf_session_is_shared_session(tfs)) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Only shared session able to set state, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_msg_session_set_hotup_state(tfp, parms->state); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Set session hot upgrade state failed, rc:%s\n", - strerror(-rc)); + errmsg); } return rc; @@ -1181,29 +1259,36 @@ tf_session_get_hotup_state(struct tf *tfp, { int rc = 0; struct tf_session *tfs = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; rc = tf_session_get_session(tfp, &tfs); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Session lookup failed, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } if (!tf_session_is_shared_session(tfs)) { rc = -EINVAL; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Only shared session able to get state, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } rc = tf_msg_session_get_hotup_state(tfp, &parms->state, &parms->ref_cnt); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Get session hot upgrade state failed, rc:%s\n", - strerror(-rc)); + errmsg); } 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..14e8a77746 100644 --- a/drivers/net/bnxt/tf_core/tf_sram_mgr.c +++ b/drivers/net/bnxt/tf_core/tf_sram_mgr.c @@ -484,6 +484,7 @@ static struct tf_sram_block { struct tf_sram_block *block; struct tfp_calloc_parms cparms; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; cparms.nitems = 1; @@ -492,9 +493,11 @@ static struct tf_sram_block rc = tfp_calloc(&cparms); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to allocate block, rc:%s\n", - strerror(-rc)); + errmsg); return NULL; } block = (struct tf_sram_block *)cparms.mem_va; @@ -577,6 +580,7 @@ tf_sram_mgr_bind(void **sram_handle) int rc = 0; struct tf_sram *sram; struct tfp_calloc_parms cparms; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS1(sram_handle); @@ -586,9 +590,11 @@ tf_sram_mgr_bind(void **sram_handle) rc = tfp_calloc(&cparms); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to allocate SRAM mgmt data, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } sram = (struct tf_sram *)cparms.mem_va; @@ -602,6 +608,7 @@ tf_sram_mgr_unbind(void *sram_handle) int rc = 0; struct tf_sram *sram; enum tf_sram_bank_id bank_id; + char errmsg[RTE_STRERR_BUFSIZE]; enum tf_sram_slice_size slice_size; enum tf_dir dir; struct tf_sram_slice_list *slice_list; @@ -626,9 +633,12 @@ tf_sram_mgr_unbind(void *sram_handle) bank_id); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), + "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "No SRAM slice list, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } if (tf_sram_get_block_cnt(slice_list)) @@ -653,6 +663,7 @@ int tf_sram_mgr_alloc(void *sram_handle, uint16_t block_id, slice_offset = 0; uint32_t index, next_index; struct tf_sram_block *block; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_rm_allocate_parms aparms = { 0 }; struct tf_rm_free_parms fparms = { 0 }; bool block_is_full; @@ -668,9 +679,11 @@ int tf_sram_mgr_alloc(void *sram_handle, parms->dir, parms->bank_id); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "No SRAM slice list, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -746,6 +759,7 @@ tf_sram_mgr_free(void *sram_handle, struct tf_sram_block *block; bool block_is_empty; struct tf_rm_free_parms fparms = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(sram_handle, parms); @@ -757,9 +771,11 @@ tf_sram_mgr_free(void *sram_handle, parms->dir, parms->bank_id); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "No SRAM slice list, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -781,7 +797,9 @@ 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)); + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); + TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", errmsg); return rc; } #if (STATS_CLEAR_ON_READ_SUPPORT == 0) @@ -801,11 +819,13 @@ tf_sram_mgr_free(void *sram_handle, hparms.hcapi_type = &hcapi_type; rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%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)); + errmsg); return rc; } /* Clear the counter @@ -817,11 +837,13 @@ tf_sram_mgr_free(void *sram_handle, data, parms->sram_offset); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->tbl_type), - strerror(-rc)); + errmsg); return rc; } } @@ -835,15 +857,19 @@ tf_sram_mgr_free(void *sram_handle, rc = tf_rm_free(&fparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Free block_id(%d) failed error(%s)\n", - block_id, strerror(-rc)); + block_id, errmsg); } fparms.index = block_id + 1; rc = tf_rm_free(&fparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Free next block_id(%d) failed error(%s)\n", - block_id + 1, strerror(-rc)); + block_id + 1, errmsg); } /* Free local entry regardless */ tf_sram_free_block(slice_list, block); @@ -921,6 +947,7 @@ int tf_sram_mgr_is_allocated(void *sram_handle, { int rc = 0; struct tf_sram *sram; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_sram_slice_list *slice_list; uint16_t block_id, slice_offset; struct tf_sram_block *block; @@ -935,9 +962,11 @@ int tf_sram_mgr_is_allocated(void *sram_handle, parms->dir, parms->bank_id); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "No SRAM slice list, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c index f5f3889934..d82a73ee20 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_tbl.c @@ -31,6 +31,7 @@ tf_tbl_bind(struct tf *tfp, struct tbl_rm_db *tbl_db; struct tfp_calloc_parms cparms; struct tf_session *tfs; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -44,8 +45,10 @@ tf_tbl_bind(struct tf *tfp, cparms.size = sizeof(struct tbl_rm_db); cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "tbl_rm_db alloc error %s\n", - strerror(ENOMEM)); + errmsg); return -ENOMEM; } @@ -126,6 +129,7 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, struct tf_dev_info *dev; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -141,9 +145,11 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get tbl_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -178,6 +184,7 @@ tf_tbl_free(struct tf *tfp __rte_unused, struct tf_dev_info *dev; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -193,9 +200,11 @@ tf_tbl_free(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -230,11 +239,13 @@ tf_tbl_free(struct tf *tfp __rte_unused, hparms.hcapi_type = &hcapi_type; rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } /* Clear the counter @@ -246,11 +257,13 @@ tf_tbl_free(struct tf *tfp __rte_unused, data, parms->idx); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } } @@ -285,6 +298,7 @@ tf_tbl_set(struct tf *tfp, struct tf_dev_info *dev; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -300,9 +314,11 @@ tf_tbl_set(struct tf *tfp, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -337,11 +353,13 @@ tf_tbl_set(struct tf *tfp, hparms.hcapi_type = &hcapi_type; rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } @@ -352,11 +370,13 @@ tf_tbl_set(struct tf *tfp, parms->data, parms->idx); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } @@ -376,6 +396,7 @@ tf_tbl_get(struct tf *tfp, struct tf_dev_info *dev; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -391,9 +412,11 @@ tf_tbl_get(struct tf *tfp, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -428,11 +451,13 @@ tf_tbl_get(struct tf *tfp, hparms.hcapi_type = &hcapi_type; rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } @@ -445,11 +470,13 @@ tf_tbl_get(struct tf *tfp, parms->idx, false); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Get failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } @@ -468,6 +495,7 @@ tf_tbl_bulk_get(struct tf *tfp, struct tf_dev_info *dev; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -483,9 +511,11 @@ tf_tbl_bulk_get(struct tf *tfp, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; @@ -513,11 +543,13 @@ tf_tbl_bulk_get(struct tf *tfp, hparms.hcapi_type = &hcapi_type; rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } @@ -531,11 +563,13 @@ tf_tbl_bulk_get(struct tf *tfp, parms->physical_mem_addr, false); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Bulk get failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); } 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..baef72d81c 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl_sram.c +++ b/drivers/net/bnxt/tf_core/tf_tbl_sram.c @@ -101,6 +101,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms) int rc = 0; uint16_t hcapi_type; uint16_t slices; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_rm_get_hcapi_parms hparms; struct tf_rm_get_slices_parms sparms; @@ -110,11 +111,13 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms) rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%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)); + errmsg); return rc; } parms->bank_id = tf_tbl_sram_hcapi_2_bank[hcapi_type]; @@ -125,11 +128,13 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms) rc = tf_rm_get_slices(&sparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%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)); + errmsg); return rc; } if (slices) @@ -161,14 +166,17 @@ tf_tbl_sram_unbind(struct tf *tfp __rte_unused) { int rc = 0; void *sram_handle = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS1(tfp); rc = tf_session_get_sram_db(tfp, &sram_handle); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } if (sram_handle) @@ -187,6 +195,7 @@ tf_tbl_sram_alloc(struct tf *tfp, uint16_t idx; struct tf_session *tfs; struct tf_dev_info *dev; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_sram_get_info_parms iparms = { 0 }; struct tf_sram_mgr_alloc_parms aparms = { 0 }; struct tbl_rm_db *tbl_db; @@ -202,9 +211,11 @@ tf_tbl_sram_alloc(struct tf *tfp, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get tbl_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -212,9 +223,11 @@ tf_tbl_sram_alloc(struct tf *tfp, rc = tf_session_get_sram_db(tfp, &sram_handle); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -273,6 +286,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused, struct tf_dev_info *dev; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; struct tf_tbl_sram_get_info_parms iparms = { 0 }; struct tf_sram_mgr_free_parms fparms = { 0 }; struct tf_sram_mgr_is_allocated_parms aparms = { 0 }; @@ -288,18 +302,22 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; rc = tf_session_get_sram_db(tfp, &sram_handle); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -340,12 +358,14 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused, rc = tf_sram_mgr_is_allocated(sram_handle, &aparms); if (rc || !allocated) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Free of invalid entry:%s idx(0x%x):(%s)\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), parms->idx, - strerror(-rc)); + errmsg); rc = -ENOMEM; return rc; } @@ -405,6 +425,7 @@ tf_tbl_sram_set(struct tf *tfp, struct tf_rm_is_allocated_parms raparms = { 0 }; void *sram_handle = NULL; uint16_t base = 0, shift = 0; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -415,18 +436,22 @@ tf_tbl_sram_set(struct tf *tfp, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; rc = tf_session_get_sram_db(tfp, &sram_handle); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -484,12 +509,14 @@ tf_tbl_sram_set(struct tf *tfp, aparms.is_allocated = &allocated; rc = tf_sram_mgr_is_allocated(sram_handle, &aparms); if (rc || !allocated) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Entry not allocated:%s idx(0x%x):(%s)\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), parms->idx, - strerror(-rc)); + errmsg); rc = -ENOMEM; return rc; } @@ -500,11 +527,13 @@ tf_tbl_sram_set(struct tf *tfp, hparms.hcapi_type = &hcapi_type; rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } @@ -515,11 +544,13 @@ tf_tbl_sram_set(struct tf *tfp, parms->data, parms->idx); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } return rc; @@ -541,6 +572,7 @@ tf_tbl_sram_get(struct tf *tfp, struct tf_sram_mgr_is_allocated_parms aparms = { 0 }; void *sram_handle = NULL; bool clear_on_read = false; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -551,18 +583,22 @@ tf_tbl_sram_get(struct tf *tfp, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; rc = tf_session_get_sram_db(tfp, &sram_handle); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -587,12 +623,14 @@ tf_tbl_sram_get(struct tf *tfp, rc = tf_sram_mgr_is_allocated(sram_handle, &aparms); if (rc || !allocated) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Entry not allocated:%s idx(0x%x):(%s)\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), parms->idx, - strerror(-rc)); + errmsg); rc = -ENOMEM; return rc; } @@ -603,11 +641,13 @@ tf_tbl_sram_get(struct tf *tfp, hparms.hcapi_type = &hcapi_type; rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } if (parms->type == TF_TBL_TYPE_ACT_STATS_64) @@ -622,11 +662,13 @@ tf_tbl_sram_get(struct tf *tfp, parms->idx, clear_on_read); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Get failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } return rc; @@ -649,6 +691,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp, bool allocated = false; void *sram_handle = NULL; bool clear_on_read = false; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -659,18 +702,22 @@ tf_tbl_sram_bulk_get(struct tf *tfp, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; rc = tf_session_get_sram_db(tfp, &sram_handle); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get sram_handle from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -698,12 +745,14 @@ tf_tbl_sram_bulk_get(struct tf *tfp, aparms.is_allocated = &allocated; rc = tf_sram_mgr_is_allocated(sram_handle, &aparms); if (rc || !allocated) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Entry not allocated:%s starting_idx(%d):(%s)\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), parms->starting_idx, - strerror(-rc)); + errmsg); rc = -ENOMEM; return rc; } @@ -711,12 +760,14 @@ tf_tbl_sram_bulk_get(struct tf *tfp, aparms.sram_offset = idx; rc = tf_sram_mgr_is_allocated(sram_handle, &aparms); if (rc || !allocated) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Entry not allocated:%s last_idx(0x%x):(%s)\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), idx, - strerror(-rc)); + errmsg); rc = -ENOMEM; return rc; } @@ -726,11 +777,13 @@ tf_tbl_sram_bulk_get(struct tf *tfp, hparms.hcapi_type = &hcapi_type; rc = tf_rm_get_hcapi_type(&hparms); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); return rc; } @@ -747,11 +800,13 @@ tf_tbl_sram_bulk_get(struct tf *tfp, parms->physical_mem_addr, clear_on_read); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s, Bulk get failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), tf_tbl_type_2_str(parms->type), - strerror(-rc)); + errmsg); } return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c index 9e0671d47b..4e97556bc5 100644 --- a/drivers/net/bnxt/tf_core/tf_tcam.c +++ b/drivers/net/bnxt/tf_core/tf_tcam.c @@ -40,6 +40,7 @@ tf_tcam_bind(struct tf *tfp, uint32_t rx_supported; uint32_t tx_supported; bool no_req = true; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -55,9 +56,11 @@ tf_tcam_bind(struct tf *tfp, if (dev->ops->tf_dev_get_tcam_slice_info == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } @@ -90,8 +93,10 @@ tf_tcam_bind(struct tf *tfp, cparms.size = sizeof(struct tcam_rm_db); cparms.alignment = 0; if (tfp_calloc(&cparms) != 0) { + if (strerror_r(ENOMEM, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ENOMEM); TFP_DRV_LOG(ERR, "tcam_rm_db alloc error %s\n", - strerror(ENOMEM)); + errmsg); return -ENOMEM; } @@ -283,6 +288,7 @@ tf_tcam_alloc(struct tf *tfp, uint32_t index; struct tcam_rm_db *tcam_db; void *tcam_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -298,10 +304,12 @@ tf_tcam_alloc(struct tf *tfp, if (dev->ops->tf_dev_get_tcam_slice_info == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -318,9 +326,11 @@ tf_tcam_alloc(struct tf *tfp, return tf_tcam_mgr_alloc_msg(tfp, dev, parms); rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get tcam_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr; @@ -367,6 +377,7 @@ tf_tcam_free(struct tf *tfp, int i; struct tcam_rm_db *tcam_db; void *tcam_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -382,10 +393,12 @@ tf_tcam_free(struct tf *tfp, if (dev->ops->tf_dev_get_tcam_slice_info == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -415,9 +428,11 @@ tf_tcam_free(struct tf *tfp, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr; @@ -472,12 +487,14 @@ tf_tcam_free(struct tf *tfp, rc = tf_msg_tcam_entry_free(tfp, dev, parms); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: %s: Entry %d free failed, rc:%s\n", tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx, - strerror(-rc)); + errmsg); return rc; } @@ -497,6 +514,7 @@ tf_tcam_set(struct tf *tfp __rte_unused, int allocated = 0; struct tcam_rm_db *tcam_db; void *tcam_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -512,10 +530,12 @@ tf_tcam_set(struct tf *tfp __rte_unused, if (dev->ops->tf_dev_get_tcam_slice_info == NULL) { rc = -EOPNOTSUPP; + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: Operation not supported, rc:%s\n", tf_dir_2_str(parms->dir), - strerror(-rc)); + errmsg); return rc; } @@ -533,9 +553,11 @@ tf_tcam_set(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr; @@ -574,12 +596,14 @@ tf_tcam_set(struct tf *tfp __rte_unused, rc = tf_msg_tcam_entry_set(tfp, dev, parms); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: %s: Entry %d set failed, rc:%s", tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx, - strerror(-rc)); + errmsg); return rc; } return 0; @@ -597,6 +621,7 @@ tf_tcam_get(struct tf *tfp __rte_unused, int allocated = 0; struct tcam_rm_db *tcam_db; void *tcam_db_ptr = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; TF_CHECK_PARMS2(tfp, parms); @@ -616,9 +641,11 @@ tf_tcam_get(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr); if (rc) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", - strerror(-rc)); + errmsg); return rc; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr; @@ -657,12 +684,14 @@ tf_tcam_get(struct tf *tfp __rte_unused, rc = tf_msg_tcam_entry_get(tfp, dev, parms); if (rc) { /* Log error */ + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); TFP_DRV_LOG(ERR, "%s: %s: Entry %d set failed, rc:%s", tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx, - strerror(-rc)); + errmsg); return rc; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 24/52] net/af_xdp: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (22 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 23/52] net/bnxt: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 25/52] net/af_xdp: use rte strerror Dengdui Huang ` (28 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/af_xdp/rte_eth_af_xdp.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 814398ba4b..52ad450172 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1141,6 +1141,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, void *aligned_addr; uint64_t umem_size; struct rte_mempool_mem_range_info range; + char errmsg[RTE_STRERR_BUFSIZE]; if (internals->shared_umem) { if (get_shared_umem(rxq, internals->if_name, &umem) < 0) @@ -1190,8 +1191,10 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, ret = xsk_umem__create(&umem->umem, aligned_addr, umem_size, &rxq->fq, &rxq->cq, &usr_config); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); AF_XDP_LOG_LINE(ERR, "Failed to create umem [%d]: [%s]", - errno, strerror(errno)); + errno, errmsg); goto err; } umem->buffer = aligned_addr; @@ -1394,6 +1397,7 @@ configure_preferred_busy_poll(struct pkt_rx_queue *rxq) static int init_uds_sock(struct sockaddr_un *server, const char *dp_path) { + char errmsg[RTE_STRERR_BUFSIZE]; int sock; sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); @@ -1407,8 +1411,10 @@ init_uds_sock(struct sockaddr_un *server, const char *dp_path) if (connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr_un)) < 0) { close(sock); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); AF_XDP_LOG_LINE(ERR, "Error connecting stream socket errno = [%d]: [%s]", - errno, strerror(errno)); + errno, errmsg); return -1; } @@ -1472,6 +1478,7 @@ read_msg(int sock, char *response, struct sockaddr_un *s, int *fd) struct iovec iov; char control[CMSG_SPACE(sizeof(*fd))]; struct cmsghdr *cmsg; + char errmsg[RTE_STRERR_BUFSIZE]; /* Initialize message header structure */ memset(&msgh, 0, sizeof(msgh)); @@ -1492,7 +1499,9 @@ read_msg(int sock, char *response, struct sockaddr_un *s, int *fd) return 0; if (msglen < 0) { - AF_XDP_LOG_LINE(ERR, "recvmsg failed, %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + AF_XDP_LOG_LINE(ERR, "recvmsg failed, %s", errmsg); return -1; } @@ -1514,6 +1523,7 @@ static int make_request_dp(int sock, struct sockaddr_un *server, char *request, int *req_fd, char *response, int *out_fd, const char *dp_path) { + char errmsg[RTE_STRERR_BUFSIZE]; int rval; AF_XDP_LOG_LINE(DEBUG, "Request: [%s]", request); @@ -1527,7 +1537,9 @@ make_request_dp(int sock, struct sockaddr_un *server, char *request, rval = send_msg(sock, request, req_fd, dp_path); if (rval < 0) { - AF_XDP_LOG_LINE(ERR, "Write error %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + AF_XDP_LOG_LINE(ERR, "Write error %s", errmsg); return -1; } @@ -2013,6 +2025,7 @@ static int parse_prog_arg(const char *key __rte_unused, const char *value, void *extra_args) { + char errmsg[RTE_STRERR_BUFSIZE]; char *path = extra_args; if (strnlen(value, PATH_MAX) == PATH_MAX) { @@ -2022,8 +2035,10 @@ parse_prog_arg(const char *key __rte_unused, } if (access(value, F_OK) != 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); AF_XDP_LOG_LINE(ERR, "Error accessing %s: %s", - value, strerror(errno)); + value, errmsg); return -EINVAL; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 25/52] net/af_xdp: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (23 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 24/52] net/af_xdp: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 26/52] net/bonding: replace strerror with reentrant version Dengdui Huang ` (27 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 52ad450172..abdbeee80c 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -2533,7 +2533,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_LINE(ERR, "%s: Failed to register multi-process IPC callback: %s", - name, strerror(rte_errno)); + name, rte_strerror(rte_errno)); return -1; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 26/52] net/bonding: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (24 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 25/52] net/af_xdp: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 27/52] net/bonding: use rte strerror Dengdui Huang ` (26 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/bonding/bonding_testpmd.c | 18 ++++++++++++------ drivers/net/bonding/rte_eth_bond_api.c | 5 ++++- drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++++++++++---- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c index 8fcd6cadd0..56cca3d447 100644 --- a/drivers/net/bonding/bonding_testpmd.c +++ b/drivers/net/bonding/bonding_testpmd.c @@ -541,6 +541,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { struct cmd_set_bond_mac_addr_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (port_id_is_invalid(res->port_num, ENABLED_WARN)) @@ -549,9 +550,11 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result, ret = rte_eth_bond_mac_address_set(res->port_num, &res->address); /* check the return value and print it if is < 0 */ - if (ret < 0) - fprintf(stderr, "set_bond_mac_addr error: (%s)\n", - strerror(-ret)); + if (ret < 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "set_bond_mac_addr error: (%s)\n", errmsg); + } } static cmdline_parse_token_string_t cmd_set_bond_mac_addr_set = @@ -597,14 +600,17 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { struct cmd_set_bond_mon_period_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; ret = rte_eth_bond_link_monitoring_set(res->port_num, res->period_ms); /* check the return value and print it if is < 0 */ - if (ret < 0) - fprintf(stderr, "set_bond_mac_addr error: (%s)\n", - strerror(-ret)); + if (ret < 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "set_bond_mac_addr error: (%s)\n", errmsg); + } } 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 ffc1322047..11a37dd142 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -465,6 +465,7 @@ __eth_bond_member_add_lock_free(uint16_t bonding_port_id, uint16_t member_port_i struct bond_dev_private *internals; struct rte_eth_link link_props; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; bonding_eth_dev = &rte_eth_devices[bonding_port_id]; @@ -481,9 +482,11 @@ __eth_bond_member_add_lock_free(uint16_t bonding_port_id, uint16_t member_port_i ret = rte_eth_dev_info_get(member_port_id, &dev_info); if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s", - __func__, member_port_id, strerror(-ret)); + __func__, member_port_id, errmsg); return ret; } diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 91bf2c2345..9849e0ecb0 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -165,6 +165,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev, struct rte_eth_dev_info member_info; struct rte_flow_error error; struct bond_dev_private *internals = bond_dev->data->dev_private; + char errmsg[RTE_STRERR_BUFSIZE]; const struct rte_flow_action_queue lacp_queue_conf = { .index = 0, @@ -191,9 +192,11 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev, ret = rte_eth_dev_info_get(member_port, &member_info); if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s", - __func__, member_port, strerror(-ret)); + __func__, member_port, errmsg); return ret; } @@ -214,6 +217,7 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) { struct rte_eth_dev *bond_dev = &rte_eth_devices[port_id]; struct bond_dev_private *internals = bond_dev->data->dev_private; struct rte_eth_dev_info bond_info; + char errmsg[RTE_STRERR_BUFSIZE]; uint16_t idx; int ret; @@ -221,10 +225,11 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) { if (internals->member_count > 0) { ret = rte_eth_dev_info_get(bond_dev->data->port_id, &bond_info); if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s", - __func__, bond_dev->data->port_id, - strerror(-ret)); + __func__, bond_dev->data->port_id, errmsg); return ret; } @@ -2264,6 +2269,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct bond_dev_private *internals = dev->data->dev_private; struct bond_member_details member; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; uint16_t max_nb_rx_queues = UINT16_MAX; @@ -2287,11 +2293,13 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) member = internals->members[idx]; ret = rte_eth_dev_info_get(member.port_id, &member_info); if (ret != 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s", __func__, member.port_id, - strerror(-ret)); + errmsg); return ret; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 27/52] net/bonding: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (25 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 26/52] net/bonding: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 28/52] net/cnxk: replace strerror with reentrant version Dengdui Huang ` (25 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/bonding/rte_eth_bond_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c index 5d0be5caf5..a38cc84f56 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 28/52] net/cnxk: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (26 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 27/52] net/bonding: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 29/52] net/dpaa: " Dengdui Huang ` (24 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/cnxk/cnxk_rep_msg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/cnxk/cnxk_rep_msg.c b/drivers/net/cnxk/cnxk_rep_msg.c index a222e2b5cd..c1c10eab5b 100644 --- a/drivers/net/cnxk/cnxk_rep_msg.c +++ b/drivers/net/cnxk/cnxk_rep_msg.c @@ -111,6 +111,7 @@ send_message_on_socket(int socketfd, void *data, uint32_t len, int afd) static int open_socket_ctrl_channel(void) { + char errmsg[RTE_STRERR_BUFSIZE]; struct sockaddr_un un; int sock_fd; @@ -141,13 +142,17 @@ open_socket_ctrl_channel(void) strncpy(un.sun_path, CNXK_ESWITCH_CTRL_MSG_SOCK_PATH, sizeof(un.sun_path) - 1); if (bind(sock_fd, (struct sockaddr *)&un, sizeof(un)) < 0) { - plt_err("Failed to bind %s: %s", un.sun_path, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + plt_err("Failed to bind %s: %s", un.sun_path, errmsg); close(sock_fd); return -errno; } if (listen(sock_fd, 1) < 0) { - plt_err("Failed to listen, err %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + plt_err("Failed to listen, err %s", errmsg); close(sock_fd); return -errno; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 29/52] net/dpaa: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (27 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 28/52] net/cnxk: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 30/52] net/dpaa2: " Dengdui Huang ` (23 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/dpaa/dpaa_ethdev.c | 10 ++++++++-- drivers/net/dpaa/fmlib/fm_lib.c | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index e8d34e5898..0bdd5458e2 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1075,6 +1075,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct fman_if *fif = dev->process_private; struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx]; struct qm_mcc_initfq opts = {0}; + char errmsg[RTE_STRERR_BUFSIZE]; u32 ch_id, flags = 0; int ret; u32 buffsz = rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM; @@ -1217,8 +1218,10 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } ret = qman_init_fq(rxq, flags, &opts); if (ret) { + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", 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, errmsg); return ret; } if (dpaa_svr_family == SVR_LS1043A_FAMILY) { @@ -1310,6 +1313,7 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev, struct dpaa_if *dpaa_intf = dev->data->dev_private; struct qman_fq *rxq = &dpaa_intf->rx_queues[eth_rx_queue_id]; struct qm_mcc_initfq opts = {0}; + char errmsg[RTE_STRERR_BUFSIZE]; if (dpaa_push_mode_max_queue) { DPAA_PMD_WARN("PUSH mode q and EVENTDEV are not compatible"); @@ -1352,8 +1356,10 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev, ret = qman_init_fq(rxq, flags, &opts); if (ret) { + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", 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, errmsg); return ret; } diff --git a/drivers/net/dpaa/fmlib/fm_lib.c b/drivers/net/dpaa/fmlib/fm_lib.c index b35feba004..347d24906a 100644 --- a/drivers/net/dpaa/fmlib/fm_lib.c +++ b/drivers/net/dpaa/fmlib/fm_lib.c @@ -96,14 +96,17 @@ uint32_t fm_get_api_version(t_handle h_fm, ioc_fm_api_version_t *p_version) { t_device *p_dev = (t_device *)h_fm; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; _fml_dbg("Calling..."); ret = ioctl(p_dev->fd, FM_IOC_GET_API_VERSION, p_version); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA_PMD_ERR("cannot get API version, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } _fml_dbg("Finishing."); @@ -250,6 +253,7 @@ fm_pcd_kg_scheme_set(t_handle h_fm_pcd, ioc_fm_pcd_kg_scheme_params_t *params) { t_device *p_pcd_dev = (t_device *)h_fm_pcd; + char errmsg[RTE_STRERR_BUFSIZE]; t_device *p_dev = NULL; int ret; @@ -275,8 +279,10 @@ 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) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA_PMD_ERR(" cannot set kg scheme, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); return NULL; } @@ -300,6 +306,7 @@ uint32_t fm_pcd_kg_scheme_delete(t_handle h_scheme) { t_device *p_dev = (t_device *)h_scheme; + char errmsg[RTE_STRERR_BUFSIZE]; t_device *p_pcd_dev = NULL; ioc_fm_obj_t id; @@ -309,8 +316,10 @@ fm_pcd_kg_scheme_delete(t_handle h_scheme) id.obj = UINT_TO_PTR(p_dev->id); if (ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_DELETE, &id)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DPAA_PMD_WARN("cannot delete kg scheme, error %i (%s)", - errno, strerror(errno)); + errno, errmsg); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 30/52] net/dpaa2: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (28 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 29/52] net/dpaa: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 31/52] net/enetfec: " Dengdui Huang ` (22 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/dpaa2/dpaa2_ethdev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 7b3e587a8d..6a058e90f8 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1163,22 +1163,28 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable) struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private; int irq_index = DPNI_IRQ_INDEX; unsigned int mask = DPNI_IRQ_EVENT_LINK_CHANGED; + char errmsg[RTE_STRERR_BUFSIZE]; PMD_INIT_FUNC_TRACE(); err = dpni_set_irq_mask(dpni, CMD_PRI_LOW, priv->token, irq_index, mask); if (err < 0) { + if (strerror_r(-err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -err); DPAA2_PMD_ERR("Error: dpni_set_irq_mask():%d (%s)", err, - strerror(-err)); + errmsg); return err; } err = dpni_set_irq_enable(dpni, CMD_PRI_LOW, priv->token, irq_index, enable); - if (err < 0) + if (err < 0) { + if (strerror_r(-err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -err); DPAA2_PMD_ERR("Error: dpni_set_irq_enable():%d (%s)", err, - strerror(-err)); + errmsg); + } return err; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 31/52] net/enetfec: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (29 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 30/52] net/dpaa2: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 32/52] net/failsafe: " Dengdui Huang ` (21 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/enetfec/enet_uio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/enetfec/enet_uio.c b/drivers/net/enetfec/enet_uio.c index 9f4e896985..c4d4e60c64 100644 --- a/drivers/net/enetfec/enet_uio.c +++ b/drivers/net/enetfec/enet_uio.c @@ -222,6 +222,7 @@ config_enetfec_uio(struct enetfec_private *fep) int enetfec_configure(void) { + char errmsg[RTE_STRERR_BUFSIZE]; char uio_name[32]; int uio_minor_number = -1; int ret; @@ -230,8 +231,10 @@ enetfec_configure(void) d = opendir(FEC_UIO_DEVICE_SYS_ATTR_PATH); if (d == NULL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); ENETFEC_PMD_ERR("Error opening directory '%s': %s", - FEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno)); + FEC_UIO_DEVICE_SYS_ATTR_PATH, errmsg); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 32/52] net/failsafe: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (30 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 31/52] net/enetfec: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 33/52] net/failsafe: use rte strerror Dengdui Huang ` (20 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/failsafe/failsafe.c | 13 ++++++++++--- drivers/net/failsafe/failsafe_args.c | 12 +++++++++--- drivers/net/failsafe/failsafe_eal.c | 5 ++++- drivers/net/failsafe/failsafe_ops.c | 5 ++++- drivers/net/failsafe/failsafe_private.h | 17 +++++++++++++---- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 32811403b4..345dd13eff 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -135,21 +135,28 @@ fs_mutex_init(struct fs_priv *priv) { int ret; pthread_mutexattr_t attr; + char errmsg[RTE_STRERR_BUFSIZE]; ret = pthread_mutexattr_init(&attr); if (ret) { - ERROR("Cannot initiate mutex attributes - %s", strerror(ret)); + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); + ERROR("Cannot initiate mutex attributes - %s", errmsg); 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)); + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); + ERROR("Cannot set mutex type - %s", errmsg); return ret; } ret = pthread_mutex_init(&priv->hotplug_mutex, &attr); if (ret) { - ERROR("Cannot initiate mutex - %s", strerror(ret)); + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); + ERROR("Cannot initiate mutex - %s", errmsg); return ret; } return 0; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 1b8f1d3050..fe53fecda8 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -89,6 +89,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) FILE *fp; /* store possible newline as well */ char output[DEVARGS_MAXLEN + 1]; + char errmsg[RTE_STRERR_BUFSIZE]; size_t len; int ret; @@ -112,7 +113,9 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) fp = popen(sdev->cmdline, "r"); if (fp == NULL) { ret = -errno; - ERROR("popen: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + ERROR("popen: %s", errmsg); return ret; } /* We only read one line */ @@ -130,8 +133,11 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) if (ret) ERROR("Parsing device '%s' failed", output); ret_pclose: - if (pclose(fp) == -1) - ERROR("pclose: %s", strerror(errno)); + if (pclose(fp) == -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + ERROR("pclose: %s", errmsg); + } return ret; } diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index e79d3b4120..8af72c6468 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -33,6 +33,7 @@ fs_ethdev_portid_get(const char *name, uint16_t *port_id) static int fs_bus_init(struct rte_eth_dev *dev) { + char errmsg[RTE_STRERR_BUFSIZE]; struct sub_device *sdev; struct rte_devargs *da; uint8_t i; @@ -99,8 +100,10 @@ fs_bus_init(struct rte_eth_dev *dev) " %d named %s", i, da->name); ret = rte_eth_dev_owner_set(pid, &PRIV(dev)->my_owner); if (ret < 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); INFO("sub_device %d owner set failed (%s), " - "will try again later", i, strerror(-ret)); + "will try again later", i, errmsg); continue; } else if (strncmp(rte_eth_devices[pid].device->name, da->name, strlen(da->name)) != 0) { diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 9c013e0419..f1734a5d36 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -409,6 +409,7 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool) { + char errmsg[RTE_STRERR_BUFSIZE]; struct sub_device *sdev; struct rxq *rxq; uint8_t i; @@ -452,7 +453,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + ERROR("Failed to create an eventfd: %s", errmsg); fs_unlock(dev, 0); return -errno; } diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index babea6016e..54ac39b87b 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -401,20 +401,25 @@ fs_dev(struct sub_device *sdev) { static inline int fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (is_alarm) { ret = pthread_mutex_trylock(&PRIV(dev)->hotplug_mutex); if (ret) { + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); DEBUG("Hot-plug mutex lock trying failed(%s), will try" - " again later...", strerror(ret)); + " again later...", errmsg); 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)); + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); + ERROR("Cannot lock mutex(%s)", errmsg); return ret; } } @@ -428,6 +433,7 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm) static inline void fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (is_alarm) { @@ -435,8 +441,11 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm) PRIV(dev)->alarm_lock = 0; } ret = pthread_mutex_unlock(&PRIV(dev)->hotplug_mutex); - if (ret) - ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret)); + if (ret) { + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); + ERROR("Cannot unlock hot-plug mutex(%s)", errmsg); + } } /* -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 33/52] net/failsafe: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (31 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 32/52] net/failsafe: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 34/52] net/i40e: replace strerror with reentrant version Dengdui Huang ` (19 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/failsafe/failsafe.c | 2 +- drivers/net/failsafe/failsafe_eal.c | 2 +- drivers/net/failsafe/failsafe_flow.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 345dd13eff..f32af0b2c3 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; diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index 8af72c6468..121dee9349 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -53,7 +53,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; } 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 34/52] net/i40e: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (32 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 33/52] net/failsafe: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 35/52] net/ice: " Dengdui Huang ` (18 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/i40e/i40e_testpmd.c | 109 +++++++++++++++++++++++++------- 1 file changed, 86 insertions(+), 23 deletions(-) diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c index b6ef5d6e42..ef910c1cbc 100644 --- a/drivers/net/i40e/i40e_testpmd.c +++ b/drivers/net/i40e/i40e_testpmd.c @@ -33,6 +33,7 @@ cmd_queue_region_parsed(void *parsed_result, int ret = -ENOTSUP; struct rte_pmd_i40e_queue_region_conf region_conf; enum rte_pmd_i40e_queue_region_op op_type; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -52,8 +53,10 @@ cmd_queue_region_parsed(void *parsed_result, fprintf(stderr, "function not implemented or supported\n"); break; default: + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); fprintf(stderr, "queue region config error: (%s)\n", - strerror(-ret)); + errmsg); } } @@ -128,6 +131,7 @@ cmd_region_flowtype_parsed(void *parsed_result, int ret = -ENOTSUP; struct rte_pmd_i40e_queue_region_conf region_conf; enum rte_pmd_i40e_queue_region_op op_type; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -147,8 +151,10 @@ cmd_region_flowtype_parsed(void *parsed_result, fprintf(stderr, "function not implemented or supported\n"); break; default: + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); fprintf(stderr, "region flowtype config error: (%s)\n", - strerror(-ret)); + errmsg); } } @@ -214,6 +220,7 @@ cmd_user_priority_region_parsed(void *parsed_result, int ret = -ENOTSUP; struct rte_pmd_i40e_queue_region_conf region_conf; enum rte_pmd_i40e_queue_region_op op_type; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -232,8 +239,10 @@ cmd_user_priority_region_parsed(void *parsed_result, fprintf(stderr, "function not implemented or supported\n"); break; default: + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); fprintf(stderr, "user_priority region config error: (%s)\n", - strerror(-ret)); + errmsg); } } @@ -299,6 +308,7 @@ cmd_flush_queue_region_parsed(void *parsed_result, int ret = -ENOTSUP; struct rte_pmd_i40e_queue_region_conf region_conf; enum rte_pmd_i40e_queue_region_op op_type; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -319,8 +329,10 @@ cmd_flush_queue_region_parsed(void *parsed_result, fprintf(stderr, "function not implemented or supported\n"); break; default: + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); fprintf(stderr, "queue region config flush error: (%s)\n", - strerror(-ret)); + errmsg); } } @@ -413,6 +425,7 @@ cmd_show_queue_region_info_parsed(void *parsed_result, int ret = -ENOTSUP; struct rte_pmd_i40e_queue_regions rte_pmd_regions; enum rte_pmd_i40e_queue_region_op op_type; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -432,8 +445,10 @@ cmd_show_queue_region_info_parsed(void *parsed_result, fprintf(stderr, "function not implemented or supported\n"); break; default: + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); fprintf(stderr, "queue region config info show error: (%s)\n", - strerror(-ret)); + errmsg); } } @@ -492,6 +507,7 @@ cmd_flow_director_filter_parsed(void *parsed_result, mapping[RTE_PMD_I40E_FLOW_TYPE_MAX]; struct rte_pmd_i40e_pkt_template_conf conf; uint16_t flow_type = str_to_flowtype(res->flow_type); + char errmsg[RTE_STRERR_BUFSIZE]; uint16_t i, port = res->port_id; uint8_t add; @@ -534,9 +550,11 @@ cmd_flow_director_filter_parsed(void *parsed_result, ret = rte_pmd_i40e_flow_add_del_packet_template(port, &conf, add); - if (ret < 0) - fprintf(stderr, "flow director config error: (%s)\n", - strerror(-ret)); + if (ret < 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "flow director config error: (%s)\n", errmsg); + } close_file(conf.input.packet); } @@ -645,6 +663,7 @@ cmd_set_vf_promisc_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_vf_promisc_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; @@ -666,7 +685,9 @@ cmd_set_vf_promisc_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -724,6 +745,7 @@ cmd_set_vf_allmulti_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_vf_allmulti_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; @@ -745,7 +767,9 @@ cmd_set_vf_allmulti_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -803,6 +827,7 @@ cmd_set_vf_broadcast_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_set_vf_broadcast_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; @@ -825,7 +850,9 @@ cmd_set_vf_broadcast_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -886,6 +913,7 @@ cmd_set_vf_vlan_tag_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_set_vf_vlan_tag_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; @@ -908,7 +936,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -992,6 +1022,7 @@ cmd_vf_max_bw_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_vf_tc_bw_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -1013,7 +1044,9 @@ cmd_vf_max_bw_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -1083,6 +1116,7 @@ cmd_vf_tc_min_bw_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_vf_tc_bw_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t tc_num; uint8_t bw[16]; int ret = -ENOTSUP; @@ -1108,7 +1142,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -1137,6 +1173,7 @@ cmd_vf_tc_max_bw_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_vf_tc_bw_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -1158,7 +1195,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -1188,6 +1227,7 @@ cmd_strict_link_prio_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_vf_tc_bw_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -1207,7 +1247,9 @@ cmd_strict_link_prio_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -1912,6 +1954,7 @@ cmd_pctype_mapping_reset_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_pctype_mapping_reset_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -1928,7 +1971,9 @@ cmd_pctype_mapping_reset_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -1984,6 +2029,7 @@ cmd_pctype_mapping_get_parsed(void *parsed_result, int ret = -ENOTSUP; struct rte_pmd_i40e_flow_type_mapping mapping[RTE_PMD_I40E_FLOW_TYPE_MAX]; + char errmsg[RTE_STRERR_BUFSIZE]; int i, j, first_pctype; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -2000,7 +2046,9 @@ cmd_pctype_mapping_get_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); return; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); return; } @@ -2085,6 +2133,7 @@ cmd_pctype_mapping_update_parsed(void *parsed_result, unsigned int i; unsigned int nb_item; unsigned int pctype_list[RTE_PMD_I40E_PCTYPE_MAX]; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -2111,7 +2160,9 @@ cmd_pctype_mapping_update_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -2170,6 +2221,7 @@ cmd_ptype_mapping_get_parsed(void *parsed_result, int ret = -ENOTSUP; int max_ptype_num = 256; struct rte_pmd_i40e_ptype_mapping mapping[max_ptype_num]; + char errmsg[RTE_STRERR_BUFSIZE]; uint16_t count; int i; @@ -2191,7 +2243,9 @@ cmd_ptype_mapping_get_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } if (!ret) { @@ -2257,6 +2311,7 @@ cmd_ptype_mapping_replace_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_ptype_mapping_replace_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -2280,7 +2335,9 @@ cmd_ptype_mapping_replace_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -2331,6 +2388,7 @@ cmd_ptype_mapping_reset_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_ptype_mapping_reset_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = -ENOTSUP; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -2347,7 +2405,9 @@ cmd_ptype_mapping_reset_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -2404,6 +2464,7 @@ cmd_ptype_mapping_update_parsed(void *parsed_result, struct cmd_ptype_mapping_update_result *res = parsed_result; int ret = -ENOTSUP; struct rte_pmd_i40e_ptype_mapping mapping; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -2427,7 +2488,9 @@ cmd_ptype_mapping_update_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 35/52] net/ice: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (33 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 34/52] net/i40e: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 36/52] net/ixgbe: " Dengdui Huang ` (17 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/ice/ice_testpmd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_testpmd.c b/drivers/net/ice/ice_testpmd.c index 98c02d68c6..03ec3e0adc 100644 --- a/drivers/net/ice/ice_testpmd.c +++ b/drivers/net/ice/ice_testpmd.c @@ -38,6 +38,7 @@ cmd_ddp_dump_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_ddp_dump_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t *buff; uint32_t size; int ret = -ENOTSUP; @@ -59,9 +60,11 @@ cmd_ddp_dump_parsed(void *parsed_result, "dump DDP runtime configure.\n"); break; default: + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); fprintf(stderr, "Failed to dump DDP runtime configure," - " error: (%s)\n", strerror(-ret)); + " error: (%s)\n", errmsg); } } free(buff); @@ -105,6 +108,7 @@ cmd_ddp_dump_switch_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_ddp_dump_switch_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t *buff; uint32_t size; int ret = -ENOTSUP; @@ -126,9 +130,11 @@ cmd_ddp_dump_switch_parsed(void *parsed_result, "dump DDP switch runtime configure.\n"); break; default: + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); fprintf(stderr, "Failed to dump DDP switch runtime configure," - " error: (%s)\n", strerror(-ret)); + " error: (%s)\n", rte_strerror(-ret)); } } free(buff); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 36/52] net/ixgbe: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (34 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 35/52] net/ice: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 37/52] net/memif: " Dengdui Huang ` (16 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/ixgbe/ixgbe_testpmd.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_testpmd.c b/drivers/net/ixgbe/ixgbe_testpmd.c index e0d161eafe..d019a0d6fd 100644 --- a/drivers/net/ixgbe/ixgbe_testpmd.c +++ b/drivers/net/ixgbe/ixgbe_testpmd.c @@ -122,6 +122,7 @@ cmd_set_vf_split_drop_en_parsed(void *parsed_result, struct cmd_vf_split_drop_en_result *res = parsed_result; int ret = -ENOTSUP; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -141,7 +142,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -215,6 +218,7 @@ cmd_set_macsec_offload_on_parsed(void *parsed_result, int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0; int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0; struct rte_eth_dev_info dev_info; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -243,7 +247,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -300,6 +306,7 @@ cmd_set_macsec_offload_off_parsed(void *parsed_result, int ret = -ENOTSUP; struct rte_eth_dev_info dev_info; portid_t port_id = res->port_id; + char errmsg[RTE_STRERR_BUFSIZE]; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -327,7 +334,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -386,6 +395,7 @@ cmd_set_macsec_sc_parsed(void *parsed_result, struct cmd_macsec_sc_result *res = parsed_result; int ret = -ENOTSUP; int is_tx = (strcmp(res->tx_rx, "tx") == 0) ? 1 : 0; + char errmsg[RTE_STRERR_BUFSIZE]; ret = is_tx ? rte_pmd_ixgbe_macsec_config_txsc(res->port_id, @@ -402,7 +412,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -471,6 +483,7 @@ cmd_set_macsec_sa_parsed(void *parsed_result, struct cmd_macsec_sa_result *res = parsed_result; int ret = -ENOTSUP; int is_tx = (strcmp(res->tx_rx, "tx") == 0) ? 1 : 0; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t key[16] = { 0 }; uint8_t xdgt0; uint8_t xdgt1; @@ -510,7 +523,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -565,6 +580,7 @@ cmd_tc_min_bw_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { struct cmd_vf_tc_bw_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_port *port; uint8_t tc_num; uint8_t bw[16]; @@ -599,7 +615,9 @@ cmd_tc_min_bw_parsed(void *parsed_result, fprintf(stderr, "function not implemented\n"); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 37/52] net/memif: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (35 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 36/52] net/ixgbe: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 38/52] net/memif: use rte strerror Dengdui Huang ` (15 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/memif/memif_socket.c | 10 +++++-- drivers/net/memif/rte_eth_memif.c | 43 ++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c index 649f8d0e61..0bd4209920 100644 --- a/drivers/net/memif/memif_socket.c +++ b/drivers/net/memif/memif_socket.c @@ -57,6 +57,7 @@ memif_msg_send(int fd, memif_msg_t *msg, int afd) static int memif_msg_send_from_queue(struct memif_control_channel *cc) { + char errmsg[RTE_STRERR_BUFSIZE]; ssize_t size; int ret = 0; struct memif_msg_queue_elt *e; @@ -71,7 +72,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + MIF_LOG(ERR, "sendmsg fail: %s.", errmsg); ret = -1; } else { MIF_LOG(DEBUG, "Sent msg type %u.", e->msg.type); @@ -891,6 +894,7 @@ memif_listener_handler(void *arg) static struct memif_socket * memif_socket_create(char *key, uint8_t listener, bool is_abstract, uid_t owner_uid, gid_t owner_gid) { + char errmsg[RTE_STRERR_BUFSIZE]; struct memif_socket *sock; struct sockaddr_un un = { 0 }; uint32_t sunlen; @@ -975,7 +979,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + MIF_LOG(ERR, "Failed to setup socket %s: %s", key, errmsg); 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 cd722f254f..cdc1e0ced7 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -648,6 +648,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) uint64_t a; ssize_t size; struct rte_eth_link link; + char errmsg[RTE_STRERR_BUFSIZE]; if (unlikely((pmd->flags & ETH_MEMIF_FLAG_CONNECTED) == 0)) return 0; @@ -806,8 +807,10 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) size = write(rte_intr_fd_get(mq->intr_handle), &a, sizeof(a)); if (unlikely(size < 0)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); MIF_LOG(WARNING, - "Failed to send interrupt. %s", strerror(errno)); + "Failed to send interrupt. %s", errmsg); } } @@ -863,6 +866,7 @@ eth_memif_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) rte_eth_devices[mq->in_port].process_private; memif_ring_t *ring = memif_get_ring_from_queue(proc_private, mq); uint16_t slot, n_free, ring_size, mask, n_tx_pkts = 0; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_eth_link link; if (unlikely((pmd->flags & ETH_MEMIF_FLAG_CONNECTED) == 0)) @@ -957,8 +961,10 @@ eth_memif_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ssize_t size = write(rte_intr_fd_get(mq->intr_handle), &a, sizeof(a)); if (unlikely(size < 0)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); MIF_LOG(WARNING, - "Failed to send interrupt. %s", strerror(errno)); + "Failed to send interrupt. %s", errmsg); } } @@ -1047,6 +1053,7 @@ memif_region_init_shm(struct rte_eth_dev *dev, uint8_t has_buffers) struct pmd_internals *pmd = dev->data->dev_private; struct pmd_process_private *proc_private = dev->process_private; char shm_name[ETH_MEMIF_SHM_NAME_SIZE]; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = 0; struct memif_region *r; @@ -1080,27 +1087,35 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + MIF_LOG(ERR, "Failed to create shm file: %s.", errmsg); 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + MIF_LOG(ERR, "Failed to add seals to shm file: %s.", errmsg); goto error; } ret = ftruncate(r->fd, r->region_size); if (ret < 0) { - MIF_LOG(ERR, "Failed to truncate shm file: %s.", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + MIF_LOG(ERR, "Failed to truncate shm file: %s.", errmsg); 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)); + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); + MIF_LOG(ERR, "Failed to mmap shm region: %s.", errmsg); ret = -1; goto error; } @@ -1204,6 +1219,7 @@ static int memif_init_queues(struct rte_eth_dev *dev) { struct pmd_internals *pmd = dev->data->dev_private; + char errmsg[RTE_STRERR_BUFSIZE]; struct memif_queue *mq; int i; @@ -1219,9 +1235,11 @@ memif_init_queues(struct rte_eth_dev *dev) return -rte_errno; if (rte_intr_fd_get(mq->intr_handle) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); MIF_LOG(WARNING, "Failed to create eventfd for tx queue %d: %s.", i, - strerror(errno)); + errmsg); } mq->buffers = NULL; if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) { @@ -1243,9 +1261,11 @@ memif_init_queues(struct rte_eth_dev *dev) if (rte_intr_fd_set(mq->intr_handle, eventfd(0, EFD_NONBLOCK))) return -rte_errno; if (rte_intr_fd_get(mq->intr_handle) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); MIF_LOG(WARNING, "Failed to create eventfd for rx queue %d: %s.", i, - strerror(errno)); + errmsg); } mq->buffers = NULL; if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) { @@ -1285,6 +1305,7 @@ memif_connect(struct rte_eth_dev *dev) { struct pmd_internals *pmd = dev->data->dev_private; struct pmd_process_private *proc_private = dev->process_private; + char errmsg[RTE_STRERR_BUFSIZE]; struct memif_region *mr; struct memif_queue *mq; memif_ring_t *ring; @@ -1300,8 +1321,10 @@ memif_connect(struct rte_eth_dev *dev) PROT_READ | PROT_WRITE, MAP_SHARED, mr->fd, 0); if (mr->addr == MAP_FAILED) { - MIF_LOG(ERR, "mmap failed: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), + "Unknown error %d", errno); + MIF_LOG(ERR, "mmap failed: %s", errmsg); return -1; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 38/52] net/memif: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (36 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 37/52] net/memif: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 39/52] net/mlx4: replace strerror with reentrant version Dengdui Huang ` (14 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/memif/rte_eth_memif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index cdc1e0ced7..5e40d2fca1 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -2008,7 +2008,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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 39/52] net/mlx4: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (37 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 38/52] net/memif: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 40/52] net/mlx4: use rte strerror Dengdui Huang ` (13 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/mlx4/mlx4.c | 27 +++++++++++++++++++++------ drivers/net/mlx4/mlx4_rxq.c | 14 +++++++++++--- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 9c2872429f..e8872e105c 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -247,15 +247,18 @@ static int mlx4_dev_configure(struct rte_eth_dev *dev) { struct mlx4_priv *priv = dev->data->dev_private; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_flow_error error; int ret; /* Prepare internal flow rules. */ ret = mlx4_flow_sync(priv, &error); if (ret) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -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, errmsg, error.type, error.cause, error.message ? error.message : "(unspecified)"); goto exit; } @@ -291,6 +294,7 @@ static int mlx4_dev_start(struct rte_eth_dev *dev) { struct mlx4_priv *priv = dev->data->dev_private; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_flow_error error; uint16_t i; int ret; @@ -301,8 +305,10 @@ mlx4_dev_start(struct rte_eth_dev *dev) priv->started = 1; ret = mlx4_rss_init(priv); if (ret) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); ERROR("%p: cannot initialize RSS resources: %s", - (void *)dev, strerror(-ret)); + (void *)dev, errmsg); goto err; } #ifdef RTE_LIBRTE_MLX4_DEBUG @@ -316,10 +322,12 @@ mlx4_dev_start(struct rte_eth_dev *dev) } ret = mlx4_flow_sync(priv, &error); if (ret) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); 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, errmsg, error.type, error.cause, error.message ? error.message : "(unspecified)"); goto err; } @@ -788,6 +796,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) unsigned int vf; int i; char ifname[IF_NAMESIZE]; + char errmsg[RTE_STRERR_BUFSIZE]; (void)pci_drv; err = mlx4_init_once(); @@ -946,7 +955,9 @@ 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)); + if (strerror_r(err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", err); + ERROR("port query failed: %s", errmsg); goto port_error; } if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { @@ -962,8 +973,10 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) /* Make asynchronous FD non-blocking to handle interrupts. */ err = mlx4_fd_set_non_blocking(ctx->async_fd); if (err) { + if (strerror_r(err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", err); ERROR("cannot make asynchronous FD non-blocking: %s", - strerror(err)); + errmsg); goto port_error; } /* Allocate protection domain. */ @@ -1023,8 +1036,10 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) /* Configure the first MAC address by default. */ err = mlx4_get_mac(priv, &mac.addr_bytes); if (err) { + if (strerror_r(err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", err); ERROR("cannot get MAC address, is mlx4_en loaded?" - " (error: %s)", strerror(err)); + " (error: %s)", errmsg); goto port_error; } INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT, diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c index 781ee256df..d147bcad26 100644 --- a/drivers/net/mlx4/mlx4_rxq.c +++ b/drivers/net/mlx4/mlx4_rxq.c @@ -332,6 +332,7 @@ mlx4_rss_init(struct mlx4_priv *priv) { struct rte_eth_dev *dev = ETH_DEV(priv); uint8_t log2_range = rte_log2_u32(dev->data->nb_rx_queues); + char errmsg[RTE_STRERR_BUFSIZE]; uint32_t wq_num_prev = 0; const char *msg; unsigned int i; @@ -351,9 +352,11 @@ mlx4_rss_init(struct mlx4_priv *priv) MLX4DV_SET_CTX_ATTR_LOG_WQS_RANGE_SZ, &log2_range); if (ret) { + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", 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, errmsg); rte_errno = ret; return -ret; } @@ -430,8 +433,10 @@ mlx4_rss_init(struct mlx4_priv *priv) priv->rss_init = 1; return 0; error: + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); ERROR("cannot initialize common RSS resources (queue %u): %s: %s", - i, msg, strerror(ret)); + i, msg, errmsg); while (i--) { struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i]; @@ -508,6 +513,7 @@ mlx4_rxq_attach(struct rxq *rxq) uint32_t create_flags = 0; uint32_t comp_mask = 0; volatile struct mlx4_wqe_data_seg (*wqes)[]; + char errmsg[RTE_STRERR_BUFSIZE]; unsigned int i; int ret; @@ -630,8 +636,10 @@ mlx4_rxq_attach(struct rxq *rxq) claim_zero(mlx4_glue->destroy_cq(cq)); --rxq->usecnt; rte_errno = ret; + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); ERROR("error while attaching Rx queue %p: %s: %s", - (void *)rxq, msg, strerror(ret)); + (void *)rxq, msg, errmsg); priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_NONE; return -ret; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 40/52] net/mlx4: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (38 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 39/52] net/mlx4: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 41/52] net/mlx5: replace strerror with reentrant version Dengdui Huang ` (12 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++--------- drivers/net/mlx4/mlx4_rxq.c | 4 ++-- drivers/net/mlx4/mlx4_txq.c | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index e8872e105c..c28392bd16 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -802,7 +802,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); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index f11c6b4373..d52d2f5511 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 d147bcad26..6716038e46 100644 --- a/drivers/net/mlx4/mlx4_rxq.c +++ b/drivers/net/mlx4/mlx4_rxq.c @@ -890,13 +890,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. */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 41/52] net/mlx5: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (39 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 40/52] net/mlx4: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 42/52] net/mlx5: use rte strerror Dengdui Huang ` (11 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/mlx5/linux/mlx5_os.c | 5 ++- drivers/net/mlx5/linux/mlx5_socket.c | 40 ++++++++++++++++------- drivers/net/mlx5/linux/mlx5_verbs.c | 20 ++++++++---- drivers/net/mlx5/mlx5_devx.c | 9 ++++-- drivers/net/mlx5/mlx5_rxq.c | 12 ++++--- drivers/net/mlx5/mlx5_rxtx.c | 5 ++- drivers/net/mlx5/mlx5_stats.c | 5 ++- drivers/net/mlx5/mlx5_testpmd.c | 48 ++++++++++++++++++++-------- drivers/net/mlx5/windows/mlx5_os.c | 6 ++-- 9 files changed, 107 insertions(+), 43 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 0a8de88759..0ed5ba38a5 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1147,6 +1147,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, int nl_rdma; int i; struct mlx5_indexed_pool_config icfg[RTE_DIM(default_icfg)]; + char errmsg[RTE_STRERR_BUFSIZE]; memcpy(icfg, default_icfg, sizeof(icfg)); /* Determine if this port representor is supposed to be spawned. */ @@ -1256,7 +1257,9 @@ 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)); + if (strerror_r(err, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", err); + DRV_LOG(ERR, "port query failed: %s", errmsg); goto error; } if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c index 6ce0e59643..26c71670ca 100644 --- a/drivers/net/mlx5/linux/mlx5_socket.c +++ b/drivers/net/mlx5/linux/mlx5_socket.c @@ -54,6 +54,7 @@ mlx5_pmd_socket_handle(void *cb __rte_unused) FILE *file = NULL; struct rte_eth_dev *dev; struct rte_flow_error err; + char errmsg[RTE_STRERR_BUFSIZE]; struct mlx5_flow_dump_req *dump_req; struct mlx5_flow_dump_ack *dump_ack; @@ -61,13 +62,16 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(WARNING, "connection failed: %s", errmsg); 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(WARNING, "wrong message received: %s", errmsg); goto error; } @@ -136,9 +140,11 @@ mlx5_pmd_socket_handle(void *cb __rte_unused) do { ret = sendmsg(conn_sock, &msg, 0); } while (ret < 0 && errno == EINTR); - if (ret < 0) - DRV_LOG(WARNING, "failed to send response %s", - strerror(errno)); + if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(WARNING, "failed to send response %s", errmsg); + } error: if (conn_sock >= 0) close(conn_sock); @@ -158,6 +164,7 @@ mlx5_pmd_socket_init(void) struct sockaddr_un sun = { .sun_family = AF_UNIX, }; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; int flags; @@ -166,8 +173,9 @@ mlx5_pmd_socket_init(void) return 0; ret = socket(AF_UNIX, SOCK_STREAM, 0); if (ret < 0) { - DRV_LOG(WARNING, "Failed to open mlx5 socket: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(WARNING, "Failed to open mlx5 socket: %s", errmsg); goto error; } server_socket = ret; @@ -182,22 +190,28 @@ mlx5_pmd_socket_init(void) remove(sun.sun_path); ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun)); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(WARNING, - "cannot bind mlx5 socket: %s", strerror(errno)); + "cannot bind mlx5 socket: %s", errmsg); goto remove; } ret = listen(server_socket, 0); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(WARNING, "cannot listen on mlx5 socket: %s", - strerror(errno)); + errmsg); goto remove; } server_intr_handle = mlx5_os_interrupt_handler_create (RTE_INTR_INSTANCE_F_PRIVATE, false, server_socket, mlx5_pmd_socket_handle, NULL); if (server_intr_handle == NULL) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(WARNING, "cannot register interrupt handler for mlx5 socket: %s", - strerror(errno)); + errmsg); goto remove; } return 0; @@ -207,7 +221,9 @@ mlx5_pmd_socket_init(void) claim_zero(close(server_socket)); server_socket = -1; error: - DRV_LOG(ERR, "Cannot initialize socket: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Cannot initialize socket: %s", errmsg); return -errno; } diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c index 454bd7c77e..1624c8bbeb 100644 --- a/drivers/net/mlx5/linux/mlx5_verbs.c +++ b/drivers/net/mlx5/linux/mlx5_verbs.c @@ -94,13 +94,16 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, .qp_state = IBV_QPS_RESET, .port_num = dev_port, }; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (type != MLX5_TXQ_MOD_RST2RDY) { ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(ERR, "Cannot change Tx QP state to RESET %s", - strerror(errno)); + errmsg); rte_errno = errno; return ret; } @@ -110,24 +113,27 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, mod.qp_state = IBV_QPS_INIT; 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Cannot change Tx QP state to INIT %s", errmsg); rte_errno = errno; return ret; } mod.qp_state = IBV_QPS_RTR; 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Cannot change Tx QP state to RTR %s", errmsg); rte_errno = errno; return ret; } mod.qp_state = IBV_QPS_RTS; 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Cannot change Tx QP state to RTS %s", errmsg); rte_errno = errno; return ret; } diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c index 8ebe784000..1c6fbb597a 100644 --- a/drivers/net/mlx5/mlx5_devx.c +++ b/drivers/net/mlx5/mlx5_devx.c @@ -162,6 +162,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, uint8_t dev_port) { struct mlx5_devx_modify_sq_attr msq_attr = { 0 }; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (type != MLX5_TXQ_MOD_RST2RDY) { @@ -173,8 +174,10 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, msq_attr.state = MLX5_SQC_STATE_RST; ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(ERR, "Cannot change the Tx SQ state to RESET" - " %s", strerror(errno)); + " %s", errmsg); rte_errno = errno; return ret; } @@ -185,8 +188,10 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type, msq_attr.state = MLX5_SQC_STATE_RDY; ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(ERR, "Cannot change the Tx SQ state to READY" - " %s", strerror(errno)); + " %s", errmsg); rte_errno = errno; return ret; } diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index c6655b7db4..8ad36546b4 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -481,14 +481,16 @@ mlx5_rx_queue_stop_primary(struct rte_eth_dev *dev, uint16_t idx) struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_rxq_priv *rxq = mlx5_rxq_get(dev, idx); struct mlx5_rxq_ctrl *rxq_ctrl = rxq->ctrl; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; MLX5_ASSERT(rxq != NULL && rxq_ctrl != NULL); MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY); 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Cannot change Rx WQ state to RESET: %s", errmsg); rte_errno = errno; return ret; } @@ -567,6 +569,7 @@ mlx5_rx_queue_start_primary(struct rte_eth_dev *dev, uint16_t idx) struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_rxq_priv *rxq = mlx5_rxq_get(dev, idx); struct mlx5_rxq_data *rxq_data = &rxq->ctrl->rxq; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; MLX5_ASSERT(rxq != NULL && rxq->ctrl != NULL); @@ -586,8 +589,9 @@ mlx5_rx_queue_start_primary(struct rte_eth_dev *dev, uint16_t idx) rte_io_wmb(); 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Cannot change Rx WQ state to READY: %s", errmsg); rte_errno = errno; return ret; } diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index eadadcdffb..314d2d8c6b 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -394,6 +394,7 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev, const struct mlx5_mp_arg_queue_state_modify *sm) { int ret; + char errmsg[RTE_STRERR_BUFSIZE]; struct mlx5_priv *priv = dev->data->dev_private; if (sm->is_wq) { @@ -401,8 +402,10 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev, ret = priv->obj_ops.rxq_obj_modify(rxq, sm->state); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(ERR, "Cannot change Rx WQ state to %u - %s", - sm->state, strerror(errno)); + sm->state, errmsg); rte_errno = errno; return ret; } diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c index f4ac58e2f9..83338dc279 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -243,11 +243,14 @@ mlx5_xstats_reset(struct rte_eth_dev *dev) uint16_t stats_n = 0; uint16_t stats_n_2nd = 0; bool bond_master = (priv->master && priv->pf_bond >= 0); + char errmsg[RTE_STRERR_BUFSIZE]; ret = mlx5_os_get_stats_n(dev, bond_master, &stats_n, &stats_n_2nd); if (ret < 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id, - strerror(-ret)); + errmsg); return ret; } if (xstats_ctrl->stats_n != stats_n || diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c index 1bb5a89559..02fbd59582 100644 --- a/drivers/net/mlx5/mlx5_testpmd.c +++ b/drivers/net/mlx5/mlx5_testpmd.c @@ -202,6 +202,7 @@ mlx5_test_extend_devargs(char *identifier, char *extend) }; struct cmsghdr *cmsg; const char *path = mlx5_test_get_socket_path(extend + 1); + char errmsg[RTE_STRERR_BUFSIZE]; size_t len = 1; int socket_fd; int ret; @@ -214,14 +215,17 @@ mlx5_test_extend_devargs(char *identifier, char *extend) /* Initialize IPC channel. */ socket_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (socket_fd < 0) { - TESTPMD_LOG(ERR, "Failed to create unix socket: %s\n", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + TESTPMD_LOG(ERR, "Failed to create unix socket: %s\n", errmsg); return -1; } rte_strlcpy(un.sun_path, path, sizeof(un.sun_path)); if (connect(socket_fd, (struct sockaddr *)&un, sizeof(un)) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TESTPMD_LOG(ERR, "Failed to connect %s: %s\n", un.sun_path, - strerror(errno)); + errmsg); close(socket_fd); return -1; } @@ -231,8 +235,10 @@ mlx5_test_extend_devargs(char *identifier, char *extend) ret = sendmsg(socket_fd, &msgh, 0); } while (ret < 0 && errno == EINTR); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TESTPMD_LOG(ERR, "Failed to send request to (%s): %s\n", path, - strerror(errno)); + errmsg); close(socket_fd); return -1; } @@ -420,6 +426,7 @@ static void cmd_port_host_shaper_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_port_host_shaper_result *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = 0; if ((strcmp(res->mlx5, "mlx5") == 0) && @@ -430,8 +437,11 @@ static void cmd_port_host_shaper_parsed(void *parsed_result, (strcmp(res->rate, "rate") == 0)) 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)); + if (ret < 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + printf("cmd_port_host_shaper error: (%s)\n", errmsg); + } } static cmdline_parse_token_string_t cmd_port_host_shaper_mlx5 = @@ -565,6 +575,7 @@ mlx5_cmd_map_ext_rxq_parsed(void *parsed_result, __rte_unused void *data) { struct mlx5_cmd_map_ext_rxq *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -590,7 +601,9 @@ mlx5_cmd_map_ext_rxq_parsed(void *parsed_result, res->sw_queue_id); break; default: - fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -642,6 +655,7 @@ mlx5_cmd_unmap_ext_rxq_parsed(void *parsed_result, __rte_unused void *data) { struct mlx5_cmd_unmap_ext_rxq *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) @@ -663,7 +677,9 @@ 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)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "programming error: (%s)\n", errmsg); } } @@ -731,6 +747,7 @@ mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result, { struct mlx5_cmd_set_flow_engine_mode *res = parsed_result; enum rte_pmd_mlx5_flow_engine_mode mode; + char errmsg[RTE_STRERR_BUFSIZE]; uint32_t flag; int ret; @@ -743,13 +760,16 @@ mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result, ret = rte_pmd_mlx5_flow_engine_set_mode(mode, flag); - if (ret < 0) + if (ret < 0) { + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); 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)); - else + errmsg); + } 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); + } } cmdline_parse_token_string_t mlx5_cmd_set_flow_engine_mode_mlx5 = @@ -1164,6 +1184,7 @@ mlx5_cmd_destroy_tlv_options_parsed(void *parsed_result, __rte_unused void *data) { struct mlx5_cmd_destroy_tlv_options *res = parsed_result; + char errmsg[RTE_STRERR_BUFSIZE]; struct mlx5_port *port; int ret; @@ -1176,8 +1197,9 @@ mlx5_cmd_destroy_tlv_options_parsed(void *parsed_result, ret = rte_pmd_mlx5_destroy_geneve_tlv_parser(port->geneve_tlv_parser_handle); if (ret < 0) { - fprintf(stderr, "Fail to destroy GENEVE TLV parser: %s\n", - strerror(-ret)); + if (strerror_r(-ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -ret); + fprintf(stderr, "Fail to destroy GENEVE TLV parser: %s\n", errmsg); return; } diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index 0ebd233595..8032616268 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -354,6 +354,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, uint16_t port_id; int i; struct mlx5_indexed_pool_config icfg[RTE_DIM(default_icfg)]; + char errmsg[RTE_STRERR_BUFSIZE]; memcpy(icfg, default_icfg, sizeof(icfg)); /* Build device name. */ @@ -381,8 +382,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "failed to init showdown event: %s", errmsg); goto error; } /* Allocate private eth device data. */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 42/52] net/mlx5: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (40 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 41/52] net/mlx5: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 43/52] net/qede: replace strerror with reentrant version Dengdui Huang ` (10 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +++++++++++----------- drivers/net/mlx5/linux/mlx5_os.c | 16 ++++++++-------- drivers/net/mlx5/mlx5.c | 8 ++++---- drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_rxmode.c | 8 ++++---- drivers/net/mlx5/mlx5_stats.c | 2 +- drivers/net/mlx5/mlx5_testpmd.c | 10 +++++----- 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 | 10 +++++----- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index dfa2cd435c..063f6b871e 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -1516,7 +1516,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 5d64984022..c874303722 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -314,7 +314,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) { @@ -351,7 +351,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; } } @@ -395,7 +395,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) { @@ -430,7 +430,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; } } @@ -448,7 +448,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; } @@ -538,7 +538,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) DRV_LOG(DEBUG, "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; @@ -591,7 +591,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; @@ -666,7 +666,7 @@ mlx5_link_update_bond(struct rte_eth_dev *dev) ret = mlx5_ifreq_by_ifname(bond->ifname, SIOCGIFFLAGS, &ifr); if (ret) { DRV_LOG(WARNING, "ifname %s ioctl(SIOCGIFFLAGS) failed: %s", - bond->ifname, strerror(rte_errno)); + bond->ifname, rte_strerror(rte_errno)); return; } dev->data->dev_link.link_status = @@ -1118,7 +1118,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; @@ -1167,7 +1167,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); @@ -1725,7 +1725,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_counters(dev, bond_master, 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 0ed5ba38a5..1a330dd0b7 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1274,7 +1274,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; } @@ -1434,7 +1434,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; @@ -1525,7 +1525,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); @@ -1571,7 +1571,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; } @@ -2037,7 +2037,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); @@ -2751,7 +2751,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--) { @@ -2931,13 +2931,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/mlx5.c b/drivers/net/mlx5/mlx5.c index 52b90e6ff3..a44f86d70f 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1506,7 +1506,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; } } @@ -1835,7 +1835,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; @@ -2837,7 +2837,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; } } @@ -3068,7 +3068,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_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_stats.c b/drivers/net/mlx5/mlx5_stats.c index 83338dc279..ba7789287c 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -268,7 +268,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_counters(dev, bond_master, 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 02fbd59582..032382a564 100644 --- a/drivers/net/mlx5/mlx5_testpmd.c +++ b/drivers/net/mlx5/mlx5_testpmd.c @@ -1128,7 +1128,7 @@ mlx5_cmd_apply_tlv_options_parsed(void *parsed_result, if (handle == NULL) { fprintf(stderr, "Fail to create GENEVE TLV parser, nb_option=%u: %s\n", - tlv_mng.nb_options, strerror(rte_errno)); + tlv_mng.nb_options, rte_strerror(rte_errno)); return; } @@ -1281,10 +1281,10 @@ mlx5_cmd_dump_sq_context_options_parsed(void *parsed_result, fprintf(stderr, "invalid port_id %u\n", res->port_id); break; case -EIO: - fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); + fprintf(stderr, "File Access Error (%s)\n", rte_strerror(rte_errno)); break; default: - fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", strerror(rte_errno)); + fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", rte_strerror(rte_errno)); } } @@ -1363,10 +1363,10 @@ mlx5_cmd_dump_rq_context_options_parsed(void *parsed_result, fprintf(stderr, "invalid port_id %u\n", res->port_id); break; case -EIO: - fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); + fprintf(stderr, "File Access Error (%s)\n", rte_strerror(rte_errno)); break; default: - fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", strerror(rte_errno)); + fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", rte_strerror(rte_errno)); } } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index bf836c92fc..8ac91e6c71 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -1201,14 +1201,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) && @@ -1220,7 +1220,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) { @@ -1244,7 +1244,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; } /* @@ -1254,7 +1254,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. */ @@ -1307,7 +1307,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 49f750be68..cd0a02d76b 100644 --- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c @@ -221,7 +221,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 8032616268..24c24cf7a3 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -432,7 +432,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; @@ -442,7 +442,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); @@ -485,7 +485,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; } @@ -739,7 +739,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)) { @@ -858,7 +858,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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 43/52] net/qede: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (41 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 42/52] net/mlx5: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 44/52] net/sfc: " Dengdui Huang ` (9 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/qede/qede_regs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/qede/qede_regs.c b/drivers/net/qede/qede_regs.c index d2ea1c9108..ca8efd796e 100644 --- a/drivers/net/qede/qede_regs.c +++ b/drivers/net/qede/qede_regs.c @@ -213,6 +213,7 @@ qede_set_fw_dump_file_name(struct qede_dev *qdev) static int qede_write_fwdump(const char *dump_file, void *dump, size_t len) { + char errmsg[RTE_STRERR_BUFSIZE]; int err = 0; FILE *f; size_t bytes; @@ -220,8 +221,10 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len) f = fopen(dump_file, "wb+"); if (!f) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); fprintf(stderr, "Can't open file %s: %s\n", - dump_file, strerror(errno)); + dump_file, errmsg); return 1; } bytes = fwrite(dump, 1, len, f); @@ -233,8 +236,10 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len) } if (fclose(f)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); fprintf(stderr, "Can't close file %s: %s\n", - dump_file, strerror(errno)); + dump_file, errmsg); err = 1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 44/52] net/sfc: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (42 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 43/52] net/qede: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 45/52] net/tap: " Dengdui Huang ` (8 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/sfc/sfc_flow.c | 5 +- drivers/net/sfc/sfc_flow_tunnel.c | 6 +- drivers/net/sfc/sfc_mae.c | 152 +++++++++++++++++++++++------- 3 files changed, 126 insertions(+), 37 deletions(-) diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 1006243539..52c5800b10 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1321,6 +1321,7 @@ sfc_flow_parse_pattern(struct sfc_adapter *sa, unsigned int prev_layer = SFC_FLOW_ITEM_ANY_LAYER; boolean_t is_ifrm = B_FALSE; const struct sfc_flow_item *item; + char errmsg[RTE_STRERR_BUFSIZE]; if (pattern == NULL) { rte_flow_error_set(error, EINVAL, @@ -1396,8 +1397,10 @@ sfc_flow_parse_pattern(struct sfc_adapter *sa, rc = item->parse(pattern, parse_ctx, error); if (rc != 0) { + if (strerror_r(-rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -rc); sfc_err(sa, "failed to parse item %s: %s", - item->name, strerror(-rc)); + item->name, errmsg); return rc; } diff --git a/drivers/net/sfc/sfc_flow_tunnel.c b/drivers/net/sfc/sfc_flow_tunnel.c index 889fee569a..9bd4d10f17 100644 --- a/drivers/net/sfc/sfc_flow_tunnel.c +++ b/drivers/net/sfc/sfc_flow_tunnel.c @@ -60,6 +60,7 @@ sfc_ft_tunnel_rule_detect(struct sfc_adapter *sa, { const struct rte_flow_action_mark *action_mark = NULL; const struct rte_flow_action_jump *action_jump = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; struct sfc_ft_ctx *ft_ctx; uint32_t flow_mark = 0; int rc = 0; @@ -118,9 +119,10 @@ sfc_ft_tunnel_rule_detect(struct sfc_adapter *sa, sfc_dbg(sa, "FT: TUNNEL: detected"); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); /* The loop above might have spotted wrong actions. */ - sfc_err(sa, "FT: TUNNEL: invalid actions: %s", - strerror(rc)); + sfc_err(sa, "FT: TUNNEL: invalid actions: %s", errmsg); goto fail; } diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index b0e8b02b41..dfa9b5d9a1 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -410,6 +410,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa, efx_mae_match_spec_t *match_spec_action) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (rule == NULL) @@ -427,8 +428,10 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa, rule->encap_type, &fw_rsrc->rule_id); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to enable outer_rule=%p: %s", - rule, strerror(rc)); + rule, errmsg); return rc; } } @@ -445,7 +448,9 @@ 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)); + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); + sfc_err(sa, "can't match on outer rule ID: %s", errmsg); return rc; } @@ -468,6 +473,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa, { efx_mae_rule_id_t invalid_rule_id = { .id = EFX_MAE_RSRC_ID_INVALID }; struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (rule == NULL) @@ -483,8 +489,10 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa, rc = efx_mae_match_spec_outer_rule_id_set(match_spec_action, &invalid_rule_id); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "cannot restore match on invalid outer rule ID: %s", - strerror(rc)); + errmsg); return; } @@ -502,8 +510,10 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa, sfc_dbg(sa, "disabled outer_rule=%p with OR_ID=0x%08x", rule, fw_rsrc->rule_id.id); } else { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); 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, errmsg); } fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -600,6 +610,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa, efx_mae_actions_t *aset_spec) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc = 0; if (mac_addr == NULL) @@ -615,8 +626,10 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa, rc = efx_mae_mac_addr_alloc(sa->nic, mac_addr->addr_bytes, &fw_rsrc->mac_id); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to enable mac_addr=%p: %s", - mac_addr, strerror(rc)); + mac_addr, errmsg); return rc; } } @@ -641,8 +654,9 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa, fw_rsrc->mac_id.id = EFX_MAE_RSRC_ID_INVALID; } - sfc_err(sa, "cannot fill in MAC address entry ID: %s", - strerror(rc)); + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); + sfc_err(sa, "cannot fill in MAC address entry ID: %s", errmsg); return rc; } @@ -662,6 +676,7 @@ sfc_mae_mac_addr_disable(struct sfc_adapter *sa, struct sfc_mae_mac_addr *mac_addr) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (mac_addr == NULL) @@ -684,8 +699,10 @@ sfc_mae_mac_addr_disable(struct sfc_adapter *sa, sfc_dbg(sa, "disabled mac_addr=%p with MAC_ID=0x%08x", mac_addr, fw_rsrc->mac_id.id); } else { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); 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, errmsg); } fw_rsrc->mac_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -795,6 +812,7 @@ sfc_mae_encap_header_update(struct sfc_adapter *sa, { const struct sfc_mae_bounce_eh *bounce_eh = &sa->mae.bounce_eh; struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; uint8_t *buf; int ret; @@ -817,8 +835,10 @@ sfc_mae_encap_header_update(struct sfc_adapter *sa, encap_header->type, buf, bounce_eh->size); if (ret != 0) { + if (strerror_r(ret, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", ret); sfc_err(sa, "failed to update encap_header=%p: %s", - encap_header, strerror(ret)); + encap_header, errmsg); rte_free(buf); return ret; } @@ -839,6 +859,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa, efx_mae_actions_t *action_set_spec) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (encap_header == NULL) @@ -858,8 +879,10 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa, encap_header->size, &fw_rsrc->eh_id); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to enable encap_header=%p: %s", - encap_header, strerror(rc)); + encap_header, errmsg); return rc; } } @@ -873,7 +896,9 @@ 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)); + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); + sfc_err(sa, "can't fill in encap. header ID: %s", errmsg); return rc; } @@ -893,6 +918,7 @@ sfc_mae_encap_header_disable(struct sfc_adapter *sa, struct sfc_mae_encap_header *encap_header) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (encap_header == NULL) @@ -915,8 +941,10 @@ sfc_mae_encap_header_disable(struct sfc_adapter *sa, sfc_dbg(sa, "disabled encap_header=%p with EH_ID=0x%08x", encap_header, fw_rsrc->eh_id.id); } else { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); 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, errmsg); } fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -993,6 +1021,7 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter, efx_mae_actions_t *action_set_spec) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (counter == NULL) @@ -1007,8 +1036,10 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter, rc = sfc_mae_counter_fw_rsrc_enable(sa, counter); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to enable counter=%p: %s", - counter, rte_strerror(rc)); + counter, errmsg); return rc; } } @@ -1022,8 +1053,9 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter, fw_rsrc->counter_id.id = EFX_MAE_RSRC_ID_INVALID; } - sfc_err(sa, "cannot fill in counter ID: %s", - strerror(rc)); + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); + sfc_err(sa, "cannot fill in counter ID: %s", errmsg); return rc; } } @@ -1042,6 +1074,7 @@ static void sfc_mae_counter_disable(struct sfc_adapter *sa, struct sfc_mae_counter *counter) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (counter == NULL) @@ -1066,8 +1099,10 @@ sfc_mae_counter_disable(struct sfc_adapter *sa, struct sfc_mae_counter *counter) sfc_dbg(sa, "disabled counter=%p with COUNTER_ID=0x%x-#%u", counter, counter->type, counter_id); } else { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); 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, errmsg); } fw_rsrc->counter_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1178,6 +1213,7 @@ sfc_mae_action_set_enable(struct sfc_adapter *sa, struct sfc_mae_mac_addr *src_mac_addr; struct sfc_mae_counter *counter; struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (action_set == NULL) @@ -1240,8 +1276,10 @@ sfc_mae_action_set_enable(struct sfc_adapter *sa, rc = efx_mae_action_set_alloc(sa->nic, action_set->spec, &fw_rsrc->aset_id); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to enable action_set=%p: %s", - action_set, strerror(rc)); + action_set, errmsg); sfc_mae_encap_header_disable(sa, encap_header); sfc_mae_mac_addr_disable(sa, src_mac_addr); @@ -1264,6 +1302,7 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa, struct sfc_mae_action_set *action_set) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (action_set == NULL) @@ -1288,8 +1327,10 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa, sfc_dbg(sa, "disabled action_set=%p with AS_ID=0x%08x", action_set, fw_rsrc->aset_id.id); } else { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); 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, errmsg); } fw_rsrc->aset_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1411,6 +1452,7 @@ sfc_mae_action_set_list_enable(struct sfc_adapter *sa, struct sfc_mae_action_set_list *action_set_list) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; unsigned int i; unsigned int j; int rc; @@ -1444,8 +1486,10 @@ sfc_mae_action_set_list_enable(struct sfc_adapter *sa, mae->bounce_aset_ids, &fw_rsrc->aset_list_id); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to enable action_set_list=%p: %s", - action_set_list, strerror(rc)); + action_set_list, errmsg); goto fail_action_set_list_alloc; } @@ -1470,6 +1514,7 @@ sfc_mae_action_set_list_disable(struct sfc_adapter *sa, struct sfc_mae_action_set_list *action_set_list) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (action_set_list == NULL) @@ -1496,9 +1541,11 @@ sfc_mae_action_set_list_disable(struct sfc_adapter *sa, sfc_dbg(sa, "disabled action_set_list=%p with ASL_ID=0x%08x", action_set_list, fw_rsrc->aset_list_id.id); } else { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); 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)); + errmsg); } fw_rsrc->aset_list_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1676,6 +1723,7 @@ sfc_mae_action_rule_enable(struct sfc_adapter *sa, { const efx_mae_aset_list_id_t *asl_idp = NULL; const efx_mae_aset_id_t *as_idp = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; struct sfc_mae_fw_rsrc *fw_rsrc; int rc; @@ -1707,8 +1755,10 @@ sfc_mae_action_rule_enable(struct sfc_adapter *sa, rc = efx_mae_action_rule_insert(sa->nic, rule->match_spec, asl_idp, as_idp, &fw_rsrc->rule_id); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to enable action_rule=%p: %s", - rule, strerror(rc)); + rule, errmsg); goto fail_action_rule_insert; } @@ -1739,6 +1789,7 @@ sfc_mae_action_rule_disable(struct sfc_adapter *sa, struct sfc_mae_action_rule *rule) { struct sfc_mae_fw_rsrc *fw_rsrc; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; SFC_ASSERT(sfc_adapter_is_locked(sa)); @@ -1758,8 +1809,10 @@ sfc_mae_action_rule_disable(struct sfc_adapter *sa, sfc_dbg(sa, "disabled action_rule=%p with AR_ID=0x%08x", rule, fw_rsrc->rule_id.id); } else { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); 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, errmsg); } fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -4385,6 +4438,7 @@ sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa, const struct sfc_flow_spec_mae *spec_mae, efx_mae_actions_t *spec) { + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if (spec_mae->ft_rule_type == SFC_FT_RULE_TUNNEL) { @@ -4395,8 +4449,11 @@ 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)); + if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); + sfc_err(sa, "failed to request action MARK: %s", errmsg); + } return rc; } @@ -4409,6 +4466,7 @@ sfc_mae_rule_parse_action_count(struct sfc_adapter *sa, efx_mae_actions_t *spec) { struct sfc_mae_counter counter_tmp = {}; + char errmsg[RTE_STRERR_BUFSIZE]; int rc; if ((sa->counter_rxq.state & SFC_COUNTER_RXQ_INITIALIZED) == 0) { @@ -4432,9 +4490,11 @@ sfc_mae_rule_parse_action_count(struct sfc_adapter *sa, if (spec != NULL) { rc = efx_mae_action_set_populate_count(spec); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to populate counters in MAE action set: %s", - rte_strerror(rc)); + errmsg); goto fail_populate_count; } } @@ -4555,6 +4615,7 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa, efx_mae_actions_t *spec) { const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); + char errmsg[RTE_STRERR_BUFSIZE]; efx_mport_sel_t mport; uint32_t vf; int rc; @@ -4568,16 +4629,20 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa, rc = efx_mae_mport_by_pcie_function(encp->enc_pf, vf, &mport); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); 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)); + errmsg); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, errmsg); } return rc; @@ -4589,6 +4654,7 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa, efx_mae_actions_t *spec) { struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); + char errmsg[RTE_STRERR_BUFSIZE]; struct sfc_mae *mae = &sa->mae; unsigned int type_mask; efx_mport_sel_t mport; @@ -4605,15 +4671,19 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa, rc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id, port_id, type_mask, &mport); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - port_id, strerror(rc)); + port_id, errmsg); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, errmsg); } return rc; @@ -4624,6 +4694,7 @@ sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa, const struct rte_flow_action_ethdev *conf, unsigned int type_mask, efx_mae_actions_t *spec) { + char errmsg[RTE_STRERR_BUFSIZE]; struct sfc_mae *mae = &sa->mae; efx_mport_sel_t mport; int rc; @@ -4631,15 +4702,19 @@ sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa, rc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id, conf->port_id, type_mask, &mport); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - conf->port_id, strerror(rc)); + conf->port_id, errmsg); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, errmsg); } return rc; @@ -4650,6 +4725,7 @@ sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa, const struct rte_flow_action_ethdev *conf, efx_mae_actions_t *spec) { + char errmsg[RTE_STRERR_BUFSIZE]; struct sfc_mae *mae = &sa->mae; efx_mport_sel_t mport; int rc; @@ -4657,15 +4733,19 @@ sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa, rc = sfc_mae_switch_get_entity_mport(mae->switch_domain_id, conf->port_id, &mport); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - conf->port_id, strerror(rc)); + conf->port_id, errmsg); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, errmsg); } return rc; @@ -4750,6 +4830,8 @@ sfc_mae_rule_parse_action_rc(struct sfc_adapter *sa, struct rte_flow_error *error, int rc, bool custom_error) { + char errmsg[RTE_STRERR_BUFSIZE]; + if (rc == 0) { bundle->actions_mask |= (1ULL << action->type); } else if (!custom_error) { @@ -4757,8 +4839,10 @@ sfc_mae_rule_parse_action_rc(struct sfc_adapter *sa, const char *action_name = action_names[action->type]; if (action_name != NULL) { + if (strerror_r(rc, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", rc); sfc_err(sa, "action %s was rejected: %s", - action_name, strerror(rc)); + action_name, errmsg); } } rc = rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ACTION, -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 45/52] net/tap: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (43 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 44/52] net/sfc: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 46/52] net/tap: use rte strerror Dengdui Huang ` (7 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/tap/rte_eth_tap.c | 51 ++++++++++++++++++++++++++--------- drivers/net/tap/tap_flow.c | 33 ++++++++++++++++++----- drivers/net/tap/tap_netlink.c | 12 +++++++-- drivers/net/tap/tap_tcmsgs.c | 12 +++++++-- 4 files changed, 85 insertions(+), 23 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 650ddbd706..159d2e9c75 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -153,6 +153,7 @@ static int tap_intr_handle_set(struct rte_eth_dev *dev, int set); static int tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) { + char errmsg[RTE_STRERR_BUFSIZE]; struct ifreq ifr; #ifdef IFF_MULTI_QUEUE unsigned int features; @@ -196,16 +197,20 @@ 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) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(WARNING, "Unable to set TUNSETIFF for %s: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, errmsg); goto error; } /* Keep the device after application exit */ if (persistent && ioctl(fd, TUNSETPERSIST, 1) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(WARNING, "Unable to set persist %s: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, errmsg); goto error; } @@ -223,26 +228,32 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) */ ifr.ifr_flags = IFF_DETACH_QUEUE; if (ioctl(fd, TUNSETQUEUE, (void *)&ifr) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(WARNING, "Unable to detach keep-alive queue for %s: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, errmsg); goto error; } } flags = fcntl(fd, F_GETFL); if (flags == -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(WARNING, "Unable to get %s current flags: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, errmsg); goto error; } /* Always set the file descriptor to non-blocking */ flags |= O_NONBLOCK; if (fcntl(fd, F_SETFL, flags) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(WARNING, "Unable to set %s to nonblocking: %s", - ifr.ifr_name, strerror(errno)); + ifr.ifr_name, errmsg); goto error; } @@ -294,19 +305,25 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) } else { /* Enable signal on file descriptor */ if (fcntl(fd, F_SETSIG, signo) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(WARNING, "Unable to set signo %d for fd %d: %s", - signo, fd, strerror(errno)); + signo, fd, errmsg); goto error; } if (fcntl(fd, F_SETFL, flags | O_ASYNC) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(WARNING, "Unable to set fcntl flags: %s", - strerror(errno)); + errmsg); goto error; } if (fcntl(fd, F_SETOWN, getpid()) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(WARNING, "Unable to set fcntl owner: %s", - strerror(errno)); + errmsg); goto error; } } @@ -781,6 +798,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request, short req_flags = ifr->ifr_flags; int remote = pmd->remote_if_index && (mode == REMOTE_ONLY || mode == LOCAL_AND_REMOTE); + char errmsg[RTE_STRERR_BUFSIZE]; if (!pmd->remote_if_index && mode == REMOTE_ONLY) return 0; @@ -820,8 +838,10 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request, return 0; error: + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(DEBUG, "%s(%s) failed: %s(%d)", ifr->ifr_name, - tap_ioctl_req2str(request), strerror(errno), errno); + tap_ioctl_req2str(request), errmsg, errno); return -errno; } @@ -1913,6 +1933,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, struct pmd_internals *pmd; struct pmd_process_private *process_private; const char *tuntap_name = tuntap_types[type]; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_eth_dev_data *data; struct ifreq ifr; int i; @@ -1947,9 +1968,11 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, pmd->ioctl_sock = socket(AF_INET, SOCK_DGRAM, 0); if (pmd->ioctl_sock == -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "%s Unable to get a socket for management: %s", - tuntap_name, strerror(errno)); + tuntap_name, errmsg); goto error_exit; } @@ -2110,8 +2133,10 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, return 0; disable_rte_flow: + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, " Disabling rte flow support: %s(%d)", - strerror(errno), errno); + errmsg, errno); if (strlen(remote_iface)) { TAP_LOG(ERR, "Remote feature requires flow support."); goto error_exit; @@ -2121,8 +2146,10 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, #ifdef HAVE_TCA_FLOWER error_remote: + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, " Can't set up remote feature: %s(%d)", - strerror(errno), errno); + errmsg, errno); tap_flow_implicit_flush(pmd, NULL); #endif diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index c0e44bb1a7..01a9852bfd 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -1258,6 +1258,7 @@ tap_flow_create(struct rte_eth_dev *dev, { struct pmd_internals *pmd = dev->data->dev_private; struct rte_flow *remote_flow = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_flow *flow = NULL; struct tap_nlmsg *msg = NULL; int err; @@ -1300,9 +1301,11 @@ tap_flow_create(struct rte_eth_dev *dev, } err = tap_nl_recv_ack(pmd->nlsk_fd); if (err < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Kernel refused TC filter rule creation (%d): %s", - errno, strerror(errno)); + errno, errmsg); rte_flow_error_set(error, EEXIST, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "overlapping rules or Kernel too old for flower support"); @@ -1345,9 +1348,11 @@ tap_flow_create(struct rte_eth_dev *dev, } err = tap_nl_recv_ack(pmd->nlsk_fd); if (err < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Kernel refused TC filter rule creation (%d): %s", - errno, strerror(errno)); + errno, errmsg); rte_flow_error_set( error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -1382,6 +1387,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd, struct rte_flow_error *error) { struct rte_flow *remote_flow = flow->remote_flow; + char errmsg[RTE_STRERR_BUFSIZE]; int ret = 0; LIST_REMOVE(flow, next); @@ -1399,9 +1405,11 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd, if (ret < 0 && errno == ENOENT) ret = 0; if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Kernel refused TC filter rule deletion (%d): %s", - errno, strerror(errno)); + errno, errmsg); rte_flow_error_set( error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "couldn't receive kernel ack to our request"); @@ -1423,9 +1431,11 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd, if (ret < 0 && errno == ENOENT) ret = 0; if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Kernel refused TC filter rule deletion (%d): %s", - errno, strerror(errno)); + errno, errmsg); rte_flow_error_set( error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Failure trying to receive nl ack"); @@ -1578,6 +1588,7 @@ int tap_flow_implicit_create(struct pmd_internals *pmd, struct rte_flow_item_eth eth_local = { .hdr.ether_type = 0 }; unsigned int if_index = pmd->remote_if_index; struct rte_flow *remote_flow = NULL; + char errmsg[RTE_STRERR_BUFSIZE]; struct tap_nlmsg *msg = NULL; int err = 0; struct rte_flow_item items_local[2] = { @@ -1647,9 +1658,11 @@ int tap_flow_implicit_create(struct pmd_internals *pmd, /* Silently ignore re-entering existing rule */ if (errno == EEXIST) goto success; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Kernel refused TC filter rule creation (%d): %s", - errno, strerror(errno)); + errno, errmsg); goto fail; } LIST_INSERT_HEAD(&pmd->implicit_flows, remote_flow, next); @@ -1734,12 +1747,15 @@ void tap_flow_bpf_destroy(struct pmd_internals *pmd __rte_unused) */ static int rss_enable(struct pmd_internals *pmd, struct rte_flow_error *error) { + char errmsg[RTE_STRERR_BUFSIZE]; int err; /* Load the BPF program (defined in tap_bpf.h from skeleton) */ pmd->rss = tap_rss__open_and_load(); if (pmd->rss == NULL) { - TAP_LOG(ERR, "Failed to load BPF object: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + TAP_LOG(ERR, "Failed to load BPF object: %s", errmsg); rte_flow_error_set(error, errno, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "BPF object could not be loaded"); return -errno; @@ -1795,6 +1811,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd, const uint8_t *key_in; uint32_t hash_type = 0; uint32_t handle = flow->msg.t.tcm_handle; + char errmsg[RTE_STRERR_BUFSIZE]; unsigned int i; int err; @@ -1868,9 +1885,11 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd, &handle, sizeof(handle), &rss_entry, sizeof(rss_entry), 0); if (err) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Failed to update BPF map entry %#x (%d): %s", - handle, errno, strerror(errno)); + handle, errno, errmsg); 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 8a57c9242c..bd75ca8576 100644 --- a/drivers/net/tap/tap_netlink.c +++ b/drivers/net/tap/tap_netlink.c @@ -14,6 +14,7 @@ #include <rte_malloc.h> #include <tap_netlink.h> #include <rte_random.h> +#include <rte_errno.h> #include "tap_log.h" @@ -96,9 +97,13 @@ tap_nl_init(uint32_t nl_groups) int tap_nl_final(int nlsk_fd) { + char errmsg[RTE_STRERR_BUFSIZE]; + if (close(nlsk_fd)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Failed to close netlink socket: %s (%d)", - strerror(errno), errno); + errmsg, errno); return -1; } return 0; @@ -122,6 +127,7 @@ tap_nl_send(int nlsk_fd, struct nlmsghdr *nh) nh->nlmsg_pid = 0; /* communication with the kernel uses pid 0 */ nh->nlmsg_seq = (uint32_t)rte_rand(); + char errmsg[RTE_STRERR_BUFSIZE]; retry: send_bytes = send(nlsk_fd, nh, nh->nlmsg_len, 0); @@ -129,8 +135,10 @@ tap_nl_send(int nlsk_fd, struct nlmsghdr *nh) if (errno == EINTR) goto retry; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Failed to send netlink message: %s (%d)", - strerror(errno), errno); + errmsg, errno); return -1; } return send_bytes; diff --git a/drivers/net/tap/tap_tcmsgs.c b/drivers/net/tap/tap_tcmsgs.c index 1755b57519..5b45c3c296 100644 --- a/drivers/net/tap/tap_tcmsgs.c +++ b/drivers/net/tap/tap_tcmsgs.c @@ -8,6 +8,8 @@ #include <net/if.h> #include <string.h> +#include <rte_errno.h> + #include <rte_log.h> #include <tap_tcmsgs.h> #include "tap_log.h" @@ -258,12 +260,15 @@ qdisc_flush(int nlsk_fd, unsigned int ifindex) int qdisc_create_multiq(int nlsk_fd, unsigned int ifindex) { + char errmsg[RTE_STRERR_BUFSIZE]; int err = 0; err = qdisc_add_multiq(nlsk_fd, ifindex); if (err < 0 && errno != -EEXIST) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Could not add multiq qdisc (%d): %s", - errno, strerror(errno)); + errno, errmsg); return -1; } return 0; @@ -284,12 +289,15 @@ qdisc_create_multiq(int nlsk_fd, unsigned int ifindex) int qdisc_create_ingress(int nlsk_fd, unsigned int ifindex) { + char errmsg[RTE_STRERR_BUFSIZE]; int err = 0; err = qdisc_add_ingress(nlsk_fd, ifindex); if (err < 0 && errno != -EEXIST) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); TAP_LOG(ERR, "Could not add ingress qdisc (%d): %s", - errno, strerror(errno)); + errno, errmsg); return -1; } return 0; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 46/52] net/tap: use rte strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (44 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 45/52] net/tap: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 47/52] net/vhost: replace strerror with reentrant version Dengdui Huang ` (6 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/tap/rte_eth_tap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 159d2e9c75..441200e498 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2480,7 +2480,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; } } @@ -2540,7 +2540,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; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 47/52] net/vhost: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (45 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 46/52] net/tap: use rte strerror Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 48/52] net/virtio: " Dengdui Huang ` (5 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/vhost/rte_eth_vhost.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 87c05caccd..d35c13166a 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -550,6 +550,7 @@ find_internal_resource(char *ifname) static void eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx) { + char errmsg[RTE_STRERR_BUFSIZE]; struct rte_vhost_vring vring; struct vhost_queue *vq; @@ -567,8 +568,10 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx) /* Remove previous kickfd from proxy epoll */ if (vq->kickfd >= 0 && vq->kickfd != vring.kickfd) { if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_LOG_LINE(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s", - vq->kickfd, rxq_idx, strerror(errno)); + vq->kickfd, rxq_idx, errmsg); } else { VHOST_LOG_LINE(DEBUG, "Unregistered %d from rxq-%d epoll", vq->kickfd, rxq_idx); @@ -579,8 +582,10 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx) /* Add new one, if valid */ if (vq->kickfd != vring.kickfd && vring.kickfd >= 0) { if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_ADD, vring.kickfd, &vq->ev) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); VHOST_LOG_LINE(ERR, "Failed to register %d in rxq-%d epoll: %s", - vring.kickfd, rxq_idx, strerror(errno)); + vring.kickfd, rxq_idx, errmsg); } else { vq->kickfd = vring.kickfd; VHOST_LOG_LINE(DEBUG, "Registered %d in rxq-%d epoll", @@ -716,6 +721,7 @@ eth_vhost_configure_intr(struct rte_eth_dev *dev) static void eth_vhost_unconfigure_intr(struct rte_eth_dev *eth_dev) { + char errmsg[RTE_STRERR_BUFSIZE]; struct vhost_queue *vq; int i; @@ -729,9 +735,11 @@ eth_vhost_unconfigure_intr(struct rte_eth_dev *eth_dev) /* Remove previous kickfd from proxy epoll */ if (vq->kickfd >= 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) { VHOST_LOG_LINE(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s", - vq->kickfd, i, strerror(errno)); + vq->kickfd, i, errmsg); } else { VHOST_LOG_LINE(DEBUG, "Unregistered %d from rxq-%d epoll", vq->kickfd, i); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 48/52] net/virtio: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (46 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 47/52] net/vhost: replace strerror with reentrant version Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 49/52] raw/ifpga: " Dengdui Huang ` (4 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/virtio/virtio_user/vhost_kernel.c | 21 +++++-- .../net/virtio/virtio_user/vhost_kernel_tap.c | 56 +++++++++++++++---- drivers/net/virtio/virtio_user/vhost_user.c | 52 ++++++++++++----- drivers/net/virtio/virtio_user/vhost_vdpa.c | 30 ++++++++-- .../net/virtio/virtio_user/virtio_user_dev.c | 26 ++++++--- drivers/net/virtio/virtio_user_ethdev.c | 21 ++++--- 6 files changed, 155 insertions(+), 51 deletions(-) diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c index e42bb35935..c3ae6dd476 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -87,12 +87,15 @@ get_vhost_kernel_max_regions(void) static int vhost_kernel_ioctl(int fd, uint64_t request, void *arg) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; ret = ioctl(fd, request, arg); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "Vhost-kernel ioctl %"PRIu64" failed (%s)", - request, strerror(errno)); + request, errmsg); return -1; } @@ -381,6 +384,7 @@ vhost_kernel_set_status(struct virtio_user_dev *dev __rte_unused, uint8_t status static int vhost_kernel_setup(struct virtio_user_dev *dev) { + char errmsg[RTE_STRERR_BUFSIZE]; struct vhost_kernel_data *data; unsigned int tap_features; unsigned int tap_flags; @@ -428,7 +432,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, errmsg); goto err_tapfds; } data->vhostfds[i] = vhostfd; @@ -505,20 +511,23 @@ vhost_kernel_destroy(struct virtio_user_dev *dev) static int vhost_kernel_set_backend(int vhostfd, int tapfd) { + char errmsg[RTE_STRERR_BUFSIZE]; struct vhost_vring_file f; f.fd = 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s", errmsg); 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s", errmsg); 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..4adc28df55 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 <limits.h> #include <rte_ether.h> +#include <rte_errno.h> #include "vhost_kernel_tap.h" #include "../virtio_logs.h" @@ -22,17 +23,22 @@ int tap_support_features(unsigned int *tap_features) { + char errmsg[RTE_STRERR_BUFSIZE]; int tapfd; tapfd = open(PATH_NET_TUN, O_RDWR); if (tapfd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "fail to open %s: %s", - PATH_NET_TUN, strerror(errno)); + PATH_NET_TUN, errmsg); return -1; } if (ioctl(tapfd, TUNGETFEATURES, tap_features) == -1) { - PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", errmsg); close(tapfd); return -1; } @@ -44,16 +50,21 @@ tap_support_features(unsigned int *tap_features) int tap_open(const char *ifname, unsigned int r_flags, bool multi_queue) { + char errmsg[RTE_STRERR_BUFSIZE]; struct ifreq ifr; int tapfd; tapfd = open(PATH_NET_TUN, O_RDWR); if (tapfd < 0) { - PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, errmsg); return -1; } if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) { - PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", errmsg); close(tapfd); return -1; } @@ -66,14 +77,18 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue) ifr.ifr_flags |= IFF_MULTI_QUEUE; if (ioctl(tapfd, TUNSETIFF, (void *)&ifr) == -1) { if (multi_queue) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(DEBUG, "TUNSETIFF failed (will retry without IFF_MULTI_QUEUE): %s", - strerror(errno)); + errmsg); multi_queue = false; goto retry_mono_q; } - PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", errmsg); close(tapfd); tapfd = -1; } @@ -83,12 +98,15 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue) int tap_get_name(int tapfd, char **name) { + char errmsg[RTE_STRERR_BUFSIZE]; struct ifreq ifr; int ret; memset(&ifr, 0, sizeof(ifr)); if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) { - PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", errmsg); return -1; } ret = asprintf(name, "%s", ifr.ifr_name); @@ -100,11 +118,14 @@ tap_get_name(int tapfd, char **name) int tap_get_flags(int tapfd, unsigned int *tap_flags) { + char errmsg[RTE_STRERR_BUFSIZE]; struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) { - PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", errmsg); return -1; } *tap_flags = ifr.ifr_flags; @@ -114,13 +135,16 @@ tap_get_flags(int tapfd, unsigned int *tap_flags) int tap_set_mac(int tapfd, uint8_t *mac) { + char errmsg[RTE_STRERR_BUFSIZE]; struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", errmsg); return -1; } return 0; @@ -129,6 +153,7 @@ tap_set_mac(int tapfd, uint8_t *mac) static int vhost_kernel_tap_set_offload(int fd, uint64_t features) { + char errmsg[RTE_STRERR_BUFSIZE]; unsigned int offload = 0; if (features & (1ULL << VIRTIO_NET_F_GUEST_CSUM)) { @@ -154,8 +179,10 @@ vhost_kernel_tap_set_offload(int fd, uint64_t features) if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) { offload &= ~TUN_F_UFO; if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "TUNSETOFFLOAD ioctl() failed: %s", - strerror(errno)); + errmsg); return -1; } } @@ -166,6 +193,7 @@ vhost_kernel_tap_set_offload(int fd, uint64_t features) int vhost_kernel_tap_setup(int tapfd, int hdr_size, uint64_t features) { + char errmsg[RTE_STRERR_BUFSIZE]; int sndbuf = INT_MAX; int ret; @@ -175,12 +203,16 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", errmsg); return -1; } if (ioctl(tapfd, TUNSETSNDBUF, &sndbuf) < 0) { - PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", errmsg); return -1; } diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c index c10252506b..3f10fb95f4 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -111,6 +111,7 @@ vhost_user_write(int fd, struct vhost_user_msg *msg, int *fds, int fd_num) struct iovec iov; size_t fd_size = fd_num * sizeof(int); char control[CMSG_SPACE(fd_size)]; + char errmsg[RTE_STRERR_BUFSIZE]; struct cmsghdr *cmsg; memset(&msgh, 0, sizeof(msgh)); @@ -135,8 +136,11 @@ vhost_user_write(int fd, struct vhost_user_msg *msg, int *fds, int fd_num) r = sendmsg(fd, &msgh, 0); } while (r < 0 && errno == EINTR); - if (r < 0) - PMD_DRV_LOG(ERR, "Failed to send msg: %s", strerror(errno)); + if (r < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "Failed to send msg: %s", errmsg); + } return r; } @@ -146,10 +150,13 @@ vhost_user_read(int fd, struct vhost_user_msg *msg) { uint32_t valid_flags = VHOST_USER_REPLY_MASK | VHOST_USER_VERSION; int ret, sz_hdr = VHOST_USER_HDR_SIZE, sz_payload; + char errmsg[RTE_STRERR_BUFSIZE]; ret = recv(fd, (void *)msg, sz_hdr, 0); if (ret < 0) { - PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", errmsg); return -1; } else if (ret < sz_hdr) { PMD_DRV_LOG(ERR, "Failed to recv msg hdr: %d instead of %d.", @@ -175,7 +182,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", errmsg); return -1; } else if (ret < sz_payload) { PMD_DRV_LOG(ERR, "Failed to recv msg payload: %d instead of %u.", @@ -745,12 +754,15 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un) int ret; int flag; struct vhost_user_data *data = dev->backend_data; + char errmsg[RTE_STRERR_BUFSIZE]; int fd = data->listenfd; ret = bind(fd, (struct sockaddr *)un, sizeof(*un)); if (ret < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "failed to bind to %s: %s; remove it and try again", - dev->path, strerror(errno)); + dev->path, errmsg); return -1; } ret = listen(fd, MAX_VIRTIO_USER_BACKLOG); @@ -760,14 +772,18 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un) PMD_DRV_LOG(NOTICE, "(%s) waiting for client connection...", dev->path); data->vhostfd = accept(fd, NULL, NULL); if (data->vhostfd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "Failed to accept initial client connection (%s)", - strerror(errno)); + errmsg); 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "fcntl failed, %s", errmsg); return -1; } @@ -819,6 +835,7 @@ vhost_user_setup(struct virtio_user_dev *dev) int flag; struct sockaddr_un un; struct vhost_user_data *data; + char errmsg[RTE_STRERR_BUFSIZE]; data = malloc(sizeof(*data)); if (!data) { @@ -835,15 +852,22 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "socket() error, %s", errmsg); goto err_data; } flag = fcntl(fd, F_GETFD); - if (flag == -1) - PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", strerror(errno)); - else if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0) - PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", strerror(errno)); + if (flag == -1) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", errmsg); + } else if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", errmsg); + } memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; @@ -857,7 +881,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "connect error, %s", errmsg); 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 bc3e2a9af5..ed4f4930ed 100644 --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c @@ -88,12 +88,15 @@ struct vhost_msg { static int vhost_vdpa_ioctl(int fd, uint64_t request, void *arg) { + char errmsg[RTE_STRERR_BUFSIZE]; int ret; ret = ioctl(fd, request, arg); if (ret) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "Vhost-vDPA ioctl %"PRIu64" failed (%s)", - request, strerror(errno)); + request, errmsg); return -1; } @@ -172,6 +175,7 @@ static int vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev) { struct vhost_vdpa_data *data = dev->backend_data; + char errmsg[RTE_STRERR_BUFSIZE]; struct vhost_msg msg = {}; if (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) @@ -186,8 +190,10 @@ vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev) msg.iotlb.type = VHOST_IOTLB_BATCH_BEGIN; if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "Failed to send IOTLB batch begin (%s)", - strerror(errno)); + errmsg); return -1; } @@ -198,6 +204,7 @@ static int vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev) { struct vhost_vdpa_data *data = dev->backend_data; + char errmsg[RTE_STRERR_BUFSIZE]; struct vhost_msg msg = {}; if (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) @@ -212,8 +219,10 @@ vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev) msg.iotlb.type = VHOST_IOTLB_BATCH_END; if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "Failed to send IOTLB batch end (%s)", - strerror(errno)); + errmsg); return -1; } @@ -225,6 +234,7 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr, uint64_t iova, size_t len) { struct vhost_vdpa_data *data = dev->backend_data; + char errmsg[RTE_STRERR_BUFSIZE]; struct vhost_msg msg = {}; if (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) { @@ -243,8 +253,10 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr, __func__, iova, addr, len); if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)", - strerror(errno)); + errmsg); return -1; } @@ -256,6 +268,7 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr, uint64_t iova, size_t len) { struct vhost_vdpa_data *data = dev->backend_data; + char errmsg[RTE_STRERR_BUFSIZE]; struct vhost_msg msg = {}; if (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) { @@ -272,8 +285,10 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr, __func__, iova, len); if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)", - strerror(errno)); + errmsg); return -1; } @@ -519,6 +534,7 @@ vhost_vdpa_set_config(struct virtio_user_dev *dev, const uint8_t *data, uint32_t static int vhost_vdpa_setup(struct virtio_user_dev *dev) { + char errmsg[RTE_STRERR_BUFSIZE]; struct vhost_vdpa_data *data; uint32_t did = (uint32_t)-1; @@ -530,8 +546,10 @@ vhost_vdpa_setup(struct virtio_user_dev *dev) data->vhostfd = open(dev->path, O_RDWR); if (data->vhostfd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "Failed to open %s: %s", - dev->path, strerror(errno)); + dev->path, errmsg); 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 2997d2bd26..a4aeaa8a0b 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -53,20 +53,26 @@ virtio_user_uninit_notify_queue(struct virtio_user_dev *dev, uint32_t queue_sel) static int virtio_user_init_notify_queue(struct virtio_user_dev *dev, uint32_t queue_sel) { + char errmsg[RTE_STRERR_BUFSIZE]; + /* May use invalid flag, but some backend uses kickfd and * callfd as criteria to judge if dev is alive. so finally we * use real event_fd. */ dev->callfds[queue_sel] = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (dev->callfds[queue_sel] < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "(%s) Failed to setup callfd for queue %u: %s", - dev->path, queue_sel, strerror(errno)); + dev->path, queue_sel, errmsg); return -1; } dev->kickfds[queue_sel] = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (dev->kickfds[queue_sel] < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); PMD_DRV_LOG(ERR, "(%s) Failed to setup kickfd for queue %u: %s", - dev->path, queue_sel, strerror(errno)); + dev->path, queue_sel, errmsg); return -1; } @@ -1108,12 +1114,16 @@ static void virtio_user_control_queue_notify(struct virtqueue *vq, void *cookie) { struct virtio_user_dev *dev = cookie; + char errmsg[RTE_STRERR_BUFSIZE]; uint64_t notify_data = 1; if (!dev->notify_area) { - if (write(dev->kickfds[vq->vq_queue_index], ¬ify_data, sizeof(notify_data)) < 0) - PMD_DRV_LOG(ERR, "failed to kick backend: %s", - strerror(errno)); + if (write(dev->kickfds[vq->vq_queue_index], ¬ify_data, + sizeof(notify_data)) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "failed to kick backend: %s", errmsg); + } return; } else if (!virtio_with_feature(&dev->hw, VIRTIO_F_NOTIFICATION_DATA)) { rte_write16(vq->vq_queue_index, vq->notify_addr); @@ -1337,6 +1347,7 @@ virtio_user_dev_server_reconnect(struct virtio_user_dev *dev) int ret, old_status; struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->hw.port_id]; struct virtio_hw *hw = &dev->hw; + char errmsg[RTE_STRERR_BUFSIZE]; if (!dev->ops->server_reconnect) { PMD_DRV_LOG(ERR, "(%s) Missing server reconnect callback", dev->path); @@ -1357,8 +1368,9 @@ virtio_user_dev_server_reconnect(struct virtio_user_dev *dev) virtio_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); if (dev->ops->get_features(dev, &dev->device_features) < 0) { - PMD_INIT_LOG(ERR, "get_features failed: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_INIT_LOG(ERR, "get_features failed: %s", errmsg); return -1; } diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 747dddeb2e..d8611cda28 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -273,6 +273,7 @@ static void virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq) { struct virtio_user_dev *dev = virtio_user_get_dev(hw); + char errmsg[RTE_STRERR_BUFSIZE]; uint64_t notify_data = 1; if (hw->cvq && (virtnet_cq_to_vq(hw->cvq) == vq)) { @@ -283,9 +284,11 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq) if (!dev->notify_area) { if (write(dev->kickfds[vq->vq_queue_index], ¬ify_data, - sizeof(notify_data)) < 0) - PMD_DRV_LOG(ERR, "failed to kick backend: %s", - strerror(errno)); + sizeof(notify_data)) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_DRV_LOG(ERR, "failed to kick backend: %s", errmsg); + } return; } else if (!virtio_with_feature(hw, VIRTIO_F_NOTIFICATION_DATA)) { rte_write16(vq->vq_queue_index, vq->notify_addr); @@ -407,6 +410,7 @@ get_integer_arg(const char *key __rte_unused, static uint32_t vdpa_dynamic_major_num(void) { + char errmsg[RTE_STRERR_BUFSIZE]; FILE *fp; char *line = NULL; size_t size = 0; @@ -416,8 +420,9 @@ vdpa_dynamic_major_num(void) fp = fopen("/proc/devices", "r"); if (fp == NULL) { - PMD_INIT_LOG(ERR, "Cannot open /proc/devices: %s", - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_INIT_LOG(ERR, "Cannot open /proc/devices: %s", errmsg); return UNNAMED_MAJOR; } @@ -437,14 +442,16 @@ vdpa_dynamic_major_num(void) static enum virtio_user_backend_type virtio_user_backend_type(const char *path) { + char errmsg[RTE_STRERR_BUFSIZE]; struct stat sb; if (stat(path, &sb) == -1) { if (errno == ENOENT) return VIRTIO_USER_BACKEND_VHOST_USER; - PMD_INIT_LOG(ERR, "Stat fails: %s (%s)", path, - strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + PMD_INIT_LOG(ERR, "Stat fails: %s (%s)", path, errmsg); return VIRTIO_USER_BACKEND_UNKNOWN; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 49/52] raw/ifpga: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (47 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 48/52] net/virtio: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 50/52] vdpa/ifc: " Dengdui Huang ` (3 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/raw/ifpga/afu_pmd_n3000.c | 10 ++++++++-- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 24 +++++++++++++++++++----- drivers/raw/ifpga/ifpga_rawdev.c | 5 ++++- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c index 6aae1b224e..d9545a3b5f 100644 --- a/drivers/raw/ifpga/afu_pmd_n3000.c +++ b/drivers/raw/ifpga/afu_pmd_n3000.c @@ -21,6 +21,7 @@ #include <bus_pci_driver.h> #include <bus_ifpga_driver.h> #include <rte_rawdev.h> +#include <rte_errno.h> #include "afu_pmd_core.h" #include "afu_pmd_n3000.h" @@ -680,6 +681,7 @@ static void clear_interrupt(struct dma_afu_ctx *ctx) static int poll_interrupt(struct dma_afu_ctx *ctx) { + char errmsg[RTE_STRERR_BUFSIZE]; struct pollfd pfd = {0}; uint64_t count = 0; ssize_t bytes_read = 0; @@ -693,7 +695,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + IFPGA_RAWDEV_PMD_ERR("Error %s", errmsg); ret = -EFAULT; goto out; } else if (poll_ret == 0) { @@ -707,8 +711,10 @@ static int poll_interrupt(struct dma_afu_ctx *ctx) poll_ret, count); ret = 0; } else { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); IFPGA_RAWDEV_PMD_ERR("Failed %s", bytes_read > 0 ? - strerror(errno) : "zero bytes read"); + errmsg : "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..9f1643c5ee 100644 --- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c +++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c @@ -7,6 +7,8 @@ #include <unistd.h> #include "ifpga_sec_mgr.h" +#include <rte_errno.h> + static struct ifpga_sec_mgr *sec_mgr; static void set_rsu_control(struct ifpga_sec_mgr *smgr, uint32_t ctrl) @@ -91,6 +93,7 @@ static int start_flash_update(struct ifpga_sec_mgr *smgr) static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image, uint32_t offset) { + char errmsg[RTE_STRERR_BUFSIZE]; void *buf = NULL; int retry = 0; uint32_t length = 0; @@ -110,9 +113,11 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image, fd = open(image, O_RDONLY); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); dev_err(smgr, "Failed to open \'%s\' for RD [e:%s]\n", - image, strerror(errno)); + image, errmsg); return -EIO; } @@ -129,15 +134,19 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image, to_transfer = (length > IFPGA_RSU_DATA_BLK_SIZE) ? IFPGA_RSU_DATA_BLK_SIZE : length; if (lseek(fd, offset, SEEK_SET) < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); dev_err(smgr, "Failed to seek in \'%s\' [e:%s]\n", - image, strerror(errno)); + image, errmsg); ret = -EIO; goto end; } read_size = read(fd, buf, to_transfer); if (read_size < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); dev_err(smgr, "Failed to read from \'%s\' [e:%s]\n", - image, strerror(errno)); + image, errmsg); ret = -EIO; goto end; } @@ -280,6 +289,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image, struct sigaction sa; time_t start; int ret = 0; + char errmsg[RTE_STRERR_BUFSIZE]; if (!fme || !image || !status) { dev_err(fme, "Input parameter of %s is invalid\n", __func__); @@ -314,18 +324,22 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image, fd = open(image, O_RDONLY); if (fd < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); dev_err(smgr, "Failed to open \'%s\' for RD [e:%s]\n", - image, strerror(errno)); + image, errmsg); return -EIO; } len = lseek(fd, 0, SEEK_END); close(fd); if (len < 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); dev_err(smgr, "Failed to get file length of \'%s\' [e:%s]\n", - image, strerror(errno)); + image, errmsg); return -EIO; } if (len == 0) { diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index 5b9b596435..d6728079e1 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -834,6 +834,7 @@ static int rte_fpga_do_pr(struct rte_rawdev *rawdev, int port_id, const char *file_name) { + char errmsg[RTE_STRERR_BUFSIZE]; struct stat file_stat; int file_fd; int ret = 0; @@ -848,7 +849,9 @@ rte_fpga_do_pr(struct rte_rawdev *rawdev, int port_id, if (file_fd < 0) { IFPGA_RAWDEV_PMD_ERR("%s: open file error: %s", __func__, file_name); - IFPGA_RAWDEV_PMD_ERR("Message : %s", strerror(errno)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + IFPGA_RAWDEV_PMD_ERR("Message : %s", errmsg); return -EINVAL; } ret = stat(file_name, &file_stat); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 50/52] vdpa/ifc: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (48 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 49/52] raw/ifpga: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 51/52] vdpa/mlx5: " Dengdui Huang ` (2 subsequent siblings) 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/vdpa/ifc/ifcvf_vdpa.c | 57 ++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 65de383b95..170614d8ce 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -23,6 +23,7 @@ #include <rte_log.h> #include <rte_kvargs.h> #include <rte_devargs.h> +#include <rte_errno.h> #include "base/ifcvf.h" @@ -407,6 +408,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx) int ret; uint32_t i, nr_vring; char irq_set_buf[MSIX_IRQ_SET_BUF_LEN]; + char errmsg[RTE_STRERR_BUFSIZE]; struct vfio_irq_set *irq_set; int *fd_ptr; struct rte_vhost_vring vring; @@ -445,8 +447,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "can't setup eventfd: %s", errmsg); return -1; } internal->intr_fd[i] = fd; @@ -456,8 +459,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Error enabling MSI-X interrupts: %s", errmsg); return -1; } @@ -470,6 +474,7 @@ vdpa_disable_vfio_intr(struct ifcvf_internal *internal) int ret; uint32_t i, nr_vring; char irq_set_buf[MSIX_IRQ_SET_BUF_LEN]; + char errmsg[RTE_STRERR_BUFSIZE]; struct vfio_irq_set *irq_set; irq_set = (struct vfio_irq_set *)irq_set_buf; @@ -488,8 +493,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Error disabling MSI-X interrupts: %s", errmsg); return -1; } @@ -502,6 +508,7 @@ notify_relay(void *arg) int i, kickfd, epfd, nfds = 0; uint32_t qid, q_num; struct epoll_event events[IFCVF_MAX_QUEUES * 2]; + char errmsg[RTE_STRERR_BUFSIZE]; struct epoll_event ev; uint64_t buf; int nbytes; @@ -526,7 +533,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "epoll add error: %s", errmsg); return 1; } } @@ -550,9 +559,12 @@ notify_relay(void *arg) errno == EWOULDBLOCK || errno == EAGAIN) continue; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), + "Unknown error %d", errno); DRV_LOG(INFO, "Error reading " "kickfd: %s", - strerror(errno)); + errmsg); } break; } while (1); @@ -612,6 +624,7 @@ static uint32_t intr_relay(void *arg) { struct ifcvf_internal *internal = (struct ifcvf_internal *)arg; + char errmsg[RTE_STRERR_BUFSIZE]; struct epoll_event csc_event; struct epoll_event ev; uint64_t buf; @@ -628,7 +641,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "epoll add error: %s", errmsg); goto out; } @@ -651,9 +666,11 @@ intr_relay(void *arg) errno == EWOULDBLOCK || errno == EAGAIN) continue; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(ERR, "Error reading from file descriptor %d: %s", csc_event.data.fd, - strerror(errno)); + errmsg); goto out; } else if (nbytes == 0) { DRV_LOG(ERR, "Read nothing from file descriptor %d", @@ -926,6 +943,7 @@ vring_relay(void *arg) struct rte_vhost_vring vring; uint16_t qid, q_num; struct epoll_event events[IFCVF_MAX_QUEUES * 4]; + char errmsg[RTE_STRERR_BUFSIZE]; struct epoll_event ev; int nbytes; uint64_t buf; @@ -947,7 +965,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "epoll add error: %s", errmsg); return 1; } } @@ -961,7 +981,9 @@ 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "epoll add error: %s", errmsg); return 1; } update_used_ring(internal, qid); @@ -990,9 +1012,12 @@ vring_relay(void *arg) errno == EWOULDBLOCK || errno == EAGAIN) continue; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), + "Unknown error %d", errno); DRV_LOG(INFO, "Error reading " "kickfd: %s", - strerror(errno)); + errmsg); } break; } while (1); @@ -1250,6 +1275,7 @@ ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size) struct internal_list *list; struct ifcvf_internal *internal; struct vfio_region_info reg = { .argsz = sizeof(reg) }; + char errmsg[RTE_STRERR_BUFSIZE]; int ret; vdev = rte_vhost_get_vdpa_device(vid); @@ -1264,8 +1290,9 @@ ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size) reg.index = ifcvf_get_notify_region(&internal->hw); 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)); + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); + DRV_LOG(ERR, "Get not get device region info: %s", errmsg); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 51/52] vdpa/mlx5: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (49 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 50/52] vdpa/ifc: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 52/52] vdpa/sfc: " Dengdui Huang 2024-11-04 18:23 ` [PATCH v5 00/52] replace strerror Stephen Hemminger 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index 093cdd08d2..4a07f76a80 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -20,6 +20,7 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg) { struct mlx5_vdpa_virtq *virtq = cb_arg; struct mlx5_vdpa_priv *priv = virtq->priv; + char errmsg[RTE_STRERR_BUFSIZE]; uint64_t buf; int nbytes; int retry; @@ -43,8 +44,10 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg) errno == EWOULDBLOCK || errno == EAGAIN) continue; + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); DRV_LOG(ERR, "Failed to read kickfd of virtq %d: %s.", - virtq->index, strerror(errno)); + virtq->index, errmsg); } break; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v5 52/52] vdpa/sfc: replace strerror with reentrant version 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (50 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 51/52] vdpa/mlx5: " Dengdui Huang @ 2024-11-04 11:10 ` Dengdui Huang 2024-11-04 18:23 ` [PATCH v5 00/52] replace strerror Stephen Hemminger 52 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-04 11:10 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The function strerror() is insecure in a multi-thread environment. This patch uses strerror_r() to replace it. Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Huisong Li <lihuisong@huawei.com> --- drivers/vdpa/sfc/sfc_vdpa_ops.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c index 00f9a4b04c..7e549075c4 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c @@ -106,6 +106,7 @@ sfc_vdpa_enable_vfio_intr(struct sfc_vdpa_ops_data *ops_data) struct rte_vhost_vring vring; struct vfio_irq_set *irq_set; struct rte_pci_device *pci_dev; + char errmsg[RTE_STRERR_BUFSIZE]; char irq_set_buf[SFC_VDPA_MSIX_IRQ_SET_BUF_LEN]; void *dev; @@ -135,9 +136,11 @@ sfc_vdpa_enable_vfio_intr(struct sfc_vdpa_ops_data *ops_data) rc = ioctl(vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set); if (rc) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); sfc_vdpa_err(ops_data->dev_handle, "error enabling MSI-X interrupts: %s", - strerror(errno)); + errmsg); return -1; } @@ -150,6 +153,7 @@ sfc_vdpa_disable_vfio_intr(struct sfc_vdpa_ops_data *ops_data) int rc; int vfio_dev_fd; struct vfio_irq_set irq_set; + char errmsg[RTE_STRERR_BUFSIZE]; void *dev; dev = ops_data->dev_handle; @@ -163,9 +167,11 @@ sfc_vdpa_disable_vfio_intr(struct sfc_vdpa_ops_data *ops_data) rc = ioctl(vfio_dev_fd, VFIO_DEVICE_SET_IRQS, &irq_set); if (rc) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); sfc_vdpa_err(ops_data->dev_handle, "error disabling MSI-X interrupts: %s", - strerror(errno)); + errmsg); return -1; } @@ -812,6 +818,7 @@ sfc_vdpa_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size) struct rte_vdpa_device *vdpa_dev; struct sfc_vdpa_ops_data *ops_data; struct vfio_region_info reg = { .argsz = sizeof(reg) }; + char errmsg[RTE_STRERR_BUFSIZE]; const efx_nic_cfg_t *encp; int max_vring_cnt; int64_t len; @@ -840,8 +847,10 @@ sfc_vdpa_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size) reg.index = sfc_vdpa_adapter_by_dev_handle(dev)->mem_bar.esb_rid; ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, ®); if (ret != 0) { + if (strerror_r(errno, errmsg, sizeof(errmsg)) != 0) + snprintf(errmsg, sizeof(errmsg), "Unknown error %d", errno); sfc_vdpa_err(dev, "could not get device region info: %s", - strerror(errno)); + errmsg); return ret; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v5 00/52] replace strerror 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang ` (51 preceding siblings ...) 2024-11-04 11:10 ` [PATCH v5 52/52] vdpa/sfc: " Dengdui Huang @ 2024-11-04 18:23 ` Stephen Hemminger 52 siblings, 0 replies; 264+ messages in thread From: Stephen Hemminger @ 2024-11-04 18:23 UTC (permalink / raw) To: Dengdui Huang Cc: dev, ajit.khaparde, thomas, ferruh.yigit, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong On Mon, 4 Nov 2024 19:09:45 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > The function strerror() is insecure in a multi-thread environment. > It is better to use strerror_r() instead of strerror(). > In addition, rte_errno should obtain the error description through rte_strerror() instead of strerror(). > In this patchset, only the libs and drivers are modified. > > v4->v5 strerror_r(errno) replace strerror(errno), and rte_strerror replace strerror(rte_errno). > v3->v4 fix ci error > v2->v3 drop patch "telemetry: replace strerror" due to compile fail > v1-v2 fix ci error > > Dengdui Huang (52): > eal: fix use rte errno for libc function > devtools: forbid use of strerror > eal: replace strerror with reentrant version > eventdev: replace strerror with reentrant version > latency: replace strerror with reentrant version > node: replace strerror with reentrant version > pdump: replace strerror with reentrant version > pdump: use rte strerror > power: replace strerror with reentrant version > vhost: replace strerror with reentrant version > bpf: replace strerror with reentrant version > bus/cdx: replace strerror with reentrant version > bus/dpaa: replace strerror with reentrant version > bus/fslmc: replace strerror with reentrant version > bus/pci: replace strerror with reentrant version > bus/vmbus: replace strerror with reentrant version > bus/vdev: use rte strerror > common/cnxk: replace strerror with reentrant version > common/mlx5: replace strerror with reentrant version > common/mlx5: use rte strerror > crypto/caam_jr: replace strerror with reentrant version > dma/idxd: replace strerror with reentrant version > net/bnxt: replace strerror with reentrant version > net/af_xdp: replace strerror with reentrant version > net/af_xdp: use rte strerror > net/bonding: replace strerror with reentrant version > net/bonding: use rte strerror > net/cnxk: replace strerror with reentrant version > net/dpaa: replace strerror with reentrant version > net/dpaa2: replace strerror with reentrant version > net/enetfec: replace strerror with reentrant version > net/failsafe: replace strerror with reentrant version > net/failsafe: use rte strerror > net/i40e: replace strerror with reentrant version > net/ice: replace strerror with reentrant version > net/ixgbe: replace strerror with reentrant version > net/memif: replace strerror with reentrant version > net/memif: use rte strerror > net/mlx4: replace strerror with reentrant version > net/mlx4: use rte strerror > net/mlx5: replace strerror with reentrant version > net/mlx5: use rte strerror > net/qede: replace strerror with reentrant version > net/sfc: replace strerror with reentrant version > net/tap: replace strerror with reentrant version > net/tap: use rte strerror > net/vhost: replace strerror with reentrant version > net/virtio: replace strerror with reentrant version > raw/ifpga: replace strerror with reentrant version > vdpa/ifc: replace strerror with reentrant version > vdpa/mlx5: replace strerror with reentrant version > vdpa/sfc: replace strerror with reentrant version > > devtools/checkpatches.sh | 8 + > drivers/bus/cdx/cdx.c | 6 +- > drivers/bus/cdx/cdx_vfio.c | 58 +- > drivers/bus/dpaa/base/fman/fman.c | 8 +- > drivers/bus/dpaa/dpaa_bus.c | 5 +- > drivers/bus/fslmc/fslmc_vfio.c | 28 +- > drivers/bus/pci/bsd/pci.c | 20 +- > drivers/bus/pci/linux/pci.c | 16 +- > drivers/bus/pci/linux/pci_uio.c | 50 +- > drivers/bus/pci/linux/pci_vfio.c | 52 +- > drivers/bus/pci/pci_common_uio.c | 6 +- > drivers/bus/vdev/vdev.c | 2 +- > drivers/bus/vmbus/linux/vmbus_bus.c | 16 +- > drivers/bus/vmbus/linux/vmbus_uio.c | 55 +- > drivers/bus/vmbus/vmbus_common.c | 13 +- > drivers/bus/vmbus/vmbus_common_uio.c | 7 +- > drivers/common/cnxk/roc_dev.c | 12 +- > drivers/common/cnxk/roc_model.c | 8 +- > drivers/common/mlx5/linux/mlx5_nl.c | 15 +- > drivers/common/mlx5/mlx5_common.c | 6 +- > drivers/crypto/caam_jr/caam_jr_uio.c | 11 +- > drivers/dma/idxd/idxd_bus.c | 33 +- > drivers/net/af_xdp/rte_eth_af_xdp.c | 27 +- > drivers/net/bnxt/bnxt_stats.c | 8 +- > drivers/net/bnxt/rte_pmd_bnxt.c | 65 ++- > drivers/net/bnxt/tf_core/tf_core.c | 509 +++++++++++++----- > drivers/net/bnxt/tf_core/tf_em_common.c | 56 +- > .../net/bnxt/tf_core/tf_em_hash_internal.c | 10 +- > drivers/net/bnxt/tf_core/tf_em_host.c | 51 +- > drivers/net/bnxt/tf_core/tf_em_internal.c | 32 +- > drivers/net/bnxt/tf_core/tf_global_cfg.c | 23 +- > drivers/net/bnxt/tf_core/tf_identifier.c | 20 +- > drivers/net/bnxt/tf_core/tf_if_tbl.c | 15 +- > drivers/net/bnxt/tf_core/tf_msg.c | 347 +++++++++--- > drivers/net/bnxt/tf_core/tf_rm.c | 14 +- > drivers/net/bnxt/tf_core/tf_session.c | 161 ++++-- > drivers/net/bnxt/tf_core/tf_sram_mgr.c | 51 +- > drivers/net/bnxt/tf_core/tf_tbl.c | 62 ++- > drivers/net/bnxt/tf_core/tf_tbl_sram.c | 103 +++- > drivers/net/bnxt/tf_core/tf_tcam.c | 53 +- > drivers/net/bonding/bonding_testpmd.c | 18 +- > drivers/net/bonding/rte_eth_bond_api.c | 5 +- > drivers/net/bonding/rte_eth_bond_flow.c | 4 +- > drivers/net/bonding/rte_eth_bond_pmd.c | 16 +- > drivers/net/cnxk/cnxk_rep_msg.c | 9 +- > drivers/net/dpaa/dpaa_ethdev.c | 10 +- > drivers/net/dpaa/fmlib/fm_lib.c | 15 +- > drivers/net/dpaa2/dpaa2_ethdev.c | 12 +- > drivers/net/enetfec/enet_uio.c | 5 +- > drivers/net/failsafe/failsafe.c | 15 +- > drivers/net/failsafe/failsafe_args.c | 12 +- > drivers/net/failsafe/failsafe_eal.c | 7 +- > drivers/net/failsafe/failsafe_flow.c | 4 +- > drivers/net/failsafe/failsafe_ops.c | 5 +- > drivers/net/failsafe/failsafe_private.h | 17 +- > drivers/net/i40e/i40e_testpmd.c | 109 +++- > drivers/net/ice/ice_testpmd.c | 10 +- > drivers/net/ixgbe/ixgbe_testpmd.c | 30 +- > drivers/net/memif/memif_socket.c | 10 +- > drivers/net/memif/rte_eth_memif.c | 45 +- > drivers/net/mlx4/mlx4.c | 29 +- > drivers/net/mlx4/mlx4_ethdev.c | 18 +- > drivers/net/mlx4/mlx4_rxq.c | 18 +- > drivers/net/mlx4/mlx4_txq.c | 10 +- > drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- > drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +- > drivers/net/mlx5/linux/mlx5_os.c | 21 +- > drivers/net/mlx5/linux/mlx5_socket.c | 40 +- > drivers/net/mlx5/linux/mlx5_verbs.c | 20 +- > drivers/net/mlx5/mlx5.c | 8 +- > drivers/net/mlx5/mlx5_devx.c | 9 +- > drivers/net/mlx5/mlx5_mac.c | 2 +- > drivers/net/mlx5/mlx5_rxmode.c | 8 +- > drivers/net/mlx5/mlx5_rxq.c | 12 +- > drivers/net/mlx5/mlx5_rxtx.c | 5 +- > drivers/net/mlx5/mlx5_stats.c | 7 +- > drivers/net/mlx5/mlx5_testpmd.c | 58 +- > 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 | 16 +- > drivers/net/qede/qede_regs.c | 9 +- > drivers/net/sfc/sfc_flow.c | 5 +- > drivers/net/sfc/sfc_flow_tunnel.c | 6 +- > drivers/net/sfc/sfc_mae.c | 152 ++++-- > drivers/net/tap/rte_eth_tap.c | 55 +- > drivers/net/tap/tap_flow.c | 33 +- > drivers/net/tap/tap_netlink.c | 12 +- > drivers/net/tap/tap_tcmsgs.c | 12 +- > drivers/net/vhost/rte_eth_vhost.c | 14 +- > drivers/net/virtio/virtio_user/vhost_kernel.c | 21 +- > .../net/virtio/virtio_user/vhost_kernel_tap.c | 56 +- > drivers/net/virtio/virtio_user/vhost_user.c | 52 +- > drivers/net/virtio/virtio_user/vhost_vdpa.c | 30 +- > .../net/virtio/virtio_user/virtio_user_dev.c | 26 +- > drivers/net/virtio/virtio_user_ethdev.c | 21 +- > drivers/raw/ifpga/afu_pmd_n3000.c | 10 +- > drivers/raw/ifpga/base/ifpga_fme_rsu.c | 24 +- > drivers/raw/ifpga/ifpga_rawdev.c | 5 +- > drivers/vdpa/ifc/ifcvf_vdpa.c | 57 +- > drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 5 +- > drivers/vdpa/sfc/sfc_vdpa_ops.c | 15 +- > lib/bpf/bpf_load_elf.c | 5 +- > lib/eal/common/eal_common_fbarray.c | 6 +- > lib/eal/common/eal_common_options.c | 19 +- > lib/eal/common/eal_common_proc.c | 32 +- > lib/eal/common/eal_common_trace_utils.c | 14 +- > lib/eal/freebsd/eal.c | 10 +- > lib/eal/freebsd/eal_interrupts.c | 26 +- > lib/eal/freebsd/eal_memory.c | 6 +- > lib/eal/freebsd/eal_timer.c | 22 +- > lib/eal/include/rte_errno.h | 3 + > lib/eal/linux/eal.c | 25 +- > lib/eal/linux/eal_dev.c | 5 +- > lib/eal/linux/eal_hugepage_info.c | 17 +- > lib/eal/linux/eal_interrupts.c | 51 +- > lib/eal/linux/eal_memalloc.c | 118 ++-- > lib/eal/linux/eal_memory.c | 102 +++- > lib/eal/linux/eal_timer.c | 6 +- > lib/eal/linux/eal_vfio.c | 102 +++- > lib/eal/unix/eal_filesystem.c | 12 +- > lib/eal/unix/eal_unix_memory.c | 19 +- > lib/eal/unix/rte_thread.c | 18 +- > lib/eal/windows/include/rte_os_shim.h | 1 + > lib/eventdev/rte_event_eth_rx_adapter.c | 8 +- > lib/latencystats/rte_latencystats.c | 10 +- > lib/node/kernel_tx.c | 8 +- > lib/pdump/rte_pdump.c | 12 +- > lib/power/guest_channel.c | 15 +- > lib/power/power_kvm_vm.c | 6 +- > lib/power/power_pstate_cpufreq.c | 14 +- > lib/power/rte_power_pmd_mgmt.c | 6 +- > lib/vhost/fd_man.c | 14 +- > lib/vhost/socket.c | 34 +- > lib/vhost/vduse.c | 105 +++- > lib/vhost/vhost_user.c | 25 +- > 136 files changed, 3172 insertions(+), 1045 deletions(-) > NAK - not needed. See my earlier comments. ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH 00/43] replace strerror 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (44 preceding siblings ...) 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang @ 2024-11-06 18:57 ` Stephen Hemminger 2024-11-07 2:52 ` huangdengdui 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang 46 siblings, 1 reply; 264+ messages in thread From: Stephen Hemminger @ 2024-11-06 18:57 UTC (permalink / raw) To: Dengdui Huang; +Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong On Tue, 14 Nov 2023 16:24:56 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > The function strerror() is insecure in a multi-thread environment. > This series of patches fix it. In this patchset, only the libs and > drivers are modified. strerror is ok in multi-threaded environment, look at what glibc does. The bigger problem is where DPDK code is calling strerror() on rte_errno. This should be flagged by checkpatch (but isn't now). Examples: $ git grep 'strerror(rte_errno)' | grep -v rte_strerror app/dumpcap/main.c: strerror(rte_errno)); app/test/test_bpf.c: __func__, __LINE__, rte_errno, strerror(rte_errno)); app/test/test_bpf.c: __func__, __LINE__, str, rte_errno, strerror(rte_errno)); app/test/test_bpf.c: __func__, __LINE__, rte_errno, strerror(rte_errno)); app/test/test_bpf.c: __func__, __LINE__, s, rte_errno, strerror(rte_errno)); app/test/test_bpf.c: __func__, __LINE__, rte_errno, strerror(rte_errno)); drivers/bus/vdev/vdev.c: devname, strerror(rte_errno)); drivers/common/mlx5/linux/mlx5_nl.c: iface_idx, strerror(rte_errno)); drivers/common/mlx5/linux/mlx5_nl.c: add ? "add" : "remove", m, strerror(rte_errno)); drivers/common/mlx5/linux/mlx5_nl.c: strerror(rte_errno)); drivers/common/mlx5/linux/mlx5_nl.c: strerror(rte_errno)); drivers/common/mlx5/linux/mlx5_nl.c: strerror(rte_errno)); drivers/common/mlx5/mlx5_common.c: strerror(rte_errno)); drivers/common/mlx5/mlx5_common.c: strerror(rte_errno)); drivers/common/mlx5/mlx5_common.c: strerror(rte_errno)); drivers/net/af_xdp/rte_eth_af_xdp.c: name, strerror(rte_errno)); drivers/net/bonding/rte_eth_bond_flow.c: strerror(rte_errno)); drivers/net/bonding/rte_eth_bond_flow.c: strerror(rte_errno)); drivers/net/failsafe/failsafe.c: strerror(rte_errno)); drivers/net/failsafe/failsafe_eal.c: rte_errno ? strerror(rte_errno) : "", drivers/net/failsafe/failsafe_flow.c: strerror(rte_errno)); drivers/net/failsafe/failsafe_flow.c: strerror(rte_errno)); drivers/net/memif/rte_eth_memif.c: strerror(rte_errno)); drivers/net/mlx4/mlx4.c: strerror(rte_errno)); drivers/net/mlx4/mlx4_ethdev.c: mode, rte_errno, strerror(rte_errno), error.type, error.cause, drivers/net/mlx4/mlx4_ethdev.c: index, rte_errno, strerror(rte_errno), error.type, error.cause, drivers/net/mlx4/mlx4_ethdev.c: index, rte_errno, strerror(rte_errno), error.type, error.cause, drivers/net/mlx4/mlx4_ethdev.c: rte_errno, strerror(rte_errno), error.type, error.cause, drivers/net/mlx4/mlx4_ethdev.c: rte_errno, strerror(rte_errno), error.type, error.cause, drivers/net/mlx4/mlx4_ethdev.c: WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(rte_errno)); drivers/net/mlx4/mlx4_ethdev.c: strerror(rte_errno)); drivers/net/mlx4/mlx4_ethdev.c: strerror(rte_errno)); drivers/net/mlx4/mlx4_ethdev.c: strerror(rte_errno)); drivers/net/mlx4/mlx4_rxq.c: (void *)dev, strerror(rte_errno)); drivers/net/mlx4/mlx4_rxq.c: (void *)dev, strerror(rte_errno)); drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); drivers/net/mlx5/hws/mlx5dr_matcher.c: strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: bond->ifname, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_os.c: eth_dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/mlx5.c: strerror(rte_errno)); drivers/net/mlx5/mlx5.c: strerror(rte_errno)); drivers/net/mlx5/mlx5.c: strerror(rte_errno)); drivers/net/mlx5/mlx5.c: strerror(rte_errno)); drivers/net/mlx5/mlx5_mac.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_rxmode.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_rxmode.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_rxmode.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_rxmode.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_stats.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_testpmd.c: tlv_mng.nb_options, strerror(rte_errno)); drivers/net/mlx5/mlx5_testpmd.c: fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); drivers/net/mlx5/mlx5_testpmd.c: fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", strerror(rte_errno)); drivers/net/mlx5/mlx5_testpmd.c: fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); drivers/net/mlx5/mlx5_testpmd.c: fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", strerror(rte_errno)); drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/mlx5_vlan.c: " %s", dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/windows/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/windows/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/windows/mlx5_os.c: strerror(rte_errno)); drivers/net/mlx5/windows/mlx5_os.c: eth_dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/windows/mlx5_os.c: dev->data->port_id, strerror(rte_errno)); drivers/net/mlx5/windows/mlx5_os.c: strerror(rte_errno)); drivers/net/tap/rte_eth_tap.c: strerror(rte_errno)); drivers/net/tap/rte_eth_tap.c: strerror(rte_errno)); lib/eal/linux/eal_dev.c: "(rte_errno: %s)!", strerror(rte_errno)); lib/eal/unix/eal_unix_memory.c: virt, size, flags, strerror(rte_errno)); lib/pdump/rte_pdump.c: strerror(rte_errno)); ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH 00/43] replace strerror 2024-11-06 18:57 ` [PATCH 00/43] " Stephen Hemminger @ 2024-11-07 2:52 ` huangdengdui 0 siblings, 0 replies; 264+ messages in thread From: huangdengdui @ 2024-11-07 2:52 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong On 2024/11/7 2:57, Stephen Hemminger wrote: > On Tue, 14 Nov 2023 16:24:56 +0800 > Dengdui Huang <huangdengdui@huawei.com> wrote: > >> The function strerror() is insecure in a multi-thread environment. >> This series of patches fix it. In this patchset, only the libs and >> drivers are modified. > > strerror is ok in multi-threaded environment, look at what glibc does. > Yes, it's safe in the latest version.[1] But, static variables used in previous versions, so it is insecure in multi-threaded environment.[2][3] [1]:https://elixir.bootlin.com/glibc/glibc-2.40/source/string/strerror.c#L24 [2]:https://elixir.bootlin.com/glibc/glibc-2.31/source/string/strerror.c#L26 [3]:https://elixir.bootlin.com/glibc/glibc-2.3/source/string/strerror.c#L29 > The bigger problem is where DPDK code is calling strerror() on rte_errno. > This should be flagged by checkpatch (but isn't now). I found it, too, and have fixed it in this patchset. But I didn't add it to the checkpatch script. > > Examples: > $ git grep 'strerror(rte_errno)' | grep -v rte_strerror > app/dumpcap/main.c: strerror(rte_errno)); > app/test/test_bpf.c: __func__, __LINE__, rte_errno, strerror(rte_errno)); > app/test/test_bpf.c: __func__, __LINE__, str, rte_errno, strerror(rte_errno)); > app/test/test_bpf.c: __func__, __LINE__, rte_errno, strerror(rte_errno)); > app/test/test_bpf.c: __func__, __LINE__, s, rte_errno, strerror(rte_errno)); > app/test/test_bpf.c: __func__, __LINE__, rte_errno, strerror(rte_errno)); > drivers/bus/vdev/vdev.c: devname, strerror(rte_errno)); > drivers/common/mlx5/linux/mlx5_nl.c: iface_idx, strerror(rte_errno)); > drivers/common/mlx5/linux/mlx5_nl.c: add ? "add" : "remove", m, strerror(rte_errno)); > drivers/common/mlx5/linux/mlx5_nl.c: strerror(rte_errno)); > drivers/common/mlx5/linux/mlx5_nl.c: strerror(rte_errno)); > drivers/common/mlx5/linux/mlx5_nl.c: strerror(rte_errno)); > drivers/common/mlx5/mlx5_common.c: strerror(rte_errno)); > drivers/common/mlx5/mlx5_common.c: strerror(rte_errno)); > drivers/common/mlx5/mlx5_common.c: strerror(rte_errno)); > drivers/net/af_xdp/rte_eth_af_xdp.c: name, strerror(rte_errno)); > drivers/net/bonding/rte_eth_bond_flow.c: strerror(rte_errno)); > drivers/net/bonding/rte_eth_bond_flow.c: strerror(rte_errno)); > drivers/net/failsafe/failsafe.c: strerror(rte_errno)); > drivers/net/failsafe/failsafe_eal.c: rte_errno ? strerror(rte_errno) : "", > drivers/net/failsafe/failsafe_flow.c: strerror(rte_errno)); > drivers/net/failsafe/failsafe_flow.c: strerror(rte_errno)); > drivers/net/memif/rte_eth_memif.c: strerror(rte_errno)); > drivers/net/mlx4/mlx4.c: strerror(rte_errno)); > drivers/net/mlx4/mlx4_ethdev.c: mode, rte_errno, strerror(rte_errno), error.type, error.cause, > drivers/net/mlx4/mlx4_ethdev.c: index, rte_errno, strerror(rte_errno), error.type, error.cause, > drivers/net/mlx4/mlx4_ethdev.c: index, rte_errno, strerror(rte_errno), error.type, error.cause, > drivers/net/mlx4/mlx4_ethdev.c: rte_errno, strerror(rte_errno), error.type, error.cause, > drivers/net/mlx4/mlx4_ethdev.c: rte_errno, strerror(rte_errno), error.type, error.cause, > drivers/net/mlx4/mlx4_ethdev.c: WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(rte_errno)); > drivers/net/mlx4/mlx4_ethdev.c: strerror(rte_errno)); > drivers/net/mlx4/mlx4_ethdev.c: strerror(rte_errno)); > drivers/net/mlx4/mlx4_ethdev.c: strerror(rte_errno)); > drivers/net/mlx4/mlx4_rxq.c: (void *)dev, strerror(rte_errno)); > drivers/net/mlx4/mlx4_rxq.c: (void *)dev, strerror(rte_errno)); > drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); > drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); > drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); > drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); > drivers/net/mlx4/mlx4_txq.c: (void *)dev, strerror(rte_errno)); > drivers/net/mlx5/hws/mlx5dr_matcher.c: strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: bond->ifname, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_os.c: eth_dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/linux/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/mlx5.c: strerror(rte_errno)); > drivers/net/mlx5/mlx5.c: strerror(rte_errno)); > drivers/net/mlx5/mlx5.c: strerror(rte_errno)); > drivers/net/mlx5/mlx5.c: strerror(rte_errno)); > drivers/net/mlx5/mlx5_mac.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_rxmode.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_rxmode.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_rxmode.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_rxmode.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_stats.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_testpmd.c: tlv_mng.nb_options, strerror(rte_errno)); > drivers/net/mlx5/mlx5_testpmd.c: fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); > drivers/net/mlx5/mlx5_testpmd.c: fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", strerror(rte_errno)); > drivers/net/mlx5/mlx5_testpmd.c: fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); > drivers/net/mlx5/mlx5_testpmd.c: fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", strerror(rte_errno)); > drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_trigger.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/mlx5_vlan.c: " %s", dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/windows/mlx5_ethdev_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/windows/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/windows/mlx5_os.c: strerror(rte_errno)); > drivers/net/mlx5/windows/mlx5_os.c: eth_dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/windows/mlx5_os.c: dev->data->port_id, strerror(rte_errno)); > drivers/net/mlx5/windows/mlx5_os.c: strerror(rte_errno)); > drivers/net/tap/rte_eth_tap.c: strerror(rte_errno)); > drivers/net/tap/rte_eth_tap.c: strerror(rte_errno)); > lib/eal/linux/eal_dev.c: "(rte_errno: %s)!", strerror(rte_errno)); > lib/eal/unix/eal_unix_memory.c: virt, size, flags, strerror(rte_errno)); > lib/pdump/rte_pdump.c: strerror(rte_errno)); ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 00/14] use rte_strerror() for rte_errno 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang ` (45 preceding siblings ...) 2024-11-06 18:57 ` [PATCH 00/43] " Stephen Hemminger @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 01/14] eal: fix use rte errno for libc function Dengdui Huang ` (15 more replies) 46 siblings, 16 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong Whether strerror() needs to be replaced needs further discussion, but rte_error should not be used by strerror() because rte_errno may be an RTE-specific error code. This patchset use rte_strerror() instead of strerror() for rte_errno. Also, I tried to add it to checkpatch, but rte_errno can be used as an argument to any function and the checkpatch script should not return an error, so I didn't do that. Dengdui Huang (14): eal: fix use rte errno for libc function eal: use rte strerror pdump: use rte strerror bus/vdev: use rte strerror common/mlx5: use rte strerror net/af_xdp: use rte strerror net/bonding: use rte strerror net/failsafe: use rte strerror net/memif: use rte strerror net/mlx4: use rte strerror net/mlx5: use rte strerror net/tap: use rte strerror app/dumpcap: use rte strerror test: use rte strerror app/dumpcap/main.c | 2 +- app/test/test_bpf.c | 10 +++++----- drivers/bus/vdev/vdev.c | 2 +- drivers/common/mlx5/linux/mlx5_nl.c | 10 +++++----- drivers/common/mlx5/mlx5_common.c | 6 +++--- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- drivers/net/bonding/rte_eth_bond_flow.c | 4 ++-- drivers/net/failsafe/failsafe.c | 2 +- drivers/net/failsafe/failsafe_eal.c | 2 +- drivers/net/failsafe/failsafe_flow.c | 4 ++-- drivers/net/memif/rte_eth_memif.c | 2 +- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++--------- drivers/net/mlx4/mlx4_rxq.c | 4 ++-- drivers/net/mlx4/mlx4_txq.c | 10 +++++----- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +++++++++++----------- drivers/net/mlx5/linux/mlx5_os.c | 16 ++++++++-------- drivers/net/mlx5/mlx5.c | 8 ++++---- drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_rxmode.c | 8 ++++---- drivers/net/mlx5/mlx5_stats.c | 2 +- drivers/net/mlx5/mlx5_testpmd.c | 10 +++++----- 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 | 10 +++++----- drivers/net/tap/rte_eth_tap.c | 4 ++-- lib/eal/linux/eal_dev.c | 2 +- lib/eal/unix/eal_unix_memory.c | 2 +- lib/pdump/rte_pdump.c | 2 +- 31 files changed, 93 insertions(+), 93 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 01/14] eal: fix use rte errno for libc function 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 02/14] eal: use rte strerror Dengdui Huang ` (14 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong In the libc function, rte_errno is not assigned a value. Therefore, errno should be used instead of it. Fixes: c4b89ecb64ea ("eal: introduce memory management wrappers") Cc: stable@dpdk.org Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- lib/eal/unix/eal_unix_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c index 97969a401b..4fd066a290 100644 --- a/lib/eal/unix/eal_unix_memory.c +++ b/lib/eal/unix/eal_unix_memory.c @@ -84,7 +84,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump) int ret = madvise(virt, size, flags); if (ret) { EAL_LOG(DEBUG, "madvise(%p, %#zx, %d) failed: %s", - virt, size, flags, strerror(rte_errno)); + virt, size, flags, strerror(errno)); rte_errno = errno; } return ret; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 02/14] eal: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 01/14] eal: fix use rte errno for libc function Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 03/14] pdump: " Dengdui Huang ` (13 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- lib/eal/linux/eal_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index e63f24d108..95b1d02c9f 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) { -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 03/14] pdump: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 01/14] eal: fix use rte errno for libc function Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 02/14] eal: use rte strerror Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 04/14] bus/vdev: " Dengdui Huang ` (12 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- lib/pdump/rte_pdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index 679c3dd0b5..55c6eeaa36 100644 --- a/lib/pdump/rte_pdump.c +++ b/lib/pdump/rte_pdump.c @@ -407,7 +407,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_LINE(ERR, "failed to send to client:%s", - strerror(rte_errno)); + rte_strerror(rte_errno)); return -1; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 04/14] bus/vdev: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (2 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 03/14] pdump: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 05/14] common/mlx5: " Dengdui Huang ` (11 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- 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 ec7abe7cda..299f8c2873 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -437,7 +437,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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 05/14] common/mlx5: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (3 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 04/14] bus/vdev: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 06/14] net/af_xdp: " Dengdui Huang ` (10 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- drivers/common/mlx5/linux/mlx5_nl.c | 10 +++++----- drivers/common/mlx5/mlx5_common.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index a5ac4dc543..5b18d7f8cc 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -548,7 +548,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; } @@ -618,7 +618,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; @@ -705,7 +705,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; } @@ -930,7 +930,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; } @@ -957,7 +957,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; } 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; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 06/14] net/af_xdp: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (4 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 05/14] common/mlx5: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 07/14] net/bonding: " Dengdui Huang ` (9 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 814398ba4b..c74107d46a 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -2518,7 +2518,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_LINE(ERR, "%s: Failed to register multi-process IPC callback: %s", - name, strerror(rte_errno)); + name, rte_strerror(rte_errno)); return -1; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 07/14] net/bonding: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (5 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 06/14] net/af_xdp: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 08/14] net/failsafe: " Dengdui Huang ` (8 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- drivers/net/bonding/rte_eth_bond_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c index 5d0be5caf5..a38cc84f56 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 08/14] net/failsafe: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (6 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 07/14] net/bonding: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 09/14] net/memif: " Dengdui Huang ` (7 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- drivers/net/failsafe/failsafe.c | 2 +- drivers/net/failsafe/failsafe_eal.c | 2 +- drivers/net/failsafe/failsafe_flow.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 32811403b4..dd3fd24301 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; diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index e79d3b4120..16e4be6e8d 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; } 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; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 09/14] net/memif: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (7 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 08/14] net/failsafe: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 10/14] net/mlx4: " Dengdui Huang ` (6 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- drivers/net/memif/rte_eth_memif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index c0bf1e3bbf..fdd92390b9 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -1993,7 +1993,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; -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 10/14] net/mlx4: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (8 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 09/14] net/memif: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 11/14] net/mlx5: " Dengdui Huang ` (5 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++--------- drivers/net/mlx4/mlx4_rxq.c | 4 ++-- drivers/net/mlx4/mlx4_txq.c | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 9c2872429f..d4e3e4997d 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -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); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index f11c6b4373..d52d2f5511 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..cb8c6fa649 100644 --- a/drivers/net/mlx4/mlx4_rxq.c +++ b/drivers/net/mlx4/mlx4_rxq.c @@ -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. */ -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 11/14] net/mlx5: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (9 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 10/14] net/mlx4: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 12/14] net/tap: " Dengdui Huang ` (4 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +++++++++++----------- drivers/net/mlx5/linux/mlx5_os.c | 16 ++++++++-------- drivers/net/mlx5/mlx5.c | 8 ++++---- drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_rxmode.c | 8 ++++---- drivers/net/mlx5/mlx5_stats.c | 2 +- drivers/net/mlx5/mlx5_testpmd.c | 10 +++++----- 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 | 10 +++++----- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 54460cc82b..fd293d3f49 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -1566,7 +1566,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 5d64984022..c874303722 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -314,7 +314,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) { @@ -351,7 +351,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; } } @@ -395,7 +395,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) { @@ -430,7 +430,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; } } @@ -448,7 +448,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; } @@ -538,7 +538,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) DRV_LOG(DEBUG, "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; @@ -591,7 +591,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; @@ -666,7 +666,7 @@ mlx5_link_update_bond(struct rte_eth_dev *dev) ret = mlx5_ifreq_by_ifname(bond->ifname, SIOCGIFFLAGS, &ifr); if (ret) { DRV_LOG(WARNING, "ifname %s ioctl(SIOCGIFFLAGS) failed: %s", - bond->ifname, strerror(rte_errno)); + bond->ifname, rte_strerror(rte_errno)); return; } dev->data->dev_link.link_status = @@ -1118,7 +1118,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; @@ -1167,7 +1167,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); @@ -1725,7 +1725,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_counters(dev, bond_master, 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 69a80b9ddc..524627b5e6 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1271,7 +1271,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; } @@ -1431,7 +1431,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; @@ -1522,7 +1522,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); @@ -1568,7 +1568,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; } @@ -2039,7 +2039,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); @@ -2746,7 +2746,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--) { @@ -2926,13 +2926,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/mlx5.c b/drivers/net/mlx5/mlx5.c index 52b90e6ff3..a44f86d70f 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1506,7 +1506,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; } } @@ -1835,7 +1835,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; @@ -2837,7 +2837,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; } } @@ -3068,7 +3068,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_mac.c b/drivers/net/mlx5/mlx5_mac.c index 0e5d2be530..b246df99cd 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -110,7 +110,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = mlx5_traffic_mac_remove(dev, &addr); if (ret) DRV_LOG(ERR, "port %u cannot update control flow rules: %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_stats.c b/drivers/net/mlx5/mlx5_stats.c index f4ac58e2f9..1b6d0f42b0 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -265,7 +265,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev) ret = mlx5_os_read_dev_counters(dev, bond_master, 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 1bb5a89559..bf5b645a58 100644 --- a/drivers/net/mlx5/mlx5_testpmd.c +++ b/drivers/net/mlx5/mlx5_testpmd.c @@ -1108,7 +1108,7 @@ mlx5_cmd_apply_tlv_options_parsed(void *parsed_result, if (handle == NULL) { fprintf(stderr, "Fail to create GENEVE TLV parser, nb_option=%u: %s\n", - tlv_mng.nb_options, strerror(rte_errno)); + tlv_mng.nb_options, rte_strerror(rte_errno)); return; } @@ -1259,10 +1259,10 @@ mlx5_cmd_dump_sq_context_options_parsed(void *parsed_result, fprintf(stderr, "invalid port_id %u\n", res->port_id); break; case -EIO: - fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); + fprintf(stderr, "File Access Error (%s)\n", rte_strerror(rte_errno)); break; default: - fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", strerror(rte_errno)); + fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", rte_strerror(rte_errno)); } } @@ -1341,10 +1341,10 @@ mlx5_cmd_dump_rq_context_options_parsed(void *parsed_result, fprintf(stderr, "invalid port_id %u\n", res->port_id); break; case -EIO: - fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno)); + fprintf(stderr, "File Access Error (%s)\n", rte_strerror(rte_errno)); break; default: - fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", strerror(rte_errno)); + fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", rte_strerror(rte_errno)); } } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 79b3d4d982..d52ef74ead 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -1209,14 +1209,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) && @@ -1228,7 +1228,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) { @@ -1252,7 +1252,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; } /* @@ -1262,7 +1262,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. */ @@ -1315,7 +1315,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 43a314a679..c2cd1a5b25 100644 --- a/drivers/net/mlx5/mlx5_vlan.c +++ b/drivers/net/mlx5/mlx5_vlan.c @@ -117,7 +117,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 49f750be68..cd0a02d76b 100644 --- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c @@ -221,7 +221,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 268598f209..94fb980353 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -430,7 +430,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; @@ -440,7 +440,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); @@ -483,7 +483,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; } @@ -742,7 +742,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)) { @@ -861,7 +861,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); -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 12/14] net/tap: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (10 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 11/14] net/mlx5: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 13/14] app/dumpcap: " Dengdui Huang ` (3 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- drivers/net/tap/rte_eth_tap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 650ddbd706..6c67f53dcc 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2453,7 +2453,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; } } @@ -2513,7 +2513,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; } } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 13/14] app/dumpcap: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (11 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 12/14] net/tap: " Dengdui Huang @ 2024-11-14 11:39 ` Dengdui Huang 2024-11-14 11:40 ` [PATCH v6 14/14] test: " Dengdui Huang ` (2 subsequent siblings) 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:39 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- app/dumpcap/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index 3d3c0dbc66..6b122862af 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -796,7 +796,7 @@ static dumpcap_out_t create_output(void) version(), capture_comment); if (ret.pcapng == NULL) rte_exit(EXIT_FAILURE, "pcapng_fdopen failed: %s\n", - strerror(rte_errno)); + rte_strerror(rte_errno)); free(os); TAILQ_FOREACH(intf, &interfaces, next) { -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* [PATCH v6 14/14] test: use rte strerror 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (12 preceding siblings ...) 2024-11-14 11:39 ` [PATCH v6 13/14] app/dumpcap: " Dengdui Huang @ 2024-11-14 11:40 ` Dengdui Huang 2024-11-14 16:31 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Stephen Hemminger 2024-11-15 6:01 ` fengchengwen 15 siblings, 0 replies; 264+ messages in thread From: Dengdui Huang @ 2024-11-14 11:40 UTC (permalink / raw) To: dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong The rte_errno may be an RTE-specific error code, use rte_strerror() instead of strerror(). Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- app/test/test_bpf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c index 90e10d7d2c..2f9412e28c 100644 --- a/app/test/test_bpf.c +++ b/app/test/test_bpf.c @@ -3225,7 +3225,7 @@ run_test(const struct bpf_test *tst) bpf = rte_bpf_load(&tst->prm); if (bpf == NULL) { printf("%s@%d: failed to load bpf code, error=%d(%s);\n", - __func__, __LINE__, rte_errno, strerror(rte_errno)); + __func__, __LINE__, rte_errno, rte_strerror(rte_errno)); return -1; } @@ -3321,14 +3321,14 @@ test_bpf_match(pcap_t *pcap, const char *str, prm = rte_bpf_convert(&fcode); if (prm == NULL) { printf("%s@%d: bpf_convert('%s') failed,, error=%d(%s);\n", - __func__, __LINE__, str, rte_errno, strerror(rte_errno)); + __func__, __LINE__, str, rte_errno, rte_strerror(rte_errno)); goto error; } bpf = rte_bpf_load(prm); if (bpf == NULL) { printf("%s@%d: failed to load bpf code, error=%d(%s);\n", - __func__, __LINE__, rte_errno, strerror(rte_errno)); + __func__, __LINE__, rte_errno, rte_strerror(rte_errno)); goto error; } @@ -3444,7 +3444,7 @@ test_bpf_filter(pcap_t *pcap, const char *s) prm = rte_bpf_convert(&fcode); if (prm == NULL) { printf("%s@%d: bpf_convert('%s') failed,, error=%d(%s);\n", - __func__, __LINE__, s, rte_errno, strerror(rte_errno)); + __func__, __LINE__, s, rte_errno, rte_strerror(rte_errno)); goto error; } @@ -3454,7 +3454,7 @@ test_bpf_filter(pcap_t *pcap, const char *s) bpf = rte_bpf_load(prm); if (bpf == NULL) { printf("%s@%d: failed to load bpf code, error=%d(%s);\n", - __func__, __LINE__, rte_errno, strerror(rte_errno)); + __func__, __LINE__, rte_errno, rte_strerror(rte_errno)); goto error; } -- 2.33.0 ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v6 00/14] use rte_strerror() for rte_errno 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (13 preceding siblings ...) 2024-11-14 11:40 ` [PATCH v6 14/14] test: " Dengdui Huang @ 2024-11-14 16:31 ` Stephen Hemminger 2024-11-15 6:01 ` fengchengwen 15 siblings, 0 replies; 264+ messages in thread From: Stephen Hemminger @ 2024-11-14 16:31 UTC (permalink / raw) To: Dengdui Huang Cc: dev, ajit.khaparde, thomas, ferruh.yigit, mb, david.marchand, iboukris, lihuisong, fengchengwen, haijie1, liuyonglong On Thu, 14 Nov 2024 19:39:46 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > Whether strerror() needs to be replaced needs further discussion, > but rte_error should not be used by strerror() because rte_errno > may be an RTE-specific error code. > > This patchset use rte_strerror() instead of strerror() for rte_errno. > > Also, I tried to add it to checkpatch, but rte_errno can be used as an argument to any function > and the checkpatch script should not return an error, so I didn't do that. > > Dengdui Huang (14): > eal: fix use rte errno for libc function > eal: use rte strerror > pdump: use rte strerror > bus/vdev: use rte strerror > common/mlx5: use rte strerror > net/af_xdp: use rte strerror > net/bonding: use rte strerror > net/failsafe: use rte strerror > net/memif: use rte strerror > net/mlx4: use rte strerror > net/mlx5: use rte strerror > net/tap: use rte strerror > app/dumpcap: use rte strerror > test: use rte strerror > > app/dumpcap/main.c | 2 +- > app/test/test_bpf.c | 10 +++++----- > drivers/bus/vdev/vdev.c | 2 +- > drivers/common/mlx5/linux/mlx5_nl.c | 10 +++++----- > drivers/common/mlx5/mlx5_common.c | 6 +++--- > drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- > drivers/net/bonding/rte_eth_bond_flow.c | 4 ++-- > drivers/net/failsafe/failsafe.c | 2 +- > drivers/net/failsafe/failsafe_eal.c | 2 +- > drivers/net/failsafe/failsafe_flow.c | 4 ++-- > drivers/net/memif/rte_eth_memif.c | 2 +- > drivers/net/mlx4/mlx4.c | 2 +- > drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++--------- > drivers/net/mlx4/mlx4_rxq.c | 4 ++-- > drivers/net/mlx4/mlx4_txq.c | 10 +++++----- > drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- > drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +++++++++++----------- > drivers/net/mlx5/linux/mlx5_os.c | 16 ++++++++-------- > drivers/net/mlx5/mlx5.c | 8 ++++---- > drivers/net/mlx5/mlx5_mac.c | 2 +- > drivers/net/mlx5/mlx5_rxmode.c | 8 ++++---- > drivers/net/mlx5/mlx5_stats.c | 2 +- > drivers/net/mlx5/mlx5_testpmd.c | 10 +++++----- > 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 | 10 +++++----- > drivers/net/tap/rte_eth_tap.c | 4 ++-- > lib/eal/linux/eal_dev.c | 2 +- > lib/eal/unix/eal_unix_memory.c | 2 +- > lib/pdump/rte_pdump.c | 2 +- > 31 files changed, 93 insertions(+), 93 deletions(-) > Looks good thanks. Series-Acked-by: Stephen Hemminger <stephen@networkplumber.org> ^ permalink raw reply [flat|nested] 264+ messages in thread
* Re: [PATCH v6 00/14] use rte_strerror() for rte_errno 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang ` (14 preceding siblings ...) 2024-11-14 16:31 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Stephen Hemminger @ 2024-11-15 6:01 ` fengchengwen 15 siblings, 0 replies; 264+ messages in thread From: fengchengwen @ 2024-11-15 6:01 UTC (permalink / raw) To: Dengdui Huang, dev Cc: ajit.khaparde, thomas, ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong, haijie1, liuyonglong Series-acked-by: Chengwen Feng <fengchengwen@huawei.com> On 2024/11/14 19:39, Dengdui Huang wrote: > Whether strerror() needs to be replaced needs further discussion, > but rte_error should not be used by strerror() because rte_errno > may be an RTE-specific error code. > > This patchset use rte_strerror() instead of strerror() for rte_errno. > > Also, I tried to add it to checkpatch, but rte_errno can be used as an argument to any function > and the checkpatch script should not return an error, so I didn't do that. > > Dengdui Huang (14): > eal: fix use rte errno for libc function > eal: use rte strerror > pdump: use rte strerror > bus/vdev: use rte strerror > common/mlx5: use rte strerror > net/af_xdp: use rte strerror > net/bonding: use rte strerror > net/failsafe: use rte strerror > net/memif: use rte strerror > net/mlx4: use rte strerror > net/mlx5: use rte strerror > net/tap: use rte strerror > app/dumpcap: use rte strerror > test: use rte strerror > > app/dumpcap/main.c | 2 +- > app/test/test_bpf.c | 10 +++++----- > drivers/bus/vdev/vdev.c | 2 +- > drivers/common/mlx5/linux/mlx5_nl.c | 10 +++++----- > drivers/common/mlx5/mlx5_common.c | 6 +++--- > drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- > drivers/net/bonding/rte_eth_bond_flow.c | 4 ++-- > drivers/net/failsafe/failsafe.c | 2 +- > drivers/net/failsafe/failsafe_eal.c | 2 +- > drivers/net/failsafe/failsafe_flow.c | 4 ++-- > drivers/net/memif/rte_eth_memif.c | 2 +- > drivers/net/mlx4/mlx4.c | 2 +- > drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++--------- > drivers/net/mlx4/mlx4_rxq.c | 4 ++-- > drivers/net/mlx4/mlx4_txq.c | 10 +++++----- > drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- > drivers/net/mlx5/linux/mlx5_ethdev_os.c | 22 +++++++++++----------- > drivers/net/mlx5/linux/mlx5_os.c | 16 ++++++++-------- > drivers/net/mlx5/mlx5.c | 8 ++++---- > drivers/net/mlx5/mlx5_mac.c | 2 +- > drivers/net/mlx5/mlx5_rxmode.c | 8 ++++---- > drivers/net/mlx5/mlx5_stats.c | 2 +- > drivers/net/mlx5/mlx5_testpmd.c | 10 +++++----- > 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 | 10 +++++----- > drivers/net/tap/rte_eth_tap.c | 4 ++-- > lib/eal/linux/eal_dev.c | 2 +- > lib/eal/unix/eal_unix_memory.c | 2 +- > lib/pdump/rte_pdump.c | 2 +- > 31 files changed, 93 insertions(+), 93 deletions(-) > ^ permalink raw reply [flat|nested] 264+ messages in thread
end of thread, other threads:[~2024-11-15 6:02 UTC | newest] Thread overview: 264+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-11-14 8:24 [PATCH 00/43] replace strerror Dengdui Huang 2023-11-14 8:24 ` [PATCH 01/43] devtools: forbid use of strerror Dengdui Huang 2023-11-14 8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang 2023-11-15 0:18 ` Stephen Hemminger 2023-11-15 11:16 ` Morten Brørup 2024-02-01 21:49 ` Stephen Hemminger 2023-11-15 0:22 ` Stephen Hemminger 2023-11-15 11:23 ` Morten Brørup 2023-11-15 15:06 ` Stephen Hemminger 2023-11-14 8:24 ` [PATCH 03/43] eventdev: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 04/43] latency: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 05/43] node: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 06/43] pdump: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 07/43] power: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 08/43] telemetry: replace strerror Dengdui Huang 2023-11-14 8:25 ` [PATCH 09/43] vhost: use rte strerror Dengdui Huang 2023-11-14 8:25 ` [PATCH 10/43] bpf: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 11/43] bus/cdx: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 12/43] bus/dpaa: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 13/43] bus/fslmc: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 14/43] bus/pci: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 15/43] bus/vdev: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 16/43] bus/vmbus: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 17/43] common/cnxk: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 18/43] common/mlx5: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 19/43] crypto/caam_jr: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 20/43] dma/idxd: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 21/43] net/af_packet: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 22/43] net/bnxt: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 23/43] net/af_xdp: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 24/43] net/bonding: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 25/43] net/dpaa: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 26/43] net/dpaa2: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 27/43] net/enetfec: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 28/43] net/failsafe: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 29/43] net/i40e: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 30/43] net/ice: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 31/43] net/ixgbe: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 32/43] net/memif: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 33/43] net/mlx4: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 34/43] net/mlx5: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 35/43] net/qede: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 36/43] net/sfc: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 37/43] net/tap: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 38/43] net/vhost: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 39/43] net/virtio: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 40/43] raw/ifpga: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 41/43] vdpa/ifc: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 42/43] vdpa/mlx5: " Dengdui Huang 2023-11-14 8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 00/43] replace strerror Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 01/43] devtools: forbid use of strerror Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 02/43] eal: use rte strerror Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 03/43] eventdev: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 04/43] latency: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 05/43] node: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 06/43] pdump: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 07/43] power: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 08/43] telemetry: replace strerror Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 09/43] vhost: use rte strerror Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 10/43] bpf: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 11/43] bus/cdx: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 12/43] bus/dpaa: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 13/43] bus/fslmc: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 14/43] bus/pci: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 15/43] bus/vdev: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 16/43] bus/vmbus: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 17/43] common/cnxk: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 18/43] common/mlx5: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 19/43] crypto/caam_jr: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 20/43] dma/idxd: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 21/43] net/af_packet: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 22/43] net/bnxt: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 23/43] net/af_xdp: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 24/43] net/bonding: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 25/43] net/dpaa: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 26/43] net/dpaa2: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 27/43] net/enetfec: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 28/43] net/failsafe: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 29/43] net/i40e: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 30/43] net/ice: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 31/43] net/ixgbe: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 32/43] net/memif: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 33/43] net/mlx4: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 34/43] net/mlx5: " Dengdui Huang 2023-11-14 11:23 ` [PATCH v2 35/43] net/qede: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 36/43] net/sfc: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 37/43] net/tap: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 38/43] net/vhost: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 39/43] net/virtio: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 40/43] raw/ifpga: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 41/43] vdpa/ifc: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 42/43] vdpa/mlx5: " Dengdui Huang 2023-11-14 11:24 ` [PATCH v2 43/43] vdpa/sfc: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 00/42] replace strerror Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 01/42] devtools: forbid use of strerror Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 02/42] eal: use rte strerror Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 03/42] eventdev: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 04/42] latency: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 05/42] node: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 06/42] pdump: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 07/42] power: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 08/42] vhost: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 09/42] bpf: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 10/42] bus/cdx: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 11/42] bus/dpaa: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 12/42] bus/fslmc: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 13/42] bus/pci: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 14/42] bus/vdev: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 15/42] bus/vmbus: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 16/42] common/cnxk: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 17/42] common/mlx5: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 18/42] crypto/caam_jr: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 19/42] dma/idxd: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 20/42] net/af_packet: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 21/42] net/bnxt: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 22/42] net/af_xdp: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 23/42] net/bonding: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 24/42] net/dpaa: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 25/42] net/dpaa2: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 26/42] net/enetfec: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 27/42] net/failsafe: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 28/42] net/i40e: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 29/42] net/ice: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 30/42] net/ixgbe: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 31/42] net/memif: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 32/42] net/mlx4: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 33/42] net/mlx5: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 34/42] net/qede: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 35/42] net/sfc: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 36/42] net/tap: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 37/42] net/vhost: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 38/42] net/virtio: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 39/42] raw/ifpga: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 40/42] vdpa/ifc: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 41/42] vdpa/mlx5: " Dengdui Huang 2023-11-14 12:35 ` [PATCH v3 42/42] vdpa/sfc: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 00/42] replace strerror Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 01/42] devtools: forbid use of strerror Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 02/42] eal: use rte strerror Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 03/42] eventdev: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 04/42] latency: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 05/42] node: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 06/42] pdump: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 07/42] power: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 08/42] vhost: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 09/42] bpf: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 10/42] bus/cdx: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 11/42] bus/dpaa: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 12/42] bus/fslmc: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 13/42] bus/pci: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 14/42] bus/vdev: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 15/42] bus/vmbus: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 16/42] common/cnxk: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 17/42] common/mlx5: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 18/42] crypto/caam_jr: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 19/42] dma/idxd: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 20/42] net/af_packet: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 21/42] net/bnxt: " Dengdui Huang 2024-10-23 20:24 ` Ajit Khaparde 2024-10-23 8:28 ` [PATCH v4 22/42] net/af_xdp: " Dengdui Huang 2024-10-24 17:05 ` Maryam Tahhan 2024-10-23 8:28 ` [PATCH v4 23/42] net/bonding: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 24/42] net/dpaa: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 25/42] net/dpaa2: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 26/42] net/enetfec: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 27/42] net/failsafe: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 28/42] net/i40e: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 29/42] net/ice: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 30/42] net/ixgbe: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 31/42] net/memif: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 32/42] net/mlx4: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 33/42] net/mlx5: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 34/42] net/qede: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 35/42] net/sfc: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 36/42] net/tap: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 37/42] net/vhost: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 38/42] net/virtio: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 39/42] raw/ifpga: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 40/42] vdpa/ifc: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 41/42] vdpa/mlx5: " Dengdui Huang 2024-10-23 8:28 ` [PATCH v4 42/42] vdpa/sfc: " Dengdui Huang 2024-10-23 15:42 ` [PATCH v4 00/42] replace strerror Stephen Hemminger 2024-10-24 6:47 ` huangdengdui 2024-10-25 21:56 ` Thomas Monjalon 2024-11-01 9:16 ` huangdengdui 2024-10-29 1:16 ` lihuisong (C) 2024-11-04 18:22 ` Stephen Hemminger 2023-11-15 0:16 ` [PATCH 00/43] " Stephen Hemminger 2024-02-01 11:03 ` David Marchand 2024-10-22 10:48 ` Morten Brørup 2024-11-04 11:09 ` [PATCH v5 00/52] " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 01/52] eal: fix use rte errno for libc function Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 02/52] devtools: forbid use of strerror Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 03/52] eal: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 04/52] eventdev: " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 05/52] latency: " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 06/52] node: " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 07/52] pdump: " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 08/52] pdump: use rte strerror Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 09/52] power: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 10/52] vhost: " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 11/52] bpf: " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 12/52] bus/cdx: " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 13/52] bus/dpaa: " Dengdui Huang 2024-11-04 11:09 ` [PATCH v5 14/52] bus/fslmc: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 15/52] bus/pci: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 16/52] bus/vmbus: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 17/52] bus/vdev: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 18/52] common/cnxk: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 19/52] common/mlx5: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 20/52] common/mlx5: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 21/52] crypto/caam_jr: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 22/52] dma/idxd: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 23/52] net/bnxt: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 24/52] net/af_xdp: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 25/52] net/af_xdp: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 26/52] net/bonding: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 27/52] net/bonding: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 28/52] net/cnxk: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 29/52] net/dpaa: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 30/52] net/dpaa2: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 31/52] net/enetfec: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 32/52] net/failsafe: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 33/52] net/failsafe: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 34/52] net/i40e: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 35/52] net/ice: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 36/52] net/ixgbe: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 37/52] net/memif: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 38/52] net/memif: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 39/52] net/mlx4: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 40/52] net/mlx4: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 41/52] net/mlx5: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 42/52] net/mlx5: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 43/52] net/qede: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 44/52] net/sfc: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 45/52] net/tap: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 46/52] net/tap: use rte strerror Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 47/52] net/vhost: replace strerror with reentrant version Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 48/52] net/virtio: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 49/52] raw/ifpga: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 50/52] vdpa/ifc: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 51/52] vdpa/mlx5: " Dengdui Huang 2024-11-04 11:10 ` [PATCH v5 52/52] vdpa/sfc: " Dengdui Huang 2024-11-04 18:23 ` [PATCH v5 00/52] replace strerror Stephen Hemminger 2024-11-06 18:57 ` [PATCH 00/43] " Stephen Hemminger 2024-11-07 2:52 ` huangdengdui 2024-11-14 11:39 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 01/14] eal: fix use rte errno for libc function Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 02/14] eal: use rte strerror Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 03/14] pdump: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 04/14] bus/vdev: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 05/14] common/mlx5: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 06/14] net/af_xdp: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 07/14] net/bonding: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 08/14] net/failsafe: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 09/14] net/memif: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 10/14] net/mlx4: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 11/14] net/mlx5: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 12/14] net/tap: " Dengdui Huang 2024-11-14 11:39 ` [PATCH v6 13/14] app/dumpcap: " Dengdui Huang 2024-11-14 11:40 ` [PATCH v6 14/14] test: " Dengdui Huang 2024-11-14 16:31 ` [PATCH v6 00/14] use rte_strerror() for rte_errno Stephen Hemminger 2024-11-15 6:01 ` fengchengwen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).