| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_age.c,v 1.31 2009/08/05 14:41:12 cegger Exp $ */ | | 1 | /* $NetBSD: if_age.c,v 1.32 2009/08/05 15:29:51 cegger Exp $ */ |
2 | /* $OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $ */ | | 2 | /* $OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $ */ |
3 | | | 3 | |
4 | /*- | | 4 | /*- |
5 | * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> | | 5 | * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice unmodified, this list of conditions, and the following | | 12 | * notice unmodified, this list of conditions, and the following |
13 | * disclaimer. | | 13 | * disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | * SUCH DAMAGE. | | 28 | * SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */ | | 31 | /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.31 2009/08/05 14:41:12 cegger Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.32 2009/08/05 15:29:51 cegger Exp $"); |
35 | | | 35 | |
36 | #include "bpfilter.h" | | 36 | #include "bpfilter.h" |
37 | #include "vlan.h" | | 37 | #include "vlan.h" |
38 | | | 38 | |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #include <sys/proc.h> | | 40 | #include <sys/proc.h> |
41 | #include <sys/endian.h> | | 41 | #include <sys/endian.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/types.h> | | 43 | #include <sys/types.h> |
44 | #include <sys/sockio.h> | | 44 | #include <sys/sockio.h> |
45 | #include <sys/mbuf.h> | | 45 | #include <sys/mbuf.h> |
46 | #include <sys/queue.h> | | 46 | #include <sys/queue.h> |
47 | #include <sys/kernel.h> | | 47 | #include <sys/kernel.h> |
| @@ -244,30 +244,33 @@ age_attach(device_t parent, device_t sel | | | @@ -244,30 +244,33 @@ age_attach(device_t parent, device_t sel |
244 | ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; | | 244 | ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; |
245 | ifp->if_init = age_init; | | 245 | ifp->if_init = age_init; |
246 | ifp->if_ioctl = age_ioctl; | | 246 | ifp->if_ioctl = age_ioctl; |
247 | ifp->if_start = age_start; | | 247 | ifp->if_start = age_start; |
248 | ifp->if_stop = age_stop; | | 248 | ifp->if_stop = age_stop; |
249 | ifp->if_watchdog = age_watchdog; | | 249 | ifp->if_watchdog = age_watchdog; |
250 | ifp->if_baudrate = IF_Gbps(1); | | 250 | ifp->if_baudrate = IF_Gbps(1); |
251 | IFQ_SET_MAXLEN(&ifp->if_snd, AGE_TX_RING_CNT - 1); | | 251 | IFQ_SET_MAXLEN(&ifp->if_snd, AGE_TX_RING_CNT - 1); |
252 | IFQ_SET_READY(&ifp->if_snd); | | 252 | IFQ_SET_READY(&ifp->if_snd); |
253 | strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); | | 253 | strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); |
254 | | | 254 | |
255 | sc->sc_ec.ec_capabilities = ETHERCAP_VLAN_MTU; | | 255 | sc->sc_ec.ec_capabilities = ETHERCAP_VLAN_MTU; |
256 | | | 256 | |
| | | 257 | ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx | |
| | | 258 | IFCAP_CSUM_TCPv4_Rx | |
| | | 259 | IFCAP_CSUM_UDPv4_Rx; |
257 | #ifdef AGE_CHECKSUM | | 260 | #ifdef AGE_CHECKSUM |
258 | ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx | | | 261 | ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx | |
259 | IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx | | | 262 | IFCAP_CSUM_TCPv4_Tx | |
260 | IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UCPv4_Rx; | | 263 | IFCAP_CSUM_UDPv4_Tx; |
261 | #endif | | 264 | #endif |
262 | | | 265 | |
263 | #if NVLAN > 0 | | 266 | #if NVLAN > 0 |
264 | sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_HWTAGGING; | | 267 | sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_HWTAGGING; |
265 | #endif | | 268 | #endif |
266 | | | 269 | |
267 | /* Set up MII bus. */ | | 270 | /* Set up MII bus. */ |
268 | sc->sc_miibus.mii_ifp = ifp; | | 271 | sc->sc_miibus.mii_ifp = ifp; |
269 | sc->sc_miibus.mii_readreg = age_miibus_readreg; | | 272 | sc->sc_miibus.mii_readreg = age_miibus_readreg; |
270 | sc->sc_miibus.mii_writereg = age_miibus_writereg; | | 273 | sc->sc_miibus.mii_writereg = age_miibus_writereg; |
271 | sc->sc_miibus.mii_statchg = age_miibus_statchg; | | 274 | sc->sc_miibus.mii_statchg = age_miibus_statchg; |
272 | | | 275 | |
273 | sc->sc_ec.ec_mii = &sc->sc_miibus; | | 276 | sc->sc_ec.ec_mii = &sc->sc_miibus; |