From: David Harton <dharton@cisco.com>
To: thomas@monjalon.net
Cc: dev@dpdk.org, harry.van.haaren@intel.com,
christian.ehrhardt@canonical.com,
David Harton <dharton@cisco.com>
Subject: [dpdk-dev] [PATCH v4 1/2] ethdev: add return code to rte_eth_stats_reset()
Date: Thu, 10 Aug 2017 09:29:51 -0400 [thread overview]
Message-ID: <20170810132952.26974-1-dharton@cisco.com> (raw)
In-Reply-To: <20170807173914.36750-1-dharton@cisco.com>
Some devices do not support reset of eth stats. An application may
need to know not to clear shadow stats if the device cannot.
rte_eth_stats_reset is updated to provide a return code to share
whether the device supports reset or not.
Signed-off-by: David Harton <dharton@cisco.com>
---
v4:
* commented return values
v3:
* overcame noob errors and figured out patch challenged
v2:
* fixed soft tab issue inserted while moving changes
lib/librte_ether/rte_ethdev.c | 8 +++++---
lib/librte_ether/rte_ethdev.h | 6 +++++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0597641..b420391 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1341,17 +1341,19 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
return 0;
}
-void
+int
rte_eth_stats_reset(uint8_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];
- RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
(*dev->dev_ops->stats_reset)(dev);
dev->data->rx_mbuf_alloc_failed = 0;
+
+ return 0;
}
static int
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 0adf327..b14a2b5 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -2246,8 +2246,12 @@ int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);
*
* @param port_id
* The port identifier of the Ethernet device.
+ * @return
+ * - (0) if device notified to reset stats.
+ * - (-ENOTSUP) if hardware doesn't support.
+ * - (-ENODEV) if *port_id* invalid.
*/
-void rte_eth_stats_reset(uint8_t port_id);
+int rte_eth_stats_reset(uint8_t port_id);
/**
* Retrieve names of extended statistics of an Ethernet device.
--
2.10.3.dirty
next prev parent reply other threads:[~2017-08-10 13:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 17:39 [dpdk-dev] [PATCH v3] " David Harton
2017-08-08 9:02 ` Van Haaren, Harry
2017-08-08 11:01 ` David Harton (dharton)
2017-08-08 11:03 ` Christian Ehrhardt
2017-08-08 13:13 ` Thomas Monjalon
2017-08-10 13:29 ` David Harton [this message]
2017-08-10 13:29 ` [dpdk-dev] [PATCH v4 2/2] doc: Update ABI Change for rte_eth_stats_reset David Harton
2017-08-31 22:10 ` Thomas Monjalon
2017-08-31 22:10 ` Thomas Monjalon
2017-08-31 22:16 ` [dpdk-dev] [PATCH v4 1/2] ethdev: add return code to rte_eth_stats_reset() Thomas Monjalon
2017-09-01 2:26 ` [dpdk-dev] [PATCH v5] " David Harton
2017-09-01 7:47 ` Hemant Agrawal
2017-09-19 17:14 ` Ferruh Yigit
2017-09-20 14:01 ` David Harton (dharton)
2017-09-20 16:55 ` Ferruh Yigit
2017-09-20 14:11 ` [dpdk-dev] [PATCH v6] " David C Harton
2017-09-20 16:56 ` Ferruh Yigit
2017-10-09 23:02 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170810132952.26974-1-dharton@cisco.com \
--to=dharton@cisco.com \
--cc=christian.ehrhardt@canonical.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).