DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matan Azrad <matan@mellanox.com>
To: Gaetan Rivet <gaetan.rivet@6wind.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 1/2] net/failsafe: improve stats accuracy
Date: Sat, 21 Oct 2017 20:54:45 +0000	[thread overview]
Message-ID: <1508619286-7096-1-git-send-email-matan@mellanox.com> (raw)
In-Reply-To: <1508423514-28557-1-git-send-email-matan@mellanox.com>

The stats_get API was changed to signal a potential failure to read
stats. Furthermore, some PMDs are able to provide statistics even
after a removal event occurred.

Considering this, the fail-safe can try to access the latest
statistics of a PMD to improve statistics accuracy.

Attempt an ultimate statistics read on removal time; if that
fails, use the latest recorded snapshot.

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/failsafe/failsafe_ether.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

V2:
Improve commit message.
Add warning massage when using stats snapshot.
Add time report from last snapshot.

V3:
Separate patch.
Replace "cycles" by "timestamp".

diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index f4db423..0282891 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -312,8 +312,16 @@
 static void
 fs_dev_stats_save(struct sub_device *sdev)
 {
+	struct rte_eth_stats stats;
+	int err;
+
+	/* Attempt to read current stats. */
+	err = rte_eth_stats_get(PORT_ID(sdev), &stats);
+	if (err)
+		WARN("Could not access latest statistics from sub-device %d,"
+			 " using latest snapshot.\n", SUB_ID(sdev));
 	failsafe_stats_increment(&PRIV(sdev->fs_dev)->stats_accumulator,
-			&sdev->stats_snapshot);
+			err ? &sdev->stats_snapshot : &stats);
 	memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats));
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2017-10-21 20:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16  7:41 [dpdk-dev] [PATCH] " Matan Azrad
2017-10-16  8:27 ` Gaëtan Rivet
2017-10-16  8:51   ` Matan Azrad
2017-10-19 14:31 ` [dpdk-dev] [PATCH v2] " Matan Azrad
2017-10-19 15:08   ` Gaëtan Rivet
2017-10-21 20:54   ` Matan Azrad [this message]
2017-10-21 20:54     ` [dpdk-dev] [PATCH v3 2/2] net/failsafe: add timestamp to stats snapshot Matan Azrad
2017-10-23  8:46       ` Gaëtan Rivet
2017-10-23  8:46     ` [dpdk-dev] [PATCH v3 1/2] net/failsafe: improve stats accuracy Gaëtan Rivet
2017-10-23 21:01       ` 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=1508619286-7096-1-git-send-email-matan@mellanox.com \
    --to=matan@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=gaetan.rivet@6wind.com \
    /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).