Deleted Added
sdiff udiff text old ( 165220 ) new ( 167598 )
full compact
1#ifndef __sctp_lock_bsd_h__
2#define __sctp_lock_bsd_h__
3/*-
4 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *

--- 55 unchanged lines hidden (view full) ---

64
65/*
66 * When working with the global SCTP lists we lock and unlock the INP_INFO
67 * lock. So when we go to lookup an association we will want to do a
68 * SCTP_INP_INFO_RLOCK() and then when we want to add a new association to
69 * the sctppcbinfo list's we will do a SCTP_INP_INFO_WLOCK().
70 */
71#include <sys/cdefs.h>
72__FBSDID("$FreeBSD: head/sys/netinet/sctp_lock_bsd.h 167598 2007-03-15 11:27:14Z rrs $");
73
74
75extern struct sctp_foo_stuff sctp_logoff[];
76extern int sctp_logoff_stuff;
77
78#define SCTP_IPI_COUNT_INIT()
79
80#define SCTP_STATLOG_INIT_LOCK()

--- 20 unchanged lines hidden (view full) ---

101} while (0)
102
103
104#define SCTP_INP_INFO_WLOCK() do { \
105 mtx_lock(&sctppcbinfo.ipi_ep_mtx); \
106} while (0)
107
108
109#define SCTP_IPI_ADDR_INIT() \
110 mtx_init(&sctppcbinfo.ipi_addr_mtx, "sctp-addr", "sctp_addr", MTX_DEF)
111
112#define SCTP_IPI_ADDR_DESTROY() \
113 mtx_destroy(&sctppcbinfo.ipi_addr_mtx)
114
115#define SCTP_IPI_ADDR_LOCK() do { \
116 mtx_lock(&sctppcbinfo.ipi_addr_mtx); \
117} while (0)
118
119#define SCTP_IPI_ADDR_UNLOCK() mtx_unlock(&sctppcbinfo.ipi_addr_mtx)
120
121
122
123#define SCTP_IPI_ITERATOR_WQ_INIT() \
124 mtx_init(&sctppcbinfo.ipi_iterator_wq_mtx, "sctp-it-wq", "sctp_it_wq", MTX_DEF)
125
126#define SCTP_IPI_ITERATOR_WQ_DESTROY() \
127 mtx_destroy(&sctppcbinfo.ipi_iterator_wq_mtx)
128
129#define SCTP_IPI_ITERATOR_WQ_LOCK() do { \
130 mtx_lock(&sctppcbinfo.ipi_iterator_wq_mtx); \
131} while (0)
132
133#define SCTP_IPI_ITERATOR_WQ_UNLOCK() mtx_unlock(&sctppcbinfo.ipi_iterator_wq_mtx)
134
135
136
137
138
139#define SCTP_INP_INFO_RUNLOCK() mtx_unlock(&sctppcbinfo.ipi_ep_mtx)
140#define SCTP_INP_INFO_WUNLOCK() mtx_unlock(&sctppcbinfo.ipi_ep_mtx)
141
142/*
143 * The INP locks we will use for locking an SCTP endpoint, so for example if
144 * we want to change something at the endpoint level for example random_store
145 * or cookie secrets we lock the INP level.
146 */

--- 55 unchanged lines hidden (view full) ---

202#define SCTP_TCB_SEND_LOCK_DESTROY(_tcb) mtx_destroy(&(_tcb)->tcb_send_mtx)
203
204#define SCTP_TCB_SEND_LOCK(_tcb) do { \
205 mtx_lock(&(_tcb)->tcb_send_mtx); \
206} while (0)
207
208#define SCTP_TCB_SEND_UNLOCK(_tcb) mtx_unlock(&(_tcb)->tcb_send_mtx)
209
210#define SCTP_INP_INCR_REF(_inp) atomic_add_int(&((_inp)->refcount), 1)
211#define SCTP_INP_DECR_REF(_inp) atomic_add_int(&((_inp)->refcount), -1)
212
213
214#ifdef SCTP_LOCK_LOGGING
215#define SCTP_ASOC_CREATE_LOCK(_inp) \
216 do { \
217 sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_CREATE); \
218 mtx_lock(&(_inp)->inp_create_mtx); \
219 } while (0)
220#else

--- 157 unchanged lines hidden ---