Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_subr.c
Show First 20 Lines • Show All 587 Lines • ▼ Show 20 Lines | tcp_init(void) | ||||
tcbhash_tuneable = "net.inet.tcp.tcbhashsize"; | tcbhash_tuneable = "net.inet.tcp.tcbhashsize"; | ||||
if (hhook_head_register(HHOOK_TYPE_TCP, HHOOK_TCP_EST_IN, | if (hhook_head_register(HHOOK_TYPE_TCP, HHOOK_TCP_EST_IN, | ||||
&V_tcp_hhh[HHOOK_TCP_EST_IN], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) | &V_tcp_hhh[HHOOK_TCP_EST_IN], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) | ||||
printf("%s: WARNING: unable to register helper hook\n", __func__); | printf("%s: WARNING: unable to register helper hook\n", __func__); | ||||
if (hhook_head_register(HHOOK_TYPE_TCP, HHOOK_TCP_EST_OUT, | if (hhook_head_register(HHOOK_TYPE_TCP, HHOOK_TCP_EST_OUT, | ||||
&V_tcp_hhh[HHOOK_TCP_EST_OUT], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) | &V_tcp_hhh[HHOOK_TCP_EST_OUT], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) | ||||
printf("%s: WARNING: unable to register helper hook\n", __func__); | printf("%s: WARNING: unable to register helper hook\n", __func__); | ||||
/* Setup the tcp function block list */ | |||||
TAILQ_INIT(&t_functions); | |||||
rw_init_flags(&tcp_function_lock, "tcp_func_lock" , 0); | |||||
register_tcp_functions(&tcp_def_funcblk, M_WAITOK); | |||||
hashsize = TCBHASHSIZE; | hashsize = TCBHASHSIZE; | ||||
TUNABLE_INT_FETCH(tcbhash_tuneable, &hashsize); | TUNABLE_INT_FETCH(tcbhash_tuneable, &hashsize); | ||||
if (hashsize == 0) { | if (hashsize == 0) { | ||||
/* | /* | ||||
* Auto tune the hash size based on maxsockets. | * Auto tune the hash size based on maxsockets. | ||||
* A perfect hash would have a 1:1 mapping | * A perfect hash would have a 1:1 mapping | ||||
* (hashsize = maxsockets) however it's been | * (hashsize = maxsockets) however it's been | ||||
* suggested that O(2) average is better. | * suggested that O(2) average is better. | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | tcp_init(void) | ||||
tcp_maxpersistidle = TCPTV_KEEP_IDLE; | tcp_maxpersistidle = TCPTV_KEEP_IDLE; | ||||
tcp_msl = TCPTV_MSL; | tcp_msl = TCPTV_MSL; | ||||
tcp_rexmit_min = TCPTV_MIN; | tcp_rexmit_min = TCPTV_MIN; | ||||
if (tcp_rexmit_min < 1) | if (tcp_rexmit_min < 1) | ||||
tcp_rexmit_min = 1; | tcp_rexmit_min = 1; | ||||
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 */ | |||||
TAILQ_INIT(&t_functions); | |||||
rw_init_flags(&tcp_function_lock, "tcp_func_lock" , 0); | |||||
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; | ||||
#endif /* INET6 */ | #endif /* INET6 */ | ||||
▲ Show 20 Lines • Show All 2,161 Lines • Show Last 20 Lines |