diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ar/if_ar.c | 34 | ||||
-rw-r--r-- | sys/dev/ar/if_ar_isa.c | 34 | ||||
-rw-r--r-- | sys/dev/ed/if_ed.c | 164 | ||||
-rw-r--r-- | sys/dev/ep/if_ep.c | 33 | ||||
-rw-r--r-- | sys/dev/fe/if_fe.c | 20 | ||||
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 52 | ||||
-rw-r--r-- | sys/dev/ie/if_ie.c | 4 | ||||
-rw-r--r-- | sys/dev/lnc/if_lnc.c | 12 | ||||
-rw-r--r-- | sys/i386/isa/if_ar.c | 34 | ||||
-rw-r--r-- | sys/i386/isa/if_cx.c | 43 | ||||
-rw-r--r-- | sys/i386/isa/if_ed.c | 164 | ||||
-rw-r--r-- | sys/i386/isa/if_eg.c | 3 | ||||
-rw-r--r-- | sys/i386/isa/if_el.c | 18 | ||||
-rw-r--r-- | sys/i386/isa/if_ep.c | 33 | ||||
-rw-r--r-- | sys/i386/isa/if_fe.c | 20 | ||||
-rw-r--r-- | sys/i386/isa/if_ie.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/if_ix.c | 16 | ||||
-rw-r--r-- | sys/i386/isa/if_le.c | 28 | ||||
-rw-r--r-- | sys/i386/isa/if_lnc.c | 12 | ||||
-rw-r--r-- | sys/i386/isa/if_ze.c | 24 | ||||
-rw-r--r-- | sys/i386/isa/if_zp.c | 19 | ||||
-rw-r--r-- | sys/net/if.c | 20 | ||||
-rw-r--r-- | sys/net/if.h | 8 | ||||
-rw-r--r-- | sys/netinet/if_ether.h | 5 | ||||
-rw-r--r-- | sys/netiso/if_eon.c | 5 | ||||
-rw-r--r-- | sys/netiso/iso_snpac.c | 6 | ||||
-rw-r--r-- | sys/pci/if_fxp.c | 52 | ||||
-rw-r--r-- | sys/pci/if_pdq.c | 28 | ||||
-rw-r--r-- | sys/pci/if_vx.c | 21 |
29 files changed, 367 insertions, 549 deletions
diff --git a/sys/dev/ar/if_ar.c b/sys/dev/ar/if_ar.c index ce46405..10c923a 100644 --- a/sys/dev/ar/if_ar.c +++ b/sys/dev/ar/if_ar.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ar.c,v 1.7 1995/11/16 20:16:34 jhay Exp $ + * $Id: if_ar.c,v 1.1.1.1 1995/11/21 02:32:04 peter Exp $ */ /* @@ -201,8 +201,7 @@ static struct kern_devconf kdc_arc_template = { void arstart(struct ifnet *ifp); int arioctl(struct ifnet *ifp, int cmd, caddr_t data); -void arwatchdog(int port_number); -void arinit(int port_number); +void arwatchdog(struct ifnet *ifp); static void ar_up(struct ar_softc *sc); static void ar_down(struct ar_softc *sc); @@ -397,7 +396,6 @@ int arattach(struct isa_device *id) ifp->if_ioctl = arioctl; ifp->if_start = arstart; ifp->if_watchdog = arwatchdog; - ifp->if_init = arinit; sc->ifsppp.pp_flags = PP_KEEPALIVE; @@ -666,15 +664,15 @@ int arioctl(struct ifnet *ifp, int cmd, caddr_t data) /* * This is to catch lost tx interrupts. */ -void arwatchdog(int unit) +void arwatchdog(struct ifnet *ifp) { - struct ar_softc *sc = ARUNIT2SC(unit); + struct ar_softc *sc = ARUNIT2SC(ifp->if_unit); - if(!(sc->ifsppp.pp_if.if_flags & IFF_RUNNING)) + if(!(ifp->if_flags & IFF_RUNNING)) return; /* XXX if(sc->ifsppp.pp_if.if_flags & IFF_DEBUG) */ - printf("ar%d: transmit failed.\n", unit); + printf("ar%d: transmit failed.\n", ifp->if_unit); ARC_SET_SCA(sc->hc->iobase, sc->scano); sc->hc->sca->msci[sc->scachan].cmd = SCA_CMD_TXABORT; @@ -682,9 +680,9 @@ void arwatchdog(int unit) ar_down(sc); ar_up(sc); - sc->ifsppp.pp_if.if_flags &= ~IFF_OACTIVE; + ifp->if_flags &= ~IFF_OACTIVE; - arstart(&sc->ifsppp.pp_if); + arstart(ifp); } static void ar_up(struct ar_softc *sc) @@ -769,22 +767,6 @@ static void ar_down(struct ar_softc *sc) } /* - * I don't think anything ever calls this function. - */ -void arinit(int unit) - { - int s; - struct ar_softc *sc = ARUNIT2SC(unit); - - printf("ar%d: OOPS, so somebody do call arinit!\n", unit); - - s = splimp(); - ar_down(sc); - ar_up(sc); - splx(s); - } - -/* * Initialize the card, allocate memory for the ar_softc structures * and fill in the pointers. */ diff --git a/sys/dev/ar/if_ar_isa.c b/sys/dev/ar/if_ar_isa.c index ce46405..10c923a 100644 --- a/sys/dev/ar/if_ar_isa.c +++ b/sys/dev/ar/if_ar_isa.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ar.c,v 1.7 1995/11/16 20:16:34 jhay Exp $ + * $Id: if_ar.c,v 1.1.1.1 1995/11/21 02:32:04 peter Exp $ */ /* @@ -201,8 +201,7 @@ static struct kern_devconf kdc_arc_template = { void arstart(struct ifnet *ifp); int arioctl(struct ifnet *ifp, int cmd, caddr_t data); -void arwatchdog(int port_number); -void arinit(int port_number); +void arwatchdog(struct ifnet *ifp); static void ar_up(struct ar_softc *sc); static void ar_down(struct ar_softc *sc); @@ -397,7 +396,6 @@ int arattach(struct isa_device *id) ifp->if_ioctl = arioctl; ifp->if_start = arstart; ifp->if_watchdog = arwatchdog; - ifp->if_init = arinit; sc->ifsppp.pp_flags = PP_KEEPALIVE; @@ -666,15 +664,15 @@ int arioctl(struct ifnet *ifp, int cmd, caddr_t data) /* * This is to catch lost tx interrupts. */ -void arwatchdog(int unit) +void arwatchdog(struct ifnet *ifp) { - struct ar_softc *sc = ARUNIT2SC(unit); + struct ar_softc *sc = ARUNIT2SC(ifp->if_unit); - if(!(sc->ifsppp.pp_if.if_flags & IFF_RUNNING)) + if(!(ifp->if_flags & IFF_RUNNING)) return; /* XXX if(sc->ifsppp.pp_if.if_flags & IFF_DEBUG) */ - printf("ar%d: transmit failed.\n", unit); + printf("ar%d: transmit failed.\n", ifp->if_unit); ARC_SET_SCA(sc->hc->iobase, sc->scano); sc->hc->sca->msci[sc->scachan].cmd = SCA_CMD_TXABORT; @@ -682,9 +680,9 @@ void arwatchdog(int unit) ar_down(sc); ar_up(sc); - sc->ifsppp.pp_if.if_flags &= ~IFF_OACTIVE; + ifp->if_flags &= ~IFF_OACTIVE; - arstart(&sc->ifsppp.pp_if); + arstart(ifp); } static void ar_up(struct ar_softc *sc) @@ -769,22 +767,6 @@ static void ar_down(struct ar_softc *sc) } /* - * I don't think anything ever calls this function. - */ -void arinit(int unit) - { - int s; - struct ar_softc *sc = ARUNIT2SC(unit); - - printf("ar%d: OOPS, so somebody do call arinit!\n", unit); - - s = splimp(); - ar_down(sc); - ar_up(sc); - splx(s); - } - -/* * Initialize the card, allocate memory for the ar_softc structures * and fill in the pointers. */ diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index ebf4c83..6c50b55 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -13,7 +13,7 @@ * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000, * and a variety of similar clones. * - * $Id: if_ed.c,v 1.86 1995/11/16 09:55:51 bde Exp $ + * $Id: if_ed.c,v 1.87 1995/11/18 08:29:04 bde Exp $ */ #include "ed.h" @@ -108,23 +108,24 @@ struct ed_softc { struct kern_devconf kdc; /* kernel configuration database info */ } ed_softc[NED]; -static int ed_attach(struct isa_device *); -static void ed_init(int); -static int ed_ioctl(struct ifnet *, int, caddr_t); -static int ed_probe(struct isa_device *); -static void ed_start(struct ifnet *); -static void ed_reset(int); -static void ed_watchdog(int); -static int ed_probe_generic8390(struct ed_softc *); -static int ed_probe_WD80x3(struct isa_device *); -static int ed_probe_3Com(struct isa_device *); -static int ed_probe_Novell(struct isa_device *); -static int ed_probe_pccard(struct isa_device *, u_char *); +static int ed_attach __P((struct isa_device *)); +static void ed_init __P((struct ifnet *)); +static int ed_ioctl __P((struct ifnet *, int, caddr_t)); +static int ed_probe __P((struct isa_device *)); +static void ed_start __P((struct ifnet *)); +static void ed_reset __P((struct ifnet *)); +static void ed_watchdog __P((struct ifnet *)); + +static void ed_stop __P((struct ed_softc *)); +static int ed_probe_generic8390 __P((struct ed_softc *)); +static int ed_probe_WD80x3 __P((struct isa_device *)); +static int ed_probe_3Com __P((struct isa_device *)); +static int ed_probe_Novell __P((struct isa_device *)); +static int ed_probe_pccard __P((struct isa_device *, u_char *)); static void ds_getmcaf(); static void ed_get_packet(struct ed_softc *, char *, int /* u_short */ , int); -static void ed_stop(int); static inline void ed_rint(); static inline void ed_xmit(); @@ -133,7 +134,7 @@ static inline char *ed_ring_copy(); static void ed_pio_readmem(), ed_pio_writemem(); static u_short ed_pio_write_mbufs(); -static void ed_setrcr(struct ifnet *, struct ed_softc *); +static void ed_setrcr(struct ed_softc *); static u_long ds_crc(u_char *ep); #include "crd.h" @@ -223,13 +224,15 @@ static void edunload(struct pccard_dev *dp) { struct ed_softc *sc = &ed_softc[dp->isahd.id_unit]; + struct ifnet *ifp = &sc->arpcom.ac_if; + if (sc->kdc.kdc_state == DC_UNCONFIGURED) { printf("ed%d: already unloaded\n", dp->isahd.id_unit); return; } sc->kdc.kdc_state = DC_UNCONFIGURED; - sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING; - if_down(&sc->arpcom.ac_if); + ifp->if_flags &= ~IFF_RUNNING; + if_down(ifp); sc->gone = 1; printf("ed%d: unload\n", dp->isahd.id_unit); } @@ -1391,7 +1394,7 @@ ed_attach(isa_dev) /* * Set interface to stopped condition (reset) */ - ed_stop(isa_dev->id_unit); + ed_stop(sc); if (!ifp->if_name) { /* @@ -1399,11 +1402,9 @@ ed_attach(isa_dev) */ ifp->if_unit = isa_dev->id_unit; ifp->if_name = "ed"; - ifp->if_init = ed_init; ifp->if_output = ether_output; ifp->if_start = ed_start; ifp->if_ioctl = ed_ioctl; - ifp->if_reset = ed_reset; ifp->if_watchdog = ed_watchdog; ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; @@ -1456,20 +1457,21 @@ ed_attach(isa_dev) * Reset interface. */ static void -ed_reset(unit) - int unit; +ed_reset(ifp) + struct ifnet *ifp; { + struct ed_softc *sc = (struct ed_softc *)ifp; int s; - if (ed_softc[unit].gone) + if (sc->gone) return; s = splimp(); /* * Stop interface and re-initialize. */ - ed_stop(unit); - ed_init(unit); + ed_stop(sc); + ed_init(ifp); (void) splx(s); } @@ -1478,10 +1480,9 @@ ed_reset(unit) * Take interface offline. */ static void -ed_stop(unit) - int unit; +ed_stop(sc) + struct ed_softc *sc; { - struct ed_softc *sc = &ed_softc[unit]; int n = 5000; if (sc->gone) @@ -1504,28 +1505,27 @@ ed_stop(unit) * generate an interrupt after a transmit has been started on it. */ static void -ed_watchdog(unit) - int unit; +ed_watchdog(ifp) + struct ifnet *ifp; { - struct ed_softc *sc = &ed_softc[unit]; + struct ed_softc *sc = (struct ed_softc *)ifp; if (sc->gone) return; - log(LOG_ERR, "ed%d: device timeout\n", unit); - ++sc->arpcom.ac_if.if_oerrors; + log(LOG_ERR, "ed%d: device timeout\n", ifp->if_unit); + ifp->if_oerrors++; - ed_reset(unit); + ed_reset(ifp); } /* * Initialize device. */ static void -ed_init(unit) - int unit; +ed_init(ifp) + struct ifnet *ifp; { - struct ed_softc *sc = &ed_softc[unit]; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ed_softc *sc = (struct ed_softc *)ifp; int i, s; if (sc->gone) @@ -1544,7 +1544,7 @@ ed_init(unit) /* reset transmitter flags */ sc->xmit_busy = 0; - sc->arpcom.ac_if.if_timer = 0; + ifp->if_timer = 0; sc->txb_inuse = 0; sc->txb_new = 0; @@ -1639,7 +1639,7 @@ ed_init(unit) * Program Receiver Configuration Register and multicast filter. CR is * set to page 0 on return. */ - ed_setrcr(ifp, sc); + ed_setrcr(sc); /* * Take interface out of loopback @@ -1676,10 +1676,10 @@ ed_init(unit) * This routine actually starts the transmission on the interface */ static inline void -ed_xmit(ifp) - struct ifnet *ifp; +ed_xmit(sc) + struct ed_softc *sc; { - struct ed_softc *sc = &ed_softc[ifp->if_unit]; + struct ifnet *ifp = (struct ifnet *)sc; unsigned short len; if (sc->gone) @@ -1735,7 +1735,7 @@ static void ed_start(ifp) struct ifnet *ifp; { - struct ed_softc *sc = &ed_softc[ifp->if_unit]; + struct ed_softc *sc = (struct ed_softc *)ifp; struct mbuf *m0, *m; caddr_t buffer; int len; @@ -1752,7 +1752,7 @@ outloop: */ if (sc->txb_inuse && (sc->xmit_busy == 0)) { printf("ed: packets buffered, but transmitter idle\n"); - ed_xmit(ifp); + ed_xmit(sc); } /* @@ -1766,7 +1766,7 @@ outloop: ifp->if_flags |= IFF_OACTIVE; return; } - IF_DEQUEUE(&sc->arpcom.ac_if.if_snd, m); + IF_DEQUEUE(&ifp->if_snd, m); if (m == 0) { /* @@ -1864,7 +1864,7 @@ outloop: sc->txb_new = 0; if (sc->xmit_busy == 0) - ed_xmit(ifp); + ed_xmit(sc); /* * Tap off here if there is a bpf listener. @@ -1887,10 +1887,10 @@ outloop: * Ethernet interface receiver interrupt. */ static inline void -ed_rint(unit) - int unit; +ed_rint(sc) + struct ed_softc *sc; { - register struct ed_softc *sc = &ed_softc[unit]; + struct ifnet *ifp = (struct ifnet *)sc; u_char boundry; u_short len; struct ed_ring packet_hdr; @@ -1965,16 +1965,16 @@ ed_rint(unit) */ ed_get_packet(sc, packet_ptr + sizeof(struct ed_ring), len - sizeof(struct ed_ring), packet_hdr.rsr & ED_RSR_PHY); - ++sc->arpcom.ac_if.if_ipackets; + ifp->if_ipackets++; } else { /* * Really BAD. The ring pointers are corrupted. */ log(LOG_ERR, "ed%d: NIC memory corrupt - invalid packet length %d\n", - unit, len); - ++sc->arpcom.ac_if.if_ierrors; - ed_reset(unit); + ifp->if_unit, len); + ifp->if_ierrors++; + ed_reset(ifp); return; } @@ -2014,6 +2014,7 @@ edintr(unit) int unit; { struct ed_softc *sc = &ed_softc[unit]; + struct ifnet *ifp = (struct ifnet *)sc; u_char isr; if (sc->gone) @@ -2071,32 +2072,32 @@ edintr(unit) /* * update output errors counter */ - ++sc->arpcom.ac_if.if_oerrors; + ifp->if_oerrors++; } else { /* * Update total number of successfully * transmitted packets. */ - ++sc->arpcom.ac_if.if_opackets; + ifp->if_opackets++; } /* * reset tx busy and output active flags */ sc->xmit_busy = 0; - sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + ifp->if_flags &= ~IFF_OACTIVE; /* * clear watchdog timer */ - sc->arpcom.ac_if.if_timer = 0; + ifp->if_timer = 0; /* * Add in total number of collisions on last * transmission. */ - sc->arpcom.ac_if.if_collisions += collisions; + ifp->if_collisions += collisions; /* * Decrement buffer in-use count if not zero (can only @@ -2106,7 +2107,7 @@ edintr(unit) * until after handling receiver */ if (sc->txb_inuse && --sc->txb_inuse) - ed_xmit(&sc->arpcom.ac_if); + ed_xmit(sc); } /* @@ -2124,17 +2125,17 @@ edintr(unit) * fixed in later revs. -DG */ if (isr & ED_ISR_OVW) { - ++sc->arpcom.ac_if.if_ierrors; + ifp->if_ierrors++; #ifdef DIAGNOSTIC log(LOG_WARNING, "ed%d: warning - receiver ring buffer overrun\n", - unit); + ifp->if_unit); #endif /* * Stop/reset/re-init NIC */ - ed_reset(unit); + ed_reset(ifp); } else { /* @@ -2143,9 +2144,9 @@ edintr(unit) * missed packet. */ if (isr & ED_ISR_RXE) { - ++sc->arpcom.ac_if.if_ierrors; + ifp->if_ierrors++; #ifdef ED_DEBUG - printf("ed%d: receive error %x\n", unit, + printf("ed%d: receive error %x\n", ifp->if_unit, inb(sc->nic_addr + ED_P0_RSR)); #endif } @@ -2173,7 +2174,7 @@ edintr(unit) ED_WD_MSR_MENB); } } - ed_rint(unit); + ed_rint(sc); /* disable 16bit access */ if (sc->isa16bit && @@ -2194,8 +2195,8 @@ edintr(unit) * attempt to start output on the interface. This is done * after handling the receiver to give the receiver priority. */ - if ((sc->arpcom.ac_if.if_flags & IFF_OACTIVE) == 0) - ed_start(&sc->arpcom.ac_if); + if ((ifp->if_flags & IFF_OACTIVE) == 0) + ed_start(ifp); /* * return NIC CR to standard state: page 0, remote DMA @@ -2229,7 +2230,7 @@ ed_ioctl(ifp, command, data) caddr_t data; { register struct ifaddr *ifa = (struct ifaddr *) data; - struct ed_softc *sc = &ed_softc[ifp->if_unit]; + struct ed_softc *sc = (struct ed_softc *)ifp; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; @@ -2249,7 +2250,7 @@ ed_ioctl(ifp, command, data) switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - ed_init(ifp->if_unit); /* before arpwhohas */ + ed_init(ifp); /* before arpwhohas */ arp_ifinit((struct arpcom *)ifp, ifa); break; #endif @@ -2273,7 +2274,7 @@ ed_ioctl(ifp, command, data) /* * Set new address */ - ed_init(ifp->if_unit); + ed_init(ifp); break; } #endif @@ -2297,12 +2298,12 @@ ed_ioctl(ifp, command, data) /* * Set new address */ - ed_init(ifp->if_unit); + ed_init(ifp); break; } #endif default: - ed_init(ifp->if_unit); + ed_init(ifp); break; } break; @@ -2324,7 +2325,7 @@ ed_ioctl(ifp, command, data) */ if (((ifp->if_flags & IFF_UP) == 0) && (ifp->if_flags & IFF_RUNNING)) { - ed_stop(ifp->if_unit); + ed_stop(sc); ifp->if_flags &= ~IFF_RUNNING; } else { @@ -2334,7 +2335,7 @@ ed_ioctl(ifp, command, data) */ if ((ifp->if_flags & IFF_UP) && ((ifp->if_flags & IFF_RUNNING) == 0)) - ed_init(ifp->if_unit); + ed_init(ifp); } /* UP controls BUSY/IDLE */ sc->kdc.kdc_state = ((ifp->if_flags & IFF_UP) @@ -2346,7 +2347,7 @@ ed_ioctl(ifp, command, data) /* * Promiscuous flag may have changed, so reprogram the RCR. */ - ed_setrcr(ifp, sc); + ed_setrcr(sc); #endif /* @@ -2378,7 +2379,7 @@ ed_ioctl(ifp, command, data) * Multicast list has changed; set the hardware filter * accordingly. */ - ed_setrcr(ifp, sc); + ed_setrcr(sc); error = 0; } break; @@ -2574,6 +2575,7 @@ ed_pio_write_mbufs(sc, m, dst) struct mbuf *m; unsigned short dst; { + struct ifnet *ifp = (struct ifnet *)sc; unsigned short total_len, dma_len; struct mbuf *mp; int maxwait = 200; /* about 240us */ @@ -2670,8 +2672,8 @@ ed_pio_write_mbufs(sc, m, dst) if (!maxwait) { log(LOG_WARNING, "ed%d: remote transmit DMA failed to complete\n", - sc->arpcom.ac_if.if_unit); - ed_reset(sc->arpcom.ac_if.if_unit); + ifp->if_unit); + ed_reset(ifp); return(0); } return (total_len); @@ -2714,10 +2716,10 @@ ed_ring_copy(sc, src, dst, amount) } static void -ed_setrcr(ifp, sc) - struct ifnet *ifp; +ed_setrcr(sc) struct ed_softc *sc; { + struct ifnet *ifp = (struct ifnet *)sc; int i; /* set page 1 registers */ diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index 5cea129..54536f6 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -38,7 +38,7 @@ */ /* - * $Id: if_ep.c,v 1.33 1995/10/28 15:39:04 phk Exp $ + * $Id: if_ep.c,v 1.34 1995/11/04 17:07:26 bde Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -117,7 +117,7 @@ void epread __P((struct ep_softc *)); void epreset __P((int)); void epstart __P((struct ifnet *)); void epstop __P((int)); -void epwatchdog __P((int)); +void epwatchdog __P((struct ifnet *)); static int send_ID_sequence __P((int)); static int get_eeprom_data __P((int, int)); @@ -427,12 +427,10 @@ epattach(is) ifp->if_name = "ep"; ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; - ifp->if_init = epinit; ifp->if_output = ether_output; ifp->if_start = epstart; ifp->if_ioctl = epioctl; ifp->if_watchdog = epwatchdog; - ifp->if_timer=1; if_attach(ifp); kdc_ep[is->id_unit].kdc_state = DC_BUSY; @@ -1246,36 +1244,19 @@ epioctl(ifp, cmd, data) } void -epreset(unit) - int unit; -{ - int s = splimp(); - - epstop(unit); - epinit(unit); - splx(s); -} - -void -epwatchdog(unit) - int unit; +epwatchdog(ifp) + struct ifnet *ifp; { - struct ep_softc *sc = &ep_softc[unit]; - struct ifnet *ifp=&sc->arpcom.ac_if; - /* printf("ep: watchdog\n"); - log(LOG_ERR, "ep%d: watchdog\n", unit); - ++sc->arpcom.ac_if.if_oerrors; + log(LOG_ERR, "ep%d: watchdog\n", ifp->if_unit); + ifp->if_oerrors++; */ - /* epreset(unit); */ ifp->if_flags &= ~IFF_OACTIVE; epstart(ifp); - epintr(unit); - - ifp->if_timer=1; + epintr(ifp->if_unit); } void diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 01ec89a..a366f05 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -252,7 +252,7 @@ void fe_init ( int ); int fe_ioctl ( struct ifnet *, int, caddr_t ); void fe_start ( struct ifnet * ); void fe_reset ( int ); -void fe_watchdog ( int ); +void fe_watchdog ( struct ifnet * ); /* Local functions. Order of declaration is confused. FIXME. */ static int fe_probe_fmv ( struct isa_device *, struct fe_softc * ); @@ -1062,11 +1062,9 @@ fe_attach ( struct isa_device *isa_dev ) */ sc->sc_if.if_unit = sc->sc_unit; sc->sc_if.if_name = "fe"; - sc->sc_if.if_init = fe_init; sc->sc_if.if_output = ether_output; sc->sc_if.if_start = fe_start; sc->sc_if.if_ioctl = fe_ioctl; - sc->sc_if.if_reset = fe_reset; sc->sc_if.if_watchdog = fe_watchdog; /* @@ -1246,27 +1244,27 @@ fe_stop ( int unit ) * generate an interrupt after a transmit has been started on it. */ void -fe_watchdog ( int unit ) +fe_watchdog ( struct ifnet *ifp ) { - struct fe_softc *sc = &fe_softc[unit]; + struct fe_softc *sc = (struct fe_softc *)ifp; #if FE_DEBUG >= 1 log( LOG_ERR, "fe%d: transmission timeout (%d+%d)%s\n", - unit, sc->txb_sched, sc->txb_count, - ( sc->sc_if.if_flags & IFF_UP ) ? "" : " when down" ); + ifp->if_unit, sc->txb_sched, sc->txb_count, + ( ifp->if_flags & IFF_UP ) ? "" : " when down" ); #endif #if FE_DEBUG >= 3 fe_dump( LOG_INFO, sc, NULL ); #endif /* Record how many packets are lost by this accident. */ - sc->sc_if.if_oerrors += sc->txb_sched + sc->txb_count; + ifp->if_oerrors += sc->txb_sched + sc->txb_count; /* Put the interface into known initial state. */ - if ( sc->sc_if.if_flags & IFF_UP ) { - fe_reset( unit ); + if ( ifp->if_flags & IFF_UP ) { + fe_reset( ifp->if_unit ); } else { - fe_stop( unit ); + fe_stop( ifp->if_unit ); } } diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index f8f7ac4..66e2fa0 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_fxp.c,v 1.1 1995/11/28 23:55:20 davidg Exp $ + * $Id: if_fxp.c,v 1.2 1995/12/01 22:41:56 davidg Exp $ */ /* @@ -140,9 +140,9 @@ static int fxp_shutdown __P((struct kern_devconf *, int)); static int fxp_intr __P((void *)); static void fxp_start __P((struct ifnet *)); static int fxp_ioctl __P((struct ifnet *, int, caddr_t)); -static void fxp_init __P((int)); -static void fxp_stop __P((int)); -static void fxp_watchdog __P((int)); +static void fxp_init __P((struct ifnet *)); +static void fxp_stop __P((struct fxp_softc *)); +static void fxp_watchdog __P((struct ifnet *)); static void fxp_get_macaddr __P((struct fxp_softc *)); static int fxp_add_rfabuf __P((struct fxp_softc *, struct mbuf *)); @@ -413,7 +413,7 @@ static void fxp_start(ifp) struct ifnet *ifp; { - struct fxp_softc *sc = fxp_sc[ifp->if_unit]; + struct fxp_softc *sc = (struct fxp_softc *)ifp; struct fxp_csr *csr = sc->csr; struct fxp_cb_tx *txp; struct mbuf *m, *mb_head; @@ -687,10 +687,9 @@ fxp_stats_update(arg) * the interface. */ static void -fxp_stop(unit) - int unit; +fxp_stop(sc) + struct fxp_softc *sc; { - struct fxp_softc *sc = fxp_sc[unit]; struct ifnet *ifp = &sc->arpcom.ac_if; /* @@ -710,25 +709,20 @@ fxp_stop(unit) * card has wedged for some reason. */ static void -fxp_watchdog(unit) - int unit; +fxp_watchdog(ifp) + struct ifnet *ifp; { - struct fxp_softc *sc = fxp_sc[unit]; - struct ifnet *ifp = &sc->arpcom.ac_if; + log(LOG_ERR, "fxp%d: device timeout\n", ifp->if_unit); + ifp->if_oerrors++; - log(LOG_ERR, "fxp%d: device timeout\n", unit); - ++sc->arpcom.ac_if.if_oerrors; - - fxp_stop(unit); - fxp_init(unit); + fxp_init(ifp); } static void -fxp_init(unit) - int unit; +fxp_init(ifp) + struct ifnet *ifp; { - struct fxp_softc *sc = fxp_sc[unit]; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct fxp_softc *sc = (struct fxp_softc *)ifp; struct fxp_cb_config *cbp; struct fxp_cb_ias *cb_ias; struct fxp_cb_tx *txp; @@ -950,7 +944,7 @@ fxp_ioctl(ifp, command, data) caddr_t data; { struct ifaddr *ifa = (struct ifaddr *) data; - struct fxp_softc *sc = fxp_sc[ifp->if_unit]; + struct fxp_softc *sc = (struct fxp_softc *)ifp; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; @@ -964,7 +958,7 @@ fxp_ioctl(ifp, command, data) switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - fxp_init(ifp->if_unit); /* before arpwhohas */ + fxp_init(ifp); /* before arpwhohas */ arp_ifinit((struct arpcom *)ifp, ifa); break; #endif @@ -988,7 +982,7 @@ fxp_ioctl(ifp, command, data) /* * Set new address */ - fxp_init(ifp->if_unit); + fxp_init(ifp); break; } #endif @@ -1012,12 +1006,12 @@ fxp_ioctl(ifp, command, data) /* * Set new address */ - fxp_init(ifp->if_unit); + fxp_init(ifp); break; } #endif default: - fxp_init(ifp->if_unit); + fxp_init(ifp); break; } break; @@ -1041,10 +1035,10 @@ fxp_ioctl(ifp, command, data) * such as IFF_PROMISC are handled. */ if (ifp->if_flags & IFF_UP) { - fxp_init(ifp->if_unit); + fxp_init(ifp); } else { if (ifp->if_flags & IFF_RUNNING) - fxp_stop(ifp->if_unit); + fxp_stop(sc); } break; @@ -1062,7 +1056,7 @@ fxp_ioctl(ifp, command, data) * Multicast list has changed; set the hardware filter * accordingly. */ - fxp_init(ifp->if_unit); + fxp_init(ifp); error = 0; } diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c index 3c04d9a..069867a 100644 --- a/sys/dev/ie/if_ie.c +++ b/sys/dev/ie/if_ie.c @@ -43,7 +43,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ie.c,v 1.28 1995/10/26 20:29:43 julian Exp $ + * $Id: if_ie.c,v 1.29 1995/11/18 08:35:49 bde Exp $ */ /* @@ -588,11 +588,9 @@ ieattach(dvp) ether_sprintf(ie->arpcom.ac_enaddr)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_init = ieinit; ifp->if_output = ether_output; ifp->if_start = iestart; ifp->if_ioctl = ieioctl; - ifp->if_reset = iereset; ifp->if_type = IFT_ETHER; ifp->if_addrlen = 6; ifp->if_hdrlen = 14; diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index a04c39e..ffc57a7 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -136,7 +136,7 @@ static int pcnet_probe(int); static void lnc_init(int); static void lnc_start(struct ifnet *); static int lnc_ioctl(struct ifnet *, int, caddr_t); -static void lnc_watchdog(int); +static void lnc_watchdog(struct ifnet *); static int lnc_probe(struct isa_device *); static int lnc_attach(struct isa_device *); #ifdef DEBUG @@ -1088,11 +1088,9 @@ lnc_attach(struct isa_device * isa_dev) sc->arpcom.ac_if.if_mtu = ETHERMTU; sc->arpcom.ac_if.if_flags = IFF_BROADCAST | IFF_SIMPLEX; sc->arpcom.ac_if.if_timer = 0; - sc->arpcom.ac_if.if_init = lnc_init; sc->arpcom.ac_if.if_output = ether_output; sc->arpcom.ac_if.if_start = lnc_start; sc->arpcom.ac_if.if_ioctl = lnc_ioctl; - sc->arpcom.ac_if.if_reset = lnc_reset; sc->arpcom.ac_if.if_watchdog = lnc_watchdog; sc->arpcom.ac_if.if_type = IFT_ETHER; sc->arpcom.ac_if.if_addrlen = ETHER_ADDR_LEN; @@ -1668,11 +1666,11 @@ lnc_ioctl(struct ifnet * ifp, int command, caddr_t data) } static void -lnc_watchdog(int unit) +lnc_watchdog(struct ifnet *ifp) { - log(LOG_ERR, "lnc%d: Device timeout -- Resetting\n", unit); - ++lnc_softc[unit].arpcom.ac_if.if_oerrors; - lnc_reset(unit); + log(LOG_ERR, "lnc%d: Device timeout -- Resetting\n", ifp->if_unit); + ifp->if_oerrors++; + lnc_reset(ifp->if_unit); } #ifdef DEBUG diff --git a/sys/i386/isa/if_ar.c b/sys/i386/isa/if_ar.c index ce46405..10c923a 100644 --- a/sys/i386/isa/if_ar.c +++ b/sys/i386/isa/if_ar.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ar.c,v 1.7 1995/11/16 20:16:34 jhay Exp $ + * $Id: if_ar.c,v 1.1.1.1 1995/11/21 02:32:04 peter Exp $ */ /* @@ -201,8 +201,7 @@ static struct kern_devconf kdc_arc_template = { void arstart(struct ifnet *ifp); int arioctl(struct ifnet *ifp, int cmd, caddr_t data); -void arwatchdog(int port_number); -void arinit(int port_number); +void arwatchdog(struct ifnet *ifp); static void ar_up(struct ar_softc *sc); static void ar_down(struct ar_softc *sc); @@ -397,7 +396,6 @@ int arattach(struct isa_device *id) ifp->if_ioctl = arioctl; ifp->if_start = arstart; ifp->if_watchdog = arwatchdog; - ifp->if_init = arinit; sc->ifsppp.pp_flags = PP_KEEPALIVE; @@ -666,15 +664,15 @@ int arioctl(struct ifnet *ifp, int cmd, caddr_t data) /* * This is to catch lost tx interrupts. */ -void arwatchdog(int unit) +void arwatchdog(struct ifnet *ifp) { - struct ar_softc *sc = ARUNIT2SC(unit); + struct ar_softc *sc = ARUNIT2SC(ifp->if_unit); - if(!(sc->ifsppp.pp_if.if_flags & IFF_RUNNING)) + if(!(ifp->if_flags & IFF_RUNNING)) return; /* XXX if(sc->ifsppp.pp_if.if_flags & IFF_DEBUG) */ - printf("ar%d: transmit failed.\n", unit); + printf("ar%d: transmit failed.\n", ifp->if_unit); ARC_SET_SCA(sc->hc->iobase, sc->scano); sc->hc->sca->msci[sc->scachan].cmd = SCA_CMD_TXABORT; @@ -682,9 +680,9 @@ void arwatchdog(int unit) ar_down(sc); ar_up(sc); - sc->ifsppp.pp_if.if_flags &= ~IFF_OACTIVE; + ifp->if_flags &= ~IFF_OACTIVE; - arstart(&sc->ifsppp.pp_if); + arstart(ifp); } static void ar_up(struct ar_softc *sc) @@ -769,22 +767,6 @@ static void ar_down(struct ar_softc *sc) } /* - * I don't think anything ever calls this function. - */ -void arinit(int unit) - { - int s; - struct ar_softc *sc = ARUNIT2SC(unit); - - printf("ar%d: OOPS, so somebody do call arinit!\n", unit); - - s = splimp(); - ar_down(sc); - ar_up(sc); - splx(s); - } - -/* * Initialize the card, allocate memory for the ar_softc structures * and fill in the pointers. */ diff --git a/sys/i386/isa/if_cx.c b/sys/i386/isa/if_cx.c index 59e25ed..1520f95 100644 --- a/sys/i386/isa/if_cx.c +++ b/sys/i386/isa/if_cx.c @@ -50,8 +50,7 @@ # define CDEV_MAJOR 42 /*XXX*/ /* replace with variable ASAP*/ # include <sys/devconf.h> # endif -# define init_func_t void(*)(int) -# define watchdog_func_t void(*)(int) +# define watchdog_func_t void(*)(struct ifnet *) # define start_func_t void(*)(struct ifnet*) #endif @@ -116,9 +115,8 @@ extern void cxswitch __P((cx_chan_t *c, cx_soft_opt_t new)); #define IFNETSZ (sizeof (struct ifnet)) int cxsioctl (struct ifnet *ifp, int cmd, caddr_t data); -void cxinit (int unit); void cxstart (struct ifnet *ifp); -void cxwatchdog (int unit); +void cxwatchdog (struct ifnet *ifp); void cxinput (cx_chan_t *c, void *buf, unsigned len); int cxrinta (cx_chan_t *c); void cxtinta (cx_chan_t *c); @@ -345,7 +343,6 @@ void cxattach (struct device *parent, struct device *self, void *aux) c->ifp->if_start = (start_func_t) cxstart; c->ifp->if_watchdog = (watchdog_func_t) cxwatchdog; /* Init routine is never called by upper level? */ - c->ifp->if_init = (init_func_t) cxinit; sppp_attach (c->ifp); if_attach (c->ifp); #if NBPFILTER > 0 @@ -531,32 +528,6 @@ void cxup (cx_chan_t *c) } /* - * Initialization of interface. - */ -void cxinit (int unit) -{ - cx_chan_t *q, *c = cxchan[unit]; - int s = splimp(); - - print (("cx%d.%d: cxinit\n", c->board->num, c->num)); - - cxdown (c); - - /* Stop all slave subchannels. */ - for (q=c->slaveq; q; q=q->slaveq) - cxdown (q); - - if (c->ifp->if_flags & IFF_RUNNING) { - cxup (c); - - /* Start all slave subchannels. */ - for (q=c->slaveq; q; q=q->slaveq) - cxup (q); - } - splx (s); -} - -/* * Fill transmitter buffer with data. */ void cxput (cx_chan_t *c, char b) @@ -702,13 +673,13 @@ void cxstart (struct ifnet *ifp) * Recover after lost transmit interrupts. * Always called on splimp(). */ -void cxwatchdog (int unit) +void cxwatchdog (struct ifnet *ifp) { - cx_chan_t *q, *c = cxchan[unit]; + cx_chan_t *q, *c = cxchan[ifp->if_unit]; - if (! (c->ifp->if_flags & IFF_RUNNING)) + if (! (ifp->if_flags & IFF_RUNNING)) return; - if (c->ifp->if_flags & IFF_DEBUG) + if (ifp->if_flags & IFF_DEBUG) printf ("cx%d.%d: device timeout\n", c->board->num, c->num); cxdown (c); @@ -719,7 +690,7 @@ void cxwatchdog (int unit) for (q=c->slaveq; q; q=q->slaveq) cxup (q); - cxstart (c->ifp); + cxstart (ifp); } /* diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index ebf4c83..6c50b55 100644 --- a/sys/i386/isa/if_ed.c +++ b/sys/i386/isa/if_ed.c @@ -13,7 +13,7 @@ * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000, * and a variety of similar clones. * - * $Id: if_ed.c,v 1.86 1995/11/16 09:55:51 bde Exp $ + * $Id: if_ed.c,v 1.87 1995/11/18 08:29:04 bde Exp $ */ #include "ed.h" @@ -108,23 +108,24 @@ struct ed_softc { struct kern_devconf kdc; /* kernel configuration database info */ } ed_softc[NED]; -static int ed_attach(struct isa_device *); -static void ed_init(int); -static int ed_ioctl(struct ifnet *, int, caddr_t); -static int ed_probe(struct isa_device *); -static void ed_start(struct ifnet *); -static void ed_reset(int); -static void ed_watchdog(int); -static int ed_probe_generic8390(struct ed_softc *); -static int ed_probe_WD80x3(struct isa_device *); -static int ed_probe_3Com(struct isa_device *); -static int ed_probe_Novell(struct isa_device *); -static int ed_probe_pccard(struct isa_device *, u_char *); +static int ed_attach __P((struct isa_device *)); +static void ed_init __P((struct ifnet *)); +static int ed_ioctl __P((struct ifnet *, int, caddr_t)); +static int ed_probe __P((struct isa_device *)); +static void ed_start __P((struct ifnet *)); +static void ed_reset __P((struct ifnet *)); +static void ed_watchdog __P((struct ifnet *)); + +static void ed_stop __P((struct ed_softc *)); +static int ed_probe_generic8390 __P((struct ed_softc *)); +static int ed_probe_WD80x3 __P((struct isa_device *)); +static int ed_probe_3Com __P((struct isa_device *)); +static int ed_probe_Novell __P((struct isa_device *)); +static int ed_probe_pccard __P((struct isa_device *, u_char *)); static void ds_getmcaf(); static void ed_get_packet(struct ed_softc *, char *, int /* u_short */ , int); -static void ed_stop(int); static inline void ed_rint(); static inline void ed_xmit(); @@ -133,7 +134,7 @@ static inline char *ed_ring_copy(); static void ed_pio_readmem(), ed_pio_writemem(); static u_short ed_pio_write_mbufs(); -static void ed_setrcr(struct ifnet *, struct ed_softc *); +static void ed_setrcr(struct ed_softc *); static u_long ds_crc(u_char *ep); #include "crd.h" @@ -223,13 +224,15 @@ static void edunload(struct pccard_dev *dp) { struct ed_softc *sc = &ed_softc[dp->isahd.id_unit]; + struct ifnet *ifp = &sc->arpcom.ac_if; + if (sc->kdc.kdc_state == DC_UNCONFIGURED) { printf("ed%d: already unloaded\n", dp->isahd.id_unit); return; } sc->kdc.kdc_state = DC_UNCONFIGURED; - sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING; - if_down(&sc->arpcom.ac_if); + ifp->if_flags &= ~IFF_RUNNING; + if_down(ifp); sc->gone = 1; printf("ed%d: unload\n", dp->isahd.id_unit); } @@ -1391,7 +1394,7 @@ ed_attach(isa_dev) /* * Set interface to stopped condition (reset) */ - ed_stop(isa_dev->id_unit); + ed_stop(sc); if (!ifp->if_name) { /* @@ -1399,11 +1402,9 @@ ed_attach(isa_dev) */ ifp->if_unit = isa_dev->id_unit; ifp->if_name = "ed"; - ifp->if_init = ed_init; ifp->if_output = ether_output; ifp->if_start = ed_start; ifp->if_ioctl = ed_ioctl; - ifp->if_reset = ed_reset; ifp->if_watchdog = ed_watchdog; ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; @@ -1456,20 +1457,21 @@ ed_attach(isa_dev) * Reset interface. */ static void -ed_reset(unit) - int unit; +ed_reset(ifp) + struct ifnet *ifp; { + struct ed_softc *sc = (struct ed_softc *)ifp; int s; - if (ed_softc[unit].gone) + if (sc->gone) return; s = splimp(); /* * Stop interface and re-initialize. */ - ed_stop(unit); - ed_init(unit); + ed_stop(sc); + ed_init(ifp); (void) splx(s); } @@ -1478,10 +1480,9 @@ ed_reset(unit) * Take interface offline. */ static void -ed_stop(unit) - int unit; +ed_stop(sc) + struct ed_softc *sc; { - struct ed_softc *sc = &ed_softc[unit]; int n = 5000; if (sc->gone) @@ -1504,28 +1505,27 @@ ed_stop(unit) * generate an interrupt after a transmit has been started on it. */ static void -ed_watchdog(unit) - int unit; +ed_watchdog(ifp) + struct ifnet *ifp; { - struct ed_softc *sc = &ed_softc[unit]; + struct ed_softc *sc = (struct ed_softc *)ifp; if (sc->gone) return; - log(LOG_ERR, "ed%d: device timeout\n", unit); - ++sc->arpcom.ac_if.if_oerrors; + log(LOG_ERR, "ed%d: device timeout\n", ifp->if_unit); + ifp->if_oerrors++; - ed_reset(unit); + ed_reset(ifp); } /* * Initialize device. */ static void -ed_init(unit) - int unit; +ed_init(ifp) + struct ifnet *ifp; { - struct ed_softc *sc = &ed_softc[unit]; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ed_softc *sc = (struct ed_softc *)ifp; int i, s; if (sc->gone) @@ -1544,7 +1544,7 @@ ed_init(unit) /* reset transmitter flags */ sc->xmit_busy = 0; - sc->arpcom.ac_if.if_timer = 0; + ifp->if_timer = 0; sc->txb_inuse = 0; sc->txb_new = 0; @@ -1639,7 +1639,7 @@ ed_init(unit) * Program Receiver Configuration Register and multicast filter. CR is * set to page 0 on return. */ - ed_setrcr(ifp, sc); + ed_setrcr(sc); /* * Take interface out of loopback @@ -1676,10 +1676,10 @@ ed_init(unit) * This routine actually starts the transmission on the interface */ static inline void -ed_xmit(ifp) - struct ifnet *ifp; +ed_xmit(sc) + struct ed_softc *sc; { - struct ed_softc *sc = &ed_softc[ifp->if_unit]; + struct ifnet *ifp = (struct ifnet *)sc; unsigned short len; if (sc->gone) @@ -1735,7 +1735,7 @@ static void ed_start(ifp) struct ifnet *ifp; { - struct ed_softc *sc = &ed_softc[ifp->if_unit]; + struct ed_softc *sc = (struct ed_softc *)ifp; struct mbuf *m0, *m; caddr_t buffer; int len; @@ -1752,7 +1752,7 @@ outloop: */ if (sc->txb_inuse && (sc->xmit_busy == 0)) { printf("ed: packets buffered, but transmitter idle\n"); - ed_xmit(ifp); + ed_xmit(sc); } /* @@ -1766,7 +1766,7 @@ outloop: ifp->if_flags |= IFF_OACTIVE; return; } - IF_DEQUEUE(&sc->arpcom.ac_if.if_snd, m); + IF_DEQUEUE(&ifp->if_snd, m); if (m == 0) { /* @@ -1864,7 +1864,7 @@ outloop: sc->txb_new = 0; if (sc->xmit_busy == 0) - ed_xmit(ifp); + ed_xmit(sc); /* * Tap off here if there is a bpf listener. @@ -1887,10 +1887,10 @@ outloop: * Ethernet interface receiver interrupt. */ static inline void -ed_rint(unit) - int unit; +ed_rint(sc) + struct ed_softc *sc; { - register struct ed_softc *sc = &ed_softc[unit]; + struct ifnet *ifp = (struct ifnet *)sc; u_char boundry; u_short len; struct ed_ring packet_hdr; @@ -1965,16 +1965,16 @@ ed_rint(unit) */ ed_get_packet(sc, packet_ptr + sizeof(struct ed_ring), len - sizeof(struct ed_ring), packet_hdr.rsr & ED_RSR_PHY); - ++sc->arpcom.ac_if.if_ipackets; + ifp->if_ipackets++; } else { /* * Really BAD. The ring pointers are corrupted. */ log(LOG_ERR, "ed%d: NIC memory corrupt - invalid packet length %d\n", - unit, len); - ++sc->arpcom.ac_if.if_ierrors; - ed_reset(unit); + ifp->if_unit, len); + ifp->if_ierrors++; + ed_reset(ifp); return; } @@ -2014,6 +2014,7 @@ edintr(unit) int unit; { struct ed_softc *sc = &ed_softc[unit]; + struct ifnet *ifp = (struct ifnet *)sc; u_char isr; if (sc->gone) @@ -2071,32 +2072,32 @@ edintr(unit) /* * update output errors counter */ - ++sc->arpcom.ac_if.if_oerrors; + ifp->if_oerrors++; } else { /* * Update total number of successfully * transmitted packets. */ - ++sc->arpcom.ac_if.if_opackets; + ifp->if_opackets++; } /* * reset tx busy and output active flags */ sc->xmit_busy = 0; - sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + ifp->if_flags &= ~IFF_OACTIVE; /* * clear watchdog timer */ - sc->arpcom.ac_if.if_timer = 0; + ifp->if_timer = 0; /* * Add in total number of collisions on last * transmission. */ - sc->arpcom.ac_if.if_collisions += collisions; + ifp->if_collisions += collisions; /* * Decrement buffer in-use count if not zero (can only @@ -2106,7 +2107,7 @@ edintr(unit) * until after handling receiver */ if (sc->txb_inuse && --sc->txb_inuse) - ed_xmit(&sc->arpcom.ac_if); + ed_xmit(sc); } /* @@ -2124,17 +2125,17 @@ edintr(unit) * fixed in later revs. -DG */ if (isr & ED_ISR_OVW) { - ++sc->arpcom.ac_if.if_ierrors; + ifp->if_ierrors++; #ifdef DIAGNOSTIC log(LOG_WARNING, "ed%d: warning - receiver ring buffer overrun\n", - unit); + ifp->if_unit); #endif /* * Stop/reset/re-init NIC */ - ed_reset(unit); + ed_reset(ifp); } else { /* @@ -2143,9 +2144,9 @@ edintr(unit) * missed packet. */ if (isr & ED_ISR_RXE) { - ++sc->arpcom.ac_if.if_ierrors; + ifp->if_ierrors++; #ifdef ED_DEBUG - printf("ed%d: receive error %x\n", unit, + printf("ed%d: receive error %x\n", ifp->if_unit, inb(sc->nic_addr + ED_P0_RSR)); #endif } @@ -2173,7 +2174,7 @@ edintr(unit) ED_WD_MSR_MENB); } } - ed_rint(unit); + ed_rint(sc); /* disable 16bit access */ if (sc->isa16bit && @@ -2194,8 +2195,8 @@ edintr(unit) * attempt to start output on the interface. This is done * after handling the receiver to give the receiver priority. */ - if ((sc->arpcom.ac_if.if_flags & IFF_OACTIVE) == 0) - ed_start(&sc->arpcom.ac_if); + if ((ifp->if_flags & IFF_OACTIVE) == 0) + ed_start(ifp); /* * return NIC CR to standard state: page 0, remote DMA @@ -2229,7 +2230,7 @@ ed_ioctl(ifp, command, data) caddr_t data; { register struct ifaddr *ifa = (struct ifaddr *) data; - struct ed_softc *sc = &ed_softc[ifp->if_unit]; + struct ed_softc *sc = (struct ed_softc *)ifp; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; @@ -2249,7 +2250,7 @@ ed_ioctl(ifp, command, data) switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - ed_init(ifp->if_unit); /* before arpwhohas */ + ed_init(ifp); /* before arpwhohas */ arp_ifinit((struct arpcom *)ifp, ifa); break; #endif @@ -2273,7 +2274,7 @@ ed_ioctl(ifp, command, data) /* * Set new address */ - ed_init(ifp->if_unit); + ed_init(ifp); break; } #endif @@ -2297,12 +2298,12 @@ ed_ioctl(ifp, command, data) /* * Set new address */ - ed_init(ifp->if_unit); + ed_init(ifp); break; } #endif default: - ed_init(ifp->if_unit); + ed_init(ifp); break; } break; @@ -2324,7 +2325,7 @@ ed_ioctl(ifp, command, data) */ if (((ifp->if_flags & IFF_UP) == 0) && (ifp->if_flags & IFF_RUNNING)) { - ed_stop(ifp->if_unit); + ed_stop(sc); ifp->if_flags &= ~IFF_RUNNING; } else { @@ -2334,7 +2335,7 @@ ed_ioctl(ifp, command, data) */ if ((ifp->if_flags & IFF_UP) && ((ifp->if_flags & IFF_RUNNING) == 0)) - ed_init(ifp->if_unit); + ed_init(ifp); } /* UP controls BUSY/IDLE */ sc->kdc.kdc_state = ((ifp->if_flags & IFF_UP) @@ -2346,7 +2347,7 @@ ed_ioctl(ifp, command, data) /* * Promiscuous flag may have changed, so reprogram the RCR. */ - ed_setrcr(ifp, sc); + ed_setrcr(sc); #endif /* @@ -2378,7 +2379,7 @@ ed_ioctl(ifp, command, data) * Multicast list has changed; set the hardware filter * accordingly. */ - ed_setrcr(ifp, sc); + ed_setrcr(sc); error = 0; } break; @@ -2574,6 +2575,7 @@ ed_pio_write_mbufs(sc, m, dst) struct mbuf *m; unsigned short dst; { + struct ifnet *ifp = (struct ifnet *)sc; unsigned short total_len, dma_len; struct mbuf *mp; int maxwait = 200; /* about 240us */ @@ -2670,8 +2672,8 @@ ed_pio_write_mbufs(sc, m, dst) if (!maxwait) { log(LOG_WARNING, "ed%d: remote transmit DMA failed to complete\n", - sc->arpcom.ac_if.if_unit); - ed_reset(sc->arpcom.ac_if.if_unit); + ifp->if_unit); + ed_reset(ifp); return(0); } return (total_len); @@ -2714,10 +2716,10 @@ ed_ring_copy(sc, src, dst, amount) } static void -ed_setrcr(ifp, sc) - struct ifnet *ifp; +ed_setrcr(sc) struct ed_softc *sc; { + struct ifnet *ifp = (struct ifnet *)sc; int i; /* set page 1 registers */ diff --git a/sys/i386/isa/if_eg.c b/sys/i386/isa/if_eg.c index d5c7e17..ff20a24 100644 --- a/sys/i386/isa/if_eg.c +++ b/sys/i386/isa/if_eg.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_eg.c,v 1.6 1995/10/26 20:29:32 julian Exp $ + * $Id: if_eg.c,v 1.7 1995/11/04 17:07:22 bde Exp $ */ /* To do: @@ -422,7 +422,6 @@ egattach (struct isa_device *id) ifp->if_output = ether_output; ifp->if_start = egstart; ifp->if_ioctl = egioctl; - ifp->if_reset = egreset; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; /* Now we can attach the interface. */ diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c index 72fcc65..12f71d2 100644 --- a/sys/i386/isa/if_el.c +++ b/sys/i386/isa/if_el.c @@ -6,7 +6,7 @@ * * Questions, comments, bug reports and fixes to kimmel@cs.umass.edu. * - * $Id: if_el.c,v 1.17 1995/10/28 15:39:02 phk Exp $ + * $Id: if_el.c,v 1.18 1995/11/04 17:07:24 bde Exp $ */ /* Except of course for the portions of code lifted from other FreeBSD * drivers (mainly elread, elget and el_ioctl) @@ -91,7 +91,7 @@ int el_ioctl(struct ifnet *,int,caddr_t); int el_probe(struct isa_device *); void el_start(struct ifnet *); void el_reset(int); -void el_watchdog(int); +void el_watchdog(struct ifnet *); static void el_stop(int); static int el_xmit(struct el_softc *,int); @@ -209,11 +209,9 @@ int el_attach(struct isa_device *idev) ifp->if_unit = idev->id_unit; ifp->if_name = "el"; ifp->if_mtu = ETHERMTU; - ifp->if_init = el_init; ifp->if_output = ether_output; ifp->if_start = el_start; ifp->if_ioctl = el_ioctl; - ifp->if_reset = el_reset; ifp->if_watchdog = el_watchdog; ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX); @@ -819,14 +817,10 @@ el_ioctl(ifp, command, data) } /* Device timeout routine */ -void el_watchdog(int unit) +void el_watchdog(struct ifnet *ifp) { - struct el_softc *sc; - - sc = &el_softc[unit]; - - log(LOG_ERR,"el%d: device timeout\n",unit); - sc->arpcom.ac_if.if_oerrors++; - el_reset(unit); + log(LOG_ERR,"el%d: device timeout\n",ifp->if_unit); + ifp->if_oerrors++; + el_reset(ifp->if_unit); } #endif diff --git a/sys/i386/isa/if_ep.c b/sys/i386/isa/if_ep.c index 5cea129..54536f6 100644 --- a/sys/i386/isa/if_ep.c +++ b/sys/i386/isa/if_ep.c @@ -38,7 +38,7 @@ */ /* - * $Id: if_ep.c,v 1.33 1995/10/28 15:39:04 phk Exp $ + * $Id: if_ep.c,v 1.34 1995/11/04 17:07:26 bde Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -117,7 +117,7 @@ void epread __P((struct ep_softc *)); void epreset __P((int)); void epstart __P((struct ifnet *)); void epstop __P((int)); -void epwatchdog __P((int)); +void epwatchdog __P((struct ifnet *)); static int send_ID_sequence __P((int)); static int get_eeprom_data __P((int, int)); @@ -427,12 +427,10 @@ epattach(is) ifp->if_name = "ep"; ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; - ifp->if_init = epinit; ifp->if_output = ether_output; ifp->if_start = epstart; ifp->if_ioctl = epioctl; ifp->if_watchdog = epwatchdog; - ifp->if_timer=1; if_attach(ifp); kdc_ep[is->id_unit].kdc_state = DC_BUSY; @@ -1246,36 +1244,19 @@ epioctl(ifp, cmd, data) } void -epreset(unit) - int unit; -{ - int s = splimp(); - - epstop(unit); - epinit(unit); - splx(s); -} - -void -epwatchdog(unit) - int unit; +epwatchdog(ifp) + struct ifnet *ifp; { - struct ep_softc *sc = &ep_softc[unit]; - struct ifnet *ifp=&sc->arpcom.ac_if; - /* printf("ep: watchdog\n"); - log(LOG_ERR, "ep%d: watchdog\n", unit); - ++sc->arpcom.ac_if.if_oerrors; + log(LOG_ERR, "ep%d: watchdog\n", ifp->if_unit); + ifp->if_oerrors++; */ - /* epreset(unit); */ ifp->if_flags &= ~IFF_OACTIVE; epstart(ifp); - epintr(unit); - - ifp->if_timer=1; + epintr(ifp->if_unit); } void diff --git a/sys/i386/isa/if_fe.c b/sys/i386/isa/if_fe.c index 01ec89a..a366f05 100644 --- a/sys/i386/isa/if_fe.c +++ b/sys/i386/isa/if_fe.c @@ -252,7 +252,7 @@ void fe_init ( int ); int fe_ioctl ( struct ifnet *, int, caddr_t ); void fe_start ( struct ifnet * ); void fe_reset ( int ); -void fe_watchdog ( int ); +void fe_watchdog ( struct ifnet * ); /* Local functions. Order of declaration is confused. FIXME. */ static int fe_probe_fmv ( struct isa_device *, struct fe_softc * ); @@ -1062,11 +1062,9 @@ fe_attach ( struct isa_device *isa_dev ) */ sc->sc_if.if_unit = sc->sc_unit; sc->sc_if.if_name = "fe"; - sc->sc_if.if_init = fe_init; sc->sc_if.if_output = ether_output; sc->sc_if.if_start = fe_start; sc->sc_if.if_ioctl = fe_ioctl; - sc->sc_if.if_reset = fe_reset; sc->sc_if.if_watchdog = fe_watchdog; /* @@ -1246,27 +1244,27 @@ fe_stop ( int unit ) * generate an interrupt after a transmit has been started on it. */ void -fe_watchdog ( int unit ) +fe_watchdog ( struct ifnet *ifp ) { - struct fe_softc *sc = &fe_softc[unit]; + struct fe_softc *sc = (struct fe_softc *)ifp; #if FE_DEBUG >= 1 log( LOG_ERR, "fe%d: transmission timeout (%d+%d)%s\n", - unit, sc->txb_sched, sc->txb_count, - ( sc->sc_if.if_flags & IFF_UP ) ? "" : " when down" ); + ifp->if_unit, sc->txb_sched, sc->txb_count, + ( ifp->if_flags & IFF_UP ) ? "" : " when down" ); #endif #if FE_DEBUG >= 3 fe_dump( LOG_INFO, sc, NULL ); #endif /* Record how many packets are lost by this accident. */ - sc->sc_if.if_oerrors += sc->txb_sched + sc->txb_count; + ifp->if_oerrors += sc->txb_sched + sc->txb_count; /* Put the interface into known initial state. */ - if ( sc->sc_if.if_flags & IFF_UP ) { - fe_reset( unit ); + if ( ifp->if_flags & IFF_UP ) { + fe_reset( ifp->if_unit ); } else { - fe_stop( unit ); + fe_stop( ifp->if_unit ); } } diff --git a/sys/i386/isa/if_ie.c b/sys/i386/isa/if_ie.c index 3c04d9a..069867a 100644 --- a/sys/i386/isa/if_ie.c +++ b/sys/i386/isa/if_ie.c @@ -43,7 +43,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ie.c,v 1.28 1995/10/26 20:29:43 julian Exp $ + * $Id: if_ie.c,v 1.29 1995/11/18 08:35:49 bde Exp $ */ /* @@ -588,11 +588,9 @@ ieattach(dvp) ether_sprintf(ie->arpcom.ac_enaddr)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_init = ieinit; ifp->if_output = ether_output; ifp->if_start = iestart; ifp->if_ioctl = ieioctl; - ifp->if_reset = iereset; ifp->if_type = IFT_ETHER; ifp->if_addrlen = 6; ifp->if_hdrlen = 14; diff --git a/sys/i386/isa/if_ix.c b/sys/i386/isa/if_ix.c index 7d7c9f3..765b559 100644 --- a/sys/i386/isa/if_ix.c +++ b/sys/i386/isa/if_ix.c @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_ix.c,v 1.13 1995/10/31 18:41:11 phk Exp $ + * $Id: if_ix.c,v 1.14 1995/11/04 17:07:31 bde Exp $ */ #include "ix.h" @@ -163,7 +163,7 @@ static int ixstop(struct ifnet *); static int ixdone(struct ifnet *); static int ixioctl(struct ifnet *, int, caddr_t); static void ixreset(int); -static void ixwatchdog(int); +static void ixwatchdog(struct ifnet *); static u_short ixeeprom_read(int, int); static void ixeeprom_outbits(int, int, int); static int ixeeprom_inbits(int); @@ -591,12 +591,10 @@ ixattach(struct isa_device *dvp) { ifp->if_unit = unit; ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST; - ifp->if_init = ixinit; ifp->if_output = ether_output; ifp->if_start = ixstart; ifp->if_done = ixdone; ifp->if_ioctl = ixioctl; - ifp->if_reset = ixreset; ifp->if_watchdog = ixwatchdog; ifp->if_type = IFT_ETHER; ifp->if_addrlen = ETHER_ADDRESS_LENGTH; @@ -1599,12 +1597,10 @@ ixreset(int unit) { * watchdog from happening. */ void -ixwatchdog(int unit) { - ix_softc_t *sc = &ix_softc[unit]; - - log(LOG_ERR, "ix%d: device timeout\n", unit); - sc->arpcom.ac_if.if_oerrors++; - ixreset(unit); +ixwatchdog(struct ifnet *ifp) { + log(LOG_ERR, "ix%d: device timeout\n", ifp->if_unit); + ifp->if_oerrors++; + ixreset(ifp->if_unit); return; } diff --git a/sys/i386/isa/if_le.c b/sys/i386/isa/if_le.c index e22c765..2e38218 100644 --- a/sys/i386/isa/if_le.c +++ b/sys/i386/isa/if_le.c @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_le.c,v 1.22 1995/10/28 15:39:08 phk Exp $ + * $Id: if_le.c,v 1.23 1995/11/04 17:07:33 bde Exp $ */ /* @@ -97,10 +97,10 @@ typedef u_short le_mcbits_t; #define LE_MC_NBPW (1 << LE_MC_NBPW_LOG2) #if __FreeBSD__ > 1 #define IF_RESET_ARGS int unit -#define LE_RESET(ifp) (((sc)->le_if.if_reset)((sc)->le_if.if_unit)) +#define LE_RESET(ifp) (((sc)->if_reset)((sc)->le_if.if_unit)) #else #define IF_RESET_ARGS int unit, int dummy -#define LE_RESET(ifp) (((sc)->le_if.if_reset)((sc)->le_if.if_unit, 0)) +#define LE_RESET(ifp) (((sc)->if_reset)((sc)->le_if.if_unit, 0)) #endif #if !defined(LE_NOLEMAC) @@ -220,6 +220,8 @@ static void (*le_intrvec[NLE])(le_softc_t *sc); */ struct le_softc { struct arpcom le_ac; /* Common Ethernet/ARP Structure */ + void (*if_init) __P((int)); /* Interface init routine */ + void (*if_reset) __P((int)); /* Interface reset routine */ caddr_t le_membase; /* Starting memory address (virtual) */ unsigned le_iobase; /* Starting I/O base address */ unsigned le_irq; /* Interrupt Request Value */ @@ -568,7 +570,7 @@ le_ioctl( switch(ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: { - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); arp_ifinit((struct arpcom *)ifp, ifa); break; } @@ -589,7 +591,7 @@ le_ioctl( sizeof sc->le_ac.ac_enaddr); } - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); break; } #endif /* IPX */ @@ -609,12 +611,12 @@ le_ioctl( sizeof sc->le_ac.ac_enaddr); } - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); break; } #endif /* NS */ default: { - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); break; } } @@ -622,7 +624,7 @@ le_ioctl( } case SIOCSIFFLAGS: { - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); break; } @@ -638,7 +640,7 @@ le_ioctl( if (error == ENETRESET) { /* reset multicast filtering */ - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); error = 0; } break; @@ -885,9 +887,9 @@ lemac_probe( /* * Try to reset the unit */ - sc->le_if.if_init = lemac_init; + sc->if_init = lemac_init; sc->le_if.if_start = lemac_start; - sc->le_if.if_reset = lemac_reset; + sc->if_reset = lemac_reset; sc->lemac_memmode = 2; LE_RESET(sc); if ((sc->le_flags & IFF_UP) == 0) @@ -1561,8 +1563,8 @@ depca_probe( if (!lance_init_adapmem(sc)) return 0; - sc->le_if.if_reset = lance_reset; - sc->le_if.if_init = lance_init; + sc->if_reset = lance_reset; + sc->if_init = lance_init; sc->le_if.if_start = lance_start; DEPCA_WRNICSR(sc, DEPCA_NICSR_SHE | DEPCA_NICSR_ENABINTR); LE_RESET(sc); diff --git a/sys/i386/isa/if_lnc.c b/sys/i386/isa/if_lnc.c index a04c39e..ffc57a7 100644 --- a/sys/i386/isa/if_lnc.c +++ b/sys/i386/isa/if_lnc.c @@ -136,7 +136,7 @@ static int pcnet_probe(int); static void lnc_init(int); static void lnc_start(struct ifnet *); static int lnc_ioctl(struct ifnet *, int, caddr_t); -static void lnc_watchdog(int); +static void lnc_watchdog(struct ifnet *); static int lnc_probe(struct isa_device *); static int lnc_attach(struct isa_device *); #ifdef DEBUG @@ -1088,11 +1088,9 @@ lnc_attach(struct isa_device * isa_dev) sc->arpcom.ac_if.if_mtu = ETHERMTU; sc->arpcom.ac_if.if_flags = IFF_BROADCAST | IFF_SIMPLEX; sc->arpcom.ac_if.if_timer = 0; - sc->arpcom.ac_if.if_init = lnc_init; sc->arpcom.ac_if.if_output = ether_output; sc->arpcom.ac_if.if_start = lnc_start; sc->arpcom.ac_if.if_ioctl = lnc_ioctl; - sc->arpcom.ac_if.if_reset = lnc_reset; sc->arpcom.ac_if.if_watchdog = lnc_watchdog; sc->arpcom.ac_if.if_type = IFT_ETHER; sc->arpcom.ac_if.if_addrlen = ETHER_ADDR_LEN; @@ -1668,11 +1666,11 @@ lnc_ioctl(struct ifnet * ifp, int command, caddr_t data) } static void -lnc_watchdog(int unit) +lnc_watchdog(struct ifnet *ifp) { - log(LOG_ERR, "lnc%d: Device timeout -- Resetting\n", unit); - ++lnc_softc[unit].arpcom.ac_if.if_oerrors; - lnc_reset(unit); + log(LOG_ERR, "lnc%d: Device timeout -- Resetting\n", ifp->if_unit); + ifp->if_oerrors++; + lnc_reset(ifp->if_unit); } #ifdef DEBUG diff --git a/sys/i386/isa/if_ze.c b/sys/i386/isa/if_ze.c index 15fefc1..6d964a1 100644 --- a/sys/i386/isa/if_ze.c +++ b/sys/i386/isa/if_ze.c @@ -47,7 +47,7 @@ */ /* - * $Id: if_ze.c,v 1.23 1995/10/28 15:39:12 phk Exp $ + * $Id: if_ze.c,v 1.24 1995/11/18 08:39:28 bde Exp $ */ #include "ze.h" @@ -113,11 +113,11 @@ */ struct ze_softc { + struct arpcom arpcom; /* ethernet common */ + caddr_t maddr; u_long iobase, irq; - struct arpcom arpcom; /* ethernet common */ - char *type_str; /* pointer to type string */ char *mau; /* type of media access unit */ u_short nic_addr; /* NIC (DS8390) I/O bus address */ @@ -158,7 +158,7 @@ static int ze_resume __P((void *visa_dev)); extern int ze_attach __P((struct isa_device *isa_dev)); extern void ze_reset __P((int unit)); extern void ze_stop __P((int unit)); -extern void ze_watchdog __P((int unit)); +extern void ze_watchdog __P((struct ifnet *ifp)); extern void ze_init __P((int unit)); static inline void ze_xmit __P((struct ifnet *ifp)); extern void ze_start __P((struct ifnet *ifp)); @@ -622,11 +622,9 @@ ze_attach(isa_dev) ifp->if_unit = isa_dev->id_unit; ifp->if_name = "ze" ; ifp->if_mtu = ETHERMTU; - ifp->if_init = ze_init; ifp->if_output = ether_output; ifp->if_start = ze_start; ifp->if_ioctl = ze_ioctl; - ifp->if_reset = ze_reset; ifp->if_watchdog = ze_watchdog; ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX); @@ -741,15 +739,15 @@ ze_stop(unit) * generate an interrupt after a transmit has been started on it. */ void -ze_watchdog(unit) - int unit; +ze_watchdog(ifp) + struct ifnet *ifp; { #if 1 - struct ze_softc *sc = &ze_softc[unit]; + struct ze_softc *sc = (struct ze_softc *)ifp; u_char isr, imr; u_short imask; - if(!(sc->arpcom.ac_if.if_flags & IFF_UP)) + if(!(ifp->if_flags & IFF_UP)) return; /* select page zero */ outb (sc->nic_addr + ED_P0_CR, @@ -768,12 +766,12 @@ ze_watchdog(unit) imask = inb(IO_ICU2) << 8 | inb(IO_ICU1); log (LOG_ERR, "ze%d: device timeout, isr=%02x, imr=%02x, imask=%04x\n", - unit, isr, imr, imask); + ifp->if_unit, isr, imr, imask); #else - log(LOG_ERR, "ze%d: device timeout\n", unit); + log(LOG_ERR, "ze%d: device timeout\n", ifp->if_unit); #endif - ze_reset(unit); + ze_reset(ifp->if_unit); } /* diff --git a/sys/i386/isa/if_zp.c b/sys/i386/isa/if_zp.c index 5c1dd15..80a4b24 100644 --- a/sys/i386/isa/if_zp.c +++ b/sys/i386/isa/if_zp.c @@ -34,7 +34,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * From: if_ep.c,v 1.9 1994/01/25 10:46:29 deraadt Exp $ - * $Id: if_zp.c,v 1.11 1995/10/28 15:39:13 phk Exp $ + * $Id: if_zp.c,v 1.12 1995/11/18 08:58:14 bde Exp $ */ /*- * TODO: @@ -284,7 +284,7 @@ void zpread __P((struct zp_softc *)); void zpreset __P((int)); void zpstart __P((struct ifnet *)); void zpstop __P((int)); -void zpwatchdog __P((int)); +void zpwatchdog __P((struct ifnet *)); struct isa_driver zpdriver = { zpprobe, @@ -913,7 +913,6 @@ zpattach(isa_dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; ifp->if_unit = isa_dev->id_unit; ifp->if_name = "zp"; - ifp->if_init = zpinit; ifp->if_output = ether_output; ifp->if_start = zpstart; ifp->if_ioctl = zpioctl; @@ -2032,22 +2031,20 @@ zpreset(unit) } void -zpwatchdog(unit) - int unit; +zpwatchdog(ifp) + struct ifnet *ifp; { - struct zp_softc *sc = &zp_softc[unit]; - #ifdef ZP_DEBUG printf("### zpwatchdog ####\n"); #endif /* ZP_DEBUG */ #ifdef MACH_KERNEL - ++sc->ds_if.if_oerrors; + ifp->if_oerrors++; #else /* MACH_KERNEL */ - log(LOG_ERR, "zp%d: watchdog\n", unit); - ++sc->arpcom.ac_if.if_oerrors; + log(LOG_ERR, "zp%d: watchdog\n", ifp->if_unit); + ifp->if_oerrors++; #endif /* MACH_KERNEL */ - zpreset(unit); + zpreset(ifp->if_unit); } void diff --git a/sys/net/if.c b/sys/net/if.c index c55897b..f0ebb23 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if.c 8.3 (Berkeley) 1/4/94 - * $Id: if.c,v 1.21 1995/09/27 15:00:49 wollman Exp $ + * $Id: if.c,v 1.22 1995/11/18 13:01:19 bde Exp $ */ #include <sys/param.h> @@ -84,22 +84,6 @@ ifinit(dummy) if_slowtimo(0); } -#ifdef vax -/* - * Call each interface on a Unibus reset. - */ -void -ifubareset(uban) - int uban; -{ - register struct ifnet *ifp; - - for (ifp = ifnet; ifp; ifp = ifp->if_next) - if (ifp->if_reset) - (*ifp->if_reset)(ifp->if_unit, uban); -} -#endif - int if_index = 0; struct ifaddr **ifnet_addrs; static char *sprint_d __P((u_int, char *, int)); @@ -440,7 +424,7 @@ if_slowtimo(arg) if (ifp->if_timer == 0 || --ifp->if_timer) continue; if (ifp->if_watchdog) - (*ifp->if_watchdog)(ifp->if_unit); + (*ifp->if_watchdog)(ifp); } splx(s); timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ); diff --git a/sys/net/if.h b/sys/net/if.h index 46e5213..19bd37d 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if.h 8.1 (Berkeley) 6/10/93 - * $Id: if.h,v 1.22 1995/08/31 15:21:31 wollman Exp $ + * $Id: if.h,v 1.23 1995/10/13 19:48:00 wollman Exp $ */ #ifndef _NET_IF_H_ @@ -135,8 +135,6 @@ struct ifnet { short if_flags; /* up/down, broadcast, etc. */ struct if_data if_data; /* procedure handles */ - void (*if_init) /* init routine */ - __P((int)); int (*if_output) /* output routine (enqueue) */ __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *)); @@ -146,10 +144,8 @@ struct ifnet { __P((struct ifnet *)); /* (XXX not used; fake prototype) */ int (*if_ioctl) /* ioctl routine */ __P((struct ifnet *, int, caddr_t)); - void (*if_reset) - __P((int)); /* new autoconfig will permit removal */ void (*if_watchdog) /* timer routine */ - __P((int)); + __P((struct ifnet *)); struct ifqueue if_snd; /* output queue */ void *if_private[IF_NPRIVATE]; /* opaque data for various clients */ }; diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h index aaa5200..5a7f73a 100644 --- a/sys/netinet/if_ether.h +++ b/sys/netinet/if_ether.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 - * $Id: if_ether.h,v 1.10 1995/09/21 17:39:51 wollman Exp $ + * $Id: if_ether.h,v 1.11 1995/10/05 20:08:43 wollman Exp $ */ #ifndef _NETINET_IF_ETHER_H_ @@ -115,6 +115,9 @@ struct ether_arp { * begins with this structure. */ struct arpcom { + /* + * The ifnet struct _must_ be at the head of this structure. + */ struct ifnet ac_if; /* network-visible interface */ u_char ac_enaddr[6]; /* ethernet hardware address */ struct in_addr ac_ipaddr; /* copy of ip address- XXX */ diff --git a/sys/netiso/if_eon.c b/sys/netiso/if_eon.c index c8ac599..4379829 100644 --- a/sys/netiso/if_eon.c +++ b/sys/netiso/if_eon.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_eon.c 8.1 (Berkeley) 6/10/93 - * $Id: if_eon.c,v 1.3 1995/04/26 18:10:57 pst Exp $ + * $Id: if_eon.c,v 1.4 1995/05/30 08:10:45 rgrimes Exp $ */ /*********************************************************** @@ -61,7 +61,7 @@ SOFTWARE. * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison */ /* - * $Header: /home/ncvs/src/sys/netiso/if_eon.c,v 1.3 1995/04/26 18:10:57 pst Exp $ + * $Header: /home/ncvs/src/sys/netiso/if_eon.c,v 1.4 1995/05/30 08:10:45 rgrimes Exp $ * $Source: /home/ncvs/src/sys/netiso/if_eon.c,v $ * * EON rfc @@ -147,7 +147,6 @@ eonattach() ifp->if_mtu = ETHERMTU; /* since everything will go out over ether or token ring */ - ifp->if_init = eoninit; ifp->if_ioctl = eonioctl; ifp->if_output = eonoutput; ifp->if_type = IFT_EON; diff --git a/sys/netiso/iso_snpac.c b/sys/netiso/iso_snpac.c index 3650231..5218682 100644 --- a/sys/netiso/iso_snpac.c +++ b/sys/netiso/iso_snpac.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)iso_snpac.c 8.1 (Berkeley) 6/10/93 - * $Id: iso_snpac.c,v 1.3 1994/12/13 22:33:05 wollman Exp $ + * $Id: iso_snpac.c,v 1.4 1995/05/30 08:10:58 rgrimes Exp $ */ /*********************************************************** @@ -60,7 +60,7 @@ SOFTWARE. /* * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison */ -/* $Header: /home/ncvs/src/sys/netiso/iso_snpac.c,v 1.3 1994/12/13 22:33:05 wollman Exp $ */ +/* $Header: /home/ncvs/src/sys/netiso/iso_snpac.c,v 1.4 1995/05/30 08:10:58 rgrimes Exp $ */ /* $Source: /home/ncvs/src/sys/netiso/iso_snpac.c,v $ */ #ifdef ISO @@ -253,6 +253,7 @@ iso_setmcasts(ifp, req) if (ether_delmulti(&ifr, (struct arpcom *)ifp) == ENETRESET) doreset++; } +#if 0 if (doreset) { if (ifp->if_reset) (*ifp->if_reset)(ifp->if_unit); @@ -260,6 +261,7 @@ iso_setmcasts(ifp, req) printf("iso_setmcasts: %s%d needs reseting to receive iso mcasts\n", ifp->if_name, ifp->if_unit); } +#endif } /* * FUNCTION: iso_snparesolve diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c index f8f7ac4..66e2fa0 100644 --- a/sys/pci/if_fxp.c +++ b/sys/pci/if_fxp.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_fxp.c,v 1.1 1995/11/28 23:55:20 davidg Exp $ + * $Id: if_fxp.c,v 1.2 1995/12/01 22:41:56 davidg Exp $ */ /* @@ -140,9 +140,9 @@ static int fxp_shutdown __P((struct kern_devconf *, int)); static int fxp_intr __P((void *)); static void fxp_start __P((struct ifnet *)); static int fxp_ioctl __P((struct ifnet *, int, caddr_t)); -static void fxp_init __P((int)); -static void fxp_stop __P((int)); -static void fxp_watchdog __P((int)); +static void fxp_init __P((struct ifnet *)); +static void fxp_stop __P((struct fxp_softc *)); +static void fxp_watchdog __P((struct ifnet *)); static void fxp_get_macaddr __P((struct fxp_softc *)); static int fxp_add_rfabuf __P((struct fxp_softc *, struct mbuf *)); @@ -413,7 +413,7 @@ static void fxp_start(ifp) struct ifnet *ifp; { - struct fxp_softc *sc = fxp_sc[ifp->if_unit]; + struct fxp_softc *sc = (struct fxp_softc *)ifp; struct fxp_csr *csr = sc->csr; struct fxp_cb_tx *txp; struct mbuf *m, *mb_head; @@ -687,10 +687,9 @@ fxp_stats_update(arg) * the interface. */ static void -fxp_stop(unit) - int unit; +fxp_stop(sc) + struct fxp_softc *sc; { - struct fxp_softc *sc = fxp_sc[unit]; struct ifnet *ifp = &sc->arpcom.ac_if; /* @@ -710,25 +709,20 @@ fxp_stop(unit) * card has wedged for some reason. */ static void -fxp_watchdog(unit) - int unit; +fxp_watchdog(ifp) + struct ifnet *ifp; { - struct fxp_softc *sc = fxp_sc[unit]; - struct ifnet *ifp = &sc->arpcom.ac_if; + log(LOG_ERR, "fxp%d: device timeout\n", ifp->if_unit); + ifp->if_oerrors++; - log(LOG_ERR, "fxp%d: device timeout\n", unit); - ++sc->arpcom.ac_if.if_oerrors; - - fxp_stop(unit); - fxp_init(unit); + fxp_init(ifp); } static void -fxp_init(unit) - int unit; +fxp_init(ifp) + struct ifnet *ifp; { - struct fxp_softc *sc = fxp_sc[unit]; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct fxp_softc *sc = (struct fxp_softc *)ifp; struct fxp_cb_config *cbp; struct fxp_cb_ias *cb_ias; struct fxp_cb_tx *txp; @@ -950,7 +944,7 @@ fxp_ioctl(ifp, command, data) caddr_t data; { struct ifaddr *ifa = (struct ifaddr *) data; - struct fxp_softc *sc = fxp_sc[ifp->if_unit]; + struct fxp_softc *sc = (struct fxp_softc *)ifp; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; @@ -964,7 +958,7 @@ fxp_ioctl(ifp, command, data) switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - fxp_init(ifp->if_unit); /* before arpwhohas */ + fxp_init(ifp); /* before arpwhohas */ arp_ifinit((struct arpcom *)ifp, ifa); break; #endif @@ -988,7 +982,7 @@ fxp_ioctl(ifp, command, data) /* * Set new address */ - fxp_init(ifp->if_unit); + fxp_init(ifp); break; } #endif @@ -1012,12 +1006,12 @@ fxp_ioctl(ifp, command, data) /* * Set new address */ - fxp_init(ifp->if_unit); + fxp_init(ifp); break; } #endif default: - fxp_init(ifp->if_unit); + fxp_init(ifp); break; } break; @@ -1041,10 +1035,10 @@ fxp_ioctl(ifp, command, data) * such as IFF_PROMISC are handled. */ if (ifp->if_flags & IFF_UP) { - fxp_init(ifp->if_unit); + fxp_init(ifp); } else { if (ifp->if_flags & IFF_RUNNING) - fxp_stop(ifp->if_unit); + fxp_stop(sc); } break; @@ -1062,7 +1056,7 @@ fxp_ioctl(ifp, command, data) * Multicast list has changed; set the hardware filter * accordingly. */ - fxp_init(ifp->if_unit); + fxp_init(ifp); error = 0; } diff --git a/sys/pci/if_pdq.c b/sys/pci/if_pdq.c index 34a9546..ef252cd 100644 --- a/sys/pci/if_pdq.c +++ b/sys/pci/if_pdq.c @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_pdq.c,v 1.8 1995/10/29 15:33:28 phk Exp $ + * $Id: if_pdq.c,v 1.9 1995/11/04 15:05:52 bde Exp $ * */ @@ -119,6 +119,7 @@ typedef struct { struct atshutdown sc_ats; /* shutdown routine */ #endif struct arpcom sc_ac; + void (*if_init) __P((int unit)); pdq_t *sc_pdq; #if NBPFILTER > 0 && !defined(__FreeBSD__) && !defined(__bsdi__) caddr_t sc_bpf; @@ -325,7 +326,7 @@ pdq_ifioctl( #ifdef INET case AF_INET: { ((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr; - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); #ifdef __FreeBSD__ arp_ifinit((struct arpcom *)ifp, ifa); #else @@ -351,13 +352,13 @@ pdq_ifioctl( sizeof sc->sc_ac.ac_enaddr); } - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); break; } #endif /* NS */ default: { - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); break; } } @@ -365,7 +366,7 @@ pdq_ifioctl( } case SIOCSIFFLAGS: { - (*ifp->if_init)(ifp->if_unit); + (*sc->if_init)(ifp->if_unit); break; } @@ -402,16 +403,13 @@ pdq_ifattach( pdq_softc_t *sc, ifnet_ret_t (*ifinit)(int unit), ifnet_ret_t (*ifreset)(int unit), - ifnet_ret_t (*ifwatchdog)(int unit)) + ifnet_ret_t (*ifwatchdog)(struct ifnet *ifp)) { struct ifnet *ifp = &sc->sc_if; ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST; - ifp->if_init = ifinit; -#ifndef __bsdi__ - ifp->if_reset = ifreset; -#endif + sc->if_init = ifinit; ifp->if_watchdog = ifwatchdog; ifp->if_ioctl = pdq_ifioctl; @@ -470,10 +468,9 @@ pdq_pci_ifinit( } static ifnet_ret_t -pdq_pci_ifwatchdog( - int unit) +pdq_pci_ifwatchdog(struct ifnet *ifp) { - pdq_ifwatchdog(PDQ_PCI_UNIT_TO_SOFTC(unit)); + pdq_ifwatchdog(PDQ_PCI_UNIT_TO_SOFTC(ifp->if_unit)); } static int @@ -564,10 +561,9 @@ pdq_eisa_ifinit( } static ifnet_ret_t -pdq_eisa_ifwatchdog( - int unit) +pdq_eisa_ifwatchdog(struct ifnet *ifp) { - pdq_ifwatchdog(PDQ_EISA_UNIT_TO_SOFTC(unit)); + pdq_ifwatchdog(PDQ_EISA_UNIT_TO_SOFTC(ifp->if_unit)); } #ifdef __FreeBSD__ diff --git a/sys/pci/if_vx.c b/sys/pci/if_vx.c index 9574a86..2c135fd 100644 --- a/sys/pci/if_vx.c +++ b/sys/pci/if_vx.c @@ -111,7 +111,7 @@ void vxread __P((struct vx_softc *)); void vxreset __P((int)); void vxstart __P((struct ifnet *)); void vxstop __P((int)); -void vxwatchdog __P((int)); +void vxwatchdog __P((struct ifnet *)); static int send_ID_sequence __P((int)); static int get_eeprom_data __P((int, int)); @@ -252,12 +252,10 @@ vx_pci_attach( ifp->if_name = "vx"; ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX /*| IFF_NOTRAILERS*/; - ifp->if_init = vxinit; ifp->if_output = ether_output; ifp->if_start = vxstart; ifp->if_ioctl = vxioctl; ifp->if_watchdog = vxwatchdog; - ifp->if_timer=1; if_attach(ifp); @@ -1071,25 +1069,20 @@ vxreset(unit) } void -vxwatchdog(unit) - int unit; +vxwatchdog(ifp) + struct ifnet *ifp; { - struct vx_softc *sc = &vx_softc[unit]; - struct ifnet *ifp=&sc->arpcom.ac_if; - /* printf("vx: watchdog\n"); - log(LOG_ERR, "vx%d: watchdog\n", unit); - ++sc->arpcom.ac_if.if_oerrors; + log(LOG_ERR, "vx%d: watchdog\n", ifp->if_unit); + ifp->if_oerrors++; */ - /* vxreset(unit); */ + /* vxreset(ifp->if_unit); */ ifp->if_flags &= ~IFF_OACTIVE; vxstart(ifp); - vxintr(unit); - - ifp->if_timer=1; + vxintr(ifp->if_unit); } void |