| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: i82557.c,v 1.128 2009/03/15 14:48:11 tsutsui Exp $ */ | | 1 | /* $NetBSD: i82557.c,v 1.129 2009/03/16 12:13:04 tsutsui Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center. | | 9 | * NASA Ames Research Center. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -56,27 +56,27 @@ | | | @@ -56,27 +56,27 @@ |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
58 | * SUCH DAMAGE. | | 58 | * SUCH DAMAGE. |
59 | * | | 59 | * |
60 | * Id: if_fxp.c,v 1.113 2001/05/17 23:50:24 jlemon | | 60 | * Id: if_fxp.c,v 1.113 2001/05/17 23:50:24 jlemon |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | /* | | 63 | /* |
64 | * Device driver for the Intel i82557 fast Ethernet controller, | | 64 | * Device driver for the Intel i82557 fast Ethernet controller, |
65 | * and its successors, the i82558 and i82559. | | 65 | * and its successors, the i82558 and i82559. |
66 | */ | | 66 | */ |
67 | | | 67 | |
68 | #include <sys/cdefs.h> | | 68 | #include <sys/cdefs.h> |
69 | __KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.128 2009/03/15 14:48:11 tsutsui Exp $"); | | 69 | __KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.129 2009/03/16 12:13:04 tsutsui Exp $"); |
70 | | | 70 | |
71 | #include "bpfilter.h" | | 71 | #include "bpfilter.h" |
72 | #include "rnd.h" | | 72 | #include "rnd.h" |
73 | | | 73 | |
74 | #include <sys/param.h> | | 74 | #include <sys/param.h> |
75 | #include <sys/systm.h> | | 75 | #include <sys/systm.h> |
76 | #include <sys/callout.h> | | 76 | #include <sys/callout.h> |
77 | #include <sys/mbuf.h> | | 77 | #include <sys/mbuf.h> |
78 | #include <sys/malloc.h> | | 78 | #include <sys/malloc.h> |
79 | #include <sys/kernel.h> | | 79 | #include <sys/kernel.h> |
80 | #include <sys/socket.h> | | 80 | #include <sys/socket.h> |
81 | #include <sys/ioctl.h> | | 81 | #include <sys/ioctl.h> |
82 | #include <sys/errno.h> | | 82 | #include <sys/errno.h> |
| @@ -1320,27 +1320,27 @@ fxp_rx_hwcksum(struct fxp_softc *sc, str | | | @@ -1320,27 +1320,27 @@ fxp_rx_hwcksum(struct fxp_softc *sc, str |
1320 | if (hlen > 0) { | | 1320 | if (hlen > 0) { |
1321 | uint32_t hsum; | | 1321 | uint32_t hsum; |
1322 | const uint16_t *iphdr; | | 1322 | const uint16_t *iphdr; |
1323 | hsum = 0; | | 1323 | hsum = 0; |
1324 | iphdr = (uint16_t *)ip; | | 1324 | iphdr = (uint16_t *)ip; |
1325 | | | 1325 | |
1326 | while (hlen > 1) { | | 1326 | while (hlen > 1) { |
1327 | hsum += ntohs(*iphdr++); | | 1327 | hsum += ntohs(*iphdr++); |
1328 | hlen -= sizeof(uint16_t); | | 1328 | hlen -= sizeof(uint16_t); |
1329 | } | | 1329 | } |
1330 | while (hsum >> 16) | | 1330 | while (hsum >> 16) |
1331 | hsum = (hsum >> 16) + (hsum & 0xffff); | | 1331 | hsum = (hsum >> 16) + (hsum & 0xffff); |
1332 | | | 1332 | |
1333 | csum_data = ~(~csum_data - ~hsum); | | 1333 | csum_data += (uint16_t)~hsum; |
1334 | | | 1334 | |
1335 | while (csum_data >> 16) | | 1335 | while (csum_data >> 16) |
1336 | csum_data = | | 1336 | csum_data = |
1337 | (csum_data >> 16) + (csum_data & 0xffff); | | 1337 | (csum_data >> 16) + (csum_data & 0xffff); |
1338 | } | | 1338 | } |
1339 | #endif | | 1339 | #endif |
1340 | } | | 1340 | } |
1341 | out: | | 1341 | out: |
1342 | m->m_pkthdr.csum_flags = csum_flags; | | 1342 | m->m_pkthdr.csum_flags = csum_flags; |
1343 | m->m_pkthdr.csum_data = csum_data; | | 1343 | m->m_pkthdr.csum_data = csum_data; |
1344 | } | | 1344 | } |
1345 | | | 1345 | |
1346 | /* | | 1346 | /* |