Message ID | 1508139710-12798-1-git-send-email-matan@mellanox.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Ferruh Yigit |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E76D71B3BB; Mon, 16 Oct 2017 09:42:06 +0200 (CEST) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30086.outbound.protection.outlook.com [40.107.3.86]) by dpdk.org (Postfix) with ESMTP id 9A4FF1B3AB for <dev@dpdk.org>; Mon, 16 Oct 2017 09:42:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=futdwW65OZ/uMOcHkNwgM+0QcClH8e3wWfn5myYF/Nw=; b=U68YKApUXAa/2penbN6UXhQsxzxMqRtVZlGkSdfZQoe1OP4uLKQ7Kk/5WV80wXhF7DZ/vYfl6ChqKMujw4dUUVqOieLf1aFMXc4e5htiuPyOvSrVaaW1/mSVE02VGByAwVCSSVQBlbboP+adVKd34r8ToP+c4Qw/GCm2KWoSY9A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR0502MB3048.eurprd05.prod.outlook.com (2603:10a6:4:9f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 16 Oct 2017 07:42:04 +0000 From: Matan Azrad <matan@mellanox.com> To: Gaetan Rivet <gaetan.rivet@6wind.com> Cc: dev@dpdk.org Date: Mon, 16 Oct 2017 07:41:50 +0000 Message-Id: <1508139710-12798-1-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: DB6PR07CA0181.eurprd07.prod.outlook.com (2603:10a6:6:42::11) To DB6PR0502MB3048.eurprd05.prod.outlook.com (2603:10a6:4:9f::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54b863bd-8bb4-469d-7bc3-08d51469654b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DB6PR0502MB3048; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0502MB3048; 3:CRPLxpMI0aTzRY1eDMJfzI5/qsiZ8nKFwN20V+wqhi84vdXobYOTHXsT0u1N4gEOLx2SjiVX2gJwEpDk5VRm0ispU/WWTaHWl3FeNhS4B78FzBremN8wgPvXxshYxKNQNfJbFZshbptAcjDyz24/5mPVpvEqF8+KX1RnZED01BWLBw9W7OkgJhu6chmpGcdGUiquei8dZvmaFEYYCUaUGmkt2fV8KW1xl9Y9gmZ/KiNBIYx0tY2l4fBtrXjMEaE/; 25:9gIiJDbdnvVanlryiMufDeHICvUrEY5DQ8HKNAODfZ0+LgZ8spuJBDWpemSd8tEqtvxLECB+F38tE74owSX54AjWzEiwRwIvaZYvvXjmLNrXg2Xtg8tgyaMNe9XKgG1z0wKhYncLF+Opcwz5UcPTuqLmhjGYa9GRVBm7g0HfWVaT2Oc9lIUQK8md5ZIcKrwFMv8aNvLmMyh10tU0emIfBgV5emlgfnq5bFRWVqzmx1zX18Omc+F/27GJBxWPfpAPUNp45w+Dvwt74mQMHsR9ydcArQZkBvHcu0G44FIhA30nsjfIBUdwFkaaFjY4YbV8SUBLZKf2mlAHxwCBW/l9qA==; 31:6pVW/xHGSSI7H/WO9Khdaa9VjokpqtoIWaDIpQ7QECpoLivUkD8bx36et3uvlFh3lyfkHk2BhxVrTvf/+h/7CUXF05CxXn2+lLCXkxlkztAzLU5TEBRj8GASeusK/Mzu5lGrYQVftNCsjlqzjYtvFxvcfb6g3D5GFXhjTHY4nhq3PYqMBNeWtHhmQ3T4kPeCH0sJFADvdIkO5GDjVnEH90mWDNssxCHiVkvIjo2ODBw= X-MS-TrafficTypeDiagnostic: DB6PR0502MB3048: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0502MB3048; 20:5alyZHcOf3Sgx9h4E/3wB1gR5+u7owT20Qr4wNIUYY/mG1RQFABqAYrrvYl0xNJbLvhd/hDQmadMAjwi3P3jcaXl46+iYR8DWFXnwWCCLpJgCtNnXgI7uPl88MUBPUbyShH7cMkTaEYr+GaaPNZtR2YTxaM3yUrYeTglGA0G3X3MWovanrHpIWggB5hbA40ZpVbxhiRdemP814D+q5ldW/Qi06O2n4UIdNUwadbCpbE9hoSR+DxazjyGuEwmVvvszxlINfJAdENwDV1K2TSw+Aqe4JgW/Yi15mtOLP71wQ0zJrqTHW90mDQNa/AZ4MXSyEcQkW4qxBqYgZcYdaH9/ejHtw/OADDYRAXAmg7ZsuVURiSm3VmbJccDYwrZwnx8E522JYpvHXxQhiQkPaB48QhtxVedv1Au8LunTZfhMXe0Z4FKVQm2cOkgB7KyihtDTxpEwSkX/fYRHEt3Ay9b9U+q5CCwiWgH/GKC5XCk31Nx8z3WwodYaUOr9FKTDlIo; 4:vY8X8J07ebD7DkWnyNJmLk+01zRpdGytt204sl7KUk2+8dnlm2edHoq0iNb1huL36RsU0nybKrU3tmv8lFimDo/zLz+z3G75s4qRHozrSsTeBblyyM55P44qtMj1n5HTxhCB4NkQCQ73GrU2iI8c9v6EWukNxovyHIOFM286uU4zEKB9vHltIRFnvI4huYyFU0zkAFEd+scMpfQCZWkWD72VZOK370da1ShyBOuTubyZZL1QNcK3bTP4GKYXSR84 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: <DB6PR0502MB3048DD27F83A50C520E0BC45D24F0@DB6PR0502MB3048.eurprd05.prod.outlook.com> X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123560025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0502MB3048; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0502MB3048; X-Forefront-PRVS: 0462918D61 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(39860400002)(376002)(199003)(189002)(16526018)(478600001)(6666003)(25786009)(8676002)(68736007)(305945005)(5660300001)(50466002)(6916009)(48376002)(4720700003)(105586002)(16586007)(97736004)(36756003)(50226002)(316002)(8936002)(106356001)(53936002)(21086003)(69596002)(189998001)(101416001)(5003940100001)(50986999)(55016002)(66066001)(33646002)(2906002)(33026002)(3846002)(6116002)(81166006)(81156014)(4326008)(47776003)(7736002)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0502MB3048; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0502MB3048; 23:t1rObGNOkLuspuosj02L10ce+ds23XZhpml1lD7?= N5Xh0ONXzDGuYUfxGowRIqqcjEyBahg53i4oi+XlQp/Vec90DJHg1/6qF3A/TgFzxVsOYaWnk0BupLFfXLx4P3rnEUqWTPDVR0Q0hw+2XWuFiwdReAE4WPpS+2JXoNptBGuvO7gRYgG2wLOD8N7Zh1Ye8+qpo6WHpM/1vFJtpvnvhWpnYwuKd+2mopZJCby0Lm/o6n/KIq1ha/EZ/NnxTSP7iw9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6uc8u50fbJ78jGIypZ5w2gvAmySp5L26a+T/mOpUhElFkouRwLMy8jlDctNXs3fb6r7Lxab4O5gorXvtK4UnwA3+jQpQkKzZhKsO02b0Jt2MK778DyrS8jvNJDijPwsz2qWVuXFwxeeOzmB2ojd/0swOmliZ1ag==; 5:9RjfnqdEDDRIHlc+2ZE1KZjaZ0f5Wa2ofoSmZB3tRGQomKwfyDCN9c8HPf5SvKA/FFWUprLT4DxDKUhjF+ZCcaKcSONIyLX17yiYVA/locQmh0oJW+v/6Oxbe3pHCK23rtIqWcFaJetmQOR+ekZnqHGLGH2k/k5cEvdgRvQ5jiE=; 24:cg3QOO28hPZBv3F3x3UDCxNsL5mxcBUN55duyA1CYhaPOIKjjNWv3R9BOyfIQOL7WleMpEmgdMB9l+dm7LrDlZjKwMqDicjBiBFfQrnPdss=; 7:bxo5fucZxx1UDdilnSRinNzbLUQf6O4rq358sYuaZGLekjFpQkB6TNAek4sIHK70dDIdmH0YVr0Z0PT54TB2Q5CA+hDB+RtBfHpgDazsMu1tKwz5fKgebK0dJlD65Zs5TvdRsk4jOKEWnZzxObzSsuCg9GjiQMFGR/QfZR7O+ISTfznDp3zVnxv8+0nYI2sU2IE+ioVuEskb8WD+vajKeFvqlSmfIdiz2UoUXHb9Wvg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2017 07:42:04.1829 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0502MB3048 Subject: [dpdk-dev] [PATCH] net/failsafe: improve stats accuracy X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
ci/Intel-compilation | success | Compilation OK |
Commit Message
Matan Azrad
Oct. 16, 2017, 7:41 a.m. UTC
The stats_get API was changed to return error in case of failure at
stats getting process time.
By this way, failsafe can get stats snapshot in removal process for
each PMD which can give stats after removal event.
This patch implements ultimate stats snapshot on removal time by
trying to get the removed device stats before calling to dev_close.
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
drivers/net/failsafe/failsafe_ether.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
Hey Matan, Thanks for the patch. Here are some remarks: On Mon, Oct 16, 2017 at 07:41:50AM +0000, Matan Azrad wrote: > The stats_get API was changed to return error in case of failure at > stats getting process time. > By this way, failsafe can get stats snapshot in removal process for > each PMD which can give stats after removal event. > > This patch implements ultimate stats snapshot on removal time by > trying to get the removed device stats before calling to dev_close. > I would reformulate the commit log as such: The stats_get API has changed to signal a potential failure to read stats. Furthermore, some PMDs are able to provide statistics even after a removal event occured. Considering this, the fail-safe can try to access the latest statistics of a PMD to improve statistics readings. 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 | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c > index f4db423..2758d4c 100644 > --- a/drivers/net/failsafe/failsafe_ether.c > +++ b/drivers/net/failsafe/failsafe_ether.c > @@ -312,8 +312,12 @@ > static void > fs_dev_stats_save(struct sub_device *sdev) > { > + struct rte_eth_stats stats; > + > + /* Get stats now or take it from last snapshot. */ > failsafe_stats_increment(&PRIV(sdev->fs_dev)->stats_accumulator, > - &sdev->stats_snapshot); > + rte_eth_stats_get(PORT_ID(sdev), &stats) ? > + &sdev->stats_snapshot : &stats); The conditional is awkward within the parameter list here. Something like: 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", SUB_ID(sdev)); /* Use either current stats or latest snapshot. */ failsafe_stats_increment(&PRIV(sdev->fs_dev)->stats_accumulator, err ? &sdev->stats_snapshot : &stats); Seems easier to read and allows warning the user of potential inaccuracies. On that matter, it may be interesting to measure the time since the last snapshot and display it as well. > memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats)); > } > > -- > 1.8.3.1 >
Hi Geatan > -----Original Message----- > From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com] > Sent: Monday, October 16, 2017 11:28 AM > To: Matan Azrad <matan@mellanox.com> > Cc: dev@dpdk.org > Subject: Re: [PATCH] net/failsafe: improve stats accuracy > > Hey Matan, > > Thanks for the patch. Here are some remarks: > > On Mon, Oct 16, 2017 at 07:41:50AM +0000, Matan Azrad wrote: > > The stats_get API was changed to return error in case of failure at > > stats getting process time. > > By this way, failsafe can get stats snapshot in removal process for > > each PMD which can give stats after removal event. > > > > This patch implements ultimate stats snapshot on removal time by > > trying to get the removed device stats before calling to dev_close. > > > > I would reformulate the commit log as such: > > The stats_get API has changed to signal a potential failure to read stats. > Furthermore, some PMDs are able to provide statistics even after a removal > event occured. > > Considering this, the fail-safe can try to access the latest statistics of a PMD to > improve statistics readings. > > Attempt an ultimate statistics read on removal time; if that fails, use the > latest recorded snapshot. > Looks ok for me, thanks. > > Signed-off-by: Matan Azrad <matan@mellanox.com> > > --- > > drivers/net/failsafe/failsafe_ether.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/failsafe/failsafe_ether.c > > b/drivers/net/failsafe/failsafe_ether.c > > index f4db423..2758d4c 100644 > > --- a/drivers/net/failsafe/failsafe_ether.c > > +++ b/drivers/net/failsafe/failsafe_ether.c > > @@ -312,8 +312,12 @@ > > static void > > fs_dev_stats_save(struct sub_device *sdev) { > > + struct rte_eth_stats stats; > > + > > + /* Get stats now or take it from last snapshot. */ > > failsafe_stats_increment(&PRIV(sdev->fs_dev)->stats_accumulator, > > - &sdev->stats_snapshot); > > + rte_eth_stats_get(PORT_ID(sdev), &stats) ? > > + &sdev->stats_snapshot : &stats); > > The conditional is awkward within the parameter list here. > Something like: > > 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", > SUB_ID(sdev)); > /* Use either current stats or latest snapshot. */ > failsafe_stats_increment(&PRIV(sdev->fs_dev)->stats_accumulator, > err ? &sdev->stats_snapshot : &stats); > > Seems easier to read and allows warning the user of potential inaccuracies. > On that matter, it may be interesting to measure the time since the last > snapshot and display it as well. > OK, I think it is good idea, I will try to add this here. > > memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats)); } > > > > -- > > 1.8.3.1 > > > > -- > Gaëtan Rivet > 6WIND
diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index f4db423..2758d4c 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -312,8 +312,12 @@ static void fs_dev_stats_save(struct sub_device *sdev) { + struct rte_eth_stats stats; + + /* Get stats now or take it from last snapshot. */ failsafe_stats_increment(&PRIV(sdev->fs_dev)->stats_accumulator, - &sdev->stats_snapshot); + rte_eth_stats_get(PORT_ID(sdev), &stats) ? + &sdev->stats_snapshot : &stats); memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats)); }