From d501a057f71484357997983eebdbc8b40277c447 Mon Sep 17 00:00:00 2001 From: Jan Klemkow Date: Wed, 20 Dec 2023 09:51:07 +0000 Subject: vio(4): checksum offloading for TCP/UDP in IPv6 Packets ok sf@ --- sys/dev/pv/if_vio.c | 11 ++++++++--- 1 file 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 #include #include +#include #include #include @@ -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; } -- cgit v1.2.3