diff options
author | John Baldwin <jhb@FreeBSD.org> | 2008-06-02 19:17:40 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2008-06-02 19:17:40 +0000 |
commit | 00f1da89ab2c9c421435fa1362860e09eef713ec (patch) | |
tree | 6b1e299624a0f9baf24c0113e20f7c17d938ad7c /sys/dev/ie/if_ievar.h | |
parent | 1ead26d4e1be97e214da28a80934660647d299bd (diff) | |
download | src-00f1da89ab2c9c421435fa1362860e09eef713ec.tar.gz src-00f1da89ab2c9c421435fa1362860e09eef713ec.zip |
Make ie(4) MPSAFE:
- Add a mutex to the softc and use it to protect the softc and device.
- Setup the interrupt handler in the common code instead of in each front
end and do it after ether_ifattach().
- Use ie_stop() and ieinit_locked() in iereset() rather than frobbing IFF_UP
and invoking ieioctl().
- Use DELAY() to implement a spin loop on a register with a timeout rather
than scheduling a timeout and then doing a tight spin on the register.
In the non-MPSAFE case this would never have worked because the spinning
code held Giant and the timeout routine would have been blocked on Giant
forever. The same approach would not worke in the MPSAFE case either for
the same reason, hence use a loop around DELAY().
- Clear IFF_DRV_(RUNNING|OACTIVE) in ie_stop() rather than in callers.
- Call ieinit_locked() directly rather than ieioctl(!) from ie_mc_reset().
- Don't leak the rx frame buffer on detach.
Tested by: Thierry Herbelot thierry of herbelot.com
Notes
Notes:
svn path=/head/; revision=179491
Diffstat (limited to 'sys/dev/ie/if_ievar.h')
-rw-r--r-- | sys/dev/ie/if_ievar.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/ie/if_ievar.h b/sys/dev/ie/if_ievar.h index 7869951e04b0..e588d805ed46 100644 --- a/sys/dev/ie/if_ievar.h +++ b/sys/dev/ie/if_ievar.h @@ -67,10 +67,16 @@ struct ie_softc { int mcast_count; u_short irq_encoded; /* encoded interrupt on IEE16 */ + + struct mtx lock; }; #define PORT(sc) sc->port #define MEM(sc) sc->iomem +#define IE_LOCK(sc) mtx_lock(&(sc)->lock) +#define IE_UNLOCK(sc) mtx_unlock(&(sc)->lock) +#define IE_ASSERT_LOCKED(sc) mtx_assert(&(sc)->lock, MA_OWNED) + void ie_intr (void *); int ie_alloc_resources (device_t); void ie_release_resources (device_t); |