003 File Manager
Current Path:
/usr/src/sys/netinet
usr
/
src
/
sys
/
netinet
/
📁
..
📄
accf_data.c
(1.95 KB)
📄
accf_dns.c
(3.37 KB)
📄
accf_http.c
(8.35 KB)
📁
cc
📄
dccp.h
(2.48 KB)
📄
icmp6.h
(26.97 KB)
📄
icmp_var.h
(3.78 KB)
📄
if_ether.c
(41.26 KB)
📄
if_ether.h
(4.62 KB)
📄
igmp.c
(98.93 KB)
📄
igmp.h
(5.36 KB)
📄
igmp_var.h
(8.69 KB)
📄
in.c
(43.68 KB)
📄
in.h
(25.81 KB)
📄
in_cksum.c
(4.09 KB)
📄
in_debug.c
(3.48 KB)
📄
in_fib.c
(8.62 KB)
📄
in_fib.h
(2.59 KB)
📄
in_fib_algo.c
(18.68 KB)
📄
in_gif.c
(11.76 KB)
📄
in_jail.c
(10.31 KB)
📄
in_kdtrace.c
(5.61 KB)
📄
in_kdtrace.h
(3.31 KB)
📄
in_mcast.c
(79.22 KB)
📄
in_pcb.c
(90.89 KB)
📄
in_pcb.h
(34.46 KB)
📄
in_pcbgroup.c
(17.28 KB)
📄
in_prot.c
(2.35 KB)
📄
in_proto.c
(9.36 KB)
📄
in_rmx.c
(4.99 KB)
📄
in_rss.c
(11.27 KB)
📄
in_rss.h
(2.42 KB)
📄
in_systm.h
(2.57 KB)
📄
in_var.h
(15.4 KB)
📄
ip.h
(7.37 KB)
📄
ip6.h
(8.93 KB)
📄
ip_carp.c
(53.25 KB)
📄
ip_carp.h
(6.79 KB)
📄
ip_divert.c
(21.74 KB)
📄
ip_divert.h
(2.32 KB)
📄
ip_dummynet.h
(8.94 KB)
📄
ip_ecn.c
(5.83 KB)
📄
ip_ecn.h
(2.1 KB)
📄
ip_encap.c
(10.59 KB)
📄
ip_encap.h
(3.13 KB)
📄
ip_fastfwd.c
(13.79 KB)
📄
ip_fw.h
(34.29 KB)
📄
ip_gre.c
(15.28 KB)
📄
ip_icmp.c
(31.15 KB)
📄
ip_icmp.h
(8.52 KB)
📄
ip_id.c
(9.78 KB)
📄
ip_input.c
(37.16 KB)
📄
ip_mroute.c
(75.86 KB)
📄
ip_mroute.h
(13.66 KB)
📄
ip_options.c
(19.9 KB)
📄
ip_options.h
(2.61 KB)
📄
ip_output.c
(40.67 KB)
📄
ip_reass.c
(22.42 KB)
📄
ip_var.h
(11.48 KB)
📁
khelp
📁
libalias
📁
netdump
📄
pim.h
(4.25 KB)
📄
pim_var.h
(3.14 KB)
📄
raw_ip.c
(28.58 KB)
📄
sctp.h
(22.97 KB)
📄
sctp_asconf.c
(100.05 KB)
📄
sctp_asconf.h
(3.31 KB)
📄
sctp_auth.c
(50.44 KB)
📄
sctp_auth.h
(8.52 KB)
📄
sctp_bsd_addr.c
(13.89 KB)
📄
sctp_bsd_addr.h
(2.45 KB)
📄
sctp_cc_functions.c
(68.75 KB)
📄
sctp_constants.h
(34.12 KB)
📄
sctp_crc32.c
(4.5 KB)
📄
sctp_crc32.h
(2.07 KB)
📄
sctp_header.h
(17.48 KB)
📄
sctp_indata.c
(175.36 KB)
📄
sctp_indata.h
(4.18 KB)
📄
sctp_input.c
(183.57 KB)
📄
sctp_input.h
(2.43 KB)
📄
sctp_kdtrace.c
(7.51 KB)
📄
sctp_kdtrace.h
(3.6 KB)
📄
sctp_lock_bsd.h
(15.64 KB)
📄
sctp_module.c
(5.16 KB)
📄
sctp_os.h
(2.73 KB)
📄
sctp_os_bsd.h
(15.04 KB)
📄
sctp_output.c
(362.89 KB)
📄
sctp_output.h
(6.38 KB)
📄
sctp_pcb.c
(198.87 KB)
📄
sctp_pcb.h
(19.31 KB)
📄
sctp_peeloff.c
(5.74 KB)
📄
sctp_peeloff.h
(2.05 KB)
📄
sctp_ss_functions.c
(30.72 KB)
📄
sctp_structs.h
(38.29 KB)
📄
sctp_syscalls.c
(13.94 KB)
📄
sctp_sysctl.c
(37.45 KB)
📄
sctp_sysctl.h
(22.9 KB)
📄
sctp_timer.c
(47.92 KB)
📄
sctp_timer.h
(3.07 KB)
📄
sctp_uio.h
(38.07 KB)
📄
sctp_usrreq.c
(216.08 KB)
📄
sctp_var.h
(12.21 KB)
📄
sctputil.c
(212.13 KB)
📄
sctputil.h
(11.69 KB)
📄
siftr.c
(45.2 KB)
📄
tcp.h
(18.3 KB)
📄
tcp_debug.c
(5.9 KB)
📄
tcp_debug.h
(2.65 KB)
📄
tcp_fastopen.c
(37.98 KB)
📄
tcp_fastopen.h
(3.7 KB)
📄
tcp_fsm.h
(4.25 KB)
📄
tcp_hostcache.c
(21.43 KB)
📄
tcp_hostcache.h
(2.92 KB)
📄
tcp_hpts.c
(57.55 KB)
📄
tcp_hpts.h
(9.89 KB)
📄
tcp_input.c
(115.95 KB)
📄
tcp_log_buf.c
(76.37 KB)
📄
tcp_log_buf.h
(14.88 KB)
📄
tcp_lro.c
(36.38 KB)
📄
tcp_lro.h
(4.43 KB)
📄
tcp_offload.c
(5.48 KB)
📄
tcp_offload.h
(2.09 KB)
📄
tcp_output.c
(60.16 KB)
📄
tcp_pcap.c
(12.67 KB)
📄
tcp_pcap.h
(1.76 KB)
📄
tcp_ratelimit.c
(43.8 KB)
📄
tcp_ratelimit.h
(5.07 KB)
📄
tcp_reass.c
(30.75 KB)
📄
tcp_sack.c
(26.74 KB)
📄
tcp_seq.h
(3.57 KB)
📁
tcp_stacks
📄
tcp_stats.c
(8.47 KB)
📄
tcp_subr.c
(92.74 KB)
📄
tcp_syncache.c
(73 KB)
📄
tcp_syncache.h
(5.16 KB)
📄
tcp_timer.c
(31.04 KB)
📄
tcp_timer.h
(9.29 KB)
📄
tcp_timewait.c
(19.06 KB)
📄
tcp_usrreq.c
(71.35 KB)
📄
tcp_var.h
(43.48 KB)
📄
tcpip.h
(2.29 KB)
📄
toecore.c
(13.51 KB)
📄
toecore.h
(5.13 KB)
📄
udp.h
(2.49 KB)
📄
udp_usrreq.c
(44.57 KB)
📄
udp_var.h
(6.48 KB)
📄
udplite.h
(1.91 KB)
Editing: sctp_lock_bsd.h
/*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * b) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #ifndef _NETINET_SCTP_LOCK_BSD_H_ #define _NETINET_SCTP_LOCK_BSD_H_ /* * General locking concepts: The goal of our locking is to of course provide * consistency and yet minimize overhead. We will attempt to use * non-recursive locks which are supposed to be quite inexpensive. Now in * order to do this the goal is that most functions are not aware of locking. * Once we have a TCB we lock it and unlock when we are through. This means * that the TCB lock is kind-of a "global" lock when working on an * association. Caution must be used when asserting a TCB_LOCK since if we * recurse we deadlock. * * Most other locks (INP and INFO) attempt to localize the locking i.e. we try * to contain the lock and unlock within the function that needs to lock it. * This sometimes mean we do extra locks and unlocks and lose a bit of * efficiency, but if the performance statements about non-recursive locks are * true this should not be a problem. One issue that arises with this only * lock when needed is that if an implicit association setup is done we have * a problem. If at the time I lookup an association I have NULL in the tcb * return, by the time I call to create the association some other processor * could have created it. This is what the CREATE lock on the endpoint. * Places where we will be implicitly creating the association OR just * creating an association (the connect call) will assert the CREATE_INP * lock. This will assure us that during all the lookup of INP and INFO if * another creator is also locking/looking up we can gate the two to * synchronize. So the CREATE_INP lock is also another one we must use * extreme caution in locking to make sure we don't hit a re-entrancy issue. * */ /* * When working with the global SCTP lists we lock and unlock the INP_INFO * lock. So when we go to lookup an association we will want to do a * SCTP_INP_INFO_RLOCK() and then when we want to add a new association to * the SCTP_BASE_INFO() list's we will do a SCTP_INP_INFO_WLOCK(). */ #define SCTP_IPI_COUNT_INIT() #define SCTP_STATLOG_INIT_LOCK() #define SCTP_STATLOG_DESTROY() #define SCTP_STATLOG_LOCK() #define SCTP_STATLOG_UNLOCK() #define SCTP_INP_INFO_LOCK_INIT() do { \ rw_init(&SCTP_BASE_INFO(ipi_ep_mtx), "sctp-info"); \ } while (0) #define SCTP_INP_INFO_LOCK_DESTROY() do { \ if (rw_wowned(&SCTP_BASE_INFO(ipi_ep_mtx))) { \ rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } \ rw_destroy(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) #define SCTP_INP_INFO_RLOCK() do { \ rw_rlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) #define SCTP_INP_INFO_WLOCK() do { \ rw_wlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) #define SCTP_INP_INFO_RUNLOCK() do { \ rw_runlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) #define SCTP_INP_INFO_WUNLOCK() do { \ rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) #define SCTP_MCORE_QLOCK_INIT(cpstr) do { \ mtx_init(&(cpstr)->que_mtx, "sctp-mcore_queue","queue_lock", \ MTX_DEF | MTX_DUPOK); \ } while (0) #define SCTP_MCORE_QDESTROY(cpstr) do { \ if (mtx_owned(&(cpstr)->core_mtx)) { \ mtx_unlock(&(cpstr)->que_mtx); \ } \ mtx_destroy(&(cpstr)->que_mtx); \ } while (0) #define SCTP_MCORE_QLOCK(cpstr) do { \ mtx_lock(&(cpstr)->que_mtx); \ } while (0) #define SCTP_MCORE_QUNLOCK(cpstr) do { \ mtx_unlock(&(cpstr)->que_mtx); \ } while (0) #define SCTP_MCORE_LOCK_INIT(cpstr) do { \ mtx_init(&(cpstr)->core_mtx, "sctp-cpulck","cpu_proc_lock", \ MTX_DEF | MTX_DUPOK); \ } while (0) #define SCTP_MCORE_DESTROY(cpstr) do { \ if (mtx_owned(&(cpstr)->core_mtx)) { \ mtx_unlock(&(cpstr)->core_mtx); \ } \ mtx_destroy(&(cpstr)->core_mtx); \ } while (0) #define SCTP_MCORE_LOCK(cpstr) do { \ mtx_lock(&(cpstr)->core_mtx); \ } while (0) #define SCTP_MCORE_UNLOCK(cpstr) do { \ mtx_unlock(&(cpstr)->core_mtx); \ } while (0) #define SCTP_IPI_ADDR_INIT() do { \ rw_init(&SCTP_BASE_INFO(ipi_addr_mtx), "sctp-addr"); \ } while (0) #define SCTP_IPI_ADDR_DESTROY() do { \ if (rw_wowned(&SCTP_BASE_INFO(ipi_addr_mtx))) { \ rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } \ rw_destroy(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } while (0) #define SCTP_IPI_ADDR_RLOCK() do { \ rw_rlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } while (0) #define SCTP_IPI_ADDR_WLOCK() do { \ rw_wlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } while (0) #define SCTP_IPI_ADDR_RUNLOCK() do { \ rw_runlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } while (0) #define SCTP_IPI_ADDR_WUNLOCK() do { \ rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } while (0) #define SCTP_IPI_ADDR_LOCK_ASSERT() do { \ rw_assert(&SCTP_BASE_INFO(ipi_addr_mtx), RA_LOCKED); \ } while (0) #define SCTP_IPI_ADDR_WLOCK_ASSERT() do { \ rw_assert(&SCTP_BASE_INFO(ipi_addr_mtx), RA_WLOCKED); \ } while (0) #define SCTP_IPI_ITERATOR_WQ_INIT() do { \ mtx_init(&sctp_it_ctl.ipi_iterator_wq_mtx, "sctp-it-wq", \ "sctp_it_wq", MTX_DEF); \ } while (0) #define SCTP_IPI_ITERATOR_WQ_DESTROY() do { \ mtx_destroy(&sctp_it_ctl.ipi_iterator_wq_mtx); \ } while (0) #define SCTP_IPI_ITERATOR_WQ_LOCK() do { \ mtx_lock(&sctp_it_ctl.ipi_iterator_wq_mtx); \ } while (0) #define SCTP_IPI_ITERATOR_WQ_UNLOCK() do { \ mtx_unlock(&sctp_it_ctl.ipi_iterator_wq_mtx); \ } while (0) #define SCTP_IP_PKTLOG_INIT() do { \ mtx_init(&SCTP_BASE_INFO(ipi_pktlog_mtx), "sctp-pktlog", \ "packetlog", MTX_DEF); \ } while (0) #define SCTP_IP_PKTLOG_DESTROY() do { \ mtx_destroy(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ } while (0) #define SCTP_IP_PKTLOG_LOCK() do { \ mtx_lock(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ } while (0) #define SCTP_IP_PKTLOG_UNLOCK() do { \ mtx_unlock(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ } while (0) /* * The INP locks we will use for locking an SCTP endpoint, so for example if * we want to change something at the endpoint level for example random_store * or cookie secrets we lock the INP level. */ #define SCTP_INP_READ_INIT(_inp) do { \ mtx_init(&(_inp)->inp_rdata_mtx, "sctp-read", "inpr", \ MTX_DEF | MTX_DUPOK); \ } while (0) #define SCTP_INP_READ_DESTROY(_inp) do { \ mtx_destroy(&(_inp)->inp_rdata_mtx); \ } while (0) #define SCTP_INP_READ_LOCK(_inp) do { \ mtx_lock(&(_inp)->inp_rdata_mtx); \ } while (0) #define SCTP_INP_READ_UNLOCK(_inp) do { \ mtx_unlock(&(_inp)->inp_rdata_mtx); \ } while (0) #define SCTP_INP_LOCK_INIT(_inp) do { \ mtx_init(&(_inp)->inp_mtx, "sctp-inp", "inp", \ MTX_DEF | MTX_DUPOK); \ } while (0) #define SCTP_INP_LOCK_DESTROY(_inp) do { \ mtx_destroy(&(_inp)->inp_mtx); \ } while (0) #define SCTP_INP_LOCK_CONTENDED(_inp) \ ((_inp)->inp_mtx.mtx_lock & MTX_CONTESTED) #define SCTP_INP_READ_CONTENDED(_inp) \ ((_inp)->inp_rdata_mtx.mtx_lock & MTX_CONTESTED) #ifdef SCTP_LOCK_LOGGING #define SCTP_INP_RLOCK(_inp) do { \ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_INP); \ mtx_lock(&(_inp)->inp_mtx); \ } while (0) #define SCTP_INP_WLOCK(_inp) do { \ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_INP); \ mtx_lock(&(_inp)->inp_mtx); \ } while (0) #else #define SCTP_INP_RLOCK(_inp) do { \ mtx_lock(&(_inp)->inp_mtx); \ } while (0) #define SCTP_INP_WLOCK(_inp) do { \ mtx_lock(&(_inp)->inp_mtx); \ } while (0) #endif #define SCTP_INP_RUNLOCK(_inp) do { \ mtx_unlock(&(_inp)->inp_mtx); \ } while (0) #define SCTP_INP_WUNLOCK(_inp) do { \ mtx_unlock(&(_inp)->inp_mtx); \ } while (0) #define SCTP_INP_RLOCK_ASSERT(_inp) do { \ KASSERT(mtx_owned(&(_inp)->inp_mtx), \ ("Don't own INP read lock")); \ } while (0) #define SCTP_INP_WLOCK_ASSERT(_inp) do { \ KASSERT(mtx_owned(&(_inp)->inp_mtx), \ ("Don't own INP write lock")); \ } while (0) #define SCTP_INP_INCR_REF(_inp) atomic_add_int(&((_inp)->refcount), 1) #define SCTP_INP_DECR_REF(_inp) atomic_add_int(&((_inp)->refcount), -1) #define SCTP_ASOC_CREATE_LOCK_INIT(_inp) do { \ mtx_init(&(_inp)->inp_create_mtx, "sctp-create", "inp_create", \ MTX_DEF | MTX_DUPOK); \ } while (0) #define SCTP_ASOC_CREATE_LOCK_DESTROY(_inp) do { \ mtx_destroy(&(_inp)->inp_create_mtx); \ } while (0) #ifdef SCTP_LOCK_LOGGING #define SCTP_ASOC_CREATE_LOCK(_inp) do { \ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_CREATE); \ mtx_lock(&(_inp)->inp_create_mtx); \ } while (0) #else #define SCTP_ASOC_CREATE_LOCK(_inp) do { \ mtx_lock(&(_inp)->inp_create_mtx); \ } while (0) #endif #define SCTP_ASOC_CREATE_UNLOCK(_inp) do { \ mtx_unlock(&(_inp)->inp_create_mtx); \ } while (0) #define SCTP_ASOC_CREATE_LOCK_CONTENDED(_inp) \ ((_inp)->inp_create_mtx.mtx_lock & MTX_CONTESTED) #define SCTP_TCB_SEND_LOCK_INIT(_tcb) do { \ mtx_init(&(_tcb)->tcb_send_mtx, "sctp-send-tcb", "tcbs", \ MTX_DEF | MTX_DUPOK); \ } while (0) #define SCTP_TCB_SEND_LOCK_DESTROY(_tcb) do { \ mtx_destroy(&(_tcb)->tcb_send_mtx); \ } while (0) #define SCTP_TCB_SEND_LOCK(_tcb) do { \ mtx_lock(&(_tcb)->tcb_send_mtx); \ } while (0) #define SCTP_TCB_SEND_UNLOCK(_tcb) do { \ mtx_unlock(&(_tcb)->tcb_send_mtx); \ } while (0) /* * For the majority of things (once we have found the association) we will * lock the actual association mutex. This will protect all the assoiciation * level queues and streams and such. We will need to lock the socket layer * when we stuff data up into the receiving sb_mb. I.e. we will need to do an * extra SOCKBUF_LOCK(&so->so_rcv) even though the association is locked. */ #define SCTP_TCB_LOCK_INIT(_tcb) do { \ mtx_init(&(_tcb)->tcb_mtx, "sctp-tcb", "tcb", \ MTX_DEF | MTX_DUPOK); \ } while (0) #define SCTP_TCB_LOCK_DESTROY(_tcb) do { \ mtx_destroy(&(_tcb)->tcb_mtx); \ } while (0) #ifdef SCTP_LOCK_LOGGING #define SCTP_TCB_LOCK(_tcb) do { \ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ sctp_log_lock(_tcb->sctp_ep, _tcb, SCTP_LOG_LOCK_TCB); \ mtx_lock(&(_tcb)->tcb_mtx); \ } while (0) #else #define SCTP_TCB_LOCK(_tcb) do { \ mtx_lock(&(_tcb)->tcb_mtx); \ } while (0) #endif #define SCTP_TCB_TRYLOCK(_tcb) \ mtx_trylock(&(_tcb)->tcb_mtx) #define SCTP_TCB_UNLOCK(_tcb) do { \ mtx_unlock(&(_tcb)->tcb_mtx); \ } while (0) #define SCTP_TCB_UNLOCK_IFOWNED(_tcb) do { \ if (mtx_owned(&(_tcb)->tcb_mtx)) \ mtx_unlock(&(_tcb)->tcb_mtx); \ } while (0) #define SCTP_TCB_LOCK_ASSERT(_tcb) do { \ KASSERT(mtx_owned(&(_tcb)->tcb_mtx), \ ("Don't own TCB lock")); \ } while (0) #define SCTP_ITERATOR_LOCK_INIT() do { \ mtx_init(&sctp_it_ctl.it_mtx, "sctp-it", "iterator", MTX_DEF); \ } while (0) #define SCTP_ITERATOR_LOCK_DESTROY() do { \ mtx_destroy(&sctp_it_ctl.it_mtx); \ } while (0) #define SCTP_ITERATOR_LOCK() \ do { \ KASSERT(!mtx_owned(&sctp_it_ctl.it_mtx), \ ("Own the iterator lock")); \ mtx_lock(&sctp_it_ctl.it_mtx); \ } while (0) #define SCTP_ITERATOR_UNLOCK() do { \ mtx_unlock(&sctp_it_ctl.it_mtx); \ } while (0) #define SCTP_WQ_ADDR_INIT() do { \ mtx_init(&SCTP_BASE_INFO(wq_addr_mtx), \ "sctp-addr-wq","sctp_addr_wq", MTX_DEF); \ } while (0) #define SCTP_WQ_ADDR_DESTROY() do { \ if (mtx_owned(&SCTP_BASE_INFO(wq_addr_mtx))) { \ mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \ } \ mtx_destroy(&SCTP_BASE_INFO(wq_addr_mtx)); \ } while (0) #define SCTP_WQ_ADDR_LOCK() do { \ mtx_lock(&SCTP_BASE_INFO(wq_addr_mtx)); \ } while (0) #define SCTP_WQ_ADDR_UNLOCK() do { \ mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \ } while (0) #define SCTP_WQ_ADDR_LOCK_ASSERT() do { \ KASSERT(mtx_owned(&SCTP_BASE_INFO(wq_addr_mtx)), \ ("Don't own the ADDR-WQ lock")); \ } while (0) #define SCTP_INCR_EP_COUNT() do { \ atomic_add_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \ } while (0) #define SCTP_DECR_EP_COUNT() do { \ atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \ } while (0) #define SCTP_INCR_ASOC_COUNT() do { \ atomic_add_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \ } while (0) #define SCTP_DECR_ASOC_COUNT() do { \ atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \ } while (0) #define SCTP_INCR_LADDR_COUNT() do { \ atomic_add_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \ } while (0) #define SCTP_DECR_LADDR_COUNT() do { \ atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \ } while (0) #define SCTP_INCR_RADDR_COUNT() do { \ atomic_add_int(&SCTP_BASE_INFO(ipi_count_raddr), 1); \ } while (0) #define SCTP_DECR_RADDR_COUNT() do { \ atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_raddr),1); \ } while (0) #define SCTP_INCR_CHK_COUNT() do { \ atomic_add_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \ } while (0) #define SCTP_DECR_CHK_COUNT() do { \ KASSERT(SCTP_BASE_INFO(ipi_count_chunk) > 0, \ ("ipi_count_chunk would become negative")); \ if (SCTP_BASE_INFO(ipi_count_chunk) != 0) \ atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_chunk), \ 1); \ } while (0) #define SCTP_INCR_READQ_COUNT() do { \ atomic_add_int(&SCTP_BASE_INFO(ipi_count_readq), 1); \ } while (0) #define SCTP_DECR_READQ_COUNT() do { \ atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_readq), 1); \ } while (0) #define SCTP_INCR_STRMOQ_COUNT() do { \ atomic_add_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \ } while (0) #define SCTP_DECR_STRMOQ_COUNT() do { \ atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \ } while (0) #if defined(SCTP_SO_LOCK_TESTING) #define SCTP_INP_SO(sctpinp) \ (sctpinp)->ip_inp.inp.inp_socket #define SCTP_SOCKET_LOCK(so, refcnt) #define SCTP_SOCKET_UNLOCK(so, refcnt) #endif #endif
Upload File
Create Folder