From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20062.outbound.protection.outlook.com [40.107.2.62]) by dpdk.org (Postfix) with ESMTP id E9582223 for ; Mon, 16 Oct 2017 10:51:50 +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=LM4UOBbhnB8VTZXXEm7hkL+z1wPleZsAT9Q0/rxkcYA=; b=ip7PvbdpxZBkHt9BLcuAdfLqVoZ0ZpWaVtmpbYDPMMDadrEk1d6As3cCM3WdlX3tmF94upK/+HBV7yF88Qh+DMh3VWDBaCG6PKJFnVD0sD+pZLYa1xGyPw+cfrUeVEsLg38Yr2LbO/kzxi0/yl7rd28izB34ULiBlqjvm3xWEzU= Received: from DB6PR0502MB3048.eurprd05.prod.outlook.com (10.172.250.136) by DB6PR0502MB3046.eurprd05.prod.outlook.com (10.172.247.145) 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 08:51:49 +0000 Received: from DB6PR0502MB3048.eurprd05.prod.outlook.com ([fe80::119e:aa7d:96e5:33a3]) by DB6PR0502MB3048.eurprd05.prod.outlook.com ([fe80::119e:aa7d:96e5:33a3%18]) with mapi id 15.20.0077.022; Mon, 16 Oct 2017 08:51:49 +0000 From: Matan Azrad To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: "dev@dpdk.org" Thread-Topic: [PATCH] net/failsafe: improve stats accuracy Thread-Index: AQHTRlixfFsH1LaaR0uUdbNlNLZ/e6LmKSjw Date: Mon, 16 Oct 2017 08:51:49 +0000 Message-ID: References: <1508139710-12798-1-git-send-email-matan@mellanox.com> <20171016082750.GC3408@bidouze.vm.6wind.com> In-Reply-To: <20171016082750.GC3408@bidouze.vm.6wind.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0502MB3046; 6:O5vo8Fj9CwHqBb0Gp0/34wmvtqC8yREhoZyX9PIiDS2OV1p2KbwaSwSJ9RE+5IV+Y5fKRrdcuBHL+awmAXDR1p4X6AMIAayUOlFspZb9SnPMcCfR7coMKKogRrdW1BPn2KicAHaHzN48+U2QkXuWDrWCT1ELHcNV8a66VaOSeY2voIbVg1yx2s7FZWynLgb/EUx+L/0E9AibwrM5qEmqOCzwxAGp50zcm6XPuuexP+NdBT89tT9gZ/KegyurE12PUzrjODEKZczJLGtSbyW2fwTUIYit/qEb05HjlvCEjk0n2/5jwWqElAsCyd2qMkx9eJz9wZgopojSEJHAr2Spgg==; 5:AZjIuzVTY5HDMdPrWpKNJTRC26jXLqzcyDo3/UC645nWny4zxkpI7d8Yc/0Azti6tyT7rSlg7jGL3VqOhFqWEfR9hXbRBK45ehfa4nmmcbF+WXVVwqcpLsyphXyoExC4NncWSJdAYXXzlCBHQ+Ovkg==; 24:XhehpfvWoC9yhsez9OXjEl+g9PmKlZkbm/rNKzCkMMmaFK4MIiEjk++Bj2VjL0SlFJqo5z4G2fEBG86Ct63KKzZopCCP/lltUtXQWzUtmk0=; 7:j+oi9l2lZWuofYM0euH/0t96SzVGsHZTx+zzZ1i7BsPmw2yDeJFV+cZxneR1YS1Qqav9uj9IXlGP4nJyfUDPd+fdM0hvVnLSFvOgM8VNWVt7pUWt5sFbUJasZmbEkdt26WeI/D/MK0J7HmnDHthjmEZREjcP352z411n/f8LNeyRO3uqIYUblbRYkp1KJ0MQd912WuLm7qduJE1cf9RyjmNzfTFV80J4hX8C20zixds= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: a753674f-c7d0-425f-2b11-08d5147323e5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DB6PR0502MB3046; x-ms-traffictypediagnostic: DB6PR0502MB3046: x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0502MB3046; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0502MB3046; x-forefront-prvs: 0462918D61 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(24454002)(51914003)(189002)(377454003)(13464003)(199003)(53546010)(105586002)(2900100001)(81156014)(81166006)(478600001)(5660300001)(25786009)(86362001)(7696004)(8936002)(97736004)(50986999)(76176999)(54356999)(66066001)(316002)(3846002)(101416001)(102836003)(14454004)(6116002)(4326008)(53936002)(99286003)(8676002)(2906002)(9686003)(189998001)(6246003)(2950100002)(33656002)(6436002)(305945005)(6506006)(74316002)(3660700001)(3280700002)(6916009)(229853002)(7736002)(106356001)(5250100002)(68736007)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0502MB3046; H:DB6PR0502MB3048.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2017 08:51:49.7559 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0502MB3046 Subject: Re: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Oct 2017 08:51:51 -0000 Hi Geatan > -----Original Message----- > From: Ga=EBtan Rivet [mailto:gaetan.rivet@6wind.com] > Sent: Monday, October 16, 2017 11:28 AM > To: Matan Azrad > Cc: dev@dpdk.org > Subject: Re: [PATCH] net/failsafe: improve stats accuracy >=20 > Hey Matan, >=20 > Thanks for the patch. Here are some remarks: >=20 > 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. > > >=20 > I would reformulate the commit log as such: >=20 > 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 remova= l > event occured. >=20 > Considering this, the fail-safe can try to access the latest statistics o= f a PMD to > improve statistics readings. >=20 > Attempt an ultimate statistics read on removal time; if that fails, use t= he > latest recorded snapshot. >=20 Looks ok for me, thanks. > > Signed-off-by: Matan Azrad > > --- > > 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); >=20 > The conditional is awkward within the parameter list here. > Something like: >=20 > struct rte_eth_stats stats; > int err; >=20 > /* Attempt to read current stats. */ > err =3D rte_eth_stats_get(PORT_ID(sdev), &stats); > if (err) > WARN("Could not access latest statistics from sub-device %d, usin= g 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); >=20 > Seems easier to read and allows warning the user of potential inaccuracie= s. > 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. =20 > > memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats)); } > > > > -- > > 1.8.3.1 > > >=20 > -- > Ga=EBtan Rivet > 6WIND