|
|
9ae3a8 |
From 6fa94ac455819e37a16ed8439be4bbf0b869884c Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <6fa94ac455819e37a16ed8439be4bbf0b869884c.1387276076.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <e610718166120379517e80d1a7aa12d60294209b.1387276076.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <e610718166120379517e80d1a7aa12d60294209b.1387276076.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Vlad Yasevich <vyasevic@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 11 Dec 2013 21:40:06 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 16/16] net: Update netdev peer on link change
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Vlad Yasevich <vyasevic@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1386798006-31753-1-git-send-email-vyasevic@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56241
|
|
|
9ae3a8 |
O-Subject: [RHEL 7.0 qemu PATCH] net: Update netdev peer on link change
|
|
|
9ae3a8 |
Bugzilla: 1027571
|
|
|
9ae3a8 |
RH-Acked-by: Amos Kong <akong@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1027571
|
|
|
9ae3a8 |
Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6714640
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
When a link change occurs on a backend (like tap), we currently do
|
|
|
9ae3a8 |
not propage such change to the nic. As a result, when someone turns
|
|
|
9ae3a8 |
off a link on a tap device, for instance, then a guest doesn't see
|
|
|
9ae3a8 |
that change and continues to try to send traffic or run DHCP even
|
|
|
9ae3a8 |
though the lower-layer is disconnected. This is OK when the network
|
|
|
9ae3a8 |
is set up as a HUB since the the guest may be connected to other HUB
|
|
|
9ae3a8 |
ports too, but when it's set up as a netdev, it makes thinkgs worse.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The patch addresses this by setting the peers link down only when the
|
|
|
9ae3a8 |
peer is not a HUBPORT device. With this patch, in the following config
|
|
|
9ae3a8 |
-netdev tap,id=net0 -device e1000,mac=XXXXX,netdev=net0
|
|
|
9ae3a8 |
when net0 link is turned off, the guest e1000 shows lower-layer link
|
|
|
9ae3a8 |
down. This allows guests to boot much faster in such configurations.
|
|
|
9ae3a8 |
With windows guest, it also allows the network to recover properly
|
|
|
9ae3a8 |
since windows will not configure the link-local IPv4 address, and
|
|
|
9ae3a8 |
when the link is turned on, the proper address address is configured.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 02d38fcb2caa4454cf4ed728d5908c3cc9ba47be)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
net/net.c | 26 +++++++++++++++++---------
|
|
|
9ae3a8 |
1 file changed, 17 insertions(+), 9 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
net/net.c | 26 +++++++++++++++++---------
|
|
|
9ae3a8 |
1 file changed, 17 insertions(+), 9 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/net/net.c b/net/net.c
|
|
|
9ae3a8 |
index c0d61bf..a8c49fc 100644
|
|
|
9ae3a8 |
--- a/net/net.c
|
|
|
9ae3a8 |
+++ b/net/net.c
|
|
|
9ae3a8 |
@@ -1059,15 +1059,23 @@ void qmp_set_link(const char *name, bool up, Error **errp)
|
|
|
9ae3a8 |
nc->info->link_status_changed(nc);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- /* Notify peer. Don't update peer link status: this makes it possible to
|
|
|
9ae3a8 |
- * disconnect from host network without notifying the guest.
|
|
|
9ae3a8 |
- * FIXME: is disconnected link status change operation useful?
|
|
|
9ae3a8 |
- *
|
|
|
9ae3a8 |
- * Current behaviour is compatible with qemu vlans where there could be
|
|
|
9ae3a8 |
- * multiple clients that can still communicate with each other in
|
|
|
9ae3a8 |
- * disconnected mode. For now maintain this compatibility. */
|
|
|
9ae3a8 |
- if (nc->peer && nc->peer->info->link_status_changed) {
|
|
|
9ae3a8 |
- nc->peer->info->link_status_changed(nc->peer);
|
|
|
9ae3a8 |
+ if (nc->peer) {
|
|
|
9ae3a8 |
+ /* Change peer link only if the peer is NIC and then notify peer.
|
|
|
9ae3a8 |
+ * If the peer is a HUBPORT or a backend, we do not change the
|
|
|
9ae3a8 |
+ * link status.
|
|
|
9ae3a8 |
+ *
|
|
|
9ae3a8 |
+ * This behavior is compatible with qemu vlans where there could be
|
|
|
9ae3a8 |
+ * multiple clients that can still communicate with each other in
|
|
|
9ae3a8 |
+ * disconnected mode. For now maintain this compatibility.
|
|
|
9ae3a8 |
+ */
|
|
|
9ae3a8 |
+ if (nc->peer->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
|
|
|
9ae3a8 |
+ for (i = 0; i < queues; i++) {
|
|
|
9ae3a8 |
+ ncs[i]->peer->link_down = !up;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ if (nc->peer->info->link_status_changed) {
|
|
|
9ae3a8 |
+ nc->peer->info->link_status_changed(nc->peer);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|