diff options
author | Jan Klemkow <jan@cvs.openbsd.org> | 2023-12-20 09:51:07 +0000 |
---|---|---|
committer | Jan Klemkow <jan@cvs.openbsd.org> | 2023-12-20 09:51:07 +0000 |
commit | d501a057f71484357997983eebdbc8b40277c447 (patch) | |
tree | c6e1200814b901857b79bcdfa75357d5c1f5f088 | |
parent | b11161b8eea38760380731863405128b9ba00381 (diff) |
vio(4): checksum offloading for TCP/UDP in IPv6 Packets
ok sf@
-rw-r--r-- | sys/dev/pv/if_vio.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c index 787b6a5202f..550c4deb9f3 100644 --- a/sys/dev/pv/if_vio.c +++ b/sys/dev/pv/if_vio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vio.c,v 1.28 2023/12/11 09:40:42 jan Exp $ */ +/* $OpenBSD: if_vio.c,v 1.29 2023/12/20 09:51:06 jan Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. @@ -47,6 +47,7 @@ #include <netinet/in.h> #include <netinet/if_ether.h> #include <netinet/ip.h> +#include <netinet/ip6.h> #include <netinet/tcp.h> #include <netinet/udp.h> @@ -592,7 +593,8 @@ vio_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = vio_ioctl; ifp->if_capabilities = IFCAP_VLAN_MTU; if (virtio_has_feature(vsc, VIRTIO_NET_F_CSUM)) - ifp->if_capabilities |= IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4; + ifp->if_capabilities |= IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4| + IFCAP_CSUM_TCPv6|IFCAP_CSUM_UDPv6; ifq_init_maxlen(&ifp->if_snd, vsc->sc_vqs[1].vq_num - 1); ifmedia_init(&sc->sc_media, 0, vio_media_change, vio_media_status); ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); @@ -764,7 +766,10 @@ again: if (ext.ip4) hdr->csum_start += ext.ip4->ip_hl << 2; - +#ifdef INET6 + else if (ext.ip6) + hdr->csum_start += sizeof(*ext.ip6); +#endif hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; } |