summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/tc/am7990.c5
-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
-rw-r--r--sys/i386/isa/if_el.c7
-rw-r--r--sys/i386/isa/if_fe.c7
-rw-r--r--sys/i386/isa/if_le.c5
-rw-r--r--sys/i386/isa/if_rdp.c7
-rw-r--r--sys/i386/isa/if_wi.c9
-rw-r--r--sys/i386/isa/if_wl.c5
-rw-r--r--sys/net/ethernet.h6
-rw-r--r--sys/net/if_ef.c4
-rw-r--r--sys/net/if_ethersubr.c26
-rw-r--r--sys/net/if_var.h3
-rw-r--r--sys/net/if_vlan.c4
-rw-r--r--sys/pc98/pc98/if_ed.c7
-rw-r--r--sys/pci/if_dc.c9
-rw-r--r--sys/pci/if_de.c5
-rw-r--r--sys/pci/if_fxp.c6
-rw-r--r--sys/pci/if_rl.c9
-rw-r--r--sys/pci/if_sf.c9
-rw-r--r--sys/pci/if_sis.c9
-rw-r--r--sys/pci/if_sk.c8
-rw-r--r--sys/pci/if_ste.c10
-rw-r--r--sys/pci/if_ti.c9
-rw-r--r--sys/pci/if_tl.c9
-rw-r--r--sys/pci/if_tx.c8
-rw-r--r--sys/pci/if_vr.c9
-rw-r--r--sys/pci/if_wb.c9
-rw-r--r--sys/pci/if_wx.c6
-rw-r--r--sys/pci/if_xl.c9
61 files changed, 143 insertions, 282 deletions
diff --git a/sys/alpha/tc/am7990.c b/sys/alpha/tc/am7990.c
index 5c102dd..ef90782 100644
--- a/sys/alpha/tc/am7990.c
+++ b/sys/alpha/tc/am7990.c
@@ -221,10 +221,7 @@ am7990_config(sc)
printf("%s: address %s\n", device_get_nameunit(sc->sc_dev),
ether_sprintf(sc->sc_enaddr));
- if_attach(ifp);
- ether_ifattach(ifp);
-
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
switch (sc->sc_memsize) {
case 8192:
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;
diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c
index d19944a..c0a54a2 100644
--- a/sys/i386/isa/if_el.c
+++ b/sys/i386/isa/if_el.c
@@ -202,17 +202,12 @@ el_attach(struct isa_device *idev)
/* Now we can attach the interface */
dprintf(("Attaching interface...\n"));
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
/* Print out some information for the user */
printf("el%d: 3c501 address %6D\n",idev->id_unit,
sc->arpcom.ac_enaddr, ":");
- /* Finally, attach to bpf filter if it is present. */
- dprintf(("Attaching to BPF...\n"));
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-
dprintf(("el_attach() finished.\n"));
return(1);
}
diff --git a/sys/i386/isa/if_fe.c b/sys/i386/isa/if_fe.c
index 5a73a67..79883cc 100644
--- a/sys/i386/isa/if_fe.c
+++ b/sys/i386/isa/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/i386/isa/if_le.c b/sys/i386/isa/if_le.c
index 7932c74..4ed96bb 100644
--- a/sys/i386/isa/if_le.c
+++ b/sys/i386/isa/if_le.c
@@ -361,10 +361,7 @@ le_attach(
ifp->if_addrlen = 6;
ifp->if_hdrlen = 14;
- 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/i386/isa/if_rdp.c b/sys/i386/isa/if_rdp.c
index 31ad93a..f959a52 100644
--- a/sys/i386/isa/if_rdp.c
+++ b/sys/i386/isa/if_rdp.c
@@ -614,8 +614,7 @@ rdp_attach(struct isa_device *isa_dev)
/*
* Attach the interface
*/
- if_attach(ifp);
- ether_ifattach(ifp);
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
}
/*
@@ -629,10 +628,6 @@ rdp_attach(struct isa_device *isa_dev)
printf("%s%d: address %6D\n", ifp->if_name, ifp->if_unit,
sc->arpcom.ac_enaddr, ":");
- /*
- * If BPF is in the kernel, call the attach for it
- */
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
return 1;
}
diff --git a/sys/i386/isa/if_wi.c b/sys/i386/isa/if_wi.c
index deb797c..df6fb2a 100644
--- a/sys/i386/isa/if_wi.c
+++ b/sys/i386/isa/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/i386/isa/if_wl.c b/sys/i386/isa/if_wl.c
index 97a36d7..fe4558b 100644
--- a/sys/i386/isa/if_wl.c
+++ b/sys/i386/isa/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/net/ethernet.h b/sys/net/ethernet.h
index 619a2e9..6d1c82e 100644
--- a/sys/net/ethernet.h
+++ b/sys/net/ethernet.h
@@ -82,6 +82,12 @@ struct ether_addr {
#ifdef _KERNEL
+/*
+ * For device drivers to specify whether they support BPF or not
+ */
+#define ETHER_BPF_UNSUPPORTED 0
+#define ETHER_BPF_SUPPORTED 1
+
struct ifnet;
struct mbuf;
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
index 97d93c8..e2ede08 100644
--- a/sys/net/if_ef.c
+++ b/sys/net/if_ef.c
@@ -128,9 +128,7 @@ ef_attach(struct efnet *sc)
/*
* Attach the interface
*/
- if_attach(ifp);
- ether_ifattach(ifp);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
ifp->if_resolvemulti = 0;
ifp->if_type = IFT_XETHER;
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 7ae976e..d7c410b 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -646,12 +646,14 @@ ether_demux(ifp, eh, m)
* Perform common duties while attaching to interface list
*/
void
-ether_ifattach(ifp)
+ether_ifattach(ifp, bpf)
register struct ifnet *ifp;
+ int bpf;
{
register struct ifaddr *ifa;
register struct sockaddr_dl *sdl;
+ if_attach(ifp);
ifp->if_type = IFT_ETHER;
ifp->if_addrlen = 6;
ifp->if_hdrlen = 14;
@@ -660,18 +662,32 @@ ether_ifattach(ifp)
if (ifp->if_baudrate == 0)
ifp->if_baudrate = 10000000;
ifa = ifnet_addrs[ifp->if_index - 1];
- if (ifa == 0) {
- printf("ether_ifattach: no lladdr!\n");
- return;
- }
+ KASSERT(ifa != NULL, ("%s: no lladdr!\n", __FUNCTION__));
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
sdl->sdl_type = IFT_ETHER;
sdl->sdl_alen = ifp->if_addrlen;
bcopy((IFP2AC(ifp))->ac_enaddr, LLADDR(sdl), ifp->if_addrlen);
+ if (bpf)
+ bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
if (ng_ether_attach_p != NULL)
(*ng_ether_attach_p)(ifp);
}
+/*
+ * Perform common duties while detaching an Ethernet interface
+ */
+void
+ether_ifdetach(ifp, bpf)
+ struct ifnet *ifp;
+ int bpf;
+{
+ if (ng_ether_detach_p != NULL)
+ (*ng_ether_detach_p)(ifp);
+ if (bpf)
+ bpfdetach(ifp);
+ if_detach(ifp);
+}
+
SYSCTL_DECL(_net_link);
SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet");
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 79b1ff6..e6f0785 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -323,7 +323,8 @@ extern struct ifnet loif[];
extern int if_index;
extern struct ifaddr **ifnet_addrs;
-void ether_ifattach __P((struct ifnet *));
+void ether_ifattach __P((struct ifnet *, int));
+void ether_ifdetach __P((struct ifnet *, int));
void ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *));
void ether_demux __P((struct ifnet *, struct ether_header *, struct mbuf *));
int ether_output __P((struct ifnet *,
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 7bf08bd..5c4292c 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -170,9 +170,7 @@ vlaninit(void *dummy)
ifp->if_ioctl = vlan_ioctl;
ifp->if_output = ether_output;
ifp->if_snd.ifq_maxlen = ifqmaxlen;
- if_attach(ifp);
- ether_ifattach(ifp);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
/* Now undo some of the damage... */
ifp->if_data.ifi_type = IFT_8021_VLAN;
ifp->if_data.ifi_hdrlen = EVL_ENCAPLEN;
diff --git a/sys/pc98/pc98/if_ed.c b/sys/pc98/pc98/if_ed.c
index ac5b6c8..a6dcf82 100644
--- a/sys/pc98/pc98/if_ed.c
+++ b/sys/pc98/pc98/if_ed.c
@@ -2477,8 +2477,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 */
@@ -2504,10 +2503,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 1;
}
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c
index dcb6ee9..c26e6e0 100644
--- a/sys/pci/if_dc.c
+++ b/sys/pci/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/pci/if_de.c b/sys/pci/if_de.c
index 3b2a4fb..7037f6d 100644
--- a/sys/pci/if_de.c
+++ b/sys/pci/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/pci/if_fxp.c b/sys/pci/if_fxp.c
index a9060e3..408ec5d 100644
--- a/sys/pci/if_fxp.c
+++ b/sys/pci/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/pci/if_rl.c b/sys/pci/if_rl.c
index a8e0ba0..78b80a2 100644
--- a/sys/pci/if_rl.c
+++ b/sys/pci/if_rl.c
@@ -956,12 +956,9 @@ static int rl_attach(dev)
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
/*
- * 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);
@@ -980,7 +977,7 @@ static int rl_detach(dev)
sc = device_get_softc(dev);
ifp = &sc->arpcom.ac_if;
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
rl_stop(sc);
bus_generic_detach(dev);
diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c
index 2ce3869..3ffa606 100644
--- a/sys/pci/if_sf.c
+++ b/sys/pci/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/pci/if_sis.c b/sys/pci/if_sis.c
index d69679d..9f7bb1e 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -844,14 +844,11 @@ static int sis_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->sis_stat_ch);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-
fail:
splx(s);
return(error);
@@ -871,7 +868,7 @@ static int sis_detach(dev)
sis_reset(sc);
sis_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_generic_detach(dev);
device_delete_child(dev, sc->sis_miibus);
diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c
index 3504af4..d51ee34 100644
--- a/sys/pci/if_sk.c
+++ b/sys/pci/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/pci/if_ste.c b/sys/pci/if_ste.c
index 8a2f1dd..18d355c 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -1068,13 +1068,9 @@ static int ste_attach(dev)
ifp->if_snd.ifq_maxlen = STE_TX_LIST_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);
@@ -1094,7 +1090,7 @@ static int ste_detach(dev)
ifp = &sc->arpcom.ac_if;
ste_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_generic_detach(dev);
device_delete_child(dev, sc->ste_miibus);
diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c
index 92525bc..358a3f0 100644
--- a/sys/pci/if_ti.c
+++ b/sys/pci/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/pci/if_tl.c b/sys/pci/if_tl.c
index 4f14915..a18ac22 100644
--- a/sys/pci/if_tl.c
+++ b/sys/pci/if_tl.c
@@ -1335,12 +1335,9 @@ static int tl_attach(dev)
}
/*
- * 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);
@@ -1360,7 +1357,7 @@ static int tl_detach(dev)
ifp = &sc->arpcom.ac_if;
tl_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
bus_generic_detach(dev);
device_delete_child(dev, sc->tl_miibus);
diff --git a/sys/pci/if_tx.c b/sys/pci/if_tx.c
index dc25317..7cbe32d 100644
--- a/sys/pci/if_tx.c
+++ b/sys/pci/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/pci/if_vr.c b/sys/pci/if_vr.c
index 469ef0e..3649d7e 100644
--- a/sys/pci/if_vr.c
+++ b/sys/pci/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/pci/if_wb.c b/sys/pci/if_wb.c
index 2f8b60a..397ca20 100644
--- a/sys/pci/if_wb.c
+++ b/sys/pci/if_wb.c
@@ -967,12 +967,9 @@ static int wb_attach(dev)
}
/*
- * 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:
if (error)
@@ -995,7 +992,7 @@ static int wb_detach(dev)
ifp = &sc->arpcom.ac_if;
wb_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
/* Delete any miibus and phy devices attached to this interface */
bus_generic_detach(dev);
diff --git a/sys/pci/if_wx.c b/sys/pci/if_wx.c
index 5fd2b28..c509f58 100644
--- a/sys/pci/if_wx.c
+++ b/sys/pci/if_wx.c
@@ -629,10 +629,8 @@ wx_attach(device_t dev)
ifp->if_ioctl = wx_ioctl;
ifp->if_start = wx_start;
ifp->if_watchdog = wx_txwatchdog;
- if_attach(ifp);
ifp->if_snd.ifq_maxlen = WX_MAX_TDESC - 1;
- ether_ifattach(ifp);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
tmp = wxlist;
if (tmp) {
while (tmp->wx_next)
@@ -651,7 +649,7 @@ wx_detach(device_t dev)
{
wx_softc_t *sc = device_get_softc(dev);
int s = splimp();
- if_detach(&sc->w.arpcom.ac_if);
+ ether_ifdetach(&sc->w.arpcom.ac_if, ETHER_BPF_SUPPORTED);
wx_stop(sc);
bus_teardown_intr(dev, sc->w.irq, sc->w.ih);
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->w.irq);
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index edfb4ee..dc9d319 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -1491,12 +1491,9 @@ static int xl_attach(dev)
done:
/*
- * 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);
@@ -1517,7 +1514,7 @@ static int xl_detach(dev)
xl_reset(sc);
xl_stop(sc);
- if_detach(ifp);
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
/* Delete any miibus and phy devices attached to this interface */
if (sc->xl_miibus != NULL) {
OpenPOWER on IntegriCloud