diff mbox

[V2] tap: forbid creating multiqueue tap when hub is used

Message ID 1361415956-7197-1-git-send-email-jasowang@redhat.com
State New
Headers show

Commit Message

Jason Wang Feb. 21, 2013, 3:05 a.m. UTC
Obviously, hub does not support multiqueue tap. So this patch forbids creating
multiple queue tap when hub is used to prevent the crash when command line such
as "-net tap,queues=2" is used.

Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
Changes from V1:
- Add a comment to explain the reason. (Stefan)
- Use a more specific message. (Stefan)
---
 net/tap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

Stefan Hajnoczi Feb. 21, 2013, 8:44 a.m. UTC | #1
On Thu, Feb 21, 2013 at 11:05:56AM +0800, Jason Wang wrote:
> Obviously, hub does not support multiqueue tap. So this patch forbids creating
> multiple queue tap when hub is used to prevent the crash when command line such
> as "-net tap,queues=2" is used.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> Changes from V1:
> - Add a comment to explain the reason. (Stefan)
> - Use a more specific message. (Stefan)
> ---
>  net/tap.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)

Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net

Stefan
diff mbox

Patch

diff --git a/net/tap.c b/net/tap.c
index 48c254e..daab350 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -693,6 +693,13 @@  int net_init_tap(const NetClientOptions *opts, const char *name,
     queues = tap->has_queues ? tap->queues : 1;
     vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
 
+    /* QEMU vlans does not support multiqueue tap, in this case peer is set.
+     * For -netdev, peer is always NULL. */
+    if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) {
+        error_report("Multiqueue tap cannnot be used with QEMU vlans");
+        return -1;
+    }
+
     if (tap->has_fd) {
         if (tap->has_ifname || tap->has_script || tap->has_downscript ||
             tap->has_vnet_hdr || tap->has_helper || tap->has_queues ||