Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_subr.c
Show First 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | static struct tcp_function_block tcp_def_funcblk = { | ||||
NULL, | NULL, | ||||
NULL, | NULL, | ||||
NULL, | NULL, | ||||
NULL, | NULL, | ||||
0, | 0, | ||||
0 | 0 | ||||
}; | }; | ||||
int t_functions_inited = 0; | |||||
struct tcp_funchead t_functions; | struct tcp_funchead t_functions; | ||||
static struct tcp_function_block *tcp_func_set_ptr = &tcp_def_funcblk; | static struct tcp_function_block *tcp_func_set_ptr = &tcp_def_funcblk; | ||||
static void | |||||
init_tcp_functions() | |||||
{ | |||||
if (t_functions_inited == 0) { | |||||
TAILQ_INIT(&t_functions); | |||||
rw_init_flags(&tcp_function_lock, "tcp_func_lock" , 0); | |||||
t_functions_inited = 1; | |||||
} | |||||
} | |||||
static struct tcp_function_block * | static struct tcp_function_block * | ||||
find_tcp_functions_locked(struct tcp_function_set *fs) | find_tcp_functions_locked(struct tcp_function_set *fs) | ||||
{ | { | ||||
struct tcp_function *f; | struct tcp_function *f; | ||||
struct tcp_function_block *blk=NULL; | struct tcp_function_block *blk=NULL; | ||||
TAILQ_FOREACH(f, &t_functions, tf_next) { | TAILQ_FOREACH(f, &t_functions, tf_next) { | ||||
if (strcmp(f->tf_fb->tfb_tcp_block_name, fs->function_set_name) == 0) { | if (strcmp(f->tf_fb->tfb_tcp_block_name, fs->function_set_name) == 0) { | ||||
▲ Show 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
register_tcp_functions(struct tcp_function_block *blk, int wait) | register_tcp_functions(struct tcp_function_block *blk, int wait) | ||||
{ | { | ||||
struct tcp_function_block *lblk; | struct tcp_function_block *lblk; | ||||
struct tcp_function *n; | struct tcp_function *n; | ||||
struct tcp_function_set fs; | struct tcp_function_set fs; | ||||
if (t_functions_inited == 0) { | |||||
init_tcp_functions(); | |||||
} | |||||
if ((blk->tfb_tcp_output == NULL) || | if ((blk->tfb_tcp_output == NULL) || | ||||
(blk->tfb_tcp_do_segment == NULL) || | (blk->tfb_tcp_do_segment == NULL) || | ||||
(blk->tfb_tcp_ctloutput == NULL) || | (blk->tfb_tcp_ctloutput == NULL) || | ||||
(strlen(blk->tfb_tcp_block_name) == 0)) { | (strlen(blk->tfb_tcp_block_name) == 0)) { | ||||
/* | /* | ||||
* These functions are required and you | * These functions are required and you | ||||
* need a name. | * need a name. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | tcp_init(void) | ||||
if (tcp_rexmit_min < 1) | if (tcp_rexmit_min < 1) | ||||
tcp_rexmit_min = 1; | tcp_rexmit_min = 1; | ||||
tcp_persmin = TCPTV_PERSMIN; | tcp_persmin = TCPTV_PERSMIN; | ||||
tcp_persmax = TCPTV_PERSMAX; | tcp_persmax = TCPTV_PERSMAX; | ||||
tcp_rexmit_slop = TCPTV_CPU_VAR; | tcp_rexmit_slop = TCPTV_CPU_VAR; | ||||
tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT; | tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT; | ||||
tcp_tcbhashsize = hashsize; | tcp_tcbhashsize = hashsize; | ||||
/* Setup the tcp function block list */ | /* Setup the tcp function block list */ | ||||
TAILQ_INIT(&t_functions); | init_tcp_functions(); | ||||
rw_init_flags(&tcp_function_lock, "tcp_func_lock" , 0); | |||||
register_tcp_functions(&tcp_def_funcblk, M_WAITOK); | register_tcp_functions(&tcp_def_funcblk, M_WAITOK); | ||||
if (tcp_soreceive_stream) { | if (tcp_soreceive_stream) { | ||||
#ifdef INET | #ifdef INET | ||||
tcp_usrreqs.pru_soreceive = soreceive_stream; | tcp_usrreqs.pru_soreceive = soreceive_stream; | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
tcp6_usrreqs.pru_soreceive = soreceive_stream; | tcp6_usrreqs.pru_soreceive = soreceive_stream; | ||||
▲ Show 20 Lines • Show All 2,226 Lines • Show Last 20 Lines |