[dpdk-dev,v3] net/virtio-user: fix feature setting with vhost-net backend

Message ID 1526023567-111448-1-git-send-email-jiayu.hu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Hu, Jiayu May 11, 2018, 7:26 a.m. UTC
  When the backend is vhost-net, virtio-user must work in client mode and
needs to request features from the backend in virtio_user_dev_init().
But currently, virtio-user is assigned to default features in this case.

This patch is to fix this inappropriate feature setting.

Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Tested-by: Lei Yao <lei.a.yao@intel.com>
---
changes in v3:
- remove unnecessary code change.
changes in v2:
- remove unnecessary indent change.
- change commit log.

 drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tiwei Bie May 11, 2018, 7:33 a.m. UTC | #1
On Fri, May 11, 2018 at 03:26:07PM +0800, Jiayu Hu wrote:
> When the backend is vhost-net, virtio-user must work in client mode and
> needs to request features from the backend in virtio_user_dev_init().
> But currently, virtio-user is assigned to default features in this case.
> 
> This patch is to fix this inappropriate feature setting.
> 
> Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> Tested-by: Lei Yao <lei.a.yao@intel.com>
> ---
> changes in v3:
> - remove unnecessary code change.
> changes in v2:
> - remove unnecessary indent change.
> - change commit log.
> 
>  drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index 38b8bc9..f8ef7e2 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -353,7 +353,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
>  		return -1;
>  	}
>  
> -	if (dev->vhostfd >= 0) {
> +	if (!dev->is_server) {
>  		if (dev->ops->send_request(dev, VHOST_USER_SET_OWNER,
>  					   NULL) < 0) {
>  			PMD_INIT_LOG(ERR, "set_owner fails: %s",
> -- 
> 2.7.4
> 

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
  
Yang, Zhiyong May 11, 2018, 7:45 a.m. UTC | #2
> -----Original Message-----

> From: Bie, Tiwei

> Sent: Friday, May 11, 2018 3:33 PM

> To: Hu, Jiayu <jiayu.hu@intel.com>

> Cc: dev@dpdk.org; Yang, Zhiyong <zhiyong.yang@intel.com>

> Subject: Re: [PATCH v3] net/virtio-user: fix feature setting with vhost-net

> backend

> 

> On Fri, May 11, 2018 at 03:26:07PM +0800, Jiayu Hu wrote:

> > When the backend is vhost-net, virtio-user must work in client mode

> > and needs to request features from the backend in virtio_user_dev_init().

> > But currently, virtio-user is assigned to default features in this case.

> >

> > This patch is to fix this inappropriate feature setting.

> >

> > Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")

> > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>

> > Tested-by: Lei Yao <lei.a.yao@intel.com>

> > ---

> > changes in v3:

> > - remove unnecessary code change.

> > changes in v2:

> > - remove unnecessary indent change.

> > - change commit log.

> >

> >  drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> >


Reviewed-by: Zhiyong Yang <zhyong.yang@intel.com>
  
Maxime Coquelin May 16, 2018, 6:05 a.m. UTC | #3
On 05/11/2018 09:26 AM, Jiayu Hu wrote:
> When the backend is vhost-net, virtio-user must work in client mode and
> needs to request features from the backend in virtio_user_dev_init().
> But currently, virtio-user is assigned to default features in this case.
> 
> This patch is to fix this inappropriate feature setting.
> 
> Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> Tested-by: Lei Yao <lei.a.yao@intel.com>
> ---
> changes in v3:
> - remove unnecessary code change.
> changes in v2:
> - remove unnecessary indent change.
> - change commit log.
> 
>   drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 


Applied to dpdk-next-virtio/master.

Thanks!
Maxime
  

Patch

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 38b8bc9..f8ef7e2 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -353,7 +353,7 @@  virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 		return -1;
 	}
 
-	if (dev->vhostfd >= 0) {
+	if (!dev->is_server) {
 		if (dev->ops->send_request(dev, VHOST_USER_SET_OWNER,
 					   NULL) < 0) {
 			PMD_INIT_LOG(ERR, "set_owner fails: %s",