diff mbox

[2/2] kvmtool: Restrict virtio queue number to 1 when vhost on

Message ID 1437447928-24286-3-git-send-email-fan.du@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Du, Fan July 21, 2015, 3:05 a.m. UTC
vhost kernel driver does not support mutiple queue yet,
Tweak queue number will fail with "--net mode=tap,vhost=1,mq=2"
as below when lkvm trying to set ring kick fd for queue 2:

VHOST_SET_VRING_KICK failed: No buffer space available

Error on this scenario, and overide with the default one queue
configuration.

Signed-off-by: Fan Du <fan.du@intel.com>
---
 virtio/net.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox

Patch

diff --git a/virtio/net.c b/virtio/net.c
index 55dd9d9..78199b9 100644
--- a/virtio/net.c
+++ b/virtio/net.c
@@ -731,6 +731,10 @@  static int set_net_param(struct kvm *kvm, struct virtio_net_params *p,
 		p->mq = atoi(val);
 	} else
 		die("Unknown network parameter %s", param);
+	if (p->vhost && p->mq > 1) {
+		p->mq = 1;
+		pr_err("vhost does not support mq yet, overide mq to 1.");
+	}
 
 	return 0;
 }