From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34580 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnDAc-0002cy-L4 for qemu-devel@nongnu.org; Wed, 09 Feb 2011 11:45:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnDAb-0000qA-H0 for qemu-devel@nongnu.org; Wed, 09 Feb 2011 11:45:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnDAb-0000q6-5Q for qemu-devel@nongnu.org; Wed, 09 Feb 2011 11:45:33 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p19GjWFZ029183 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Feb 2011 11:45:32 -0500 Date: Wed, 9 Feb 2011 18:45:04 +0200 From: "Michael S. Tsirkin" Message-ID: <74454724f60ec0a05edf672ec10e303d941f079a.1297269881.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCHv3 1/2] net: notify peer about link status change List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: armbru@redhat.com, alex.williamson@redhat.com, glommer@redhat.com, lcapitulino@redhat.com, jasowang@redhat.com, Amit Shah , qemu-devel@nongnu.org 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 Reported-by: pradeep --- 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