summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>2000-07-13 22:54:34 +0000
committerarchie <archie@FreeBSD.org>2000-07-13 22:54:34 +0000
commit7357df6b4854f9914c605ad7c7cf3c01ea7700fd (patch)
treef79218274bf72874f2d01c6213ea088c3a3e768d /sys/dev
parentef18034ac19957f4a94d28dd906d02cf32260a83 (diff)
downloadFreeBSD-src-7357df6b4854f9914c605ad7c7cf3c01ea7700fd.zip
FreeBSD-src-7357df6b4854f9914c605ad7c7cf3c01ea7700fd.tar.gz
Make all Ethernet drivers attach using ether_ifattach() and detach using
ether_ifdetach(). The former consolidates the operations of if_attach(), ng_ether_attach(), and bpfattach(). The latter consolidates the corresponding detach operations. Reviewed by: julian, freebsd-net
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/an/if_an.c6
-rw-r--r--sys/dev/an/if_an_isa.c2
-rw-r--r--sys/dev/an/if_an_pccard.c2
-rw-r--r--sys/dev/an/if_an_pci.c2
-rw-r--r--sys/dev/awi/awi.c7
-rw-r--r--sys/dev/awi/if_awi_pccard.c2
-rw-r--r--sys/dev/cs/if_cs.c4
-rw-r--r--sys/dev/dc/if_dc.c9
-rw-r--r--sys/dev/de/if_de.c5
-rw-r--r--sys/dev/ed/if_ed.c7
-rw-r--r--sys/dev/ed/if_ed_pccard.c2
-rw-r--r--sys/dev/ep/if_ep.c7
-rw-r--r--sys/dev/ep/if_ep_pccard.c3
-rw-r--r--sys/dev/ex/if_ex.c7
-rw-r--r--sys/dev/fe/if_fe.c7
-rw-r--r--sys/dev/fxp/if_fxp.c6
-rw-r--r--sys/dev/ie/if_ie.c5
-rw-r--r--sys/dev/lnc/if_lnc.c9
-rw-r--r--sys/dev/lnc/if_lnc_isa.c4
-rw-r--r--sys/dev/sf/if_sf.c9
-rw-r--r--sys/dev/sk/if_sk.c8
-rw-r--r--sys/dev/sn/if_sn.c5
-rw-r--r--sys/dev/sn/if_sn_pccard.c2
-rw-r--r--sys/dev/ti/if_ti.c9
-rw-r--r--sys/dev/tx/if_tx.c8
-rw-r--r--sys/dev/usb/if_aue.c9
-rw-r--r--sys/dev/usb/if_cue.c9
-rw-r--r--sys/dev/usb/if_kue.c12
-rw-r--r--sys/dev/vr/if_vr.c9
-rw-r--r--sys/dev/vx/if_vx.c5
-rw-r--r--sys/dev/wi/if_wi.c9
-rw-r--r--sys/dev/wl/if_wl.c5
-rw-r--r--sys/dev/xe/if_xe.c11
33 files changed, 61 insertions, 145 deletions
diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c
index 8abf07b..2cce3bd 100644
--- a/sys/dev/an/if_an.c
+++ b/sys/dev/an/if_an.c
@@ -369,12 +369,10 @@ int an_attach(sc, unit, flags)
bzero((char *)&sc->an_stats, sizeof(sc->an_stats));
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
callout_handle_init(&sc->an_stat_ch);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
return(0);
}
diff --git a/sys/dev/an/if_an_isa.c b/sys/dev/an/if_an_isa.c
index e798437..2d78fcb 100644
--- a/sys/dev/an/if_an_isa.c
+++ b/sys/dev/an/if_an_isa.c
@@ -131,7 +131,7 @@ an_detach_isa(device_t dev)
struct ifnet *ifp = &sc->arpcom.ac_if;
an_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_teardown_intr(dev, sc->irq_res, sc->irq_handle);
an_release_resources(dev);
diff --git a/sys/dev/an/if_an_pccard.c b/sys/dev/an/if_an_pccard.c
index 6809d6e..66e5590 100644
--- a/sys/dev/an/if_an_pccard.c
+++ b/sys/dev/an/if_an_pccard.c
@@ -105,7 +105,7 @@ an_pccard_detach(device_t dev)
}
an_stop(sc);
ifp->if_flags &= ~IFF_RUNNING;
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
sc->an_gone = 1;
bus_teardown_intr(dev, sc->irq_res, sc->irq_handle);
an_release_resources(dev);
diff --git a/sys/dev/an/if_an_pci.c b/sys/dev/an/if_an_pci.c
index 987def3..468a5bc 100644
--- a/sys/dev/an/if_an_pci.c
+++ b/sys/dev/an/if_an_pci.c
@@ -198,7 +198,7 @@ an_detach_pci(device_t dev)
struct ifnet *ifp = &sc->arpcom.ac_if;
an_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_teardown_intr(dev, sc->irq_res, sc->irq_handle);
an_release_resources(dev);
diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c
index 10cf224..65783c6 100644
--- a/sys/dev/awi/awi.c
+++ b/sys/dev/awi/awi.c
@@ -308,13 +308,10 @@ awi_attach(sc)
sc->sc_dev.dv_xname,
sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH ? "FH" : "DS",
sc->sc_tx_rate / 10, ether_sprintf(sc->sc_mib_addr.aMAC_Address));
- if_attach(ifp);
#ifdef __FreeBSD__
- ether_ifattach(ifp);
-#if NBPFILTER > 0
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
#else
+ if_attach(ifp);
ether_ifattach(ifp, sc->sc_mib_addr.aMAC_Address);
#if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
diff --git a/sys/dev/awi/if_awi_pccard.c b/sys/dev/awi/if_awi_pccard.c
index c9b8150..95bf1c5 100644
--- a/sys/dev/awi/if_awi_pccard.c
+++ b/sys/dev/awi/if_awi_pccard.c
@@ -198,7 +198,7 @@ awi_pccard_detach(device_t dev)
struct awi_softc *sc = &psc->sc_awi;
struct ifnet *ifp = &sc->sc_ec.ac_if;
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
ifp->if_flags &= ~IFF_RUNNING;
if (psc->sc_intrhand) {
bus_teardown_intr(dev, psc->sc_irq_res, psc->sc_intrhand);
diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c
index 2801b26..b581655 100644
--- a/sys/dev/cs/if_cs.c
+++ b/sys/dev/cs/if_cs.c
@@ -796,15 +796,13 @@ cs_attach(struct cs_softc *sc, int unit, int flags)
ifmedia_set(&sc->media, media);
cs_mediaset(sc, media);
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
}
if (bootverbose)
printf(CS_NAME"%d: ethernet address %6D\n",
ifp->if_unit, sc->arpcom.ac_enaddr, ":");
- bpfattach(ifp, DLT_EN10MB, sizeof (struct ether_header));
return (0);
}
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index dcb6ee9..c26e6e0 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -1727,14 +1727,11 @@ static int dc_attach(dev)
}
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
callout_handle_init(&sc->dc_stat_ch);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-
#ifdef __alpha__
sc->dc_srm_media = 0;
@@ -1781,7 +1778,7 @@ static int dc_detach(dev)
ifp = &sc->arpcom.ac_if;
dc_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_generic_detach(dev);
device_delete_child(dev, sc->dc_miibus);
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c
index 3b2a4fb..7037f6d 100644
--- a/sys/dev/de/if_de.c
+++ b/sys/dev/de/if_de.c
@@ -4874,11 +4874,8 @@ tulip_attach(
tulip_reset(sc);
- if_attach(ifp);
+ ether_ifattach(&(sc)->tulip_if, ETHER_BPF_SUPPORTED);
ifp->if_snd.ifq_maxlen = ifqmaxlen;
- ether_ifattach(&(sc)->tulip_if);
-
- bpfattach(&sc->tulip_if, DLT_EN10MB, sizeof(struct ether_header));
}
#if defined(TULIP_BUS_DMA)
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index d7744a6..a795858 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -1642,8 +1642,7 @@ ed_attach(sc, unit, flags)
/*
* Attach the interface
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
}
/* device attach does transition from UNCONFIGURED to IDLE state */
@@ -1669,10 +1668,6 @@ ed_attach(sc, unit, flags)
(sc->vendor == ED_VENDOR_HP)) &&
(ifp->if_flags & IFF_ALTPHYS)) ? " tranceiver disabled" : "");
- /*
- * If BPF is in the kernel, call the attach for it
- */
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
return (0);
}
diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c
index 63b0e7b..9d5fb7f 100644
--- a/sys/dev/ed/if_ed_pccard.c
+++ b/sys/dev/ed/if_ed_pccard.c
@@ -91,7 +91,7 @@ ed_pccard_detach(device_t dev)
}
ed_stop(sc);
ifp->if_flags &= ~IFF_RUNNING;
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
sc->gone = 1;
bus_teardown_intr(dev, sc->irq_res, sc->irq_handle);
ed_release_resources(dev);
diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c
index a1762b6..df3c169 100644
--- a/sys/dev/ep/if_ep.c
+++ b/sys/dev/ep/if_ep.c
@@ -316,11 +316,8 @@ ep_attach(sc)
ep_ifmedia_upd(ifp);
}
- if (!attached) {
- if_attach(ifp);
- ether_ifattach(ifp);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
- }
+ if (!attached)
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
#ifdef EP_LOCAL_STATS
sc->rx_no_first = sc->rx_no_mbuf = sc->rx_bpf_disc =
diff --git a/sys/dev/ep/if_ep_pccard.c b/sys/dev/ep/if_ep_pccard.c
index 23c089e..12d5241 100644
--- a/sys/dev/ep/if_ep_pccard.c
+++ b/sys/dev/ep/if_ep_pccard.c
@@ -48,6 +48,7 @@
#include <machine/resource.h>
#include <sys/rman.h>
+#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_media.h>
@@ -227,7 +228,7 @@ ep_pccard_detach(device_t dev)
return (0);
}
sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
- if_detach(&sc->arpcom.ac_if);
+ ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
sc->gone = 1;
bus_teardown_intr(dev, sc->irq, sc->ep_intrhand);
ep_free(dev);
diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c
index 10bcf32..ba91071 100644
--- a/sys/dev/ex/if_ex.c
+++ b/sys/dev/ex/if_ex.c
@@ -264,15 +264,10 @@ ex_attach(device_t dev)
/*
* Attach the interface.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
device_printf(sc->dev, "Ethernet address %6D\n",
sc->arpcom.ac_enaddr, ":");
- /*
- * If BPF is in the kernel, call the attach for it
- */
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
return(0);
}
diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c
index 5a73a67..79883cc 100644
--- a/sys/dev/fe/if_fe.c
+++ b/sys/dev/fe/if_fe.c
@@ -2849,14 +2849,13 @@ fe_attach ( struct isa_device * dev )
/* Attach and stop the interface. */
#if NCARD > 0
if (already_ifattach[dev->id_unit] != 1) {
- if_attach(&sc->sc_if);
+ ether_ifattach(&sc->sc_if, ETHER_BPF_SUPPORTED);
already_ifattach[dev->id_unit] = 1;
}
#else
- if_attach(&sc->sc_if);
+ ether_ifattach(&sc->sc_if, ETHER_BPF_SUPPORTED);
#endif
fe_stop(sc);
- ether_ifattach(&sc->sc_if);
/* Print additional info when attached. */
printf("fe%d: address %6D, type %s%s\n", sc->sc_unit,
@@ -2905,8 +2904,6 @@ fe_attach ( struct isa_device * dev )
sc->sc_unit);
}
- /* If BPF is in the kernel, call the attach for it. */
- bpfattach(&sc->sc_if, DLT_EN10MB, sizeof(struct ether_header));
return 1;
}
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index a9060e3..408ec5d 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -598,14 +598,12 @@ fxp_attach(device_t dev)
/*
* Attach the interface.
*/
- if_attach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
/*
* Let the system queue as many packets as we have available
* TX descriptors.
*/
ifp->if_snd.ifq_maxlen = FXP_NTXCB - 1;
- ether_ifattach(ifp);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
splx(s);
return 0;
@@ -629,7 +627,7 @@ fxp_detach(device_t dev)
/*
* Close down routes etc.
*/
- if_detach(&sc->arpcom.ac_if);
+ ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
/*
* Stop DMA and drop transmit queue.
diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c
index c9ce52d..636c634 100644
--- a/sys/dev/ie/if_ie.c
+++ b/sys/dev/ie/if_ie.c
@@ -792,10 +792,7 @@ ieattach(struct isa_device *dvp)
EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
ie, SHUTDOWN_PRI_DEFAULT);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
return (1);
}
diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c
index d1c6e68..f56a56d 100644
--- a/sys/dev/lnc/if_lnc.c
+++ b/sys/dev/lnc/if_lnc.c
@@ -895,12 +895,7 @@ lnc_attach_sc(lnc_softc_t *sc, int unit)
sc->arpcom.ac_if.if_hdrlen = ETHER_HDR_LEN;
sc->arpcom.ac_if.if_snd.ifq_maxlen = IFQ_MAXLEN;
- /*
- * XXX -- should check return status of if_attach
- */
-
- if_attach(&sc->arpcom.ac_if);
- ether_ifattach(&sc->arpcom.ac_if);
+ ether_ifattach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
printf("lnc%d: ", unit);
if (sc->nic.ic == LANCE || sc->nic.ic == C_LANCE)
@@ -910,8 +905,6 @@ lnc_attach_sc(lnc_softc_t *sc, int unit)
printf("%s", ic_ident[sc->nic.ic]);
printf(" address %6D\n", sc->arpcom.ac_enaddr, ":");
- bpfattach(&sc->arpcom.ac_if, DLT_EN10MB, sizeof(struct ether_header));
-
return (1);
}
diff --git a/sys/dev/lnc/if_lnc_isa.c b/sys/dev/lnc/if_lnc_isa.c
index fe98027..ce501b5 100644
--- a/sys/dev/lnc/if_lnc_isa.c
+++ b/sys/dev/lnc/if_lnc_isa.c
@@ -315,8 +315,8 @@ lnc_attach(struct isa_device * isa_dev)
#ifndef PC98
/*
- * XXX - is it safe to call isa_dmacascade() after if_attach()
- * and ether_ifattach() have been called in lnc_attach() ???
+ * XXX - is it safe to call isa_dmacascade() after
+ * ether_ifattach() has been called in lnc_attach() ???
*/
if ((sc->nic.mem_mode != SHMEM) &&
(sc->nic.ic < PCnet_32))
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
index 2ce3869..3ffa606 100644
--- a/sys/dev/sf/if_sf.c
+++ b/sys/dev/sf/if_sf.c
@@ -829,12 +829,9 @@ static int sf_attach(dev)
ifp->if_snd.ifq_maxlen = SF_TX_DLIST_CNT - 1;
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
-
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
fail:
splx(s);
@@ -853,7 +850,7 @@ static int sf_detach(dev)
sc = device_get_softc(dev);
ifp = &sc->arpcom.ac_if;
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
sf_stop(sc);
bus_generic_detach(dev);
diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c
index 3504af4..d51ee34 100644
--- a/sys/dev/sk/if_sk.c
+++ b/sys/dev/sk/if_sk.c
@@ -1221,12 +1221,10 @@ static int sk_attach_xmac(dev)
}
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
callout_handle_init(&sc_if->sk_tick_ch);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
return(0);
}
@@ -1431,7 +1429,7 @@ static int sk_detach_xmac(dev)
sc_if = device_get_softc(dev);
ifp = &sc_if->arpcom.ac_if;
sk_stop(sc_if);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_generic_detach(dev);
if (sc_if->sk_miibus != NULL)
device_delete_child(dev, sc_if->sk_miibus);
diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c
index 860d3ef..2794442 100644
--- a/sys/dev/sn/if_sn.c
+++ b/sys/dev/sn/if_sn.c
@@ -222,8 +222,7 @@ sn_attach(device_t dev)
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
ifp->if_timer = 0;
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
/*
* Fill the hardware address into ifa_addr if we find an AF_LINK
@@ -243,8 +242,6 @@ sn_attach(device_t dev)
bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN);
}
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-
return 0;
}
diff --git a/sys/dev/sn/if_sn_pccard.c b/sys/dev/sn/if_sn_pccard.c
index 018646e..4220dea 100644
--- a/sys/dev/sn/if_sn_pccard.c
+++ b/sys/dev/sn/if_sn_pccard.c
@@ -90,7 +90,7 @@ sn_pccard_detach(device_t dev)
struct sn_softc *sc = device_get_softc(dev);
sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
- if_detach(&sc->arpcom.ac_if);
+ ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
sn_deactivate(dev);
return 0;
}
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index 92525bc..358a3f0 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -1722,12 +1722,9 @@ static int ti_attach(dev)
ifmedia_set(&sc->ifmedia, IFM_ETHER|IFM_AUTO);
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
-
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
fail:
splx(s);
@@ -1747,7 +1744,7 @@ static int ti_detach(dev)
sc = device_get_softc(dev);
ifp = &sc->arpcom.ac_if;
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
ti_stop(sc);
bus_teardown_intr(dev, sc->ti_irq, sc->ti_intrhand);
diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c
index dc25317..7cbe32d 100644
--- a/sys/dev/tx/if_tx.c
+++ b/sys/dev/tx/if_tx.c
@@ -550,12 +550,9 @@ epic_freebsd_attach(dev)
printf ("\n");
/* Attach to OS's managers */
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
callout_handle_init(&sc->stat_ch);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-
fail:
splx(s);
@@ -578,8 +575,7 @@ epic_freebsd_detach(dev)
sc = device_get_softc(dev);
ifp = &sc->arpcom.ac_if;
- bpfdetach(ifp);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
epic_stop(sc);
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index acafe1d..d202491 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -736,12 +736,10 @@ USB_ATTACH(aue)
aue_qdat.if_rxstart = aue_rxstart;
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
callout_handle_init(&sc->aue_stat_ch);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
usb_register_netisr();
sc->aue_gone = 0;
@@ -763,8 +761,7 @@ Static int aue_detach(dev)
sc->aue_gone = 1;
untimeout(aue_tick, sc, sc->aue_stat_ch);
- bpfdetach(ifp);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
if (sc->aue_ep[AUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_TX]);
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index 6681517..3de4364 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -555,12 +555,10 @@ USB_ATTACH(cue)
cue_qdat.if_rxstart = cue_rxstart;
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
callout_handle_init(&sc->cue_stat_ch);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
usb_register_netisr();
sc->cue_gone = 0;
@@ -582,8 +580,7 @@ Static int cue_detach(dev)
sc->cue_gone = 1;
untimeout(cue_tick, sc, sc->cue_stat_ch);
- bpfdetach(ifp);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
if (sc->cue_ep[CUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_TX]);
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index cb6a03c..780c42b 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -500,11 +500,9 @@ USB_ATTACH(kue)
kue_qdat.if_rxstart = kue_rxstart;
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
usb_register_netisr();
sc->kue_gone = 0;
@@ -526,10 +524,8 @@ Static int kue_detach(dev)
sc->kue_gone = 1;
- if (ifp != NULL) {
- bpfdetach(ifp);
- if_detach(ifp);
- }
+ if (ifp != NULL)
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
if (sc->kue_ep[KUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->kue_ep[KUE_ENDPT_TX]);
diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c
index 469ef0e..3649d7e 100644
--- a/sys/dev/vr/if_vr.c
+++ b/sys/dev/vr/if_vr.c
@@ -800,12 +800,9 @@ static int vr_attach(dev)
callout_handle_init(&sc->vr_stat_ch);
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
-
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
fail:
splx(s);
@@ -825,7 +822,7 @@ static int vr_detach(dev)
ifp = &sc->arpcom.ac_if;
vr_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_generic_detach(dev);
device_delete_child(dev, sc->vr_miibus);
diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c
index 303cd94..da8dcb0 100644
--- a/sys/dev/vx/if_vx.c
+++ b/sys/dev/vx/if_vx.c
@@ -210,10 +210,7 @@ vxattach(sc)
ifp->if_watchdog = vxwatchdog;
ifp->if_softc = sc;
- if_attach(ifp);
- ether_ifattach(ifp);
-
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
sc->tx_start_thresh = 20; /* probably a good starting point. */
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index deb797c..df6fb2a 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -216,8 +216,7 @@ static int wi_pccard_detach(dev)
wi_stop(sc);
- bpfdetach(ifp);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_teardown_intr(dev, sc->irq, sc->wi_intrhand);
wi_free(dev);
sc->wi_gone = 1;
@@ -327,12 +326,10 @@ static int wi_pccard_attach(device_t dev)
wi_stop(sc);
/*
- * Call MI attach routines.
+ * Call MI attach routine.
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
callout_handle_init(&sc->wi_stat_ch);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
return(0);
}
diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c
index 97a36d7..fe4558b 100644
--- a/sys/dev/wl/if_wl.c
+++ b/sys/dev/wl/if_wl.c
@@ -515,10 +515,7 @@ wlattach(struct isa_device *id)
ifp->if_done
ifp->if_reset
*/
- if_attach(ifp);
- ether_ifattach(ifp);
-
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
bcopy(&sc->wl_addr[0], sc->wl_ac.ac_enaddr, WAVELAN_ADDR_SIZE);
printf("%s%d: address %6D, NWID 0x%02x%02x", ifp->if_name, ifp->if_unit,
diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c
index 6699026..b030195 100644
--- a/sys/dev/xe/if_xe.c
+++ b/sys/dev/xe/if_xe.c
@@ -479,7 +479,7 @@ xe_detach(device_t dev) {
struct xe_softc *sc = device_get_softc(dev);
sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
- if_detach(&sc->arpcom.ac_if);
+ ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
xe_deactivate(dev);
return 0;
}
@@ -578,14 +578,7 @@ xe_attach (device_t dev) {
device_printf(dev, "Ethernet address %6D\n", scp->arpcom.ac_enaddr, ":");
/* Attach the interface */
- if_attach(scp->ifp);
- ether_ifattach(scp->ifp);
-
- /* BPF is in the kernel, call the attach for it */
-#if XE_DEBUG > 1
- device_printf(dev, "BPF listener attached\n");
-#endif
- bpfattach(scp->ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(scp->ifp, ETHER_BPF_SUPPORTED);
/* Done */
return 0;
OpenPOWER on IntegriCloud