diff options
| author | is <is@NetBSD.org> | 1997-03-15 18:09:08 +0000 |
|---|---|---|
| committer | is <is@NetBSD.org> | 1997-03-15 18:09:08 +0000 |
| commit | 07b064e02e8e7e44fc512c16bb738773fec298ce (patch) | |
| tree | 56722e7d774212d1461b6179a5f5e6bb206bb330 /sys/dev | |
| parent | 9b9fb25893c487e5ab45d96afdef31da5e6a538d (diff) | |
New ARP system, supports IPv4 over any hardware link.
Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.
For the detailed change history, look at the commit log entries for
the is-newarp branch.
Diffstat (limited to 'sys/dev')
51 files changed, 810 insertions, 635 deletions
diff --git a/sys/dev/clock_subr.c b/sys/dev/clock_subr.c index 087259b4894..f4a344637ba 100644 --- a/sys/dev/clock_subr.c +++ b/sys/dev/clock_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock_subr.c,v 1.2 1997/02/20 00:32:15 gwr Exp $ */ +/* $NetBSD: clock_subr.c,v 1.3 1997/03/15 18:11:16 is Exp $ */ /* * Copyright (c) 1988 University of Utah. diff --git a/sys/dev/clock_subr.h b/sys/dev/clock_subr.h index 0b790f2e806..05bf362da99 100644 --- a/sys/dev/clock_subr.h +++ b/sys/dev/clock_subr.h @@ -1,4 +1,4 @@ -/* $NetBSD: clock_subr.h,v 1.1 1997/02/19 23:29:28 gwr Exp $ */ +/* $NetBSD: clock_subr.h,v 1.2 1997/03/15 18:11:17 is Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. diff --git a/sys/dev/dec/if_le_dec.c b/sys/dev/dec/if_le_dec.c index 50094f17fdb..599c41ba526 100644 --- a/sys/dev/dec/if_le_dec.c +++ b/sys/dev/dec/if_le_dec.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_dec.c,v 1.3 1996/10/13 01:38:38 christos Exp $ */ +/* $NetBSD: if_le_dec.c,v 1.4 1997/03/15 18:12:04 is Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -49,10 +49,11 @@ #include <sys/device.h> #include <net/if.h> +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #include <dev/ic/am7990reg.h> @@ -87,8 +88,8 @@ dec_le_common_attach(sc, eap) /* * Get the ethernet address out of rom */ - for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) { - sc->sc_arpcom.ac_enaddr[i] = *eap; + for (i = 0; i < sizeof(sc->sc_enaddr); i++) { + sc->sc_enaddr[i] = *eap; eap += 4; } diff --git a/sys/dev/eisa/files.eisa b/sys/dev/eisa/files.eisa index b7e8ad1b158..1c09760a581 100644 --- a/sys/dev/eisa/files.eisa +++ b/sys/dev/eisa/files.eisa @@ -1,4 +1,4 @@ -# $NetBSD: files.eisa,v 1.12 1996/09/01 00:10:55 mycroft Exp $ +# $NetBSD: files.eisa,v 1.13 1997/03/15 18:11:18 is Exp $ # # Config.new file and device description for machine-independent EISA code. # Included by ports that need it. Requires that the SCSI files be @@ -34,6 +34,6 @@ attach ep at eisa with ep_eisa file dev/eisa/if_ep_eisa.c ep_eisa # DEC DEFEA EISA FDDI Controller -device fea: pdq, fddi, ifnet +device fea: pdq, fddi, ifnet, arp attach fea at eisa file dev/eisa/if_fea.c fea diff --git a/sys/dev/eisa/if_ep_eisa.c b/sys/dev/eisa/if_ep_eisa.c index f202a234214..e9d6b09f88f 100644 --- a/sys/dev/eisa/if_ep_eisa.c +++ b/sys/dev/eisa/if_ep_eisa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ep_eisa.c,v 1.10 1997/02/18 10:51:06 jonathan Exp $ */ +/* $NetBSD: if_ep_eisa.c,v 1.11 1997/03/15 18:11:19 is Exp $ */ /* * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org> @@ -44,15 +44,15 @@ #include <net/if.h> #include <net/if_dl.h> +#include <net/if_ether.h> #include <net/if_types.h> -#include <net/netisr.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS diff --git a/sys/dev/eisa/if_fea.c b/sys/dev/eisa/if_fea.c index a0f1474c96d..fa83fdc63bf 100644 --- a/sys/dev/eisa/if_fea.c +++ b/sys/dev/eisa/if_fea.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_fea.c,v 1.12 1997/03/05 08:02:03 mikel Exp $ */ +/* $NetBSD: if_fea.c,v 1.13 1997/03/15 18:11:20 is Exp $ */ /*- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com> @@ -50,7 +50,10 @@ #include <net/if.h> #include <net/if_types.h> #include <net/if_dl.h> -#include <net/route.h> + +#if defined(__NetBSD__) +#include <net/if_ether.h> +#endif #include "bpfilter.h" #if NBPFILTER > 0 @@ -63,8 +66,12 @@ #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> +#if defined(__NetBSD__) +#include <netinet/if_inarp.h> +#else #include <netinet/if_ether.h> #endif +#endif #if defined(__FreeBSD__) #include <netinet/if_fddi.h> @@ -521,8 +528,6 @@ pdq_eisa_attach( return; } - bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6); - pdq_ifattach(sc, pdq_eisa_ifwatchdog); if (eisa_intr_map(ea->ea_ec, irq, &ih)) { diff --git a/sys/dev/ic/aha.c b/sys/dev/ic/aha.c index 490f25c0f1f..149b2f5b5c5 100644 --- a/sys/dev/ic/aha.c +++ b/sys/dev/ic/aha.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha.c,v 1.2 1997/02/26 04:52:13 sommerfe Exp $ */ +/* $NetBSD: aha.c,v 1.3 1997/03/15 18:11:21 is Exp $ */ #undef AHADIAG #ifdef DDB diff --git a/sys/dev/ic/ahareg.h b/sys/dev/ic/ahareg.h index 922276e53d5..7b6ca0fd7ea 100644 --- a/sys/dev/ic/ahareg.h +++ b/sys/dev/ic/ahareg.h @@ -1,4 +1,4 @@ -/* $NetBSD: ahareg.h,v 1.1 1997/02/07 17:37:29 mycroft Exp $ */ +/* $NetBSD: ahareg.h,v 1.2 1997/03/15 18:11:23 is Exp $ */ /* * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved. diff --git a/sys/dev/ic/ahavar.h b/sys/dev/ic/ahavar.h index 541201eb99e..5e75c42ee77 100644 --- a/sys/dev/ic/ahavar.h +++ b/sys/dev/ic/ahavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ahavar.h,v 1.1 1997/02/07 17:37:30 mycroft Exp $ */ +/* $NetBSD: ahavar.h,v 1.2 1997/03/15 18:11:23 is Exp $ */ /* * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved. diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c index 862705e37bb..6ef25bf32a2 100644 --- a/sys/dev/ic/am7990.c +++ b/sys/dev/ic/am7990.c @@ -1,4 +1,4 @@ -/* $NetBSD: am7990.c,v 1.25 1997/03/09 21:12:39 leo Exp $ */ +/* $NetBSD: am7990.c,v 1.26 1997/03/15 18:11:25 is Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -52,10 +52,12 @@ #include <sys/errno.h> #include <net/if.h> +#include <net/if_dl.h> +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> @@ -96,7 +98,7 @@ integrate void am7990_read __P((struct am7990_softc *, int, int)); hide void am7990_shutdown __P((void *)); -#define ifp (&sc->sc_arpcom.ac_if) +#define ifp (&sc->sc_ethercom.ec_if) #ifdef sun3 /* XXX what do we do about this?! --thorpej */ static inline u_int16_t ether_cmp __P((void *, void *)); @@ -162,7 +164,7 @@ am7990_config(sc) /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->sc_enaddr); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); @@ -193,7 +195,7 @@ am7990_config(sc) panic("am7990_config: weird memory size"); } - printf(": address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr)); + printf(": address %s\n", ether_sprintf(sc->sc_enaddr)); printf("%s: %d receive buffers, %d transmit buffers\n", sc->sc_dev.dv_xname, sc->sc_nrbuf, sc->sc_ntbuf); @@ -253,12 +255,12 @@ am7990_meminit(sc) #endif init.init_mode = LE_MODE_NORMAL; init.init_padr[0] = - (sc->sc_arpcom.ac_enaddr[1] << 8) | sc->sc_arpcom.ac_enaddr[0]; + (LLADDR(ifp->if_sadl)[1] << 8) | LLADDR(ifp->if_sadl)[0]; init.init_padr[1] = - (sc->sc_arpcom.ac_enaddr[3] << 8) | sc->sc_arpcom.ac_enaddr[2]; + (LLADDR(ifp->if_sadl)[3] << 8) | LLADDR(ifp->if_sadl)[2]; init.init_padr[2] = - (sc->sc_arpcom.ac_enaddr[5] << 8) | sc->sc_arpcom.ac_enaddr[4]; - am7990_setladrf(&sc->sc_arpcom, init.init_ladrf); + (LLADDR(ifp->if_sadl)[5] << 8) | LLADDR(ifp->if_sadl)[4]; + am7990_setladrf(&sc->sc_ethercom, init.init_ladrf); sc->sc_last_rd = 0; sc->sc_first_td = sc->sc_last_td = sc->sc_no_td = 0; @@ -489,7 +491,7 @@ am7990_read(sc, boff, len) */ if ((ifp->if_flags & IFF_PROMISC) != 0 && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - ETHER_CMP(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) { + ETHER_CMP(eh->ether_dhost, LLADDR(ifp->if_sadl))) { m_freem(m); return; } @@ -505,7 +507,7 @@ am7990_read(sc, boff, len) * destination address (garbage will usually not match). * Of course, this precludes multicast support... */ - if (ETHER_CMP(eh->ether_dhost, sc->sc_arpcom.ac_enaddr) && + if (ETHER_CMP(eh->ether_dhost, LLADDR(ifp->if_sadl)) && ETHER_CMP(eh->ether_dhost, etherbroadcastaddr)) { m_freem(m); return; @@ -866,7 +868,7 @@ am7990_ioctl(ifp, cmd, data) #ifdef INET case AF_INET: am7990_init(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -876,11 +878,12 @@ am7990_ioctl(ifp, cmd, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); - else + *(union ns_host *)LLADDR(ifp->if_sadl); + else { bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + LLADDR(ifp->if_sadl), + sizeof(sc->sc_enaddr)); + } /* Set new address. */ am7990_init(sc); break; @@ -937,8 +940,8 @@ am7990_ioctl(ifp, cmd, data) case SIOCADDMULTI: case SIOCDELMULTI: error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom) : + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -1028,10 +1031,10 @@ am7990_xmit_print(sc, no) */ void am7990_setladrf(ac, af) - struct arpcom *ac; + struct ethercom *ac; u_int16_t *af; { - struct ifnet *ifp = &ac->ac_if; + struct ifnet *ifp = &ac->ec_if; struct ether_multi *enm; register u_char *cp, c; register u_int32_t crc; diff --git a/sys/dev/ic/am7990reg.h b/sys/dev/ic/am7990reg.h index 6c5a5e52d6a..04faaf9576b 100644 --- a/sys/dev/ic/am7990reg.h +++ b/sys/dev/ic/am7990reg.h @@ -1,4 +1,4 @@ -/* $NetBSD: am7990reg.h,v 1.2 1997/03/09 21:12:41 leo Exp $ */ +/* $NetBSD: am7990reg.h,v 1.3 1997/03/15 18:11:26 is Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. diff --git a/sys/dev/ic/am7990var.h b/sys/dev/ic/am7990var.h index 1e65cdfbe1e..dcb4e490e7e 100644 --- a/sys/dev/ic/am7990var.h +++ b/sys/dev/ic/am7990var.h @@ -1,4 +1,4 @@ -/* $NetBSD: am7990var.h,v 1.10 1997/03/09 21:12:42 leo Exp $ */ +/* $NetBSD: am7990var.h,v 1.11 1997/03/15 18:11:27 is Exp $ */ /* * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -41,7 +41,7 @@ * Ethernet software status per device. * * Each interface is referenced by a network interface structure, - * arpcom.ac_if, which the routing code uses to locate the interface. + * ethercom.ec_if, which the routing code uses to locate the interface. * This structure contains the output queue for the interface, its address, ... * * NOTE: this structure MUST be the first element in machine-dependent @@ -52,7 +52,7 @@ */ struct am7990_softc { struct device sc_dev; /* base device glue */ - struct arpcom sc_arpcom; /* Ethernet common part */ + struct ethercom sc_ethercom; /* Ethernet common part */ /* * Memory functions: @@ -110,6 +110,8 @@ struct am7990_softc { #ifdef LEDEBUG int sc_debug; #endif + u_int8_t sc_enaddr[6]; + u_int8_t sc_pad[2]; }; /* Export this to machine-dependent drivers. */ @@ -120,7 +122,7 @@ void am7990_init __P((struct am7990_softc *)); int am7990_ioctl __P((struct ifnet *, u_long, caddr_t)); void am7990_meminit __P((struct am7990_softc *)); void am7990_reset __P((struct am7990_softc *)); -void am7990_setladrf __P((struct arpcom *, u_int16_t *)); +void am7990_setladrf __P((struct ethercom *, u_int16_t *)); void am7990_start __P((struct ifnet *)); void am7990_stop __P((struct am7990_softc *)); void am7990_watchdog __P((struct ifnet *)); diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index c57ce59a4e7..95144d6b4d4 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -1,4 +1,4 @@ -/* $NetBSD: elink3.c,v 1.20 1997/02/18 10:51:15 jonathan Exp $ */ +/* $NetBSD: elink3.c,v 1.21 1997/03/15 18:11:29 is Exp $ */ /* * Copyright (c) 1996, 1997 Jonathan Stone <jonathan@NetBSD.org> @@ -44,17 +44,17 @@ #include <sys/device.h> #include <net/if.h> -#include <net/netisr.h> #include <net/if_dl.h> +#include <net/if_ether.h> #include <net/if_types.h> -#include <net/netisr.h> + #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -143,10 +143,11 @@ epconfig(sc, chipset) struct ep_softc *sc; u_short chipset; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; u_int16_t i; + u_int8_t myla[6]; printf("%s: ", sc->sc_dev.dv_xname); @@ -169,11 +170,11 @@ epconfig(sc, chipset) if (epbusyeeprom(sc)) return; x = bus_space_read_2(iot, ioh, EP_W0_EEPROM_DATA); - sc->sc_arpcom.ac_enaddr[(i << 1)] = x >> 8; - sc->sc_arpcom.ac_enaddr[(i << 1) + 1] = x; + myla[(i << 1)] = x >> 8; + myla[(i << 1) + 1] = x; } - printf("MAC address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr)); + printf("MAC address %s\n", ether_sprintf(myla)); /* * Vortex-based (3c59x, eisa)? and Boomerang (3c900)cards allow @@ -258,10 +259,10 @@ epconfig(sc, chipset) IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST; if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, myla); #if NBPFILTER > 0 - bpfattach(&sc->sc_arpcom.ac_if.if_bpf, ifp, DLT_EN10MB, + bpfattach(&sc->sc_ethercom.ec_if.if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif @@ -419,7 +420,7 @@ void epinit(sc) register struct ep_softc *sc; { - register struct ifnet *ifp = &sc->sc_arpcom.ac_if; + register struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; int i; @@ -445,7 +446,7 @@ epinit(sc) GO_WINDOW(2); for (i = 0; i < 6; i++) /* Reload the ether_addr. */ bus_space_write_1(iot, ioh, EP_W2_ADDR_0 + i, - sc->sc_arpcom.ac_enaddr[i]); + LLADDR(ifp->if_sadl)[i]); /* * Reset the station-address receive filter. @@ -501,7 +502,7 @@ void epsetfilter(sc) register struct ep_softc *sc; { - register struct ifnet *ifp = &sc->sc_arpcom.ac_if; + register struct ifnet *ifp = &sc->sc_ethercom.ec_if; GO_WINDOW(1); /* Window 1 is operating window */ bus_space_write_2(sc->sc_iot, sc->sc_ioh, EP_COMMAND, SET_RX_FILTER | @@ -519,7 +520,7 @@ void epsetlink(sc) register struct ep_softc *sc; { - register struct ifnet *ifp = &sc->sc_arpcom.ac_if; + register struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; @@ -748,26 +749,26 @@ epstatus(sc) GO_WINDOW(1); if (fifost & FIFOS_RX_UNDERRUN) { - if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG) + if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: RX underrun\n", sc->sc_dev.dv_xname); epreset(sc); return 0; } if (fifost & FIFOS_RX_STATUS_OVERRUN) { - if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG) + if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: RX Status overrun\n", sc->sc_dev.dv_xname); return 1; } if (fifost & FIFOS_RX_OVERRUN) { - if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG) + if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: RX overrun\n", sc->sc_dev.dv_xname); return 1; } if (fifost & FIFOS_TX_OVERRUN) { - if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG) + if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: TX overrun\n", sc->sc_dev.dv_xname); epreset(sc); return 0; @@ -793,14 +794,14 @@ eptxstat(sc) bus_space_write_1(iot, ioh, EP_W1_TX_STATUS, 0x0); if (i & TXS_JABBER) { - ++sc->sc_arpcom.ac_if.if_oerrors; - if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG) + ++sc->sc_ethercom.ec_if.if_oerrors; + if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: jabber (%x)\n", sc->sc_dev.dv_xname, i); epreset(sc); } else if (i & TXS_UNDERRUN) { - ++sc->sc_arpcom.ac_if.if_oerrors; - if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG) + ++sc->sc_ethercom.ec_if.if_oerrors; + if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: fifo underrun (%x) @%d\n", sc->sc_dev.dv_xname, i, sc->tx_start_thresh); @@ -810,9 +811,9 @@ eptxstat(sc) sc->tx_succ_ok = 0; epreset(sc); } else if (i & TXS_MAX_COLLISION) { - ++sc->sc_arpcom.ac_if.if_collisions; + ++sc->sc_ethercom.ec_if.if_collisions; bus_space_write_2(iot, ioh, EP_COMMAND, TX_ENABLE); - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; } else sc->tx_succ_ok = (sc->tx_succ_ok+1) & 127; } @@ -825,7 +826,7 @@ epintr(arg) register struct ep_softc *sc = arg; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; u_int16_t status; int ret = 0; @@ -851,8 +852,8 @@ epintr(arg) if (status & S_RX_COMPLETE) epread(sc); if (status & S_TX_AVAIL) { - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; - epstart(&sc->sc_arpcom.ac_if); + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; + epstart(&sc->sc_ethercom.ec_if); } if (status & S_CARD_FAILURE) { printf("%s: adapter failure (%x)\n", @@ -876,7 +877,7 @@ epread(sc) { bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mbuf *m; struct ether_header *eh; int len; @@ -944,7 +945,7 @@ again: */ if ((ifp->if_flags & IFF_PROMISC) && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, LLADDR(sc->sc_ethercom.ec_if.if_sadl), sizeof(eh->ether_dhost)) != 0) { m_freem(m); return; @@ -1000,7 +1001,7 @@ epget(sc, totlen) { bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mbuf *top, **mp, *m; int len, remaining; int sh; @@ -1153,7 +1154,7 @@ epioctl(ifp, cmd, data) #ifdef INET case AF_INET: epinit(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(&sc->sc_ethercom.ec_if, ifa); break; #endif #ifdef NS @@ -1162,12 +1163,12 @@ epioctl(ifp, cmd, data) register struct ns_addr *ina = &IA_SNS(ifa)->sns_addr; if (ns_nullhost(*ina)) - ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); + ina->x_host = *(union ns_host *) + LLADDR(ifp->if_sadl); else bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + LLADDR(ifp->if_sadl), + ifp->if_addrlen); /* Set new address. */ epinit(sc); break; @@ -1209,8 +1210,8 @@ epioctl(ifp, cmd, data) case SIOCADDMULTI: case SIOCDELMULTI: error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom) : + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -1250,7 +1251,7 @@ epwatchdog(ifp) struct ep_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); - ++sc->sc_arpcom.ac_if.if_oerrors; + ++sc->sc_ethercom.ec_if.if_oerrors; epreset(sc); } diff --git a/sys/dev/ic/elink3var.h b/sys/dev/ic/elink3var.h index 89617f80d15..0ddc9391fb7 100644 --- a/sys/dev/ic/elink3var.h +++ b/sys/dev/ic/elink3var.h @@ -1,4 +1,4 @@ -/* $NetBSD: elink3var.h,v 1.10 1997/02/18 10:51:17 jonathan Exp $ */ +/* $NetBSD: elink3var.h,v 1.11 1997/03/15 18:11:30 is Exp $ */ /* * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org> @@ -37,7 +37,7 @@ struct ep_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* Ethernet common part */ + struct ethercom sc_ethercom; /* Ethernet common part */ bus_space_tag_t sc_iot; /* bus cookie */ bus_space_handle_t sc_ioh; /* bus i/o handle */ u_int ep_connectors; /* Connectors on this card. */ diff --git a/sys/dev/ic/mb86960.c b/sys/dev/ic/mb86960.c index e56539bdf14..1a0d48e545c 100644 --- a/sys/dev/ic/mb86960.c +++ b/sys/dev/ic/mb86960.c @@ -58,14 +58,15 @@ #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> -#include <net/netisr.h> + +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -167,7 +168,7 @@ struct fe_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* ethernet common */ + struct ethercom sc_ethercom; /* ethernet common */ /* Set by probe() and not modified in later phases. */ enum fe_type type; /* interface type code */ @@ -194,10 +195,9 @@ struct fe_softc { /* Multicast address filter management. */ u_char filter_change; /* MARs must be changed ASAP. */ u_char filter[FE_FILTER_LEN]; /* new filter value. */ -}; -/* Frequently accessed members in arpcom. */ -#define sc_enaddr sc_arpcom.ac_enaddr + u_int8_t sc_enaddr[ETHER_ADDR_LEN]; +}; /* Standard driver entry points. These can be static. */ int feprobe __P((struct device *, void *, void *)); @@ -224,7 +224,7 @@ void fe_xmit __P((struct fe_softc *)); void fe_write_mbufs __P((struct fe_softc *, struct mbuf *)); static inline void fe_droppacket __P((struct fe_softc *)); -void fe_getmcaf __P((struct arpcom *, u_char *)); +void fe_getmcaf __P((struct ethercom *, u_char *)); void fe_setmode __P((struct fe_softc *)); void fe_loadmar __P((struct fe_softc *)); #if FE_DEBUG >= 1 @@ -994,7 +994,7 @@ feattach(parent, self, aux) struct fe_softc *sc = (void *)self; struct isa_attach_args *ia = aux; struct cfdata *cf = sc->sc_dev.dv_cfdata; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Stop the 86960. */ fe_stop(sc); @@ -1063,11 +1063,11 @@ feattach(parent, self, aux) /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->sc_enaddr); /* Print additional info when attached. */ printf(": address %s, type %s\n", - ether_sprintf(sc->sc_arpcom.ac_enaddr), sc->typestr); + ether_sprintf(sc->sc_enaddr), sc->typestr); #if FE_DEBUG >= 3 { int buf, txb, bbw, sbw, ram; @@ -1214,7 +1214,7 @@ fe_watchdog(ifp) #endif /* Record how many packets are lost by this accident. */ - sc->sc_arpcom.ac_if.if_oerrors += sc->txb_sched + sc->txb_count; + sc->sc_ethercom.ec_if.if_oerrors += sc->txb_sched + sc->txb_count; fe_reset(sc); } @@ -1237,7 +1237,7 @@ void fe_init(sc) struct fe_softc *sc; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int i; #if FE_DEBUG >= 3 @@ -1399,7 +1399,7 @@ fe_xmit(sc) * We use longer timeout for multiple packet transmission. * I'm not sure this timer value is appropriate. FIXME. */ - sc->sc_arpcom.ac_if.if_timer = 1 + sc->txb_count; + sc->sc_ethercom.ec_if.if_timer = 1 + sc->txb_count; /* Update txb variables. */ sc->txb_sched = sc->txb_count; @@ -1577,7 +1577,7 @@ fe_tint(sc, tstat) struct fe_softc *sc; u_char tstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int left; int col; @@ -1716,7 +1716,7 @@ fe_rint(sc, rstat) struct fe_softc *sc; u_char rstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int len; u_char status; int i; @@ -1898,7 +1898,7 @@ feintr(arg) if (sc->filter_change && sc->txb_count == 0 && sc->txb_sched == 0) { fe_loadmar(sc); - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; } /* @@ -1907,8 +1907,8 @@ feintr(arg) * after handling the receiver interrupt to give the * receive operation priority. */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE) == 0) - fe_start(&sc->sc_arpcom.ac_if); + if ((sc->sc_ethercom.ec_if.if_flags & IFF_OACTIVE) == 0) + fe_start(&sc->sc_ethercom.ec_if); /* * Get interrupt conditions, masking unneeded flags. @@ -1949,7 +1949,7 @@ fe_ioctl(ifp, command, data) #ifdef INET case AF_INET: fe_init(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -1959,11 +1959,13 @@ fe_ioctl(ifp, command, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); - else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + *(union ns_host *)(sc->sc_enaddr); + else { + bcopy(ina->x_host.c_host, sc->sc_enaddr, + ETHER_ADDR_LEN); + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); + } /* Set new address. */ fe_init(sc); break; @@ -2011,8 +2013,8 @@ fe_ioctl(ifp, command, data) case SIOCDELMULTI: /* Update our multicast list. */ error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom) : + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -2044,7 +2046,7 @@ fe_get_packet(sc, len) { struct ether_header *eh; struct mbuf *m; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Allocate a header mbuf. */ MGETHDR(m, M_DONTWAIT, MT_DATA); @@ -2105,7 +2107,7 @@ fe_get_packet(sc, len) */ if ((ifp->if_flags & IFF_PROMISC) != 0 && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, sc->sc_enaddr, sizeof(eh->ether_dhost)) != 0) { m_freem(m); return (1); @@ -2186,7 +2188,7 @@ fe_write_mbufs(sc, m) log(LOG_ERR, "%s: got a %s packet (%u bytes) to send\n", sc->sc_dev.dv_xname, totlen < ETHER_HDR_SIZE ? "partial" : "big", totlen); - sc->sc_arpcom.ac_if.if_oerrors++; + sc->sc_ethercom.ec_if.if_oerrors++; return; } #endif @@ -2270,11 +2272,11 @@ fe_write_mbufs(sc, m) * list of multicast addresses we need to listen to. */ void -fe_getmcaf(ac, af) - struct arpcom *ac; +fe_getmcaf(ec, af) + struct ethercom *ec; u_char *af; { - struct ifnet *ifp = &ac->ac_if; + struct ifnet *ifp = &ec->ec_if; struct ether_multi *enm; register u_char *cp, c; register u_long crc; @@ -2293,7 +2295,7 @@ fe_getmcaf(ac, af) goto allmulti; af[0] = af[1] = af[2] = af[3] = af[4] = af[5] = af[6] = af[7] = 0x00; - ETHER_FIRST_MULTI(step, ac, enm); + ETHER_FIRST_MULTI(step, ec, enm); while (enm != NULL) { if (bcmp(enm->enm_addrlo, enm->enm_addrhi, sizeof(enm->enm_addrlo)) != 0) { @@ -2345,7 +2347,7 @@ void fe_setmode(sc) struct fe_softc *sc; { - int flags = sc->sc_arpcom.ac_if.if_flags; + int flags = sc->sc_ethercom.ec_if.if_flags; /* * If the interface is not running, we postpone the update @@ -2392,7 +2394,7 @@ fe_setmode(sc) /* * Find the new multicast filter value. */ - fe_getmcaf(&sc->sc_arpcom, sc->filter); + fe_getmcaf(&sc->sc_ethercom, sc->filter); sc->filter_change = 1; #if FE_DEBUG >= 3 diff --git a/sys/dev/ic/mb86960var.h b/sys/dev/ic/mb86960var.h index e56539bdf14..1a0d48e545c 100644 --- a/sys/dev/ic/mb86960var.h +++ b/sys/dev/ic/mb86960var.h @@ -58,14 +58,15 @@ #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> -#include <net/netisr.h> + +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -167,7 +168,7 @@ struct fe_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* ethernet common */ + struct ethercom sc_ethercom; /* ethernet common */ /* Set by probe() and not modified in later phases. */ enum fe_type type; /* interface type code */ @@ -194,10 +195,9 @@ struct fe_softc { /* Multicast address filter management. */ u_char filter_change; /* MARs must be changed ASAP. */ u_char filter[FE_FILTER_LEN]; /* new filter value. */ -}; -/* Frequently accessed members in arpcom. */ -#define sc_enaddr sc_arpcom.ac_enaddr + u_int8_t sc_enaddr[ETHER_ADDR_LEN]; +}; /* Standard driver entry points. These can be static. */ int feprobe __P((struct device *, void *, void *)); @@ -224,7 +224,7 @@ void fe_xmit __P((struct fe_softc *)); void fe_write_mbufs __P((struct fe_softc *, struct mbuf *)); static inline void fe_droppacket __P((struct fe_softc *)); -void fe_getmcaf __P((struct arpcom *, u_char *)); +void fe_getmcaf __P((struct ethercom *, u_char *)); void fe_setmode __P((struct fe_softc *)); void fe_loadmar __P((struct fe_softc *)); #if FE_DEBUG >= 1 @@ -994,7 +994,7 @@ feattach(parent, self, aux) struct fe_softc *sc = (void *)self; struct isa_attach_args *ia = aux; struct cfdata *cf = sc->sc_dev.dv_cfdata; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Stop the 86960. */ fe_stop(sc); @@ -1063,11 +1063,11 @@ feattach(parent, self, aux) /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->sc_enaddr); /* Print additional info when attached. */ printf(": address %s, type %s\n", - ether_sprintf(sc->sc_arpcom.ac_enaddr), sc->typestr); + ether_sprintf(sc->sc_enaddr), sc->typestr); #if FE_DEBUG >= 3 { int buf, txb, bbw, sbw, ram; @@ -1214,7 +1214,7 @@ fe_watchdog(ifp) #endif /* Record how many packets are lost by this accident. */ - sc->sc_arpcom.ac_if.if_oerrors += sc->txb_sched + sc->txb_count; + sc->sc_ethercom.ec_if.if_oerrors += sc->txb_sched + sc->txb_count; fe_reset(sc); } @@ -1237,7 +1237,7 @@ void fe_init(sc) struct fe_softc *sc; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int i; #if FE_DEBUG >= 3 @@ -1399,7 +1399,7 @@ fe_xmit(sc) * We use longer timeout for multiple packet transmission. * I'm not sure this timer value is appropriate. FIXME. */ - sc->sc_arpcom.ac_if.if_timer = 1 + sc->txb_count; + sc->sc_ethercom.ec_if.if_timer = 1 + sc->txb_count; /* Update txb variables. */ sc->txb_sched = sc->txb_count; @@ -1577,7 +1577,7 @@ fe_tint(sc, tstat) struct fe_softc *sc; u_char tstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int left; int col; @@ -1716,7 +1716,7 @@ fe_rint(sc, rstat) struct fe_softc *sc; u_char rstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int len; u_char status; int i; @@ -1898,7 +1898,7 @@ feintr(arg) if (sc->filter_change && sc->txb_count == 0 && sc->txb_sched == 0) { fe_loadmar(sc); - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; } /* @@ -1907,8 +1907,8 @@ feintr(arg) * after handling the receiver interrupt to give the * receive operation priority. */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE) == 0) - fe_start(&sc->sc_arpcom.ac_if); + if ((sc->sc_ethercom.ec_if.if_flags & IFF_OACTIVE) == 0) + fe_start(&sc->sc_ethercom.ec_if); /* * Get interrupt conditions, masking unneeded flags. @@ -1949,7 +1949,7 @@ fe_ioctl(ifp, command, data) #ifdef INET case AF_INET: fe_init(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -1959,11 +1959,13 @@ fe_ioctl(ifp, command, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); - else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + *(union ns_host *)(sc->sc_enaddr); + else { + bcopy(ina->x_host.c_host, sc->sc_enaddr, + ETHER_ADDR_LEN); + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); + } /* Set new address. */ fe_init(sc); break; @@ -2011,8 +2013,8 @@ fe_ioctl(ifp, command, data) case SIOCDELMULTI: /* Update our multicast list. */ error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom) : + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -2044,7 +2046,7 @@ fe_get_packet(sc, len) { struct ether_header *eh; struct mbuf *m; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Allocate a header mbuf. */ MGETHDR(m, M_DONTWAIT, MT_DATA); @@ -2105,7 +2107,7 @@ fe_get_packet(sc, len) */ if ((ifp->if_flags & IFF_PROMISC) != 0 && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, sc->sc_enaddr, sizeof(eh->ether_dhost)) != 0) { m_freem(m); return (1); @@ -2186,7 +2188,7 @@ fe_write_mbufs(sc, m) log(LOG_ERR, "%s: got a %s packet (%u bytes) to send\n", sc->sc_dev.dv_xname, totlen < ETHER_HDR_SIZE ? "partial" : "big", totlen); - sc->sc_arpcom.ac_if.if_oerrors++; + sc->sc_ethercom.ec_if.if_oerrors++; return; } #endif @@ -2270,11 +2272,11 @@ fe_write_mbufs(sc, m) * list of multicast addresses we need to listen to. */ void -fe_getmcaf(ac, af) - struct arpcom *ac; +fe_getmcaf(ec, af) + struct ethercom *ec; u_char *af; { - struct ifnet *ifp = &ac->ac_if; + struct ifnet *ifp = &ec->ec_if; struct ether_multi *enm; register u_char *cp, c; register u_long crc; @@ -2293,7 +2295,7 @@ fe_getmcaf(ac, af) goto allmulti; af[0] = af[1] = af[2] = af[3] = af[4] = af[5] = af[6] = af[7] = 0x00; - ETHER_FIRST_MULTI(step, ac, enm); + ETHER_FIRST_MULTI(step, ec, enm); while (enm != NULL) { if (bcmp(enm->enm_addrlo, enm->enm_addrhi, sizeof(enm->enm_addrlo)) != 0) { @@ -2345,7 +2347,7 @@ void fe_setmode(sc) struct fe_softc *sc; { - int flags = sc->sc_arpcom.ac_if.if_flags; + int flags = sc->sc_ethercom.ec_if.if_flags; /* * If the interface is not running, we postpone the update @@ -2392,7 +2394,7 @@ fe_setmode(sc) /* * Find the new multicast filter value. */ - fe_getmcaf(&sc->sc_arpcom, sc->filter); + fe_getmcaf(&sc->sc_ethercom, sc->filter); sc->filter_change = 1; #if FE_DEBUG >= 3 diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index e9012ce73a1..b2a8719f505 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9x.c,v 1.2 1997/02/27 13:59:32 briggs Exp $ */ +/* $NetBSD: ncr53c9x.c,v 1.3 1997/03/15 18:11:31 is Exp $ */ /* * Copyright (c) 1996 Charles M. Hannum. All rights reserved. diff --git a/sys/dev/ic/ncr53c9xreg.h b/sys/dev/ic/ncr53c9xreg.h index f704e467ad7..9ebc936a5ed 100644 --- a/sys/dev/ic/ncr53c9xreg.h +++ b/sys/dev/ic/ncr53c9xreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9xreg.h,v 1.1 1997/02/27 01:12:08 thorpej Exp $ */ +/* $NetBSD: ncr53c9xreg.h,v 1.2 1997/03/15 18:11:32 is Exp $ */ /* * Copyright (c) 1994 Peter Galbavy. All rights reserved. diff --git a/sys/dev/ic/ncr53c9xvar.h b/sys/dev/ic/ncr53c9xvar.h index fc909387fa5..a10dc17601d 100644 --- a/sys/dev/ic/ncr53c9xvar.h +++ b/sys/dev/ic/ncr53c9xvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9xvar.h,v 1.2 1997/02/27 13:59:34 briggs Exp $ */ +/* $NetBSD: ncr53c9xvar.h,v 1.3 1997/03/15 18:11:33 is Exp $ */ /* * Copyright (c) 1997 Jason R. Thorpe. diff --git a/sys/dev/ic/pdq_ifsubr.c b/sys/dev/ic/pdq_ifsubr.c index dc77238073b..813a93e0994 100644 --- a/sys/dev/ic/pdq_ifsubr.c +++ b/sys/dev/ic/pdq_ifsubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: pdq_ifsubr.c,v 1.7 1997/02/20 17:53:50 is Exp $ */ +/* $NetBSD: pdq_ifsubr.c,v 1.8 1997/03/15 18:11:34 is Exp $ */ /*- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com> @@ -52,7 +52,15 @@ #include <net/if.h> #include <net/if_types.h> #include <net/if_dl.h> + +#if !defined(__NetBSD__) #include <net/route.h> +#endif + +#if defined(__NetBSD__) +#include <net/if_ether.h> +#endif + #include "bpfilter.h" #if NBPFILTER > 0 @@ -65,8 +73,12 @@ #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> +#if defined(__NetBSD__) +#include <netinet/if_inarp.h> +#else #include <netinet/if_ether.h> #endif +#endif #if defined(__FreeBSD__) #include <netinet/if_fddi.h> #else @@ -158,7 +170,7 @@ ifnet_ret_t pdq_ifstart( struct ifnet *ifp) { - pdq_softc_t *sc = (pdq_softc_t *) ((caddr_t) ifp - offsetof(pdq_softc_t, sc_ac.ac_if)); + pdq_softc_t *sc = (pdq_softc_t *) ((caddr_t) ifp - offsetof(pdq_softc_t, sc_ec.ec_if)); struct ifqueue *ifq = &ifp->if_snd; struct mbuf *m; int tx = 0; @@ -204,7 +216,11 @@ pdq_os_receive_pdu( if ((fh->fddi_fc & (FDDIFC_L|FDDIFC_F)) != FDDIFC_LLC_ASYNC || ((sc->sc_if.if_flags & IFF_PROMISC) && (fh->fddi_dhost[0] & 1) == 0 && /* !mcast and !bcast */ +#ifdef __NetBSD__ + bcmp(fh->fddi_dhost, LLADDR(sc->sc_ec.ec_if.if_sadl), +#else bcmp(fh->fddi_dhost, sc->sc_ac.ac_enaddr, +#endif sizeof(fh->fddi_dhost)) != 0)) { m_freem(m); return; @@ -256,7 +272,7 @@ pdq_os_addr_fill( struct ether_multistep step; struct ether_multi *enm; - ETHER_FIRST_MULTI(step, &sc->sc_ac, enm); + ETHER_FIRST_MULTI(step, &sc->sc_ec, enm); while (enm != NULL && num_addrs > 0) { ((u_short *) addr->lanaddr_bytes)[0] = ((u_short *) enm->enm_addrlo)[0]; ((u_short *) addr->lanaddr_bytes)[1] = ((u_short *) enm->enm_addrlo)[1]; @@ -273,7 +289,7 @@ pdq_ifioctl( ioctl_cmd_t cmd, caddr_t data) { - pdq_softc_t *sc = (pdq_softc_t *) ((caddr_t) ifp - offsetof(pdq_softc_t, sc_ac.ac_if)); + pdq_softc_t *sc = (pdq_softc_t *) ((caddr_t) ifp - offsetof(pdq_softc_t, sc_ec.ec_if)); int s, error = 0; s = splimp(); @@ -287,7 +303,7 @@ pdq_ifioctl( #if defined(INET) case AF_INET: { pdq_ifinit(sc); - arp_ifinit(&sc->sc_ac, ifa); + arp_ifinit(ifp, ifa); break; } #endif /* INET */ @@ -300,12 +316,11 @@ pdq_ifioctl( case AF_NS: { struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr); if (ns_nullhost(*ina)) { - ina->x_host = *(union ns_host *)(sc->sc_ac.ac_enaddr); + ina->x_host = *(union ns_host *)LLADDR(ifp->if_sadl); } else { ifp->if_flags &= ~IFF_RUNNING; bcopy((caddr_t)ina->x_host.c_host, - (caddr_t)sc->sc_ac.ac_enaddr, - sizeof sc->sc_ac.ac_enaddr); + LLADDR(ifp->if_sadl), ifp->if_data.ifi_addrlen); } pdq_ifinit(sc); @@ -332,9 +347,9 @@ pdq_ifioctl( * Update multicast listeners */ if (cmd == SIOCADDMULTI) - error = ether_addmulti((struct ifreq *)data, &sc->sc_ac); + error = ether_addmulti((struct ifreq *)data, &sc->sc_ec); else - error = ether_delmulti((struct ifreq *)data, &sc->sc_ac); + error = ether_delmulti((struct ifreq *)data, &sc->sc_ec); if (error == ENETRESET) { if (sc->sc_if.if_flags & IFF_RUNNING) @@ -378,7 +393,7 @@ pdq_ifattach( ifp->if_start = pdq_ifstart; if_attach(ifp); - fddi_ifattach(ifp); + fddi_ifattach(ifp, (caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes); #if NBPFILTER > 0 PDQ_BPFATTACH(sc, DLT_FDDI, sizeof(struct fddi_header)); #endif diff --git a/sys/dev/ic/pdqvar.h b/sys/dev/ic/pdqvar.h index 8872b28bf63..f6f00334b52 100644 --- a/sys/dev/ic/pdqvar.h +++ b/sys/dev/ic/pdqvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: pdqvar.h,v 1.11 1996/10/25 21:33:37 cgd Exp $ */ +/* $NetBSD: pdqvar.h,v 1.12 1997/03/15 18:11:35 is Exp $ */ /*- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com> @@ -203,8 +203,13 @@ typedef struct { #elif defined(__FreeBSD__) struct kern_devconf *sc_kdc; /* freebsd cruft */ #endif +#if defined(__NetBSD__) + struct ethercom sc_ec; +#define sc_if sc_ec.ec_if +#else struct arpcom sc_ac; #define sc_if sc_ac.ac_if +#endif pdq_t *sc_pdq; #if !defined(__NetBSD__) pdq_bus_ioport_t sc_iobase; diff --git a/sys/dev/isa/aha_isa.c b/sys/dev/isa/aha_isa.c index 91fc935c35a..c44d27e2bf8 100644 --- a/sys/dev/isa/aha_isa.c +++ b/sys/dev/isa/aha_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha_isa.c,v 1.1 1997/02/07 17:37:32 mycroft Exp $ */ +/* $NetBSD: aha_isa.c,v 1.2 1997/03/15 18:11:36 is Exp $ */ /* * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved. diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa index 99fe449391b..973d09dd8c5 100644 --- a/sys/dev/isa/files.isa +++ b/sys/dev/isa/files.isa @@ -1,4 +1,4 @@ -# $NetBSD: files.isa,v 1.26 1997/02/07 17:37:34 mycroft Exp $ +# $NetBSD: files.isa,v 1.27 1997/03/15 18:11:37 is Exp $ # # Config.new file and device description for machine-independent ISA code. # Included by ports that need it. Requires that the SCSI files be @@ -128,17 +128,17 @@ file dev/isa/elink.c elink # National Semiconductor DS8390/WD83C690-based boards # (WD/SMC 80x3 family, SMC Ultra [8216], 3Com 3C503, NE[12]000, and clones) -device ed: ether, ifnet +device ed: ether, ifnet, arp attach ed at isa file dev/isa/if_ed.c ed # 3Com 3C505 -device eg: ether, ifnet +device eg: ether, ifnet, arp attach eg at isa file dev/isa/if_eg.c eg # 3Com 3C501 -device el: ether, ifnet +device el: ether, ifnet, arp attach el at isa file dev/isa/if_el.c el @@ -148,31 +148,31 @@ file dev/isa/if_ep_isa.c ep_isa # Fujitsu MB8696[05]-based boards # (Allied Telesis AT1700) -device fe: ether, ifnet +device fe: ether, ifnet, arp attach fe at isa file dev/isa/if_fe.c fe # HP Lan Ethernet controllers # XXX currently broken -#device hp: ether, ifnet +#device hp: ether, ifnet, arp #attach hp at isa #file dev/isa/if_hp.c hp # Intel i82586-based boards # (AT&T StarLAN 10, AT&T EN100, AT&T StarLAN Fiber, 3Com 3C507) -device ie: ether, ifnet, elink +device ie: ether, ifnet, elink, arp attach ie at isa file dev/isa/if_ie.c ie # Intel i82595-based boards. # (Intel EtherExpress PRO) -device iy: ether, ifnet +device iy: ether, ifnet, arp attach iy at isa file dev/isa/if_iy.c iy # XXX ??? # XXX NOT IN TREE? -#device ix: ether, ifnet +#device ix: ether, ifnet, arp #attach ix at isa #file dev/isa/if_ix.c ix diff --git a/sys/dev/isa/if_ate.c b/sys/dev/isa/if_ate.c index e56539bdf14..1a0d48e545c 100644 --- a/sys/dev/isa/if_ate.c +++ b/sys/dev/isa/if_ate.c @@ -58,14 +58,15 @@ #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> -#include <net/netisr.h> + +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -167,7 +168,7 @@ struct fe_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* ethernet common */ + struct ethercom sc_ethercom; /* ethernet common */ /* Set by probe() and not modified in later phases. */ enum fe_type type; /* interface type code */ @@ -194,10 +195,9 @@ struct fe_softc { /* Multicast address filter management. */ u_char filter_change; /* MARs must be changed ASAP. */ u_char filter[FE_FILTER_LEN]; /* new filter value. */ -}; -/* Frequently accessed members in arpcom. */ -#define sc_enaddr sc_arpcom.ac_enaddr + u_int8_t sc_enaddr[ETHER_ADDR_LEN]; +}; /* Standard driver entry points. These can be static. */ int feprobe __P((struct device *, void *, void *)); @@ -224,7 +224,7 @@ void fe_xmit __P((struct fe_softc *)); void fe_write_mbufs __P((struct fe_softc *, struct mbuf *)); static inline void fe_droppacket __P((struct fe_softc *)); -void fe_getmcaf __P((struct arpcom *, u_char *)); +void fe_getmcaf __P((struct ethercom *, u_char *)); void fe_setmode __P((struct fe_softc *)); void fe_loadmar __P((struct fe_softc *)); #if FE_DEBUG >= 1 @@ -994,7 +994,7 @@ feattach(parent, self, aux) struct fe_softc *sc = (void *)self; struct isa_attach_args *ia = aux; struct cfdata *cf = sc->sc_dev.dv_cfdata; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Stop the 86960. */ fe_stop(sc); @@ -1063,11 +1063,11 @@ feattach(parent, self, aux) /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->sc_enaddr); /* Print additional info when attached. */ printf(": address %s, type %s\n", - ether_sprintf(sc->sc_arpcom.ac_enaddr), sc->typestr); + ether_sprintf(sc->sc_enaddr), sc->typestr); #if FE_DEBUG >= 3 { int buf, txb, bbw, sbw, ram; @@ -1214,7 +1214,7 @@ fe_watchdog(ifp) #endif /* Record how many packets are lost by this accident. */ - sc->sc_arpcom.ac_if.if_oerrors += sc->txb_sched + sc->txb_count; + sc->sc_ethercom.ec_if.if_oerrors += sc->txb_sched + sc->txb_count; fe_reset(sc); } @@ -1237,7 +1237,7 @@ void fe_init(sc) struct fe_softc *sc; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int i; #if FE_DEBUG >= 3 @@ -1399,7 +1399,7 @@ fe_xmit(sc) * We use longer timeout for multiple packet transmission. * I'm not sure this timer value is appropriate. FIXME. */ - sc->sc_arpcom.ac_if.if_timer = 1 + sc->txb_count; + sc->sc_ethercom.ec_if.if_timer = 1 + sc->txb_count; /* Update txb variables. */ sc->txb_sched = sc->txb_count; @@ -1577,7 +1577,7 @@ fe_tint(sc, tstat) struct fe_softc *sc; u_char tstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int left; int col; @@ -1716,7 +1716,7 @@ fe_rint(sc, rstat) struct fe_softc *sc; u_char rstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int len; u_char status; int i; @@ -1898,7 +1898,7 @@ feintr(arg) if (sc->filter_change && sc->txb_count == 0 && sc->txb_sched == 0) { fe_loadmar(sc); - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; } /* @@ -1907,8 +1907,8 @@ feintr(arg) * after handling the receiver interrupt to give the * receive operation priority. */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE) == 0) - fe_start(&sc->sc_arpcom.ac_if); + if ((sc->sc_ethercom.ec_if.if_flags & IFF_OACTIVE) == 0) + fe_start(&sc->sc_ethercom.ec_if); /* * Get interrupt conditions, masking unneeded flags. @@ -1949,7 +1949,7 @@ fe_ioctl(ifp, command, data) #ifdef INET case AF_INET: fe_init(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -1959,11 +1959,13 @@ fe_ioctl(ifp, command, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); - else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + *(union ns_host *)(sc->sc_enaddr); + else { + bcopy(ina->x_host.c_host, sc->sc_enaddr, + ETHER_ADDR_LEN); + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); + } /* Set new address. */ fe_init(sc); break; @@ -2011,8 +2013,8 @@ fe_ioctl(ifp, command, data) case SIOCDELMULTI: /* Update our multicast list. */ error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom) : + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -2044,7 +2046,7 @@ fe_get_packet(sc, len) { struct ether_header *eh; struct mbuf *m; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Allocate a header mbuf. */ MGETHDR(m, M_DONTWAIT, MT_DATA); @@ -2105,7 +2107,7 @@ fe_get_packet(sc, len) */ if ((ifp->if_flags & IFF_PROMISC) != 0 && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, sc->sc_enaddr, sizeof(eh->ether_dhost)) != 0) { m_freem(m); return (1); @@ -2186,7 +2188,7 @@ fe_write_mbufs(sc, m) log(LOG_ERR, "%s: got a %s packet (%u bytes) to send\n", sc->sc_dev.dv_xname, totlen < ETHER_HDR_SIZE ? "partial" : "big", totlen); - sc->sc_arpcom.ac_if.if_oerrors++; + sc->sc_ethercom.ec_if.if_oerrors++; return; } #endif @@ -2270,11 +2272,11 @@ fe_write_mbufs(sc, m) * list of multicast addresses we need to listen to. */ void -fe_getmcaf(ac, af) - struct arpcom *ac; +fe_getmcaf(ec, af) + struct ethercom *ec; u_char *af; { - struct ifnet *ifp = &ac->ac_if; + struct ifnet *ifp = &ec->ec_if; struct ether_multi *enm; register u_char *cp, c; register u_long crc; @@ -2293,7 +2295,7 @@ fe_getmcaf(ac, af) goto allmulti; af[0] = af[1] = af[2] = af[3] = af[4] = af[5] = af[6] = af[7] = 0x00; - ETHER_FIRST_MULTI(step, ac, enm); + ETHER_FIRST_MULTI(step, ec, enm); while (enm != NULL) { if (bcmp(enm->enm_addrlo, enm->enm_addrhi, sizeof(enm->enm_addrlo)) != 0) { @@ -2345,7 +2347,7 @@ void fe_setmode(sc) struct fe_softc *sc; { - int flags = sc->sc_arpcom.ac_if.if_flags; + int flags = sc->sc_ethercom.ec_if.if_flags; /* * If the interface is not running, we postpone the update @@ -2392,7 +2394,7 @@ fe_setmode(sc) /* * Find the new multicast filter value. */ - fe_getmcaf(&sc->sc_arpcom, sc->filter); + fe_getmcaf(&sc->sc_ethercom, sc->filter); sc->filter_change = 1; #if FE_DEBUG >= 3 diff --git a/sys/dev/isa/if_ed.c b/sys/dev/isa/if_ed.c index c949235c335..eaebc812edd 100644 --- a/sys/dev/isa/if_ed.c +++ b/sys/dev/isa/if_ed.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ed.c,v 1.106 1996/11/17 04:11:18 mikel Exp $ */ +/* $NetBSD: if_ed.c,v 1.107 1997/03/15 18:11:39 is Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -31,14 +31,15 @@ #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> -#include <net/netisr.h> + +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -67,7 +68,7 @@ struct ed_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* ethernet common */ + struct ethercom sc_ethercom; /* ethernet common */ char *type_str; /* pointer to type string */ u_char vendor; /* interface vendor */ @@ -112,6 +113,8 @@ struct ed_softc { u_char rec_page_start; /* first page of RX ring-buffer */ u_char rec_page_stop; /* last page of RX ring-buffer */ u_char next_packet; /* pointer to next unread RX packet */ + + u_int8_t sc_enaddr[6]; }; int edprobe __P((struct device *, void *, void *)); @@ -138,7 +141,7 @@ void ed_shared_readmem __P((struct ed_softc *, int, caddr_t, int)); #define inline /* XXX for debugging porpoises */ -void ed_getmcaf __P((struct arpcom *, u_long *)); +void ed_getmcaf __P((struct ethercom *, u_long *)); void edread __P((struct ed_softc *, int, int)); struct mbuf *edget __P((struct ed_softc *, int, int)); static inline void ed_rint __P((struct ed_softc *)); @@ -529,7 +532,7 @@ ed_find_WD80x3(sc, cf, ia) /* Get station address from on-board ROM. */ for (i = 0; i < ETHER_ADDR_LEN; ++i) - sc->sc_arpcom.ac_enaddr[i] = + sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, asicbase + ED_WD_PROM + i); /* @@ -809,7 +812,7 @@ ed_find_3Com(sc, cf, ia) ED_3COM_CR_EALO | ED_3COM_CR_XSEL); for (i = 0; i < ETHER_ADDR_LEN; ++i) - sc->sc_arpcom.ac_enaddr[i] = NIC_GET(iot, ioh, nicbase, i); + sc->sc_enaddr[i] = NIC_GET(iot, ioh, nicbase, i); /* * Unmap PROM - select NIC registers. The proper setting of the @@ -1206,10 +1209,10 @@ ed_find_Novell(sc, cf, ia) ed_pio_readmem(sc, 0, romdata, 16); for (n = 0; n < ETHER_ADDR_LEN; n++) - sc->sc_arpcom.ac_enaddr[n] = romdata[n*(sc->isa16bit+1)]; + sc->sc_enaddr[n] = romdata[n*(sc->isa16bit+1)]; #ifdef GWETHER - if (sc->arpcom.ac_enaddr[2] == 0x86) + if (sc->sc_enaddr[2] == 0x86) sc->type_str = "Gateway AT"; #endif /* GWETHER */ @@ -1245,7 +1248,7 @@ edattach(parent, self, aux) struct ed_softc *sc = (void *)self; struct isa_attach_args *ia = aux; struct cfdata *cf = sc->sc_dev.dv_cfdata; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int asicbase; /* @@ -1290,11 +1293,11 @@ edattach(parent, self, aux) /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->sc_enaddr); /* Print additional info when attached. */ printf("\n%s: address %s, ", sc->sc_dev.dv_xname, - ether_sprintf(sc->sc_arpcom.ac_enaddr)); + ether_sprintf(sc->sc_enaddr)); if (sc->type_str) printf("type %s ", sc->type_str); @@ -1376,7 +1379,7 @@ edwatchdog(ifp) struct ed_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); - ++sc->sc_arpcom.ac_if.if_oerrors; + ++sc->sc_ethercom.ec_if.if_oerrors; edreset(sc); } @@ -1390,7 +1393,7 @@ edinit(sc) { bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int nicbase = sc->nic_base, asicbase = sc->asic_base; int i; u_long mcaf[2]; @@ -1466,10 +1469,10 @@ edinit(sc) /* Copy out our station address. */ for (i = 0; i < ETHER_ADDR_LEN; ++i) NIC_PUT(iot, ioh, nicbase, ED_P1_PAR0 + i, - sc->sc_arpcom.ac_enaddr[i]); + LLADDR(ifp->if_sadl)[i]); /* Set multicast filter on chip. */ - ed_getmcaf(&sc->sc_arpcom, mcaf); + ed_getmcaf(&sc->sc_ethercom, mcaf); for (i = 0; i < 8; i++) NIC_PUT(iot, ioh, nicbase, ED_P1_MAR0 + i, ((u_char *)mcaf)[i]); @@ -1543,7 +1546,7 @@ ed_xmit(sc) { bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int nicbase = sc->nic_base; u_short len; @@ -1798,7 +1801,7 @@ loop: log(LOG_ERR, "%s: NIC memory corrupt - invalid packet length %d\n", sc->sc_dev.dv_xname, len); - ++sc->sc_arpcom.ac_if.if_ierrors; + ++sc->sc_ethercom.ec_if.if_ierrors; edreset(sc); return; } @@ -1827,7 +1830,7 @@ edintr(arg) struct ed_softc *sc = arg; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int nicbase = sc->nic_base, asicbase = sc->asic_base; u_char isr; @@ -2054,7 +2057,7 @@ edioctl(ifp, cmd, data) #ifdef INET case AF_INET: edinit(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -2065,11 +2068,11 @@ edioctl(ifp, cmd, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); - else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + *(union ns_host *)LLADDR(ifp->if_sadl); + else { + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); + } /* Set new address. */ edinit(sc); break; @@ -2111,8 +2114,8 @@ edioctl(ifp, cmd, data) case SIOCDELMULTI: /* Update our multicast list. */ error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom) : + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -2143,7 +2146,7 @@ edread(sc, buf, len) struct ed_softc *sc; int buf, len; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mbuf *m; struct ether_header *eh; @@ -2174,7 +2177,7 @@ edread(sc, buf, len) */ if ((ifp->if_flags & IFF_PROMISC) && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl), sizeof(eh->ether_dhost)) != 0) { m_freem(m); return; @@ -2452,7 +2455,7 @@ edget(sc, src, total_len) int src; u_short total_len; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mbuf *top, **mp, *m; int len; @@ -2494,11 +2497,11 @@ edget(sc, src, total_len) * need to listen to. */ void -ed_getmcaf(ac, af) - struct arpcom *ac; +ed_getmcaf(ec, af) + struct ethercom *ec; u_long *af; { - struct ifnet *ifp = &ac->ac_if; + struct ifnet *ifp = &ec->ec_if; struct ether_multi *enm; register u_char *cp, c; register u_long crc; @@ -2520,7 +2523,7 @@ ed_getmcaf(ac, af) } af[0] = af[1] = 0; - ETHER_FIRST_MULTI(step, ac, enm); + ETHER_FIRST_MULTI(step, ec, enm); while (enm != NULL) { if (bcmp(enm->enm_addrlo, enm->enm_addrhi, sizeof(enm->enm_addrlo)) != 0) { diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c index 11cb32fb61b..9a68d89a3cd 100644 --- a/sys/dev/isa/if_eg.c +++ b/sys/dev/isa/if_eg.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_eg.c,v 1.32 1996/10/21 22:40:50 thorpej Exp $ */ +/* $NetBSD: if_eg.c,v 1.33 1997/03/15 18:11:40 is Exp $ */ /* * Copyright (c) 1993 Dean Huxley <dean@fsa.ca> @@ -52,17 +52,17 @@ #include <sys/device.h> #include <net/if.h> -#include <net/netisr.h> #include <net/if_dl.h> #include <net/if_types.h> -#include <net/netisr.h> + +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -103,7 +103,7 @@ struct eg_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* Ethernet common part */ + struct ethercom sc_ethercom; /* Ethernet common part */ bus_space_tag_t sc_iot; /* bus space identifier */ bus_space_handle_t sc_ioh; /* i/o handle */ u_int8_t eg_rom_major; /* Cards ROM version (major number) */ @@ -397,7 +397,8 @@ egattach(parent, self, aux) struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; + u_int8_t myaddr[ETHER_ADDR_LEN]; printf("\n"); @@ -431,11 +432,11 @@ egattach(parent, self, aux) egprintpcb(sc); return; } - bcopy(&sc->eg_pcb[2], sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); + bcopy(&sc->eg_pcb[2], myaddr, ETHER_ADDR_LEN); printf("%s: ROM v%d.%02d %dk address %s\n", self->dv_xname, sc->eg_rom_major, sc->eg_rom_minor, sc->eg_ram, - ether_sprintf(sc->sc_arpcom.ac_enaddr)); + ether_sprintf(myaddr)); sc->eg_pcb[0] = EG_CMD_SETEADDR; /* Set station address */ if (egwritePCB(sc) != 0) { @@ -466,7 +467,7 @@ egattach(parent, self, aux) /* Now we can attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, myaddr); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); @@ -480,7 +481,7 @@ void eginit(sc) register struct eg_softc *sc; { - register struct ifnet *ifp = &sc->sc_arpcom.ac_if; + register struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; @@ -676,13 +677,13 @@ egintr(arg) if (sc->eg_pcb[6] || sc->eg_pcb[7]) { DPRINTF(("%s: packet dropped\n", sc->sc_dev.dv_xname)); - sc->sc_arpcom.ac_if.if_oerrors++; + sc->sc_ethercom.ec_if.if_oerrors++; } else - sc->sc_arpcom.ac_if.if_opackets++; - sc->sc_arpcom.ac_if.if_collisions += + sc->sc_ethercom.ec_if.if_opackets++; + sc->sc_ethercom.ec_if.if_collisions += sc->eg_pcb[8] & 0xf; - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; - egstart(&sc->sc_arpcom.ac_if); + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; + egstart(&sc->sc_ethercom.ec_if); serviced = 1; break; @@ -725,7 +726,7 @@ egread(sc, buf, len) caddr_t buf; int len; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mbuf *m; struct ether_header *eh; @@ -764,7 +765,7 @@ egread(sc, buf, len) */ if ((ifp->if_flags & IFF_PROMISC) && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl), sizeof(eh->ether_dhost)) != 0) { m_freem(m); return; @@ -786,7 +787,7 @@ egget(sc, buf, totlen) caddr_t buf; int totlen; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mbuf *top, **mp, *m; int len; @@ -845,7 +846,7 @@ egioctl(ifp, cmd, data) #ifdef INET case AF_INET: eginit(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -855,11 +856,10 @@ egioctl(ifp, cmd, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); + *(union ns_host *)LLADDR(ifp->if_sadl); else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); /* Set new address. */ eginit(sc); break; @@ -929,7 +929,7 @@ egwatchdog(ifp) struct eg_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); - sc->sc_arpcom.ac_if.if_oerrors++; + sc->sc_ethercom.ec_if.if_oerrors++; egreset(sc); } diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c index 762dc9e5d82..5883e7fe937 100644 --- a/sys/dev/isa/if_el.c +++ b/sys/dev/isa/if_el.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_el.c,v 1.43 1996/10/21 22:40:53 thorpej Exp $ */ +/* $NetBSD: if_el.c,v 1.44 1997/03/15 18:11:41 is Exp $ */ /* * Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted @@ -33,12 +33,14 @@ #include <net/if_dl.h> #include <net/if_types.h> +#include <net/if_ether.h> + #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -76,7 +78,7 @@ struct el_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* ethernet common */ + struct ethercom sc_ethercom; /* ethernet common */ bus_space_tag_t sc_iot; /* bus space identifier */ bus_space_handle_t sc_ioh; /* i/o handle */ }; @@ -190,7 +192,8 @@ elattach(parent, self, aux) struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; + u_int8_t myaddr[ETHER_ADDR_LEN]; u_int8_t i; printf("\n"); @@ -214,7 +217,7 @@ elattach(parent, self, aux) /* Now read the address. */ for (i = 0; i < ETHER_ADDR_LEN; i++) { bus_space_write_1(iot, ioh, EL_GPBL, i); - sc->sc_arpcom.ac_enaddr[i] = bus_space_read_1(iot, ioh, EL_EAW); + myaddr[i] = bus_space_read_1(iot, ioh, EL_EAW); } /* Stop the board. */ @@ -231,11 +234,10 @@ elattach(parent, self, aux) /* Now we can attach the interface. */ DPRINTF(("Attaching interface...\n")); if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, myaddr); /* Print out some information for the user. */ - printf("%s: address %s\n", self->dv_xname, - ether_sprintf(sc->sc_arpcom.ac_enaddr)); + printf("%s: address %s\n", self->dv_xname, ether_sprintf(myaddr)); /* Finally, attach to bpf filter if it is present. */ #if NBPFILTER > 0 @@ -293,7 +295,8 @@ el_hardreset(sc) bus_space_write_1(iot, ioh, EL_AC, 0); for (i = 0; i < ETHER_ADDR_LEN; i++) - bus_space_write_1(iot, ioh, i, sc->sc_arpcom.ac_enaddr[i]); + bus_space_write_1(iot, ioh, i, + LLADDR(sc->sc_ethercom.ec_if.if_sadl)[i]); } /* @@ -303,7 +306,7 @@ void elinit(sc) struct el_softc *sc; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; @@ -517,7 +520,7 @@ elintr(arg) DPRINTF(("overflow.\n")); el_hardreset(sc); /* Put board back into receive mode. */ - if (sc->sc_arpcom.ac_if.if_flags & IFF_PROMISC) + if (sc->sc_ethercom.ec_if.if_flags & IFF_PROMISC) bus_space_write_1(iot, ioh, EL_RXC, EL_RXC_AGF | EL_RXC_DSHORT | EL_RXC_DDRIB | EL_RXC_DOFLOW | EL_RXC_PROMISC); @@ -559,7 +562,7 @@ elread(sc, len) register struct el_softc *sc; int len; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mbuf *m; struct ether_header *eh; @@ -598,7 +601,7 @@ elread(sc, len) */ if ((ifp->if_flags & IFF_PROMISC) && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl), sizeof(eh->ether_dhost)) != 0) { m_freem(m); return; @@ -621,7 +624,7 @@ elget(sc, totlen) struct el_softc *sc; int totlen; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; struct mbuf *top, **mp, *m; @@ -690,7 +693,7 @@ elioctl(ifp, cmd, data) #ifdef INET case AF_INET: elinit(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -701,11 +704,10 @@ elioctl(ifp, cmd, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); + *(union ns_host *)LLADDR(ifp->if_sadl); else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); /* Set new address. */ elinit(sc); break; @@ -761,7 +763,7 @@ elwatchdog(ifp) struct el_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); - sc->sc_arpcom.ac_if.if_oerrors++; + sc->sc_ethercom.ec_if.if_oerrors++; elreset(sc); } diff --git a/sys/dev/isa/if_ep_isa.c b/sys/dev/isa/if_ep_isa.c index 8e97402f70e..4f02367f4c0 100644 --- a/sys/dev/isa/if_ep_isa.c +++ b/sys/dev/isa/if_ep_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ep_isa.c,v 1.9 1997/02/18 10:51:09 jonathan Exp $ */ +/* $NetBSD: if_ep_isa.c,v 1.10 1997/03/15 18:11:42 is Exp $ */ /* * Copyright (c) 1996 Jason R. Thorpe <thorpej@beer.org> @@ -47,14 +47,15 @@ #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> -#include <net/netisr.h> + +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS diff --git a/sys/dev/isa/if_fe.c b/sys/dev/isa/if_fe.c index e56539bdf14..1a0d48e545c 100644 --- a/sys/dev/isa/if_fe.c +++ b/sys/dev/isa/if_fe.c @@ -58,14 +58,15 @@ #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> -#include <net/netisr.h> + +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -167,7 +168,7 @@ struct fe_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* ethernet common */ + struct ethercom sc_ethercom; /* ethernet common */ /* Set by probe() and not modified in later phases. */ enum fe_type type; /* interface type code */ @@ -194,10 +195,9 @@ struct fe_softc { /* Multicast address filter management. */ u_char filter_change; /* MARs must be changed ASAP. */ u_char filter[FE_FILTER_LEN]; /* new filter value. */ -}; -/* Frequently accessed members in arpcom. */ -#define sc_enaddr sc_arpcom.ac_enaddr + u_int8_t sc_enaddr[ETHER_ADDR_LEN]; +}; /* Standard driver entry points. These can be static. */ int feprobe __P((struct device *, void *, void *)); @@ -224,7 +224,7 @@ void fe_xmit __P((struct fe_softc *)); void fe_write_mbufs __P((struct fe_softc *, struct mbuf *)); static inline void fe_droppacket __P((struct fe_softc *)); -void fe_getmcaf __P((struct arpcom *, u_char *)); +void fe_getmcaf __P((struct ethercom *, u_char *)); void fe_setmode __P((struct fe_softc *)); void fe_loadmar __P((struct fe_softc *)); #if FE_DEBUG >= 1 @@ -994,7 +994,7 @@ feattach(parent, self, aux) struct fe_softc *sc = (void *)self; struct isa_attach_args *ia = aux; struct cfdata *cf = sc->sc_dev.dv_cfdata; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Stop the 86960. */ fe_stop(sc); @@ -1063,11 +1063,11 @@ feattach(parent, self, aux) /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->sc_enaddr); /* Print additional info when attached. */ printf(": address %s, type %s\n", - ether_sprintf(sc->sc_arpcom.ac_enaddr), sc->typestr); + ether_sprintf(sc->sc_enaddr), sc->typestr); #if FE_DEBUG >= 3 { int buf, txb, bbw, sbw, ram; @@ -1214,7 +1214,7 @@ fe_watchdog(ifp) #endif /* Record how many packets are lost by this accident. */ - sc->sc_arpcom.ac_if.if_oerrors += sc->txb_sched + sc->txb_count; + sc->sc_ethercom.ec_if.if_oerrors += sc->txb_sched + sc->txb_count; fe_reset(sc); } @@ -1237,7 +1237,7 @@ void fe_init(sc) struct fe_softc *sc; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int i; #if FE_DEBUG >= 3 @@ -1399,7 +1399,7 @@ fe_xmit(sc) * We use longer timeout for multiple packet transmission. * I'm not sure this timer value is appropriate. FIXME. */ - sc->sc_arpcom.ac_if.if_timer = 1 + sc->txb_count; + sc->sc_ethercom.ec_if.if_timer = 1 + sc->txb_count; /* Update txb variables. */ sc->txb_sched = sc->txb_count; @@ -1577,7 +1577,7 @@ fe_tint(sc, tstat) struct fe_softc *sc; u_char tstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int left; int col; @@ -1716,7 +1716,7 @@ fe_rint(sc, rstat) struct fe_softc *sc; u_char rstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int len; u_char status; int i; @@ -1898,7 +1898,7 @@ feintr(arg) if (sc->filter_change && sc->txb_count == 0 && sc->txb_sched == 0) { fe_loadmar(sc); - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; } /* @@ -1907,8 +1907,8 @@ feintr(arg) * after handling the receiver interrupt to give the * receive operation priority. */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE) == 0) - fe_start(&sc->sc_arpcom.ac_if); + if ((sc->sc_ethercom.ec_if.if_flags & IFF_OACTIVE) == 0) + fe_start(&sc->sc_ethercom.ec_if); /* * Get interrupt conditions, masking unneeded flags. @@ -1949,7 +1949,7 @@ fe_ioctl(ifp, command, data) #ifdef INET case AF_INET: fe_init(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -1959,11 +1959,13 @@ fe_ioctl(ifp, command, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); - else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + *(union ns_host *)(sc->sc_enaddr); + else { + bcopy(ina->x_host.c_host, sc->sc_enaddr, + ETHER_ADDR_LEN); + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); + } /* Set new address. */ fe_init(sc); break; @@ -2011,8 +2013,8 @@ fe_ioctl(ifp, command, data) case SIOCDELMULTI: /* Update our multicast list. */ error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom) : + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -2044,7 +2046,7 @@ fe_get_packet(sc, len) { struct ether_header *eh; struct mbuf *m; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Allocate a header mbuf. */ MGETHDR(m, M_DONTWAIT, MT_DATA); @@ -2105,7 +2107,7 @@ fe_get_packet(sc, len) */ if ((ifp->if_flags & IFF_PROMISC) != 0 && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, sc->sc_enaddr, sizeof(eh->ether_dhost)) != 0) { m_freem(m); return (1); @@ -2186,7 +2188,7 @@ fe_write_mbufs(sc, m) log(LOG_ERR, "%s: got a %s packet (%u bytes) to send\n", sc->sc_dev.dv_xname, totlen < ETHER_HDR_SIZE ? "partial" : "big", totlen); - sc->sc_arpcom.ac_if.if_oerrors++; + sc->sc_ethercom.ec_if.if_oerrors++; return; } #endif @@ -2270,11 +2272,11 @@ fe_write_mbufs(sc, m) * list of multicast addresses we need to listen to. */ void -fe_getmcaf(ac, af) - struct arpcom *ac; +fe_getmcaf(ec, af) + struct ethercom *ec; u_char *af; { - struct ifnet *ifp = &ac->ac_if; + struct ifnet *ifp = &ec->ec_if; struct ether_multi *enm; register u_char *cp, c; register u_long crc; @@ -2293,7 +2295,7 @@ fe_getmcaf(ac, af) goto allmulti; af[0] = af[1] = af[2] = af[3] = af[4] = af[5] = af[6] = af[7] = 0x00; - ETHER_FIRST_MULTI(step, ac, enm); + ETHER_FIRST_MULTI(step, ec, enm); while (enm != NULL) { if (bcmp(enm->enm_addrlo, enm->enm_addrhi, sizeof(enm->enm_addrlo)) != 0) { @@ -2345,7 +2347,7 @@ void fe_setmode(sc) struct fe_softc *sc; { - int flags = sc->sc_arpcom.ac_if.if_flags; + int flags = sc->sc_ethercom.ec_if.if_flags; /* * If the interface is not running, we postpone the update @@ -2392,7 +2394,7 @@ fe_setmode(sc) /* * Find the new multicast filter value. */ - fe_getmcaf(&sc->sc_arpcom, sc->filter); + fe_getmcaf(&sc->sc_ethercom, sc->filter); sc->filter_change = 1; #if FE_DEBUG >= 3 diff --git a/sys/dev/isa/if_fmv.c b/sys/dev/isa/if_fmv.c index e56539bdf14..1a0d48e545c 100644 --- a/sys/dev/isa/if_fmv.c +++ b/sys/dev/isa/if_fmv.c @@ -58,14 +58,15 @@ #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> -#include <net/netisr.h> + +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -167,7 +168,7 @@ struct fe_softc { struct device sc_dev; void *sc_ih; - struct arpcom sc_arpcom; /* ethernet common */ + struct ethercom sc_ethercom; /* ethernet common */ /* Set by probe() and not modified in later phases. */ enum fe_type type; /* interface type code */ @@ -194,10 +195,9 @@ struct fe_softc { /* Multicast address filter management. */ u_char filter_change; /* MARs must be changed ASAP. */ u_char filter[FE_FILTER_LEN]; /* new filter value. */ -}; -/* Frequently accessed members in arpcom. */ -#define sc_enaddr sc_arpcom.ac_enaddr + u_int8_t sc_enaddr[ETHER_ADDR_LEN]; +}; /* Standard driver entry points. These can be static. */ int feprobe __P((struct device *, void *, void *)); @@ -224,7 +224,7 @@ void fe_xmit __P((struct fe_softc *)); void fe_write_mbufs __P((struct fe_softc *, struct mbuf *)); static inline void fe_droppacket __P((struct fe_softc *)); -void fe_getmcaf __P((struct arpcom *, u_char *)); +void fe_getmcaf __P((struct ethercom *, u_char *)); void fe_setmode __P((struct fe_softc *)); void fe_loadmar __P((struct fe_softc *)); #if FE_DEBUG >= 1 @@ -994,7 +994,7 @@ feattach(parent, self, aux) struct fe_softc *sc = (void *)self; struct isa_attach_args *ia = aux; struct cfdata *cf = sc->sc_dev.dv_cfdata; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Stop the 86960. */ fe_stop(sc); @@ -1063,11 +1063,11 @@ feattach(parent, self, aux) /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->sc_enaddr); /* Print additional info when attached. */ printf(": address %s, type %s\n", - ether_sprintf(sc->sc_arpcom.ac_enaddr), sc->typestr); + ether_sprintf(sc->sc_enaddr), sc->typestr); #if FE_DEBUG >= 3 { int buf, txb, bbw, sbw, ram; @@ -1214,7 +1214,7 @@ fe_watchdog(ifp) #endif /* Record how many packets are lost by this accident. */ - sc->sc_arpcom.ac_if.if_oerrors += sc->txb_sched + sc->txb_count; + sc->sc_ethercom.ec_if.if_oerrors += sc->txb_sched + sc->txb_count; fe_reset(sc); } @@ -1237,7 +1237,7 @@ void fe_init(sc) struct fe_softc *sc; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int i; #if FE_DEBUG >= 3 @@ -1399,7 +1399,7 @@ fe_xmit(sc) * We use longer timeout for multiple packet transmission. * I'm not sure this timer value is appropriate. FIXME. */ - sc->sc_arpcom.ac_if.if_timer = 1 + sc->txb_count; + sc->sc_ethercom.ec_if.if_timer = 1 + sc->txb_count; /* Update txb variables. */ sc->txb_sched = sc->txb_count; @@ -1577,7 +1577,7 @@ fe_tint(sc, tstat) struct fe_softc *sc; u_char tstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int left; int col; @@ -1716,7 +1716,7 @@ fe_rint(sc, rstat) struct fe_softc *sc; u_char rstat; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int len; u_char status; int i; @@ -1898,7 +1898,7 @@ feintr(arg) if (sc->filter_change && sc->txb_count == 0 && sc->txb_sched == 0) { fe_loadmar(sc); - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; } /* @@ -1907,8 +1907,8 @@ feintr(arg) * after handling the receiver interrupt to give the * receive operation priority. */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE) == 0) - fe_start(&sc->sc_arpcom.ac_if); + if ((sc->sc_ethercom.ec_if.if_flags & IFF_OACTIVE) == 0) + fe_start(&sc->sc_ethercom.ec_if); /* * Get interrupt conditions, masking unneeded flags. @@ -1949,7 +1949,7 @@ fe_ioctl(ifp, command, data) #ifdef INET case AF_INET: fe_init(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -1959,11 +1959,13 @@ fe_ioctl(ifp, command, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); - else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + *(union ns_host *)(sc->sc_enaddr); + else { + bcopy(ina->x_host.c_host, sc->sc_enaddr, + ETHER_ADDR_LEN); + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); + } /* Set new address. */ fe_init(sc); break; @@ -2011,8 +2013,8 @@ fe_ioctl(ifp, command, data) case SIOCDELMULTI: /* Update our multicast list. */ error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom) : + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -2044,7 +2046,7 @@ fe_get_packet(sc, len) { struct ether_header *eh; struct mbuf *m; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* Allocate a header mbuf. */ MGETHDR(m, M_DONTWAIT, MT_DATA); @@ -2105,7 +2107,7 @@ fe_get_packet(sc, len) */ if ((ifp->if_flags & IFF_PROMISC) != 0 && (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, + bcmp(eh->ether_dhost, sc->sc_enaddr, sizeof(eh->ether_dhost)) != 0) { m_freem(m); return (1); @@ -2186,7 +2188,7 @@ fe_write_mbufs(sc, m) log(LOG_ERR, "%s: got a %s packet (%u bytes) to send\n", sc->sc_dev.dv_xname, totlen < ETHER_HDR_SIZE ? "partial" : "big", totlen); - sc->sc_arpcom.ac_if.if_oerrors++; + sc->sc_ethercom.ec_if.if_oerrors++; return; } #endif @@ -2270,11 +2272,11 @@ fe_write_mbufs(sc, m) * list of multicast addresses we need to listen to. */ void -fe_getmcaf(ac, af) - struct arpcom *ac; +fe_getmcaf(ec, af) + struct ethercom *ec; u_char *af; { - struct ifnet *ifp = &ac->ac_if; + struct ifnet *ifp = &ec->ec_if; struct ether_multi *enm; register u_char *cp, c; register u_long crc; @@ -2293,7 +2295,7 @@ fe_getmcaf(ac, af) goto allmulti; af[0] = af[1] = af[2] = af[3] = af[4] = af[5] = af[6] = af[7] = 0x00; - ETHER_FIRST_MULTI(step, ac, enm); + ETHER_FIRST_MULTI(step, ec, enm); while (enm != NULL) { if (bcmp(enm->enm_addrlo, enm->enm_addrhi, sizeof(enm->enm_addrlo)) != 0) { @@ -2345,7 +2347,7 @@ void fe_setmode(sc) struct fe_softc *sc; { - int flags = sc->sc_arpcom.ac_if.if_flags; + int flags = sc->sc_ethercom.ec_if.if_flags; /* * If the interface is not running, we postpone the update @@ -2392,7 +2394,7 @@ fe_setmode(sc) /* * Find the new multicast filter value. */ - fe_getmcaf(&sc->sc_arpcom, sc->filter); + fe_getmcaf(&sc->sc_ethercom, sc->filter); sc->filter_change = 1; #if FE_DEBUG >= 3 diff --git a/sys/dev/isa/if_hp.c b/sys/dev/isa/if_hp.c index 35b1f6f43ed..8ef46e3b9bf 100644 --- a/sys/dev/isa/if_hp.c +++ b/sys/dev/isa/if_hp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_hp.c,v 1.23 1996/10/13 01:37:49 christos Exp $ */ +/* $NetBSD: if_hp.c,v 1.24 1997/03/15 18:11:44 is Exp $ */ /* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */ @@ -66,15 +66,14 @@ #include <sys/syslog.h> #include <net/if.h> -#include <net/netisr.h> -#include <net/route.h> +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -117,9 +116,8 @@ struct mbuf *hpget(); * This structure contains the output queue for the interface, its address, ... */ struct hp_softc { - struct arpcom ns_ac; /* Ethernet common part */ + struct ethercom ns_ec; /* Ethernet common part */ #define ns_if ns_ac.ac_if /* network-visible interface */ -#define ns_addrp ns_ac.ac_enaddr /* hardware Ethernet address */ int ns_flags; #define DSF_LOCK 1 /* block re-entering enstart */ int ns_oactive; @@ -137,6 +135,8 @@ struct hp_softc { #if NBPFILTER > 0 caddr_t ns_bpf; #endif + u_int8_t ns_addrp[ETHER_ADDR_LEN]; /* hardware Ethernet address */ + } hp_softc[NHP]; #define ENBUFSIZE (sizeof(struct ether_header) + ETHERMTU + 2 + ETHER_MIN_LEN) diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c index 0bb53d911ec..2084f91d60f 100644 --- a/sys/dev/isa/if_ie.c +++ b/sys/dev/isa/if_ie.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie.c,v 1.56 1996/11/05 07:17:23 mikel Exp $ */ +/* $NetBSD: if_ie.c,v 1.57 1997/03/15 18:11:46 is Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -121,8 +121,8 @@ iomem, and to make 16-pointers, we subtract sc_maddr and and with 0xffff. #include <net/if.h> #include <net/if_types.h> #include <net/if_dl.h> -#include <net/netisr.h> -#include <net/route.h> +#include <net/if_ether.h> + #if NBPFILTER > 0 #include <net/bpf.h> @@ -134,7 +134,7 @@ iomem, and to make 16-pointers, we subtract sc_maddr and and with 0xffff. #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -232,7 +232,7 @@ struct ie_softc { caddr_t sc_maddr; u_int sc_msize; - struct arpcom sc_arpcom; + struct ethercom sc_ethercom; void (*reset_586) __P((struct ie_softc *)); void (*chan_attn) __P((struct ie_softc *)); @@ -264,6 +264,8 @@ struct ie_softc { #ifdef IEDEBUG int sc_debug; #endif + u_int8_t sc_enaddr[6]; + u_int8_t sc_pad[2]; }; void iewatchdog __P((struct ifnet *)); @@ -749,14 +751,14 @@ ee16_probe(sc, ia) * save it in the softc for use by the 586 setup code. */ eaddrtemp = ee16_read_eeprom(sc, IEE16_EEPROM_ENET_HIGH); - sc->sc_arpcom.ac_enaddr[1] = eaddrtemp & 0xFF; - sc->sc_arpcom.ac_enaddr[0] = eaddrtemp >> 8; + sc->sc_enaddr[1] = eaddrtemp & 0xFF; + sc->sc_enaddr[0] = eaddrtemp >> 8; eaddrtemp = ee16_read_eeprom(sc, IEE16_EEPROM_ENET_MID); - sc->sc_arpcom.ac_enaddr[3] = eaddrtemp & 0xFF; - sc->sc_arpcom.ac_enaddr[2] = eaddrtemp >> 8; + sc->sc_enaddr[3] = eaddrtemp & 0xFF; + sc->sc_enaddr[2] = eaddrtemp >> 8; eaddrtemp = ee16_read_eeprom(sc, IEE16_EEPROM_ENET_LOW); - sc->sc_arpcom.ac_enaddr[5] = eaddrtemp & 0xFF; - sc->sc_arpcom.ac_enaddr[4] = eaddrtemp >> 8; + sc->sc_enaddr[5] = eaddrtemp & 0xFF; + sc->sc_enaddr[4] = eaddrtemp >> 8; /* disable the board interrupts */ outb(PORT + IEE16_IRQ, sc->irq_encoded); @@ -789,7 +791,7 @@ ieattach(parent, self, aux) { struct ie_softc *sc = (void *)self; struct isa_attach_args *ia = aux; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_softc = sc; @@ -801,14 +803,14 @@ ieattach(parent, self, aux) /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, sc->sc_enaddr); printf(": address %s, type %s R%d\n", - ether_sprintf(sc->sc_arpcom.ac_enaddr), + ether_sprintf(sc->sc_enaddr), ie_hardware_names[sc->hard_type], sc->hard_vers + 1); #if NBPFILTER > 0 - bpfattach(&sc->sc_arpcom.ac_if.if_bpf, ifp, DLT_EN10MB, + bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif @@ -827,7 +829,7 @@ iewatchdog(ifp) struct ie_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); - ++sc->sc_arpcom.ac_if.if_oerrors; + ++ifp->if_oerrors; iereset(sc); } @@ -839,6 +841,7 @@ ieintr(arg) void *arg; { struct ie_softc *sc = arg; + struct ifnet *ifp = arg; register u_short status; /* Clear the interrupt latch on the 3C507. */ @@ -883,7 +886,7 @@ loop: if (status & IE_ST_RNR) { printf("%s: receiver not ready\n", sc->sc_dev.dv_xname); - sc->sc_arpcom.ac_if.if_ierrors++; + ifp->if_ierrors++; iereset(sc); } @@ -915,16 +918,19 @@ ierint(sc) struct ie_softc *sc; { volatile struct ie_sys_ctl_block *scb = sc->scb; + struct ifnet *ifp; int i, status; static int timesthru = 1024; + ifp = &sc->sc_ethercom.ec_if; + i = sc->rfhead; for (;;) { status = sc->rframes[i]->ie_fd_status; if ((status & IE_FD_COMPLETE) && (status & IE_FD_OK)) { if (!--timesthru) { - sc->sc_arpcom.ac_if.if_ierrors += + ifp->if_ierrors += scb->ie_err_crc + scb->ie_err_align + scb->ie_err_resource + scb->ie_err_overrun; scb->ie_err_crc = scb->ie_err_align = @@ -956,7 +962,7 @@ void ietint(sc) struct ie_softc *sc; { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; int status; ifp->if_timer = 0; @@ -1047,8 +1053,11 @@ check_eh(sc, eh, to_bpf) struct ether_header *eh; int *to_bpf; { + struct ifnet *ifp; int i; + ifp = &sc->sc_ethercom.ec_if; + switch (sc->promisc) { case IFF_ALLMULTI: /* @@ -1056,11 +1065,11 @@ check_eh(sc, eh, to_bpf) * destined for us. */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); /* BPF gets this packet if anybody cares */ + *to_bpf = (ifp->if_bpf != 0); /* BPF gets this packet if anybody cares */ #endif if (eh->ether_dhost[0] & 1) return 1; - if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) + if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl))) return 1; return 0; @@ -1069,10 +1078,10 @@ check_eh(sc, eh, to_bpf) * Receiving all packets. These need to be passed on to BPF. */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); + *to_bpf = (ifp->if_bpf != 0); #endif /* If for us, accept and hand up to BPF */ - if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) + if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl))) return 1; #if NBPFILTER > 0 @@ -1107,14 +1116,14 @@ check_eh(sc, eh, to_bpf) * time. Whew! (Hope this is a fast machine...) */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); + *to_bpf = (sc->sc_ethercom.ec_if.if_bpf != 0); #endif /* We want to see multicasts. */ if (eh->ether_dhost[0] & 1) return 1; /* We want to see our own packets */ - if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) + if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl))) return 1; /* Anything else goes to BPF but nothing else. */ @@ -1134,7 +1143,7 @@ check_eh(sc, eh, to_bpf) * of here as quickly as possible. */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); + *to_bpf = (sc->sc_ethercom.ec_if.if_bpf != 0); #endif return 1; } @@ -1203,8 +1212,8 @@ iexmit(sc) * If BPF is listening on this interface, let it see the packet before * we push it on the wire. */ - if (sc->sc_arpcom.ac_if.if_bpf) - bpf_tap(sc->sc_arpcom.ac_if.if_bpf, + if (sc->sc_ethercom.ec_if.if_bpf) + bpf_tap(sc->sc_ethercom.ec_if.if_bpf, sc->xmit_cbuffs[sc->xctail], sc->xmit_buffs[sc->xctail]->ie_xmit_flags); #endif @@ -1225,7 +1234,7 @@ iexmit(sc) sc->scb->ie_command_list = MK_16(MEM, sc->xmit_cmds[sc->xctail]); command_and_wait(sc, IE_CU_START, 0, 0); - sc->sc_arpcom.ac_if.if_timer = 5; + sc->sc_ethercom.ec_if.if_timer = 5; } /* @@ -1268,7 +1277,7 @@ ieget(sc, ehp, to_bpf) * we are either running BPF or doing multicasting. */ if (!check_eh(sc, ehp, to_bpf)) { - sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */ + sc->sc_ethercom.ec_if.if_ierrors--; /* just this case, it's not an error */ return 0; } @@ -1277,7 +1286,7 @@ ieget(sc, ehp, to_bpf) MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == 0) return 0; - m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if; + m->m_pkthdr.rcvif = &sc->sc_ethercom.ec_if; m->m_pkthdr.len = totlen; len = MHLEN; top = 0; @@ -1384,7 +1393,7 @@ ie_readframe(sc, num) ie_drop_packet_buffer(sc); } if (m == 0) { - sc->sc_arpcom.ac_if.if_ierrors++; + sc->sc_ethercom.ec_if.if_ierrors++; return; } @@ -1410,7 +1419,7 @@ ie_readframe(sc, num) m0.m_next = m; /* Pass it up. */ - bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, &m0); + bpf_mtap(sc->sc_ethercom.ec_if.if_bpf, &m0); /* * A signal passed up from the filtering code indicating that @@ -1436,8 +1445,8 @@ ie_readframe(sc, num) /* * Finally pass this packet up to higher layers. */ - ether_input(&sc->sc_arpcom.ac_if, &eh, m); - sc->sc_arpcom.ac_if.if_ipackets++; + ether_input(&sc->sc_ethercom.ec_if, &eh, m); + sc->sc_ethercom.ec_if.if_ipackets++; } void @@ -1786,7 +1795,7 @@ void slel_get_address(sc) struct ie_softc *sc; { - u_char *addr = sc->sc_arpcom.ac_enaddr; + u_char *addr = sc->sc_enaddr; int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -2046,6 +2055,7 @@ ieinit(sc) struct ie_softc *sc; { volatile struct ie_sys_ctl_block *scb = sc->scb; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; void *ptr; ptr = (void *)ALIGN(scb + 1); @@ -2083,7 +2093,7 @@ ieinit(sc) cmd->com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST; cmd->com.ie_cmd_link = 0xffff; - bcopy(sc->sc_arpcom.ac_enaddr, (caddr_t)&cmd->ie_address, + bcopy(LLADDR(ifp->if_sadl), (caddr_t)&cmd->ie_address, sizeof cmd->ie_address); if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || @@ -2109,8 +2119,8 @@ ieinit(sc) */ iememinit(ptr, sc); - sc->sc_arpcom.ac_if.if_flags |= IFF_RUNNING; - sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + sc->sc_ethercom.ec_if.if_flags |= IFF_RUNNING; + sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE; sc->scb->ie_recv_list = MK_16(MEM, sc->rframes[0]); command_and_wait(sc, IE_RU_START, 0, 0); @@ -2163,7 +2173,7 @@ ieioctl(ifp, cmd, data) #ifdef INET case AF_INET: ieinit(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -2174,11 +2184,11 @@ ieioctl(ifp, cmd, data) if (ns_nullhost(*ina)) ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); - else - bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + *(union ns_host *)LLADDR(ifp->if_sadl); + else { + bcopy(ina->x_host.c_host, LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); + } /* Set new address. */ ieinit(sc); break; @@ -2226,8 +2236,8 @@ ieioctl(ifp, cmd, data) case SIOCADDMULTI: case SIOCDELMULTI: error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom): + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -2252,17 +2262,20 @@ mc_reset(sc) { struct ether_multi *enm; struct ether_multistep step; + struct ifnet *ifp; + + ifp = &sc->sc_ethercom.ec_if; /* * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, &sc->sc_ethercom, enm); while (enm) { if (sc->mcast_count >= MAXMCAST || bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + ifp->if_flags |= IFF_ALLMULTI; + ieioctl(ifp, SIOCSIFFLAGS, (void *)0); goto setflag; } diff --git a/sys/dev/isa/if_iy.c b/sys/dev/isa/if_iy.c index 46e40d20a32..eaae196b415 100644 --- a/sys/dev/isa/if_iy.c +++ b/sys/dev/isa/if_iy.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iy.c,v 1.9 1996/10/21 22:41:03 thorpej Exp $ */ +/* $NetBSD: if_iy.c,v 1.10 1997/03/15 18:11:47 is Exp $ */ /* #define IYDEBUG */ /* #define IYMEMDEBUG */ /*- @@ -49,8 +49,8 @@ #include <net/if.h> #include <net/if_types.h> #include <net/if_dl.h> -#include <net/netisr.h> -#include <net/route.h> + +#include <net/if_ether.h> #if NBPFILTER > 0 #include <net/bpf.h> @@ -62,7 +62,7 @@ #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS @@ -80,8 +80,8 @@ #include <dev/isa/isavar.h> #include <dev/ic/i82595reg.h> -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 +#define ETHER_MIN_LEN (ETHERMIN + sizeof(struct ether_header) + 4) +#define ETHER_MAX_LEN (ETHERMTU + sizeof(struct ether_header) + 4) /* * Ethernet status, per interface. @@ -93,7 +93,7 @@ struct iy_softc { bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; - struct arpcom sc_arpcom; + struct ethercom sc_ethercom; #define MAX_MBS 8 struct mbuf *mb[MAX_MBS]; @@ -124,9 +124,6 @@ void iystart __P((struct ifnet *)); void iy_intr_rx __P((struct iy_softc *)); void iy_intr_tx __P((struct iy_softc *)); -void eepro_reset_595 __P((struct iy_softc *)); -int eepro_probe __P((struct iy_softc *, struct isa_attach_args *)); -u_short eepro_read_eeprom __P((struct iy_softc *, int)); void iyreset __P((struct iy_softc *)); void iy_readframe __P((struct iy_softc *, int)); @@ -139,7 +136,9 @@ void iyget __P((struct iy_softc *, bus_space_tag_t, bus_space_handle_t, int)); void iymbuffill __P((void *)); void iymbufempty __P((void *)); void iyprobemem __P((struct iy_softc *)); - +static __inline void eepromwritebit __P((bus_space_tag_t, bus_space_handle_t, + int)); +static __inline int eepromreadbit __P((bus_space_tag_t, bus_space_handle_t)); /* * void iymeminit __P((void *, struct iy_softc *)); * static int iy_mc_setup __P((struct iy_softc *, void *)); @@ -155,8 +154,10 @@ int in_iftint = 0; int iyprobe __P((struct device *, void *, void *)); void iyattach __P((struct device *, struct device *, void *)); -static u_int16_t eepromread __P((bus_space_tag_t, bus_space_handle_t, - bus_size_t, int)); +static u_int16_t eepromread __P((bus_space_tag_t, bus_space_handle_t, int)); + +static int eepromreadall __P((bus_space_tag_t, bus_space_handle_t, u_int16_t *, + int)); struct cfattach iy_ca = { sizeof(struct iy_softc), iyprobe, iyattach @@ -174,88 +175,59 @@ iyprobe(parent, match, aux) struct device *parent; void *match, *aux; { - struct iy_softc *sc = match; struct isa_attach_args *ia = aux; - u_int16_t eaddr[8]; bus_space_tag_t iot; bus_space_handle_t ioh; - int i; - - u_int16_t checksum = 0; - u_int16_t eepromtmp; u_int8_t c, d; iot = ia->ia_iot; if (bus_space_map(iot, ia->ia_iobase, 16, 0, &ioh)) - goto out; - - /* check here for addresses already given to other devices */ - + return 0; /* try to find the round robin sig: */ c = bus_space_read_1(iot, ioh, ID_REG); - if (c & ID_REG_MASK != ID_REG_SIG) + if ((c & ID_REG_MASK) != ID_REG_SIG) goto out; d = bus_space_read_1(iot, ioh, ID_REG); - if (d & ID_REG_MASK != ID_REG_SIG) + if ((d & ID_REG_MASK) != ID_REG_SIG) goto out; if (((d-c) & R_ROBIN_BITS) != 0x40) goto out; d = bus_space_read_1(iot, ioh, ID_REG); - if (d & ID_REG_MASK != ID_REG_SIG) + if ((d & ID_REG_MASK) != ID_REG_SIG) goto out; if (((d-c) & R_ROBIN_BITS) != 0x80) goto out; d = bus_space_read_1(iot, ioh, ID_REG); - if (d & ID_REG_MASK != ID_REG_SIG) + if ((d & ID_REG_MASK) != ID_REG_SIG) goto out; if (((d-c) & R_ROBIN_BITS) != 0xC0) goto out; d = bus_space_read_1(iot, ioh, ID_REG); - if (d & ID_REG_MASK != ID_REG_SIG) + if ((d & ID_REG_MASK) != ID_REG_SIG) goto out; if (((d-c) & R_ROBIN_BITS) != 0x00) goto out; #ifdef IYDEBUG - printf("eepro_probe verified working ID reg.\n"); + printf("iyprobe verified working ID reg.\n"); #endif - for (i=0; i<64; ++i) { - eepromtmp = eepromread(iot, ioh, EEPROM_REG, i); - checksum += eepromtmp; - if (i<(sizeof(eaddr)/sizeof(*eaddr))) - eaddr[i] = eepromtmp; - } - if (checksum != EEPP_CHKSUM) - printf("wrong EEPROM checksum 0x%x should be 0x%x\n", - checksum, EEPP_CHKSUM); - - - if ((eaddr[EEPPEther0] != eepromread(iot, ioh, EEPROM_REG, EEPPEther0a)) && - (eaddr[EEPPEther1] != eepromread(iot, ioh, EEPROM_REG, EEPPEther1a)) && - (eaddr[EEPPEther2] != eepromread(iot, ioh, EEPROM_REG, EEPPEther2a))) - printf("EEPROM Ethernet address differs from copy\n"); - - sc->sc_arpcom.ac_enaddr[1] = eaddr[EEPPEther0] & 0xFF; - sc->sc_arpcom.ac_enaddr[0] = eaddr[EEPPEther0] >> 8; - sc->sc_arpcom.ac_enaddr[3] = eaddr[EEPPEther1] & 0xFF; - sc->sc_arpcom.ac_enaddr[2] = eaddr[EEPPEther1] >> 8; - sc->sc_arpcom.ac_enaddr[5] = eaddr[EEPPEther2] & 0xFF; - sc->sc_arpcom.ac_enaddr[4] = eaddr[EEPPEther2] >> 8; + if (eepromreadall(iot, ioh, eaddr, 8)) + goto out; if (ia->ia_irq == IRQUNK) ia->ia_irq = eepro_irqmap[eaddr[EEPPW1] & EEPP_Int]; @@ -263,24 +235,17 @@ iyprobe(parent, match, aux) if (ia->ia_irq >= sizeof(eepro_revirqmap)) goto out; - if ((sc->mappedirq = eepro_revirqmap[ia->ia_irq]) == -1) + if (eepro_revirqmap[ia->ia_irq] == 0xff) goto out; - sc->hard_vers = eaddr[EEPW6] & EEPP_BoardRev; - /* now lets reset the chip */ bus_space_write_1(iot, ioh, COMMAND_REG, RESET_CMD); delay(200); - /* - * XXX Sould always unmap, but we can't yet. - * XXX Need to squish "indirect" first. - */ ia->ia_iosize = 16; - sc->sc_iot = iot; - sc->sc_ioh = ioh; + bus_space_unmap(iot, ioh, 16); return 1; /* found */ out: bus_space_unmap(iot, ioh, 16); @@ -294,16 +259,30 @@ iyattach(parent, self, aux) { struct iy_softc *sc = (void *)self; struct isa_attach_args *ia = aux; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_space_tag_t iot; bus_space_handle_t ioh; + unsigned temp; + u_int16_t eaddr[8]; + u_int8_t myaddr[ETHER_ADDR_LEN]; + int eirq; - /* - * XXX Should re-map io and mem, but can't - * XXX until we squish "indirect" brokenness. - */ - iot = sc->sc_iot; /* XXX */ - ioh = sc->sc_ioh; /* XXX */ + iot = ia->ia_iot; + + if (bus_space_map(iot, ia->ia_iobase, 16, 0, &ioh)) + panic("Can't bus_space_map in iyattach"); + + sc->sc_iot = iot; + sc->sc_ioh = ioh; + + sc->mappedirq = eepro_revirqmap[ia->ia_irq]; + + /* now let's reset the chip */ + + bus_space_write_1(iot, ioh, COMMAND_REG, RESET_CMD); + delay(200); + + iyprobemem(sc); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_softc = sc; @@ -311,24 +290,51 @@ iyattach(parent, self, aux) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS; /* XXX todo: | IFF_MULTICAST */ - iyprobemem(sc); - ifp->if_ioctl = iyioctl; ifp->if_watchdog = iywatchdog; + (void)eepromreadall(iot, ioh, eaddr, 8); + sc->hard_vers = eaddr[EEPW6] & EEPP_BoardRev; + +#ifdef DIAGNOSTICS + if ((eaddr[EEPPEther0] != + eepromread(iot, ioh, EEPPEther0a)) && + (eaddr[EEPPEther1] != + eepromread(iot, ioh, EEPPEther1a)) && + (eaddr[EEPPEther2] != + eepromread(iot, ioh, EEPPEther2a))) + + printf("EEPROM Ethernet address differs from copy\n"); +#endif + + myaddr[1] = eaddr[EEPPEther0] & 0xFF; + myaddr[0] = eaddr[EEPPEther0] >> 8; + myaddr[3] = eaddr[EEPPEther1] & 0xFF; + myaddr[2] = eaddr[EEPPEther1] >> 8; + myaddr[5] = eaddr[EEPPEther2] & 0xFF; + myaddr[4] = eaddr[EEPPEther2] >> 8; + /* Attach the interface. */ if_attach(ifp); - ether_ifattach(ifp); - printf(": address %s, chip rev. %d, %d kB SRAM\n", - ether_sprintf(sc->sc_arpcom.ac_enaddr), + ether_ifattach(ifp, myaddr); + printf(": address %s, rev. %d, %d kB\n", + ether_sprintf(myaddr), sc->hard_vers, sc->sram/1024); + + eirq = eepro_irqmap[eaddr[EEPPW1] & EEPP_Int]; + if (eirq != ia->ia_irq) + printf("%s: EEPROM irq setting %d ignored\n", + sc->sc_dev.dv_xname, eirq); + #if NBPFILTER > 0 - bpfattach(&sc->sc_arpcom.ac_if.if_bpf, ifp, DLT_EN10MB, - sizeof(struct ether_header)); + bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, IPL_NET, iyintr, sc); + + temp = bus_space_read_1(iot, ioh, INT_NO_REG); + bus_space_write_1(iot, ioh, INT_NO_REG, (temp & 0xf8) | sc->mappedirq); } void @@ -372,7 +378,7 @@ struct iy_softc *sc; #endif sc->tx_start = sc->tx_end = sc->rx_size; sc->tx_last = 0; - sc->sc_arpcom.ac_if.if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); + sc->sc_ethercom.ec_if.if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); iymbufempty((void *)sc); } @@ -401,7 +407,7 @@ struct iy_softc *sc; iot = sc->sc_iot; ioh = sc->sc_ioh; - ifp = &sc->sc_arpcom.ac_if; + ifp = &sc->sc_ethercom.ec_if; #ifdef IYDEBUG printf("ifp is %p\n", ifp); #endif @@ -413,12 +419,12 @@ struct iy_softc *sc; bus_space_write_1(iot, ioh, EEPROM_REG, temp & ~0x10); for (i=0; i<6; ++i) { - bus_space_write_1(iot, ioh, I_ADD(i), sc->sc_arpcom.ac_enaddr[i]); + bus_space_write_1(iot, ioh, I_ADD(i), LLADDR(ifp->if_sadl)[i]); } temp = bus_space_read_1(iot, ioh, REG1); - bus_space_write_1(iot, ioh, REG1, temp | XMT_CHAIN_INT | XMT_CHAIN_ERRSTOP | - RCV_DISCARD_BAD); + bus_space_write_1(iot, ioh, REG1, + temp | XMT_CHAIN_INT | XMT_CHAIN_ERRSTOP | RCV_DISCARD_BAD); temp = bus_space_read_1(iot, ioh, RECV_MODES_REG); bus_space_write_1(iot, ioh, RECV_MODES_REG, temp | MATCH_BRDCST); @@ -431,7 +437,7 @@ struct iy_softc *sc; #endif - DELAY(500000); /* for the hardware to test for the connector */ + delay(500000); /* for the hardware to test for the connector */ temp = bus_space_read_1(iot, ioh, MEDIA_SELECT); #ifdef IYDEBUG @@ -446,11 +452,11 @@ struct iy_softc *sc; break; case IFF_LINK1: - temp = temp & ~TPE_BIT | BNC_BIT; + temp = (temp & ~TPE_BIT) | BNC_BIT; break; case IFF_LINK0|IFF_LINK1: - temp = temp & ~BNC_BIT | TPE_BIT; + temp = (temp & ~BNC_BIT) | TPE_BIT; break; default: /* nothing; leave as it is */ @@ -463,6 +469,8 @@ struct iy_softc *sc; temp, "\020\1LnkInDis\2PolCor\3TPE\4JabberDis\5NoAport\6BNC"); #endif + bus_space_write_1(iot, ioh, 0, BANK_SEL(0)); + bus_space_write_1(iot, ioh, INT_MASK_REG, ALL_INTS); bus_space_write_1(iot, ioh, 0, BANK_SEL(1)); temp = bus_space_read_1(iot, ioh, INT_NO_REG); @@ -505,7 +513,7 @@ struct iy_softc *sc; sc->rx_start = 0; bus_space_write_1(iot, ioh, 0, SEL_RESET_CMD); - DELAY(200); + delay(200); bus_space_write_2(iot, ioh, XMT_ADDR_REG, sc->rx_size); @@ -704,42 +712,39 @@ struct ifnet *ifp; static __inline void -eepromwritebit(iot, ioh, ioff, what) +eepromwritebit(iot, ioh, what) bus_space_tag_t iot; bus_space_handle_t ioh; - bus_size_t ioff; int what; { - bus_space_write_1(iot, ioh, ioff, what); + bus_space_write_1(iot, ioh, EEPROM_REG, what); delay(1); - bus_space_write_1(iot, ioh, ioff, what|EESK); + bus_space_write_1(iot, ioh, EEPROM_REG, what|EESK); delay(1); - bus_space_write_1(iot, ioh, ioff, what); + bus_space_write_1(iot, ioh, EEPROM_REG, what); delay(1); } static __inline int -eepromreadbit(iot, ioh, ioff) +eepromreadbit(iot, ioh) bus_space_tag_t iot; bus_space_handle_t ioh; - bus_size_t ioff; { int b; - bus_space_write_1(iot, ioh, ioff, EECS|EESK); + bus_space_write_1(iot, ioh, EEPROM_REG, EECS|EESK); delay(1); - b = bus_space_read_1(iot, ioh, ioff); - bus_space_write_1(iot, ioh, ioff, EECS); + b = bus_space_read_1(iot, ioh, EEPROM_REG); + bus_space_write_1(iot, ioh, EEPROM_REG, EECS); delay(1); return ((b & EEDO) != 0); } static u_int16_t -eepromread(iot, ioh, ioff, offset) +eepromread(iot, ioh, offset) bus_space_tag_t iot; bus_space_handle_t ioh; - bus_size_t ioff; int offset; { volatile int i; @@ -748,30 +753,30 @@ eepromread(iot, ioh, ioff, offset) bus_space_write_1(iot, ioh, 0, BANK_SEL(2)); delay(1); - bus_space_write_1(iot, ioh, ioff, EECS); /* XXXX??? */ + bus_space_write_1(iot, ioh, EEPROM_REG, EECS); /* XXXX??? */ delay(1); - eepromwritebit(iot, ioh, ioff, EECS|EEDI); - eepromwritebit(iot, ioh, ioff, EECS|EEDI); - eepromwritebit(iot, ioh, ioff, EECS); + eepromwritebit(iot, ioh, EECS|EEDI); + eepromwritebit(iot, ioh, EECS|EEDI); + eepromwritebit(iot, ioh, EECS); for (j=5; j>=0; --j) { if ((offset>>j) & 1) - eepromwritebit(iot, ioh, ioff, EECS|EEDI); + eepromwritebit(iot, ioh, EECS|EEDI); else - eepromwritebit(iot, ioh, ioff, EECS); + eepromwritebit(iot, ioh, EECS); } for (readval=0, i=0; i<16; ++i) { readval<<=1; - readval |= eepromreadbit(iot, ioh, ioff); + readval |= eepromreadbit(iot, ioh); } - bus_space_write_1(iot, ioh, ioff, 0|EESK); + bus_space_write_1(iot, ioh, EEPROM_REG, 0|EESK); delay(1); - bus_space_write_1(iot, ioh, ioff, 0); + bus_space_write_1(iot, ioh, EEPROM_REG, 0); - bus_space_write_1(iot, ioh, ioff, BANK_SEL(0)); + bus_space_write_1(iot, ioh, COMMAND_REG, BANK_SEL(0)); return readval; } @@ -787,7 +792,7 @@ iywatchdog(ifp) struct iy_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); - ++sc->sc_arpcom.ac_if.if_oerrors; + ++sc->sc_ethercom.ec_if.if_oerrors; iyreset(sc); } @@ -819,7 +824,7 @@ iyintr(arg) printf("\n"); } #endif - if ((status & (RX_INT | TX_INT) == 0)) + if (((status & (RX_INT | TX_INT)) == 0)) return 0; if (status & RX_INT) { @@ -844,7 +849,7 @@ iyget(sc, iot, ioh, rxlen) struct ifnet *ifp; int len; - ifp = &sc->sc_arpcom.ac_if; + ifp = &sc->sc_ethercom.ec_if; m = sc->mb[sc->next_mb]; sc->mb[sc->next_mb] = 0; @@ -913,8 +918,10 @@ iyget(sc, iot, ioh, rxlen) bpf_mtap(ifp->if_bpf, top); if ((ifp->if_flags & IFF_PROMISC) && (eh->ether_dhost[0] & 1) == 0 && - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0) { + bcmp(eh->ether_dhost, + LLADDR(sc->sc_ethercom.ec_if.if_sadl), + sizeof(eh->ether_dhost)) != 0) { + m_freem(top); return; } @@ -940,7 +947,7 @@ struct iy_softc *sc; iot = sc->sc_iot; ioh = sc->sc_ioh; - ifp = &sc->sc_arpcom.ac_if; + ifp = &sc->sc_ethercom.ec_if; rxadrs = sc->rx_start; bus_space_write_2(iot, ioh, HOST_ADDR_REG, rxadrs); @@ -980,7 +987,7 @@ struct iy_softc *sc; struct ifnet *ifp; u_int txstatus, txstat2, txlen, txnext; - ifp = &sc->sc_arpcom.ac_if; + ifp = &sc->sc_ethercom.ec_if; iot = sc->sc_iot; ioh = sc->sc_ioh; @@ -1056,11 +1063,12 @@ check_eh(sc, eh, to_bpf) * destined for us. */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.iy_bpf != 0); /* BPF gets this packet if anybody cares */ + *to_bpf = (sc->sc_ethercom.ec_if.iy_bpf != 0); /* BPF gets this packet if anybody cares */ #endif if (eh->ether_dhost[0] & 1) return 1; - if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) + if (ether_equal(eh->ether_dhost, + LLADDR(sc->sc_ethercom.ec_if.if_sadl))) return 1; return 0; @@ -1069,10 +1077,10 @@ check_eh(sc, eh, to_bpf) * Receiving all packets. These need to be passed on to BPF. */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.iy_bpf != 0); + *to_bpf = (sc->sc_ethercom.ec_if.iy_bpf != 0); #endif /* If for us, accept and hand up to BPF */ - if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) + if (ether_equal(eh->ether_dhost, LLADDR(sc->sc_ethercom.ec_if.if_sadl))) return 1; #if NBPFILTER > 0 @@ -1107,14 +1115,14 @@ check_eh(sc, eh, to_bpf) * time. Whew! (Hope this is a fast machine...) */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.iy_bpf != 0); + *to_bpf = (sc->sc_ethercom.ec_if.iy_bpf != 0); #endif /* We want to see multicasts. */ if (eh->ether_dhost[0] & 1) return 1; /* We want to see our own packets */ - if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) + if (ether_equal(eh->ether_dhost, LLADDR(sc->sc_ethercom.ec_if.if_sadl))) return 1; /* Anything else goes to BPF but nothing else. */ @@ -1134,7 +1142,7 @@ check_eh(sc, eh, to_bpf) * of here as quickly as possible. */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.iy_bpf != 0); + *to_bpf = (sc->sc_ethercom.ec_if.iy_bpf != 0); #endif return 1; } @@ -1176,7 +1184,7 @@ iyioctl(ifp, cmd, data) #ifdef INET case AF_INET: iyinit(sc); - arp_ifinit(&sc->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif #ifdef NS @@ -1186,12 +1194,12 @@ iyioctl(ifp, cmd, data) struct ns_addr *ina = &IA_SNS(ifa)->sns_addr; if (ns_nullhost(*ina)) - ina->x_host = - *(union ns_host *)(sc->sc_arpcom.ac_enaddr); + ina->x_host = *(union ns_host *) + LLADDR(sc->sc_ethercom.ec_if.if_sadl); else bcopy(ina->x_host.c_host, - sc->sc_arpcom.ac_enaddr, - sizeof(sc->sc_arpcom.ac_enaddr)); + LLADDR(sc->sc_ethercom.ec_if.if_sadl), + ETHER_ADDR_LEN); /* Set new address. */ iyinit(sc); break; @@ -1240,8 +1248,8 @@ iyioctl(ifp, cmd, data) case SIOCADDMULTI: case SIOCDELMULTI: error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); + ether_addmulti(ifr, &sc->sc_ethercom): + ether_delmulti(ifr, &sc->sc_ethercom); if (error == ENETRESET) { /* @@ -1272,12 +1280,13 @@ iy_mc_reset(sc) * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, &sc->sc_ethercom, enm); while (enm) { if (sc->mcast_count >= MAXMCAST || bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - iyioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + sc->sc_ethercom.ec_if.if_flags |= IFF_ALLMULTI; + iyioctl(&sc->sc_ethercom.ec_if, SIOCSIFFLAGS, + (void *)0); goto setflag; } @@ -1357,6 +1366,8 @@ iyprobemem(sc) iot = sc->sc_iot; ioh = sc->sc_ioh; + bus_space_write_1(iot, ioh, COMMAND_REG, BANK_SEL(0)); + delay(1); bus_space_write_2(iot, ioh, HOST_ADDR_REG, 4096-2); bus_space_write_2(iot, ioh, MEM_PORT_REG, 0); @@ -1422,3 +1433,32 @@ iyprobemem(sc) } sc->tx_size = testing - sc->rx_size; } + +static int +eepromreadall(iot, ioh, wordp, maxi) + bus_space_tag_t iot; + bus_space_handle_t ioh; + u_int16_t *wordp; + int maxi; +{ + int i; + u_int16_t checksum, tmp; + + checksum = 0; + + for (i=0; i<EEPP_LENGTH; ++i) { + tmp = eepromread(iot, ioh, i); + checksum += tmp; + if (i<maxi) + wordp[i] = tmp; + } + + if (checksum != EEPP_CHKSUM) { +#ifdef IYDEBUG + printf("wrong EEPROM checksum 0x%x should be 0x%x\n", + checksum, EEPP_CHKSUM); +#endif + return 1; + } + return 0; +} diff --git a/sys/dev/isa/if_le_isa.c b/sys/dev/isa/if_le_isa.c index 6f4f91e5b8c..fcd750772ed 100644 --- a/sys/dev/isa/if_le_isa.c +++ b/sys/dev/isa/if_le_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_isa.c,v 1.8 1997/02/12 23:36:04 thorpej Exp $ */ +/* $NetBSD: if_le_isa.c,v 1.9 1997/03/15 18:11:48 is Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -49,10 +49,11 @@ #include <sys/device.h> #include <net/if.h> +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #include <vm/vm.h> @@ -221,17 +222,17 @@ depca_isa_probe(lesc, ia) goto bad; found: - for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) - sc->sc_arpcom.ac_enaddr[i] = bus_space_read_1(iot, ioh, port); + for (i = 0; i < sizeof(sc->sc_enaddr); i++) + sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, port); #if 0 sum = - (sc->sc_arpcom.ac_enaddr[0] << 2) + - (sc->sc_arpcom.ac_enaddr[1] << 10) + - (sc->sc_arpcom.ac_enaddr[2] << 1) + - (sc->sc_arpcom.ac_enaddr[3] << 9) + - (sc->sc_arpcom.ac_enaddr[4] << 0) + - (sc->sc_arpcom.ac_enaddr[5] << 8); + (sc->sc_enaddr[0] << 2) + + (sc->sc_enaddr[1] << 10) + + (sc->sc_enaddr[2] << 1) + + (sc->sc_enaddr[3] << 9) + + (sc->sc_enaddr[4] << 0) + + (sc->sc_enaddr[5] << 8); sum = (sum & 0xffff) + (sum >> 16); sum = (sum & 0xffff) + (sum >> 16); @@ -290,8 +291,8 @@ ne2100_isa_probe(lesc, ia) /* * Extract the physical MAC address from the ROM. */ - for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) - sc->sc_arpcom.ac_enaddr[i] = bus_space_read_1(iot, ioh, i); + for (i = 0; i < sizeof(sc->sc_enaddr); i++) + sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, i); /* * XXX INDIRECT BROKENNESS! @@ -331,8 +332,8 @@ bicc_isa_probe(lesc, ia) /* * Extract the physical MAC address from the ROM. */ - for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) - sc->sc_arpcom.ac_enaddr[i] = bus_space_read_1(iot, ioh, i * 2); + for (i = 0; i < sizeof(sc->sc_enaddr); i++) + sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, i * 2); /* * XXX INDIRECT BROKENNESS! diff --git a/sys/dev/isa/if_levar.h b/sys/dev/isa/if_levar.h index de472806548..65d0126fe9b 100644 --- a/sys/dev/isa/if_levar.h +++ b/sys/dev/isa/if_levar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_levar.h,v 1.7 1996/12/02 05:44:18 thorpej Exp $ */ +/* $NetBSD: if_levar.h,v 1.8 1997/03/15 18:11:49 is Exp $ */ /* * LANCE Ethernet driver header file @@ -40,7 +40,7 @@ * Ethernet software status per interface. * * Each interface is referenced by a network interface structure, - * arpcom.ac_if, which the routing code uses to locate the interface. + * ethercom.ec_if, which the routing code uses to locate the interface. * This structure contains the output queue for the interface, its address, ... */ struct le_softc { diff --git a/sys/dev/ofw/files.ofw b/sys/dev/ofw/files.ofw index db1d7795cc6..4b00bd01352 100644 --- a/sys/dev/ofw/files.ofw +++ b/sys/dev/ofw/files.ofw @@ -11,7 +11,7 @@ file dev/ofw/ofdisk.c ofdisk needs-flag # Generic net support define ipkdbofn { [ disable = 0 ] } -device ofnet: ether, ifnet, ipkdbofn +device ofnet: ether, ifnet, ipkdbofn, arp attach ofnet at openfirm file dev/ofw/ofnet.c ofnet | ipkdb_ofn needs-flag attach ipkdbif at ipkdbofn with ipkdb_ofn diff --git a/sys/dev/ofw/ofnet.c b/sys/dev/ofw/ofnet.c index 6dc62575198..4334f457e53 100644 --- a/sys/dev/ofw/ofnet.c +++ b/sys/dev/ofw/ofnet.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofnet.c,v 1.4 1996/10/16 19:33:21 ws Exp $ */ +/* $NetBSD: ofnet.c,v 1.5 1997/03/15 18:11:51 is Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -41,10 +41,11 @@ #include <sys/syslog.h> #include <net/if.h> +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #include <dev/ofw/openfirm.h> @@ -67,7 +68,7 @@ struct ofn_softc { struct device sc_dev; int sc_phandle; int sc_ihandle; - struct arpcom sc_arpcom; + struct ethercom sc_ethercom; }; static int ofnprobe __P((struct device *, void *, void *)); @@ -119,10 +120,11 @@ ofnattach(parent, self, aux) void *aux; { struct ofn_softc *of = (void *)self; - struct ifnet *ifp = &of->sc_arpcom.ac_if; + struct ifnet *ifp = &of->sc_ethercom.ec_if; struct ofprobe *ofp = aux; char path[256]; int l; + u_int8_t myaddr[ETHER_ADDR_LEN]; of->sc_phandle = ofp->phandle; #if NIPKDB_OFN > 0 @@ -138,10 +140,10 @@ ofnattach(parent, self, aux) || (path[l] = 0, !(of->sc_ihandle = OF_open(path)))) panic("ofnattach: unable to open"); if (OF_getprop(ofp->phandle, "mac-address", - of->sc_arpcom.ac_enaddr, sizeof of->sc_arpcom.ac_enaddr) + myaddr, sizeof myaddr) < 0) panic("ofnattach: no max-address"); - printf(": address %s\n", ether_sprintf(of->sc_arpcom.ac_enaddr)); + printf(": address %s\n", ether_sprintf(myaddr)); bcopy(of->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_softc = of; @@ -151,11 +153,10 @@ ofnattach(parent, self, aux) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS; if_attach(ifp); - ether_ifattach(ifp); + ether_ifattach(ifp, myaddr); #if NBPFILTER > 0 - bpfattach(&of->sc_arpcom.ac_if.if_bpf, ifp, DLT_EN10MB, - sizeof(struct ether_header)); + bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif dk_establish(0, self); /* XXX */ @@ -167,7 +168,7 @@ static void ofnread(of) struct ofn_softc *of; { - struct ifnet *ifp = &of->sc_arpcom.ac_if; + struct ifnet *ifp = &of->sc_ethercom.ec_if; struct ether_header *eh; struct mbuf *m, **mp, *head; int l, len; @@ -250,7 +251,7 @@ static void ofninit(of) struct ofn_softc *of; { - struct ifnet *ifp = &of->sc_arpcom.ac_if; + struct ifnet *ifp = &of->sc_ethercom.ec_if; if (ifp->if_flags & IFF_RUNNING) return; @@ -267,7 +268,7 @@ ofnstop(of) struct ofn_softc *of; { untimeout(ofntimer, of); - of->sc_arpcom.ac_if.if_flags &= ~IFF_RUNNING; + of->sc_ethercom.ec_if.if_flags &= ~IFF_RUNNING; } static void @@ -336,7 +337,7 @@ ofnioctl(ifp, cmd, data) switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - arp_ifinit(&of->sc_arpcom, ifa); + arp_ifinit(ifp, ifa); break; #endif default: @@ -371,7 +372,7 @@ ofnwatchdog(ifp) struct ofn_softc *of = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", of->sc_dev.dv_xname); - of->sc_arpcom.ac_if.if_oerrors++; + ifp->if_oerrors++; ofnstop(of); ofninit(of); } @@ -384,7 +385,7 @@ ipkdbofstart(kip) int unit = kip->unit - 1; if (ipkdb_of) - ipkdbattach(kip, &ipkdb_of->sc_arpcom); + ipkdbattach(kip, &ipkdb_of->sc_ethercom); } static void diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index 7d0fd79d676..f9df1d3d76e 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $NetBSD: files.pci,v 1.22 1997/03/12 06:39:47 cgd Exp $ +# $NetBSD: files.pci,v 1.23 1997/03/15 18:11:53 is Exp $ # # Config.new file and device description for machine-independent PCI code. # Included by ports that need it. Requires that the SCSI files be @@ -26,7 +26,7 @@ attach isp at pci with isp_pci file dev/pci/isp_pci.c isp_pci # Ethernet driver for DC21040-based boards -device de: ether, ifnet +device de: ether, ifnet, arp attach de at pci file dev/pci/if_de.c de @@ -41,7 +41,7 @@ attach ep at pci with ep_pci file dev/pci/if_ep_pci.c ep_pci # Digital DEFPA PCI FDDI Controller -device fpa: pdq, fddi, ifnet +device fpa: pdq, fddi, ifnet, arp attach fpa at pci file dev/pci/if_fpa.c fpa diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index 8ef50086184..b547a6348d9 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_de.c,v 1.33 1997/03/06 22:32:20 thorpej Exp $ */ +/* $NetBSD: if_de.c,v 1.34 1997/03/15 18:11:55 is Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -57,8 +57,15 @@ #include <net/if.h> #include <net/if_types.h> #include <net/if_dl.h> + +#if defined(__NetBSD__) +#include <net/if_ether.h> +#endif + +#if !defined(__NetBSD__) #include <net/route.h> #include <net/netisr.h> +#endif #include "bpfilter.h" #if NBPFILTER > 0 @@ -71,8 +78,12 @@ #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> +#if defined(__NetBSD__) +#include <netinet/if_inarp.h> +#else #include <netinet/if_ether.h> #endif +#endif #ifdef NS #include <netns/ns.h> @@ -2634,7 +2645,7 @@ tulip_addr_filter( sc->tulip_flags |= TULIP_WANTSETUP; sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN; sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; - if (sc->tulip_ac.ac_multicnt > 14) { + if (TULIP_MULTICAST_CNT > 14) { unsigned hash; /* * If we have more than 14 multicasts, we have @@ -2645,21 +2656,21 @@ tulip_addr_filter( bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata)); hash = tulip_mchash(etherbroadcastaddr); sp[hash >> 4] |= 1 << (hash & 0xF); - ETHER_FIRST_MULTI(step, &sc->tulip_ac, enm); + ETHER_FIRST_MULTI(step, &TULIP_ETHERCOM, enm); while (enm != NULL) { hash = tulip_mchash(enm->enm_addrlo); sp[hash >> 4] |= 1 << (hash & 0xF); ETHER_NEXT_MULTI(step, enm); } sc->tulip_flags |= TULIP_WANTHASH; - sp[39] = ((u_int16_t *) sc->tulip_ac.ac_enaddr)[0]; - sp[40] = ((u_int16_t *) sc->tulip_ac.ac_enaddr)[1]; - sp[41] = ((u_int16_t *) sc->tulip_ac.ac_enaddr)[2]; + sp[39] = ((u_int16_t *) sc->tulip_hwaddr)[0]; + sp[40] = ((u_int16_t *) sc->tulip_hwaddr)[1]; + sp[41] = ((u_int16_t *) sc->tulip_hwaddr)[2]; } else { /* * Else can get perfect filtering for 16 addresses. */ - ETHER_FIRST_MULTI(step, &sc->tulip_ac, enm); + ETHER_FIRST_MULTI(step, &TULIP_ETHERCOM, enm); for (; enm != NULL; i++) { *sp++ = ((u_int16_t *) enm->enm_addrlo)[0]; *sp++ = ((u_int16_t *) enm->enm_addrlo)[1]; @@ -2677,9 +2688,9 @@ tulip_addr_filter( * Pad the rest with our hardware address */ for (; i < 16; i++) { - *sp++ = ((u_int16_t *) sc->tulip_ac.ac_enaddr)[0]; - *sp++ = ((u_int16_t *) sc->tulip_ac.ac_enaddr)[1]; - *sp++ = ((u_int16_t *) sc->tulip_ac.ac_enaddr)[2]; + *sp++ = ((u_int16_t *) sc->tulip_hwaddr)[0]; + *sp++ = ((u_int16_t *) sc->tulip_hwaddr)[1]; + *sp++ = ((u_int16_t *) sc->tulip_hwaddr)[2]; } } } @@ -2935,7 +2946,7 @@ tulip_rx_intr( #endif if ((sc->tulip_if.if_flags & IFF_PROMISC) && (eh.ether_dhost[0] & 1) == 0 - && !TULIP_ADDREQUAL(eh.ether_dhost, sc->tulip_ac.ac_enaddr)) + && !TULIP_ADDREQUAL(eh.ether_dhost, sc->tulip_hwaddr)) goto next; accept = 1; sc->tulip_flags |= TULIP_RXACT; @@ -3454,7 +3465,7 @@ tulip_ifioctl( #ifdef INET case AF_INET: { tulip_init(sc); - arp_ifinit(&sc->tulip_ac, ifa); + arp_ifinit(TULIP_ARPINITPAR, ifa); break; } #endif /* INET */ @@ -3468,12 +3479,17 @@ tulip_ifioctl( case AF_NS: { struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr); if (ns_nullhost(*ina)) { - ina->x_host = *(union ns_host *)(sc->tulip_ac.ac_enaddr); + ina->x_host = *(union ns_host *)(sc->tulip_hwaddr); } else { ifp->if_flags &= ~IFF_RUNNING; bcopy((caddr_t)ina->x_host.c_host, - (caddr_t)sc->tulip_ac.ac_enaddr, - sizeof sc->tulip_ac.ac_enaddr); + (caddr_t)sc->tulip_hwaddr, + ETHER_ADDR_LEN); +#if defined(__NetBSD__) + bcopy((caddr_t)ina->x_host.c_host, + LLADDR(ifp->if_sadl), + ETHER_ADDR_LEN); +#endif } tulip_init(sc); break; @@ -3488,9 +3504,9 @@ tulip_ifioctl( break; } case SIOCGIFADDR: { - bcopy((caddr_t) sc->tulip_ac.ac_enaddr, + bcopy((caddr_t) sc->tulip_hwaddr, (caddr_t) ((struct sockaddr *)&ifr->ifr_data)->sa_data, - 6); + ETHER_ADDR_LEN); break; } @@ -3523,9 +3539,9 @@ tulip_ifioctl( * Update multicast listeners */ if (cmd == SIOCADDMULTI) - error = ether_addmulti(ifr, &sc->tulip_ac); + error = ether_addmulti(ifr, &TULIP_ETHERCOM); else - error = ether_delmulti(ifr, &sc->tulip_ac); + error = ether_delmulti(ifr, &TULIP_ETHERCOM); if (error == ENETRESET) { tulip_addr_filter(sc); /* reset multicast filtering */ @@ -3961,7 +3977,9 @@ tulip_attach( ether_attach(ifp); #else if_attach(ifp); -#if defined(__NetBSD__) || (defined(__FreeBSD__) && BSD >= 199506) +#if defined(__NetBSD__) + ether_ifattach(ifp, sc->tulip_hwaddr); +#elif (defined(__FreeBSD__) && BSD >= 199506) ether_ifattach(ifp); #endif #endif /* __bsdi__ */ diff --git a/sys/dev/pci/if_devar.h b/sys/dev/pci/if_devar.h index 77b6a234c0d..e97ff2d261f 100644 --- a/sys/dev/pci/if_devar.h +++ b/sys/dev/pci/if_devar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_devar.h,v 1.4 1997/03/06 22:32:24 thorpej Exp $ */ +/* $NetBSD: if_devar.h,v 1.5 1997/03/15 18:11:57 is Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -466,8 +466,10 @@ struct _tulip_softc_t { bus_space_tag_t tulip_bustag; bus_space_handle_t tulip_bushandle; /* CSR region handle */ pci_chipset_tag_t tulip_pc; -#endif + struct ethercom tulip_ec; +#else struct arpcom tulip_ac; +#endif tulip_regfile_t tulip_csrs; u_int32_t tulip_flags; #define TULIP_WANTSETUP 0x00000001 @@ -591,6 +593,9 @@ struct _tulip_softc_t { tulip_srom_connection_t tulip_conntype; tulip_desc_t tulip_rxdescs[TULIP_RXDESCS]; tulip_desc_t tulip_txdescs[TULIP_TXDESCS]; +#if defined(__NetBSD__) + u_int8_t tulip_enaddr[ETHER_ADDR_LEN]; +#endif }; #if defined(TULIP_HDR_DATA) @@ -811,11 +816,14 @@ extern struct cfattach de_ca; extern struct cfdriver de_cd; #define TULIP_UNIT_TO_SOFTC(unit) ((tulip_softc_t *) de_cd.cd_devs[unit]) #define TULIP_IFP_TO_SOFTC(ifp) ((tulip_softc_t *)((ifp)->if_softc)) -#define tulip_xname tulip_ac.ac_if.if_xname +#define tulip_xname tulip_ec.ec_if.if_xname #define tulip_unit tulip_dev.dv_unit #define loudprintf printf #define TULIP_PRINTF_FMT "%s" #define TULIP_PRINTF_ARGS sc->tulip_xname +#define TULIP_ETHERCOM sc->tulip_ec +#define TULIP_MULTICAST_CNT sc->tulip_ec.ec_multicnt +#define TULIP_ARPINITPAR ifp #if defined(__alpha__) /* XXX XXX NEED REAL DMA MAPPING SUPPORT XXX XXX */ #define TULIP_KVATOPHYS(sc, va) alpha_XXX_dmamap((vm_offset_t)(va)) @@ -833,12 +841,36 @@ extern struct cfdriver de_cd; #define TULIP_BURSTSIZE(unit) 3 #endif +#ifndef TULIP_ETHERCOM +#define TULIP_ETHERCOM sc->tulip_ac +#endif + +#ifndef TULIP_MULTICAST_CNT +#define TULIP_MULTICAST_CNT sc->tulip_ac.ac_multicnt +#endif + +#ifndef TULIP_ARPINITPAR +#define TULIP_ARPINITPAR &sc->tulip_ac +#endif + +#if defined(__NetBSD__) +#define tulip_if tulip_ec.ec_if +#define tulip_name tulip_ec.ec_if.if_name +#ifndef tulip_unit +#define tulip_unit tulip_ec.ec_if.if_unit +#endif +#define tulip_hwaddr tulip_enaddr +#define tulip_bpf tulip_ec.ec_if.if_bpf + +#else /* __NetBSD__ */ + #define tulip_if tulip_ac.ac_if +#define tulip_name tulip_ac.ac_if.if_name #ifndef tulip_unit #define tulip_unit tulip_ac.ac_if.if_unit #endif -#define tulip_name tulip_ac.ac_if.if_name #define tulip_hwaddr tulip_ac.ac_enaddr +#endif /* __NetBSD__ */ #if !defined(tulip_bpf) && (!defined(__bsdi__) || _BSDI_VERSION >= 199401) #define tulip_bpf tulip_ac.ac_if.if_bpf diff --git a/sys/dev/pci/if_ep_pci.c b/sys/dev/pci/if_ep_pci.c index 0ad9ecc31b0..cf65b3cf5e3 100644 --- a/sys/dev/pci/if_ep_pci.c +++ b/sys/dev/pci/if_ep_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ep_pci.c,v 1.18 1997/02/18 10:51:12 jonathan Exp $ */ +/* $NetBSD: if_ep_pci.c,v 1.19 1997/03/15 18:11:58 is Exp $ */ /* * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org> @@ -46,12 +46,14 @@ #include <net/if_dl.h> #include <net/if_types.h> +#include <net/if_ether.h> + #ifdef INET #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #ifdef NS diff --git a/sys/dev/pci/if_fpa.c b/sys/dev/pci/if_fpa.c index c3b4535feb4..d49b8b08fc0 100644 --- a/sys/dev/pci/if_fpa.c +++ b/sys/dev/pci/if_fpa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_fpa.c,v 1.16 1996/12/05 01:25:26 cgd Exp $ */ +/* $NetBSD: if_fpa.c,v 1.17 1997/03/15 18:11:59 is Exp $ */ /*- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com> @@ -51,7 +51,9 @@ #include <net/if.h> #include <net/if_types.h> #include <net/if_dl.h> +#if !defined(__NetBSD__) #include <net/route.h> +#endif #include "bpfilter.h" #if NBPFILTER > 0 @@ -59,10 +61,18 @@ #include <net/bpfdesc.h> #endif +#if defined(__NetBSD__) +#include <net/if_ether.h> +#endif + #ifdef INET #include <netinet/in.h> +#if defined(__NetBSD__) +#include <netinet/if_inarp.h> +#else #include <netinet/if_ether.h> #endif +#endif #if defined(__FreeBSD__) #include <netinet/if_fddi.h> #else @@ -207,7 +217,6 @@ pdq_pci_attach( free((void *) sc, M_DEVBUF); return; } - bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6); pdqs_pci[unit] = sc; pdq_ifattach(sc, pdq_pci_ifwatchdog); pci_map_int(config_id, pdq_pci_ifintr, (void*) sc, &net_imask); @@ -334,7 +343,8 @@ pdq_pci_attach( return; } - bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6); + bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, + LLADDR(ifp->if_sadl), 6); pdq_ifattach(sc, pdq_pci_ifwatchdog); @@ -438,7 +448,8 @@ pdq_pci_attach( return; } - bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6); + bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, + LLADDR(sc->sc_if.if_sadl), 6); pdq_ifattach(sc, pdq_pci_ifwatchdog); if (pci_intr_map(pa->pa_pc, pa->pa_intrtag, pa->pa_intrpin, diff --git a/sys/dev/pci/if_le_pci.c b/sys/dev/pci/if_le_pci.c index 8cb23352de4..d1e98efd16c 100644 --- a/sys/dev/pci/if_le_pci.c +++ b/sys/dev/pci/if_le_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_pci.c,v 1.14 1996/12/05 01:25:27 cgd Exp $ */ +/* $NetBSD: if_le_pci.c,v 1.15 1997/03/15 18:12:00 is Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -53,10 +53,11 @@ #include <vm/vm_param.h> #include <net/if.h> +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #include <vm/vm.h> @@ -194,8 +195,8 @@ le_pci_attach(parent, self, aux) /* * Extract the physical MAC address from the ROM. */ - for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) - sc->sc_arpcom.ac_enaddr[i] = bus_space_read_1(iot, ioh, i); + for (i = 0; i < sizeof(sc->sc_enaddr); i++) + sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, i); sc->sc_mem = malloc(16384, M_DEVBUF, M_NOWAIT); if (sc->sc_mem == 0) { diff --git a/sys/dev/pci/if_levar.h b/sys/dev/pci/if_levar.h index d24222545d0..790450c415a 100644 --- a/sys/dev/pci/if_levar.h +++ b/sys/dev/pci/if_levar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_levar.h,v 1.3 1996/10/21 22:56:46 thorpej Exp $ */ +/* $NetBSD: if_levar.h,v 1.4 1997/03/15 18:12:01 is Exp $ */ /* * LANCE Ethernet driver header file @@ -20,7 +20,7 @@ * Ethernet software status per interface. * * Each interface is referenced by a network interface structure, - * arpcom.ac_if, which the routing code uses to locate the interface. + * ethercom.ec_if, which the routing code uses to locate the interface. * This structure contains the output queue for the interface, its address, ... */ struct le_softc { diff --git a/sys/dev/tc/files.tc b/sys/dev/tc/files.tc index dc75b634acd..f4f0be45561 100644 --- a/sys/dev/tc/files.tc +++ b/sys/dev/tc/files.tc @@ -1,4 +1,4 @@ -# $NetBSD: files.tc,v 1.5 1996/05/20 00:45:02 thorpej Exp $ +# $NetBSD: files.tc,v 1.6 1997/03/15 18:12:02 is Exp $ # # Config.new file and device description for machine-independent # TurboChannel code. Included by ports that need it. @@ -15,6 +15,6 @@ file dev/tc/tc.c tc needs-flag # file dev/tc/if_le_tc.c le_tc # DEC DEFTA TC FDDI Controller -device fta: pdq, fddi, ifnet +device fta: pdq, fddi, ifnet, arp attach fta at tc file dev/tc/if_fta.c fta diff --git a/sys/dev/tc/if_fta.c b/sys/dev/tc/if_fta.c index 6b2b6c87baf..9a04495d7fd 100644 --- a/sys/dev/tc/if_fta.c +++ b/sys/dev/tc/if_fta.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_fta.c,v 1.8 1996/12/05 01:25:32 cgd Exp $ */ +/* $NetBSD: if_fta.c,v 1.9 1997/03/15 18:12:03 is Exp $ */ /*- * Copyright (c) 1996 Matt Thomas <matt@3am-software.com> @@ -48,9 +48,13 @@ #include <net/if.h> #include <net/if_types.h> +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> +#if defined(__NetBSD__) +#include <netinet/if_inarp.h> +#else #include <netinet/if_ether.h> #endif #include <net/if_fddi.h> @@ -112,7 +116,10 @@ pdq_tc_attach( printf("%s: initialization failed\n", sc->sc_dev.dv_xname); return; } +#if !defined(__NetBSD__) bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6); +#endif + pdq_ifattach(sc, NULL); tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NET, diff --git a/sys/dev/tc/if_le_dec.c b/sys/dev/tc/if_le_dec.c index 50094f17fdb..599c41ba526 100644 --- a/sys/dev/tc/if_le_dec.c +++ b/sys/dev/tc/if_le_dec.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_dec.c,v 1.3 1996/10/13 01:38:38 christos Exp $ */ +/* $NetBSD: if_le_dec.c,v 1.4 1997/03/15 18:12:04 is Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -49,10 +49,11 @@ #include <sys/device.h> #include <net/if.h> +#include <net/if_ether.h> #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #include <dev/ic/am7990reg.h> @@ -87,8 +88,8 @@ dec_le_common_attach(sc, eap) /* * Get the ethernet address out of rom */ - for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) { - sc->sc_arpcom.ac_enaddr[i] = *eap; + for (i = 0; i < sizeof(sc->sc_enaddr); i++) { + sc->sc_enaddr[i] = *eap; eap += 4; } diff --git a/sys/dev/tc/if_le_ibus.c b/sys/dev/tc/if_le_ibus.c index 904e472bcf9..5c9c943a546 100644 --- a/sys/dev/tc/if_le_ibus.c +++ b/sys/dev/tc/if_le_ibus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_ibus.c,v 1.3 1996/05/20 23:19:16 jonathan Exp $ */ +/* $NetBSD: if_le_ibus.c,v 1.4 1997/03/15 18:12:05 is Exp $ */ /* * Copyright 1996 The Board of Trustees of The Leland Stanford @@ -30,7 +30,7 @@ #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #include <dev/ic/am7990reg.h> diff --git a/sys/dev/tc/if_le_ioasic.c b/sys/dev/tc/if_le_ioasic.c index ec0f06ad061..9ee8a5ac74f 100644 --- a/sys/dev/tc/if_le_ioasic.c +++ b/sys/dev/tc/if_le_ioasic.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_ioasic.c,v 1.3 1996/12/05 01:25:33 cgd Exp $ */ +/* $NetBSD: if_le_ioasic.c,v 1.4 1997/03/15 18:12:05 is Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -42,7 +42,7 @@ #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #include <dev/ic/am7990reg.h> diff --git a/sys/dev/tc/if_le_tc.c b/sys/dev/tc/if_le_tc.c index 7939f5d4f87..088aab51943 100644 --- a/sys/dev/tc/if_le_tc.c +++ b/sys/dev/tc/if_le_tc.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_tc.c,v 1.3 1996/12/05 01:25:34 cgd Exp $ */ +/* $NetBSD: if_le_tc.c,v 1.4 1997/03/15 18:12:06 is Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -42,7 +42,7 @@ #ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/if_inarp.h> #endif #include <dev/ic/am7990reg.h> diff --git a/sys/dev/tc/if_levar.h b/sys/dev/tc/if_levar.h index a8180677036..6f08a8d2bf2 100644 --- a/sys/dev/tc/if_levar.h +++ b/sys/dev/tc/if_levar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_levar.h,v 1.3 1996/05/07 02:24:58 thorpej Exp $ */ +/* $NetBSD: if_levar.h,v 1.4 1997/03/15 18:12:07 is Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -56,7 +56,7 @@ struct lereg1 { * Ethernet software status per interface. * * Each interface is referenced by a network interface structure, - * arpcom.ac_if, which the routing code uses to locate the interface. + * ethercom.ec_if, which the routing code uses to locate the interface. * This structure contains the output queue for the interface, its address, ... */ struct le_softc { |
