diff mbox

Re: [PATCH] vhost: disable on tap link down

Message ID 20110208154112.GA4341@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin Feb. 8, 2011, 3:41 p.m. UTC
On Tue, Feb 08, 2011 at 05:40:58PM +0530, pradeep wrote:
> On Mon, 7 Feb 2011 15:50:01 +0200
> "Michael S. Tsirkin" <mst@redhat.com> 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 <mst@redhat.com>
> > Reported-by: pradeep <psuriset@linux.vnet.ibm.com>
> > ---
> > 
> > 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?

Comments

pradeep Feb. 10, 2011, 1:21 p.m. UTC | #1
On Tue, 8 Feb 2011 17:41:12 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Feb 08, 2011 at 05:40:58PM +0530, pradeep wrote:
> > On Mon, 7 Feb 2011 15:50:01 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> 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 <mst@redhat.com>
> > > Reported-by: pradeep <psuriset@linux.vnet.ibm.com>
> > > ---
> > > 
> > > 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?

ahhhh. Old one dint.  New patch works for me. 
Thanks mst

--Pradeep


> 
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index fc2d6f5..3e3d73a 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -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) {
diff mbox

Patch

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index fc2d6f5..3e3d73a 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -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) {