summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_stats.c
diff options
context:
space:
mode:
authorIgor Romanov <igor.romanov@oktetlabs.ru>2019-09-06 15:34:54 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-07 15:00:54 +0200
commit9970a9ad07db7745ca6bc441819b287940ae86ea (patch)
treec4d3d08989557d9d0d3a9dac5480c9f17f0673ca /drivers/net/mlx5/mlx5_stats.c
parentda328f7f115a459a64fd7005d4acc1ec9e1ba8bd (diff)
downloaddpdk-9970a9ad07db7745ca6bc441819b287940ae86ea.zip
dpdk-9970a9ad07db7745ca6bc441819b287940ae86ea.tar.gz
dpdk-9970a9ad07db7745ca6bc441819b287940ae86ea.tar.xz
ethdev: make stats and xstats reset callbacks return int
Change return value of the callbacks from void to int. Make implementations across all drivers return negative errno values in case of error conditions. Both callbacks are updated together because a large number of drivers assign the same function to both callbacks. Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_stats.c')
-rw-r--r--drivers/net/mlx5/mlx5_stats.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index cff065f..205e4fe 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -434,8 +434,11 @@ mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * always 0 on success and stats is reset
*/
-void
+int
mlx5_stats_reset(struct rte_eth_dev *dev)
{
struct mlx5_priv *priv = dev->data->dev_private;
@@ -458,6 +461,8 @@ mlx5_stats_reset(struct rte_eth_dev *dev)
#ifndef MLX5_PMD_SOFT_COUNTERS
/* FIXME: reset hardware counters. */
#endif
+
+ return 0;
}
/**
@@ -465,8 +470,12 @@ mlx5_stats_reset(struct rte_eth_dev *dev)
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * 0 on success and stats is reset, negative errno value otherwise and
+ * rte_errno is set.
*/
-void
+int
mlx5_xstats_reset(struct rte_eth_dev *dev)
{
struct mlx5_priv *priv = dev->data->dev_private;
@@ -481,7 +490,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
if (stats_n < 0) {
DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id,
strerror(-stats_n));
- return;
+ return stats_n;
}
if (xstats_ctrl->stats_n != stats_n)
mlx5_stats_init(dev);
@@ -489,10 +498,12 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
if (ret) {
DRV_LOG(ERR, "port %u cannot read device counters: %s",
dev->data->port_id, strerror(rte_errno));
- return;
+ return ret;
}
for (i = 0; i != n; ++i)
xstats_ctrl->base[i] = counters[i];
+
+ return 0;
}
/**