Module Name:    src
Committed By:   msaitoh
Date:           Sun Dec 21 20:49:43 UTC 2014

Modified Files:
        src/sys/dev/ic [netbsd-5]: rtl8169.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1936):
        sys/dev/ic/rtl8169.c: revision 1.142
RealTek 8139C+ incorrectly identifies UDP checksum 0xffff as bad.
Force software recalculation of UDP checksum if bad checksum is
reported by the hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.105.4.9 -r1.105.4.10 src/sys/dev/ic/rtl8169.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/rtl8169.c
diff -u src/sys/dev/ic/rtl8169.c:1.105.4.9 src/sys/dev/ic/rtl8169.c:1.105.4.10
--- src/sys/dev/ic/rtl8169.c:1.105.4.9	Wed Jan 25 18:02:44 2012
+++ src/sys/dev/ic/rtl8169.c	Sun Dec 21 20:49:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl8169.c,v 1.105.4.9 2012/01/25 18:02:44 riz Exp $	*/
+/*	$NetBSD: rtl8169.c,v 1.105.4.10 2014/12/21 20:49:43 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.105.4.9 2012/01/25 18:02:44 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.105.4.10 2014/12/21 20:49:43 msaitoh Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -1276,9 +1276,19 @@ re_rxeof(struct rtk_softc *sc)
 						    M_CSUM_TCP_UDP_BAD;
 				} else if (RE_UDPPKT(rxstat)) {
 					m->m_pkthdr.csum_flags |= M_CSUM_UDPv4;
-					if (rxstat & RE_RDESC_STAT_UDPSUMBAD)
-						m->m_pkthdr.csum_flags |=
-						    M_CSUM_TCP_UDP_BAD;
+					if (rxstat & RE_RDESC_STAT_UDPSUMBAD) {
+						/*
+						 * XXX: 8139C+ thinks UDP csum
+						 * 0xFFFF is bad, force software
+						 * calculation.
+						 */
+						if (sc->sc_quirk & RTKQ_8139CPLUS)
+							m->m_pkthdr.csum_flags
+							    &= ~M_CSUM_UDPv4;
+						else
+							m->m_pkthdr.csum_flags
+							    |= M_CSUM_TCP_UDP_BAD;
+					}
 				}
 			}
 		} else {

Reply via email to