path: root/net.c
diff options
authorMichael S. Tsirkin <[email protected]>2011-02-09 18:45:04 +0200
committerAurelien Jarno <[email protected]>2011-02-20 18:05:48 +0100
commitab1cbe1c6df3c1f11db42148f929113ad9608ba1 (patch)
treeeacd3f0b0c238313d589a4b4bdc7112fbdfbc71e /net.c
parentf45a11088b9971470218e156f8c78a5fce33adb5 (diff)
net: notify peer about link status change
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 <[email protected]> Reported-by: pradeep <[email protected]> Acked-by: Alex Williamson <[email protected]> Acked-by: Jason Wang <[email protected]> Signed-off-by: Aurelien Jarno <[email protected]>
Diffstat (limited to 'net.c')
1 files changed, 11 insertions, 0 deletions
diff --git a/net.c b/net.c
index 9ba5be22d..ec4745df3 100644
--- a/net.c
+++ b/net.c
@@ -1324,6 +1324,17 @@ done:
if (vc->info->link_status_changed) {
+ /* 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;