patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1 12/21] net/virtio-user: fix device starting failure handling
       [not found] <20221130155639.150553-1-maxime.coquelin@redhat.com>
@ 2022-11-30 15:56 ` Maxime Coquelin
  2023-01-31  5:20   ` Xia, Chenbo
  0 siblings, 1 reply; 2+ messages in thread
From: Maxime Coquelin @ 2022-11-30 15:56 UTC (permalink / raw)
  To: dev, chenbo.xia, david.marchand, eperezma; +Cc: Maxime Coquelin, stable

If the device fails to start, read the status from the
device and return early.

Fixes: 57912824615f ("net/virtio-user: support vhost status setting")
Cc: stable@dpdk.org

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index d32abec327..78b1ed9ace 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -90,10 +90,15 @@ virtio_user_set_status(struct virtio_hw *hw, uint8_t status)
 	if (status & VIRTIO_CONFIG_STATUS_FEATURES_OK &&
 			~old_status & VIRTIO_CONFIG_STATUS_FEATURES_OK)
 		virtio_user_dev_set_features(dev);
-	if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK)
-		virtio_user_start_device(dev);
-	else if (status == VIRTIO_CONFIG_STATUS_RESET)
+
+	if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) {
+		if (virtio_user_start_device(dev)) {
+			virtio_user_dev_update_status(dev);
+			return;
+		}
+	} else if (status == VIRTIO_CONFIG_STATUS_RESET) {
 		virtio_user_reset(hw);
+	}
 
 	virtio_user_dev_set_status(dev, status);
 }
-- 
2.38.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH v1 12/21] net/virtio-user: fix device starting failure handling
  2022-11-30 15:56 ` [PATCH v1 12/21] net/virtio-user: fix device starting failure handling Maxime Coquelin
@ 2023-01-31  5:20   ` Xia, Chenbo
  0 siblings, 0 replies; 2+ messages in thread
From: Xia, Chenbo @ 2023-01-31  5:20 UTC (permalink / raw)
  To: Coquelin, Maxime, dev, david.marchand, eperezma; +Cc: stable

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, November 30, 2022 11:57 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>;
> david.marchand@redhat.com; eperezma@redhat.com
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; stable@dpdk.org
> Subject: [PATCH v1 12/21] net/virtio-user: fix device starting failure
> handling
> 
> If the device fails to start, read the status from the
> device and return early.
> 
> Fixes: 57912824615f ("net/virtio-user: support vhost status setting")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/virtio/virtio_user_ethdev.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_user_ethdev.c
> b/drivers/net/virtio/virtio_user_ethdev.c
> index d32abec327..78b1ed9ace 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -90,10 +90,15 @@ virtio_user_set_status(struct virtio_hw *hw, uint8_t
> status)
>  	if (status & VIRTIO_CONFIG_STATUS_FEATURES_OK &&
>  			~old_status & VIRTIO_CONFIG_STATUS_FEATURES_OK)
>  		virtio_user_dev_set_features(dev);
> -	if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK)
> -		virtio_user_start_device(dev);
> -	else if (status == VIRTIO_CONFIG_STATUS_RESET)
> +
> +	if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) {
> +		if (virtio_user_start_device(dev)) {
> +			virtio_user_dev_update_status(dev);
> +			return;
> +		}
> +	} else if (status == VIRTIO_CONFIG_STATUS_RESET) {
>  		virtio_user_reset(hw);
> +	}
> 
>  	virtio_user_dev_set_status(dev, status);
>  }
> --
> 2.38.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-31  5:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20221130155639.150553-1-maxime.coquelin@redhat.com>
2022-11-30 15:56 ` [PATCH v1 12/21] net/virtio-user: fix device starting failure handling Maxime Coquelin
2023-01-31  5:20   ` Xia, Chenbo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).