From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2832EA04FD;
	Mon, 23 May 2022 10:23:26 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 1A5AA40156;
	Mon, 23 May 2022 10:23:26 +0200 (CEST)
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by mails.dpdk.org (Postfix) with ESMTP id 4771240156
 for <dev@dpdk.org>; Mon, 23 May 2022 10:23:24 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1653294204; x=1684830204;
 h=from:to:cc:subject:date:message-id:references:
 in-reply-to:content-transfer-encoding:mime-version;
 bh=08n2MVXgzPTBk//5tFQ7gvtVqdmqZptE0kzLdQ832yQ=;
 b=AQkuWfbc6p7JfOaaiUwQj92F/iQvodGglLhCyHs2K/c5stB+WyzLwngB
 FNVksjORUdWgkn9kwdHH682rhBvh+ePoXDJntxaAzXZD5+YLgcyPtXAaK
 wA4Ic/5eo7AgZP40DmpQt6RbfUy4wWbnp6uw+PgZjEIXAooR0rEs0aUNP
 6d38PSmPaMfbvaopNg13iycgArNuxyvOrkN2mlwycmz1lbJJzsR2UdcD5
 SCD6nw0FfOzRCKdUVK5zfrNazR3MA1amyVmVgV0xX8evYGT7gtYIDSrcE
 WcYlDDNVzvYzuu1R42KvsNDb1+aTjEIwTD6OdNKaponP4eAfR3f4KViO+ Q==;
X-IronPort-AV: E=McAfee;i="6400,9594,10355"; a="298460840"
X-IronPort-AV: E=Sophos;i="5.91,246,1647327600"; d="scan'208";a="298460840"
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 23 May 2022 01:23:23 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.91,246,1647327600"; d="scan'208";a="641361604"
Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84])
 by fmsmga004.fm.intel.com with ESMTP; 23 May 2022 01:23:23 -0700
Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by
 fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2308.27; Mon, 23 May 2022 01:23:22 -0700
Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by
 fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2308.27; Mon, 23 May 2022 01:23:22 -0700
Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by
 fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2308.27 via Frontend Transport; Mon, 23 May 2022 01:23:22 -0700
Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169)
 by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.2308.27; Mon, 23 May 2022 01:23:22 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=LDn0l3ON48GN+FA4T+3ys4k9ccERt4OrHCsjOco+08TxUckBrStNIIRoPSixC/FFLvOxqMdUz7+T2tGPcasQruKVKY3n5mQIIq915NZUfcoyt6AtP5fGza+7b8BrwHxLm8lBPx2uUZwcNverD7Ai4m6ACVomIRtUqmuHwCO9MtC5+SFDC0SjVMMIoo9dtGwOIvjySSLZkcGew9mTXHwnkKi0q+oLDBpeF9eDO0AWupLo7f0fsZVAM2Nn1/5O9OQUCFi1Y7kxqeoUXW5k6rupCfJS8HUNx8mWbMnTQf5vC6omwUDy56UU/oje169iVa4kHxxZ6v4uDdL0rLa0z1Gq/g==
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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=2tzSvvURwK7r8OzvgjYfX/DpxfRdYyth2xaZ2g8tnCg=;
 b=JxX7QVT8uEOmxHe14hE4x29zLtOAXMfufz7Oq+nV13jJnKHXbHDd1/md2vpDRKbj87+fxv6XkHTgbComuhmWIKCWiqZVp10PA2L6lhfJgN8bCj4q/OESu2uNA7beyJ69Zhe8XoxeN78bi5+lJwBO0d8c1WGqVVU/kydFizZRC0SnHB6L6pMdhuLHjUB/XDvEavIDXtwvp3viOxxiSDEE4RtkOm8H5vWXsIfeAT9TxH/22YWSooxnEDMKU7ysSgraPQwacnam8MVg51rypQz5t4jG38enlSXIYgJLu+ze1zFinOgByhRqHMwIe60L1oRoIlZIEftlnc1YuyNOQCb0GQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
 dkim=pass header.d=intel.com; arc=none
Received: from DM5PR11MB1739.namprd11.prod.outlook.com (2603:10b6:3:111::22)
 by MW3PR11MB4747.namprd11.prod.outlook.com (2603:10b6:303:2f::11) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Mon, 23 May
 2022 08:23:19 +0000
Received: from DM5PR11MB1739.namprd11.prod.outlook.com
 ([fe80::8c3b:8a54:d186:b555]) by DM5PR11MB1739.namprd11.prod.outlook.com
 ([fe80::8c3b:8a54:d186:b555%11]) with mapi id 15.20.5273.022; Mon, 23 May
 2022 08:23:19 +0000
From: "Pei, Andy" <andy.pei@intel.com>
To: "Xia, Chenbo" <chenbo.xia@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>, "Cao, Gang"
 <gang.cao@intel.com>, "Liu, Changpeng" <changpeng.liu@intel.com>, "Xu, Rosen"
 <rosen.xu@intel.com>, "Xiao, QimaiX" <qimaix.xiao@intel.com>
Subject: RE: [PATCH v8 07/13] vhost: add API to get vDPA device type
Thread-Topic: [PATCH v8 07/13] vhost: add API to get vDPA device type
Thread-Index: AQHYarddJPdnEMsGeUSG+J70iyAshq0sFfBwgAARJhA=
Date: Mon, 23 May 2022 08:23:18 +0000
Message-ID: <DM5PR11MB1739038025ED4D66B2B3FD7F8FD49@DM5PR11MB1739.namprd11.prod.outlook.com>
References: <1643093258-47258-2-git-send-email-andy.pei@intel.com>
 <1652876035-70513-1-git-send-email-andy.pei@intel.com>
 <1652876035-70513-8-git-send-email-andy.pei@intel.com>
 <SN6PR11MB350492ADB72E0F9E790BDC659CD49@SN6PR11MB3504.namprd11.prod.outlook.com>
In-Reply-To: <SN6PR11MB350492ADB72E0F9E790BDC659CD49@SN6PR11MB3504.namprd11.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-version: 11.6.401.20
dlp-reaction: no-action
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=intel.com;
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: e5ee1256-ef71-463c-9cae-08da3c957e1e
x-ms-traffictypediagnostic: MW3PR11MB4747:EE_
x-microsoft-antispam-prvs: <MW3PR11MB4747A26FF8F8BC4D075582288FD49@MW3PR11MB4747.namprd11.prod.outlook.com>
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: mU+okFkUrDmBuKBoLFU+xDFJXzfDD/bnUWN8omg5B0Clcyxo7EcmXemr+2AKWebqGBcQgLie0KPpugJj5dZ50DSTvaPPntygdDjbTezUJj4yGLsaOHjQPThCq9CyTQ3Hn+ShpHytJb5fgTSsIIi0+B5wNrhHWWiwDJ7kJfQELObb6AFJqQoqlMD6FrYskR77HKf+MNsC1Nd6WngdIms/RBcPDfemEXk1/fw39qtGMop4qFINLtKm/H4XnVppOp905PuuWt+14b8MdxDQBDzq9B5vtBpMfgDS53CRslad2FANe1BsUBYed3Xr/JHCF8gr1JP5IekG2cWIg/aDClJkN/GGk4RP0Ui/7M9Cs2YvRTMTcMBwNZnx+ow5bSLANGAOtdTrZwIa+SdpVCBWfwwQYFcMKQa+NAa4NL4tOhySnauQUP1VsA3/ElzSO8BQC3ZtaUt3lCtWMgTutzdlz/0J/tociXwTzTmAmXEv9No+0dW0yRiR5x9q+Fc4cb7jue1u0wcCyekLzuQzWbyQOEp8M1ja+dct4kcD/yzLsxIg29Smd91b/FM+qJdrphxMwQ0iCveVNd7MlFcllpJsVaPjrpVp4Ucyl4CjQC3Dquc54jc+TiKnylQosds6uyoVfxBPn1G6vGahJnV2tWZF9uNIqZH/FkpryozpCqtQFYBeBfzHftO/R/kHrv7g5oUi78UmX9txoHQR0Os71mZBksKEXg==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:DM5PR11MB1739.namprd11.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230001)(366004)(83380400001)(2906002)(107886003)(186003)(9686003)(38100700002)(33656002)(26005)(66446008)(64756008)(66556008)(66946007)(66476007)(76116006)(8676002)(4326008)(52536014)(54906003)(8936002)(110136005)(82960400001)(86362001)(7696005)(55016003)(53546011)(5660300002)(6506007)(316002)(122000001)(71200400001)(38070700005)(508600001);
 DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wD+vKikZyStW6MO+5bAP5wO1DzxTPvnghE1JuJGS+iQD8PqV8igUiO96jDTl?=
 =?us-ascii?Q?cNQUMbCjir0BfjVFYtuVONwjYPNR9tebvu18X71ZIOclg03F14Krf49QQbNW?=
 =?us-ascii?Q?iEp5u3Uu7D0365CZjxDlDHdUgfmsy1OH9x5FPjT3hf8cvgR8KQIRxxFLx9kf?=
 =?us-ascii?Q?13OwwLJCCiwQdoFeLu2kxSLKoirv2Y88u9PrJO6z6TGDtl1UWRaqFxgvCKQq?=
 =?us-ascii?Q?Finvs0b6z0NnAwxqie01fXBye6CgKmgUTnFklYjAIiU3OYQONDEGE4qtfNzl?=
 =?us-ascii?Q?aqJ3D4C17bcf39V8ExXm+nnzydXLn0frCfjkc1oDBL5e0KossvKJS7OJC0C/?=
 =?us-ascii?Q?ozZKPYP+F/AlFju8tIvvLLUDVp95k4tp89UvNvsCEnkA4cyrF8B9JUFF/cvi?=
 =?us-ascii?Q?iq5aFACY0ssngE0fevVN5vkT6iipscKg4lcNNvvsDRbNS2JOSUK/Qjeh4V7W?=
 =?us-ascii?Q?+cVIOSu9KbAlI+P+9wrX0A5pURgd2DKB8OQ+SsHUQtwTYMSSNrFD3jSshtiq?=
 =?us-ascii?Q?FSoWmeaauH+FBhcW5hvToMgN6nsjJdJzA5dBNr8AX/InaSBk3DkRhAeRqp1a?=
 =?us-ascii?Q?/XUDiNlLfwED/Yy+2/GEDQsYv9uN3d1ADgs81ba0z18L0O6berbedMDqfn5j?=
 =?us-ascii?Q?bDwcaUCL/1fUit7jcdNaneTs702VNjiMWbDEjQQQ2f7hRF5UVn81e450VKbu?=
 =?us-ascii?Q?G+4gbrC/ulqtOVVcjqdUjZxYvg32JTv7SP4Ih0i2pQZSYAIP/njS810qJHrH?=
 =?us-ascii?Q?Jo4wuRPyRMHk61Wp/62iO6O9ZTJCJafhomSVB0uZgwBLFas99gu4cDZ/yM6r?=
 =?us-ascii?Q?l4Rel8CGsIr9T4O/+Qp//tYO+Vm+HuPOWnP/KZkb7VH99DgBIO7MCCH+TgCK?=
 =?us-ascii?Q?ChAfOTGBRJSs3i99zt8urhAddbR/Q76KW2O6u1IPSKP5EycvJxjUj456BdDc?=
 =?us-ascii?Q?IJLIaOCGiDPo8Z7vs5XmrXm1aV+3rw8SctbO7SNj86VRI7WfZVsKxUpVlsDF?=
 =?us-ascii?Q?7mCL0aV2ZegtrQcPT/5TXz9WfhTW1dzC2pwd7QyUqvstQphAq2lfwCs5EZFS?=
 =?us-ascii?Q?BoHlKHRsqP9sus53ef09Mwp8o8Dx05uq9VVyMAHZwYK2MyIfdKCMIaZiT40t?=
 =?us-ascii?Q?JIh3kU4IYtGcncjUXay7TpIU+unAr4zvLfYk+s3wHoesH8ul5PkC2vL58Uuu?=
 =?us-ascii?Q?IySu1myGdjXVe3oLq1zGjOOJh21H8ewlEebHZVNPdc5uAyVoV7qgWuc2jVoX?=
 =?us-ascii?Q?+SkrPrF1YZ9YfJRAlI/kpDJj3rQZvIUM3/SJ31NxHhyHbaZyBOj2OjlJBMd8?=
 =?us-ascii?Q?/7AE4qZXdE/ToXgwRTgZoSyKV1NK+kfYtoVmWhNEq024v23GodQJ2hikPlSU?=
 =?us-ascii?Q?X1hrjdQTVCtJTe3aoSMCpDqoK7xAC4+dM7rjxyO2Wf6v29GBJwEHU3O1fiHG?=
 =?us-ascii?Q?8ib/DZgLmngJkklcxQGuYW3qjoJpxJq+doaIvQpUCaFKLUivxBS6RjRMYf95?=
 =?us-ascii?Q?mQ1ThIXwxwX4NF6IewP7DJa+wJs1lTRGYLDEDZJI+B0wYc1b3oFBZhfJIF8L?=
 =?us-ascii?Q?A9c5/uxk/wPItt/8UV8QPtrcWdiHZd5had585AQOD4WeYOEsqM5E1SaKWbBi?=
 =?us-ascii?Q?gY0pqM3n2XL6q/UkdUT8bAv0VxaGDbzGMQi8ZcSRWKObdAb7l5onI7skGp7M?=
 =?us-ascii?Q?xT+vmsybg8jI9YqzrYXbwjaOXCRAQ0OgYUnel0IZcPPijHJJNhpzI8s4Zbhp?=
 =?us-ascii?Q?kVkFfIbrWg=3D=3D?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1739.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: e5ee1256-ef71-463c-9cae-08da3c957e1e
X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2022 08:23:18.9606 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: TXIRkJ4g/BZfG3Z6xoh33cFRs9vmFFyWN09TmUBewc5bisL7I0og5u+keSLEvjpquYCVKABNjMJYetvlk2LEew==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4747
X-OriginatorOrg: intel.com
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Hi Chenbo,

Thanks for your reply.
I will send a new version to address these.

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Monday, May 23, 2022 3:26 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: RE: [PATCH v8 07/13] vhost: add API to get vDPA device type
>=20
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Wednesday, May 18, 2022 8:14 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > Cao, Gang <gang.cao@intel.com>; Liu, Changpeng
> > <changpeng.liu@intel.com>; Xu, Rosen <rosen.xu@intel.com>; Xiao,
> > QimaiX <qimaix.xiao@intel.com>
> > Subject: [PATCH v8 07/13] vhost: add API to get vDPA device type
> >
> > Vhost backend of different devices have different features.
> > Add a API to get vDPA device type, net device or blk device
>=20
> an API
>=20
> > currently, so users can set different features for different kinds of
> > devices.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> >  doc/guides/prog_guide/vhost_lib.rst    |  5 ++++
> >  doc/guides/rel_notes/release_22_07.rst |  4 ++++
> >  lib/vhost/rte_vhost.h                  | 17 +++++++++++++
> >  lib/vhost/socket.c                     | 44
> > ++++++++++++++++++++++++++++++++++
> >  lib/vhost/vdpa_driver.h                |  3 +++
> >  lib/vhost/version.map                  |  1 +
> >  6 files changed, 74 insertions(+)
> >
> > diff --git a/doc/guides/prog_guide/vhost_lib.rst
> > b/doc/guides/prog_guide/vhost_lib.rst
> > index f287b76..0337b38 100644
> > --- a/doc/guides/prog_guide/vhost_lib.rst
> > +++ b/doc/guides/prog_guide/vhost_lib.rst
> > @@ -282,6 +282,11 @@ The following is an overview of some key Vhost
> > API
> > functions:
> >    Clear inflight packets which are submitted to DMA engine in vhost
> > async data
> >    path. Completed packets are returned to applications through ``pkts`=
`.
> >
> > +* ``rte_vhost_driver_get_vdpa_dev_type(path, type)``
> > +
> > +  Get device type of vDPA device, such as VDPA_DEVICE_TYPE_NET,
> > + VDPA_DEVICE_TYPE_BLK.
> > +
> >  Vhost-user Implementations
> >  --------------------------
> >
> > diff --git a/doc/guides/rel_notes/release_22_07.rst
> > b/doc/guides/rel_notes/release_22_07.rst
> > index e49cace..9550977 100644
> > --- a/doc/guides/rel_notes/release_22_07.rst
> > +++ b/doc/guides/rel_notes/release_22_07.rst
> > @@ -104,6 +104,10 @@ New Features
> >    * ``RTE_EVENT_QUEUE_ATTR_WEIGHT``
> >    * ``RTE_EVENT_QUEUE_ATTR_AFFINITY``
> >
> > +* **Added vhost API to get the device type of a vDPA device.**
> > +
> > +  Added an API which can get the device type of vDPA device.
> > +
>=20
> Release note has a requirement of order, check comment under 'New
> features'
> in release notes.
>=20
> Based on these comments, you should put this after 'Added vhost API to ge=
t
> the number of in-flight packets'
>=20
> >
> >  Removed Items
> >  -------------
> > diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h index
> > c733f85..c977a24 100644
> > --- a/lib/vhost/rte_vhost.h
> > +++ b/lib/vhost/rte_vhost.h
> > @@ -117,6 +117,9 @@
> >
> >  #define RTE_MAX_VHOST_DEVICE	1024
> >
> > +#define VDPA_DEVICE_TYPE_NET 0
> > +#define VDPA_DEVICE_TYPE_BLK 1
>=20
> These will be new APIs of vhost lib. I suggest to rename them by adding
> prefix 'RTE_VHOST_'
>=20
> Thanks,
> Chenbo
>=20
> > +
> >  struct rte_vdpa_device;
> >
> >  /**
> > @@ -486,6 +489,20 @@ struct rte_vdpa_device *
> > rte_vhost_driver_get_vdpa_device(const char *path);
> >
> >  /**
> > + * Get the device type of the vdpa device.
> > + *
> > + * @param path
> > + *  The vhost-user socket file path
> > + * @param type
> > + *  the device type of the vdpa device
> > + * @return
> > + *  0 on success, -1 on failure
> > + */
> > +__rte_experimental
> > +int
> > +rte_vhost_driver_get_vdpa_dev_type(const char *path, uint32_t *type);
> > +
> > +/**
> >   * Set the feature bits the vhost-user driver supports.
> >   *
> >   * @param path
> > diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index
> > b304339..ef0f401 100644
> > --- a/lib/vhost/socket.c
> > +++ b/lib/vhost/socket.c
> > @@ -619,6 +619,50 @@ struct rte_vdpa_device *  }
> >
> >  int
> > +rte_vhost_driver_get_vdpa_dev_type(const char *path, uint32_t *type)
> > +{
> > +	struct vhost_user_socket *vsocket;
> > +	struct rte_vdpa_device *vdpa_dev;
> > +	uint32_t vdpa_type =3D 0;
> > +	int ret =3D 0;
> > +
> > +	pthread_mutex_lock(&vhost_user.mutex);
> > +	vsocket =3D find_vhost_user_socket(path);
> > +	if (!vsocket) {
> > +		VHOST_LOG_CONFIG(ERR,
> > +				 "(%s) socket file is not registered yet.\n",
> > +				 path);
> > +		ret =3D -1;
> > +		goto unlock_exit;
> > +	}
> > +
> > +	vdpa_dev =3D vsocket->vdpa_dev;
> > +	if (!vdpa_dev) {
> > +		ret =3D -1;
> > +		goto unlock_exit;
> > +	}
> > +
> > +	if (vdpa_dev->ops->get_dev_type) {
> > +		ret =3D vdpa_dev->ops->get_dev_type(vdpa_dev, &vdpa_type);
> > +		if (ret) {
> > +			VHOST_LOG_CONFIG(ERR,
> > +					 "(%s) failed to get vdpa dev type for
> > socket file.\n",
> > +					 path);
> > +			ret =3D -1;
> > +			goto unlock_exit;
> > +		}
> > +	} else {
> > +		vdpa_type =3D VDPA_DEVICE_TYPE_NET;
> > +	}
> > +
> > +	*type =3D vdpa_type;
> > +
> > +unlock_exit:
> > +	pthread_mutex_unlock(&vhost_user.mutex);
> > +	return ret;
> > +}
> > +
> > +int
> >  rte_vhost_driver_disable_features(const char *path, uint64_t
> > features)  {
> >  	struct vhost_user_socket *vsocket;
> > diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h index
> > e59a834..9cbd7cd 100644
> > --- a/lib/vhost/vdpa_driver.h
> > +++ b/lib/vhost/vdpa_driver.h
> > @@ -78,6 +78,9 @@ struct rte_vdpa_dev_ops {
> >  	/** Set the device configuration space */
> >  	int (*set_config)(int vid, uint8_t *config, uint32_t offset,
> >  		      uint32_t size, uint32_t flags);
> > +
> > +	/** get device type: net device, blk device... */
> > +	int (*get_dev_type)(struct rte_vdpa_device *dev, uint32_t *type);
> >  };
> >
> >  /**
> > diff --git a/lib/vhost/version.map b/lib/vhost/version.map index
> > 5841315..583b4f3 100644
> > --- a/lib/vhost/version.map
> > +++ b/lib/vhost/version.map
> > @@ -90,6 +90,7 @@ EXPERIMENTAL {
> >
> >  	# added in 22.07
> >  	rte_vhost_async_get_inflight_thread_unsafe;
> > +	rte_vhost_driver_get_vdpa_dev_type;
> >
> >  };
> >
> > --
> > 1.8.3.1