[v4,33/42] net/mlx5: use rte strerror

Message ID 20241023082852.2780488-34-huangdengdui@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series replace strerror |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

huangdengdui Oct. 23, 2024, 8:28 a.m. UTC
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(-)
  

Patch

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);