/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include "sctp_impl.h"
/* Control whether SCTP can enter defensive mode when under memory pressure. */
static void sctp_reclaim_timer(void *);
/* Diagnostic routine used to return a string associated with the sctp state. */
char *
{
char *buf;
char *cp;
return ("NULL_SCTP");
switch (sctp->sctp_state) {
case SCTPS_IDLE:
cp = "SCTP_IDLE";
break;
case SCTPS_BOUND:
cp = "SCTP_BOUND";
break;
case SCTPS_LISTEN:
cp = "SCTP_LISTEN";
break;
case SCTPS_COOKIE_WAIT:
cp = "SCTP_COOKIE_WAIT";
break;
case SCTPS_COOKIE_ECHOED:
cp = "SCTP_COOKIE_ECHOED";
break;
case SCTPS_ESTABLISHED:
cp = "SCTP_ESTABLISHED";
break;
case SCTPS_SHUTDOWN_PENDING:
cp = "SCTP_SHUTDOWN_PENDING";
break;
case SCTPS_SHUTDOWN_SENT:
cp = "SCTPS_SHUTDOWN_SENT";
break;
case SCTPS_SHUTDOWN_RECEIVED:
cp = "SCTPS_SHUTDOWN_RECEIVED";
break;
case SCTPS_SHUTDOWN_ACK_SENT:
cp = "SCTPS_SHUTDOWN_ACK_SENT";
break;
default:
break;
}
return (buf);
}
void
{
sctp_walker != NULL;
sctp_walker)) {
}
}
/*
* Given a sctp_stack_t and a port (in host byte order), find a listener
* configuration for that port and return the ratio.
*/
{
break;
}
}
return (ratio);
}
/*
* To remove all listener limit configuration in a sctp_stack_t.
*/
void
{
}
}
/*
* Timeout function to reset the SCTP stack variable sctps_reclaim to false.
*/
static void
{
int i;
for (i = 0; i < sctps->sctps_sc_cnt; i++)
/*
* This happens only when a stack is going away. sctps_reclaim_tid
* should not be reset to 0 when returning in this case.
*/
if (!sctps->sctps_reclaim) {
return;
}
sctps->sctps_reclaim_tid = 0;
} else {
/* Stay in defensive mode and restart the timer */
}
}
/*
* Kmem reclaim call back function. When the system is under memory
* pressure, we set the SCTP stack variable sctps_reclaim to true. This
* variable is reset to false after sctps_reclaim_period msecs. During this
* period, SCTP will be more aggressive in aborting connections not making
* progress, meaning retransmitting for shorter time (sctp_pa_early_abort/
* sctp_pp_early_abort number of strikes).
*/
/* ARGSUSED */
void
{
if (!sctp_do_reclaim)
return;
/*
* The reclaim function may be called even when the system is not
* really under memory pressure.
*/
return;
int i;
/*
* During boot time, the first netstack_t is created and
* initialized before SCTP has registered with the netstack
* framework. If this reclaim function is called before SCTP
* has finished its initialization, netstack_next() will
* return the first netstack_t (since its netstack_flags is
* not NSF_UNINIT). And its netstack_sctp will be NULL. We
* need to catch it.
*
* All subsequent netstack_t creation will not have this
* problem since the initialization is not finished until SCTP
* has finished its own sctp_stack_t initialization. Hence
* netstack_next() will not return one with NULL netstack_sctp.
*/
continue;
}
/*
* Even if the system is under memory pressure, the reason may
* not be because of SCTP activity. Check the number of
* associations in each stack. If the number exceeds the
* threshold (maxusers), turn on defensive mode.
*/
for (i = 0; i < sctps->sctps_sc_cnt; i++)
continue;
}
if (!sctps->sctps_reclaim) {
}
}
}
/*
* When a CPU is added, we need to allocate the per CPU stats struct.
*/
void
{
int i;
return;
KM_SLEEP);
}
}