vhost: disable on tap link down
PATCH 1/1 vhost: disable on tap link down
qemu makes it possible to disable link at tap
which is not communicated to the guest but
causes all packets to be dropped.
Handle this with vhost simply by moving to the userspace emulation.
Note: it might be a good idea to make peer link status match tap in this case, so the guest gets an event
and updates the carrier state. For now
stay bug for bug compatible with what we used to have.
---
Untested.
Pradeep, mind trying this patch out and reporting? Thanks!
hw/virtio-net.c | 4 ++++ net.c | 7 +++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
hw/virtio-net.c +4 -0
@@ -112,6 +112,10 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)return ; } +if (n->nic->nc.peer->link_down) { +return ; + } +if (!tap_get_vhost_net (n->nic->nc.peer)) {return ; }
net.c +7 -0
@@ -1324,6 +1324,13 @@ done:if (vc->info->link_status_changed) { vc->info->link_status_changed (vc); } + +/* Notify peer. Don't update peer link status: this makes it possible to +* disconnect from host network without notifying the guest. +* FIXME: is this useful? Could just be an artifact of vlan support. */ +if (vc->peer && vc->peer->info->link_status_changed) { + vc->peer->info->link_status_changed (vc->peer); + }return 0 ; }
Signature · 1 line
1.7.3.2.91.g446ac
Quoted 11 lines · On Mon, 7 Feb 2011 15:50:01 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
qemu makes it possible to disable link at tap
which is not communicated to the guest but
causes all packets to be dropped.Handle this with vhost simply by moving to the userspace emulation.
Note: it might be a good idea to make peer link status match tap in this case, so the guest gets an event
and updates the carrier state. For now
stay bug for bug compatible with what we used to have.
Quoted 6 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Reported-by pradeep <[email protected]>---
Untested.
Pradeep, mind trying this patch out and reporting?
Hi mst
This patch works. Thanks
--Pradeep
Quoted 41 lines
Thanks!
hw/virtio-net.c | 4 ++++ net.c | 7 +++++++ 2 files changed, 11 insertions(+), 0 deletions(-)hw/virtio-net.c +4
-0@@ -112,6 +112,10 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) return; } +if (n->nic->nc.peer->link_down) { +return ; + } +if (!tap_get_vhost_net (n->nic->nc.peer)) {return ; }net.c +2
-0@@ -1324,6 +1324,13 @@ done:if (vc->info->link_status_changed) { vc->info->link_status_changed (vc); } + +/* Notify peer. Don't update peer link status: this makes it possible to
net.c +2
-0+* disconnect from host network without notifying the guest. +* FIXME: is this useful? Could just be an artifact of vlan support. */
net.c +3
-0+if (vc->peer && vc->peer->info->link_status_changed) { + vc->peer->info->link_status_changed (vc->peer); + }return 0 ; }
Quoted 18 lines · pradeep
Quoted 15 lines · On Mon, 7 Feb 2011 15:50:01 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
qemu makes it possible to disable link at tap
which is not communicated to the guest but
causes all packets to be dropped.Handle this with vhost simply by moving to the userspace emulation.
Note: it might be a good idea to make peer link status match tap in this case, so the guest gets an event
and updates the carrier state. For now
stay bug for bug compatible with what we used to have.Signed-off-by Michael S. Tsirkin <[email protected]>Reported-by pradeep <[email protected]>---
Quoted 6 lines
Quoted 2 lines
Untested.
Pradeep, mind trying this patch out and reporting?Hi mst
This patch works. Thanks
Strange actually. Did you put the link down before guest booted? I went to test it with set link after guest is up, and it didn't work, I needed this on top - can you ack this in your setup as well pls?
hw/virtio-net.c +2 -5
@@ -112,14 +112,11 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)return ; } -if (n->nic->nc.peer->link_down) { -return ; - } -if (!tap_get_vhost_net (n->nic->nc.peer)) {return ; } -if (!!n->vhost_started ==virtio_net_started (n, status)) { +if (!!n->vhost_started ==virtio_net_started (n, status) && + !n->nic->nc.peer->link_down) {return ; }if (!n->vhost_started) {
Quoted 23 lines · On Tue, 8 Feb 2011 17:41:12 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 22 lines · pradeep
Quoted 18 lines · On Mon, 7 Feb 2011 15:50:01 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
qemu makes it possible to disable link at tap
which is not communicated to the guest but
causes all packets to be dropped.Handle this with vhost simply by moving to the userspace emulation.
Note: it might be a good idea to make peer link status match tap in this case, so the guest gets an event
and updates the carrier state. For now
stay bug for bug compatible with what we used to have.Signed-off-by Michael S. Tsirkin <[email protected]>Reported-by pradeep <[email protected]>---
Untested.
Pradeep, mind trying this patch out and reporting?
Quoted 7 lines
Quoted 3 lines
Hi mst
This patch works. Thanks
Strange actually. Did you put the link down before guest booted? I went to test it with set link after guest is up, and it didn't work, I needed this on top - can you ack this in your setup as well pls?
ahhhh. Old one dint. New patch works for me.
Thanks mst
--Pradeep
Quoted 22 lines
hw/virtio-net.c +2
-5@@ -112,14 +112,11 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) return; } -if (n->nic->nc.peer->link_down) { -return ; - } -if (!tap_get_vhost_net (n->nic->nc.peer)) {return ; } -if (!!n->vhost_started ==virtio_net_started (n, status)) { +if (!!n->vhost_started ==virtio_net_started (n, status) && + !n->nic->nc.peer->link_down) {return ; }if (!n->vhost_started) {