summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-10-31 19:06:47 +0200
committerMichael S. Tsirkin <mst@redhat.com>2010-11-13 23:22:01 +0200
commita5fd2c345f7a616e48e7f2be8b3060d23252180c (patch)
tree40edab4c02a4b18c29c26b97543bb26792052573
parent54cdaa1bad3885448ef39faad93d40be3b223519 (diff)
downloadhqemu-a5fd2c345f7a616e48e7f2be8b3060d23252180c.zip
hqemu-a5fd2c345f7a616e48e7f2be8b3060d23252180c.tar.gz
tap: make set_offload a nop after netdev cleanup
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 <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--net/tap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/tap.c b/net/tap.c
index 937d942..eada34a 100644
--- 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)
OpenPOWER on IntegriCloud