@@ -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,
@@ -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;
}