All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down
@ 2011-02-09 16:44 Michael S. Tsirkin
  2011-02-09 16:45 ` [Qemu-devel] [PATCHv3 1/2] net: notify peer about link status change Michael S. Tsirkin
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2011-02-09 16:44 UTC (permalink / raw)
  To: armbru, alex.williamson, glommer, lcapitulino, jasowang,
	Amit Shah, qemu-devel

qemu makes it possible to disable link at tap
which is not communicated to the guest but
causes all packets to be dropped.

With vhost-net at the moment it just keeps going.
Fix by communicating to virtio net and have that
stop vhost-net.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: pradeep <psuriset@linux.vnet.ibm.com>

Changes from v2:
	comment tweaked
	split to two patches

Changes from v1:
	fix link down after guest link is up



Michael S. Tsirkin (2):
  net: notify peer about link status change
  vhost: disable on tap link down

 hw/virtio-net.c |    3 ++-
 net.c           |   11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)

-- 
1.7.3.2.91.g446ac

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

* [Qemu-devel] [PATCHv3 1/2] net: notify peer about link status change
  2011-02-09 16:44 [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down Michael S. Tsirkin
@ 2011-02-09 16:45 ` Michael S. Tsirkin
  2011-02-09 16:45 ` [Qemu-devel] [PATCHv3 2/2] vhost: disable on tap link down Michael S. Tsirkin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2011-02-09 16:45 UTC (permalink / raw)
  To: armbru, alex.williamson, glommer, lcapitulino, jasowang,
	Amit Shah, qemu-devel

qemu makes it possible to disable link at tap
which is not communicated to the guest but
causes all packets to be dropped.

This works for virtio userspace, as qemu
stops giving it packets, but not for
virtio-net connected to vhost-net
as that does not get notified about this change.

Notify peer when this happens, which will then be used
by the follow-up patch to stop/start vhost-net.

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
in userspace.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: pradeep <psuriset@linux.vnet.ibm.com>
---
 net.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/net.c b/net.c
index 9ba5be2..ec4745d 100644
--- a/net.c
+++ b/net.c
@@ -1324,6 +1324,17 @@ 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 disconnected link status change operation useful?
+     *
+     * Current behaviour is compatible with qemu vlans where there could be
+     * multiple clients that can still communicate with each other in
+     * disconnected mode. For now maintain this compatibility. */
+    if (vc->peer && vc->peer->info->link_status_changed) {
+        vc->peer->info->link_status_changed(vc->peer);
+    }
     return 0;
 }
 
-- 
1.7.3.2.91.g446ac

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

* [Qemu-devel] [PATCHv3 2/2] vhost: disable on tap link down
  2011-02-09 16:44 [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down Michael S. Tsirkin
  2011-02-09 16:45 ` [Qemu-devel] [PATCHv3 1/2] net: notify peer about link status change Michael S. Tsirkin
@ 2011-02-09 16:45 ` Michael S. Tsirkin
  2011-02-09 17:09 ` [Qemu-devel] Re: [PATCHv3 0/2] vhost: fix " Alex Williamson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2011-02-09 16:45 UTC (permalink / raw)
  To: armbru, alex.williamson, glommer, lcapitulino, jasowang,
	Amit Shah, qemu-devel

qemu makes it possible to disable link at tap
which is not communicated to the guest but
causes all packets to be dropped.

When vhost-net is enabled, vhost needs to be aware of both the virtio
link_down and the peer link_down. we switch to userspace emulation when
either is down.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: pradeep <psuriset@linux.vnet.ibm.com>
---
 hw/virtio-net.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 671d952..20cf680 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -115,7 +115,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
     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) {
-- 
1.7.3.2.91.g446ac

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

* [Qemu-devel] Re: [PATCHv3 0/2] vhost: fix tap link down
  2011-02-09 16:44 [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down Michael S. Tsirkin
  2011-02-09 16:45 ` [Qemu-devel] [PATCHv3 1/2] net: notify peer about link status change Michael S. Tsirkin
  2011-02-09 16:45 ` [Qemu-devel] [PATCHv3 2/2] vhost: disable on tap link down Michael S. Tsirkin
@ 2011-02-09 17:09 ` Alex Williamson
  2011-02-10  5:33 ` [Qemu-devel] " Jason Wang
  2011-02-20 17:07 ` Aurelien Jarno
  4 siblings, 0 replies; 6+ messages in thread
From: Alex Williamson @ 2011-02-09 17:09 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: jasowang, qemu-devel, armbru, Amit Shah, lcapitulino, glommer

On Wed, 2011-02-09 at 18:44 +0200, Michael S. Tsirkin wrote:
> qemu makes it possible to disable link at tap
> which is not communicated to the guest but
> causes all packets to be dropped.
> 
> With vhost-net at the moment it just keeps going.
> Fix by communicating to virtio net and have that
> stop vhost-net.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reported-by: pradeep <psuriset@linux.vnet.ibm.com>
> 
> Changes from v2:
> 	comment tweaked
> 	split to two patches
> 
> Changes from v1:
> 	fix link down after guest link is up
> 
> 
> 
> Michael S. Tsirkin (2):
>   net: notify peer about link status change
>   vhost: disable on tap link down
> 
>  hw/virtio-net.c |    3 ++-
>  net.c           |   11 +++++++++++
>  2 files changed, 13 insertions(+), 1 deletions(-)
> 

Thanks

Acked-by: Alex Williamson <alex.williamson@redhat.com>

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

* [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down
  2011-02-09 16:44 [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2011-02-09 17:09 ` [Qemu-devel] Re: [PATCHv3 0/2] vhost: fix " Alex Williamson
@ 2011-02-10  5:33 ` Jason Wang
  2011-02-20 17:07 ` Aurelien Jarno
  4 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2011-02-10  5:33 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, jasowang, armbru, lcapitulino, alex.williamson,
	Amit Shah, glommer

Michael S. Tsirkin writes:
 > qemu makes it possible to disable link at tap
 > which is not communicated to the guest but
 > causes all packets to be dropped.
 > 
 > With vhost-net at the moment it just keeps going.
 > Fix by communicating to virtio net and have that
 > stop vhost-net.
 > 
 > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 > Reported-by: pradeep <psuriset@linux.vnet.ibm.com>
 > 
 > Changes from v2:
 > 	comment tweaked
 > 	split to two patches
 > 
 > Changes from v1:
 > 	fix link down after guest link is up
 > 
 > 
 > 
 > Michael S. Tsirkin (2):
 >   net: notify peer about link status change
 >   vhost: disable on tap link down
 > 
 >  hw/virtio-net.c |    3 ++-
 >  net.c           |   11 +++++++++++
 >  2 files changed, 13 insertions(+), 1 deletions(-)
 > 

Acked-by: Jason Wang <jasowang@redhat.com>

 > -- 
 > 1.7.3.2.91.g446ac
 > 

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

* Re: [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down
  2011-02-09 16:44 [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down Michael S. Tsirkin
                   ` (3 preceding siblings ...)
  2011-02-10  5:33 ` [Qemu-devel] " Jason Wang
@ 2011-02-20 17:07 ` Aurelien Jarno
  4 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2011-02-20 17:07 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, jasowang, armbru, lcapitulino, alex.williamson,
	Amit Shah, glommer

On Wed, Feb 09, 2011 at 06:44:59PM +0200, Michael S. Tsirkin wrote:
> qemu makes it possible to disable link at tap
> which is not communicated to the guest but
> causes all packets to be dropped.
> 
> With vhost-net at the moment it just keeps going.
> Fix by communicating to virtio net and have that
> stop vhost-net.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reported-by: pradeep <psuriset@linux.vnet.ibm.com>
> 
> Changes from v2:
> 	comment tweaked
> 	split to two patches
> 
> Changes from v1:
> 	fix link down after guest link is up
> 
> 
> 
> Michael S. Tsirkin (2):
>   net: notify peer about link status change
>   vhost: disable on tap link down
> 
>  hw/virtio-net.c |    3 ++-
>  net.c           |   11 +++++++++++
>  2 files changed, 13 insertions(+), 1 deletions(-)
> 

Thanks, both applied.


-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

end of thread, other threads:[~2011-02-20 17:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-09 16:44 [Qemu-devel] [PATCHv3 0/2] vhost: fix tap link down Michael S. Tsirkin
2011-02-09 16:45 ` [Qemu-devel] [PATCHv3 1/2] net: notify peer about link status change Michael S. Tsirkin
2011-02-09 16:45 ` [Qemu-devel] [PATCHv3 2/2] vhost: disable on tap link down Michael S. Tsirkin
2011-02-09 17:09 ` [Qemu-devel] Re: [PATCHv3 0/2] vhost: fix " Alex Williamson
2011-02-10  5:33 ` [Qemu-devel] " Jason Wang
2011-02-20 17:07 ` Aurelien Jarno

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.