From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDEqL-0001mP-6t for qemu-devel@nongnu.org; Wed, 25 Nov 2009 05:11:25 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDEqG-0001kA-1e for qemu-devel@nongnu.org; Wed, 25 Nov 2009 05:11:24 -0500 Received: from [199.232.76.173] (port=43335 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDEqF-0001k4-CL for qemu-devel@nongnu.org; Wed, 25 Nov 2009 05:11:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59481) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDEqE-0000Z6-W1 for qemu-devel@nongnu.org; Wed, 25 Nov 2009 05:11:19 -0500 Subject: Re: [Qemu-devel] [PATCH] Check for TUNSETOFFLOAD support before trying to enable offload features From: Mark McLoughlin In-Reply-To: <1259143482-17735-1-git-send-email-Pierre.Riteau@irisa.fr> References: <1259143482-17735-1-git-send-email-Pierre.Riteau@irisa.fr> Content-Type: text/plain; charset="UTF-8" Date: Wed, 25 Nov 2009 10:08:32 +0000 Message-Id: <1259143712.2514.18.camel@blaa> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Reply-To: Mark McLoughlin List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pierre Riteau Cc: qemu-devel@nongnu.org On Wed, 2009-11-25 at 11:04 +0100, Pierre Riteau wrote: > This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message > on kernels without TUNSETOFFLOAD support. > > Signed-off-by: Pierre Riteau Acked-by: Mark McLoughlin Thanks, Mark. > --- > 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 0f621a2..e038e1a 100644 > --- a/net/tap-linux.c > +++ b/net/tap-linux.c > @@ -129,6 +129,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)