From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE06BA0588; Thu, 16 Apr 2020 11:06:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 15BC91DB5B; Thu, 16 Apr 2020 11:06:37 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2040.outbound.protection.outlook.com [40.107.22.40]) by dpdk.org (Postfix) with ESMTP id DBD101DB10 for ; Thu, 16 Apr 2020 11:06:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VlCNsR6S0fSAErsm0ktPUhynCl89pgEEjHh40u+c4LRv3iAYy/NNQ1v4kSjTD6iirmnAcACO/qsHB5YG3Z+V72VdhVc1pugqneh20CxCkMlBphyXJf4kjIa3sqc5V9u5WG3MQt68FqKRSnekIcmjCgi1bvkTScW/VIVxIjPpDJnKqwdID9b/6c2q38HEth8/aw3YnX4IoWM3CChi8ADywHepwx5dYzQ5GQAl21SS1P5W/kbloCAn7ru8xtLKTw3kLPqY7DYhQQ7/ysoJ1eO8Wh+a5hhARhgp53K6LIMroEP9S2fv9wWulml0kfM4E9ov/T1unytKwuZiLDLOH8Q1Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1HebE8pxQiVi2e0y9Utn5oB3nxhrns7ACV5BwsuYvtM=; b=I7cuBEqpCS1UgYlWnjX1nvZcE0c167eEiB7Z2YngiCrh/7hbLBn7L5vyA4/KrpWtnHlLheDc1W49IZRKbL//S70JBsIDwyF0rhni8hVdS0BuPmsg7xkfLRCZgtP6OgiOkgkFrB5XLD9yCJNI5Org2LjoK07tEJWbjj/DQ98O32Sfcz3NsbA5/up4I9WpeW7Q9epE+NzNWsJ6nxh4uqH/B69QRufL+C3PeF1fLfFl/jo2w1cg1XRLhgLGq4xahyKQscM6g2Uki3pmlrK90XXP6eFRd5GhIDEABfgRSaMKXHg+mcFYpDkThzF2dTOBpMgnHHH74dm3Ermg5q2/mnDBQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=1HebE8pxQiVi2e0y9Utn5oB3nxhrns7ACV5BwsuYvtM=; b=r7kh3SQ0Qa6p6htyyozCjhaxjrBddm+QLdb3laVvY+UDj6vTS9GeCE4ASKw7zOqp7SYpa1P9YTnlelL4xSif4fklwMzTAFxPXyKcrGPun2OaJiRew5RwBdTAdUUxNXPEtDvhtyJ1s/XscvYmjdHslY6wkYH+VOJlwtLeenEyNoM= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (2603:10a6:208:f::11) by AM0PR0502MB3811.eurprd05.prod.outlook.com (2603:10a6:208:24::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.26; Thu, 16 Apr 2020 09:06:32 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::a564:a117:9022:1fee]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::a564:a117:9022:1fee%7]) with mapi id 15.20.2900.028; Thu, 16 Apr 2020 09:06:32 +0000 From: Matan Azrad To: Maxime Coquelin , "dev@dpdk.org" CC: Slava Ovsiienko , Shahaf Shuler Thread-Topic: [PATCH 1/4] vhost: inroduce operation to get vDPA queue stats Thread-Index: AQHWEzNZdyEGG+K6rEK5wZ5SeLDnO6h7dRyU Date: Thu, 16 Apr 2020 09:06:32 +0000 Message-ID: References: <1585826793-28709-1-git-send-email-matan@mellanox.com> <1585826793-28709-2-git-send-email-matan@mellanox.com>, In-Reply-To: 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: [207.232.22.84] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 34772b3a-2cfe-4b7a-a029-08d7e1e5751a x-ms-traffictypediagnostic: AM0PR0502MB3811:|AM0PR0502MB3811: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0375972289 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR0502MB4019.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(136003)(366004)(39860400002)(396003)(376002)(346002)(81156014)(66946007)(52536014)(107886003)(76116006)(86362001)(2906002)(33656002)(9686003)(7696005)(316002)(6506007)(26005)(64756008)(8676002)(66476007)(53546011)(478600001)(55016002)(91956017)(66446008)(71200400001)(110136005)(45080400002)(8936002)(4326008)(66556008)(186003)(54906003)(5660300002); DIR:OUT; SFP:1101; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DYg+ayP7NIJwTFcLBp4zwztjd93FwXsXzAkEcnB/OTW4vDgIqGF/gwfbM94rFSPzRshl0EN44lyGwHMFmk03B3GujyjF9A8SLhCsZfw8GY/nRe0/26JAt8XwhoL4jUDj3F/FAN0i6Zhlu2WwV4OVeGziDibMkEBmI265nfzkLugVFFkLCm9PaeJ6N+Gfyi0J2h6x8cVOK7LB+VeMVRt0EqgrmSf6HpRNZK1sDb4JzBEc5N8Ti1qY1Gp+Og7fIVE1vqFWtPjCwH9fiv5z6bBWabU5yDJ38HeeSNX0OlNP5iP3N0LmgJGxSXLWKnlSybOBstko4516D+jX3cnsp6bnTARnX/tHfd1fMKZQmIbxTeQ6Y1RXo/FYcS0dUT4j2XnrSTxHdaoHJxxEQAYTEHFbvNnVih7HiuSOgR1mt37Kv3MhSen98MeLGS9C/G1+4ojj+gPTLBdJ0ncN8usDbunDlEif70uI3h1hHj59Jq2W7udwrcFw8r7MoAMFWojBycic0f24G7P+9G3YzOGyw0MGTw== x-ms-exchange-antispam-messagedata: BjuFF0l7G4r9uSY+s4jaSu5iZ7LJAI34Wq6i8B36yyculvKw7/aiw7rsdLVDno0UOxRUWcjWyHn//IJ/I82Ys7wDFmlSsMumkrloIQ4dgHz7FBO2XhNbeod2nD/bmles0Dp7IxmBBzMoBDWPwtRF4Q== MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34772b3a-2cfe-4b7a-a029-08d7e1e5751a X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Apr 2020 09:06:32.3954 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: F7pyEW05QnmjKmUu5iqffLQRL/1GdGY5pWen0ycordnExvVGh26Ka7s4O256MY5QuXvXE2AQfFi3fZR+6+/L6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3811 Content-Type: text/plain; charset="iso-8859-8-i" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 1/4] vhost: inroduce operation to get vDPA queue stats 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Maxime Can you point on specific vendor specific counter I suggested? I think all of them come directly from virtio protocols. =E4=F9=E2 =E0=FA Outlook =F2=E1=E5=F8 Android ________________________________ From: Maxime Coquelin Sent: Wednesday, April 15, 2020 5:36:59 PM To: Matan Azrad ; dev@dpdk.org Cc: Slava Ovsiienko ; Shahaf Shuler Subject: Re: [PATCH 1/4] vhost: inroduce operation to get vDPA queue stats Hi Matan, On 4/2/20 1:26 PM, Matan Azrad wrote: > The vDPA device offloads all the datapath of the vhost device to the HW > device. > > In order to expose to the user traffic information this patch introduce > new API to get traffic statistics per virtio queue. > > The statistics are taken directly from the vDPA driver managing the HW > device. > > Signed-off-by: Matan Azrad > Acked-by: Viacheslav Ovsiienko > --- > doc/guides/rel_notes/release_20_05.rst | 4 +++ > doc/guides/vdpadevs/features/default.ini | 1 + > doc/guides/vdpadevs/features_overview.rst | 3 +++ > lib/librte_vhost/rte_vdpa.h | 45 +++++++++++++++++++++++++= +++++- > lib/librte_vhost/rte_vhost_version.map | 1 + > lib/librte_vhost/vdpa.c | 14 ++++++++++ > 6 files changed, 67 insertions(+), 1 deletion(-) ... > diff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h > index 9a3deb3..d6cbf48 100644 > --- a/lib/librte_vhost/rte_vdpa.h > +++ b/lib/librte_vhost/rte_vdpa.h > @@ -37,6 +37,27 @@ struct rte_vdpa_dev_addr { > }; > }; > > +struct rte_vdpa_queue_stats { > + /** Number of descriptors received by device */ > + uint64_t received_desc; > + /** Number of descriptors completed by the device */ > + uint64_t completed_desc; > + /** Number of bad descriptors received by device */ > + uint32_t bad_desc; > + /** > + * Number of chained descriptors received that exceed the max allow= ed > + * chain by device > + */ > + uint32_t exceed_max_chain; > + /** > + * Number of times device tried to read or write buffer that is not > + * registered to the device > + */ > + uint32_t invalid_buffer; > + /** Number of errors detected by the device */ > + uint32_t errors; > +}; > + I think doing it like that, we risk to keep the rte_vdpa_get_stats API always experimental, as every vendor will want to add their own counters and so break the ABI. How about implementing something similar to rte_eth_xstat? As these stats are for debugging purpose, it would give you much more flexibility in adding new counters as HW or firmwares evolves. What do you think? Thanks, Maxime > /** > * vdpa device operations > */ > @@ -73,8 +94,11 @@ struct rte_vdpa_dev_ops { > int (*get_notify_area)(int vid, int qid, > uint64_t *offset, uint64_t *size); > > + /** Get statistics of the queue */ > + int (*get_stats)(int did, int qid, struct rte_vdpa_queue_stats *sta= ts); > + > /** Reserved for future extension */ > - void *reserved[5]; > + void *reserved[4]; > }; > > /** > @@ -200,4 +224,23 @@ struct rte_vdpa_device * > __rte_experimental > int > rte_vdpa_relay_vring_used(int vid, uint16_t qid, void *vring_m); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Get vDPA device queue statistics. > + * > + * @param did > + * device id > + * @param qid > + * queue id > + * @param stats > + * queue statistics pointer. > + * @return > + * 0 on success, non-zero on failure. > + */ > +__rte_experimental > +int > +rte_vdpa_get_stats(int did, uint16_t qid, struct rte_vdpa_queue_stats *s= tats); > #endif /* _RTE_VDPA_H_ */ > diff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rt= e_vhost_version.map > index 051d08c..c9dcff4 100644 > --- a/lib/librte_vhost/rte_vhost_version.map > +++ b/lib/librte_vhost/rte_vhost_version.map > @@ -38,6 +38,7 @@ EXPERIMENTAL { > rte_vdpa_find_device_id; > rte_vdpa_get_device; > rte_vdpa_get_device_num; > + rte_vdpa_get_stats; > rte_vhost_driver_attach_vdpa_device; > rte_vhost_driver_detach_vdpa_device; > rte_vhost_driver_get_vdpa_device_id; > diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c > index 2b86708..57900fc 100644 > --- a/lib/librte_vhost/vdpa.c > +++ b/lib/librte_vhost/vdpa.c > @@ -227,3 +227,17 @@ struct rte_vdpa_device * > free_ind_table(idesc); > return -1; > } > + > +int > +rte_vdpa_get_stats(int did, uint16_t qid, struct rte_vdpa_queue_stats *s= tats) > +{ > + struct rte_vdpa_device *vdpa_dev; > + > + vdpa_dev =3D rte_vdpa_get_device(did); > + if (!vdpa_dev) > + return -ENODEV; > + > + RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_stats, -ENOTSUP); > + > + return vdpa_dev->ops->get_stats(did, qid, stats); > +} > =E4=F9=E2 =E0=FA Outlook =F2=E1=E5=F8 Android