summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-08-02 17:43:35 +0000
committerrwatson <rwatson@FreeBSD.org>2005-08-02 17:43:35 +0000
commita3335c93b9a924f9255eabefe20044ffee3ea74d (patch)
treebcb6f94553376af7c051153732e29df78d136a9d
parent854872e4864a2e7881301bacacefe152e8748cf3 (diff)
downloadFreeBSD-src-a3335c93b9a924f9255eabefe20044ffee3ea74d.zip
FreeBSD-src-a3335c93b9a924f9255eabefe20044ffee3ea74d.tar.gz
Add if_addr_mtx to struct ifnet, a mutex to protect ifnet-related address
lists. Add accessor macros. This changes the size of struct ifnet, but ideally, all ifnet consumers are now using if_alloc() to allocate these structures rather than embedding them into device driver softc's, so this won't modify the network device driver ABI. MFC after: 1 week
-rw-r--r--sys/net/if_var.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index c79cb89..6c4991a 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -179,6 +179,7 @@ struct ifnet {
struct mtx if_afdata_mtx;
struct task if_starttask; /* task for IFF_NEEDSGIANT */
struct task if_linktask; /* task for link change events */
+ struct mtx if_addr_mtx; /* mutex to protect address lists */
};
typedef void if_init_f_t(void *);
@@ -217,6 +218,16 @@ typedef void if_init_f_t(void *);
#define if_list if_link
/*
+ * Locks for address lists on the network interface.
+ */
+#define IF_ADDR_LOCK_INIT(if) mtx_init(&(if)->if_addr_mtx, \
+ "if_addr_mtx", NULL, MTX_DEF)
+#define IF_ADDR_LOCK_DESTROY(if) mtx_destroy(&(if)->if_addr_mtx)
+#define IF_ADDR_LOCK(if) mtx_lock(&(if)->if_addr_mtx)
+#define IF_ADDR_UNLOCK(if) mtx_unlock(&(if)->if_addr_mtx)
+#define IF_ADDR_LOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED)
+
+/*
* Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)
* are queues of messages stored on ifqueue structures
* (defined above). Entries are added to and deleted from these structures
OpenPOWER on IntegriCloud