Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 571

kvm-83-164.el5_5.30.src.rpm

From 206e0204fa9e8f8c726f267853d72b7a47303dcf Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc@redhat.com>
Date: Wed, 22 Apr 2009 16:05:57 +0100
Subject: [PATCH 06/15] kvm: qemu: drop packet from tap device if all NICs are down

On Wed, 2009-04-22 at 06:49 -0400, Yan Vugenfirer wrote:
> Hello,
>
> This is a path for https://bugzilla.redhat.com/show_bug.cgi?id=490488.
>
> Base on Mark McLoughlin recommendation the check for link status moved
> from NIC implementation to net.c

I've just submitted this upstream, so we might as well include that
changelog for RHEV since it actually has some explanation.

I think you can take this as an ACK from either Yan or I it :-)

Eduardo, this attached patch replaces:

  cb0ca7fada9b098c205a5e878147a6f73383e429 e1000, virtio_net: Check link status in can_receive

Cheers,
Mark.

From: Mark McLoughlin <markmc@redhat.com>
Subject: [PATCH] kvm: qemu: drop packet from tap device if all NICs are down

Fix for:

  https://bugzilla.redhat.com/490488

If you do e.g. "set_link virtio.0 down" and there are packets
pending on the tap interface, we currently buffer a packet
and constantly try and send it until the link is up again.

We actually just want to drop the packet if the NIC is down.
Upstream qemu already does this, we just differ because we
buffer packets from the tap interface.

Reported-by: Yan Vugenfirer <yvugenfi@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Message-Id: <1240412758.7661.28.camel@blaa>
Obsoletes: <49E3282D.7000003@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Bugzilla: 500263
RH-Upstream-status: submitted
Acked-by: "Yan Vugenfirer" <yvugenfi@redhat.com>
Acked-by: Avi Kivity <avi@redhat.com>
Acked-by: Dor Laor <dlaor@redhat.com>
---
 qemu/net.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/qemu/net.c b/qemu/net.c
index 88e2b58..a077e1c 100644
--- a/qemu/net.c
+++ b/qemu/net.c
@@ -421,8 +421,10 @@ int qemu_send_packet(VLANClientState *vc1, const uint8_t *buf, int size)
     hex_dump(stdout, buf, size);
 #endif
     for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
-        if (vc != vc1 && !vc->link_down) {
-            if (!vc->fd_can_read || vc->fd_can_read(vc->opaque)) {
+        if (vc != vc1) {
+            if (vc->link_down)
+                ret = 0;
+            else if (!vc->fd_can_read || vc->fd_can_read(vc->opaque)) {
                 vc->fd_read(vc->opaque, buf, size);
                 ret = 0;
             }
-- 
1.6.3.rc4.29.g8146