summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2010-09-17 16:20:29 +0000
committertuexen <tuexen@FreeBSD.org>2010-09-17 16:20:29 +0000
commit6397178431575de2cebaeac5bb0c05af09367120 (patch)
treed36d3eccfb211cfb9a886b7e5c2ffc68ef0f32e8
parent1ffadf8af30a4f87946a411641c03dbef4a01bd2 (diff)
downloadFreeBSD-src-6397178431575de2cebaeac5bb0c05af09367120.zip
FreeBSD-src-6397178431575de2cebaeac5bb0c05af09367120.tar.gz
* Implement initial version of send buffer splitting.
* Make send/recv buffer splitting switchable via sysctl. * While there: Fix some comments.
-rw-r--r--sys/netinet/sctp_constants.h3
-rw-r--r--sys/netinet/sctp_output.c19
-rw-r--r--sys/netinet/sctp_sysctl.c7
-rw-r--r--sys/netinet/sctp_sysctl.h13
4 files changed, 36 insertions, 6 deletions
diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h
index 078981d..212a2f9 100644
--- a/sys/netinet/sctp_constants.h
+++ b/sys/netinet/sctp_constants.h
@@ -948,6 +948,9 @@ __FBSDID("$FreeBSD$");
*/
#define SCTP_TIME_WAIT 60
+#define SCTP_SEND_BUFFER_SPLITTING 0x00000001
+#define SCTP_RECV_BUFFER_SPLITTING 0x00000002
+
/* The system retains a cache of free chunks such to
* cut down on calls the memory allocation system. There
* is a per association limit of free items and a overall
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 4d0eb02..5623228 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -7407,7 +7407,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
/* temp arrays for unlinking */
struct sctp_tmit_chunk *data_list[SCTP_MAX_DATA_BUNDLING];
int no_fragmentflg, error;
- unsigned int max_rwnd_per_dest;
+ unsigned int max_rwnd_per_dest, max_send_per_dest;
int one_chunk, hbflag, skip_data_for_this_net;
int asconf, cookie, no_out_cnt;
int bundle_at, ctl_cnt, no_data_chunks, eeor_mode;
@@ -7469,6 +7469,10 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
}
}
max_rwnd_per_dest = ((asoc->peers_rwnd + asoc->total_flight) / asoc->numnets);
+ if (stcb->sctp_socket)
+ max_send_per_dest = SCTP_SB_LIMIT_SND(stcb->sctp_socket) / asoc->numnets;
+ else
+ max_send_per_dest = 0;
if ((no_data_chunks == 0) && (!TAILQ_EMPTY(&asoc->out_wheel))) {
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
/*
@@ -8039,9 +8043,22 @@ again_one_more_time:
goto no_data_fill;
}
if ((asoc->sctp_cmt_on_off == 1) &&
+ (SCTP_BASE_SYSCTL(sctp_buffer_splitting) & SCTP_RECV_BUFFER_SPLITTING) &&
(net->flight_size > max_rwnd_per_dest)) {
goto no_data_fill;
}
+ /*
+ * We need a specific accounting for the usage of the send
+ * buffer. We also need to check the number of messages per
+ * net. For now, this is better than nothing and it disabled
+ * by default...
+ */
+ if ((asoc->sctp_cmt_on_off == 1) &&
+ (SCTP_BASE_SYSCTL(sctp_buffer_splitting) & SCTP_SEND_BUFFER_SPLITTING) &&
+ (max_send_per_dest > 0) &&
+ (net->flight_size > max_send_per_dest)) {
+ goto no_data_fill;
+ }
/*********************/
/* Data transmission */
/*********************/
diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c
index 50fbafd..ef1356c 100644
--- a/sys/netinet/sctp_sysctl.c
+++ b/sys/netinet/sctp_sysctl.c
@@ -109,6 +109,7 @@ sctp_init_sysctls()
SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT;
SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT;
SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT;
+ SCTP_BASE_SYSCTL(sctp_buffer_splitting) = SCTPCTL_BUFFER_SPLITTING_DEFAULT;
#if defined(SCTP_LOCAL_TRACE_BUF)
memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
#endif
@@ -620,7 +621,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX);
-
+ RANGECHK(SCTP_BASE_SYSCTL(sctp_buffer_splitting), SCTPCTL_BUFFER_SPLITTING_MIN, SCTPCTL_BUFFER_SPLITTING_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX);
@@ -1067,6 +1068,10 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, vtag_time_wait, CTLTYPE_INT | CTLFLAG_RW,
&SCTP_BASE_SYSCTL(sctp_vtag_time_wait), 0, sysctl_sctp_check, "IU",
SCTPCTL_TIME_WAIT_DESC);
+SYSCTL_PROC(_net_inet_sctp, OID_AUTO, buffer_splitting, CTLTYPE_INT | CTLFLAG_RW,
+ &SCTP_BASE_SYSCTL(sctp_buffer_splitting), 0, sysctl_sctp_check, "IU",
+ SCTPCTL_BUFFER_SPLITTING_DESC);
+
#ifdef SCTP_DEBUG
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
&SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU",
diff --git a/sys/netinet/sctp_sysctl.h b/sys/netinet/sctp_sysctl.h
index 1140b97..e52f40d 100644
--- a/sys/netinet/sctp_sysctl.h
+++ b/sys/netinet/sctp_sysctl.h
@@ -107,6 +107,7 @@ struct sctp_sysctl {
uint32_t sctp_udp_tunneling_port;
uint32_t sctp_enable_sack_immediately;
uint32_t sctp_vtag_time_wait;
+ uint32_t sctp_buffer_splitting;
#if defined(SCTP_DEBUG)
uint32_t sctp_debug_on;
#endif
@@ -478,19 +479,23 @@ struct sctp_sysctl {
#define SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX 1
#define SCTPCTL_SACK_IMMEDIATELY_ENABLE_DEFAULT SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN
-/* Enable sending of the SACK-IMMEDIATELY bit */
+/* Enable sending of the NAT-FRIENDLY message */
#define SCTPCTL_NAT_FRIENDLY_INITS_DESC "Enable sending of the nat-friendly SCTP option on INITs."
#define SCTPCTL_NAT_FRIENDLY_INITS_MIN 0
#define SCTPCTL_NAT_FRIENDLY_INITS_MAX 1
#define SCTPCTL_NAT_FRIENDLY_INITS_DEFAULT SCTPCTL_NAT_FRIENDLY_INITS_MIN
-
-/* Vtag tiem wait bits */
-#define SCTPCTL_TIME_WAIT_DESC "Vtag time wait time 0 disables."
+/* Vtag time wait in seconds */
+#define SCTPCTL_TIME_WAIT_DESC "Vtag time wait time in seconds, 0 disables it."
#define SCTPCTL_TIME_WAIT_MIN 0
#define SCTPCTL_TIME_WAIT_MAX 0xffffffff
#define SCTPCTL_TIME_WAIT_DEFAULT SCTP_TIME_WAIT
+/* Enable Send/Receive buffer splitting */
+#define SCTPCTL_BUFFER_SPLITTING_DESC "Enable send/receive buffer splitting."
+#define SCTPCTL_BUFFER_SPLITTING_MIN 0
+#define SCTPCTL_BUFFER_SPLITTING_MAX 0x3
+#define SCTPCTL_BUFFER_SPLITTING_DEFAULT SCTPCTL_BUFFER_SPLITTING_MIN
#if defined(SCTP_DEBUG)
/* debug: Configure debug output */
OpenPOWER on IntegriCloud