Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Feb 2013 07:26:25 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r246196 - head/sys/dev/usb/net
Message-ID:  <201302010726.r117QPgs014238@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Feb  1 07:26:25 2013
New Revision: 246196
URL: http://svnweb.freebsd.org/changeset/base/246196

Log:
  Fix for hardware checksum offloading in SMSC driver.
  This also fixes IPv6 support for this particular hardware.
  
  Submitted by:	Daisuke Aoyama

Modified:
  head/sys/dev/usb/net/if_smsc.c

Modified: head/sys/dev/usb/net/if_smsc.c
==============================================================================
--- head/sys/dev/usb/net/if_smsc.c	Fri Feb  1 07:19:19 2013	(r246195)
+++ head/sys/dev/usb/net/if_smsc.c	Fri Feb  1 07:26:25 2013	(r246196)
@@ -1009,6 +1009,10 @@ smsc_bulk_read_callback(struct usb_xfer 
 
 				/* Check if RX TCP/UDP checksumming is being offloaded */
 				if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) {
+
+					struct ether_header *eh;
+
+					eh = mtod(m, struct ether_header *);
 				
 					/* Remove the extra 2 bytes of the csum */
 					pktlen -= 2;
@@ -1020,8 +1024,10 @@ smsc_bulk_read_callback(struct usb_xfer 
 					 * the padding bytes as well. Therefore to be safe we
 					 * ignore the H/W csum on frames less than or equal to
 					 * 64 bytes.
+					 *
+					 * Ignore H/W csum for non-IPv4 packets.
 					 */
-					if (pktlen > ETHER_MIN_LEN) {
+					if (be16toh(eh->ether_type) == ETHERTYPE_IP && pktlen > ETHER_MIN_LEN) {
 					
 						/* Indicate the UDP/TCP csum has been calculated */
 						m->m_pkthdr.csum_flags |= CSUM_DATA_VALID;



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