Page MenuHomeFreeBSD

D23808.1794304653.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D23808.1794304653.diff

Index: sys/net/if_bridge.c
===================================================================
--- sys/net/if_bridge.c
+++ sys/net/if_bridge.c
@@ -184,6 +184,47 @@
*/
#define BRIDGE_IFCAPS_STRIP IFCAP_LRO
+/*
+ * Bridge locking
+ */
+#define BRIDGE_LOCK_INIT(_sc) do { \
+ mtx_init(&(_sc)->sc_mtx, "if_bridge", NULL, MTX_DEF); \
+ cv_init(&(_sc)->sc_cv, "if_bridge_cv"); \
+} while (0)
+#define BRIDGE_LOCK_DESTROY(_sc) do { \
+ mtx_destroy(&(_sc)->sc_mtx); \
+ cv_destroy(&(_sc)->sc_cv); \
+} while (0)
+#define BRIDGE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
+#define BRIDGE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
+#define BRIDGE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
+#define BRIDGE_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED)
+#define BRIDGE_LOCK2REF(_sc, _err) do { \
+ mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \
+ if ((_sc)->sc_iflist_xcnt > 0) \
+ (_err) = EBUSY; \
+ else \
+ (_sc)->sc_iflist_ref++; \
+ mtx_unlock(&(_sc)->sc_mtx); \
+} while (0)
+#define BRIDGE_UNREF(_sc) do { \
+ mtx_lock(&(_sc)->sc_mtx); \
+ (_sc)->sc_iflist_ref--; \
+ if (((_sc)->sc_iflist_xcnt > 0) && ((_sc)->sc_iflist_ref == 0)) \
+ cv_broadcast(&(_sc)->sc_cv); \
+ mtx_unlock(&(_sc)->sc_mtx); \
+} while (0)
+#define BRIDGE_XLOCK(_sc) do { \
+ mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \
+ (_sc)->sc_iflist_xcnt++; \
+ while ((_sc)->sc_iflist_ref > 0) \
+ cv_wait(&(_sc)->sc_cv, &(_sc)->sc_mtx); \
+} while (0)
+#define BRIDGE_XDROP(_sc) do { \
+ mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \
+ (_sc)->sc_iflist_xcnt--; \
+} while (0)
+
/*
* Bridge interface list entry.
*/
Index: sys/net/if_bridgevar.h
===================================================================
--- sys/net/if_bridgevar.h
+++ sys/net/if_bridgevar.h
@@ -271,44 +271,6 @@
#ifdef _KERNEL
-#define BRIDGE_LOCK_INIT(_sc) do { \
- mtx_init(&(_sc)->sc_mtx, "if_bridge", NULL, MTX_DEF); \
- cv_init(&(_sc)->sc_cv, "if_bridge_cv"); \
-} while (0)
-#define BRIDGE_LOCK_DESTROY(_sc) do { \
- mtx_destroy(&(_sc)->sc_mtx); \
- cv_destroy(&(_sc)->sc_cv); \
-} while (0)
-#define BRIDGE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
-#define BRIDGE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
-#define BRIDGE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
-#define BRIDGE_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED)
-#define BRIDGE_LOCK2REF(_sc, _err) do { \
- mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \
- if ((_sc)->sc_iflist_xcnt > 0) \
- (_err) = EBUSY; \
- else \
- (_sc)->sc_iflist_ref++; \
- mtx_unlock(&(_sc)->sc_mtx); \
-} while (0)
-#define BRIDGE_UNREF(_sc) do { \
- mtx_lock(&(_sc)->sc_mtx); \
- (_sc)->sc_iflist_ref--; \
- if (((_sc)->sc_iflist_xcnt > 0) && ((_sc)->sc_iflist_ref == 0)) \
- cv_broadcast(&(_sc)->sc_cv); \
- mtx_unlock(&(_sc)->sc_mtx); \
-} while (0)
-#define BRIDGE_XLOCK(_sc) do { \
- mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \
- (_sc)->sc_iflist_xcnt++; \
- while ((_sc)->sc_iflist_ref > 0) \
- cv_wait(&(_sc)->sc_cv, &(_sc)->sc_mtx); \
-} while (0)
-#define BRIDGE_XDROP(_sc) do { \
- mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \
- (_sc)->sc_iflist_xcnt--; \
-} while (0)
-
#define BRIDGE_INPUT(_ifp, _m) do { \
KASSERT((_ifp)->if_bridge_input != NULL, \
("%s: if_bridge not loaded!", __func__)); \

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 10, 9:57 AM (2 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41635274
Default Alt Text
D23808.1794304653.diff (3 KB)

Event Timeline