vhost: skip access lock when vDPA is configured
authorMatan Azrad <matan@mellanox.com>
Mon, 29 Jun 2020 14:08:17 +0000 (14:08 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 30 Jun 2020 12:52:30 +0000 (14:52 +0200)
No need to take access lock in the vhost-user message handler when
vDPA driver controls all the data-path of the vhost device.

It allows the vDPA set_vring_state operation callback to configure
guest notifications.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
lib/librte_vhost/vhost_user.c

index c08f506..4349506 100644 (file)
@@ -2683,8 +2683,10 @@ vhost_user_msg_handler(int vid, int fd)
        case VHOST_USER_SEND_RARP:
        case VHOST_USER_NET_SET_MTU:
        case VHOST_USER_SET_SLAVE_REQ_FD:
-               vhost_user_lock_all_queue_pairs(dev);
-               unlock_required = 1;
+               if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
+                       vhost_user_lock_all_queue_pairs(dev);
+                       unlock_required = 1;
+               }
                break;
        default:
                break;