diff options
| author | Paolo Abeni <pabeni@redhat.com> | 2025-09-22 16:18:27 +0200 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2025-10-04 10:51:02 -0400 |
| commit | fffac046282c99801b62fa7fa1032cdc261bca6d (patch) | |
| tree | c412e39fdc180150f3e891d98b34d8d98fa4098b /net/tap-linux.c | |
| parent | 3a7741c3bdc3537de4159418d712debbd22e4df6 (diff) | |
| download | focaccia-qemu-fffac046282c99801b62fa7fa1032cdc261bca6d.tar.gz focaccia-qemu-fffac046282c99801b62fa7fa1032cdc261bca6d.zip | |
net: implement tunnel probing
Tap devices support GSO over UDP tunnel offload. Probe for such feature in a similar manner to other offloads. GSO over UDP tunnel needs to be enabled in addition to a "plain" offload (TSO or USO). No need to check separately for the outer header checksum offload: the kernel is going to support both of them or none. The new features are disabled by default to avoid compat issues, and could be enabled, after that hw_compat_10_1 will be added, together with the related compat entries. Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Tested-by: Lei Yang <leiyang@redhat.com> Acked-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <a987a8a7613cbf33bb2209c7c7f5889b512638a7.1758549625.git.pabeni@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'net/tap-linux.c')
| -rw-r--r-- | net/tap-linux.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/tap-linux.c b/net/tap-linux.c index 79a9dd0da0..98b0ae9602 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -201,6 +201,17 @@ int tap_probe_has_uso(int fd) return 1; } +bool tap_probe_has_tunnel(int fd) +{ + unsigned offload; + + offload = TUN_F_CSUM | TUN_F_TSO4 | TUN_F_UDP_TUNNEL_GSO; + if (ioctl(fd, TUNSETOFFLOAD, offload) < 0) { + return false; + } + return true; +} + void tap_fd_set_vnet_hdr_len(int fd, int len) { if (ioctl(fd, TUNSETVNETHDRSZ, &len) == -1) { |