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;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to