diff options
author | Andrew Melnychenko <andrew@daynix.com> | 2023-08-01 01:31:45 +0300 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2023-09-18 14:36:13 +0800 |
commit | 2ab0ec31215e68f7af6b21b62e49141eb7c083e2 (patch) | |
tree | c5cbe776a688d0325c5945e1728b96d8c51bb7b3 /net/tap-linux.c | |
parent | 005ad32358f12fe9313a4a01918a55e60d4f39e5 (diff) | |
download | qemu-2ab0ec31215e68f7af6b21b62e49141eb7c083e2.zip qemu-2ab0ec31215e68f7af6b21b62e49141eb7c083e2.tar.gz qemu-2ab0ec31215e68f7af6b21b62e49141eb7c083e2.tar.bz2 |
tap: Add USO support to tap device.
Passing additional parameters (USOv4 and USOv6 offloads) when
setting TAP offloads
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net/tap-linux.c')
-rw-r--r-- | net/tap-linux.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/net/tap-linux.c b/net/tap-linux.c index f54f308..30fcca1 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -237,7 +237,7 @@ int tap_fd_set_vnet_be(int fd, int is_be) } void tap_fd_set_offload(int fd, int csum, int tso4, - int tso6, int ecn, int ufo) + int tso6, int ecn, int ufo, int uso4, int uso6) { unsigned int offload = 0; @@ -256,13 +256,22 @@ void tap_fd_set_offload(int fd, int csum, int tso4, offload |= TUN_F_TSO_ECN; if (ufo) offload |= TUN_F_UFO; + if (uso4) { + offload |= TUN_F_USO4; + } + if (uso6) { + offload |= TUN_F_USO6; + } } if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) { - offload &= ~TUN_F_UFO; + offload &= ~(TUN_F_USO4 | TUN_F_USO6); if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) { - fprintf(stderr, "TUNSETOFFLOAD ioctl() failed: %s\n", + offload &= ~TUN_F_UFO; + if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) { + fprintf(stderr, "TUNSETOFFLOAD ioctl() failed: %s\n", strerror(errno)); + } } } } |