summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_lock_bsd.h
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2006-12-14 17:02:55 +0000
committerrrs <rrs@FreeBSD.org>2006-12-14 17:02:55 +0000
commit3de80805ffbf0e87c0ff547698814193edb8bd14 (patch)
tree940611c208a2462c47614c0688becd97244ad6fe /sys/netinet/sctp_lock_bsd.h
parentd398e83b8a941f854ec49ad93c3694c17b0f8e88 (diff)
downloadFreeBSD-src-3de80805ffbf0e87c0ff547698814193edb8bd14.zip
FreeBSD-src-3de80805ffbf0e87c0ff547698814193edb8bd14.tar.gz
1) Fixes on a number of different collision case LOR's.
2) Fix all "magic numbers" to be constants. 3) A collision case that would generate two associations to the same peer due to a missing lock is fixed. 4) Added tracking of where timers are stopped. Approved by: gnn
Diffstat (limited to 'sys/netinet/sctp_lock_bsd.h')
-rw-r--r--sys/netinet/sctp_lock_bsd.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/sys/netinet/sctp_lock_bsd.h b/sys/netinet/sctp_lock_bsd.h
index 0121b23..a60d31b 100644
--- a/sys/netinet/sctp_lock_bsd.h
+++ b/sys/netinet/sctp_lock_bsd.h
@@ -71,6 +71,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+
+extern struct sctp_foo_stuff sctp_logoff[];
+extern int sctp_logoff_stuff;
+
#define SCTP_IPI_COUNT_INIT()
#define SCTP_STATLOG_INIT_LOCK()
@@ -87,6 +91,7 @@ __FBSDID("$FreeBSD$");
} \
}
+
#define SCTP_INP_INFO_LOCK_INIT() \
mtx_init(&sctppcbinfo.ipi_ep_mtx, "sctp-info", "inp_info", MTX_DEF)
@@ -185,10 +190,37 @@ __FBSDID("$FreeBSD$");
#define SCTP_TCB_SEND_UNLOCK(_tcb) mtx_unlock(&(_tcb)->tcb_send_mtx)
+#ifdef INVARIANTS
+
+#define SCTP_INP_INCR_REF(_inp) { int x; \
+ atomic_add_int(&((_inp)->refcount), 1); \
+ x = atomic_fetchadd_int(&sctp_logoff_stuff, 1); \
+ if(x == 30000) \
+ sctp_logoff_stuff = x = 0; \
+ sctp_logoff[x].inp = _inp; \
+ sctp_logoff[x].ticks = ticks; \
+ sctp_logoff[x].lineno = __LINE__; \
+ sctp_logoff[x].updown = 1; \
+}
+
+#define SCTP_INP_DECR_REF(_inp) { int x; \
+ if (atomic_fetchadd_int(&((_inp)->refcount), -1) == 0 ) panic("refcount goes negative"); \
+ x = atomic_fetchadd_int(&sctp_logoff_stuff, 1); \
+ if(x == 30000) \
+ sctp_logoff_stuff = x = 0; \
+ sctp_logoff[x].inp = _inp; \
+ sctp_logoff[x].ticks = ticks; \
+ sctp_logoff[x].lineno = __LINE__; \
+ sctp_logoff[x].updown = 0; \
+}
+
+#else
#define SCTP_INP_INCR_REF(_inp) atomic_add_int(&((_inp)->refcount), 1)
#define SCTP_INP_DECR_REF(_inp) atomic_add_int(&((_inp)->refcount), -1)
+#endif
+
#ifdef SCTP_LOCK_LOGGING
#define SCTP_ASOC_CREATE_LOCK(_inp) \
do { \
OpenPOWER on IntegriCloud