All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tap-win32: don't abort in tap_enable(); enables -netdev tap
@ 2017-03-24 23:46 Andrew Baumann
  2017-03-28 18:28 ` [Qemu-devel] [PATCH for 2.9?] " Stefan Weil
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Baumann @ 2017-03-24 23:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Weil, Jason Wang, Andrew Baumann

The docs generally steer users away from using the legacy -net
parameter, however on win32 attempting to enable a tap device using
-netdev tap fails at an abort() in tap_enable(). Removing the abort()s
seems to be enough to get everything working, so do that.

Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
---
 net/tap-win32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/tap-win32.c b/net/tap-win32.c
index 662f9b6..3620843 100644
--- a/net/tap-win32.c
+++ b/net/tap-win32.c
@@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char *name,
 
 int tap_enable(NetClientState *nc)
 {
-    abort();
+    return 0;
 }
 
 int tap_disable(NetClientState *nc)
 {
-    abort();
+    return 0;
 }
-- 
2.8.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.9?] tap-win32: don't abort in tap_enable(); enables -netdev tap
  2017-03-24 23:46 [Qemu-devel] [PATCH] tap-win32: don't abort in tap_enable(); enables -netdev tap Andrew Baumann
@ 2017-03-28 18:28 ` Stefan Weil
  2017-03-28 18:55   ` Andrew Baumann
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2017-03-28 18:28 UTC (permalink / raw)
  To: Andrew Baumann, qemu-devel; +Cc: Jason Wang

Am 25.03.2017 um 00:46 schrieb Andrew Baumann:
> The docs generally steer users away from using the legacy -net
> parameter, however on win32 attempting to enable a tap device using
> -netdev tap fails at an abort() in tap_enable(). Removing the abort()s
> seems to be enough to get everything working, so do that.
>
> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> ---
>  net/tap-win32.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/tap-win32.c b/net/tap-win32.c
> index 662f9b6..3620843 100644
> --- a/net/tap-win32.c
> +++ b/net/tap-win32.c
> @@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char *name,
>
>  int tap_enable(NetClientState *nc)
>  {
> -    abort();
> +    return 0;
>  }
>
>  int tap_disable(NetClientState *nc)
>  {
> -    abort();
> +    return 0;
>  }

As I never worked with TAP on Windows, I cannot say much to this fix.

Jason, what is the use of tap_enable, tap_disable? Is it fine
to simply do nothing on Windows here?

And is this something for QEMU‌ 2.9 (I added question to subject line)?

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.9?] tap-win32: don't abort in tap_enable(); enables -netdev tap
  2017-03-28 18:28 ` [Qemu-devel] [PATCH for 2.9?] " Stefan Weil
@ 2017-03-28 18:55   ` Andrew Baumann
  2017-03-29  2:38     ` Jason Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Baumann @ 2017-03-28 18:55 UTC (permalink / raw)
  To: Stefan Weil, qemu-devel; +Cc: Jason Wang

> From: Stefan Weil [mailto:sw@weilnetz.de]
> Sent: Tuesday, 28 March 2017 11:28

> Am 25.03.2017 um 00:46 schrieb Andrew Baumann:
> > The docs generally steer users away from using the legacy -net
> > parameter, however on win32 attempting to enable a tap device using
> > -netdev tap fails at an abort() in tap_enable(). Removing the abort()s
> > seems to be enough to get everything working, so do that.
> >
> > Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> > ---
> >  net/tap-win32.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/tap-win32.c b/net/tap-win32.c
> > index 662f9b6..3620843 100644
> > --- a/net/tap-win32.c
> > +++ b/net/tap-win32.c
> > @@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char
> *name,
> >
> >  int tap_enable(NetClientState *nc)
> >  {
> > -    abort();
> > +    return 0;
> >  }
> >
> >  int tap_disable(NetClientState *nc)
> >  {
> > -    abort();
> > +    return 0;
> >  }
> 
> As I never worked with TAP on Windows, I cannot say much to this fix.
> 
> Jason, what is the use of tap_enable, tap_disable? Is it fine
> to simply do nothing on Windows here?

I was also hoping for a review -- I'm no expert on this stuff either, but my quick reading of those code paths is that they issue ioctls to enable/disable packet reception on the underlying tap device. As win32 TAP is implemented, that is already enabled from start of day.

It's possible this patch still does not permit dynamic reconfiguration of tap devices (e.g. from the monitor console). However, it does work with the -netdev tap option on the command-line.

> And is this something for QEMU‌ 2.9 (I added question to subject line)?

Ideally, yes. If not, -netdev tap will continue to blow up in the abort as it does today...

Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.9?] tap-win32: don't abort in tap_enable(); enables -netdev tap
  2017-03-28 18:55   ` Andrew Baumann
@ 2017-03-29  2:38     ` Jason Wang
  2017-03-29  4:13       ` Andrew Baumann
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Wang @ 2017-03-29  2:38 UTC (permalink / raw)
  To: Andrew Baumann, Stefan Weil, qemu-devel



On 2017年03月29日 02:55, Andrew Baumann wrote:
>> From: Stefan Weil [mailto:sw@weilnetz.de]
>> Sent: Tuesday, 28 March 2017 11:28
>> Am 25.03.2017 um 00:46 schrieb Andrew Baumann:
>>> The docs generally steer users away from using the legacy -net
>>> parameter, however on win32 attempting to enable a tap device using
>>> -netdev tap fails at an abort() in tap_enable(). Removing the abort()s
>>> seems to be enough to get everything working, so do that.
>>>
>>> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
>>> ---
>>>   net/tap-win32.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/net/tap-win32.c b/net/tap-win32.c
>>> index 662f9b6..3620843 100644
>>> --- a/net/tap-win32.c
>>> +++ b/net/tap-win32.c
>>> @@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char
>> *name,
>>>   int tap_enable(NetClientState *nc)
>>>   {
>>> -    abort();
>>> +    return 0;
>>>   }
>>>
>>>   int tap_disable(NetClientState *nc)
>>>   {
>>> -    abort();
>>> +    return 0;
>>>   }
>> As I never worked with TAP on Windows, I cannot say much to this fix.
>>
>> Jason, what is the use of tap_enable, tap_disable?

It should be only used when we want to enable and disable a specific 
queue of a multiqueue supported tap.

>>   Is it fine
>> to simply do nothing on Windows here?

Unless windows support multiqueue tap, we should keep the assert here.

> I was also hoping for a review -- I'm no expert on this stuff either, but my quick reading of those code paths is that they issue ioctls to enable/disable packet reception on the underlying tap device. As win32 TAP is implemented, that is already enabled from start of day.
>
> It's possible this patch still does not permit dynamic reconfiguration of tap devices (e.g. from the monitor console). However, it does work with the -netdev tap option on the command-line.
>
>> And is this something for QEMU‌ 2.9 (I added question to subject line)?
> Ideally, yes. If not, -netdev tap will continue to blow up in the abort as it does today...
>
> Andrew

Yes, so the problem is we should prevent tap_enable() and tap_disable() 
from being called if multiqueue is disabled.

I believe the following patch can fix this issue, could you give a try 
on this?

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index c321680..7d091c9 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -510,6 +510,10 @@ static int peer_attach(VirtIONet *n, int index)
          return 0;
      }

+    if (n->max_queues == 1) {
+        return 0;
+    }
+
      return tap_enable(nc->peer);
  }

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.9?] tap-win32: don't abort in tap_enable(); enables -netdev tap
  2017-03-29  2:38     ` Jason Wang
@ 2017-03-29  4:13       ` Andrew Baumann
  2017-03-29  4:48         ` Jason Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Baumann @ 2017-03-29  4:13 UTC (permalink / raw)
  To: Jason Wang, Stefan Weil, qemu-devel

> From: Jason Wang [mailto:jasowang@redhat.com]
> Sent: Tuesday, 28 March 2017 19:39
> 
> On 2017年03月29日 02:55, Andrew Baumann wrote:
> >> From: Stefan Weil [mailto:sw@weilnetz.de]
> >> Sent: Tuesday, 28 March 2017 11:28
> >> Am 25.03.2017 um 00:46 schrieb Andrew Baumann:
> >>> The docs generally steer users away from using the legacy -net
> >>> parameter, however on win32 attempting to enable a tap device using
> >>> -netdev tap fails at an abort() in tap_enable(). Removing the abort()s
> >>> seems to be enough to get everything working, so do that.
> >>>
> >>> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
[...]
> >> Jason, what is the use of tap_enable, tap_disable?
> 
> It should be only used when we want to enable and disable a specific
> queue of a multiqueue supported tap.
> 
> >>   Is it fine
> >> to simply do nothing on Windows here?
> 
> Unless windows support multiqueue tap, we should keep the assert here.
> 
> > I was also hoping for a review -- I'm no expert on this stuff either, but my
> quick reading of those code paths is that they issue ioctls to enable/disable
> packet reception on the underlying tap device. As win32 TAP is implemented,
> that is already enabled from start of day.
> >
> > It's possible this patch still does not permit dynamic reconfiguration of tap
> devices (e.g. from the monitor console). However, it does work with the -
> netdev tap option on the command-line.
> >
> >> And is this something for QEMU‌ 2.9 (I added question to subject line)?
> > Ideally, yes. If not, -netdev tap will continue to blow up in the abort as it does
> today...
> >
> > Andrew
> 
> Yes, so the problem is we should prevent tap_enable() and tap_disable()
> from being called if multiqueue is disabled.
> 
> I believe the following patch can fix this issue, could you give a try
> on this?
> 
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index c321680..7d091c9 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -510,6 +510,10 @@ static int peer_attach(VirtIONet *n, int index)
>           return 0;
>       }
> 
> +    if (n->max_queues == 1) {
> +        return 0;
> +    }
> +
>       return tap_enable(nc->peer);
>   }
> 

Yep, this works. Thanks!

Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.9?] tap-win32: don't abort in tap_enable(); enables -netdev tap
  2017-03-29  4:13       ` Andrew Baumann
@ 2017-03-29  4:48         ` Jason Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2017-03-29  4:48 UTC (permalink / raw)
  To: Andrew Baumann, Stefan Weil, qemu-devel



On 2017年03月29日 12:13, Andrew Baumann via Qemu-devel wrote:
>> From: Jason Wang [mailto:jasowang@redhat.com]
>> Sent: Tuesday, 28 March 2017 19:39
>>
>> On 2017年03月29日 02:55, Andrew Baumann wrote:
>>>> From: Stefan Weil [mailto:sw@weilnetz.de]
>>>> Sent: Tuesday, 28 March 2017 11:28
>>>> Am 25.03.2017 um 00:46 schrieb Andrew Baumann:
>>>>> The docs generally steer users away from using the legacy -net
>>>>> parameter, however on win32 attempting to enable a tap device using
>>>>> -netdev tap fails at an abort() in tap_enable(). Removing the abort()s
>>>>> seems to be enough to get everything working, so do that.
>>>>>
>>>>> Signed-off-by: Andrew Baumann<Andrew.Baumann@microsoft.com>
> [...]
>>>> Jason, what is the use of tap_enable, tap_disable?
>> It should be only used when we want to enable and disable a specific
>> queue of a multiqueue supported tap.
>>
>>>>    Is it fine
>>>> to simply do nothing on Windows here?
>> Unless windows support multiqueue tap, we should keep the assert here.
>>
>>> I was also hoping for a review -- I'm no expert on this stuff either, but my
>> quick reading of those code paths is that they issue ioctls to enable/disable
>> packet reception on the underlying tap device. As win32 TAP is implemented,
>> that is already enabled from start of day.
>>> It's possible this patch still does not permit dynamic reconfiguration of tap
>> devices (e.g. from the monitor console). However, it does work with the -
>> netdev tap option on the command-line.
>>>> And is this something for QEMU‌ 2.9 (I added question to subject line)?
>>> Ideally, yes. If not, -netdev tap will continue to blow up in the abort as it does
>> today...
>>> Andrew
>> Yes, so the problem is we should prevent tap_enable() and tap_disable()
>> from being called if multiqueue is disabled.
>>
>> I believe the following patch can fix this issue, could you give a try
>> on this?
>>
>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>> index c321680..7d091c9 100644
>> --- a/hw/net/virtio-net.c
>> +++ b/hw/net/virtio-net.c
>> @@ -510,6 +510,10 @@ static int peer_attach(VirtIONet *n, int index)
>>            return 0;
>>        }
>>
>> +    if (n->max_queues == 1) {
>> +        return 0;
>> +    }
>> +
>>        return tap_enable(nc->peer);
>>    }
>>
> Yep, this works. Thanks!
>
> Andrew

Thanks, queued this for 2.9.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-29  4:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 23:46 [Qemu-devel] [PATCH] tap-win32: don't abort in tap_enable(); enables -netdev tap Andrew Baumann
2017-03-28 18:28 ` [Qemu-devel] [PATCH for 2.9?] " Stefan Weil
2017-03-28 18:55   ` Andrew Baumann
2017-03-29  2:38     ` Jason Wang
2017-03-29  4:13       ` Andrew Baumann
2017-03-29  4:48         ` Jason Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.