diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2005-08-09 10:20:02 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2005-08-09 10:20:02 +0000 |
commit | 13f4c340aeeeb104844712bb36899d1adef50579 (patch) | |
tree | bb70e59641e2310a3c26ec449af5ab0cb7420d9d /sys/dev/hme | |
parent | 292ee7be1c404a624dda68ddff1bd988a1851e5a (diff) |
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
Notes
Notes:
svn path=/head/; revision=148887
Diffstat (limited to 'sys/dev/hme')
-rw-r--r-- | sys/dev/hme/if_hme.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/dev/hme/if_hme.c b/sys/dev/hme/if_hme.c index 82f43a9bd7e8..7d19092f6f2e 100644 --- a/sys/dev/hme/if_hme.c +++ b/sys/dev/hme/if_hme.c @@ -880,8 +880,8 @@ hme_init_locked(struct hme_softc *sc) /* Start the one second timer. */ callout_reset(&sc->sc_tick_ch, hz, hme_tick, sc); - ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_timer = 0; hme_start_locked(ifp); } @@ -1107,7 +1107,8 @@ hme_start_locked(struct ifnet *ifp) struct mbuf *m; int error, enq = 0; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) return; error = 0; @@ -1118,7 +1119,7 @@ hme_start_locked(struct ifnet *ifp) error = hme_load_txmbuf(sc, m); if (error == -1) { - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; IFQ_DRV_PREPEND(&ifp->if_snd, m); break; } else if (error > 0) { @@ -1131,7 +1132,7 @@ hme_start_locked(struct ifnet *ifp) } if (sc->sc_rb.rb_td_nbusy == HME_NTXDESC || error == -1) - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; /* Set watchdog timer if a packet was queued */ if (enq) { bus_dmamap_sync(sc->sc_cdmatag, sc->sc_cdmamap, @@ -1184,7 +1185,7 @@ hme_tint(struct hme_softc *sc) CTR0(KTR_HME, "hme_tint: not owned"); --sc->sc_rb.rb_td_nbusy; - ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* Complete packet transmitted? */ if ((txflags & HME_XD_EOP) == 0) @@ -1558,15 +1559,15 @@ hme_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) switch (cmd) { case SIOCSIFFLAGS: if ((ifp->if_flags & IFF_UP) == 0 && - (ifp->if_flags & IFF_RUNNING) != 0) { + (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { /* * If interface is marked down and it is running, then * stop it. */ hme_stop(sc); - ifp->if_flags &= ~IFF_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; } else if ((ifp->if_flags & IFF_UP) != 0 && - (ifp->if_flags & IFF_RUNNING) == 0) { + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { /* * If interface is marked up and it is stopped, then * start it. |