summaryrefslogtreecommitdiffstats
path: root/sys/pci
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/pci
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/pci')
-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
15 files changed, 40 insertions, 84 deletions
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