diff options
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/include/cronyx.h | 1 | ||||
-rw-r--r-- | sys/i386/isa/if_ar.c | 29 | ||||
-rw-r--r-- | sys/i386/isa/if_cx.c | 17 | ||||
-rw-r--r-- | sys/i386/isa/if_ed.c | 27 | ||||
-rw-r--r-- | sys/i386/isa/if_eg.c | 14 | ||||
-rw-r--r-- | sys/i386/isa/if_el.c | 22 | ||||
-rw-r--r-- | sys/i386/isa/if_ep.c | 18 | ||||
-rw-r--r-- | sys/i386/isa/if_epreg.h | 3 | ||||
-rw-r--r-- | sys/i386/isa/if_fe.c | 67 | ||||
-rw-r--r-- | sys/i386/isa/if_ie.c | 52 | ||||
-rw-r--r-- | sys/i386/isa/if_ix.c | 24 | ||||
-rw-r--r-- | sys/i386/isa/if_le.c | 37 | ||||
-rw-r--r-- | sys/i386/isa/if_lnc.c | 19 | ||||
-rw-r--r-- | sys/i386/isa/if_ze.c | 45 | ||||
-rw-r--r-- | sys/i386/isa/if_zp.c | 34 | ||||
-rw-r--r-- | sys/i386/isa/lpt.c | 9 |
16 files changed, 139 insertions, 279 deletions
diff --git a/sys/i386/include/cronyx.h b/sys/i386/include/cronyx.h index 5b2160d..4386773 100644 --- a/sys/i386/include/cronyx.h +++ b/sys/i386/include/cronyx.h @@ -414,7 +414,6 @@ typedef struct _chan_t { struct ifnet *ifp; /* network interface data */ struct ifnet *master; /* master interface, or ==ifp */ struct _chan_t *slaveq; /* slave queue pointer, or NULL */ - caddr_t bpf; /* packet filter data */ cx_soft_opt_t sopt; /* software options and state flags */ cx_break_t brk; /* line break mode */ #ifdef __bsdi__ diff --git a/sys/i386/isa/if_ar.c b/sys/i386/isa/if_ar.c index 27ae67b..adf0ed1 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.3 1995/12/10 13:38:34 phk Exp $ + * $Id: if_ar.c,v 1.4 1995/12/15 00:54:03 bde Exp $ */ /* @@ -95,8 +95,6 @@ AR_ENA_SCA | (ch ? AR_SEL_SCA_1:AR_SEL_SCA_0)) #define ARC_SET_OFF(iobase) outb(iobase+AR_MSCA_EN, 0) -#define ARUNIT2SC(unit) ar_sc_ind[unit] - static struct ar_hardc { int cunit; struct ar_softc *sc; @@ -125,7 +123,6 @@ struct ar_softc { int unit; /* With regards to all ar devices */ int subunit; /* With regards to this card */ struct ar_hardc *hc; - caddr_t bpf; u_int txdesc; /* On card address */ u_int txstart; /* On card address */ @@ -145,8 +142,6 @@ struct ar_softc { struct kern_devconf kdc; }; -static struct ar_softc *ar_sc_ind[NAR*NPORT]; - static int arprobe(struct isa_device *id); static int arattach(struct isa_device *id); @@ -395,6 +390,7 @@ arattach(struct isa_device *id) ifp = &sc->ifsppp.pp_if; + ifp->if_softc = sc; ifp->if_unit = hc->startunit + unit; ifp->if_name = "ar"; ifp->if_mtu = PP_MTU; @@ -416,7 +412,7 @@ arattach(struct isa_device *id) if_attach(ifp); #if NBPFILTER > 0 - bpfattach(&sc->bpf, ifp, DLT_PPP, PPP_HEADER_LEN); + bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN); #endif } @@ -505,7 +501,7 @@ void arintr(int unit) static void arstart(struct ifnet *ifp) { - struct ar_softc *sc = ARUNIT2SC(ifp->if_unit); + struct ar_softc *sc = ifp->if_softc; int i, len, tlen; struct mbuf *mtx; u_char *txdata; @@ -562,8 +558,8 @@ arstart(struct ifnet *ifp) i++; #if NBPFILTER > 0 - if(sc->bpf) - bpf_mtap(sc->bpf, mtx); + if(ifp->if_bpf) + bpf_mtap(ifp, mtx); #endif m_freem(mtx); ++sc->ifsppp.pp_if.if_opackets; @@ -624,7 +620,7 @@ arioctl(struct ifnet *ifp, int cmd, caddr_t data) int s, error; int was_up, should_be_up; struct sppp *sp = (struct sppp *)ifp; - struct ar_softc *sc = ARUNIT2SC(ifp->if_unit); + struct ar_softc *sc = ifp->if_softc; TRC(printf("ar%d: arioctl.\n", ifp->if_unit);) @@ -674,7 +670,7 @@ arioctl(struct ifnet *ifp, int cmd, caddr_t data) static void arwatchdog(struct ifnet *ifp) { - struct ar_softc *sc = ARUNIT2SC(ifp->if_unit); + struct ar_softc *sc = ifp->if_softc; if(!(ifp->if_flags & IFF_RUNNING)) return; @@ -860,11 +856,6 @@ void arc_init(struct isa_device *id) sc->rxend = next + bufmem; sc->rxmax = (sc->rxend - sc->rxstart) / AR_BUF_SIZ; next += bufmem; - - /* - * This is by ARUNIT2SC(). - */ - ar_sc_ind[x] = sc; } } @@ -1233,8 +1224,8 @@ ar_get_packets(struct ar_softc *sc) m->m_pkthdr.len = m->m_len = len; ar_copy_rxbuf(m, sc, len); #if NBPFILTER > 0 - if(sc->bpf) - bpf_mtap(sc->bpf, m); + if(sc->ifsppp.pp_if.if_bpf) + bpf_mtap(&sc->ifsppp.pp_if, m); #endif sppp_input(&sc->ifsppp.pp_if, m); sc->ifsppp.pp_if.if_ipackets++; diff --git a/sys/i386/isa/if_cx.c b/sys/i386/isa/if_cx.c index cd7c193..bdbdef1 100644 --- a/sys/i386/isa/if_cx.c +++ b/sys/i386/isa/if_cx.c @@ -268,6 +268,7 @@ cxattach (struct isa_device *id) } bzero (c->ifp, IFSTRUCTSZ); c->master = c->ifp; + c->ifp->if_softc = c; c->ifp->if_unit = u; c->ifp->if_name = "cx"; c->ifp->if_mtu = PP_MTU; @@ -280,7 +281,7 @@ cxattach (struct isa_device *id) if_attach (c->ifp); #if NBPFILTER > 0 /* If BPF is in the kernel, call the attach for it. */ - bpfattach (&c->bpf, c->ifp, DLT_PPP, PPP_HEADER_LEN); + bpfattach (c->ifp, DLT_PPP, PPP_HEADER_LEN); #endif } } @@ -319,7 +320,7 @@ struct isa_driver cxdriver = { cxprobe, cxattach, "cx" }; static int cxsioctl (struct ifnet *ifp, int cmd, caddr_t data) { - cx_chan_t *q, *c = cxchan[ifp->if_unit]; + cx_chan_t *q, *c = ifp->if_softc; int error, s, was_up, should_be_up; /* @@ -488,8 +489,8 @@ cxput (cx_chan_t *c, char b) } m_copydata (m, 0, len, buf); #if NBPFILTER > 0 - if (c->bpf) - bpf_mtap (c->bpf, m); + if (c->ifp->if_bpf) + bpf_mtap (c->ifp, m); #endif m_freem (m); @@ -555,7 +556,7 @@ cxsend (cx_chan_t *c) static void cxstart (struct ifnet *ifp) { - cx_chan_t *q, *c = cxchan[ifp->if_unit]; + cx_chan_t *q, *c = ifp->if_softc; if (c->ifp->if_flags & IFF_DEBUG) print (("cx%d.%d: cxstart\n", c->board->num, c->num)); @@ -579,7 +580,7 @@ cxstart (struct ifnet *ifp) static void cxwatchdog (struct ifnet *ifp) { - cx_chan_t *q, *c = cxchan[ifp->if_unit]; + cx_chan_t *q, *c = ifp->if_softc; if (! (ifp->if_flags & IFF_RUNNING)) return; @@ -816,8 +817,8 @@ cxinput (cx_chan_t *c, void *buf, unsigned len) * Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ - if (c->bpf) - bpf_tap (c->bpf, buf, len); + if (c->ifp->if_bpf) + bpf_tap (c->ifp, buf, len); #endif /* Count the received bytes to the subchannel, not the master. */ diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index 35f8740..a68341f 100644 --- a/sys/i386/isa/if_ed.c +++ b/sys/i386/isa/if_ed.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ed.c,v 1.92 1995/12/15 07:31:40 davidg Exp $ + * $Id: if_ed.c,v 1.93 1996/01/24 21:06:02 phk Exp $ */ /* @@ -113,7 +113,6 @@ struct ed_softc { int is790; /* set by the probe code if the card is 790 * based */ - caddr_t bpf; /* BPF "magic cookie" */ caddr_t mem_start; /* NIC memory start address */ caddr_t mem_end; /* NIC memory end address */ u_long mem_size; /* total NIC memory size */ @@ -1434,6 +1433,7 @@ ed_attach(isa_dev) /* * Initialize ifnet structure */ + ifp->if_softc = sc; ifp->if_unit = isa_dev->id_unit; ifp->if_name = "ed"; ifp->if_output = ether_output; @@ -1458,6 +1458,7 @@ ed_attach(isa_dev) * Attach the interface */ if_attach(ifp); + ether_ifattach(ifp); } /* device attach does transition from UNCONFIGURED to IDLE state */ sc->kdc.kdc_state = DC_IDLE; @@ -1482,7 +1483,7 @@ ed_attach(isa_dev) * If BPF is in the kernel, call the attach for it */ #if NBPFILTER > 0 - bpfattach(&sc->bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif return 1; } @@ -1494,7 +1495,7 @@ static void ed_reset(ifp) struct ifnet *ifp; { - struct ed_softc *sc = (struct ed_softc *)ifp; + struct ed_softc *sc = ifp->if_softc; int s; if (sc->gone) @@ -1542,7 +1543,7 @@ static void ed_watchdog(ifp) struct ifnet *ifp; { - struct ed_softc *sc = (struct ed_softc *)ifp; + struct ed_softc *sc = ifp->if_softc; if (sc->gone) return; @@ -1559,7 +1560,7 @@ static void ed_init(ifp) struct ifnet *ifp; { - struct ed_softc *sc = (struct ed_softc *)ifp; + struct ed_softc *sc = ifp->if_softc; int i, s; if (sc->gone) @@ -1769,7 +1770,7 @@ static void ed_start(ifp) struct ifnet *ifp; { - struct ed_softc *sc = (struct ed_softc *)ifp; + struct ed_softc *sc = ifp->if_softc; struct mbuf *m0, *m; caddr_t buffer; int len; @@ -1904,8 +1905,8 @@ outloop: * Tap off here if there is a bpf listener. */ #if NBPFILTER > 0 - if (sc->bpf) { - bpf_mtap(sc->bpf, m0); + if (ifp->if_bpf) { + bpf_mtap(ifp, m0); } #endif @@ -1924,7 +1925,7 @@ static inline void ed_rint(sc) struct ed_softc *sc; { - struct ifnet *ifp = (struct ifnet *)sc; + struct ifnet *ifp = &sc->arpcom.ac_if; u_char boundry; u_short len; struct ed_ring packet_hdr; @@ -2264,7 +2265,7 @@ ed_ioctl(ifp, command, data) caddr_t data; { register struct ifaddr *ifa = (struct ifaddr *) data; - struct ed_softc *sc = (struct ed_softc *)ifp; + struct ed_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; @@ -2524,8 +2525,8 @@ ed_get_packet(sc, buf, len, multicast) * Check if there's a BPF listener on this interface. If so, hand off * the raw packet to bpf. */ - if (sc->bpf) { - bpf_mtap(sc->bpf, m); + if (sc->arpcom.ac_if.if_bpf) { + bpf_mtap(&sc->arpcom.ac_if, m); /* * Note that the interface cannot be in promiscuous mode if diff --git a/sys/i386/isa/if_eg.c b/sys/i386/isa/if_eg.c index 0f03f54..9d2f3bf 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.10 1995/12/15 00:54:09 bde Exp $ + * $Id: if_eg.c,v 1.11 1996/01/26 09:27:17 phk Exp $ */ /* To do: @@ -423,6 +423,7 @@ egattach (struct isa_device *id) } /* Initialize ifnet structure. */ + ifp->if_softc = sc; ifp->if_unit = id->id_unit; ifp->if_name = "eg"; ifp->if_output = ether_output; @@ -432,13 +433,14 @@ egattach (struct isa_device *id) /* Now we can attach the interface. */ if_attach(ifp); + ether_ifattach(ifp); /* device attach does transition from UNCONFIGURED to IDLE state */ sc->kdc.kdc_state = DC_IDLE; #if NBPFILTER > 0 - bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif return 1; @@ -519,7 +521,7 @@ static void egstart(ifp) struct ifnet *ifp; { - register struct eg_softc *sc = &eg_softc[ifp->if_unit]; + register struct eg_softc *sc = ifp->if_softc; struct mbuf *m0, *m; int len; short *ptr; @@ -552,7 +554,7 @@ egstart(ifp) } #if NBPFILTER > 0 if (sc->sc_arpcom.ac_if.if_bpf) - bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m0); + bpf_mtap(&sc->sc_arpcom.ac_if, m0); #endif m_freem(m0); @@ -684,7 +686,7 @@ egread(sc, buf, len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) { - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp, m); /* * Note that the interface cannot be in promiscuous mode if @@ -716,7 +718,7 @@ egioctl(ifp, command, data) int command; caddr_t data; { - struct eg_softc *sc = &eg_softc[ifp->if_unit]; + struct eg_softc *sc = ifp->if_softc; register struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c index c7b4aba..a72fc7c 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.21 1995/12/15 00:54:10 bde Exp $ + * $Id: if_el.c,v 1.22 1996/01/26 09:27:19 phk Exp $ */ /* Except of course for the portions of code lifted from other FreeBSD * drivers (mainly elread, elget and el_ioctl) @@ -80,7 +80,6 @@ static struct el_softc { struct arpcom arpcom; /* Ethernet common */ u_short el_base; /* Base I/O addr */ - caddr_t bpf; /* BPF magic cookie */ char el_pktbuf[EL_BUFSIZ]; /* Frame buffer */ } el_softc[NEL]; @@ -208,6 +207,7 @@ el_attach(struct isa_device *idev) el_hardreset(idev->id_unit); /* Initialize ifnet structure */ + ifp->if_softc = sc; ifp->if_unit = idev->id_unit; ifp->if_name = "el"; ifp->if_mtu = ETHERMTU; @@ -220,6 +220,7 @@ el_attach(struct isa_device *idev) /* Now we can attach the interface */ dprintf(("Attaching interface...\n")); if_attach(ifp); + ether_ifattach(ifp); kdc_el[idev->id_unit].kdc_state = DC_BUSY; /* Put the station address in the ifa address list's AF_LINK @@ -244,7 +245,7 @@ el_attach(struct isa_device *idev) /* Finally, attach to bpf filter if it is present. */ #if NBPFILTER > 0 dprintf(("Attaching to BPF...\n")); - bpfattach(&sc->bpf,ifp,DLT_EN10MB,sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif dprintf(("el_attach() finished.\n")); @@ -357,7 +358,7 @@ el_start(struct ifnet *ifp) int s, i, len, retries, done; /* Get things pointing in the right directions */ - sc = &el_softc[ifp->if_unit]; + sc = ifp->if_softc; base = sc->el_base; dprintf(("el_start()...\n")); @@ -400,8 +401,8 @@ el_start(struct ifnet *ifp) /* Give the packet to the bpf, if any */ #if NBPFILTER > 0 - if(sc->bpf) - bpf_tap(sc->bpf,sc->el_pktbuf,len); + if(sc->arpcom.ac_if.if_bpf) + bpf_tap(&sc->arpcom.ac_if, sc->el_pktbuf, len); #endif /* Transfer datagram to board */ @@ -588,8 +589,9 @@ static inline void elread(struct el_softc *sc,caddr_t buf,int len) * Check if there's a bpf filter listening on this interface. * If so, hand off the raw packet to bpf. */ - if(sc->bpf) { - bpf_tap(sc->bpf,buf,len+sizeof(struct ether_header)); + if(sc->arpcom.ac_if.if_bpf) { + bpf_tap(&sc->arpcom.ac_if, buf, + len + sizeof(struct ether_header)); /* * Note that the interface cannot be in promiscuous mode if @@ -699,7 +701,7 @@ el_ioctl(ifp, command, data) caddr_t data; { register struct ifaddr *ifa = (struct ifaddr *)data; - struct el_softc *sc = &el_softc[ifp->if_unit]; + struct el_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; @@ -825,7 +827,7 @@ el_ioctl(ifp, command, data) static void el_watchdog(struct ifnet *ifp) { - log(LOG_ERR,"el%d: device timeout\n",ifp->if_unit); + log(LOG_ERR,"el%d: device timeout\n", ifp->if_unit); ifp->if_oerrors++; el_reset(ifp->if_unit); } diff --git a/sys/i386/isa/if_ep.c b/sys/i386/isa/if_ep.c index c072171..66e305c 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.38 1996/01/26 09:27:22 phk Exp $ + * $Id: if_ep.c,v 1.39 1996/01/29 03:16:12 gibbs Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -449,6 +449,7 @@ epattach(is) GO_WINDOW(0); outw(BASE + EP_W0_RESOURCE_CFG, SET_IRQ(irq)); + ifp->if_softc = sc; ifp->if_unit = is->id_unit; ifp->if_name = "ep"; ifp->if_mtu = ETHERMTU; @@ -459,6 +460,7 @@ epattach(is) ifp->if_watchdog = epwatchdog; if_attach(ifp); + ether_ifattach(ifp); /* device attach does transition from UNCONFIGURED to IDLE state */ kdc_ep[is->id_unit].kdc_state=DC_IDLE; @@ -506,7 +508,7 @@ epattach(is) sc->top = sc->mcur = 0; #if NBPFILTER > 0 - bpfattach(&sc->bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif return 1; } @@ -680,7 +682,7 @@ static void epstart(ifp) struct ifnet *ifp; { - register struct ep_softc *sc = &ep_softc[ifp->if_unit]; + register struct ep_softc *sc = ifp->if_softc; register u_int len; register struct mbuf *m; struct mbuf *top; @@ -759,8 +761,8 @@ startagain: outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */ #if NBPFILTER > 0 - if (sc->bpf) { - bpf_mtap(sc->bpf, top); + if (sc->arpcom.ac_if.if_bpf) { + bpf_mtap(&sc->arpcom.ac_if, top); } #endif @@ -1083,8 +1085,8 @@ all_pkt: top->m_pkthdr.len = sc->cur_len; #if NBPFILTER > 0 - if (sc->bpf) { - bpf_mtap(sc->bpf, top); + if (sc->arpcom.ac_if.if_bpf) { + bpf_mtap(&sc->arpcom.ac_if, top); /* * Note that the interface cannot be in promiscuous mode if there are @@ -1153,7 +1155,7 @@ epioctl(ifp, cmd, data) caddr_t data; { register struct ifaddr *ifa = (struct ifaddr *) data; - struct ep_softc *sc = &ep_softc[ifp->if_unit]; + struct ep_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; diff --git a/sys/i386/isa/if_epreg.h b/sys/i386/isa/if_epreg.h index a9b3593..2dc6b59 100644 --- a/sys/i386/isa/if_epreg.h +++ b/sys/i386/isa/if_epreg.h @@ -31,7 +31,7 @@ */ /* - * $Id: if_epreg.h,v 1.9 1996/01/29 03:16:14 gibbs Exp $ + * $Id: if_epreg.h,v 1.10 1996/01/30 22:55:43 mpp Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -61,7 +61,6 @@ struct ep_softc { short rx_latency; short rx_avg_pkt; short cur_len; - caddr_t bpf; /* BPF "magic cookie" */ u_short ep_connectors; /* Connectors on this card. */ int stat; /* some flags */ #define F_RX_FIRST 0x1 diff --git a/sys/i386/isa/if_fe.c b/sys/i386/isa/if_fe.c index 5e141c5..e07970a 100644 --- a/sys/i386/isa/if_fe.c +++ b/sys/i386/isa/if_fe.c @@ -214,9 +214,6 @@ static struct fe_softc { void ( * init )( struct fe_softc * ); /* Just before fe_init(). */ void ( * stop )( struct fe_softc * ); /* Just after fe_stop(). */ - /* For BPF. */ - caddr_t bpf; /* BPF "magic cookie" */ - /* Transmission buffer management. */ u_short txb_free; /* free bytes in TX buffer */ u_char txb_count; /* number of packets in TX buffer */ @@ -236,15 +233,7 @@ static struct fe_softc { #define sc_dcstate kdc.kdc_state #define sc_description kdc.kdc_description -/* - * Some entry functions receive a "struct ifnet *" typed pointer as an - * argument. It points to arpcom.ac_if of our softc. Remember arpcom.ac_if - * is located at very first of the fe_softc struct. So, there is no - * difference between "struct fe_softc *" and "struct ifnet *" at the machine - * language level. We just cast to turn a "struct ifnet *" value into "struct - * fe_softc * value". If this were C++, we would need no such cast at all. - */ -#define IFNET2SOFTC(P) ( ( struct fe_softc * )(P) ) +#define IFNET2SOFTC(P) (P)->if_softc /* Standard driver entry points. These can be static. */ static int fe_probe ( struct isa_device * ); @@ -271,7 +260,6 @@ static struct fe_filter static int fe_hash ( u_char * ); static void fe_setmode ( struct fe_softc * ); static void fe_loadmar ( struct fe_softc * ); -static void fe_setlinkaddr ( struct fe_softc * ); #if FE_DEBUG >= 1 static void fe_dump ( int, struct fe_softc *, char * ); #endif @@ -1061,6 +1049,7 @@ fe_attach ( struct isa_device *isa_dev ) /* * Initialize ifnet structure */ + sc->sc_if.if_softc = sc; sc->sc_if.if_unit = sc->sc_unit; sc->sc_if.if_name = "fe"; sc->sc_if.if_output = ether_output; @@ -1122,7 +1111,7 @@ fe_attach ( struct isa_device *isa_dev ) /* Attach and stop the interface. */ if_attach( &sc->sc_if ); fe_stop( sc->sc_unit ); /* This changes the state to IDLE. */ - fe_setlinkaddr( sc ); + ether_ifattach(&sc->sc_if); /* Print additional info when attached. */ printf( "fe%d: address %6D, type %s\n", sc->sc_unit, @@ -1162,8 +1151,7 @@ fe_attach ( struct isa_device *isa_dev ) #if NBPFILTER > 0 /* If BPF is in the kernel, call the attach for it. */ - bpfattach(&sc->bpf, &sc->sc_if, DLT_EN10MB, - sizeof(struct ether_header)); + bpfattach(&sc->sc_if, DLT_EN10MB, sizeof(struct ether_header)); #endif return 1; } @@ -2100,6 +2088,7 @@ fe_ioctl ( struct ifnet *ifp, int command, caddr_t data ) } #endif +#ifdef notdef #ifdef SIOCSIFPHYSADDR case SIOCSIFPHYSADDR: { @@ -2115,6 +2104,7 @@ fe_ioctl ( struct ifnet *ifp, int command, caddr_t data ) break; } #endif +#endif /* notdef */ #ifdef SIOCSIFFLAGS case SIOCSIFFLAGS: @@ -2278,8 +2268,8 @@ fe_get_packet ( struct fe_softc * sc, u_short len ) * Check if there's a BPF listener on this interface. * If it is, hand off the raw packet to bpf. */ - if ( sc->bpf ) { - bpf_mtap( sc->bpf, m ); + if ( sc->sc_if.if_bpf ) { + bpf_mtap( &sc->sc_if, m ); } #endif @@ -2680,47 +2670,6 @@ fe_loadmar ( struct fe_softc * sc ) #endif } -/* - * Copy the physical (Ethernet) address into the "data link" address - * entry of the address list for an interface. - * This is (said to be) useful for netstat(1) to keep track of which - * interface is which. - * - * What I'm not sure on this function is, why this is a driver's function. - * Probably this should be moved to somewhere independent to a specific - * hardware, such as if_ehtersubr.c. FIXME. - */ -static void -fe_setlinkaddr ( struct fe_softc * sc ) -{ - struct ifaddr *ifa; - struct sockaddr_dl * sdl; - - /* - * Search down the ifa address list looking for the AF_LINK type entry. - */ - for ( ifa = sc->sc_if.if_addrlist; ifa != NULL; ifa = ifa->ifa_next ) { - if ( ifa->ifa_addr != NULL - && ifa->ifa_addr->sa_family == AF_LINK ) { - - /* - * We have found an AF_LINK type entry. - * Fill in the link-level address for this interface - */ - sdl = (struct sockaddr_dl *) ifa->ifa_addr; - sdl->sdl_type = IFT_ETHER; - sdl->sdl_alen = ETHER_ADDR_LEN; - sdl->sdl_slen = 0; - bcopy(sc->sc_enaddr, LLADDR(sdl), ETHER_ADDR_LEN); -#if FE_DEBUG >= 3 - log( LOG_INFO, "fe%d: link address set\n", - sc->sc_unit ); -#endif - return; - } - } -} - #if FE_DEBUG >= 1 static void fe_dump ( int level, struct fe_softc * sc, char * message ) diff --git a/sys/i386/isa/if_ie.c b/sys/i386/isa/if_ie.c index 4094ef2..903b1e2 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.31 1995/12/10 13:38:45 phk Exp $ + * $Id: if_ie.c,v 1.32 1996/01/26 09:27:26 phk Exp $ */ /* @@ -303,11 +303,6 @@ static struct ie_softc { struct ie_en_addr mcast_addrs[MAXMCAST + 1]; int mcast_count; - -#if NBPFILTER > 0 - caddr_t ie_bpf; -#endif - } ie_softc[NIE]; #define MK_24(base, ptr) ((caddr_t)((u_long)ptr - (u_long)base)) @@ -579,12 +574,13 @@ ieattach(dvp) struct ie_softc *ie = &ie_softc[unit]; struct ifnet *ifp = &ie->arpcom.ac_if; + ifp->if_softc = ie; ifp->if_unit = unit; ifp->if_name = iedriver.name; ifp->if_mtu = ETHERMTU; printf(" <%s R%d> ethernet address %6D\n", - ie_hardware_names[ie_softc[unit].hard_type], - ie_softc[unit].hard_vers + 1, + ie_hardware_names[ie->hard_type], + ie->hard_vers + 1, ie->arpcom.ac_enaddr, ":"); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -596,29 +592,13 @@ ieattach(dvp) ifp->if_hdrlen = 14; #if NBPFILTER > 0 - bpfattach(&ie_softc[unit].ie_bpf, ifp, DLT_EN10MB, - sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif if_attach(ifp); + ether_ifattach(ifp); kdc_ie[unit].kdc_description = ie_hardware_names[ie_softc[unit].hard_type]; - - { - struct ifaddr *ifa = ifp->if_addrlist; - struct sockaddr_dl *sdl; - while(ifa && ifa->ifa_addr && ifa->ifa_addr->sa_family != AF_LINK) - ifa = ifa->ifa_next; - - if(!ifa || !ifa->ifa_addr) return 1; - - /* Provide our ether address to the higher layers */ - sdl = (struct sockaddr_dl *)ifa->ifa_addr; - sdl->sdl_type = IFT_ETHER; - sdl->sdl_alen = 6; - sdl->sdl_slen = 0; - bcopy(ie->arpcom.ac_enaddr, LLADDR(sdl), 6); - return 1; - } + return 1; } /* @@ -857,7 +837,7 @@ static inline int check_eh(struct ie_softc *ie, * Receiving all multicasts, but no unicasts except those destined for us. */ #if NBPFILTER > 0 - *to_bpf = (ie->ie_bpf != 0); /* BPF gets this packet if anybody cares */ + *to_bpf = (ie->arpcom.ac_if.if_bpf != 0); /* BPF gets this packet if anybody cares */ #endif if(eh->ether_dhost[0] & 1) { return 1; @@ -870,7 +850,7 @@ static inline int check_eh(struct ie_softc *ie, * Receiving all packets. These need to be passed on to BPF. */ #if NBPFILTER > 0 - *to_bpf = (ie->ie_bpf != 0); + *to_bpf = (ie->arpcom.ac_if.if_bpf != 0); #endif /* If for us, accept and hand up to BPF */ if(ether_equal(eh->ether_dhost, ie->arpcom.ac_enaddr)) return 1; @@ -904,7 +884,7 @@ static inline int check_eh(struct ie_softc *ie, * Whew! (Hope this is a fast machine...) */ #if NBPFILTER > 0 - *to_bpf = (ie->ie_bpf != 0); + *to_bpf = (ie->arpcom.ac_if.if_bpf != 0); #endif /* We want to see multicasts. */ if(eh->ether_dhost[0] & 1) return 1; @@ -928,7 +908,7 @@ static inline int check_eh(struct ie_softc *ie, * as quickly as possible. */ #if NBPFILTER > 0 - *to_bpf = (ie->ie_bpf != 0); + *to_bpf = (ie->arpcom.ac_if.if_bpf != 0); #endif return 1; } @@ -1221,7 +1201,7 @@ static void ie_readframe(unit, ie, num) m0.m_next = m; /* Pass it up */ - bpf_mtap(ie->ie_bpf, &m0); + bpf_mtap(&ie->arpcom.ac_if, &m0); } /* * A signal passed up from the filtering code indicating that the @@ -1283,7 +1263,7 @@ static void iestart(ifp) struct ifnet *ifp; { - struct ie_softc *ie = &ie_softc[ifp->if_unit]; + struct ie_softc *ie = ifp->if_softc; struct mbuf *m0, *m; unsigned char *buffer; u_short len; @@ -1317,8 +1297,8 @@ iestart(ifp) * See if bpf is listening on this interface, let it see the packet * before we commit it to the wire. */ - if(ie->ie_bpf) - bpf_tap(ie->ie_bpf, ie->xmit_cbuffs[ie->xmit_count], len); + if(ie->arpcom.ac_if.if_bpf) + bpf_tap(&ie->arpcom.ac_if, ie->xmit_cbuffs[ie->xmit_count], len); #endif ie->xmit_buffs[ie->xmit_count]->ie_xmit_flags = IE_XMIT_LAST | len; @@ -1883,7 +1863,7 @@ ieioctl(ifp, command, data) caddr_t data; { struct ifaddr *ifa = (struct ifaddr *)data; - struct ie_softc *ie = &ie_softc[ifp->if_unit]; + struct ie_softc *ie = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; diff --git a/sys/i386/isa/if_ix.c b/sys/i386/isa/if_ix.c index b883491..9f081cc 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.17 1995/12/15 00:54:17 bde Exp $ + * $Id: if_ix.c,v 1.18 1996/01/26 09:27:27 phk Exp $ */ #include "ix.h" @@ -588,6 +588,7 @@ ixattach(struct isa_device *dvp) { * allocation, this will have to get revisited. */ bzero(ifp, sizeof(ifp)); + ifp->if_softc = sc; ifp->if_name = ixdriver.name; ifp->if_unit = unit; ifp->if_mtu = ETHERMTU; @@ -607,24 +608,9 @@ ixattach(struct isa_device *dvp) { #endif /* IXCOUNTERS */ if_attach(ifp); + ether_ifattach(ifp); sc->kdc.kdc_state = DC_IDLE; - /* Search down the ifa address list looking for the AF_LINK type entry */ - ifa = ifp->if_addrlist; - while ((ifa != 0) && - (ifa->ifa_addr != 0) && - (ifa->ifa_addr->sa_family != AF_LINK)) { - ifa = ifa->ifa_next; - } - /* If we find an AF_LINK type entry, we well fill in the hardware addr */ - if ((ifa != 0) && (ifa->ifa_addr != 0)) { - /* Fill in the link level address for this interface */ - sdl = (struct sockaddr_dl *)ifa->ifa_addr; - sdl->sdl_type = IFT_ETHER; - sdl->sdl_alen = ETHER_ADDRESS_LENGTH; - sdl->sdl_slen = 0; - bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDRESS_LENGTH); - } printf("ix%d: address %6D\n", unit, sc->arpcom.ac_enaddr, ":"); return(0); } @@ -1326,7 +1312,7 @@ ixintr_fr_free(int unit, rfd_t *rfd) { void ixstart(struct ifnet *ifp) { int unit = ifp->if_unit; - ix_softc_t *sc = &ix_softc[unit]; + ix_softc_t *sc = ifp->if_softc; scb_t *scb = (scb_t *)BOARDTOKV(SCB_ADDR); cb_t *cb = sc->cb_head; tbd_t *tbd; @@ -1456,7 +1442,7 @@ ixstart_exit: int ixstop(struct ifnet *ifp) { int unit = ifp->if_unit; - ix_softc_t *sc = &ix_softc[unit]; + ix_softc_t *sc = ifp->if_softc; DEBUGBEGIN(DEBUGSTOP) DEBUGDO(printf("ixstop:");) diff --git a/sys/i386/isa/if_le.c b/sys/i386/isa/if_le.c index 73dff3b..0bb4eba 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.28 1996/01/25 23:00:42 joerg Exp $ + * $Id: if_le.c,v 1.29 1996/01/26 09:27:29 phk Exp $ */ /* @@ -233,9 +233,6 @@ struct le_softc { u_int le_mcmask; /* bit mask for CRC-32 for multicast hash */ le_mcbits_t *le_mctbl; /* pointer to multicast table */ const char *le_prodname; /* product name DE20x-xx */ -#if NBPFILTER > 0 - caddr_t le_bpf; /* BPF context */ -#endif u_char le_hwaddr[6]; /* local copy of hwaddr */ unsigned le_scast_drops; /* singlecast drops */ unsigned le_mcast_drops; /* multicast drops */ @@ -395,6 +392,7 @@ le_attach( struct ifnet *ifp = &sc->le_if; struct ifaddr *ifa = ifp->if_addrlist; + ifp->if_softc = sc; ifp->if_mtu = ETHERMTU; printf("%s%d: %s ethernet address %6D\n", ifp->if_name, ifp->if_unit, @@ -409,26 +407,13 @@ le_attach( ifp->if_hdrlen = 14; #if NBPFILTER > 0 - bpfattach(&sc->le_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif if_attach(ifp); + ether_ifattach(ifp); kdc_le[dvp->id_unit].kdc_state = DC_IDLE; - while (ifa && ifa->ifa_addr && ifa->ifa_addr->sa_family != AF_LINK) - ifa = ifa->ifa_next; - - if (ifa != NULL && ifa->ifa_addr != NULL) { - struct sockaddr_dl *sdl; - /* - * Provide our ether address to the higher layers - */ - sdl = (struct sockaddr_dl *) ifa->ifa_addr; - sdl->sdl_type = IFT_ETHER; - sdl->sdl_alen = 6; - sdl->sdl_slen = 0; - MEMCPY(LLADDR(sdl), sc->le_ac.ac_enaddr, 6); - } return 1; } @@ -465,8 +450,8 @@ le_input( MEMCPY(&eh, seg1, sizeof(eh)); #if NBPFILTER > 0 - if (sc->le_bpf != NULL && seg2 == NULL) { - bpf_tap(sc->le_bpf, seg1, total_len); + if (sc->le_if.if_bpf != NULL && seg2 == NULL) { + bpf_tap(&sc->le_if, seg1, total_len); /* * If this is single cast but not to us * drop it! @@ -522,8 +507,8 @@ le_input( if (seg2 != NULL) MEMCPY(mtod(m, caddr_t) + len1, seg2, total_len - len1); #if NBPFILTER > 0 - if (sc->le_bpf != NULL && seg2 != NULL) { - bpf_mtap(sc->le_bpf, m); + if (sc->le_if.if_bpf != NULL && seg2 != NULL) { + bpf_mtap(&sc->le_if, m); /* * If this is single cast but not to us * drop it! @@ -556,7 +541,7 @@ le_ioctl( int cmd, caddr_t data) { - le_softc_t *sc = &le_softc[ifp->if_unit]; + le_softc_t *sc = ifp->if_softc; int s, error = 0; if ((sc->le_flags & IFF_UP) == 0) @@ -1216,8 +1201,8 @@ lemac_start( LE_OUTB(sc, LEMAC_REG_TQ, tx_pg); /* tell chip to transmit this packet */ #if NBPFILTER > 0 - if (sc->le_bpf) - bpf_mtap(sc->le_bpf, m); + if (sc->le_if.if_bpf) + bpf_mtap(&sc->le_if, m); #endif m_freem(m); /* free the mbuf */ diff --git a/sys/i386/isa/if_lnc.c b/sys/i386/isa/if_lnc.c index 2f8198c..3e060a4 100644 --- a/sys/i386/isa/if_lnc.c +++ b/sys/i386/isa/if_lnc.c @@ -123,9 +123,6 @@ static struct lnc_softc { #ifdef DEBUG int lnc_debug; #endif -#if NBPFILTER > 0 - caddr_t bpf; /* XXX bpf magic cookie - move to arpcom */ -#endif LNCSTATS_STRUCT } lnc_softc[NLNC]; @@ -631,8 +628,8 @@ lnc_rint(int unit) eh = (struct ether_header *) head->m_data; #if NBPFILTER > 0 - if (sc->bpf) - bpf_mtap(sc->bpf, head); + if (sc->arpcom.ac_if.if_bpf) + bpf_mtap(&sc->arpcom.ac_if, head); /* Check this packet is really for us */ @@ -1162,6 +1159,7 @@ lnc_attach(struct isa_device * isa_dev) /* Fill in arpcom structure entries */ + sc->arpcom.ac_if.if_softc = sc; sc->arpcom.ac_if.if_name = lncdriver.name; sc->arpcom.ac_if.if_unit = isa_dev->id_unit; sc->arpcom.ac_if.if_mtu = ETHERMTU; @@ -1180,6 +1178,7 @@ lnc_attach(struct isa_device * isa_dev) */ if_attach(&sc->arpcom.ac_if); + ether_ifattach(&sc->arpcom.ac_if); sc->kdc.kdc_state = DC_IDLE; printf("lnc%d: %s, address %6D\n", @@ -1188,7 +1187,7 @@ lnc_attach(struct isa_device * isa_dev) sc->arpcom.ac_enaddr, ":"); #if NBPFILTER > 0 - bpfattach(&sc->bpf, &sc->arpcom.ac_if, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(&sc->arpcom.ac_if, DLT_EN10MB, sizeof(struct ether_header)); #endif return (1); @@ -1500,7 +1499,7 @@ static void lnc_start(struct ifnet *ifp) { - struct lnc_softc *sc = &lnc_softc[ifp->if_unit]; + struct lnc_softc *sc = ifp->if_softc; struct host_ring_entry *desc; int tmp; int end_of_packet; @@ -1636,8 +1635,8 @@ lnc_start(struct ifnet *ifp) ifp->if_timer = 2; #if NBPFILTER > 0 - if (sc->bpf) - bpf_mtap(sc->bpf, head); + if (sc->arpcom.ac_if.if_bpf) + bpf_mtap(&sc->arpcom.ac_if, head); #endif if (sc->nic.mem_mode != DMA_MBUF) @@ -1658,7 +1657,7 @@ static int lnc_ioctl(struct ifnet * ifp, int command, caddr_t data) { - struct lnc_softc *sc = &lnc_softc[ifp->if_unit]; + struct lnc_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; diff --git a/sys/i386/isa/if_ze.c b/sys/i386/isa/if_ze.c index 797cdaa..53330a0 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.27 1995/12/17 21:22:57 phk Exp $ + * $Id: if_ze.c,v 1.28 1996/01/26 09:27:33 phk Exp $ */ #include "ze.h" @@ -127,8 +127,6 @@ static struct ze_softc { u_long smem_size; /* total shared memory size */ caddr_t smem_ring; /* start of RX ring-buffer (in smem) */ - caddr_t bpf; /* BPF "magic cookie" */ - u_char memwidth; /* width of access to card mem 8 or 16 */ u_char xmit_busy; /* transmitter is busy */ u_char txb_cnt; /* Number of transmit buffers */ @@ -619,6 +617,7 @@ ze_attach(isa_dev) /* * Initialize ifnet structure */ + ifp->if_softc = sc; ifp->if_unit = isa_dev->id_unit; ifp->if_name = "ze" ; ifp->if_mtu = ETHERMTU; @@ -633,29 +632,7 @@ ze_attach(isa_dev) * Attach the interface */ if_attach(ifp); - - /* - * Search down the ifa address list looking for the AF_LINK type entry - */ - ifa = ifp->if_addrlist; - while ((ifa != 0) && (ifa->ifa_addr != 0) && - (ifa->ifa_addr->sa_family != AF_LINK)) - ifa = ifa->ifa_next; - /* - * If we find an AF_LINK type entry we fill in the hardware address. - * This is useful for netstat(1) to keep track of which interface - * is which. - */ - if ((ifa != 0) && (ifa->ifa_addr != 0)) { - /* - * Fill in the link-level address for this interface - */ - sdl = (struct sockaddr_dl *)ifa->ifa_addr; - sdl->sdl_type = IFT_ETHER; - sdl->sdl_alen = ETHER_ADDR_LEN; - sdl->sdl_slen = 0; - bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN); - } + ether_ifattach(ifp); /* * Print additional info when attached @@ -670,7 +647,7 @@ ze_attach(isa_dev) * If BPF is in the kernel, call the attach for it */ #if NBPFILTER > 0 - bpfattach(&sc->bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif #if NAPM > 0 @@ -929,7 +906,7 @@ static inline void ze_xmit(ifp) struct ifnet *ifp; { - struct ze_softc *sc = &ze_softc[ifp->if_unit]; + struct ze_softc *sc = ifp->if_softc; u_short len = sc->txb_next_len; /* @@ -984,7 +961,7 @@ static void ze_start(ifp) struct ifnet *ifp; { - struct ze_softc *sc = &ze_softc[ifp->if_unit]; + struct ze_softc *sc = ifp->if_softc; struct mbuf *m0, *m; caddr_t buffer; int len; @@ -1055,8 +1032,8 @@ outloop: * If there is BPF support in the configuration, tap off here. */ #if NBPFILTER > 0 - if (sc->bpf) { - bpf_mtap(sc->bpf, m0); + if (ifp->if_bpf) { + bpf_mtap(ifp, m0); } #endif @@ -1344,7 +1321,7 @@ ze_ioctl(ifp, command, data) caddr_t data; { register struct ifaddr *ifa = (struct ifaddr *)data; - struct ze_softc *sc = &ze_softc[ifp->if_unit]; + struct ze_softc *sc = ifp->if_softc; int s, error = 0; s = splnet(); @@ -1535,8 +1512,8 @@ ze_get_packet(sc, buf, len) * Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ - if (sc->bpf) { - bpf_mtap(sc->bpf, head); + if (sc->arpcom.ac_if.if_bpf) { + bpf_mtap(&sc->arpcom.ac_if, head); /* * Note that the interface cannot be in promiscuous mode if diff --git a/sys/i386/isa/if_zp.c b/sys/i386/isa/if_zp.c index 36e03f1..2e09ee6 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.14 1995/12/13 10:35:36 phk Exp $ + * $Id: if_zp.c,v 1.15 1996/01/26 09:27:34 phk Exp $ */ /*- * TODO: @@ -174,7 +174,6 @@ static struct zp_softc { struct mbuf *mb[MAX_MBS]; /* spare mbuf storage. */ int next_mb; /* Which mbuf to use next. */ int last_mb; /* Last mbuf. */ - caddr_t bpf; /* BPF "magic cookie" */ short ep_io_addr; /* i/o bus address */ char ep_connectors; /* Connectors on this card. */ int tx_start_thresh;/* Current TX_start_thresh. */ @@ -542,6 +541,7 @@ zpattach(isa_dev) printf(" address %6D\n", sc->arpcom.ac_enaddr, ":"); + ifp->if_softc = sc; ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; ifp->if_unit = isa_dev->id_unit; @@ -554,24 +554,10 @@ zpattach(isa_dev) ifp->if_flags |= IFF_LINK0; if_attach(ifp); + ether_ifattach(ifp); - /* Fill the hardware address into ifa_addr if we find an AF_LINK - * entry. We need to do this so bpf's can get the hardware addr of - * this card. netstat likes this too! */ - ifa = ifp->if_addrlist; - while ((ifa != 0) && (ifa->ifa_addr != 0) && - (ifa->ifa_addr->sa_family != AF_LINK)) - ifa = ifa->ifa_next; - - if ((ifa != 0) && (ifa->ifa_addr != 0)) { - sdl = (struct sockaddr_dl *) ifa->ifa_addr; - sdl->sdl_type = IFT_ETHER; - sdl->sdl_alen = ETHER_ADDR_LEN; - sdl->sdl_slen = 0; - bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN); - } #if NBPFILTER > 0 - bpfattach(&sc->bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif #if NAPM > 0 sc->s_hook.ah_fun = zp_suspend; @@ -687,7 +673,7 @@ static void zpstart(ifp) struct ifnet *ifp; { - register struct zp_softc *sc = &zp_softc[ifp->if_unit]; + register struct zp_softc *sc = ifp->if_softc; struct mbuf *m, *top; int s, len, pad; @@ -760,8 +746,8 @@ startagain: outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */ #if NBPFILTER > 0 - if (sc->bpf) { - bpf_mtap(sc->bpf, top); + if (sc->arpcom.ac_if.if_bpf) { + bpf_mtap(&sc->arpcom.ac_if, top); } #endif @@ -973,8 +959,8 @@ zpread(sc) while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); ++sc->arpcom.ac_if.if_ipackets; #if NBPFILTER > 0 - if (sc->bpf) { - bpf_mtap(sc->bpf, top); + if (sc->arpcom.ac_if.if_bpf) { + bpf_mtap(&sc->arpcom.ac_if, top); /* Note that the interface cannot be in promiscuous mode if * there are no BPF listeners. And if we are in promiscuous @@ -1012,7 +998,7 @@ zpioctl(ifp, cmd, data) caddr_t data; { register struct ifaddr *ifa = (struct ifaddr *) data; - struct zp_softc *sc = &zp_softc[ifp->if_unit]; + struct zp_softc *sc = ifp->if_softc; int error = 0; diff --git a/sys/i386/isa/lpt.c b/sys/i386/isa/lpt.c index a3b1287..7b37dfa 100644 --- a/sys/i386/isa/lpt.c +++ b/sys/i386/isa/lpt.c @@ -46,7 +46,7 @@ * SUCH DAMAGE. * * from: unknown origin, 386BSD 0.1 - * $Id: lpt.c,v 1.47 1995/12/08 23:20:32 phk Exp $ + * $Id: lpt.c,v 1.48 1995/12/10 13:38:56 phk Exp $ */ /* @@ -873,6 +873,7 @@ lpattach (struct lpt_softc *sc, int unit) { struct ifnet *ifp = &sc->sc_if; + ifp->if_softc = sc; ifp->if_name = "lp"; ifp->if_unit = unit; ifp->if_mtu = LPMTU; @@ -887,7 +888,7 @@ lpattach (struct lpt_softc *sc, int unit) printf("lp%d: TCP/IP capable interface\n", unit); #if NBPFILTER > 0 - bpfattach(&ifp->if_bpf, ifp, DLT_NULL, LPIPHDRLEN); + bpfattach(ifp, DLT_NULL, LPIPHDRLEN); #endif } /* @@ -1154,7 +1155,7 @@ lpintr (int unit) } #if NBPFILTER > 0 if (sc->sc_if.if_bpf) { - bpf_tap(sc->sc_if.if_bpf, sc->sc_ifbuf, len); + bpf_tap(&sc->sc_if, sc->sc_ifbuf, len); } #endif len -= LPIPHDRLEN; @@ -1356,7 +1357,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, m0.m_len = 2; m0.m_data = (char *)&hdr; - bpf_mtap(ifp->if_bpf, &m0); + bpf_mtap(ifp, &m0); } #endif } |