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

Yao, Lei A lei.a.yao at intel.com
Wed May 9 04:58:04 CEST 2018



> -----Original Message-----
> From: Hu, Jiayu
> Sent: Tuesday, May 8, 2018 4:15 PM
> To: dev at dpdk.org
> Cc: Bie, Tiwei <tiwei.bie at intel.com>; Yang, Zhiyong
> <zhiyong.yang at intel.com>; maxime.coquelin at redhat.com; Yao, Lei A
> <lei.a.yao at intel.com>; Hu, Jiayu <jiayu.hu at intel.com>
> Subject: [PATCH v2] net/virtio-user: fix feature setting with vhost-net
> backend
> 
> 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 at intel.com>
Tested-by: Lei Yao <lei.a.yao at intel.com>
Tested this patch based on 18.05-rc2. This patch fixed the vhost-net
kernel backend issue with DPDK. 
Basic test with virtio-user server mode is also pass. 
> ---
> changes in v2:
> - remove unnecessary indent change.
> - change commit log.
> 
>  drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index 38b8bc9..2d80188 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",
> @@ -367,6 +367,8 @@ virtio_user_dev_init(struct virtio_user_dev *dev,
> char *path, int queues,
>  				     strerror(errno));
>  			return -1;
>  		}
> +		if (dev->mac_specified)
> +			dev->device_features |= (1ull <<
> VIRTIO_NET_F_MAC);
>  	} else {
>  		/* We just pretend vhost-user can support all these features.
>  		 * Note that this could be problematic that if some feature is
> @@ -376,9 +378,6 @@ virtio_user_dev_init(struct virtio_user_dev *dev,
> char *path, int queues,
>  		dev->device_features =
> VIRTIO_USER_SUPPORTED_FEATURES;
>  	}
> 
> -	if (dev->mac_specified)
> -		dev->device_features |= (1ull << VIRTIO_NET_F_MAC);
> -
>  	if (cq) {
>  		/* device does not really need to know anything about CQ,
>  		 * so if necessary, we just claim to support CQ
> --
> 2.7.4



More information about the dev mailing list