From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60222 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCbN0-0003th-3t for qemu-devel@nongnu.org; Sun, 31 Oct 2010 13:07:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCbMt-0001q4-Ms for qemu-devel@nongnu.org; Sun, 31 Oct 2010 13:07:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCbMt-0001pz-G9 for qemu-devel@nongnu.org; Sun, 31 Oct 2010 13:06:55 -0400 Date: Sun, 31 Oct 2010 19:06:48 +0200 From: "Michael S. Tsirkin" Message-ID: <20101031170647.GA426@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] tap: make set_offload a nop after netdev cleanup List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang , qemu-devel@nongnu.org, Anthony Liguori 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 --- net/tap.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/net/tap.c b/net/tap.c index 4cfa538..51c762d 100644 --- a/net/tap.c +++ b/net/tap.c @@ -248,6 +248,9 @@ 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 0; + } return tap_fd_set_offload(s->fd, csum, tso4, tso6, ecn, ufo); } @@ -269,6 +272,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) -- 1.7.3.2.91.g446ac