test/telemetry: fix typo at beginning of line
[dpdk.git] / lib / librte_vhost / vhost_user.c
index 1656ec7..8a8726f 100644 (file)
@@ -1235,6 +1235,9 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg,
        for (i = 0; i < dev->nr_vring; i++) {
                struct vhost_virtqueue *vq = dev->virtqueue[i];
 
+               if (!vq)
+                       continue;
+
                if (vq->desc || vq->avail || vq->used) {
                        /*
                         * If the memory table got updated, the ring addresses
@@ -1556,6 +1559,9 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev, VhostUserMsg *msg,
 
        for (i = 0; i < num_queues; i++) {
                vq = dev->virtqueue[i];
+               if (!vq)
+                       continue;
+
                if (vq_is_packed(dev)) {
                        vq->inflight_packed = addr;
                        vq->inflight_packed->desc_num = queue_size;
@@ -1980,9 +1986,9 @@ vhost_user_set_vring_enable(struct virtio_net **pdev,
                "set queue enable: %d to qp idx: %d\n",
                enable, index);
 
-       if (!enable && dev->virtqueue[index]->async_registered) {
+       if (enable && dev->virtqueue[index]->async_registered) {
                if (dev->virtqueue[index]->async_pkts_inflight_n) {
-                       VHOST_LOG_CONFIG(ERR, "failed to disable vring. "
+                       VHOST_LOG_CONFIG(ERR, "failed to enable vring. "
                        "async inflight packets must be completed first\n");
                        return RTE_VHOST_MSG_RESULT_ERR;
                }
@@ -2310,6 +2316,9 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg,
                for (i = 0; i < dev->nr_vring; i++) {
                        struct vhost_virtqueue *vq = dev->virtqueue[i];
 
+                       if (!vq)
+                               continue;
+
                        vhost_user_iotlb_cache_insert(vq, imsg->iova, vva,
                                        len, imsg->perm);
 
@@ -2321,6 +2330,9 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg,
                for (i = 0; i < dev->nr_vring; i++) {
                        struct vhost_virtqueue *vq = dev->virtqueue[i];
 
+                       if (!vq)
+                               continue;
+
                        vhost_user_iotlb_cache_remove(vq, imsg->iova,
                                        imsg->size);