Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_subr.c
Context not available. | |||||
&tcp_sad_low_pps, 100, | &tcp_sad_low_pps, 100, | ||||
"What is the input pps that below which we do not decay?"); | "What is the input pps that below which we do not decay?"); | ||||
#endif | #endif | ||||
uint32_t tcp_ack_war_time_window = 1000; | |||||
SYSCTL_UINT(_net_inet_tcp, OID_AUTO, ack_war_timewindow, | |||||
CTLFLAG_RW, | |||||
&tcp_ack_war_time_window, 1000, | |||||
"If the tcp_stack does ack-war prevention how many milliseconds are in its time window?"); | |||||
uint32_t tcp_ack_war_cnt = 5; | |||||
SYSCTL_UINT(_net_inet_tcp, OID_AUTO, ack_war_cnt, | |||||
CTLFLAG_RW, | |||||
&tcp_ack_war_cnt, 5, | |||||
"If the tcp_stack does ack-war prevention how many acks can be sent in its time window?"); | |||||
struct rwlock tcp_function_lock; | struct rwlock tcp_function_lock; | ||||
Context not available. | |||||
&VNET_NAME(tcp_ts_offset_per_conn), 0, | &VNET_NAME(tcp_ts_offset_per_conn), 0, | ||||
"Initialize TCP timestamps per connection instead of per host pair"); | "Initialize TCP timestamps per connection instead of per host pair"); | ||||
/* How many connections are pacing */ | |||||
static volatile uint32_t number_of_tcp_connections_pacing = 0; | |||||
static uint32_t shadow_num_connections = 0; | |||||
static int tcp_pacing_limit = 10000; | |||||
SYSCTL_INT(_net_inet_tcp, OID_AUTO, pacing_limit, CTLFLAG_RW, | |||||
&tcp_pacing_limit, 1000, | |||||
"If the TCP stack does pacing, is there a limit (-1 = no, 0 = no pacing N = number of connections)"); | |||||
SYSCTL_UINT(_net_inet_tcp, OID_AUTO, pacing_count, CTLFLAG_RD, | |||||
&shadow_num_connections, 0, "Number of TCP connections being paced"); | |||||
static int tcp_log_debug = 0; | static int tcp_log_debug = 0; | ||||
SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_debug, CTLFLAG_RW, | SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_debug, CTLFLAG_RW, | ||||
&tcp_log_debug, 0, "Log errors caused by incoming TCP segments"); | &tcp_log_debug, 0, "Log errors caused by incoming TCP segments"); | ||||
Context not available. | |||||
} | } | ||||
} | } | ||||
} | } | ||||
int | |||||
tcp_can_enable_pacing(void) | |||||
{ | |||||
if ((tcp_pacing_limit == -1) || | |||||
(tcp_pacing_limit > number_of_tcp_connections_pacing)) { | |||||
atomic_fetchadd_int(&number_of_tcp_connections_pacing, 1); | |||||
shadow_num_connections = number_of_tcp_connections_pacing; | |||||
return (1); | |||||
} else { | |||||
return (0); | |||||
} | |||||
} | |||||
static uint8_t tcp_pacing_warning = 0; | |||||
void | |||||
tcp_decrement_paced_conn(void) | |||||
{ | |||||
uint32_t ret; | |||||
ret = atomic_fetchadd_int(&number_of_tcp_connections_pacing, -1); | |||||
shadow_num_connections = number_of_tcp_connections_pacing; | |||||
KASSERT(ret != 0, ("tcp_paced_connection_exits -1 would cause wrap?")); | |||||
if (ret == 0) { | |||||
if (tcp_pacing_limit != -1) { | |||||
printf("Warning all pacing is now disabled, count decrements invalidly!\n"); | |||||
tcp_pacing_limit = 0; | |||||
} else if (tcp_pacing_warning == 0) { | |||||
printf("Warning pacing count is invalid, invalid decrement\n"); | |||||
tcp_pacing_warning = 1; | |||||
} | |||||
} | |||||
} | |||||
Context not available. |