]> Git Repo - qemu.git/commitdiff
tap: make set_offload a nop after netdev cleanup
authorMichael S. Tsirkin <[email protected]>
Sun, 31 Oct 2010 17:06:47 +0000 (19:06 +0200)
committerAnthony Liguori <[email protected]>
Tue, 16 Nov 2010 14:40:07 +0000 (08:40 -0600)
virtio-net expects set_offload to succeed after
peer cleanup.
Since we don't have an open fd anymore, make it so.
Fixes warning about the failure of offload setting.

Reported-by: Jason Wang <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
net/tap.c

index 937d9429eb5ac34d527d4fad918d7188b67fc391..eada34ac2b9d2976ceedf518f7eb11f0ee3dfd23 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
@@ -269,8 +269,11 @@ void tap_set_offload(VLANClientState *nc, int csum, int tso4,
                      int tso6, int ecn, int ufo)
 {
     TAPState *s = DO_UPCAST(TAPState, nc, nc);
+    if (s->fd < 0) {
+        return;
+    }
 
-    return tap_fd_set_offload(s->fd, csum, tso4, tso6, ecn, ufo);
+    tap_fd_set_offload(s->fd, csum, tso4, tso6, ecn, ufo);
 }
 
 static void tap_cleanup(VLANClientState *nc)
@@ -290,6 +293,7 @@ static void tap_cleanup(VLANClientState *nc)
     tap_read_poll(s, 0);
     tap_write_poll(s, 0);
     close(s->fd);
+    s->fd = -1;
 }
 
 static void tap_poll(VLANClientState *nc, bool enable)
This page took 0.02408 seconds and 4 git commands to generate.