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 B1FE7A2EEB for ; Thu, 12 Sep 2019 09:41:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8C4F31E53C; Thu, 12 Sep 2019 09:41:47 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3A4A41DFED for ; Thu, 12 Sep 2019 09:41:45 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2019 00:41:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,489,1559545200"; d="scan'208";a="385958873" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 12 Sep 2019 00:41:43 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 12 Sep 2019 00:41:41 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 12 Sep 2019 00:41:41 -0700 Received: from shsmsx106.ccr.corp.intel.com ([169.254.10.86]) by shsmsx102.ccr.corp.intel.com ([169.254.2.113]) with mapi id 14.03.0439.000; Thu, 12 Sep 2019 15:41:39 +0800 From: "Wang, Xiao W" To: "Pei, Andy" , "dev@dpdk.org" CC: "Xu, Rosen" , "Ye, Xiaolong" , "Bie, Tiwei" , "Liang, Cunming" Thread-Topic: [PATCH 3/4] vhost: call vDPA callback at the end of vring enable handler Thread-Index: AQHVZGPfe7jGPMN760u12iP8/wQw8KcnpAsA Date: Thu, 12 Sep 2019 07:41:39 +0000 Message-ID: References: <1567740051-367172-1-git-send-email-andy.pei@intel.com> <1567740051-367172-3-git-send-email-andy.pei@intel.com> In-Reply-To: <1567740051-367172-3-git-send-email-andy.pei@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTFlYTY3MTUtZTdjMS00M2VmLWFmODgtZTgzOTQ4NjhkYzZiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS0FSTWxzc0poSCtwVmw0V3ZRWW5oOGoyMHl0NVJNZTBwR1IrQ3pvYm9CSjBvaklTekNZWUVDSUgrZlRSM3JnKyJ9 dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 3/4] vhost: call vDPA callback at the end of vring enable handler 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 Andy, > -----Original Message----- > From: Pei, Andy > Sent: Friday, September 6, 2019 11:21 AM > To: dev@dpdk.org > Cc: Xu, Rosen ; Ye, Xiaolong ; > Bie, Tiwei ; Wang, Xiao W > Subject: [PATCH 3/4] vhost: call vDPA callback at the end of vring enable > handler >=20 > vDPA's set_vring_state callback would need to know the virtqueues' > enable status to configure the hardware. >=20 > Signed-off-by: Xiaolong Ye > Signed-off-by: Andy Pei > --- > lib/librte_vhost/rte_vdpa.h | 4 ++-- > lib/librte_vhost/vhost_user.c | 5 +++-- > 2 files changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h > index 9a3deb3..19cf897 100644 > --- a/lib/librte_vhost/rte_vdpa.h > +++ b/lib/librte_vhost/rte_vdpa.h > @@ -54,8 +54,8 @@ struct rte_vdpa_dev_ops { > int (*dev_conf)(int vid); > int (*dev_close)(int vid); >=20 > - /** Enable/disable this vring */ > - int (*set_vring_state)(int vid, int vring, int state); > + /** Enable/disable vring queue pairs */ > + int (*set_vring_state)(int vid); If rte_vhost_get_active_vring_num() always needs be called inside set_vring= _state callback, inorder to get the active queue pair number, then why not pass the active q= ueue pair number directly as a parameter to set_vring_state() ? This could help to avoid exp= osing new API. BRs, Xiao >=20 > /** Set features when changed */ > int (*set_features)(int vid); > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.= c > index 0b72648..21028cc 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -1346,8 +1346,6 @@ static int vhost_user_set_vring_err(struct virtio_n= et > **pdev __rte_unused, >=20 > did =3D dev->vdpa_dev_id; > vdpa_dev =3D rte_vdpa_get_device(did); > - if (vdpa_dev && vdpa_dev->ops->set_vring_state) > - vdpa_dev->ops->set_vring_state(dev->vid, index, enable); >=20 > if (dev->notify_ops->vring_state_changed) > dev->notify_ops->vring_state_changed(dev->vid, > @@ -1359,6 +1357,9 @@ static int vhost_user_set_vring_err(struct virtio_n= et > **pdev __rte_unused, >=20 > dev->virtqueue[index]->enabled =3D enable; >=20 > + if (vdpa_dev && vdpa_dev->ops->set_vring_state) > + vdpa_dev->ops->set_vring_state(dev->vid); > + > return RTE_VHOST_MSG_RESULT_OK; > } >=20 > -- > 1.8.3.1