if: Remove ifnet_rwlock
It no longer serves any purpose, as evidenced by the fact that we never take it without ifnet_sxlock. Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D27278
This commit is contained in:
parent
6b8f0ba8e2
commit
a60100fdfc
10
sys/net/if.c
10
sys/net/if.c
@ -306,15 +306,9 @@ VNET_DEFINE(struct ifnet **, ifindex_table);
|
||||
|
||||
/*
|
||||
* The global network interface list (V_ifnet) and related state (such as
|
||||
* if_index, if_indexlim, and ifindex_table) are protected by an sxlock and
|
||||
* an rwlock. Either may be acquired shared to stablize the list, but both
|
||||
* must be acquired writable to modify the list. This model allows us to
|
||||
* both stablize the interface list during interrupt thread processing, but
|
||||
* also to stablize it over long-running ioctls, without introducing priority
|
||||
* inversions and deadlocks.
|
||||
* if_index, if_indexlim, and ifindex_table) are protected by an sxlock.
|
||||
* This may be acquired to stabilise the list, or we may rely on NET_EPOCH.
|
||||
*/
|
||||
struct rwlock ifnet_rwlock;
|
||||
RW_SYSINIT_FLAGS(ifnet_rw, &ifnet_rwlock, "ifnet_rw", RW_RECURSE);
|
||||
struct sx ifnet_sxlock;
|
||||
SX_SYSINIT_FLAGS(ifnet_sx, &ifnet_sxlock, "ifnet_sx", SX_RECURSE);
|
||||
|
||||
|
@ -593,29 +593,12 @@ struct ifmultiaddr {
|
||||
struct epoch_context ifma_epoch_ctx;
|
||||
};
|
||||
|
||||
extern struct rwlock ifnet_rwlock;
|
||||
extern struct sx ifnet_sxlock;
|
||||
|
||||
#define IFNET_WLOCK() do { \
|
||||
sx_xlock(&ifnet_sxlock); \
|
||||
rw_wlock(&ifnet_rwlock); \
|
||||
} while (0)
|
||||
|
||||
#define IFNET_WUNLOCK() do { \
|
||||
rw_wunlock(&ifnet_rwlock); \
|
||||
sx_xunlock(&ifnet_sxlock); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* To assert the ifnet lock, you must know not only whether it's for read or
|
||||
* write, but also whether it was acquired with sleep support or not.
|
||||
*/
|
||||
#define IFNET_RLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_SLOCKED)
|
||||
#define IFNET_WLOCK_ASSERT() do { \
|
||||
sx_assert(&ifnet_sxlock, SA_XLOCKED); \
|
||||
rw_assert(&ifnet_rwlock, RA_WLOCKED); \
|
||||
} while (0)
|
||||
|
||||
#define IFNET_WLOCK() sx_xlock(&ifnet_sxlock)
|
||||
#define IFNET_WUNLOCK() sx_xunlock(&ifnet_sxlock)
|
||||
#define IFNET_RLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_SLOCKED)
|
||||
#define IFNET_WLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_XLOCKED)
|
||||
#define IFNET_RLOCK() sx_slock(&ifnet_sxlock)
|
||||
#define IFNET_RUNLOCK() sx_sunlock(&ifnet_sxlock)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user