aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2021-09-03 17:10:15 +0800
committerMichael S. Tsirkin <mst@redhat.com>2021-09-04 17:34:05 -0400
commit6a756d1495fc0a852b119f7ecbb7a20131f0aba7 (patch)
tree30b8653a6b4b81d6091c4b14c88055878346d72b /net
parent5fc13603a6bec4451cf1062ae6bdb6a2ab81a69c (diff)
downloadqemu-6a756d1495fc0a852b119f7ecbb7a20131f0aba7.zip
qemu-6a756d1495fc0a852b119f7ecbb7a20131f0aba7.tar.gz
qemu-6a756d1495fc0a852b119f7ecbb7a20131f0aba7.tar.bz2
vhost_net: do not assume nvqs is always 2
This patch switches to initialize dev.nvqs from the VhostNetOptions instead of assuming it was 2. This is useful for implementing control virtqueue support which will be a single vhost_net structure with a single cvq. Note that nvqs is still set to 2 for all users and this patch does not change functionality. Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Eli Cohen <elic@nvidia.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20210903091031.47303-6-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/tap.c1
-rw-r--r--net/vhost-user.c1
-rw-r--r--net/vhost-vdpa.c1
3 files changed, 3 insertions, 0 deletions
diff --git a/net/tap.c b/net/tap.c
index f5686bb..f716be3 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -749,6 +749,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
qemu_set_nonblock(vhostfd);
}
options.opaque = (void *)(uintptr_t)vhostfd;
+ options.nvqs = 2;
s->vhost_net = vhost_net_init(&options);
if (!s->vhost_net) {
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 6adfcd6..4a93912 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -85,6 +85,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[],
options.net_backend = ncs[i];
options.opaque = be;
options.busyloop_timeout = 0;
+ options.nvqs = 2;
net = vhost_net_init(&options);
if (!net) {
error_report("failed to init vhost_net for queue %d", i);
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 7282988..395117d 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -104,6 +104,7 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be)
options.net_backend = ncs;
options.opaque = be;
options.busyloop_timeout = 0;
+ options.nvqs = 2;
net = vhost_net_init(&options);
if (!net) {