vhost: fix inflight resubmit check
authorJin Yu <jin.yu@intel.com>
Wed, 25 Dec 2019 14:18:35 +0000 (22:18 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 14 Feb 2020 11:42:13 +0000 (12:42 +0100)
The frontend may not send the get_inflight_fd and
set_inflight_fd although we negotiate the protocol
feature. When we meet this situation just return OK.

Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information")
Cc: stable@dpdk.org
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost_user.c

index 91482cc..9a7b8b3 100644 (file)
@@ -1645,8 +1645,11 @@ vhost_check_queue_inflights_split(struct virtio_net *dev,
            (1ULL << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)))
                return RTE_VHOST_MSG_RESULT_OK;
 
+       /* The frontend may still not support the inflight feature
+        * although we negotiate the protocol feature.
+        */
        if ((!vq->inflight_split))
-               return RTE_VHOST_MSG_RESULT_ERR;
+               return RTE_VHOST_MSG_RESULT_OK;
 
        if (!vq->inflight_split->version) {
                vq->inflight_split->version = INFLIGHT_VERSION;
@@ -1726,8 +1729,11 @@ vhost_check_queue_inflights_packed(struct virtio_net *dev,
            (1ULL << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)))
                return RTE_VHOST_MSG_RESULT_OK;
 
+       /* The frontend may still not support the inflight feature
+        * although we negotiate the protocol feature.
+        */
        if ((!vq->inflight_packed))
-               return RTE_VHOST_MSG_RESULT_ERR;
+               return RTE_VHOST_MSG_RESULT_OK;
 
        if (!vq->inflight_packed->version) {
                vq->inflight_packed->version = INFLIGHT_VERSION;