2006-11-03 15:23:16 +00:00
|
|
|
/*-
|
2008-12-06 13:19:54 +00:00
|
|
|
* Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
|
2012-05-23 11:26:28 +00:00
|
|
|
* Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
|
|
|
|
* Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
|
2006-11-03 15:23:16 +00:00
|
|
|
*
|
|
|
|
* 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,
|
2011-12-17 19:21:40 +00:00
|
|
|
* this list of conditions and the following disclaimer.
|
2006-11-03 15:23:16 +00:00
|
|
|
*
|
|
|
|
* b) Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
2011-12-17 19:21:40 +00:00
|
|
|
* the documentation and/or other materials provided with the distribution.
|
2006-11-03 15:23:16 +00:00
|
|
|
*
|
|
|
|
* 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_VAR_H_
|
|
|
|
#define _NETINET_SCTP_VAR_H_
|
|
|
|
|
|
|
|
#include <netinet/sctp_uio.h>
|
|
|
|
|
2008-07-09 16:45:30 +00:00
|
|
|
#if defined(_KERNEL) || defined(__Userspace__)
|
2006-11-03 15:23:16 +00:00
|
|
|
|
|
|
|
extern struct pr_usrreqs sctp_usrreqs;
|
|
|
|
|
|
|
|
|
|
|
|
#define sctp_feature_on(inp, feature) (inp->sctp_features |= feature)
|
|
|
|
#define sctp_feature_off(inp, feature) (inp->sctp_features &= ~feature)
|
2008-07-31 11:08:30 +00:00
|
|
|
#define sctp_is_feature_on(inp, feature) ((inp->sctp_features & feature) == feature)
|
2006-11-03 15:23:16 +00:00
|
|
|
#define sctp_is_feature_off(inp, feature) ((inp->sctp_features & feature) == 0)
|
|
|
|
|
2011-06-15 23:50:27 +00:00
|
|
|
#define sctp_stcb_feature_on(inp, stcb, feature) {\
|
|
|
|
if (stcb) { \
|
|
|
|
stcb->asoc.sctp_features |= feature; \
|
2011-12-27 10:16:24 +00:00
|
|
|
} else if (inp) { \
|
2011-06-15 23:50:27 +00:00
|
|
|
inp->sctp_features |= feature; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define sctp_stcb_feature_off(inp, stcb, feature) {\
|
|
|
|
if (stcb) { \
|
|
|
|
stcb->asoc.sctp_features &= ~feature; \
|
2011-12-27 10:16:24 +00:00
|
|
|
} else if (inp) { \
|
2011-06-15 23:50:27 +00:00
|
|
|
inp->sctp_features &= ~feature; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define sctp_stcb_is_feature_on(inp, stcb, feature) \
|
|
|
|
(((stcb != NULL) && \
|
|
|
|
((stcb->asoc.sctp_features & feature) == feature)) || \
|
2011-12-27 10:16:24 +00:00
|
|
|
((stcb == NULL) && (inp != NULL) && \
|
2011-06-15 23:50:27 +00:00
|
|
|
((inp->sctp_features & feature) == feature)))
|
|
|
|
#define sctp_stcb_is_feature_off(inp, stcb, feature) \
|
|
|
|
(((stcb != NULL) && \
|
|
|
|
((stcb->asoc.sctp_features & feature) == 0)) || \
|
2011-12-27 10:16:24 +00:00
|
|
|
((stcb == NULL) && (inp != NULL) && \
|
|
|
|
((inp->sctp_features & feature) == 0)) || \
|
2014-07-11 21:15:40 +00:00
|
|
|
((stcb == NULL) && (inp == NULL)))
|
2008-07-31 11:08:30 +00:00
|
|
|
|
2007-08-27 05:19:48 +00:00
|
|
|
/* managing mobility_feature in inpcb (by micchie) */
|
|
|
|
#define sctp_mobility_feature_on(inp, feature) (inp->sctp_mobility_features |= feature)
|
|
|
|
#define sctp_mobility_feature_off(inp, feature) (inp->sctp_mobility_features &= ~feature)
|
|
|
|
#define sctp_is_mobility_feature_on(inp, feature) (inp->sctp_mobility_features & feature)
|
|
|
|
#define sctp_is_mobility_feature_off(inp, feature) ((inp->sctp_mobility_features & feature) == 0)
|
|
|
|
|
2007-10-01 03:22:29 +00:00
|
|
|
#define sctp_maxspace(sb) (max((sb)->sb_hiwat,SCTP_MINIMAL_RWND))
|
2006-11-03 15:23:16 +00:00
|
|
|
|
2014-12-02 20:29:29 +00:00
|
|
|
#define sctp_sbspace(asoc, sb) ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0))
|
2007-10-01 03:22:29 +00:00
|
|
|
|
2014-12-02 20:29:29 +00:00
|
|
|
#define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0))
|
2006-11-03 15:23:16 +00:00
|
|
|
|
|
|
|
#define sctp_sbspace_sub(a,b) ((a > b) ? (a - b) : 0)
|
|
|
|
|
2007-03-15 11:27:14 +00:00
|
|
|
/*
|
|
|
|
* I tried to cache the readq entries at one point. But the reality
|
|
|
|
* is that it did not add any performance since this meant we had to
|
|
|
|
* lock the STCB on read. And at that point once you have to do an
|
|
|
|
* extra lock, it really does not matter if the lock is in the ZONE
|
|
|
|
* stuff or in our code. Note that this same problem would occur with
|
|
|
|
* an mbuf cache as well so it is not really worth doing, at least
|
|
|
|
* right now :-D
|
2006-11-03 15:23:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define sctp_free_a_readq(_stcb, _readq) { \
|
2008-06-14 07:58:05 +00:00
|
|
|
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \
|
2007-02-12 23:24:31 +00:00
|
|
|
SCTP_DECR_READQ_COUNT(); \
|
2006-11-03 15:23:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define sctp_alloc_a_readq(_stcb, _readq) { \
|
2008-06-14 07:58:05 +00:00
|
|
|
(_readq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_readq), struct sctp_queued_to_read); \
|
2006-11-03 15:23:16 +00:00
|
|
|
if ((_readq)) { \
|
2014-07-11 21:15:40 +00:00
|
|
|
SCTP_INCR_READQ_COUNT(); \
|
2006-11-03 15:23:16 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2011-05-08 09:11:59 +00:00
|
|
|
#define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked) { \
|
2008-12-06 13:19:54 +00:00
|
|
|
if ((_strmoq)->holds_key_ref) { \
|
2011-05-08 09:11:59 +00:00
|
|
|
sctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \
|
2008-12-06 13:19:54 +00:00
|
|
|
(_strmoq)->holds_key_ref = 0; \
|
|
|
|
} \
|
2008-06-14 07:58:05 +00:00
|
|
|
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \
|
2007-04-19 11:28:43 +00:00
|
|
|
SCTP_DECR_STRMOQ_COUNT(); \
|
2006-11-03 15:23:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define sctp_alloc_a_strmoq(_stcb, _strmoq) { \
|
2008-06-14 07:58:05 +00:00
|
|
|
(_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \
|
2014-07-11 21:15:40 +00:00
|
|
|
if ((_strmoq)) { \
|
2009-03-14 13:42:13 +00:00
|
|
|
memset(_strmoq, 0, sizeof(struct sctp_stream_queue_pending)); \
|
2007-04-19 11:28:43 +00:00
|
|
|
SCTP_INCR_STRMOQ_COUNT(); \
|
2008-12-06 13:19:54 +00:00
|
|
|
(_strmoq)->holds_key_ref = 0; \
|
2014-07-11 21:15:40 +00:00
|
|
|
} \
|
2006-11-03 15:23:16 +00:00
|
|
|
}
|
|
|
|
|
2011-05-08 09:11:59 +00:00
|
|
|
#define sctp_free_a_chunk(_stcb, _chk, _so_locked) { \
|
2008-12-06 13:19:54 +00:00
|
|
|
if ((_chk)->holds_key_ref) {\
|
2011-05-08 09:11:59 +00:00
|
|
|
sctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \
|
2008-12-06 13:19:54 +00:00
|
|
|
(_chk)->holds_key_ref = 0; \
|
|
|
|
} \
|
2014-07-11 21:15:40 +00:00
|
|
|
if (_stcb) { \
|
|
|
|
SCTP_TCB_LOCK_ASSERT((_stcb)); \
|
|
|
|
if ((_chk)->whoTo) { \
|
|
|
|
sctp_free_remote_addr((_chk)->whoTo); \
|
|
|
|
(_chk)->whoTo = NULL; \
|
|
|
|
} \
|
|
|
|
if (((_stcb)->asoc.free_chunk_cnt > SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit)) || \
|
|
|
|
(SCTP_BASE_INFO(ipi_free_chunks) > SCTP_BASE_SYSCTL(sctp_system_free_resc_limit))) { \
|
|
|
|
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \
|
|
|
|
SCTP_DECR_CHK_COUNT(); \
|
|
|
|
} else { \
|
|
|
|
TAILQ_INSERT_TAIL(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \
|
|
|
|
(_stcb)->asoc.free_chunk_cnt++; \
|
|
|
|
atomic_add_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \
|
|
|
|
} \
|
|
|
|
} else { \
|
2008-06-14 07:58:05 +00:00
|
|
|
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \
|
2006-11-03 15:23:16 +00:00
|
|
|
SCTP_DECR_CHK_COUNT(); \
|
2007-02-12 23:24:31 +00:00
|
|
|
} \
|
2006-11-03 15:23:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define sctp_alloc_a_chunk(_stcb, _chk) { \
|
2012-04-19 15:30:15 +00:00
|
|
|
if (TAILQ_EMPTY(&(_stcb)->asoc.free_chunks)) { \
|
2008-06-14 07:58:05 +00:00
|
|
|
(_chk) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_chunk), struct sctp_tmit_chunk); \
|
2007-02-12 23:24:31 +00:00
|
|
|
if ((_chk)) { \
|
|
|
|
SCTP_INCR_CHK_COUNT(); \
|
2014-07-11 21:15:40 +00:00
|
|
|
(_chk)->whoTo = NULL; \
|
2008-12-06 13:19:54 +00:00
|
|
|
(_chk)->holds_key_ref = 0; \
|
2007-02-12 23:24:31 +00:00
|
|
|
} \
|
|
|
|
} else { \
|
|
|
|
(_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \
|
|
|
|
TAILQ_REMOVE(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \
|
2008-06-14 07:58:05 +00:00
|
|
|
atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \
|
2008-12-06 13:19:54 +00:00
|
|
|
(_chk)->holds_key_ref = 0; \
|
2014-07-11 21:15:40 +00:00
|
|
|
SCTP_STAT_INCR(sctps_cached_chk); \
|
2007-02-12 23:24:31 +00:00
|
|
|
(_stcb)->asoc.free_chunk_cnt--; \
|
2006-11-03 15:23:16 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define sctp_free_remote_addr(__net) { \
|
2007-03-15 11:27:14 +00:00
|
|
|
if ((__net)) { \
|
2008-12-06 13:19:54 +00:00
|
|
|
if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \
|
2007-05-08 14:32:53 +00:00
|
|
|
(void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \
|
|
|
|
(void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \
|
2014-07-11 21:15:40 +00:00
|
|
|
if ((__net)->ro.ro_rt) { \
|
2007-03-15 11:27:14 +00:00
|
|
|
RTFREE((__net)->ro.ro_rt); \
|
|
|
|
(__net)->ro.ro_rt = NULL; \
|
2014-07-11 21:15:40 +00:00
|
|
|
} \
|
2007-03-15 11:27:14 +00:00
|
|
|
if ((__net)->src_addr_selected) { \
|
|
|
|
sctp_free_ifa((__net)->ro._s_addr); \
|
|
|
|
(__net)->ro._s_addr = NULL; \
|
|
|
|
} \
|
2014-07-11 21:15:40 +00:00
|
|
|
(__net)->src_addr_selected = 0; \
|
2011-08-03 20:21:00 +00:00
|
|
|
(__net)->dest_state &= ~SCTP_ADDR_REACHABLE; \
|
2008-06-14 07:58:05 +00:00
|
|
|
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \
|
2006-11-03 15:23:16 +00:00
|
|
|
SCTP_DECR_RADDR_COUNT(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define sctp_sbfree(ctl, stcb, sb, m) { \
|
2014-12-02 20:29:29 +00:00
|
|
|
SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \
|
2008-12-06 13:19:54 +00:00
|
|
|
SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \
|
2007-02-12 23:24:31 +00:00
|
|
|
if (((ctl)->do_not_ref_stcb == 0) && stcb) {\
|
2014-12-02 20:29:29 +00:00
|
|
|
SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
|
2008-12-06 13:19:54 +00:00
|
|
|
SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
|
2007-02-12 23:24:31 +00:00
|
|
|
} \
|
2006-12-29 20:21:42 +00:00
|
|
|
if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \
|
|
|
|
SCTP_BUF_TYPE(m) != MT_OOBDATA) \
|
|
|
|
atomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \
|
2006-11-03 15:23:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define sctp_sballoc(stcb, sb, m) { \
|
2014-12-02 20:29:29 +00:00
|
|
|
atomic_add_int(&(sb)->sb_cc,SCTP_BUF_LEN((m))); \
|
2006-11-03 15:23:16 +00:00
|
|
|
atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \
|
2007-02-12 23:24:31 +00:00
|
|
|
if (stcb) { \
|
2014-12-02 20:29:29 +00:00
|
|
|
atomic_add_int(&(stcb)->asoc.sb_cc,SCTP_BUF_LEN((m))); \
|
2007-08-24 00:53:53 +00:00
|
|
|
atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
|
2007-02-12 23:24:31 +00:00
|
|
|
} \
|
2006-12-29 20:21:42 +00:00
|
|
|
if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \
|
|
|
|
SCTP_BUF_TYPE(m) != MT_OOBDATA) \
|
|
|
|
atomic_add_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \
|
2006-11-03 15:23:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define sctp_ucount_incr(val) { \
|
|
|
|
val++; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define sctp_ucount_decr(val) { \
|
|
|
|
if (val > 0) { \
|
|
|
|
val--; \
|
|
|
|
} else { \
|
|
|
|
val = 0; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define sctp_mbuf_crush(data) do { \
|
2007-02-12 23:24:31 +00:00
|
|
|
struct mbuf *_m; \
|
|
|
|
_m = (data); \
|
2011-12-27 10:16:24 +00:00
|
|
|
while (_m && (SCTP_BUF_LEN(_m) == 0)) { \
|
2007-02-12 23:24:31 +00:00
|
|
|
(data) = SCTP_BUF_NEXT(_m); \
|
|
|
|
SCTP_BUF_NEXT(_m) = NULL; \
|
|
|
|
sctp_m_free(_m); \
|
2006-11-03 15:23:16 +00:00
|
|
|
_m = (data); \
|
2007-02-12 23:24:31 +00:00
|
|
|
} \
|
2006-11-03 15:23:16 +00:00
|
|
|
} while (0)
|
|
|
|
|
2007-04-14 09:44:09 +00:00
|
|
|
#define sctp_flight_size_decrease(tp1) do { \
|
|
|
|
if (tp1->whoTo->flight_size >= tp1->book_size) \
|
|
|
|
tp1->whoTo->flight_size -= tp1->book_size; \
|
|
|
|
else \
|
|
|
|
tp1->whoTo->flight_size = 0; \
|
|
|
|
} while (0)
|
|
|
|
|
2007-07-14 09:36:28 +00:00
|
|
|
#define sctp_flight_size_increase(tp1) do { \
|
2014-07-11 21:15:40 +00:00
|
|
|
(tp1)->whoTo->flight_size += (tp1)->book_size; \
|
2007-07-14 09:36:28 +00:00
|
|
|
} while (0)
|
2007-04-14 09:44:09 +00:00
|
|
|
|
2007-07-14 09:36:28 +00:00
|
|
|
#ifdef SCTP_FS_SPEC_LOG
|
2007-04-14 09:44:09 +00:00
|
|
|
#define sctp_total_flight_decrease(stcb, tp1) do { \
|
2014-07-11 21:15:40 +00:00
|
|
|
if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \
|
2007-07-14 09:36:28 +00:00
|
|
|
stcb->asoc.fs_index = 0;\
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].incr = 0; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].decr = 1; \
|
|
|
|
stcb->asoc.fs_index++; \
|
2014-07-11 21:15:40 +00:00
|
|
|
tp1->window_probe = 0; \
|
2007-04-14 09:44:09 +00:00
|
|
|
if (stcb->asoc.total_flight >= tp1->book_size) { \
|
|
|
|
stcb->asoc.total_flight -= tp1->book_size; \
|
|
|
|
if (stcb->asoc.total_flight_count > 0) \
|
|
|
|
stcb->asoc.total_flight_count--; \
|
|
|
|
} else { \
|
|
|
|
stcb->asoc.total_flight = 0; \
|
|
|
|
stcb->asoc.total_flight_count = 0; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2007-07-14 09:36:28 +00:00
|
|
|
#define sctp_total_flight_increase(stcb, tp1) do { \
|
2014-07-11 21:15:40 +00:00
|
|
|
if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \
|
2007-07-14 09:36:28 +00:00
|
|
|
stcb->asoc.fs_index = 0;\
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].incr = 1; \
|
|
|
|
stcb->asoc.fslog[stcb->asoc.fs_index].decr = 0; \
|
|
|
|
stcb->asoc.fs_index++; \
|
2014-07-11 21:15:40 +00:00
|
|
|
(stcb)->asoc.total_flight_count++; \
|
|
|
|
(stcb)->asoc.total_flight += (tp1)->book_size; \
|
2007-04-14 09:44:09 +00:00
|
|
|
} while (0)
|
|
|
|
|
2007-07-14 09:36:28 +00:00
|
|
|
#else
|
2007-04-14 09:44:09 +00:00
|
|
|
|
|
|
|
#define sctp_total_flight_decrease(stcb, tp1) do { \
|
2014-07-11 21:15:40 +00:00
|
|
|
tp1->window_probe = 0; \
|
2007-04-14 09:44:09 +00:00
|
|
|
if (stcb->asoc.total_flight >= tp1->book_size) { \
|
|
|
|
stcb->asoc.total_flight -= tp1->book_size; \
|
|
|
|
if (stcb->asoc.total_flight_count > 0) \
|
|
|
|
stcb->asoc.total_flight_count--; \
|
|
|
|
} else { \
|
2007-07-14 09:36:28 +00:00
|
|
|
stcb->asoc.total_flight = 0; \
|
|
|
|
stcb->asoc.total_flight_count = 0; \
|
2007-04-14 09:44:09 +00:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define sctp_total_flight_increase(stcb, tp1) do { \
|
2014-07-11 21:15:40 +00:00
|
|
|
(stcb)->asoc.total_flight_count++; \
|
|
|
|
(stcb)->asoc.total_flight += (tp1)->book_size; \
|
2007-04-14 09:44:09 +00:00
|
|
|
} while (0)
|
2006-11-03 15:23:16 +00:00
|
|
|
|
2007-07-14 09:36:28 +00:00
|
|
|
#endif
|
|
|
|
|
2011-08-03 20:21:00 +00:00
|
|
|
#define SCTP_PF_ENABLED(_net) (_net->pf_threshold < _net->failure_threshold)
|
|
|
|
#define SCTP_NET_IS_PF(_net) (_net->pf_threshold < _net->error_count)
|
2007-08-24 00:53:53 +00:00
|
|
|
|
2006-11-03 15:23:16 +00:00
|
|
|
struct sctp_nets;
|
|
|
|
struct sctp_inpcb;
|
|
|
|
struct sctp_tcb;
|
|
|
|
struct sctphdr;
|
|
|
|
|
2007-08-27 05:19:48 +00:00
|
|
|
|
|
|
|
void sctp_close(struct socket *so);
|
|
|
|
int sctp_disconnect(struct socket *so);
|
2012-10-22 21:49:56 +00:00
|
|
|
void sctp_ctlinput(int, struct sockaddr *, void *);
|
|
|
|
int sctp_ctloutput(struct socket *, struct sockopt *);
|
2011-04-30 11:18:16 +00:00
|
|
|
|
|
|
|
#ifdef INET
|
2012-10-22 21:49:56 +00:00
|
|
|
void sctp_input_with_port(struct mbuf *, int, uint16_t);
|
2014-08-08 01:57:15 +00:00
|
|
|
int sctp_input(struct mbuf **, int *, int);
|
2011-04-30 11:18:16 +00:00
|
|
|
|
|
|
|
#endif
|
2012-10-22 21:49:56 +00:00
|
|
|
void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t);
|
|
|
|
void sctp_drain(void);
|
|
|
|
void sctp_init(void);
|
2008-06-14 07:58:05 +00:00
|
|
|
void sctp_finish(void);
|
2008-04-14 18:13:33 +00:00
|
|
|
int sctp_flush(struct socket *, int);
|
2012-10-22 21:49:56 +00:00
|
|
|
int sctp_shutdown(struct socket *);
|
2012-10-29 20:47:32 +00:00
|
|
|
void
|
|
|
|
sctp_notify(struct sctp_inpcb *, struct ip *ip, struct sctphdr *,
|
2006-11-03 15:23:16 +00:00
|
|
|
struct sockaddr *, struct sctp_tcb *,
|
2012-10-22 21:49:56 +00:00
|
|
|
struct sctp_nets *);
|
2012-10-29 20:47:32 +00:00
|
|
|
int
|
|
|
|
sctp_bindx(struct socket *, int, struct sockaddr_storage *,
|
|
|
|
int, int, struct proc *);
|
2006-11-03 15:23:16 +00:00
|
|
|
|
|
|
|
/* can't use sctp_assoc_t here */
|
2012-10-29 20:47:32 +00:00
|
|
|
int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *);
|
|
|
|
int sctp_ingetaddr(struct socket *, struct sockaddr **);
|
|
|
|
int sctp_peeraddr(struct socket *, struct sockaddr **);
|
|
|
|
int sctp_listen(struct socket *, int, struct thread *);
|
|
|
|
int sctp_accept(struct socket *, struct sockaddr **);
|
2006-11-03 15:23:16 +00:00
|
|
|
|
|
|
|
#endif /* _KERNEL */
|
|
|
|
|
|
|
|
#endif /* !_NETINET_SCTP_VAR_H_ */
|