Hi tech@,

Calculating the IP header checksum on Realtek 8168 is broken when the
packet has IP options.

FreeBSD mentions only the 8168C and 8168C_SPIN2 but the 8168CP is the
one we have.

http://svnweb.freebsd.org/base/stable/8/sys/dev/re/if_re.c?r1=219112&r2=219114

Solution is to disable IP checksum offloading.

ok?

bluhm

Index: dev/ic/re.c
===================================================================
RCS file: /mount/cvsdev/cvs/openbsd/src/sys/dev/ic/re.c,v
retrieving revision 1.139
diff -u -p -r1.139 re.c
--- dev/ic/re.c 9 May 2012 13:30:12 -0000       1.139
+++ dev/ic/re.c 1 Mar 2013 18:22:30 -0000
@@ -1139,8 +1139,21 @@ re_attach(struct rl_softc *sc, const cha
 
        m_clsetwms(ifp, MCLBYTES, 2, RL_RX_DESC_CNT);
 
-       ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 |
-                              IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+       /*
+        * RTL8168/8111C generates wrong IP checksummed frame if the
+        * packet has IP options so disable TX IP checksum offloading.
+        */
+       switch (sc->sc_hwrev) {
+       case RL_HWREV_8168C:
+       case RL_HWREV_8168C_SPIN2:
+       case RL_HWREV_8168CP:
+               ifp->if_capabilities = IFCAP_VLAN_MTU |
+                                      IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+               break;
+       default:
+               ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 |
+                                      IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+       }
 
 #if NVLAN > 0
        ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;

Reply via email to