From: Michael S. Tsirkin Date: Sun, 31 Oct 2010 17:06:47 +0000 (+0200) Subject: tap: make set_offload a nop after netdev cleanup X-Git-Tag: v0.14.0-rc0~464 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=27a6375de3edece2e5d115847d54c01e52331f7e;p=qemu-xen-4.4-testing.git 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 Signed-off-by: Michael S. Tsirkin --- diff --git a/net/tap.c b/net/tap.c index 937d9429e..eada34ac2 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)