[v3,4/8] vhost: check vDPA configuration succeed

Message ID 20200706112452.1474533-5-amorenoz@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: improve Vhost/vDPA device init |

Checks

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

Commit Message

Adrian Moreno July 6, 2020, 11:24 a.m. UTC
  From: Maxime Coquelin <maxime.coquelin@redhat.com>

This patch checks whether vDPA device configuration
succeed and does not set the CONFIGURED flag if it
didn't.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost_user.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Chenbo Xia July 7, 2020, 3:22 a.m. UTC | #1
> -----Original Message-----
> From: Adrian Moreno <amorenoz@redhat.com>
> Sent: Monday, July 6, 2020 7:25 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; Ye, Xiaolong
> <xiaolong.ye@intel.com>; shahafs@mellanox.com; matan@mellanox.com;
> maxime.coquelin@redhat.com; Wang, Xiao W <xiao.w.wang@intel.com>;
> viacheslavo@mellanox.com
> Cc: jasowang@redhat.com; lulu@redhat.com
> Subject: [PATCH v3 4/8] vhost: check vDPA configuration succeed
> 
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> This patch checks whether vDPA device configuration succeed and does not set
> the CONFIGURED flag if it didn't.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/librte_vhost/vhost_user.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index
> 6be5c771b..bf079c914 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -2849,8 +2849,11 @@ vhost_user_msg_handler(int vid, int fd)
>  		goto out;
> 
>  	if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
> -		vdpa_dev->ops->dev_conf(dev->vid);
> -		dev->flags |= VIRTIO_DEV_VDPA_CONFIGURED;
> +		if (vdpa_dev->ops->dev_conf(dev->vid))
> +			VHOST_LOG_CONFIG(ERR,
> +					 "Failed to configure vDPA device\n")
> +		else
> +			dev->flags |= VIRTIO_DEV_VDPA_CONFIGURED;
>  	}
> 
>  out:
> --
> 2.26.2

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  
Ferruh Yigit July 8, 2020, 1:20 p.m. UTC | #2
On 7/6/2020 12:24 PM, Adrian Moreno wrote:
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> This patch checks whether vDPA device configuration
> succeed and does not set the CONFIGURED flag if it
> didn't.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/librte_vhost/vhost_user.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 6be5c771b..bf079c914 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -2849,8 +2849,11 @@ vhost_user_msg_handler(int vid, int fd)
>  		goto out;
>  
>  	if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
> -		vdpa_dev->ops->dev_conf(dev->vid);
> -		dev->flags |= VIRTIO_DEV_VDPA_CONFIGURED;
> +		if (vdpa_dev->ops->dev_conf(dev->vid))
> +			VHOST_LOG_CONFIG(ERR,
> +					 "Failed to configure vDPA device\n")

';' is missing, which seems added in next patch but breaking build with this
patch. Will fix while merging.
  

Patch

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 6be5c771b..bf079c914 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2849,8 +2849,11 @@  vhost_user_msg_handler(int vid, int fd)
 		goto out;
 
 	if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
-		vdpa_dev->ops->dev_conf(dev->vid);
-		dev->flags |= VIRTIO_DEV_VDPA_CONFIGURED;
+		if (vdpa_dev->ops->dev_conf(dev->vid))
+			VHOST_LOG_CONFIG(ERR,
+					 "Failed to configure vDPA device\n")
+		else
+			dev->flags |= VIRTIO_DEV_VDPA_CONFIGURED;
 	}
 
 out: