summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_ethdev.c
diff options
context:
space:
mode:
authorNĂ©lio Laranjeiro <nelio.laranjeiro@6wind.com>2018-03-13 10:23:56 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2018-03-30 14:08:44 +0200
commita170a30d22a8c34c36541d0dd6bcc2fcc4c9ee2f (patch)
tree9a08dfb370c10be37c44af7b55828f8ccc053f85 /drivers/net/mlx5/mlx5_ethdev.c
parent0f99970b4adc943264df0487904d340124765e68 (diff)
downloaddpdk-a170a30d22a8c34c36541d0dd6bcc2fcc4c9ee2f.zip
dpdk-a170a30d22a8c34c36541d0dd6bcc2fcc4c9ee2f.tar.gz
dpdk-a170a30d22a8c34c36541d0dd6bcc2fcc4c9ee2f.tar.xz
net/mlx5: use dynamic logging
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_ethdev.c')
-rw-r--r--drivers/net/mlx5/mlx5_ethdev.c118
1 files changed, 70 insertions, 48 deletions
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 5baf843..dd46124 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -313,16 +313,18 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
int ret = 0;
if ((tx_offloads & supp_tx_offloads) != tx_offloads) {
- ERROR("port %u some Tx offloads are not supported "
- "requested 0x%" PRIx64 " supported 0x%" PRIx64,
- dev->data->port_id, tx_offloads, supp_tx_offloads);
+ DRV_LOG(ERR,
+ "port %u some Tx offloads are not supported requested"
+ " 0x%" PRIx64 " supported 0x%" PRIx64,
+ dev->data->port_id, tx_offloads, supp_tx_offloads);
rte_errno = ENOTSUP;
return -rte_errno;
}
if ((rx_offloads & supp_rx_offloads) != rx_offloads) {
- ERROR("port %u some Rx offloads are not supported "
- "requested 0x%" PRIx64 " supported 0x%" PRIx64,
- dev->data->port_id, rx_offloads, supp_rx_offloads);
+ DRV_LOG(ERR,
+ "port %u some Rx offloads are not supported requested"
+ " 0x%" PRIx64 " supported 0x%" PRIx64,
+ dev->data->port_id, rx_offloads, supp_rx_offloads);
rte_errno = ENOTSUP;
return -rte_errno;
}
@@ -337,8 +339,8 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
rte_realloc(priv->rss_conf.rss_key,
rss_hash_default_key_len, 0);
if (!priv->rss_conf.rss_key) {
- ERROR("port %u cannot allocate RSS hash key memory (%u)",
- dev->data->port_id, rxqs_n);
+ DRV_LOG(ERR, "port %u cannot allocate RSS hash key memory (%u)",
+ dev->data->port_id, rxqs_n);
rte_errno = ENOMEM;
return -rte_errno;
}
@@ -352,20 +354,20 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
priv->rxqs = (void *)dev->data->rx_queues;
priv->txqs = (void *)dev->data->tx_queues;
if (txqs_n != priv->txqs_n) {
- INFO("port %u Tx queues number update: %u -> %u",
- dev->data->port_id, priv->txqs_n, txqs_n);
+ DRV_LOG(INFO, "port %u Tx queues number update: %u -> %u",
+ dev->data->port_id, priv->txqs_n, txqs_n);
priv->txqs_n = txqs_n;
}
if (rxqs_n > priv->config.ind_table_max_size) {
- ERROR("port %u cannot handle this many Rx queues (%u)",
- dev->data->port_id, rxqs_n);
+ DRV_LOG(ERR, "port %u cannot handle this many Rx queues (%u)",
+ dev->data->port_id, rxqs_n);
rte_errno = EINVAL;
return -rte_errno;
}
if (rxqs_n == priv->rxqs_n)
return 0;
- INFO("port %u Rx queues number update: %u -> %u",
- dev->data->port_id, priv->rxqs_n, rxqs_n);
+ DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
+ dev->data->port_id, priv->rxqs_n, rxqs_n);
priv->rxqs_n = rxqs_n;
/* If the requested number of RX queues is not a power of two, use the
* maximum indirection table size for better balancing.
@@ -491,8 +493,8 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev)
ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
if (ret) {
- WARN("port %u ioctl(SIOCGIFFLAGS) failed: %s",
- dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
+ dev->data->port_id, strerror(rte_errno));
return ret;
}
memset(&dev_link, 0, sizeof(dev_link));
@@ -501,8 +503,9 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev)
ifr.ifr_data = (void *)&edata;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
if (ret) {
- WARN("port %u ioctl(SIOCETHTOOL, ETHTOOL_GSET) failed: %s",
- dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(WARNING,
+ "port %u ioctl(SIOCETHTOOL, ETHTOOL_GSET) failed: %s",
+ dev->data->port_id, strerror(rte_errno));
return ret;
}
link_speed = ethtool_cmd_speed(&edata);
@@ -558,8 +561,8 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev)
ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
if (ret) {
- WARN("port %u ioctl(SIOCGIFFLAGS) failed: %s",
- dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
+ dev->data->port_id, strerror(rte_errno));
return ret;
}
memset(&dev_link, 0, sizeof(dev_link));
@@ -568,8 +571,10 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev)
ifr.ifr_data = (void *)&gcmd;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
if (ret) {
- DEBUG("port %u ioctl(SIOCETHTOOL, ETHTOOL_GLINKSETTINGS)"
- " failed: %s", dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(DEBUG,
+ "port %u ioctl(SIOCETHTOOL, ETHTOOL_GLINKSETTINGS)"
+ " failed: %s",
+ dev->data->port_id, strerror(rte_errno));
return ret;
}
gcmd.link_mode_masks_nwords = -gcmd.link_mode_masks_nwords;
@@ -583,8 +588,10 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev)
ifr.ifr_data = (void *)ecmd;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
if (ret) {
- DEBUG("port %u ioctl(SIOCETHTOOL, ETHTOOL_GLINKSETTINGS)"
- " failed: %s", dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(DEBUG,
+ "port %u ioctl(SIOCETHTOOL, ETHTOOL_GLINKSETTINGS)"
+ " failed: %s",
+ dev->data->port_id, strerror(rte_errno));
return ret;
}
dev_link.link_speed = ecmd->speed;
@@ -655,14 +662,17 @@ mlx5_link_start(struct rte_eth_dev *dev)
dev->rx_pkt_burst = mlx5_select_rx_function(dev);
ret = mlx5_traffic_enable(dev);
if (ret) {
- ERROR("port %u error occurred while configuring control flows:"
- " %s", dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(ERR,
+ "port %u error occurred while configuring control"
+ " flows: %s",
+ dev->data->port_id, strerror(rte_errno));
return;
}
ret = mlx5_flow_start(dev, &priv->flows);
if (ret)
- ERROR("port %u error occurred while configuring flows: %s",
- dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(ERR,
+ "port %u error occurred while configuring flows: %s",
+ dev->data->port_id, strerror(rte_errno));
}
/**
@@ -783,7 +793,8 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
return ret;
if (kern_mtu == mtu) {
priv->mtu = mtu;
- DEBUG("port %u adapter MTU set to %u", dev->data->port_id, mtu);
+ DRV_LOG(DEBUG, "port %u adapter MTU set to %u",
+ dev->data->port_id, mtu);
return 0;
}
rte_errno = EAGAIN;
@@ -813,8 +824,10 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
ifr.ifr_data = (void *)&ethpause;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
if (ret) {
- WARN("port %u ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM) failed:"
- " %s", dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(WARNING,
+ "port %u ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM) failed:"
+ " %s",
+ dev->data->port_id, strerror(rte_errno));
return ret;
}
fc_conf->autoneg = ethpause.autoneg;
@@ -864,8 +877,10 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
ethpause.tx_pause = 0;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
if (ret) {
- WARN("port %u ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
- " failed: %s", dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(WARNING,
+ "port %u ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
+ " failed: %s",
+ dev->data->port_id, strerror(rte_errno));
return ret;
}
return 0;
@@ -994,8 +1009,9 @@ mlx5_dev_status_handler(struct rte_eth_dev *dev)
dev->data->dev_conf.intr_conf.rmv == 1)
ret |= (1 << RTE_ETH_EVENT_INTR_RMV);
else
- DEBUG("port %u event type %d on not handled",
- dev->data->port_id, event.event_type);
+ DRV_LOG(DEBUG,
+ "port %u event type %d on not handled",
+ dev->data->port_id, event.event_type);
mlx5_glue->ack_async_event(&event);
}
if (ret & (1 << RTE_ETH_EVENT_INTR_LSC))
@@ -1103,8 +1119,10 @@ mlx5_dev_interrupt_handler_install(struct rte_eth_dev *dev)
flags = fcntl(priv->ctx->async_fd, F_GETFL);
ret = fcntl(priv->ctx->async_fd, F_SETFL, flags | O_NONBLOCK);
if (ret) {
- INFO("port %u failed to change file descriptor async event"
- " queue", dev->data->port_id);
+ DRV_LOG(INFO,
+ "port %u failed to change file descriptor async event"
+ " queue",
+ dev->data->port_id);
dev->data->dev_conf.intr_conf.lsc = 0;
dev->data->dev_conf.intr_conf.rmv = 0;
}
@@ -1117,8 +1135,8 @@ mlx5_dev_interrupt_handler_install(struct rte_eth_dev *dev)
}
ret = mlx5_socket_init(dev);
if (ret)
- ERROR("port %u cannot initialise socket: %s",
- dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(ERR, "port %u cannot initialise socket: %s",
+ dev->data->port_id, strerror(rte_errno));
else if (priv->primary_socket) {
priv->intr_handle_socket.fd = priv->primary_socket;
priv->intr_handle_socket.type = RTE_INTR_HANDLE_EXT;
@@ -1188,20 +1206,24 @@ mlx5_select_tx_function(struct rte_eth_dev *dev)
tx_pkt_burst = mlx5_tx_burst_raw_vec;
else
tx_pkt_burst = mlx5_tx_burst_vec;
- DEBUG("port %u selected enhanced MPW Tx vectorized"
- " function", dev->data->port_id);
+ DRV_LOG(DEBUG,
+ "port %u selected enhanced MPW Tx vectorized"
+ " function",
+ dev->data->port_id);
} else {
tx_pkt_burst = mlx5_tx_burst_empw;
- DEBUG("port %u selected enhanced MPW Tx function",
- dev->data->port_id);
+ DRV_LOG(DEBUG,
+ "port %u selected enhanced MPW Tx function",
+ dev->data->port_id);
}
} else if (config->mps && (config->txq_inline > 0)) {
tx_pkt_burst = mlx5_tx_burst_mpw_inline;
- DEBUG("port %u selected MPW inline Tx function",
- dev->data->port_id);
+ DRV_LOG(DEBUG, "port %u selected MPW inline Tx function",
+ dev->data->port_id);
} else if (config->mps) {
tx_pkt_burst = mlx5_tx_burst_mpw;
- DEBUG("port %u selected MPW Tx function", dev->data->port_id);
+ DRV_LOG(DEBUG, "port %u selected MPW Tx function",
+ dev->data->port_id);
}
return tx_pkt_burst;
}
@@ -1223,8 +1245,8 @@ mlx5_select_rx_function(struct rte_eth_dev *dev)
assert(dev != NULL);
if (mlx5_check_vec_rx_support(dev) > 0) {
rx_pkt_burst = mlx5_rx_burst_vec;
- DEBUG("port %u selected Rx vectorized function",
- dev->data->port_id);
+ DRV_LOG(DEBUG, "port %u selected Rx vectorized function",
+ dev->data->port_id);
}
return rx_pkt_burst;
}