vhost-user: send set log base message only once
authorYajun Wu <yajunw@nvidia.com>
Tue, 22 Nov 2022 05:14:47 +0000 (13:14 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 21 Dec 2022 11:35:28 +0000 (06:35 -0500)
Vhost message VHOST_USER_SET_LOG_BASE is device wide. So only
send it once with the first queue pair.

Signed-off-by: Yajun Wu <yajunw@nvidia.com>
Acked-by: Parav Pandit <parav@nvidia.com>
Message-Id: <20221122051447.248462-1-yajunw@nvidia.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/vhost-user.c

index b8aaa99ab5dd7a9bb72b4091822f6daae6dd57c1..d9ce0501b2c75add7faf8628ec496082195f5922 100644 (file)
@@ -527,6 +527,11 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
         .hdr.size = sizeof(msg.payload.log),
     };
 
+    /* Send only once with first queue pair */
+    if (dev->vq_index != 0) {
+        return 0;
+    }
+
     if (shmfd && log->fd != -1) {
         fds[fd_num++] = log->fd;
     }