Andrew Melnychenko
2022-Jan-25 08:46 UTC
[RFC PATCH 1/5] uapi/linux/if_tun.h: Added new ioctl for tun/tap.
Added TUNGETSUPPORTEDOFFLOADS that should allow
to get bits of supported offloads.
Added 2 additional offlloads for USO(IPv4 & IPv6).
Separate offloads are required for Windows VM guests,
g.e. Windows may set USO rx only for IPv4.
Signed-off-by: Andrew Melnychenko <andrew at daynix.com>
---
include/uapi/linux/if_tun.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 454ae31b93c7..07680fae6e18 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -61,6 +61,7 @@
#define TUNSETFILTEREBPF _IOR('T', 225, int)
#define TUNSETCARRIER _IOW('T', 226, int)
#define TUNGETDEVNETNS _IO('T', 227)
+#define TUNGETSUPPORTEDOFFLOADS _IOR('T', 228, unsigned int)
/* TUNSETIFF ifr flags */
#define IFF_TUN 0x0001
@@ -88,6 +89,8 @@
#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */
#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
#define TUN_F_UFO 0x10 /* I can handle UFO packets */
+#define TUN_F_USO4 0x20 /* I can handle USO for IPv4 packets */
+#define TUN_F_USO6 0x40 /* I can handle USO for IPv6 packets */
/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
#define TUN_PKT_STRIP 0x0001
--
2.34.1
Jason Wang
2022-Feb-09 04:25 UTC
[RFC PATCH 1/5] uapi/linux/if_tun.h: Added new ioctl for tun/tap.
? 2022/1/25 ??4:46, Andrew Melnychenko ??:> Added TUNGETSUPPORTEDOFFLOADS that should allow > to get bits of supported offloads.So we don't use dedicated ioctls in the past, instead, we just probing by checking the return value of TUNSETOFFLOADS. E.g qemu has the following codes: int tap_probe_has_ufo(int fd) { ??? unsigned offload; ??? offload = TUN_F_CSUM | TUN_F_UFO; ??? if (ioctl(fd, TUNSETOFFLOAD, offload) < 0) ??????? return 0; ??? return 1; } Any reason we can't keep using that? Thanks> Added 2 additional offlloads for USO(IPv4 & IPv6). > Separate offloads are required for Windows VM guests, > g.e. Windows may set USO rx only for IPv4. > > Signed-off-by: Andrew Melnychenko <andrew at daynix.com> > --- > include/uapi/linux/if_tun.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h > index 454ae31b93c7..07680fae6e18 100644 > --- a/include/uapi/linux/if_tun.h > +++ b/include/uapi/linux/if_tun.h > @@ -61,6 +61,7 @@ > #define TUNSETFILTEREBPF _IOR('T', 225, int) > #define TUNSETCARRIER _IOW('T', 226, int) > #define TUNGETDEVNETNS _IO('T', 227) > +#define TUNGETSUPPORTEDOFFLOADS _IOR('T', 228, unsigned int) > > /* TUNSETIFF ifr flags */ > #define IFF_TUN 0x0001 > @@ -88,6 +89,8 @@ > #define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ > #define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ > #define TUN_F_UFO 0x10 /* I can handle UFO packets */ > +#define TUN_F_USO4 0x20 /* I can handle USO for IPv4 packets */ > +#define TUN_F_USO6 0x40 /* I can handle USO for IPv6 packets */ > > /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ > #define TUN_PKT_STRIP 0x0001