net/mlx5: use dynamic logging
[dpdk.git] / drivers / net / mlx5 / mlx5_stats.c
index 066d347..42ac9d9 100644 (file)
@@ -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)