[v4,8/8] vhost: improve vDPA blk device configure condition

Message ID 1665650674-291949-9-git-send-email-andy.pei@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series vdpa/ifc: add multi queue support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed

Commit Message

Pei, Andy Oct. 13, 2022, 8:44 a.m. UTC
  To support multi-queue, configure device 
after call fd of all queues are set.

Signed-off-by: Andy Pei <andy.pei@intel.com>
Signed-off-by: Huang Wei <wei.huang@intel.com>
---
 lib/vhost/vhost_user.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
  

Comments

Chenbo Xia Oct. 17, 2022, 6:35 a.m. UTC | #1
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Thursday, October 13, 2022 4:45 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> Huang, Wei <wei.huang@intel.com>; Cao, Gang <gang.cao@intel.com>;
> maxime.coquelin@redhat.com
> Subject: [PATCH v4 8/8] vhost: improve vDPA blk device configure condition
> 
> To support multi-queue, configure device
> after call fd of all queues are set.
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> Signed-off-by: Huang Wei <wei.huang@intel.com>
> ---
>  lib/vhost/vhost_user.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 0509025..3ede83f 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -2965,6 +2965,7 @@ static int is_vring_iotlb(struct virtio_net *dev,
>  	uint32_t vdpa_type = -1;
>  	uint32_t request;
>  	uint32_t i;
> +	uint16_t blk_call_fd;
> 
>  	dev = get_device(vid);
>  	if (dev == NULL)
> @@ -3191,9 +3192,15 @@ static int is_vring_iotlb(struct virtio_net *dev,
>  	if (!vdpa_dev)
>  		goto out;
> 
> -	if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK
> -		&& request != VHOST_USER_SET_VRING_CALL)
> -		goto out;
> +	if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK) {
> +		if (request == VHOST_USER_SET_VRING_CALL) {
> +			blk_call_fd = ctx.msg.payload.u64 &
> VHOST_USER_VRING_IDX_MASK;
> +			if (blk_call_fd != dev->nr_vring - 1)
> +				goto out;
> +		} else {
> +			goto out;
> +		}
> +	}
> 
>  	if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
>  		if (vdpa_dev->ops->dev_conf(dev->vid))
> --
> 1.8.3.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  
Pei, Andy Oct. 17, 2022, 7:12 a.m. UTC | #2
Hi Chenbo,

Thanks for your efforts.

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Monday, October 17, 2022 2:35 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Huang, Wei <wei.huang@intel.com>;
> Cao, Gang <gang.cao@intel.com>; maxime.coquelin@redhat.com
> Subject: RE: [PATCH v4 8/8] vhost: improve vDPA blk device configure
> condition
> 
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Thursday, October 13, 2022 4:45 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; Xu, Rosen
> > <rosen.xu@intel.com>; Huang, Wei <wei.huang@intel.com>; Cao, Gang
> > <gang.cao@intel.com>; maxime.coquelin@redhat.com
> > Subject: [PATCH v4 8/8] vhost: improve vDPA blk device configure
> > condition
> >
> > To support multi-queue, configure device after call fd of all queues
> > are set.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > Signed-off-by: Huang Wei <wei.huang@intel.com>
> > ---
> >  lib/vhost/vhost_user.c | 13 ++++++++++---
> >  1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index
> > 0509025..3ede83f 100644
> > --- a/lib/vhost/vhost_user.c
> > +++ b/lib/vhost/vhost_user.c
> > @@ -2965,6 +2965,7 @@ static int is_vring_iotlb(struct virtio_net *dev,
> >  	uint32_t vdpa_type = -1;
> >  	uint32_t request;
> >  	uint32_t i;
> > +	uint16_t blk_call_fd;
> >
> >  	dev = get_device(vid);
> >  	if (dev == NULL)
> > @@ -3191,9 +3192,15 @@ static int is_vring_iotlb(struct virtio_net *dev,
> >  	if (!vdpa_dev)
> >  		goto out;
> >
> > -	if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK
> > -		&& request != VHOST_USER_SET_VRING_CALL)
> > -		goto out;
> > +	if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK) {
> > +		if (request == VHOST_USER_SET_VRING_CALL) {
> > +			blk_call_fd = ctx.msg.payload.u64 &
> > VHOST_USER_VRING_IDX_MASK;
> > +			if (blk_call_fd != dev->nr_vring - 1)
> > +				goto out;
> > +		} else {
> > +			goto out;
> > +		}
> > +	}
> >
> >  	if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
> >  		if (vdpa_dev->ops->dev_conf(dev->vid))
> > --
> > 1.8.3.1
> 
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  

Patch

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 0509025..3ede83f 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -2965,6 +2965,7 @@  static int is_vring_iotlb(struct virtio_net *dev,
 	uint32_t vdpa_type = -1;
 	uint32_t request;
 	uint32_t i;
+	uint16_t blk_call_fd;
 
 	dev = get_device(vid);
 	if (dev == NULL)
@@ -3191,9 +3192,15 @@  static int is_vring_iotlb(struct virtio_net *dev,
 	if (!vdpa_dev)
 		goto out;
 
-	if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK
-		&& request != VHOST_USER_SET_VRING_CALL)
-		goto out;
+	if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK) {
+		if (request == VHOST_USER_SET_VRING_CALL) {
+			blk_call_fd = ctx.msg.payload.u64 & VHOST_USER_VRING_IDX_MASK;
+			if (blk_call_fd != dev->nr_vring - 1)
+				goto out;
+		} else {
+			goto out;
+		}
+	}
 
 	if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
 		if (vdpa_dev->ops->dev_conf(dev->vid))