From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDMyn-0007Sp-De for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDMyc-0007Kl-7X for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:36 -0500 Received: from [199.232.76.173] (port=49017 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDMyc-0007KY-0s for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46584) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDMyb-0000Fy-C6 for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:29 -0500 From: Mark McLoughlin Date: Wed, 25 Nov 2009 18:49:35 +0000 Message-Id: <1259174977-26212-43-git-send-email-markmc@redhat.com> In-Reply-To: <1259174977-26212-1-git-send-email-markmc@redhat.com> References: <1259174977-26212-1-git-send-email-markmc@redhat.com> Subject: [Qemu-devel] [PATCH 42/44] net: check for TUNSETOFFLOAD support before trying to enable offload features List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mark McLoughlin , Pierre Riteau From: Pierre Riteau This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message on kernels without TUNSETOFFLOAD support. Signed-off-by: Pierre Riteau Signed-off-by: Mark McLoughlin --- net/tap-linux.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/net/tap-linux.c b/net/tap-linux.c index e4f7e27..6af9e82 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -131,6 +131,11 @@ void tap_fd_set_offload(int fd, int csum, int tso4, { unsigned int offload = 0; + /* Check if our kernel supports TUNSETOFFLOAD */ + if (ioctl(fd, TUNSETOFFLOAD, 0) != 0 && errno == EINVAL) { + return; + } + if (csum) { offload |= TUN_F_CSUM; if (tso4) -- 1.6.5.2