summaryrefslogtreecommitdiffstats
path: root/sys/dev/hatm
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-08-09 10:20:02 +0000
committerrwatson <rwatson@FreeBSD.org>2005-08-09 10:20:02 +0000
commit5d770a09e85126b8b3e9fe302c36350a90210cbe (patch)
treebb70e59641e2310a3c26ec449af5ab0cb7420d9d /sys/dev/hatm
parent74759aaa78777146f23aa05c856f574efdfb41d9 (diff)
downloadFreeBSD-src-5d770a09e85126b8b3e9fe302c36350a90210cbe.zip
FreeBSD-src-5d770a09e85126b8b3e9fe302c36350a90210cbe.tar.gz
Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
Diffstat (limited to 'sys/dev/hatm')
-rw-r--r--sys/dev/hatm/if_hatm.c10
-rw-r--r--sys/dev/hatm/if_hatm_intr.c2
-rw-r--r--sys/dev/hatm/if_hatm_ioctl.c14
-rw-r--r--sys/dev/hatm/if_hatm_rx.c4
-rw-r--r--sys/dev/hatm/if_hatm_tx.c2
5 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/hatm/if_hatm.c b/sys/dev/hatm/if_hatm.c
index 16740f0..cd955ac 100644
--- a/sys/dev/hatm/if_hatm.c
+++ b/sys/dev/hatm/if_hatm.c
@@ -1974,7 +1974,7 @@ hatm_initialize(struct hatm_softc *sc)
u_int cid;
static const u_int layout[2][7] = HE_CONFIG_MEM_LAYOUT;
- if (sc->ifp->if_flags & IFF_RUNNING)
+ if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING)
return;
hatm_init_bus_width(sc);
@@ -2244,7 +2244,7 @@ hatm_initialize(struct hatm_softc *sc)
v |= HE_PCIM_CTL0_INIT_ENB | HE_PCIM_CTL0_INT_PROC_ENB;
pci_write_config(sc->dev, HE_PCIR_GEN_CNTL_0, v, 4);
- sc->ifp->if_flags |= IFF_RUNNING;
+ sc->ifp->if_drv_flags |= IFF_DRV_RUNNING;
sc->ifp->if_baudrate = 53 * 8 * IFP2IFATM(sc->ifp)->mib.pcr;
sc->utopia.flags &= ~UTP_FL_POLL_CARRIER;
@@ -2272,9 +2272,9 @@ hatm_stop(struct hatm_softc *sc)
mtx_assert(&sc->mtx, MA_OWNED);
- if (!(sc->ifp->if_flags & IFF_RUNNING))
+ if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING))
return;
- sc->ifp->if_flags &= ~IFF_RUNNING;
+ sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
ATMEV_SEND_IFSTATE_CHANGED(IFP2IFATM(sc->ifp),
sc->utopia.carrier == UTP_CARR_OK);
@@ -2318,7 +2318,7 @@ hatm_stop(struct hatm_softc *sc)
/*
* Give any waiters on closing a VCC a chance. They will stop
- * to wait if they see that IFF_RUNNING disappeared.
+ * to wait if they see that IFF_DRV_RUNNING disappeared.
*/
cv_broadcast(&sc->vcc_cv);
cv_broadcast(&sc->cv_rcclose);
diff --git a/sys/dev/hatm/if_hatm_intr.c b/sys/dev/hatm/if_hatm_intr.c
index 3da034f..750364a 100644
--- a/sys/dev/hatm/if_hatm_intr.c
+++ b/sys/dev/hatm/if_hatm_intr.c
@@ -537,7 +537,7 @@ hatm_intr(void *p)
/* if we have a stray interrupt with a non-initialized card,
* we cannot even lock before looking at the flag */
- if (!(sc->ifp->if_flags & IFF_RUNNING))
+ if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING))
return;
mtx_lock(&sc->mtx);
diff --git a/sys/dev/hatm/if_hatm_ioctl.c b/sys/dev/hatm/if_hatm_ioctl.c
index 0a4724a..5e37b5d 100644
--- a/sys/dev/hatm/if_hatm_ioctl.c
+++ b/sys/dev/hatm/if_hatm_ioctl.c
@@ -116,7 +116,7 @@ hatm_open_vcc(struct hatm_softc *sc, struct atmio_openvcc *arg)
return (ENOMEM);
mtx_lock(&sc->mtx);
- if (!(sc->ifp->if_flags & IFF_RUNNING)) {
+ if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
error = EIO;
goto done;
}
@@ -230,7 +230,7 @@ hatm_close_vcc(struct hatm_softc *sc, struct atmio_closevcc *arg)
mtx_lock(&sc->mtx);
vcc = sc->vccs[cid];
- if (!(sc->ifp->if_flags & IFF_RUNNING)) {
+ if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
error = EIO;
goto done;
}
@@ -248,11 +248,11 @@ hatm_close_vcc(struct hatm_softc *sc, struct atmio_closevcc *arg)
if (vcc->param.flags & ATMIO_FLAG_ASYNC)
goto done;
- while ((sc->ifp->if_flags & IFF_RUNNING) &&
+ while ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) &&
(vcc->vflags & (HE_VCC_TX_CLOSING | HE_VCC_RX_CLOSING)))
cv_wait(&sc->vcc_cv, &sc->mtx);
- if (!(sc->ifp->if_flags & IFF_RUNNING)) {
+ if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
error = EIO;
goto done;
}
@@ -284,7 +284,7 @@ hatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCSIFADDR:
mtx_lock(&sc->mtx);
ifp->if_flags |= IFF_UP;
- if (!(ifp->if_flags & IFF_RUNNING))
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
hatm_initialize(sc);
switch (ifa->ifa_addr->sa_family) {
@@ -303,11 +303,11 @@ hatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCSIFFLAGS:
mtx_lock(&sc->mtx);
if (ifp->if_flags & IFF_UP) {
- if (!(ifp->if_flags & IFF_RUNNING)) {
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
hatm_initialize(sc);
}
} else {
- if (ifp->if_flags & IFF_RUNNING) {
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
hatm_stop(sc);
}
}
diff --git a/sys/dev/hatm/if_hatm_rx.c b/sys/dev/hatm/if_hatm_rx.c
index bf6c7f7..b79b2fc 100644
--- a/sys/dev/hatm/if_hatm_rx.c
+++ b/sys/dev/hatm/if_hatm_rx.c
@@ -316,11 +316,11 @@ hatm_rx_vcc_close(struct hatm_softc *sc, u_int cid)
WRITE_RSR(sc, cid, 0, 0xf, 0);
v = READ4(sc, HE_REGO_RCCSTAT);
- while ((sc->ifp->if_flags & IFF_RUNNING) &&
+ while ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) &&
(READ4(sc, HE_REGO_RCCSTAT) & HE_REGM_RCCSTAT_PROG))
cv_timedwait(&sc->cv_rcclose, &sc->mtx, 1);
- if (!(sc->ifp->if_flags & IFF_RUNNING))
+ if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING))
return;
WRITE_MBOX4(sc, HE_REGO_RCON_CLOSE, cid);
diff --git a/sys/dev/hatm/if_hatm_tx.c b/sys/dev/hatm/if_hatm_tx.c
index 7e2676a..868b5a3 100644
--- a/sys/dev/hatm/if_hatm_tx.c
+++ b/sys/dev/hatm/if_hatm_tx.c
@@ -360,7 +360,7 @@ hatm_start(struct ifnet *ifp)
u_int len;
int error;
- if (!(ifp->if_flags & IFF_RUNNING))
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
return;
mtx_lock(&sc->mtx);
arg.sc = sc;
OpenPOWER on IntegriCloud