Page MenuHomeFreeBSD

D27278.diff
No OneTemporary

D27278.diff

Index: head/sys/net/if.c
===================================================================
--- head/sys/net/if.c
+++ head/sys/net/if.c
@@ -306,15 +306,9 @@
/*
* 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);
Index: head/sys/net/if_var.h
===================================================================
--- head/sys/net/if_var.h
+++ head/sys/net/if_var.h
@@ -593,29 +593,12 @@
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)

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 5, 2:44 PM (20 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16475874
Default Alt Text
D27278.diff (2 KB)

Event Timeline