[dpdk-dev] [PATCH 9/9] vhost: only use vDPA config workaround if needed

Maxime Coquelin maxime.coquelin at redhat.com
Thu May 14 10:02:18 CEST 2020


Now that we have Virtio device status support, let's
only use the vDPA workaround if it is not supported.

This patch also document why Virtio device status
protocol feature support is strongly advised.

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

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index e5a44be58d..67e96a872a 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2847,8 +2847,20 @@ vhost_user_msg_handler(int vid, int fd)
 	if (!vdpa_dev)
 		goto out;
 
-	if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED) &&
-			request == VHOST_USER_SET_VRING_CALL) {
+	if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
+		/*
+		 * Workaround when Virtio device status protocol
+		 * feature is not supported, wait for SET_VRING_CALL
+		 * request. This is not ideal as some frontends like
+		 * Virtio-user may not send this request, so vDPA device
+		 * may never be configured. Virtio device status support
+		 * on frontend side is strongly advised.
+		 */
+		if (!(dev->protocol_features &
+				(1ULL << VHOST_USER_PROTOCOL_F_STATUS)) &&
+				(request != VHOST_USER_SET_VRING_CALL))
+			goto out;
+
 		if (vdpa_dev->ops->dev_conf(dev->vid))
 			VHOST_LOG_CONFIG(ERR,
 					"Failed to configure vDPA device\n");
-- 
2.25.4



More information about the dev mailing list