mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
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
This commit is contained in:
parent
c20990577c
commit
de6073aab0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148640
@ -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 *);
|
||||
@ -216,6 +217,16 @@ typedef void if_init_f_t(void *);
|
||||
#define if_addrlist if_addrhead
|
||||
#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
|
||||
|
Loading…
Reference in New Issue
Block a user