DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int
@ 2019-09-06 14:34 Andrew Rybchenko
  2019-09-06 14:34 ` [dpdk-dev] [PATCH 1/2] " Andrew Rybchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2019-09-06 14:34 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit; +Cc: dev, Igor Romanov

It is the third patch series to get rid of void returning functions
in ethdev in accordance with deprecation notice [1].

It should be applied on top of the first [2] and the second [3].
It could be applied separately, but few simple conflicts should
be resolved.

Functions which return void are bad since they do not provide explicit
information to the caller if everything is OK or not.
It is especially painful in the case of promiscuous mode since it is
not always supported, there are real cases when it fails to apply and
it affects traffic which is received by the port.

Driver maintainrs are encouraged to review the patch which changes
driver callbacks prototype.

[1] https://patches.dpdk.org/patch/56969/
[2] https://patches.dpdk.org/project/dpdk/list/?series=6222
[3] https://patches.dpdk.org/project/dpdk/list/?series=6264

Igor Romanov (2):
  ethdev: change xstats reset function return value to int
  ethdev: make stats and xstats reset callbacks return int

 app/proc-info/main.c                      | 10 +++++-
 app/test-pmd/config.c                     |  8 ++++-
 app/test/virtual_pmd.c                    |  4 ++-
 doc/guides/rel_notes/deprecation.rst      |  1 -
 doc/guides/rel_notes/release_19_11.rst    |  3 ++
 drivers/net/af_packet/rte_eth_af_packet.c |  4 ++-
 drivers/net/af_xdp/rte_eth_af_xdp.c       |  4 ++-
 drivers/net/ark/ark_ethdev.c              |  6 ++--
 drivers/net/atlantic/atl_ethdev.c         |  6 ++--
 drivers/net/avp/avp_ethdev.c              |  6 ++--
 drivers/net/axgbe/axgbe_ethdev.c          |  6 ++--
 drivers/net/bnxt/bnxt_stats.c             | 38 +++++++++++++++++------
 drivers/net/bnxt/bnxt_stats.h             |  4 +--
 drivers/net/bonding/rte_eth_bond_pmd.c    | 13 ++++++--
 drivers/net/cxgbe/cxgbe_ethdev.c          |  4 ++-
 drivers/net/dpaa/dpaa_ethdev.c            |  4 ++-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 10 +++---
 drivers/net/e1000/em_ethdev.c             |  6 ++--
 drivers/net/e1000/igb_ethdev.c            | 18 +++++++----
 drivers/net/enetc/enetc_ethdev.c          |  4 ++-
 drivers/net/enic/enic.h                   |  2 +-
 drivers/net/enic/enic_ethdev.c            |  4 +--
 drivers/net/enic/enic_main.c              | 11 +++++--
 drivers/net/failsafe/failsafe_ops.c       | 16 ++++++++--
 drivers/net/fm10k/fm10k_ethdev.c          | 10 ++++--
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 14 ++++++---
 drivers/net/hinic/base/hinic_pmd_niccfg.h |  4 +--
 drivers/net/hinic/hinic_pmd_ethdev.c      | 25 +++++++++++----
 drivers/net/i40e/i40e_ethdev.c            |  6 ++--
 drivers/net/i40e/i40e_ethdev_vf.c         |  6 ++--
 drivers/net/i40e/i40e_vf_representor.c    |  4 +--
 drivers/net/iavf/iavf_ethdev.c            | 11 ++++---
 drivers/net/ice/ice_ethdev.c              |  6 ++--
 drivers/net/ipn3ke/ipn3ke_representor.c   | 14 +++++----
 drivers/net/ixgbe/ixgbe_ethdev.c          | 18 +++++++----
 drivers/net/kni/rte_eth_kni.c             |  4 ++-
 drivers/net/liquidio/lio_ethdev.c         | 23 ++++++++------
 drivers/net/memif/rte_eth_memif.c         |  4 ++-
 drivers/net/mlx4/mlx4.h                   |  2 +-
 drivers/net/mlx4/mlx4_ethdev.c            |  7 ++++-
 drivers/net/mlx5/mlx5.h                   |  4 +--
 drivers/net/mlx5/mlx5_stats.c             | 19 +++++++++---
 drivers/net/mvneta/mvneta_ethdev.c        | 11 +++++--
 drivers/net/mvpp2/mrvl_ethdev.c           | 16 +++++++---
 drivers/net/netvsc/hn_ethdev.c            | 15 ++++++---
 drivers/net/netvsc/hn_var.h               |  4 +--
 drivers/net/netvsc/hn_vf.c                | 13 +++++---
 drivers/net/nfp/nfp_net.c                 |  6 ++--
 drivers/net/null/rte_eth_null.c           |  6 ++--
 drivers/net/octeontx/octeontx_ethdev.c    |  8 ++---
 drivers/net/octeontx2/otx2_ethdev.h       |  4 +--
 drivers/net/octeontx2/otx2_stats.c        | 33 +++++++++++++-------
 drivers/net/pcap/rte_eth_pcap.c           |  4 ++-
 drivers/net/qede/qede_ethdev.c            |  8 +++--
 drivers/net/ring/rte_eth_ring.c           |  4 ++-
 drivers/net/sfc/sfc_ethdev.c              |  7 +++--
 drivers/net/szedata2/rte_eth_szedata2.c   |  4 ++-
 drivers/net/tap/rte_eth_tap.c             |  4 ++-
 drivers/net/thunderx/nicvf_ethdev.c       | 13 ++++++--
 drivers/net/vhost/rte_eth_vhost.c         |  8 +++--
 drivers/net/virtio/virtio_ethdev.c        |  6 ++--
 drivers/net/vmxnet3/vmxnet3_ethdev.c      |  6 ++--
 lib/librte_ethdev/rte_ethdev.c            | 18 ++++++-----
 lib/librte_ethdev/rte_ethdev.h            |  9 +++++-
 lib/librte_ethdev/rte_ethdev_core.h       |  4 +--
 65 files changed, 408 insertions(+), 176 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 1/2] ethdev: change xstats reset function return value to int
  2019-09-06 14:34 [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int Andrew Rybchenko
@ 2019-09-06 14:34 ` Andrew Rybchenko
  2019-09-06 14:34 ` [dpdk-dev] [PATCH 2/2] ethdev: make stats and xstats reset callbacks return int Andrew Rybchenko
  2019-09-24 11:56 ` [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int Ferruh Yigit
  2 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2019-09-06 14:34 UTC (permalink / raw)
  To: Maryam Tahhan, Reshma Pattan, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, Neil Horman, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Ferruh Yigit
  Cc: dev, Igor Romanov

From: Igor Romanov <igor.romanov@oktetlabs.ru>

Change rte_eth_xstats_reset() return value from void to int and
return negative errno values in case of error conditions.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/proc-info/main.c                   | 10 +++++++++-
 app/test-pmd/config.c                  |  8 +++++++-
 doc/guides/rel_notes/deprecation.rst   |  1 -
 doc/guides/rel_notes/release_19_11.rst |  3 +++
 lib/librte_ethdev/rte_ethdev.c         |  8 ++++----
 lib/librte_ethdev/rte_ethdev.h         |  7 ++++++-
 6 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 34eb7a7cc4..94e808dc6e 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -580,8 +580,16 @@ nic_xstats_display(uint16_t port_id)
 static void
 nic_xstats_clear(uint16_t port_id)
 {
+	int ret;
+
 	printf("\n Clearing NIC xstats for port %d\n", port_id);
-	rte_eth_xstats_reset(port_id);
+	ret = rte_eth_xstats_reset(port_id);
+	if (ret != 0) {
+		printf("\n Error clearing xstats for port %d: %s\n", port_id,
+		       strerror(-ret));
+		return;
+	}
+
 	printf("\n  NIC extended statistics for port %d cleared\n", port_id);
 }
 
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 24158e5f7d..857b6dabc9 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -273,7 +273,13 @@ nic_xstats_display(portid_t port_id)
 void
 nic_xstats_clear(portid_t port_id)
 {
-	rte_eth_xstats_reset(port_id);
+	int ret;
+
+	ret = rte_eth_xstats_reset(port_id);
+	if (ret != 0) {
+		printf("%s: Error: failed to reset xstats (port %u): %s",
+		       __func__, port_id, strerror(ret));
+	}
 }
 
 void
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index b2e0a1fc7c..beb9cc3b65 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -92,7 +92,6 @@ Deprecation Notices
   - ``rte_eth_link_get`` and ``rte_eth_link_get_nowait``
   - ``rte_eth_dev_stop``
   - ``rte_eth_dev_close``
-  - ``rte_eth_xstats_reset``
   - ``rte_eth_macaddr_get``
   - ``rte_eth_dev_owner_delete``
 
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 5299157df7..3f492ac20d 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -101,6 +101,9 @@ API Changes
   ``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to
   provide a way to report various error conditions.
 
+* ethdev: changed ``rte_eth_dev_xstats_reset`` return value from ``void`` to
+  ``int`` to provide a way to report various error conditions.
+
 
 ABI Changes
 -----------
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 98fe533c5a..b843bbc208 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2518,22 +2518,22 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,
 }
 
 /* reset ethdev extended statistics */
-void
+int
 rte_eth_xstats_reset(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	/* implemented by the driver */
 	if (dev->dev_ops->xstats_reset != NULL) {
 		(*dev->dev_ops->xstats_reset)(dev);
-		return;
+		return 0;
 	}
 
 	/* fallback to default */
-	rte_eth_stats_reset(port_id);
+	return rte_eth_stats_reset(port_id);
 }
 
 static int
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index f07a829b29..328503d1be 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -2284,8 +2284,13 @@ int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name,
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
+ * @return
+ *   - (0) if device notified to reset extended stats.
+ *   - (-ENOTSUP) if pmd doesn't support both
+ *     extended stats and basic stats reset.
+ *   - (-ENODEV) if *port_id* invalid.
  */
-void rte_eth_xstats_reset(uint16_t port_id);
+int rte_eth_xstats_reset(uint16_t port_id);
 
 /**
  *  Set a mapping for the specified transmit queue to the specified per-queue
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 2/2] ethdev: make stats and xstats reset callbacks return int
  2019-09-06 14:34 [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int Andrew Rybchenko
  2019-09-06 14:34 ` [dpdk-dev] [PATCH 1/2] " Andrew Rybchenko
@ 2019-09-06 14:34 ` Andrew Rybchenko
  2019-09-24 11:56   ` Ferruh Yigit
  2019-09-24 11:56 ` [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int Ferruh Yigit
  2 siblings, 1 reply; 6+ messages in thread
From: Andrew Rybchenko @ 2019-09-06 14:34 UTC (permalink / raw)
  To: John W. Linville, Xiaolong Ye, Qi Zhang, Shepard Siegel,
	Ed Czeck, John Miller, Igor Russkikh, Pavel Belous,
	Allain Legacy, Matt Peters, Ravi Kumar, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Ferruh Yigit,
	Shijith Thotton, Srisivasubramanian Srinivasan, Jakub Grajciar,
	Matan Azrad, Shahaf Shuler, Yongseok Koh, Viacheslav Ovsiienko,
	Zyta Szpak, Liron Himi, Tomasz Duszynski, Stephen Hemminger,
	K. Y. Srinivasan, Haiyang Zhang, Alejandro Lucero,
	Tetsuya Mukawa, Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K,
	Rasesh Mody, Shahed Shaikh, Bruce Richardson, Jan Remes,
	Rastislav Cernay, Keith Wiles, Maciej Czekaj, Maxime Coquelin,
	Tiwei Bie, Zhihong Wang, Yong Wang, Thomas Monjalon
  Cc: dev, Igor Romanov

From: Igor Romanov <igor.romanov@oktetlabs.ru>

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>
---
 app/test/virtual_pmd.c                    |  4 ++-
 drivers/net/af_packet/rte_eth_af_packet.c |  4 ++-
 drivers/net/af_xdp/rte_eth_af_xdp.c       |  4 ++-
 drivers/net/ark/ark_ethdev.c              |  6 ++--
 drivers/net/atlantic/atl_ethdev.c         |  6 ++--
 drivers/net/avp/avp_ethdev.c              |  6 ++--
 drivers/net/axgbe/axgbe_ethdev.c          |  6 ++--
 drivers/net/bnxt/bnxt_stats.c             | 38 +++++++++++++++++------
 drivers/net/bnxt/bnxt_stats.h             |  4 +--
 drivers/net/bonding/rte_eth_bond_pmd.c    | 13 ++++++--
 drivers/net/cxgbe/cxgbe_ethdev.c          |  4 ++-
 drivers/net/dpaa/dpaa_ethdev.c            |  4 ++-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 10 +++---
 drivers/net/e1000/em_ethdev.c             |  6 ++--
 drivers/net/e1000/igb_ethdev.c            | 18 +++++++----
 drivers/net/enetc/enetc_ethdev.c          |  4 ++-
 drivers/net/enic/enic.h                   |  2 +-
 drivers/net/enic/enic_ethdev.c            |  4 +--
 drivers/net/enic/enic_main.c              | 11 +++++--
 drivers/net/failsafe/failsafe_ops.c       | 16 ++++++++--
 drivers/net/fm10k/fm10k_ethdev.c          | 10 ++++--
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 14 ++++++---
 drivers/net/hinic/base/hinic_pmd_niccfg.h |  4 +--
 drivers/net/hinic/hinic_pmd_ethdev.c      | 25 +++++++++++----
 drivers/net/i40e/i40e_ethdev.c            |  6 ++--
 drivers/net/i40e/i40e_ethdev_vf.c         |  6 ++--
 drivers/net/i40e/i40e_vf_representor.c    |  4 +--
 drivers/net/iavf/iavf_ethdev.c            | 11 ++++---
 drivers/net/ice/ice_ethdev.c              |  6 ++--
 drivers/net/ipn3ke/ipn3ke_representor.c   | 14 +++++----
 drivers/net/ixgbe/ixgbe_ethdev.c          | 18 +++++++----
 drivers/net/kni/rte_eth_kni.c             |  4 ++-
 drivers/net/liquidio/lio_ethdev.c         | 23 ++++++++------
 drivers/net/memif/rte_eth_memif.c         |  4 ++-
 drivers/net/mlx4/mlx4.h                   |  2 +-
 drivers/net/mlx4/mlx4_ethdev.c            |  7 ++++-
 drivers/net/mlx5/mlx5.h                   |  4 +--
 drivers/net/mlx5/mlx5_stats.c             | 19 +++++++++---
 drivers/net/mvneta/mvneta_ethdev.c        | 11 +++++--
 drivers/net/mvpp2/mrvl_ethdev.c           | 16 +++++++---
 drivers/net/netvsc/hn_ethdev.c            | 15 ++++++---
 drivers/net/netvsc/hn_var.h               |  4 +--
 drivers/net/netvsc/hn_vf.c                | 13 +++++---
 drivers/net/nfp/nfp_net.c                 |  6 ++--
 drivers/net/null/rte_eth_null.c           |  6 ++--
 drivers/net/octeontx/octeontx_ethdev.c    |  8 ++---
 drivers/net/octeontx2/otx2_ethdev.h       |  4 +--
 drivers/net/octeontx2/otx2_stats.c        | 33 +++++++++++++-------
 drivers/net/pcap/rte_eth_pcap.c           |  4 ++-
 drivers/net/qede/qede_ethdev.c            |  8 +++--
 drivers/net/ring/rte_eth_ring.c           |  4 ++-
 drivers/net/sfc/sfc_ethdev.c              |  7 +++--
 drivers/net/szedata2/rte_eth_szedata2.c   |  4 ++-
 drivers/net/tap/rte_eth_tap.c             |  4 ++-
 drivers/net/thunderx/nicvf_ethdev.c       | 13 ++++++--
 drivers/net/vhost/rte_eth_vhost.c         |  8 +++--
 drivers/net/virtio/virtio_ethdev.c        |  6 ++--
 drivers/net/vmxnet3/vmxnet3_ethdev.c      |  6 ++--
 lib/librte_ethdev/rte_ethdev.c            | 12 ++++---
 lib/librte_ethdev/rte_ethdev.h            |  2 ++
 lib/librte_ethdev/rte_ethdev_core.h       |  4 +--
 61 files changed, 380 insertions(+), 169 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b34df416a2..79156cb85a 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -197,7 +197,7 @@ virtual_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 virtual_ethdev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct virtual_ethdev_private *dev_private = dev->data->dev_private;
@@ -208,6 +208,8 @@ virtual_ethdev_stats_reset(struct rte_eth_dev *dev)
 
 	/* Reset internal statistics */
 	memset(&dev_private->eth_stats, 0, sizeof(dev_private->eth_stats));
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 0495727281..dce76b04e5 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -349,7 +349,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
 	return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
 	unsigned i;
@@ -365,6 +365,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
 		internal->tx_queue[i].err_pkts = 0;
 		internal->tx_queue[i].tx_bytes = 0;
 	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 1da22ff866..a16669f0f8 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -463,7 +463,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
@@ -475,6 +475,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
 		memset(&internals->tx_queues[i].stats, 0,
 					sizeof(struct tx_stats));
 	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 2b3f8e3bbf..c3642012dd 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -39,7 +39,7 @@ static int eth_ark_dev_set_link_up(struct rte_eth_dev *dev);
 static int eth_ark_dev_set_link_down(struct rte_eth_dev *dev);
 static int eth_ark_dev_stats_get(struct rte_eth_dev *dev,
 				  struct rte_eth_stats *stats);
-static void eth_ark_dev_stats_reset(struct rte_eth_dev *dev);
+static int eth_ark_dev_stats_reset(struct rte_eth_dev *dev);
 static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
 					 struct rte_ether_addr *mac_addr);
 static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
@@ -813,7 +813,7 @@ eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	uint16_t i;
@@ -826,6 +826,8 @@ eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
 	if (ark->user_ext.stats_reset)
 		ark->user_ext.stats_reset(dev,
 			  ark->user_data[dev->data->port_id]);
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 5018529da1..19742c20d1 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -40,7 +40,7 @@ static int atl_dev_stats_get(struct rte_eth_dev *dev,
 static int atl_dev_xstats_get(struct rte_eth_dev *dev,
 			      struct rte_eth_xstat *stats, unsigned int n);
 
-static void atl_dev_stats_reset(struct rte_eth_dev *dev);
+static int atl_dev_stats_reset(struct rte_eth_dev *dev);
 
 static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 			      size_t fw_size);
@@ -975,7 +975,7 @@ atl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 atl_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct atl_adapter *adapter = ATL_DEV_TO_ADAPTER(dev);
@@ -987,6 +987,8 @@ atl_dev_stats_reset(struct rte_eth_dev *dev)
 	memset(&hw->curr_stats, 0, sizeof(hw->curr_stats));
 
 	memset(&adapter->sw_stats, 0, sizeof(adapter->sw_stats));
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 050901990c..cd747b6beb 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -82,7 +82,7 @@ static void avp_dev_tx_queue_release(void *txq);
 
 static int avp_dev_stats_get(struct rte_eth_dev *dev,
 			      struct rte_eth_stats *stats);
-static void avp_dev_stats_reset(struct rte_eth_dev *dev);
+static int avp_dev_stats_reset(struct rte_eth_dev *dev);
 
 
 #define AVP_MAX_RX_BURST 64
@@ -2275,7 +2275,7 @@ avp_dev_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 avp_dev_stats_reset(struct rte_eth_dev *eth_dev)
 {
 	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2300,6 +2300,8 @@ avp_dev_stats_reset(struct rte_eth_dev *eth_dev)
 			txq->errors = 0;
 		}
 	}
+
+	return 0;
 }
 
 RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd);
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index c43b5bfb6f..5036196726 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -23,7 +23,7 @@ static int axgbe_dev_link_update(struct rte_eth_dev *dev,
 				 int wait_to_complete);
 static int axgbe_dev_stats_get(struct rte_eth_dev *dev,
 				struct rte_eth_stats *stats);
-static void axgbe_dev_stats_reset(struct rte_eth_dev *dev);
+static int axgbe_dev_stats_reset(struct rte_eth_dev *dev);
 static int  axgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 
@@ -337,7 +337,7 @@ axgbe_dev_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 axgbe_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct axgbe_rx_queue *rxq;
@@ -356,6 +356,8 @@ axgbe_dev_stats_reset(struct rte_eth_dev *dev)
 		txq->bytes = 0;
 		txq->errors = 0;
 	}
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 69ac2dd914..049ad9e398 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -392,22 +392,25 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 	return rc;
 }
 
-void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
+int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 	unsigned int i;
+	int ret;
 
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
 		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
-		return;
+		return -EINVAL;
 	}
 
-	bnxt_clear_all_hwrm_stat_ctxs(bp);
+	ret = bnxt_clear_all_hwrm_stat_ctxs(bp);
 	for (i = 0; i < bp->rx_cp_nr_rings; i++) {
 		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
 
 		rte_atomic64_clear(&rxq->rx_mbuf_alloc_fail);
 	}
+
+	return ret;
 }
 
 int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
@@ -543,19 +546,36 @@ int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
 	return stat_cnt;
 }
 
-void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
+int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
+	int ret;
+
+	if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp)) {
+		ret = bnxt_hwrm_port_clr_stats(bp);
+		if (ret != 0) {
+			PMD_DRV_LOG(ERR, "Operation failed: %s\n",
+				    strerror(-ret));
+			return ret;
+		}
+	}
 
-	if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp))
-		bnxt_hwrm_port_clr_stats(bp);
+	ret = 0;
 
-	if (BNXT_VF(bp))
+	if (BNXT_VF(bp)) {
 		PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n");
-	if (!BNXT_SINGLE_PF(bp))
+		ret = -ENOTSUP;
+	}
+	if (!BNXT_SINGLE_PF(bp)) {
 		PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n");
-	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
+		ret = -ENOTSUP;
+	}
+	if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
 		PMD_DRV_LOG(ERR, "Operation not supported\n");
+		ret = -ENOTSUP;
+	}
+
+	return ret;
 }
 
 int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
diff --git a/drivers/net/bnxt/bnxt_stats.h b/drivers/net/bnxt/bnxt_stats.h
index b0f135a5af..3cf2a1b822 100644
--- a/drivers/net/bnxt/bnxt_stats.h
+++ b/drivers/net/bnxt/bnxt_stats.h
@@ -11,13 +11,13 @@
 void bnxt_free_stats(struct bnxt *bp);
 int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_stats *bnxt_stats);
-void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev);
+int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev);
 int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
 	struct rte_eth_xstat_name *xstats_names,
 	__rte_unused unsigned int limit);
 int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_xstat *xstats, unsigned int n);
-void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev);
+int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev);
 int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
 				uint64_t *values, unsigned int limit);
 int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index f9b7b595df..5ff9fcbaf7 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2472,14 +2472,21 @@ bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 bond_ethdev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	int i;
+	int err;
+	int ret;
 
-	for (i = 0; i < internals->slave_count; i++)
-		rte_eth_stats_reset(internals->slaves[i].port_id);
+	for (i = 0, err = 0; i < internals->slave_count; i++) {
+		ret = rte_eth_stats_reset(internals->slaves[i].port_id);
+		if (ret != 0)
+			err = ret;
+	}
+
+	return err;
 }
 
 static int
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index be001a0d24..030e0469c3 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -724,7 +724,7 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
 /*
  * Reset port statistics.
  */
-static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
+static int cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
 {
 	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
@@ -747,6 +747,8 @@ static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
 		txq->stats.tx_bytes = 0;
 		txq->stats.mapping_err = 0;
 	}
+
+	return 0;
 }
 
 static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev,
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index ad28c110d7..9265b1740e 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -399,13 +399,15 @@ static int dpaa_eth_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void dpaa_eth_stats_reset(struct rte_eth_dev *dev)
+static int dpaa_eth_stats_reset(struct rte_eth_dev *dev)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	fman_if_stats_reset(dpaa_intf->fif);
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index d9cc2c3510..363208c0e8 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1429,12 +1429,12 @@ dpaa2_xstats_get_names_by_id(
 	return limit;
 }
 
-static void
+static int
 dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct dpaa2_dev_priv *priv = dev->data->dev_private;
 	struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw;
-	int32_t  retcode;
+	int retcode;
 	int i;
 	struct dpaa2_queue *dpaa2_q;
 
@@ -1442,7 +1442,7 @@ dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
 
 	if (dpni == NULL) {
 		DPAA2_PMD_ERR("dpni is NULL");
-		return;
+		return -EINVAL;
 	}
 
 	retcode =  dpni_reset_statistics(dpni, CMD_PRI_LOW, priv->token);
@@ -1462,11 +1462,11 @@ dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
 			dpaa2_q->tx_pkts = 0;
 	}
 
-	return;
+	return 0;
 
 error:
 	DPAA2_PMD_ERR("Operation not completed:Error Code = %d", retcode);
-	return;
+	return retcode;
 };
 
 /* return 0 means link status changed, -1 means not changed */
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index b23e840376..a6796bf8b7 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -43,7 +43,7 @@ static int eth_em_link_update(struct rte_eth_dev *dev,
 				int wait_to_complete);
 static int eth_em_stats_get(struct rte_eth_dev *dev,
 				struct rte_eth_stats *rte_stats);
-static void eth_em_stats_reset(struct rte_eth_dev *dev);
+static int eth_em_stats_reset(struct rte_eth_dev *dev);
 static int eth_em_infos_get(struct rte_eth_dev *dev,
 				struct rte_eth_dev_info *dev_info);
 static int eth_em_flow_ctrl_get(struct rte_eth_dev *dev,
@@ -984,7 +984,7 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
 	return 0;
 }
 
-static void
+static int
 eth_em_stats_reset(struct rte_eth_dev *dev)
 {
 	struct e1000_hw_stats *hw_stats =
@@ -995,6 +995,8 @@ eth_em_stats_reset(struct rte_eth_dev *dev)
 
 	/* Reset software totals */
 	memset(hw_stats, 0, sizeof(*hw_stats));
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a9f6de5d52..f6bfdd6311 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -98,8 +98,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
 static int eth_igb_xstats_get_names_by_id(struct rte_eth_dev *dev,
 		struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
 		unsigned int limit);
-static void eth_igb_stats_reset(struct rte_eth_dev *dev);
-static void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static int eth_igb_stats_reset(struct rte_eth_dev *dev);
+static int eth_igb_xstats_reset(struct rte_eth_dev *dev);
 static int eth_igb_fw_version_get(struct rte_eth_dev *dev,
 				   char *fw_version, size_t fw_size);
 static int eth_igb_infos_get(struct rte_eth_dev *dev,
@@ -168,7 +168,7 @@ static int eth_igbvf_xstats_get(struct rte_eth_dev *dev,
 static int eth_igbvf_xstats_get_names(struct rte_eth_dev *dev,
 				      struct rte_eth_xstat_name *xstats_names,
 				      unsigned limit);
-static void eth_igbvf_stats_reset(struct rte_eth_dev *dev);
+static int eth_igbvf_stats_reset(struct rte_eth_dev *dev);
 static int igbvf_vlan_filter_set(struct rte_eth_dev *dev,
 		uint16_t vlan_id, int on);
 static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on);
@@ -1870,7 +1870,7 @@ eth_igb_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
 	return 0;
 }
 
-static void
+static int
 eth_igb_stats_reset(struct rte_eth_dev *dev)
 {
 	struct e1000_hw_stats *hw_stats =
@@ -1881,9 +1881,11 @@ eth_igb_stats_reset(struct rte_eth_dev *dev)
 
 	/* Reset software totals */
 	memset(hw_stats, 0, sizeof(*hw_stats));
+
+	return 0;
 }
 
-static void
+static int
 eth_igb_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct e1000_hw_stats *stats =
@@ -1894,6 +1896,8 @@ eth_igb_xstats_reset(struct rte_eth_dev *dev)
 
 	/* Reset software totals */
 	memset(stats, 0, sizeof(*stats));
+
+	return 0;
 }
 
 static int eth_igb_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
@@ -2127,7 +2131,7 @@ eth_igbvf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
 	return 0;
 }
 
-static void
+static int
 eth_igbvf_stats_reset(struct rte_eth_dev *dev)
 {
 	struct e1000_vf_stats *hw_stats = (struct e1000_vf_stats*)
@@ -2139,6 +2143,8 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)
 	/* reset HW current stats*/
 	memset(&hw_stats->gprc, 0, sizeof(*hw_stats) -
 	       offsetof(struct e1000_vf_stats, gprc));
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 1ec66d0baf..bd53811fcf 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -492,7 +492,7 @@ int enetc_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 enetc_stats_reset(struct rte_eth_dev *dev)
 {
 	struct enetc_eth_hw *hw =
@@ -500,6 +500,8 @@ enetc_stats_reset(struct rte_eth_dev *dev)
 	struct enetc_hw *enetc_hw = &hw->hw;
 
 	enetc_port_wr(enetc_hw, ENETC_PM0_STAT_CONFIG, ENETC_CLEAR_STATS);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 72b1e7956b..579d11872c 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -304,7 +304,7 @@ void enic_remove(struct enic *enic);
 int enic_get_link_status(struct enic *enic);
 int enic_dev_stats_get(struct enic *enic,
 		       struct rte_eth_stats *r_stats);
-void enic_dev_stats_clear(struct enic *enic);
+int enic_dev_stats_clear(struct enic *enic);
 int enic_add_packet_filter(struct enic *enic);
 int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
 int enic_del_mac_address(struct enic *enic, int mac_index);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 5d48930a9d..6b6387f6d2 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -474,12 +474,12 @@ static int enicpmd_dev_stats_get(struct rte_eth_dev *eth_dev,
 	return enic_dev_stats_get(enic, stats);
 }
 
-static void enicpmd_dev_stats_reset(struct rte_eth_dev *eth_dev)
+static int enicpmd_dev_stats_reset(struct rte_eth_dev *eth_dev)
 {
 	struct enic *enic = pmd_priv(eth_dev);
 
 	ENICPMD_FUNC_TRACE();
-	enic_dev_stats_clear(enic);
+	return enic_dev_stats_clear(enic);
 }
 
 static uint32_t speed_capa_from_pci_id(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index f4e76a057a..e507df1f6f 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -115,11 +115,18 @@ static void enic_init_soft_stats(struct enic *enic)
 	enic_clear_soft_stats(enic);
 }
 
-void enic_dev_stats_clear(struct enic *enic)
+int enic_dev_stats_clear(struct enic *enic)
 {
-	if (vnic_dev_stats_clear(enic->vdev))
+	int ret;
+
+	ret = vnic_dev_stats_clear(enic->vdev);
+	if (ret != 0) {
 		dev_err(enic, "Error in clearing stats\n");
+		return ret;
+	}
 	enic_clear_soft_stats(enic);
+
+	return 0;
 }
 
 int enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index fee783ad07..ad6bed0426 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -814,19 +814,31 @@ fs_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 fs_stats_reset(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
 	uint8_t i;
+	int ret;
 
 	fs_lock(dev, 0);
 	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
-		rte_eth_stats_reset(PORT_ID(sdev));
+		ret = rte_eth_stats_reset(PORT_ID(sdev));
+		if (ret) {
+			if (!fs_err(sdev, ret))
+				continue;
+
+			ERROR("Operation rte_eth_stats_reset failed for sub_device %d with error %d",
+			      i, ret);
+			fs_unlock(dev, 0);
+			return ret;
+		}
 		memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats));
 	}
 	memset(&PRIV(dev)->stats_accumulator, 0, sizeof(struct rte_eth_stats));
 	fs_unlock(dev, 0);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index f0f6290089..e70daa333b 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1355,7 +1355,7 @@ fm10k_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 fm10k_stats_reset(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1366,6 +1366,8 @@ fm10k_stats_reset(struct rte_eth_dev *dev)
 
 	memset(hw_stats, 0, sizeof(*hw_stats));
 	fm10k_rebind_hw_stats(hw, hw_stats);
+
+	return 0;
 }
 
 static int
@@ -3114,7 +3116,11 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
 	}
 
 	/* Reset the hw statistics */
-	fm10k_stats_reset(dev);
+	diag = fm10k_stats_reset(dev);
+	if (diag != 0) {
+		PMD_INIT_LOG(ERR, "Stats reset failed: %d", diag);
+		return diag;
+	}
 
 	/* Reset the hw */
 	diag = fm10k_reset_hw(hw);
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c
index 7da0a88749..78012b8d37 100644
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.c
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c
@@ -1131,7 +1131,7 @@ int hinic_set_fast_recycle_mode(void *hwdev, u8 mode)
 	return 0;
 }
 
-void hinic_clear_vport_stats(struct hinic_hwdev *hwdev)
+int hinic_clear_vport_stats(struct hinic_hwdev *hwdev)
 {
 	struct hinic_clear_vport_stats clear_vport_stats;
 	u16 out_size = sizeof(clear_vport_stats);
@@ -1139,7 +1139,7 @@ void hinic_clear_vport_stats(struct hinic_hwdev *hwdev)
 
 	if (!hwdev) {
 		PMD_DRV_LOG(ERR, "Hwdev is NULL");
-		return;
+		return -EINVAL;
 	}
 
 	memset(&clear_vport_stats, 0, sizeof(clear_vport_stats));
@@ -1153,10 +1153,13 @@ void hinic_clear_vport_stats(struct hinic_hwdev *hwdev)
 	if (err || !out_size || clear_vport_stats.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to clear vport statistics, err: %d, status: 0x%x, out size: 0x%x",
 			err, clear_vport_stats.mgmt_msg_head.status, out_size);
+		return -EINVAL;
 	}
+
+	return 0;
 }
 
-void hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev)
+int hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev)
 {
 	struct hinic_clear_port_stats clear_phy_port_stats;
 	u16 out_size = sizeof(clear_phy_port_stats);
@@ -1164,7 +1167,7 @@ void hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev)
 
 	if (!hwdev) {
 		PMD_DRV_LOG(ERR, "Hwdev is NULL");
-		return;
+		return -EINVAL;
 	}
 
 	memset(&clear_phy_port_stats, 0, sizeof(clear_phy_port_stats));
@@ -1180,7 +1183,10 @@ void hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev)
 		PMD_DRV_LOG(ERR, "Failed to clear phy port statistics, err: %d, status: 0x%x, out size: 0x%x",
 			err, clear_phy_port_stats.mgmt_msg_head.status,
 			out_size);
+		return -EINVAL;
 	}
+
+	return 0;
 }
 
 int hinic_set_link_status_follow(void *hwdev,
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.h b/drivers/net/hinic/base/hinic_pmd_niccfg.h
index eaa3f2aba2..174b40fa99 100644
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.h
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.h
@@ -651,8 +651,8 @@ int hinic_set_fast_recycle_mode(void *hwdev, u8 mode);
 
 int hinic_get_base_qpn(void *hwdev, u16 *global_qpn);
 
-void hinic_clear_vport_stats(struct hinic_hwdev *hwdev);
+int hinic_clear_vport_stats(struct hinic_hwdev *hwdev);
 
-void hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev);
+int hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev);
 
 #endif /* _HINIC_PMD_NICCFG_H_ */
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index c50cdd9f81..c9a400e149 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1203,14 +1203,17 @@ hinic_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
  * @param dev
  *   Pointer to Ethernet device structure.
  */
-static void hinic_dev_stats_reset(struct rte_eth_dev *dev)
+static int hinic_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	int qid;
 	struct hinic_rxq	*rxq = NULL;
 	struct hinic_txq	*txq = NULL;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+	int ret;
 
-	hinic_clear_vport_stats(nic_dev->hwdev);
+	ret = hinic_clear_vport_stats(nic_dev->hwdev);
+	if (ret != 0)
+		return ret;
 
 	for (qid = 0; qid < nic_dev->num_rq; qid++) {
 		rxq = nic_dev->rxqs[qid];
@@ -1221,6 +1224,8 @@ static void hinic_dev_stats_reset(struct rte_eth_dev *dev)
 		txq = nic_dev->txqs[qid];
 		hinic_txq_stats_reset(txq);
 	}
+
+	return 0;
 }
 
 /**
@@ -1229,14 +1234,22 @@ static void hinic_dev_stats_reset(struct rte_eth_dev *dev)
  * @param dev
  *   Pointer to Ethernet device structure.
  **/
-static void hinic_dev_xstats_reset(struct rte_eth_dev *dev)
+static int hinic_dev_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+	int ret;
 
-	hinic_dev_stats_reset(dev);
+	ret = hinic_dev_stats_reset(dev);
+	if (ret != 0)
+		return ret;
 
-	if (hinic_func_type(nic_dev->hwdev) != TYPE_VF)
-		hinic_clear_phy_port_stats(nic_dev->hwdev);
+	if (hinic_func_type(nic_dev->hwdev) != TYPE_VF) {
+		ret = hinic_clear_phy_port_stats(nic_dev->hwdev);
+		if (ret != 0)
+			return ret;
+	}
+
+	return 0;
 }
 
 static void hinic_gen_random_mac_addr(struct rte_ether_addr *mac_addr)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 79bd3a70c9..f3b5147a80 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -236,7 +236,7 @@ static int i40e_dev_xstats_get(struct rte_eth_dev *dev,
 static int i40e_dev_xstats_get_names(struct rte_eth_dev *dev,
 				     struct rte_eth_xstat_name *xstats_names,
 				     unsigned limit);
-static void i40e_dev_stats_reset(struct rte_eth_dev *dev);
+static int i40e_dev_stats_reset(struct rte_eth_dev *dev);
 static int i40e_fw_version_get(struct rte_eth_dev *dev,
 				char *fw_version, size_t fw_size);
 static int i40e_dev_info_get(struct rte_eth_dev *dev,
@@ -3313,7 +3313,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 }
 
 /* Reset the statistics */
-static void
+static int
 i40e_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -3326,6 +3326,8 @@ i40e_dev_stats_reset(struct rte_eth_dev *dev)
 
 	/* read the stats, reading current register values into offset */
 	i40e_read_stats_registers(pf, hw);
+
+	return 0;
 }
 
 static uint32_t
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 2bbbacf00b..8c5beee6bd 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -86,7 +86,7 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
 static int i40evf_dev_xstats_get_names(struct rte_eth_dev *dev,
 				       struct rte_eth_xstat_name *xstats_names,
 				       unsigned limit);
-static void i40evf_dev_xstats_reset(struct rte_eth_dev *dev);
+static int i40evf_dev_xstats_reset(struct rte_eth_dev *dev);
 static int i40evf_vlan_filter_set(struct rte_eth_dev *dev,
 				  uint16_t vlan_id, int on);
 static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
@@ -950,7 +950,7 @@ i40evf_update_stats(struct i40e_vsi *vsi,
 	i40evf_stat_update_32(&oes->tx_discards, &nes->tx_discards);
 }
 
-static void
+static int
 i40evf_dev_xstats_reset(struct rte_eth_dev *dev)
 {
 	int ret;
@@ -963,6 +963,8 @@ i40evf_dev_xstats_reset(struct rte_eth_dev *dev)
 	/* set stats offset base on current values */
 	if (ret == 0)
 		vf->vsi.eth_stats_offset = *pstats;
+
+	return ret;
 }
 
 static int i40evf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 7f69e27a24..5f4e372b37 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -264,12 +264,12 @@ i40e_vf_representor_stats_get(struct rte_eth_dev *ethdev,
 	return ret;
 }
 
-static void
+static int
 i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
-	rte_pmd_i40e_get_vf_native_stats(
+	return rte_pmd_i40e_get_vf_native_stats(
 		representor->adapter->eth_dev->data->port_id,
 		representor->vf_id, &representor->stats_offset);
 }
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 22a88c88dd..e1c4261b47 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -42,7 +42,7 @@ static int iavf_dev_info_get(struct rte_eth_dev *dev,
 static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 static int iavf_dev_stats_get(struct rte_eth_dev *dev,
 			     struct rte_eth_stats *stats);
-static void iavf_dev_stats_reset(struct rte_eth_dev *dev);
+static int iavf_dev_stats_reset(struct rte_eth_dev *dev);
 static int iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
 static int iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
@@ -1065,7 +1065,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return -EIO;
 }
 
-static void
+static int
 iavf_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	int ret;
@@ -1077,10 +1077,13 @@ iavf_dev_stats_reset(struct rte_eth_dev *dev)
 
 	/* read stat values to clear hardware registers */
 	ret = iavf_query_stats(adapter, &pstats);
+	if (ret != 0)
+		return ret;
 
 	/* set stats offset base on current values */
-	if (ret == 0)
-		vsi->eth_stats_offset = *pstats;
+	vsi->eth_stats_offset = *pstats;
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index eecf9c86c2..f02f6b8129 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -85,7 +85,7 @@ static int ice_get_eeprom(struct rte_eth_dev *dev,
 			  struct rte_dev_eeprom_info *eeprom);
 static int ice_stats_get(struct rte_eth_dev *dev,
 			 struct rte_eth_stats *stats);
-static void ice_stats_reset(struct rte_eth_dev *dev);
+static int ice_stats_reset(struct rte_eth_dev *dev);
 static int ice_xstats_get(struct rte_eth_dev *dev,
 			  struct rte_eth_xstat *xstats, unsigned int n);
 static int ice_xstats_get_names(struct rte_eth_dev *dev,
@@ -3620,7 +3620,7 @@ ice_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 }
 
 /* Reset the statistics */
-static void
+static int
 ice_stats_reset(struct rte_eth_dev *dev)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -3633,6 +3633,8 @@ ice_stats_reset(struct rte_eth_dev *dev)
 
 	/* read the stats, reading current register values into offset */
 	ice_read_stats_registers(pf, hw);
+
+	return 0;
 }
 
 static uint32_t
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 9079073c95..4bd2d016b4 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2047,7 +2047,7 @@ uint16_t port_id)
 		0);
 }
 
-static void
+static int
 ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
 {
 	uint16_t port_id = 0;
@@ -2058,18 +2058,18 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
 
 	if (!ethdev) {
 		IPN3KE_AFU_PMD_ERR("ethernet device to reset is NULL!");
-		return;
+		return -EINVAL;
 	}
 
 	afu_dev = RTE_ETH_DEV_TO_AFU(ethdev);
 	if (!afu_dev) {
 		IPN3KE_AFU_PMD_ERR("afu device to reset is NULL!");
-		return;
+		return -EINVAL;
 	}
 
 	if (!afu_dev->shared.data) {
 		IPN3KE_AFU_PMD_ERR("hardware data to reset is NULL!");
-		return;
+		return -EINVAL;
 	}
 
 	hw = afu_dev->shared.data;
@@ -2077,7 +2077,7 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
 	ch = ethdev->data->name;
 	if (!ch) {
 		IPN3KE_AFU_PMD_ERR("ethdev name is NULL!");
-		return;
+		return -EINVAL;
 	}
 	while (ch) {
 		if (*ch == '_')
@@ -2088,7 +2088,7 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
 	}
 	if (!ch) {
 		IPN3KE_AFU_PMD_ERR("Can not get port_id from ethdev name!");
-		return;
+		return -EINVAL;
 	}
 	port_id = atoi(ch);
 
@@ -2104,6 +2104,8 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
 		ipn3ke_rpst_10g_lineside_tx_stats_reset(hw, port_id);
 		ipn3ke_rpst_10g_lineside_rx_stats_reset(hw, port_id);
 	}
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 023b267d74..493764c1b7 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -164,8 +164,8 @@ static int ixgbevf_dev_xstats_get(struct rte_eth_dev *dev,
 static int
 ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 		uint64_t *values, unsigned int n);
-static void ixgbe_dev_stats_reset(struct rte_eth_dev *dev);
-static void ixgbe_dev_xstats_reset(struct rte_eth_dev *dev);
+static int ixgbe_dev_stats_reset(struct rte_eth_dev *dev);
+static int ixgbe_dev_xstats_reset(struct rte_eth_dev *dev);
 static int ixgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
 	struct rte_eth_xstat_name *xstats_names,
 	unsigned int size);
@@ -255,7 +255,7 @@ static void ixgbevf_intr_disable(struct rte_eth_dev *dev);
 static void ixgbevf_intr_enable(struct rte_eth_dev *dev);
 static int ixgbevf_dev_stats_get(struct rte_eth_dev *dev,
 		struct rte_eth_stats *stats);
-static void ixgbevf_dev_stats_reset(struct rte_eth_dev *dev);
+static int ixgbevf_dev_stats_reset(struct rte_eth_dev *dev);
 static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev,
 		uint16_t vlan_id, int on);
 static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev,
@@ -3317,7 +3317,7 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 ixgbe_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw_stats *stats =
@@ -3328,6 +3328,8 @@ ixgbe_dev_stats_reset(struct rte_eth_dev *dev)
 
 	/* Reset software totals */
 	memset(stats, 0, sizeof(*stats));
+
+	return 0;
 }
 
 /* This function calculates the number of xstats based on the current config */
@@ -3649,7 +3651,7 @@ ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 	return n;
 }
 
-static void
+static int
 ixgbe_dev_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw_stats *stats =
@@ -3666,6 +3668,8 @@ ixgbe_dev_xstats_reset(struct rte_eth_dev *dev)
 	/* Reset software totals */
 	memset(stats, 0, sizeof(*stats));
 	memset(macsec_stats, 0, sizeof(*macsec_stats));
+
+	return 0;
 }
 
 static void
@@ -3740,7 +3744,7 @@ ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *)
@@ -3754,6 +3758,8 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 	hw_stats->vfgorc = 0;
 	hw_stats->vfgptc = 0;
 	hw_stats->vfgotc = 0;
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index 5e1623d250..d269eec963 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -300,7 +300,7 @@ eth_kni_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 eth_kni_stats_reset(struct rte_eth_dev *dev)
 {
 	struct rte_eth_dev_data *data = dev->data;
@@ -317,6 +317,8 @@ eth_kni_stats_reset(struct rte_eth_dev *dev)
 		q->tx.pkts = 0;
 		q->tx.bytes = 0;
 	}
+
+	return 0;
 }
 
 static const struct eth_dev_ops eth_kni_ops = {
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index e1eaf9eb8a..ceea878591 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -243,17 +243,18 @@ lio_dev_xstats_get_names(struct rte_eth_dev *eth_dev,
 }
 
 /* Reset hw stats for the port */
-static void
+static int
 lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
 	struct lio_dev_ctrl_cmd ctrl_cmd;
 	struct lio_ctrl_pkt ctrl_pkt;
+	int ret;
 
 	if (!lio_dev->intf_open) {
 		lio_dev_err(lio_dev, "Port %d down\n",
 			    lio_dev->port_id);
-		return;
+		return -EINVAL;
 	}
 
 	/* flush added to prevent cmd failure
@@ -270,19 +271,21 @@ lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
 	ctrl_pkt.ncmd.s.cmd = LIO_CMD_CLEAR_STATS;
 	ctrl_pkt.ctrl_cmd = &ctrl_cmd;
 
-	if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
+	ret = lio_send_ctrl_pkt(lio_dev, &ctrl_pkt);
+	if (ret != 0) {
 		lio_dev_err(lio_dev, "Failed to send clear stats command\n");
-		return;
+		return ret;
 	}
 
-	if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
+	ret = lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd);
+	if (ret != 0) {
 		lio_dev_err(lio_dev, "Clear stats command timed out\n");
-		return;
+		return ret;
 	}
 
 	/* clear stored per queue stats */
-	RTE_FUNC_PTR_OR_RET(*eth_dev->dev_ops->stats_reset);
-	(*eth_dev->dev_ops->stats_reset)(eth_dev);
+	RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
+	return (*eth_dev->dev_ops->stats_reset)(eth_dev);
 }
 
 /* Retrieve the device statistics (# packets in/out, # bytes in/out, etc */
@@ -338,7 +341,7 @@ lio_dev_stats_get(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
-static void
+static int
 lio_dev_stats_reset(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -365,6 +368,8 @@ lio_dev_stats_reset(struct rte_eth_dev *eth_dev)
 			memset(oq_stats, 0, sizeof(struct lio_droq_stats));
 		}
 	}
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 0d4360e5c2..af260f7a87 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -968,7 +968,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 memif_stats_reset(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *pmd = dev->data->dev_private;
@@ -987,6 +987,8 @@ memif_stats_reset(struct rte_eth_dev *dev)
 		mq->n_pkts = 0;
 		mq->n_bytes = 0;
 	}
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 21517d70a2..09d9eaf659 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -217,7 +217,7 @@ int mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list,
 			  uint32_t num);
 int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);
 int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
-void mlx4_stats_reset(struct rte_eth_dev *dev);
+int mlx4_stats_reset(struct rte_eth_dev *dev);
 int mlx4_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size);
 int mlx4_dev_infos_get(struct rte_eth_dev *dev,
 		       struct rte_eth_dev_info *info);
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index c8a73bc1f4..3579126ed7 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -746,8 +746,11 @@ mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   alwasy 0 on success
  */
-void
+int
 mlx4_stats_reset(struct rte_eth_dev *dev)
 {
 	unsigned int i;
@@ -768,6 +771,8 @@ mlx4_stats_reset(struct rte_eth_dev *dev)
 				.idx = txq->stats.idx,
 			};
 	}
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 0c202d8dd9..3a88e6a98c 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -760,10 +760,10 @@ void mlx5_allmulticast_disable(struct rte_eth_dev *dev);
 
 void mlx5_stats_init(struct rte_eth_dev *dev);
 int mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
-void mlx5_stats_reset(struct rte_eth_dev *dev);
+int mlx5_stats_reset(struct rte_eth_dev *dev);
 int mlx5_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
 		    unsigned int n);
-void mlx5_xstats_reset(struct rte_eth_dev *dev);
+int mlx5_xstats_reset(struct rte_eth_dev *dev);
 int mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
 			  struct rte_eth_xstat_name *xstats_names,
 			  unsigned int n);
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index cff065f279..205e4fec78 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;
 }
 
 /**
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 1090af03b1..865ad61aed 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -48,7 +48,7 @@ struct mvneta_ifnames {
 
 static int mvneta_dev_num;
 
-static void mvneta_stats_reset(struct rte_eth_dev *dev);
+static int mvneta_stats_reset(struct rte_eth_dev *dev);
 static int rte_pmd_mvneta_remove(struct rte_vdev_device *vdev);
 
 
@@ -736,19 +736,24 @@ mvneta_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
-static void
+static int
 mvneta_stats_reset(struct rte_eth_dev *dev)
 {
 	struct mvneta_priv *priv = dev->data->dev_private;
 	unsigned int ret;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	ret = mvneta_stats_get(dev, &priv->prev_stats);
 	if (unlikely(ret))
 		RTE_LOG(ERR, PMD, "Failed to reset port statistics");
+
+	return ret;
 }
 
 
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 1e5a1e39aa..46b7b88de4 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -1315,15 +1315,18 @@ mrvl_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
-static void
+static int
 mrvl_stats_reset(struct rte_eth_dev *dev)
 {
 	struct mrvl_priv *priv = dev->data->dev_private;
 	int i;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		struct mrvl_rxq *rxq = dev->data->rx_queues[i];
@@ -1341,7 +1344,7 @@ mrvl_stats_reset(struct rte_eth_dev *dev)
 		txq->bytes_sent = 0;
 	}
 
-	pp2_ppio_get_statistics(priv->ppio, NULL, 1);
+	return pp2_ppio_get_statistics(priv->ppio, NULL, 1);
 }
 
 /**
@@ -1392,11 +1395,14 @@ mrvl_xstats_get(struct rte_eth_dev *dev,
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
-static void
+static int
 mrvl_xstats_reset(struct rte_eth_dev *dev)
 {
-	mrvl_stats_reset(dev);
+	return mrvl_stats_reset(dev);
 }
 
 /**
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index d04a6c8acb..7edfe5ec1e 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -630,7 +630,7 @@ static int hn_dev_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 hn_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	unsigned int i;
@@ -653,13 +653,20 @@ hn_dev_stats_reset(struct rte_eth_dev *dev)
 
 		memset(&rxq->stats, 0, sizeof(struct hn_stats));
 	}
+
+	return 0;
 }
 
-static void
+static int
 hn_dev_xstats_reset(struct rte_eth_dev *dev)
 {
-	hn_dev_stats_reset(dev);
-	hn_vf_xstats_reset(dev);
+	int ret;
+
+	ret = hn_dev_stats_reset(dev);
+	if (ret != 0)
+		return 0;
+
+	return hn_vf_xstats_reset(dev);
 }
 
 static int
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index 01f2276482..93c91e2bdb 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -235,14 +235,14 @@ int	hn_vf_rx_queue_setup(struct rte_eth_dev *dev,
 void	hn_vf_rx_queue_release(struct hn_data *hv, uint16_t queue_id);
 
 int	hn_vf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
-void	hn_vf_stats_reset(struct rte_eth_dev *dev);
+int	hn_vf_stats_reset(struct rte_eth_dev *dev);
 int	hn_vf_xstats_get_names(struct rte_eth_dev *dev,
 			       struct rte_eth_xstat_name *xstats_names,
 			       unsigned int size);
 int	hn_vf_xstats_get(struct rte_eth_dev *dev,
 			 struct rte_eth_xstat *xstats,
 			 unsigned int offset, unsigned int n);
-void	hn_vf_xstats_reset(struct rte_eth_dev *dev);
+int	hn_vf_xstats_reset(struct rte_eth_dev *dev);
 int	hn_vf_rss_hash_update(struct rte_eth_dev *dev,
 			      struct rte_eth_rss_conf *rss_conf);
 int	hn_vf_reta_hash_update(struct rte_eth_dev *dev,
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index d133438bbd..5ae4dc9796 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -395,9 +395,9 @@ void hn_vf_close(struct rte_eth_dev *dev)
 	rte_spinlock_unlock(&hv->vf_lock);
 }
 
-void hn_vf_stats_reset(struct rte_eth_dev *dev)
+int hn_vf_stats_reset(struct rte_eth_dev *dev)
 {
-	VF_ETHDEV_FUNC(dev, rte_eth_stats_reset);
+	VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_stats_reset);
 }
 
 void hn_vf_allmulticast_enable(struct rte_eth_dev *dev)
@@ -573,16 +573,21 @@ int hn_vf_xstats_get(struct rte_eth_dev *dev,
 	return count;
 }
 
-void hn_vf_xstats_reset(struct rte_eth_dev *dev)
+int hn_vf_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
 	struct rte_eth_dev *vf_dev;
+	int ret;
 
 	rte_spinlock_lock(&hv->vf_lock);
 	vf_dev = hn_get_vf_dev(hv);
 	if (vf_dev)
-		rte_eth_xstats_reset(vf_dev->data->port_id);
+		ret = rte_eth_xstats_reset(vf_dev->data->port_id);
+	else
+		ret = -EINVAL;
 	rte_spinlock_unlock(&hv->vf_lock);
+
+	return ret;
 }
 
 int hn_vf_rss_hash_update(struct rte_eth_dev *dev,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index a9858036a9..22a8b2d19e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -105,7 +105,7 @@ static int nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 static int nfp_net_start(struct rte_eth_dev *dev);
 static int nfp_net_stats_get(struct rte_eth_dev *dev,
 			      struct rte_eth_stats *stats);
-static void nfp_net_stats_reset(struct rte_eth_dev *dev);
+static int nfp_net_stats_reset(struct rte_eth_dev *dev);
 static void nfp_net_stop(struct rte_eth_dev *dev);
 static uint16_t nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				  uint16_t nb_pkts);
@@ -1149,7 +1149,7 @@ nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return -EINVAL;
 }
 
-static void
+static int
 nfp_net_stats_reset(struct rte_eth_dev *dev)
 {
 	int i;
@@ -1210,6 +1210,8 @@ nfp_net_stats_reset(struct rte_eth_dev *dev)
 
 	hw->eth_stats_base.imissed =
 		nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_DISCARDS);
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index aec0cab8f9..e2ff41a229 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -315,20 +315,22 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
 	return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
 	unsigned i;
 	struct pmd_internals *internal;
 
 	if (dev == NULL)
-		return;
+		return -EINVAL;
 
 	internal = dev->data->dev_private;
 	for (i = 0; i < RTE_DIM(internal->rx_null_queues); i++)
 		internal->rx_null_queues[i].rx_pkts.cnt = 0;
 	for (i = 0; i < RTE_DIM(internal->tx_null_queues); i++)
 		internal->tx_null_queues[i].tx_pkts.cnt = 0;
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 47cea4e9b2..00686ea26a 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -228,12 +228,12 @@ octeontx_port_stats(struct octeontx_nic *nic, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 octeontx_port_stats_clr(struct octeontx_nic *nic)
 {
 	PMD_INIT_FUNC_TRACE();
 
-	octeontx_bgx_port_stats_clr(nic->port_id);
+	return octeontx_bgx_port_stats_clr(nic->port_id);
 }
 
 static inline void
@@ -549,13 +549,13 @@ octeontx_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return octeontx_port_stats(nic, stats);
 }
 
-static void
+static int
 octeontx_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
 
 	PMD_INIT_FUNC_TRACE();
-	octeontx_port_stats_clr(nic);
+	return octeontx_port_stats_clr(nic);
 }
 
 static int
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 8814622e43..0a68f10f46 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -422,7 +422,7 @@ void otx2_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
 /* Stats */
 int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_stats *stats);
-void otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
+int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
 				 uint16_t queue_id, uint8_t stat_idx,
@@ -432,7 +432,7 @@ int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
 int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
 			      struct rte_eth_xstat_name *xstats_names,
 			      unsigned int limit);
-void otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
+int otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev,
 			      const uint64_t *ids,
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 5eca4184f4..8aaf270a7c 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -131,14 +131,16 @@ otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
-void
+int
 otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 	struct otx2_mbox *mbox = dev->mbox;
 
-	otx2_mbox_alloc_msg_nix_stats_rst(mbox);
-	otx2_mbox_process(mbox);
+	if (otx2_mbox_alloc_msg_nix_stats_rst(mbox) == NULL)
+		return -ENOMEM;
+
+	return otx2_mbox_process(mbox);
 }
 
 int
@@ -296,7 +298,7 @@ otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
 	return n;
 }
 
-static void
+static int
 nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
@@ -314,7 +316,7 @@ nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
 		rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
 		if (rc) {
 			otx2_err("Failed to read rq context");
-			return;
+			return rc;
 		}
 		aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
 		aq->qidx = i;
@@ -336,7 +338,7 @@ nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
 		rc = otx2_mbox_process(mbox);
 		if (rc) {
 			otx2_err("Failed to write rq context");
-			return;
+			return rc;
 		}
 	}
 
@@ -348,7 +350,7 @@ nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
 		rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
 		if (rc) {
 			otx2_err("Failed to read sq context");
-			return;
+			return rc;
 		}
 		aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
 		aq->qidx = i;
@@ -368,20 +370,27 @@ nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
 		rc = otx2_mbox_process(mbox);
 		if (rc) {
 			otx2_err("Failed to write sq context");
-			return;
+			return rc;
 		}
 	}
+
+	return 0;
 }
 
-void
+int
 otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 	struct otx2_mbox *mbox = dev->mbox;
+	int ret;
+
+	if (otx2_mbox_alloc_msg_nix_stats_rst(mbox) == NULL)
+		return -ENOMEM;
 
-	otx2_mbox_alloc_msg_nix_stats_rst(mbox);
-	otx2_mbox_process(mbox);
+	ret = otx2_mbox_process(mbox);
+	if (ret != 0)
+		return ret;
 
 	/* Reset queue stats */
-	nix_queue_stats_reset(eth_dev);
+	return nix_queue_stats_reset(eth_dev);
 }
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 50a0655a33..5801915a82 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -703,7 +703,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
 	unsigned int i;
@@ -719,6 +719,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
 		internal->tx_queue[i].tx_stat.bytes = 0;
 		internal->tx_queue[i].tx_stat.err_pkts = 0;
 	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index cfca6c4bc7..ac109209a8 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1698,7 +1698,7 @@ qede_get_xstats(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 	return stat_idx;
 }
 
-static void
+static int
 qede_reset_xstats(struct rte_eth_dev *dev)
 {
 	struct qede_dev *qdev = dev->data->dev_private;
@@ -1706,6 +1706,8 @@ qede_reset_xstats(struct rte_eth_dev *dev)
 
 	ecore_reset_vport_stats(edev);
 	qede_reset_queue_stats(qdev, true);
+
+	return 0;
 }
 
 int qede_dev_set_link_state(struct rte_eth_dev *eth_dev, bool link_up)
@@ -1735,13 +1737,15 @@ static int qede_dev_set_link_down(struct rte_eth_dev *eth_dev)
 	return qede_dev_set_link_state(eth_dev, false);
 }
 
-static void qede_reset_stats(struct rte_eth_dev *eth_dev)
+static int qede_reset_stats(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
 
 	ecore_reset_vport_stats(edev);
 	qede_reset_queue_stats(qdev, false);
+
+	return 0;
 }
 
 static void qede_allmulticast_enable(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 686246032e..c6733ee2b1 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -191,7 +191,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
 	unsigned int i;
@@ -201,6 +201,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
 		internal->rx_ring_queues[i].rx_pkts.cnt = 0;
 	for (i = 0; i < dev->data->nb_tx_queues; i++)
 		internal->tx_ring_queues[i].tx_pkts.cnt = 0;
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 5faf14b674..fc6a9800e6 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -637,7 +637,7 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return -ret;
 }
 
-static void
+static int
 sfc_stats_reset(struct rte_eth_dev *dev)
 {
 	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
@@ -650,12 +650,15 @@ sfc_stats_reset(struct rte_eth_dev *dev)
 		 * will be scheduled to be done during the next port start
 		 */
 		port->mac_stats_reset_pending = B_TRUE;
-		return;
+		return 0;
 	}
 
 	rc = sfc_port_reset_mac_stats(sa);
 	if (rc != 0)
 		sfc_err(sa, "failed to reset statistics (rc = %d)", rc);
+
+	SFC_ASSERT(rc >= 0);
+	return -rc;
 }
 
 static int
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 2f3811b67f..0f1ff04c9c 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1111,7 +1111,7 @@ eth_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
 	uint16_t i;
@@ -1130,6 +1130,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
 		txq->tx_bytes = 0;
 		txq->err_pkts = 0;
 	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 41612ce838..3572bbe6c4 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -986,7 +986,7 @@ tap_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *tap_stats)
 	return 0;
 }
 
-static void
+static int
 tap_stats_reset(struct rte_eth_dev *dev)
 {
 	int i;
@@ -1002,6 +1002,8 @@ tap_stats_reset(struct rte_eth_dev *dev)
 		pmd->txq[i].stats.errs = 0;
 		pmd->txq[i].stats.obytes = 0;
 	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index edc956bb3d..b93d45712e 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -362,7 +362,7 @@ nicvf_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	return ptypes;
 }
 
-static void
+static int
 nicvf_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	int i;
@@ -370,6 +370,7 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
 	struct nicvf *nic = nicvf_pmd_priv(dev);
 	uint16_t rx_start, rx_end;
 	uint16_t tx_start, tx_end;
+	int ret;
 
 	/* Reset all primary nic counters */
 	nicvf_rx_range(dev, nic, &rx_start, &rx_end);
@@ -380,7 +381,9 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
 	for (i = tx_start; i <= tx_end; i++)
 		txqs |= (0x3 << (i * 2));
 
-	nicvf_mbox_reset_stat_counters(nic, 0x3FFF, 0x1F, rxqs, txqs);
+	ret = nicvf_mbox_reset_stat_counters(nic, 0x3FFF, 0x1F, rxqs, txqs);
+	if (ret != 0)
+		return ret;
 
 	/* Reset secondary nic queue counters */
 	for (i = 0; i < nic->sqs_count; i++) {
@@ -396,8 +399,12 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
 		for (i = tx_start; i <= tx_end; i++)
 			txqs |= (0x3 << ((i % MAX_SND_QUEUES_PER_QS) * 2));
 
-		nicvf_mbox_reset_stat_counters(snic, 0, 0, rxqs, txqs);
+		ret = nicvf_mbox_reset_stat_counters(snic, 0, 0, rxqs, txqs);
+		if (ret != 0)
+			return ret;
 	}
+
+	return 0;
 }
 
 /* Promiscuous mode enabled by default in LMAC to VF 1:1 map configuration */
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 74cc7361b2..c3ba602767 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -216,7 +216,7 @@ static const struct vhost_xstats_name_off vhost_txport_stat_strings[] = {
 #define VHOST_NB_XSTATS_TXPORT (sizeof(vhost_txport_stat_strings) / \
 				sizeof(vhost_txport_stat_strings[0]))
 
-static void
+static int
 vhost_dev_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct vhost_queue *vq = NULL;
@@ -234,6 +234,8 @@ vhost_dev_xstats_reset(struct rte_eth_dev *dev)
 			continue;
 		memset(&vq->stats, 0, sizeof(vq->stats));
 	}
+
+	return 0;
 }
 
 static int
@@ -1119,7 +1121,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
 	struct vhost_queue *vq;
@@ -1140,6 +1142,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
 		vq->stats.bytes = 0;
 		vq->stats.missed_pkts = 0;
 	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 1ba4aa37e8..0b03b4f99a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -61,7 +61,7 @@ static int virtio_dev_xstats_get(struct rte_eth_dev *dev,
 static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
 				       struct rte_eth_xstat_name *xstats_names,
 				       unsigned limit);
-static void virtio_dev_stats_reset(struct rte_eth_dev *dev);
+static int virtio_dev_stats_reset(struct rte_eth_dev *dev);
 static void virtio_dev_free_mbufs(struct rte_eth_dev *dev);
 static int virtio_vlan_filter_set(struct rte_eth_dev *dev,
 				uint16_t vlan_id, int on);
@@ -1076,7 +1076,7 @@ virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 virtio_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	unsigned int i;
@@ -1107,6 +1107,8 @@ virtio_dev_stats_reset(struct rte_eth_dev *dev)
 		memset(rxvq->stats.size_bins, 0,
 		       sizeof(rxvq->stats.size_bins[0]) * 8);
 	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 8bfe16c482..bb173e980d 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -76,7 +76,7 @@ static int vmxnet3_dev_link_update(struct rte_eth_dev *dev,
 static void vmxnet3_hw_stats_save(struct vmxnet3_hw *hw);
 static int vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
 				  struct rte_eth_stats *stats);
-static void vmxnet3_dev_stats_reset(struct rte_eth_dev *dev);
+static int vmxnet3_dev_stats_reset(struct rte_eth_dev *dev);
 static int vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev,
 					struct rte_eth_xstat_name *xstats,
 					unsigned int n);
@@ -1125,7 +1125,7 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	return 0;
 }
 
-static void
+static int
 vmxnet3_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	unsigned int i;
@@ -1147,6 +1147,8 @@ vmxnet3_dev_stats_reset(struct rte_eth_dev *dev)
 		memcpy(&hw->snapshot_rx_stats[i], &rxStats,
 			sizeof(hw->snapshot_rx_stats[0]));
 	}
+
+	return 0;
 }
 
 static int
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index b843bbc208..16b1c1a4d9 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2037,12 +2037,16 @@ int
 rte_eth_stats_reset(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
+	int ret;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
-	(*dev->dev_ops->stats_reset)(dev);
+	ret = (*dev->dev_ops->stats_reset)(dev);
+	if (ret != 0)
+		return eth_err(port_id, ret);
+
 	dev->data->rx_mbuf_alloc_failed = 0;
 
 	return 0;
@@ -2527,10 +2531,8 @@ rte_eth_xstats_reset(uint16_t port_id)
 	dev = &rte_eth_devices[port_id];
 
 	/* implemented by the driver */
-	if (dev->dev_ops->xstats_reset != NULL) {
-		(*dev->dev_ops->xstats_reset)(dev);
-		return 0;
-	}
+	if (dev->dev_ops->xstats_reset != NULL)
+		return eth_err(port_id, (*dev->dev_ops->xstats_reset)(dev));
 
 	/* fallback to default */
 	return rte_eth_stats_reset(port_id);
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 328503d1be..4ea85795ff 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -2137,6 +2137,7 @@ int rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats);
  *   - (0) if device notified to reset stats.
  *   - (-ENOTSUP) if hardware doesn't support.
  *   - (-ENODEV) if *port_id* invalid.
+ *   - (<0): Error code of the driver stats reset function.
  */
 int rte_eth_stats_reset(uint16_t port_id);
 
@@ -2289,6 +2290,7 @@ int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name,
  *   - (-ENOTSUP) if pmd doesn't support both
  *     extended stats and basic stats reset.
  *   - (-ENODEV) if *port_id* invalid.
+ *   - (<0): Error code of the driver xstats reset function.
  */
 int rte_eth_xstats_reset(uint16_t port_id);
 
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 6322348d17..663d461eae 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -72,7 +72,7 @@ typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
 				struct rte_eth_stats *igb_stats);
 /**< @internal Get global I/O statistics of an Ethernet device. */
 
-typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
+typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
 /**< @internal Reset global I/O statistics of an Ethernet device to 0. */
 
 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
@@ -85,7 +85,7 @@ typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
 				      unsigned int n);
 /**< @internal Get extended stats of an Ethernet device. */
 
-typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
+typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
 /**< @internal Reset extended stats of an Ethernet device. */
 
 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] ethdev: make stats and xstats reset callbacks return int
  2019-09-06 14:34 ` [dpdk-dev] [PATCH 2/2] ethdev: make stats and xstats reset callbacks return int Andrew Rybchenko
@ 2019-09-24 11:56   ` Ferruh Yigit
  2019-09-24 13:03     ` Andrew Rybchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2019-09-24 11:56 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Shepard Siegel, Ed Czeck, John Miller, Igor Russkikh,
	Pavel Belous, Allain Legacy, Matt Peters, Ravi Kumar,
	Ajit Khaparde, Somnath Kotur, Chas Williams, Rahul Lakkireddy,
	Hemant Agrawal, Sachin Saxena, Wenzhuo Lu, Gagandeep Singh,
	John Daley, Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Jakub Grajciar, Matan Azrad,
	Shahaf Shuler, Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak,
	Liron Himi, Tomasz Duszynski, Stephen Hemminger,
	K. Y. Srinivasan, Haiyang Zhang, Alejandro Lucero,
	Tetsuya Mukawa, Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K,
	Rasesh Mody, Shahed Shaikh, Bruce Richardson, Jan Remes,
	Rastislav Cernay, Keith Wiles, Maciej Czekaj, Maxime Coquelin,
	Tiwei Bie, Zhihong Wang, Yong Wang, Thomas Monjalon
  Cc: dev, Igor Romanov

On 9/6/2019 3:34 PM, Andrew Rybchenko wrote:
> From: Igor Romanov <igor.romanov@oktetlabs.ru>
> 
> 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>
> ---
>  app/test/virtual_pmd.c                    |  4 ++-
>  drivers/net/af_packet/rte_eth_af_packet.c |  4 ++-
>  drivers/net/af_xdp/rte_eth_af_xdp.c       |  4 ++-
>  drivers/net/ark/ark_ethdev.c              |  6 ++--
>  drivers/net/atlantic/atl_ethdev.c         |  6 ++--
>  drivers/net/avp/avp_ethdev.c              |  6 ++--
>  drivers/net/axgbe/axgbe_ethdev.c          |  6 ++--
>  drivers/net/bnxt/bnxt_stats.c             | 38 +++++++++++++++++------
>  drivers/net/bnxt/bnxt_stats.h             |  4 +--
>  drivers/net/bonding/rte_eth_bond_pmd.c    | 13 ++++++--
>  drivers/net/cxgbe/cxgbe_ethdev.c          |  4 ++-
>  drivers/net/dpaa/dpaa_ethdev.c            |  4 ++-
>  drivers/net/dpaa2/dpaa2_ethdev.c          | 10 +++---
>  drivers/net/e1000/em_ethdev.c             |  6 ++--
>  drivers/net/e1000/igb_ethdev.c            | 18 +++++++----
>  drivers/net/enetc/enetc_ethdev.c          |  4 ++-
>  drivers/net/enic/enic.h                   |  2 +-
>  drivers/net/enic/enic_ethdev.c            |  4 +--
>  drivers/net/enic/enic_main.c              | 11 +++++--
>  drivers/net/failsafe/failsafe_ops.c       | 16 ++++++++--
>  drivers/net/fm10k/fm10k_ethdev.c          | 10 ++++--
>  drivers/net/hinic/base/hinic_pmd_niccfg.c | 14 ++++++---
>  drivers/net/hinic/base/hinic_pmd_niccfg.h |  4 +--
>  drivers/net/hinic/hinic_pmd_ethdev.c      | 25 +++++++++++----
>  drivers/net/i40e/i40e_ethdev.c            |  6 ++--
>  drivers/net/i40e/i40e_ethdev_vf.c         |  6 ++--
>  drivers/net/i40e/i40e_vf_representor.c    |  4 +--
>  drivers/net/iavf/iavf_ethdev.c            | 11 ++++---
>  drivers/net/ice/ice_ethdev.c              |  6 ++--
>  drivers/net/ipn3ke/ipn3ke_representor.c   | 14 +++++----
>  drivers/net/ixgbe/ixgbe_ethdev.c          | 18 +++++++----
>  drivers/net/kni/rte_eth_kni.c             |  4 ++-
>  drivers/net/liquidio/lio_ethdev.c         | 23 ++++++++------
>  drivers/net/memif/rte_eth_memif.c         |  4 ++-
>  drivers/net/mlx4/mlx4.h                   |  2 +-
>  drivers/net/mlx4/mlx4_ethdev.c            |  7 ++++-
>  drivers/net/mlx5/mlx5.h                   |  4 +--
>  drivers/net/mlx5/mlx5_stats.c             | 19 +++++++++---
>  drivers/net/mvneta/mvneta_ethdev.c        | 11 +++++--
>  drivers/net/mvpp2/mrvl_ethdev.c           | 16 +++++++---
>  drivers/net/netvsc/hn_ethdev.c            | 15 ++++++---
>  drivers/net/netvsc/hn_var.h               |  4 +--
>  drivers/net/netvsc/hn_vf.c                | 13 +++++---
>  drivers/net/nfp/nfp_net.c                 |  6 ++--
>  drivers/net/null/rte_eth_null.c           |  6 ++--
>  drivers/net/octeontx/octeontx_ethdev.c    |  8 ++---
>  drivers/net/octeontx2/otx2_ethdev.h       |  4 +--
>  drivers/net/octeontx2/otx2_stats.c        | 33 +++++++++++++-------
>  drivers/net/pcap/rte_eth_pcap.c           |  4 ++-
>  drivers/net/qede/qede_ethdev.c            |  8 +++--
>  drivers/net/ring/rte_eth_ring.c           |  4 ++-
>  drivers/net/sfc/sfc_ethdev.c              |  7 +++--
>  drivers/net/szedata2/rte_eth_szedata2.c   |  4 ++-
>  drivers/net/tap/rte_eth_tap.c             |  4 ++-
>  drivers/net/thunderx/nicvf_ethdev.c       | 13 ++++++--
>  drivers/net/vhost/rte_eth_vhost.c         |  8 +++--
>  drivers/net/virtio/virtio_ethdev.c        |  6 ++--
>  drivers/net/vmxnet3/vmxnet3_ethdev.c      |  6 ++--
>  lib/librte_ethdev/rte_ethdev.c            | 12 ++++---
>  lib/librte_ethdev/rte_ethdev.h            |  2 ++
>  lib/librte_ethdev/rte_ethdev_core.h       |  4 +--
>  61 files changed, 380 insertions(+), 169 deletions(-)

'nfb' driver was missing, updating it while merging.

<...>

> @@ -72,7 +72,7 @@ typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
>  				struct rte_eth_stats *igb_stats);
>  /**< @internal Get global I/O statistics of an Ethernet device. */
>  
> -typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
> +typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
>  /**< @internal Reset global I/O statistics of an Ethernet device to 0. */
>  
>  typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
> @@ -85,7 +85,7 @@ typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
>  				      unsigned int n);
>  /**< @internal Get extended stats of an Ethernet device. */
>  
> -typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
> +typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
>  /**< @internal Reset extended stats of an Ethernet device. */
>  
>  typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
> 

Adding following comments to the dev_ops while merging, please shout if needs
update:

-typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
-/**< @internal Reset global I/O statistics of an Ethernet device to 0. */
+/**
+ * @internal
+ * Reset global I/O statistics of an Ethernet device to 0.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, statistics has been reset.
+ * @retval -ENOTSUP
+ *   Resetting statistics is not supported.
+ * @retval -EINVAL
+ *   Resetting statistics is not valid.
+ * @retval -ENOMEM
+ *   Not enough memory to get the stats.
+ */
+typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);

 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
        struct rte_eth_xstat *stats, unsigned n);
@@ -129,8 +147,26 @@ typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
                                      unsigned int n);
 /**< @internal Get extended stats of an Ethernet device. */

-typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
-/**< @internal Reset extended stats of an Ethernet device. */
+/**
+ * @internal
+ * Reset extended stats of an Ethernet device.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, statistics has been reset.
+ * @retval -ENOTSUP
+ *   Resetting statistics is not supported.
+ * @retval -EINVAL
+ *   Resetting statistics is not valid.
+ * @retval -ENOMEM
+ *   Not enough memory to get the stats.
+ */
+typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int
  2019-09-06 14:34 [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int Andrew Rybchenko
  2019-09-06 14:34 ` [dpdk-dev] [PATCH 1/2] " Andrew Rybchenko
  2019-09-06 14:34 ` [dpdk-dev] [PATCH 2/2] ethdev: make stats and xstats reset callbacks return int Andrew Rybchenko
@ 2019-09-24 11:56 ` Ferruh Yigit
  2 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2019-09-24 11:56 UTC (permalink / raw)
  To: Andrew Rybchenko, Thomas Monjalon; +Cc: dev, Igor Romanov

On 9/6/2019 3:34 PM, Andrew Rybchenko wrote:
> It is the third patch series to get rid of void returning functions
> in ethdev in accordance with deprecation notice [1].
> 
> It should be applied on top of the first [2] and the second [3].
> It could be applied separately, but few simple conflicts should
> be resolved.
> 
> Functions which return void are bad since they do not provide explicit
> information to the caller if everything is OK or not.
> It is especially painful in the case of promiscuous mode since it is
> not always supported, there are real cases when it fails to apply and
> it affects traffic which is received by the port.
> 
> Driver maintainrs are encouraged to review the patch which changes
> driver callbacks prototype.
> 
> [1] https://patches.dpdk.org/patch/56969/
> [2] https://patches.dpdk.org/project/dpdk/list/?series=6222
> [3] https://patches.dpdk.org/project/dpdk/list/?series=6264
> 
> Igor Romanov (2):
>   ethdev: change xstats reset function return value to int
>   ethdev: make stats and xstats reset callbacks return int

For series,
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] ethdev: make stats and xstats reset callbacks return int
  2019-09-24 11:56   ` Ferruh Yigit
@ 2019-09-24 13:03     ` Andrew Rybchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2019-09-24 13:03 UTC (permalink / raw)
  To: Ferruh Yigit, John W. Linville, Xiaolong Ye, Qi Zhang,
	Shepard Siegel, Ed Czeck, John Miller, Igor Russkikh,
	Pavel Belous, Allain Legacy, Matt Peters, Ravi Kumar,
	Ajit Khaparde, Somnath Kotur, Chas Williams, Rahul Lakkireddy,
	Hemant Agrawal, Sachin Saxena, Wenzhuo Lu, Gagandeep Singh,
	John Daley, Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Jakub Grajciar, Matan Azrad,
	Shahaf Shuler, Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak,
	Liron Himi, Tomasz Duszynski, Stephen Hemminger,
	K. Y. Srinivasan, Haiyang Zhang, Alejandro Lucero,
	Tetsuya Mukawa, Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K,
	Rasesh Mody, Shahed Shaikh, Bruce Richardson, Jan Remes,
	Rastislav Cernay, Keith Wiles, Maciej Czekaj, Maxime Coquelin,
	Tiwei Bie, Zhihong Wang, Yong Wang, Thomas Monjalon
  Cc: dev, Igor Romanov

On 9/24/19 2:56 PM, Ferruh Yigit wrote:
> On 9/6/2019 3:34 PM, Andrew Rybchenko wrote:
>> From: Igor Romanov <igor.romanov@oktetlabs.ru>
>>
>> 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>
>> ---
>>   app/test/virtual_pmd.c                    |  4 ++-
>>   drivers/net/af_packet/rte_eth_af_packet.c |  4 ++-
>>   drivers/net/af_xdp/rte_eth_af_xdp.c       |  4 ++-
>>   drivers/net/ark/ark_ethdev.c              |  6 ++--
>>   drivers/net/atlantic/atl_ethdev.c         |  6 ++--
>>   drivers/net/avp/avp_ethdev.c              |  6 ++--
>>   drivers/net/axgbe/axgbe_ethdev.c          |  6 ++--
>>   drivers/net/bnxt/bnxt_stats.c             | 38 +++++++++++++++++------
>>   drivers/net/bnxt/bnxt_stats.h             |  4 +--
>>   drivers/net/bonding/rte_eth_bond_pmd.c    | 13 ++++++--
>>   drivers/net/cxgbe/cxgbe_ethdev.c          |  4 ++-
>>   drivers/net/dpaa/dpaa_ethdev.c            |  4 ++-
>>   drivers/net/dpaa2/dpaa2_ethdev.c          | 10 +++---
>>   drivers/net/e1000/em_ethdev.c             |  6 ++--
>>   drivers/net/e1000/igb_ethdev.c            | 18 +++++++----
>>   drivers/net/enetc/enetc_ethdev.c          |  4 ++-
>>   drivers/net/enic/enic.h                   |  2 +-
>>   drivers/net/enic/enic_ethdev.c            |  4 +--
>>   drivers/net/enic/enic_main.c              | 11 +++++--
>>   drivers/net/failsafe/failsafe_ops.c       | 16 ++++++++--
>>   drivers/net/fm10k/fm10k_ethdev.c          | 10 ++++--
>>   drivers/net/hinic/base/hinic_pmd_niccfg.c | 14 ++++++---
>>   drivers/net/hinic/base/hinic_pmd_niccfg.h |  4 +--
>>   drivers/net/hinic/hinic_pmd_ethdev.c      | 25 +++++++++++----
>>   drivers/net/i40e/i40e_ethdev.c            |  6 ++--
>>   drivers/net/i40e/i40e_ethdev_vf.c         |  6 ++--
>>   drivers/net/i40e/i40e_vf_representor.c    |  4 +--
>>   drivers/net/iavf/iavf_ethdev.c            | 11 ++++---
>>   drivers/net/ice/ice_ethdev.c              |  6 ++--
>>   drivers/net/ipn3ke/ipn3ke_representor.c   | 14 +++++----
>>   drivers/net/ixgbe/ixgbe_ethdev.c          | 18 +++++++----
>>   drivers/net/kni/rte_eth_kni.c             |  4 ++-
>>   drivers/net/liquidio/lio_ethdev.c         | 23 ++++++++------
>>   drivers/net/memif/rte_eth_memif.c         |  4 ++-
>>   drivers/net/mlx4/mlx4.h                   |  2 +-
>>   drivers/net/mlx4/mlx4_ethdev.c            |  7 ++++-
>>   drivers/net/mlx5/mlx5.h                   |  4 +--
>>   drivers/net/mlx5/mlx5_stats.c             | 19 +++++++++---
>>   drivers/net/mvneta/mvneta_ethdev.c        | 11 +++++--
>>   drivers/net/mvpp2/mrvl_ethdev.c           | 16 +++++++---
>>   drivers/net/netvsc/hn_ethdev.c            | 15 ++++++---
>>   drivers/net/netvsc/hn_var.h               |  4 +--
>>   drivers/net/netvsc/hn_vf.c                | 13 +++++---
>>   drivers/net/nfp/nfp_net.c                 |  6 ++--
>>   drivers/net/null/rte_eth_null.c           |  6 ++--
>>   drivers/net/octeontx/octeontx_ethdev.c    |  8 ++---
>>   drivers/net/octeontx2/otx2_ethdev.h       |  4 +--
>>   drivers/net/octeontx2/otx2_stats.c        | 33 +++++++++++++-------
>>   drivers/net/pcap/rte_eth_pcap.c           |  4 ++-
>>   drivers/net/qede/qede_ethdev.c            |  8 +++--
>>   drivers/net/ring/rte_eth_ring.c           |  4 ++-
>>   drivers/net/sfc/sfc_ethdev.c              |  7 +++--
>>   drivers/net/szedata2/rte_eth_szedata2.c   |  4 ++-
>>   drivers/net/tap/rte_eth_tap.c             |  4 ++-
>>   drivers/net/thunderx/nicvf_ethdev.c       | 13 ++++++--
>>   drivers/net/vhost/rte_eth_vhost.c         |  8 +++--
>>   drivers/net/virtio/virtio_ethdev.c        |  6 ++--
>>   drivers/net/vmxnet3/vmxnet3_ethdev.c      |  6 ++--
>>   lib/librte_ethdev/rte_ethdev.c            | 12 ++++---
>>   lib/librte_ethdev/rte_ethdev.h            |  2 ++
>>   lib/librte_ethdev/rte_ethdev_core.h       |  4 +--
>>   61 files changed, 380 insertions(+), 169 deletions(-)
> 'nfb' driver was missing, updating it while merging.

Ops, thanks.

> <...>
>
>> @@ -72,7 +72,7 @@ typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
>>   				struct rte_eth_stats *igb_stats);
>>   /**< @internal Get global I/O statistics of an Ethernet device. */
>>   
>> -typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
>> +typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
>>   /**< @internal Reset global I/O statistics of an Ethernet device to 0. */
>>   
>>   typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
>> @@ -85,7 +85,7 @@ typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
>>   				      unsigned int n);
>>   /**< @internal Get extended stats of an Ethernet device. */
>>   
>> -typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
>> +typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
>>   /**< @internal Reset extended stats of an Ethernet device. */
>>   
>>   typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
>>
> Adding following comments to the dev_ops while merging, please shout if needs
> update:
>
> -typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
> -/**< @internal Reset global I/O statistics of an Ethernet device to 0. */
> +/**
> + * @internal
> + * Reset global I/O statistics of an Ethernet device to 0.
> + *
> + * @param dev
> + *   ethdev handle of port.
> + *
> + * @return
> + *   Negative errno value on error, 0 on success.
> + *
> + * @retval 0
> + *   Success, statistics has been reset.
> + * @retval -ENOTSUP
> + *   Resetting statistics is not supported.
> + * @retval -EINVAL
> + *   Resetting statistics is not valid.
> + * @retval -ENOMEM
> + *   Not enough memory to get the stats.
> + */
> +typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
>
>   typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
>          struct rte_eth_xstat *stats, unsigned n);
> @@ -129,8 +147,26 @@ typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
>                                        unsigned int n);
>   /**< @internal Get extended stats of an Ethernet device. */
>
> -typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
> -/**< @internal Reset extended stats of an Ethernet device. */
> +/**
> + * @internal
> + * Reset extended stats of an Ethernet device.
> + *
> + * @param dev
> + *   ethdev handle of port.
> + *
> + * @return
> + *   Negative errno value on error, 0 on success.
> + *
> + * @retval 0
> + *   Success, statistics has been reset.
> + * @retval -ENOTSUP
> + *   Resetting statistics is not supported.
> + * @retval -EINVAL
> + *   Resetting statistics is not valid.
> + * @retval -ENOMEM
> + *   Not enough memory to get the stats.
> + */
> +typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);

Thanks, LGTM


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-24 13:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 14:34 [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int Andrew Rybchenko
2019-09-06 14:34 ` [dpdk-dev] [PATCH 1/2] " Andrew Rybchenko
2019-09-06 14:34 ` [dpdk-dev] [PATCH 2/2] ethdev: make stats and xstats reset callbacks return int Andrew Rybchenko
2019-09-24 11:56   ` Ferruh Yigit
2019-09-24 13:03     ` Andrew Rybchenko
2019-09-24 11:56 ` [dpdk-dev] [PATCH 0/2] ethdev: change xstats reset function return value to int Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).