[dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnect

Maxime Coquelin maxime.coquelin at redhat.com
Tue Oct 20 18:42:33 CEST 2020



On 10/20/20 5:20 PM, Adrian Moreno wrote:
> Newer vhost-user backends will rely on SET_STATUS to start the device
> so this required to support them.
> 
> Fixes: 57912824615f ("net/virtio-user: support vhost status setting")
> Cc: maxime.coquelin at redhat.com
> Cc: stable at dpdk.org
> 
> Signed-off-by: Adrian Moreno <amorenoz at redhat.com>
> ---
>  drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
> index e870fb2ff..d8bea4537 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
>  		return -1;
>  
>  	dev->vhostfd = connectfd;
> +
> +	vtpci_reset(hw);
> +
> +	vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK);
> +
> +	vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
> +
>  	if (dev->ops->send_request(dev, VHOST_USER_GET_FEATURES,
>  				   &dev->device_features) < 0) {
>  		PMD_INIT_LOG(ERR, "get_features failed: %s",
> @@ -111,6 +118,8 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
>  
>  	dev->features &= dev->device_features;
>  
> +	vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK);
> +
>  	/* For packed ring, resetting queues is required in reconnection. */
>  	if (vtpci_packed_queue(hw) &&
>  	   (vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_DRIVER_OK)) {
> @@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
>  		virtio_user_reset_queues_packed(eth_dev);
>  	}
>  
> -	ret = virtio_user_start_device(dev);
> -	if (ret < 0)
> +	/*  Start the device */
> +	vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER_OK);
> +	if (!dev->started)
>  		return -1;
>  
>  	if (dev->queue_pairs > 1) {
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Thanks,
Maxime



More information about the dev mailing list