summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaddy <naddy@openbsd.org>2009-06-04 04:48:24 +0000
committernaddy <naddy@openbsd.org>2009-06-04 04:48:24 +0000
commit4bb1c97e2f822ecf1dc209141d4935a124e959f7 (patch)
tree3d8518bba95d267e7fa26988f2a00f8810848e05
parentAdd "rde rib <name>" to the config and allow the rde to use these other RIBs. (diff)
downloadwireguard-openbsd-4bb1c97e2f822ecf1dc209141d4935a124e959f7.tar.xz
wireguard-openbsd-4bb1c97e2f822ecf1dc209141d4935a124e959f7.zip
Fix IPv4 rx checksumming for the non-TCP/UDP case. DESCV2 chips
don't set RL_RDESC_STAT_PROTOID for non-TCP/UDP IP packets, only RL_RDESC_IPV[46]. Also check RL_RDESC_IPV[46] before inspecting the TCP/UDP checksum bits to make IPv6 TCP/UDP checksum offload work intentionally. Gleaned from NetBSD.
-rw-r--r--share/man/man4/re.46
-rw-r--r--sys/dev/ic/re.c12
2 files changed, 10 insertions, 8 deletions
diff --git a/share/man/man4/re.4 b/share/man/man4/re.4
index 4e992db39a6..03a195dee6a 100644
--- a/share/man/man4/re.4
+++ b/share/man/man4/re.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: re.4,v 1.39 2008/11/17 02:40:42 brad Exp $
+.\" $OpenBSD: re.4,v 1.40 2009/06/04 04:48:24 naddy Exp $
.\" Copyright (c) 2003
.\" Bill Paul <wpaul@windriver.com>. All rights reserved.
.\"
@@ -31,7 +31,7 @@
.\"
.\" $FreeBSD: /repoman/r/ncvs/src/share/man/man4/re.4,v 1.4 2004/03/04 06:42:46 sanpei Exp $
.\"
-.Dd $Mdocdate: November 17 2008 $
+.Dd $Mdocdate: June 4 2009 $
.Dt RE 4
.Os
.Sh NAME
@@ -96,6 +96,8 @@ All
NICs support
IPv4 transmit/receive IP/TCP/UDP checksum offload, VLAN tag insertion and
stripping, and use a descriptor-based DMA mechanism.
+The 8102E, 8168C/8111C, and 8168D/8111D also support IPv6 receive TCP/UDP
+checksum offload.
.Pp
The 8139C+ is a single-chip solution combining both a 10/100 MAC and PHY.
The 8169 is a 10/100/1000 MAC only, requiring a GMII or TBI external PHY.
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index 2c0c3af8973..ec0094aa5af 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.106 2009/06/03 00:11:19 sthen Exp $ */
+/* $OpenBSD: re.c,v 1.107 2009/06/04 04:48:24 naddy Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -1445,16 +1445,16 @@ re_rxeof(struct rl_softc *sc)
if (sc->rl_flags & RL_FLAG_DESCV2) {
/* Check IP header checksum */
- if ((rxstat & RL_RDESC_STAT_PROTOID) &&
- !(rxstat & RL_RDESC_STAT_IPSUMBAD) &&
- (rxvlan & RL_RDESC_IPV4))
+ if ((rxvlan & RL_RDESC_IPV4) &&
+ !(rxstat & RL_RDESC_STAT_IPSUMBAD))
m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK;
/* Check TCP/UDP checksum */
- if (((rxstat & RL_RDESC_STAT_TCP) &&
+ if ((rxvlan & (RL_RDESC_IPV4|RL_RDESC_IPV6)) &&
+ (((rxstat & RL_RDESC_STAT_TCP) &&
!(rxstat & RL_RDESC_STAT_TCPSUMBAD)) ||
((rxstat & RL_RDESC_STAT_UDP) &&
- !(rxstat & RL_RDESC_STAT_UDPSUMBAD)))
+ !(rxstat & RL_RDESC_STAT_UDPSUMBAD))))
m->m_pkthdr.csum_flags |= M_TCP_CSUM_IN_OK |
M_UDP_CSUM_IN_OK;
} else {