summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-12-05 02:01:59 +0000
committerdg <dg@FreeBSD.org>1995-12-05 02:01:59 +0000
commit8156a5707a8830d1ce5658e103e6780f22cfc8dd (patch)
tree85cbbd7c1e0b938f939f958fcf5fd93d4c5c5406 /sys/dev
parentfd5819ba7c85b8236d4b1f4cc3340e673229a93a (diff)
downloadFreeBSD-src-8156a5707a8830d1ce5658e103e6780f22cfc8dd.zip
FreeBSD-src-8156a5707a8830d1ce5658e103e6780f22cfc8dd.tar.gz
all:
Removed ifnet.if_init and ifnet.if_reset as they are generally unused. Change the parameter passed to if_watchdog to be a ifnet * rather than a unit number. All of this is an attempt to move toward not needing an array of softc pointers (which is usually static in size) to point to the driver softc. if_ed.c: Changed some of the argument passing to some functions to make a little more sense. if_ep.c, if_vx.c: Killed completely bogus use of if_timer. It was being set in such a way that the interface was being reset once per second (blech!).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ar/if_ar.c34
-rw-r--r--sys/dev/ar/if_ar_isa.c34
-rw-r--r--sys/dev/ed/if_ed.c164
-rw-r--r--sys/dev/ep/if_ep.c33
-rw-r--r--sys/dev/fe/if_fe.c20
-rw-r--r--sys/dev/fxp/if_fxp.c52
-rw-r--r--sys/dev/ie/if_ie.c4
-rw-r--r--sys/dev/lnc/if_lnc.c12
8 files changed, 144 insertions, 209 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
OpenPOWER on IntegriCloud