diff mbox

tap: forbid creating multiqueue tap when hub is used

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

Commit Message

Jason Wang Feb. 20, 2013, 9:18 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.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
This patch is needed for 1.4 stable also.
---
 net/tap.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

Paolo Bonzini Feb. 20, 2013, 9:45 a.m. UTC | #1
Il 20/02/2013 10:18, Jason Wang ha scritto:
> 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.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> This patch is needed for 1.4 stable also.

Stefan, please add Cc when committing to the net branch.

Jason, next time please add the Cc yourself to the body.

Paolo

> ---
>  net/tap.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/net/tap.c b/net/tap.c
> index 48c254e..1e14f59 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -693,6 +693,12 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
>      queues = tap->has_queues ? tap->queues : 1;
>      vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
>  
> +    if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) {
> +        error_report("This configuration is not compatiable with multiqueue"
> +                     " tap");
> +        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 ||
>
Jason Wang Feb. 20, 2013, 10:09 a.m. UTC | #2
On 02/20/2013 05:45 PM, Paolo Bonzini wrote:
> Il 20/02/2013 10:18, Jason Wang ha scritto:
>> 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.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> This patch is needed for 1.4 stable also.
> Stefan, please add Cc when committing to the net branch.
>
> Jason, next time please add the Cc yourself to the body.

Sure.
> Paolo
>
>> ---
>>  net/tap.c |    6 ++++++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/net/tap.c b/net/tap.c
>> index 48c254e..1e14f59 100644
>> --- a/net/tap.c
>> +++ b/net/tap.c
>> @@ -693,6 +693,12 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
>>      queues = tap->has_queues ? tap->queues : 1;
>>      vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
>>  
>> +    if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) {
>> +        error_report("This configuration is not compatiable with multiqueue"
>> +                     " tap");
>> +        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 ||
>>
>
Stefan Hajnoczi Feb. 20, 2013, 1:08 p.m. UTC | #3
On Wed, Feb 20, 2013 at 05:18:08PM +0800, Jason Wang wrote:
> diff --git a/net/tap.c b/net/tap.c
> index 48c254e..1e14f59 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -693,6 +693,12 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
>      queues = tap->has_queues ? tap->queues : 1;
>      vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
>  
> +    if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) {
> +        error_report("This configuration is not compatiable with multiqueue"
> +                     " tap");

s/compatiable/compatible/

The error message should be specific, for example, "multiqueue tap
cannot be used with QEMU vlans".

A comment would be nice too to remind readers that peer is only set when
QEMU vlans are in use.  peer is always NULL for -netdev.

Stefan
Jason Wang Feb. 21, 2013, 3:10 a.m. UTC | #4
On 02/20/2013 09:08 PM, Stefan Hajnoczi wrote:
> On Wed, Feb 20, 2013 at 05:18:08PM +0800, Jason Wang wrote:
>> diff --git a/net/tap.c b/net/tap.c
>> index 48c254e..1e14f59 100644
>> --- a/net/tap.c
>> +++ b/net/tap.c
>> @@ -693,6 +693,12 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
>>      queues = tap->has_queues ? tap->queues : 1;
>>      vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
>>  
>> +    if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) {
>> +        error_report("This configuration is not compatiable with multiqueue"
>> +                     " tap");
> s/compatiable/compatible/
>
> The error message should be specific, for example, "multiqueue tap
> cannot be used with QEMU vlans".
>
> A comment would be nice too to remind readers that peer is only set when
> QEMU vlans are in use.  peer is always NULL for -netdev.
>
> Stefan

Sure, will post v2.

Thanks
diff mbox

Patch

diff --git a/net/tap.c b/net/tap.c
index 48c254e..1e14f59 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -693,6 +693,12 @@  int net_init_tap(const NetClientOptions *opts, const char *name,
     queues = tap->has_queues ? tap->queues : 1;
     vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
 
+    if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) {
+        error_report("This configuration is not compatiable with multiqueue"
+                     " tap");
+        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 ||