From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH v3 1/2] net/failsafe: improve stats accuracy Date: Mon, 23 Oct 2017 10:46:13 +0200 Message-ID: <20171023084613.GL3596@bidouze.vm.6wind.com> References: <1508423514-28557-1-git-send-email-matan@mellanox.com> <1508619286-7096-1-git-send-email-matan@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: Matan Azrad Return-path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id A715C236 for ; Mon, 23 Oct 2017 10:46:25 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id q132so8230770wmd.2 for ; Mon, 23 Oct 2017 01:46:25 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1508619286-7096-1-git-send-email-matan@mellanox.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Thanks Matan, On Sat, Oct 21, 2017 at 08:54:45PM +0000, Matan Azrad wrote: > 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 Acked-by: Gaetan Rivet > --- > 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 > -- Gaëtan Rivet 6WIND