Fix for hardware checksum offloading in SMSC driver.

This also fixes IPv6 support for this particular hardware.

Submitted by:	Daisuke Aoyama
This commit is contained in:
Hans Petter Selasky 2013-02-01 07:26:25 +00:00
parent 39700e098d
commit 664413a163

View File

@ -1009,6 +1009,10 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
/* 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 *xfer, usb_error_t error)
* 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;