diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ar/if_ar.c | 29 | ||||
-rw-r--r-- | sys/dev/ar/if_ar_isa.c | 29 | ||||
-rw-r--r-- | sys/dev/de/if_de.c | 15 | ||||
-rw-r--r-- | sys/dev/ed/if_ed.c | 27 | ||||
-rw-r--r-- | sys/dev/ep/if_ep.c | 18 | ||||
-rw-r--r-- | sys/dev/ep/if_epreg.h | 3 | ||||
-rw-r--r-- | sys/dev/fe/if_fe.c | 67 | ||||
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 22 | ||||
-rw-r--r-- | sys/dev/ie/if_ie.c | 52 | ||||
-rw-r--r-- | sys/dev/lnc/if_lnc.c | 19 |
10 files changed, 97 insertions, 184 deletions
diff --git a/sys/dev/ar/if_ar.c b/sys/dev/ar/if_ar.c index 27ae67b..adf0ed1 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.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/dev/ar/if_ar_isa.c b/sys/dev/ar/if_ar_isa.c index 27ae67b..adf0ed1 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.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/dev/de/if_de.c b/sys/dev/de/if_de.c index bf63619..b9516e8 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.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_de.c,v 1.41 1996/01/23 21:47:00 se Exp $ + * $Id: if_de.c,v 1.42 1996/01/26 09:29:26 phk Exp $ * */ @@ -1083,7 +1083,7 @@ tulip_rx_intr( eh = *mtod(m, struct ether_header *); #if NBPFILTER > 0 if (sc->tulip_bpf != NULL) - bpf_tap(sc->tulip_bpf, mtod(m, caddr_t), total_len); + bpf_tap(ifp, mtod(m, caddr_t), total_len); #endif if ((sc->tulip_if.if_flags & IFF_PROMISC) && (eh.ether_dhost[0] & 1) == 0 @@ -1223,7 +1223,7 @@ static ifnet_ret_t tulip_start( struct ifnet * const ifp) { - tulip_softc_t * const sc = TULIP_UNIT_TO_SOFTC(ifp->if_unit); + tulip_softc_t * const sc = ifp->if_softc; struct ifqueue * const ifq = &ifp->if_snd; tulip_ringinfo_t * const ri = &sc->tulip_txinfo; struct mbuf *m, *m0, *next_m0; @@ -1374,7 +1374,7 @@ tulip_start( */ #if NBPFILTER > 0 if (sc->tulip_bpf != NULL) - bpf_mtap(sc->tulip_bpf, m); + bpf_mtap(ifp, m); #endif IF_ENQUEUE(&sc->tulip_txq, m); @@ -1869,7 +1869,7 @@ tulip_ioctl( ioctl_cmd_t cmd, caddr_t data) { - tulip_softc_t * const sc = TULIP_UNIT_TO_SOFTC(ifp->if_unit); + tulip_softc_t * const sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; @@ -1994,6 +1994,7 @@ tulip_attach( { struct ifnet * const ifp = &sc->tulip_if; + ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST; ifp->if_ioctl = tulip_ioctl; ifp->if_output = ether_output; @@ -2018,12 +2019,10 @@ tulip_attach( tulip_reset(sc); if_attach(ifp); -#if defined(__NetBSD__) ether_ifattach(ifp); -#endif #if NBPFILTER > 0 - bpfattach(&sc->tulip_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif } diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 35f8740..a68341f 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/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/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index c072171..66e305c 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.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/dev/ep/if_epreg.h b/sys/dev/ep/if_epreg.h index a9b3593..2dc6b59 100644 --- a/sys/dev/ep/if_epreg.h +++ b/sys/dev/ep/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/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 5e141c5..e07970a 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/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/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 1fdf77d..fe68fa8 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.9 1996/01/23 21:47:03 se Exp $ + * $Id: if_fxp.c,v 1.10 1996/01/26 09:29:28 phk Exp $ */ /* @@ -84,7 +84,6 @@ struct fxp_softc { struct arpcom arpcom; /* per-interface network data */ - caddr_t bpf; /* BPF token */ struct fxp_csr *csr; /* control/status registers */ struct fxp_cb_tx *cbl_base; /* base of TxCB list */ struct fxp_cb_tx *cbl_first; /* first active TxCB in list */ @@ -281,6 +280,7 @@ fxp_attach(config_id, unit) fxp_sc[unit] = sc; ifp = &sc->arpcom.ac_if; + ifp->if_softc = sc; ifp->if_unit = unit; ifp->if_name = "fxp"; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -297,8 +297,10 @@ fxp_attach(config_id, unit) * Attach the interface. */ if_attach(ifp); + ether_ifattach(ifp); + #if NBPFILTER > 0 - bpfattach(&sc->bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif splx(s); return; @@ -413,7 +415,7 @@ static void fxp_start(ifp) struct ifnet *ifp; { - struct fxp_softc *sc = (struct fxp_softc *)ifp; + struct fxp_softc *sc = ifp->if_softc; struct fxp_csr *csr = sc->csr; struct fxp_cb_tx *txp; struct mbuf *m, *mb_head; @@ -529,8 +531,8 @@ tbdinit: /* * Pass packet to bpf if there is a listener. */ - if (sc->bpf != NULL) - bpf_mtap(sc->bpf, mb_head); + if (ifp->if_bpf != NULL) + bpf_mtap(ifp, mb_head); #endif /* * Set a 5 second timer just in case we don't hear from the @@ -624,8 +626,8 @@ rcvloop: sizeof(struct ether_header); eh = mtod(m, struct ether_header *); #if NBPFILTER > 0 - if (sc->bpf != NULL) { - bpf_tap(sc->bpf, mtod(m, caddr_t), total_len); + if (ifp->if_bpf != NULL) { + bpf_tap(ifp, mtod(m, caddr_t), total_len); /* * Only pass this packet up if it is for us. */ @@ -790,7 +792,7 @@ static void fxp_init(ifp) struct ifnet *ifp; { - struct fxp_softc *sc = (struct fxp_softc *)ifp; + struct fxp_softc *sc = ifp->if_softc; struct fxp_cb_config *cbp; struct fxp_cb_ias *cb_ias; struct fxp_cb_tx *txp; @@ -1006,7 +1008,7 @@ fxp_ioctl(ifp, command, data) caddr_t data; { struct ifaddr *ifa = (struct ifaddr *) data; - struct fxp_softc *sc = (struct fxp_softc *)ifp; + struct fxp_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c index 4094ef2..903b1e2 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.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/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index 2f8198c..3e060a4 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/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; |