summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_stats.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_stats.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_stats.c')
-rw-r--r--drivers/net/mlx5/mlx5_stats.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 066d347..42ac9d9 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -148,8 +148,9 @@ mlx5_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats)
ifr.ifr_data = (caddr_t)et_stats;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
if (ret) {
- WARN("port %u unable to read statistic values from device",
- dev->data->port_id);
+ DRV_LOG(WARNING,
+ "port %u unable to read statistic values from device",
+ dev->data->port_id);
return ret;
}
for (i = 0; i != xstats_n; ++i) {
@@ -195,8 +196,8 @@ mlx5_ethtool_get_stats_n(struct rte_eth_dev *dev) {
ifr.ifr_data = (caddr_t)&drvinfo;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
if (ret) {
- WARN("port %u unable to query number of statistics",
- dev->data->port_id);
+ DRV_LOG(WARNING, "port %u unable to query number of statistics",
+ dev->data->port_id);
return ret;
}
return drvinfo.n_stats;
@@ -223,8 +224,8 @@ mlx5_xstats_init(struct rte_eth_dev *dev)
ret = mlx5_ethtool_get_stats_n(dev);
if (ret < 0) {
- WARN("port %u no extended statistics available",
- dev->data->port_id);
+ DRV_LOG(WARNING, "port %u no extended statistics available",
+ dev->data->port_id);
return;
}
dev_stats_n = ret;
@@ -235,7 +236,7 @@ mlx5_xstats_init(struct rte_eth_dev *dev)
rte_malloc("xstats_strings",
str_sz + sizeof(struct ethtool_gstrings), 0);
if (!strings) {
- WARN("port %u unable to allocate memory for xstats",
+ DRV_LOG(WARNING, "port %u unable to allocate memory for xstats",
dev->data->port_id);
return;
}
@@ -245,8 +246,8 @@ mlx5_xstats_init(struct rte_eth_dev *dev)
ifr.ifr_data = (caddr_t)strings;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
if (ret) {
- WARN("port %u unable to get statistic names",
- dev->data->port_id);
+ DRV_LOG(WARNING, "port %u unable to get statistic names",
+ dev->data->port_id);
goto free;
}
for (j = 0; j != xstats_n; ++j)
@@ -267,9 +268,10 @@ mlx5_xstats_init(struct rte_eth_dev *dev)
if (mlx5_counters_init[j].ib)
continue;
if (xstats_ctrl->dev_table_idx[j] >= dev_stats_n) {
- WARN("port %u counter \"%s\" is not recognized",
- dev->data->port_id,
- mlx5_counters_init[j].dpdk_name);
+ DRV_LOG(WARNING,
+ "port %u counter \"%s\" is not recognized",
+ dev->data->port_id,
+ mlx5_counters_init[j].dpdk_name);
goto free;
}
}
@@ -277,8 +279,8 @@ mlx5_xstats_init(struct rte_eth_dev *dev)
assert(xstats_n <= MLX5_MAX_XSTATS);
ret = mlx5_read_dev_counters(dev, xstats_ctrl->base);
if (ret)
- ERROR("port %u cannot read device counters: %s",
- dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(ERR, "port %u cannot read device counters: %s",
+ dev->data->port_id, strerror(rte_errno));
free:
rte_free(strings);
}
@@ -445,16 +447,16 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
stats_n = mlx5_ethtool_get_stats_n(dev);
if (stats_n < 0) {
- ERROR("port %u cannot get stats: %s", dev->data->port_id,
- strerror(-stats_n));
+ DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id,
+ strerror(-stats_n));
return;
}
if (xstats_ctrl->stats_n != stats_n)
mlx5_xstats_init(dev);
ret = mlx5_read_dev_counters(dev, counters);
if (ret) {
- ERROR("port %u cannot read device counters: %s",
- dev->data->port_id, strerror(rte_errno));
+ DRV_LOG(ERR, "port %u cannot read device counters: %s",
+ dev->data->port_id, strerror(rte_errno));
return;
}
for (i = 0; i != n; ++i)