Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Mar 2008 02:25:09 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 138783 for review
Message-ID:  <200803280225.m2S2P9mS009636@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=138783

Change 138783 by jb@jb_freebsd1 on 2008/03/28 02:24:14

	IFC

Affected files ...

.. //depot/projects/dtrace/src/sys/dev/re/if_re.c#18 integrate

Differences ...

==== //depot/projects/dtrace/src/sys/dev/re/if_re.c#18 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.111 2008/03/23 05:35:18 yongari Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.112 2008/03/28 01:21:21 yongari Exp $");
 
 /*
  * RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
@@ -2167,16 +2167,12 @@
 	 * need to send a really small IP fragment that's less than 60
 	 * bytes in size, and IP header checksumming is enabled, the
 	 * resulting ethernet frame that appears on the wire will
-	 * have garbled payload. To work around this, if TX checksum
+	 * have garbled payload. To work around this, if TX IP checksum
 	 * offload is enabled, we always manually pad short frames out
 	 * to the minimum ethernet frame size.
-	 *
-	 * Note: this appears unnecessary for TCP, and doing it for TCP
-	 * with PCIe adapters seems to result in bad checksums.
 	 */
-	if ((*m_head)->m_pkthdr.csum_flags & (CSUM_IP | CSUM_UDP) &&
-	    ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) == 0 &&
-            (*m_head)->m_pkthdr.len < RL_MIN_FRAMELEN) {
+	if ((*m_head)->m_pkthdr.len < RL_MIN_FRAMELEN &&
+	    ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) != 0) {
 		padlen = RL_MIN_FRAMELEN - (*m_head)->m_pkthdr.len;
 		if (M_WRITABLE(*m_head) == 0) {
 			/* Get a writable copy. */
@@ -2257,12 +2253,18 @@
 		    ((uint32_t)(*m_head)->m_pkthdr.tso_segsz <<
 		    RL_TDESC_CMD_MSSVAL_SHIFT);
 	else {
-		if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP)
+		/*
+		 * Unconditionally enable IP checksum if TCP or UDP
+		 * checksum is required. Otherwise, TCP/UDP checksum
+		 * does't make effects.
+		 */
+		if (((*m_head)->m_pkthdr.csum_flags & RE_CSUM_FEATURES) != 0) {
 			csum_flags |= RL_TDESC_CMD_IPCSUM;
-		if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP)
-			csum_flags |= RL_TDESC_CMD_TCPCSUM;
-		if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP)
-			csum_flags |= RL_TDESC_CMD_UDPCSUM;
+			if (((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) != 0)
+				csum_flags |= RL_TDESC_CMD_TCPCSUM;
+			if (((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) != 0)
+				csum_flags |= RL_TDESC_CMD_UDPCSUM;
+		}
 	}
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803280225.m2S2P9mS009636>