tap-win32: don't abort in tap_enable(); enables -netdev tap
PATCH 1/1 tap-win32: don't abort in tap_enable(); enables -netdev tap
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.
--- net/tap-win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/tap-win32.c +2 -2
@@ -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 ; }
Signature · 1 line
2.8.3
Am 25.03.2017 um 00:46 schrieb Andrew Baumann:
Quoted 17 lines
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()intap_enable(). Removing the abort()s seems to be enough to get everything working, so do that.Signed-off-by Andrew Baumann <[email protected]>--- net/tap-win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/tap-win32.c +0
-0@@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char *name,int tap_enable (NetClientState *nc)
net/tap-win32.c int net_init_tap(const Netdev *netdev, const char *name, · line 820
Quoted 10 lines
net/tap-win32.c +2
-2{ -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
Quoted 33 lines
From: Stefan Weil [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 11:28Am 25.03.2017 um 00:46 schrieb Andrew Baumann:
net/tap-win32.c int net_init_tap(const Netdev *netdev, const char
Quoted 15 lines
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()intap_enable(). Removing the abort()s seems to be enough to get everything working, so do that.Signed-off-by Andrew Baumann <[email protected]>--- net/tap-win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/tap-win32.c +0
-0@@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char*name,
net/tap-win32.c int net_init_tap(const Netdev *netdev, const char *name, · line 820
Quoted 12 lines
net/tap-win32.c +2
-2int tap_enable (NetClientState *nc) { -abort (); +return 0 ; }int tap_disable (NetClientState *nc) { -abort (); +return 0 ; }
Quoted 4 lines
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.
Quoted 1 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
Quoted 25 lines · Andrew Baumann
Quoted 25 lines
From: Stefan Weil [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 11:28
Am 25.03.2017 um 00:46 schrieb Andrew Baumann:net/tap-win32.c int net_init_tap(const Netdev *netdev, const char
Quoted 15 lines
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()intap_enable(). Removing the abort()s seems to be enough to get everything working, so do that.Signed-off-by Andrew Baumann <[email protected]>--- net/tap-win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/tap-win32.c +0
-0@@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char*name,
Quoted 6 lines
net/tap-win32.c +1
-1int tap_enable (NetClientState *nc) { -abort (); +return 0 ; }
Quoted 8 lines
Quoted 8 lines
net/tap-win32.c int net_init_tap(const Netdev *netdev, const char · line 819
Quoted 5 lines
net/tap-win32.c +1
-1int 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.
Quoted 2 lines
Quoted 2 lines
Is it fine
to simply do nothing on Windows here?
Unless windows support multiqueue tap, we should keep the assert here.
Quoted 8 lines
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.
Quoted 1 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?
hw/net/virtio-net.c +4 -0
@@ -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); }
Quoted 13 lines
From: Jason Wang [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 19:39Quoted 9 lines · Andrew Baumann
Quoted 9 lines
From: Stefan Weil [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 11:28
Am 25.03.2017 um 00:46 schrieb Andrew Baumann:Quoted 6 lines
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()intap_enable(). Removing the abort()s seems to be enough to get everything working, so do that.Signed-off-by Andrew Baumann <[email protected]>
[...]
Quoted 36 lines
Quoted 1 line
Quoted 1 line
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.
Quoted 2 lines
Quoted 2 lines
Is it fine
to simply do nothing on Windows here?Unless windows support multiqueue tap, we should keep the assert here.
Quoted 1 line
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.
Quoted 2 lines
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.
Quoted 3 lines
Quoted 2 lines
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...
Quoted 2 lines
Andrew
Yes, so the problem is we should prevent
tap_enable()andtap_disable()from being called if multiqueue is disabled.I believe the following patch can fix this issue, could you give a try on this?
hw/net/virtio-net.c +0
-0
hw/net/virtio-net.c static int peer_attach(VirtIONet *n, int index) · line 519
Quoted 10 lines
hw/net/virtio-net.c +4
-0@@ -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
Quoted 56 lines · Andrew Baumann via Qemu-devel
Quoted 13 lines
From: Jason Wang [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 19:39Quoted 9 lines · Andrew Baumann
Quoted 9 lines
From: Stefan Weil [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 11:28
Am 25.03.2017 um 00:46 schrieb Andrew Baumann:Quoted 6 lines
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()intap_enable(). Removing the abort()s seems to be enough to get everything working, so do that.Signed-off-by Andrew Baumann<[email protected]>[...]
Quoted 30 lines
Quoted 1 line
Quoted 1 line
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.
Quoted 2 lines
Quoted 2 lines
Is it fine
to simply do nothing on Windows here?Unless windows support multiqueue tap, we should keep the assert here.
Quoted 1 line
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.
Quoted 1 line
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.
Quoted 2 lines
Quoted 1 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...
Quoted 1 line
Andrew
Yes, so the problem is we should prevent
tap_enable()andtap_disable()from being called if multiqueue is disabled.I believe the following patch can fix this issue, could you give a try on this?
hw/net/virtio-net.c +0
-0hw/net/virtio-net.c static int peer_attach(VirtIONet *n, int index) · line 519
Quoted 10 lines
hw/net/virtio-net.c +4
-0@@ -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!
Quoted 1 line
Andrew
Thanks, queued this for 2.9.