diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -160,12 +160,10 @@ #define TUN_VMIO_FLAG_MASK 0x0fff /* - * Interface capabilities of a tap device that supports the virtio-net - * header. + * Additional interface capabilities of a tap device that supports the + * virtio-net header. */ -#define TAP_VNET_HDR_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 \ - | IFCAP_VLAN_HWCSUM \ - | IFCAP_TSO | IFCAP_LRO \ +#define TAP_VNET_HDR_CAPS (IFCAP_VLAN_HWCSUM | IFCAP_TSO \ | IFCAP_VLAN_HWTSO) #define TAP_ALL_OFFLOAD (CSUM_TSO | CSUM_TCP | CSUM_UDP |\ @@ -987,7 +985,8 @@ ifp->if_capabilities |= IFCAP_LINKSTATE | IFCAP_MEXTPG; if ((tp->tun_flags & TUN_L2) != 0) ifp->if_capabilities |= - IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO; + IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO | + IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6; ifp->if_capenable |= IFCAP_LINKSTATE | IFCAP_MEXTPG; if ((tp->tun_flags & TUN_L2) != 0) { @@ -1767,6 +1766,13 @@ vhdr.hdr.gso_size, vhdr.hdr.csum_start, vhdr.hdr.csum_offset); error = uiomove(&vhdr, len, uio); + } else if (m->m_pkthdr.csum_flags & TAP_ALL_OFFLOAD) { + /* + * Sender offloads TCP segmentation or TCP/UDP checksum + * computation to hardware but without a virtio-net header, tap + * cannot forward the offload flags. + */ + error = EOPNOTSUPP; } if (error == 0) error = m_mbuftouio(uio, m, 0);