aboutsummaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-07-20 18:26:53 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-07-20 18:26:53 +0100
commitbd03a38fdf85fb1d4f0c9f59bbc154b516f66360 (patch)
treef6d49deb045c556d57476c181f92a46257665ece /net/net.c
parent13566fe3e584e7b14a6f45246976b91677dc2a77 (diff)
parent625de449fc5597f2e1aff9cb586e249e198f03c9 (diff)
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
# gpg: Signature made Mon Jul 20 18:25:14 2015 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/net-pull-request: net: Flush queued packets when guest resumes lan9118: Drop lan9118_can_receive etraxfs_eth: Drop eth_can_receive musicpal: Drop eth_can_receive net/vmxnet3: Fix RX TCP/UDP checksum on partially summed packets net/vmxnet3: Refactor 'vmxnet_rx_pkt_attach_data' socket: pass correct size in net_socket_send() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/net/net.c b/net/net.c
index 6ff7fec1bb..28a5597b8d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1257,14 +1257,19 @@ void qmp_set_link(const char *name, bool up, Error **errp)
static void net_vm_change_state_handler(void *opaque, int running,
RunState state)
{
- /* Complete all queued packets, to guarantee we don't modify
- * state later when VM is not running.
- */
- if (!running) {
- NetClientState *nc;
- NetClientState *tmp;
+ NetClientState *nc;
+ NetClientState *tmp;
- QTAILQ_FOREACH_SAFE(nc, &net_clients, next, tmp) {
+ QTAILQ_FOREACH_SAFE(nc, &net_clients, next, tmp) {
+ if (running) {
+ /* Flush queued packets and wake up backends. */
+ if (nc->peer && qemu_can_send_packet(nc)) {
+ qemu_flush_queued_packets(nc->peer);
+ }
+ } else {
+ /* Complete all queued packets, to guarantee we don't modify
+ * state later when VM is not running.
+ */
qemu_flush_or_purge_queued_packets(nc, true);
}
}