qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Check for TUNSETOFFLOAD support before trying to enable offload features
@ 2009-11-25 10:04 Pierre Riteau
  2009-11-25 10:08 ` Mark McLoughlin
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Riteau @ 2009-11-25 10:04 UTC (permalink / raw)
  To: qemu-devel, Mark McLoughlin; +Cc: Pierre Riteau

This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message
on kernels without TUNSETOFFLOAD support.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
---
 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)
-- 
1.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-25 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 10:04 [Qemu-devel] [PATCH] Check for TUNSETOFFLOAD support before trying to enable offload features Pierre Riteau
2009-11-25 10:08 ` Mark McLoughlin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).