summaryrefslogtreecommitdiffstats
path: root/sys/dev/xe/if_xevar.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-06-02 19:43:24 +0000
committerjhb <jhb@FreeBSD.org>2008-06-02 19:43:24 +0000
commit5c17f7e3cf029fe7e0e13844315408f04beb4f5d (patch)
treeb7709a42a374a03f01f5eb39d5cf706bae9ac92a /sys/dev/xe/if_xevar.h
parent67b6b9ed89f8a91c6772e552a912b696a25d63fc (diff)
downloadFreeBSD-src-5c17f7e3cf029fe7e0e13844315408f04beb4f5d.zip
FreeBSD-src-5c17f7e3cf029fe7e0e13844315408f04beb4f5d.tar.gz
Add locking and make xe(4) MPSAFE:
- Add a mutex to protect the softc and device hardware. - Use a callout rather than a callout_handle for the media timer. - Use a dedicated timer for managing the tx watchdog rather than if_timer. - Fix some resource leaks if xe_attach() fails. - Shutdown the device before detaching the driver. - Setup the interrupt handler after ether_ifattach(). Tested by: Ian FREISLICH ianf of clue.co.za
Diffstat (limited to 'sys/dev/xe/if_xevar.h')
-rw-r--r--sys/dev/xe/if_xevar.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/xe/if_xevar.h b/sys/dev/xe/if_xevar.h
index 0e66102..0981338 100644
--- a/sys/dev/xe/if_xevar.h
+++ b/sys/dev/xe/if_xevar.h
@@ -35,7 +35,9 @@
struct xe_softc {
struct ifmedia ifmedia;
struct ifmib_iso_8802_3 mibdata;
- struct callout_handle chand;
+ struct callout media_timer;
+ struct callout wdog_timer;
+ struct mtx lock;
struct ifnet *ifp;
struct ifmedia *ifm;
u_char enaddr[6];
@@ -68,6 +70,10 @@ struct xe_softc {
u_char gone; /* 1 = Card bailed out */
};
+#define XE_LOCK(sc) mtx_lock(&(sc)->lock)
+#define XE_UNLOCK(sc) mtx_unlock(&(sc)->lock)
+#define XE_ASSERT_LOCKED(sc) mtx_assert(&(sc)->lock, MA_OWNED)
+
/*
* For accessing card registers
*/
@@ -88,5 +94,6 @@ struct xe_softc {
int xe_attach(device_t dev);
int xe_activate(device_t dev);
void xe_deactivate(device_t dev);
+void xe_stop(struct xe_softc *scp);
#endif /* DEV_XE_IF_XEVAR_H */
OpenPOWER on IntegriCloud