From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA9BFA057B; Wed, 19 Oct 2022 11:14:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF32240E03; Wed, 19 Oct 2022 11:14:15 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 915F340A8B for ; Wed, 19 Oct 2022 11:14:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666170853; x=1697706853; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=c0F6ybfMoFrdJLYR9gCkGVLZ9GFbOE9K25J9YklK/OI=; b=Y0Pgaq/9hYqmXkj3CIuPrQgYKOp1etMJTjECYqTH7/6+L1cFmunJNtDp bvVkjBQTvjqHVLdi9PB++FcXSnDgCIWBkza3+Uy8fgvywAgzdZVvbW1TF HZ9o583ilTU54kjn665uYAB+f0laJi47XyRJT+hA+vJodneiSsxDZzX5f 2FKxNWnaUijC1b8KR2CX+Y+4Xzi5ZpRthijhmJqVsNOMXmEDDzf7y2eZh b6cWg6GxoRcvvu/KsMipuA3u7TwTxLWOdf78r2GBkKAkTvugiuoUIQIHw JwYE9cpdW4z/PyTPofm7kOmtHcQHj9ZQprYAuoXAqSxC/WGUceUsesoyA Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="308041582" X-IronPort-AV: E=Sophos;i="5.95,195,1661842800"; d="scan'208";a="308041582" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 02:14:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="624043147" X-IronPort-AV: E=Sophos;i="5.95,195,1661842800"; d="scan'208";a="624043147" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga007.jf.intel.com with ESMTP; 19 Oct 2022 02:14:12 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 19 Oct 2022 02:14:11 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.2375.31; Wed, 19 Oct 2022 02:14:10 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 19 Oct 2022 02:14:10 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.174) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 19 Oct 2022 02:14:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PM8Dg1wuHTquTmsmbiSY4YTLCZkr1Enf3mOHuI6I5utfNqJ8oMkwq7W+CF5hab3IFt8/AWGrzkQEu/wL3SU9n3RsQns+nALtwSW1B5XqGWiU+UOqZmNkE9LJInKcZ6EmDVByaDyAt0miohKHCzieVFz92Tv7Uk7xJzkF6jG/byTjzM27hVd2+hGNa68kaO9wzG2rIriqstzfM838hClDZq838xN8F0LQ4D0lxIxRikjpa/AfxKcwZOqyP1bNlKDC+QHkCyHx61kFsVzLL20V6mj81My+YCRWI2LIHA4tgwisOgpc5eusovMnJ/VzLFJzZily8zXyPxipKFUgjTefBQ== 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=nFIINYyz9MfGYf+scaPnPdGZc/UmOzqz1QhxfemsEBg=; b=QdHradw1MWZf3cZR0BC+gKKqnDY+m4uni3+DBdrSR0ul+w/FuJXoB7wzdNPHbwaBxkK9hFS3e1euYHXEwXX/FLsCAW9zl8aQDrCSAF0hJKYnXTVt1R6/DGx/hss3d508CHpBShJzY3jX1nciIUPP9vhHWY6QtxJorkM2O1FdJodbYWx2xt+fXsCQn3FM8n3k1UM+spAeeNNP8qluWU2zgo7TRy3Oyuu5Y5Im2pN7cy5z7UGCGs0Br7ciZLEwIvN/6wGApyBckq3aZA/Ms5155GGXsegXq41bGpSM+gtIzcn8swWD/SEN6x3rr1n/7lf/YiFdx/R++fwSmUwPJSmr3g== 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 SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by PH0PR11MB5808.namprd11.prod.outlook.com (2603:10b6:510:129::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Wed, 19 Oct 2022 09:14:09 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::39bf:57b1:4824:d40d]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::39bf:57b1:4824:d40d%6]) with mapi id 15.20.5723.034; Wed, 19 Oct 2022 09:14:09 +0000 From: "Xia, Chenbo" To: "Pei, Andy" , "dev@dpdk.org" CC: "Xu, Rosen" , "Huang, Wei" , "Cao, Gang" , "maxime.coquelin@redhat.com" Subject: RE: [PATCH v7 10/12] vhost: add vdpa device type to rte vdpa device Thread-Topic: [PATCH v7 10/12] vhost: add vdpa device type to rte vdpa device Thread-Index: AQHY4rpJ4oH3t21NR06JYmxdfnQcU64VcMRw Date: Wed, 19 Oct 2022 09:14:08 +0000 Message-ID: References: <1661229305-240952-2-git-send-email-andy.pei@intel.com> <1666073977-175484-1-git-send-email-andy.pei@intel.com> <1666073977-175484-11-git-send-email-andy.pei@intel.com> In-Reply-To: <1666073977-175484-11-git-send-email-andy.pei@intel.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB3504:EE_|PH0PR11MB5808:EE_ x-ms-office365-filtering-correlation-id: 2f32ea1d-0970-432d-3c47-08dab1b24789 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OVPrmI35ZNPTCjMdreL2NdOi+8CUjWu+OPuq/+wUyw60gOl58OAkyA4c4058YoPQdk7RHozz/c48RjFhvU5XclBkBLajldNuVVMbk04h8tAyBeEah7naUFOsfiSzzQZad2anSpzXv5w7xRDP022CCqNk1imjSZtHvTCeZehi/YoZYEZtz8w8Ik3ROwQOKpeGYXnA2nQjr319AXa1+ajz8mI1Ywu5GrWqozASUzg+PDXl3J+rladAjib04jXE39Y6uYIn9IWKDPsVkxwIWubRgEoZ7beF73MvWC7cNNN8Zh5EdMDIkaWi0tLQYWDRR3Vlb1a/+GZqRrQ9RoniRCGZ084DLoU7YezCQ/U3/EB8a21aKHOs+JkVNCzzmCVxJ5l+XC2n57+MsrYQOdp7ea+GYk64Gn1G/NW07mayWxYGx/cLtb6l8hpARrHODzz+IceznACOTG2BD5R5HR0LcNiPrfTAHq2AkfFuKo9J26/w1WFDkzsmxF1mk944wfPrv/AjMeSI3GIlXTYVtJP9YzBLwOzN+AvS2Mn9EEFj05IZ8Li16OvYevj0hgpyi2PjxTQiS+XP03KvcuzSHj4HMkX/XMlVUYRZUwWuwP47O9zQTX9Sfc73SOsq6qOmaLgsMkl5yw/8eZA5szsQJCkoVwLohECGVyK3/Asn6NmE+d9CCSiW1RuBftQmX/tdP7qmXCTK+yjP1eN00SbVUasp2XORoRKuDqajx2Ky7a73v6FRtKvha0wOYFI9kf0QOBxnXMA+divs9xoDsA4uVbu0xl/RSA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(136003)(39860400002)(366004)(396003)(451199015)(110136005)(54906003)(9686003)(316002)(478600001)(66946007)(64756008)(4326008)(66556008)(66476007)(8676002)(66446008)(71200400001)(76116006)(26005)(41300700001)(7696005)(52536014)(53546011)(5660300002)(8936002)(33656002)(186003)(2906002)(83380400001)(6506007)(55016003)(38070700005)(82960400001)(38100700002)(86362001)(122000001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?WlnG02whK1YDJtiF3dBcfec3Ftu5x5Q18Z8BOZ74cWCF2zaBWzs3c2HIaYFJ?= =?us-ascii?Q?uMIkl+IfUd8zlQKMWrDgFmlF0/AaBeZOzUQExJgFI/QqLOHr/k+x4Sw6fDVV?= =?us-ascii?Q?9E2/77rhNR2UVXJWW7E5Uqs+YLb4X/Dhfq1PfoKUEzDY5yQ/NKK0KPLDlzz4?= =?us-ascii?Q?MN1Xrja3KhY96NPcS1TdcxEef/9fgbynr5Bv5afIq+uJ6+bCGWjgMnyF4qrl?= =?us-ascii?Q?4Jv9L6qRUZGk7K5B5Q5stDWET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ascii?Q?1PK+SVeoRW1jUYlNWnjAHb6JtT+1vtP99sloVh8//xEBYm+3209zsdLAqker?= =?us-ascii?Q?Wm1Xv5v0RuvimVO2stW8lRJou2kzbTu+KMhCrWuawlUuajHfW1NgLoHQFQUH?= =?us-ascii?Q?iG0SchdbzzC+GserWZBd6XUZGu1Y0plLVkU7YqdG9eQ5xXg836j+SGU8BuFD?= =?us-ascii?Q?Fn2gyl5xFXdyk20Ivm7xaN1u3vrZBhLrel01Uo6alQvbdqjgRTeC2L7tNsDE?= =?us-ascii?Q?3hFhteRoc1EwizbbdqgDJ2YTdcmKL8svDdQsrcfRp9aTBrvvOJFZAdy8AVp8?= =?us-ascii?Q?DHW60rp0hiGO76pyleXTnP+F+uOYE1ECCFO2pboK0mRbS6AWB3RYATQ+1e/R?= =?us-ascii?Q?fbV6tJwIRcEX9vN9Q4wpAo/8+cdFk5kITchpCyXtHujnJeIZT/3cybi4MQ6l?= =?us-ascii?Q?H/SDAeeZ/H1SJK2Jhjgc1hQojU9Ctl9xYMWEf57n?= 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: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f32ea1d-0970-432d-3c47-08dab1b24789 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2022 09:14:08.8349 (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: YRN2F3id/LwqeNA+utDgRcJLphafvmMDR1v+kFgAlQocSQmBvSx/G08FME3KdnELlWqP8gB5y0wMPuGvq5sJ4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5808 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Pei, Andy > Sent: Tuesday, October 18, 2022 2:20 PM > To: dev@dpdk.org > Cc: Xia, Chenbo ; Xu, Rosen ; > Huang, Wei ; Cao, Gang ; > maxime.coquelin@redhat.com > Subject: [PATCH v7 10/12] vhost: add vdpa device type to rte vdpa device >=20 > Add vdpa_device_type to rte_vdpa_device to store device type. > Call vdpa ops get_dev_type to fill vdpa_device_type > when register vdpa device. >=20 > Signed-off-by: Andy Pei > --- > lib/vhost/socket.c | 15 +-------------- > lib/vhost/vdpa.c | 17 +++++++++++++++++ > lib/vhost/vdpa_driver.h | 2 ++ > 3 files changed, 20 insertions(+), 14 deletions(-) >=20 > diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c > index 608ae57..f768114 100644 > --- a/lib/vhost/socket.c > +++ b/lib/vhost/socket.c > @@ -627,7 +627,6 @@ struct rte_vdpa_device * > { > struct vhost_user_socket *vsocket; > struct rte_vdpa_device *vdpa_dev; > - uint32_t vdpa_type =3D 0; > int ret =3D 0; >=20 > pthread_mutex_lock(&vhost_user.mutex); > @@ -644,19 +643,7 @@ struct rte_vdpa_device * > goto unlock_exit; > } >=20 > - if (vdpa_dev->ops->get_dev_type) { > - ret =3D vdpa_dev->ops->get_dev_type(vdpa_dev, &vdpa_type); > - if (ret) { > - VHOST_LOG_CONFIG(path, ERR, > - "failed to get vdpa dev type for socket file.\n"); > - ret =3D -1; > - goto unlock_exit; > - } > - } else { > - vdpa_type =3D RTE_VHOST_VDPA_DEVICE_TYPE_NET; > - } > - > - *type =3D vdpa_type; > + *type =3D vdpa_dev->vdpa_device_type; >=20 > unlock_exit: > pthread_mutex_unlock(&vhost_user.mutex); > diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c > index bb82857..b487f4d 100644 > --- a/lib/vhost/vdpa.c > +++ b/lib/vhost/vdpa.c > @@ -73,6 +73,8 @@ struct rte_vdpa_device * > struct rte_vdpa_dev_ops *ops) > { > struct rte_vdpa_device *dev; > + uint32_t vdpa_type =3D -1; > + int ret =3D 0; >=20 > if (ops =3D=3D NULL) > return NULL; > @@ -101,6 +103,21 @@ struct rte_vdpa_device * >=20 > dev->device =3D rte_dev; > dev->ops =3D ops; > + > + if (ops->get_dev_type) { > + ret =3D ops->get_dev_type(dev, &vdpa_type); > + if (ret) { > + VHOST_LOG_CONFIG(rte_dev->name, ERR, > + "Failed to get vdpa dev type.\n"); > + ret =3D -1; > + goto out_unlock; > + } > + } else { > + /** by default, we assume vdpa device is a net device */ > + vdpa_type =3D RTE_VHOST_VDPA_DEVICE_TYPE_NET; > + } > + dev->vdpa_device_type =3D vdpa_type; > + > TAILQ_INSERT_TAIL(&vdpa_device_list, dev, next); > out_unlock: > rte_spinlock_unlock(&vdpa_device_list_lock); > diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h > index 8b88a53..c4ec222 100644 > --- a/lib/vhost/vdpa_driver.h > +++ b/lib/vhost/vdpa_driver.h > @@ -92,6 +92,8 @@ struct rte_vdpa_device { > struct rte_device *device; > /** vdpa device operations */ > struct rte_vdpa_dev_ops *ops; > + /** vdpa device type: net, blk... */ > + uint32_t vdpa_device_type; > }; >=20 > /** > -- > 1.8.3.1 Reviewed-by: Chenbo Xia