tcp: allocate statistics in the main tcp_init()
No reason to have a separate SYSINIT.
This commit is contained in:
parent
fff0ae77b9
commit
75add59a8e
@ -258,28 +258,6 @@ SYSCTL_COUNTER_U64_ARRAY(_net_inet_tcp, TCPCTL_STATES, states, CTLFLAG_RD |
|
||||
CTLFLAG_VNET, &VNET_NAME(tcps_states)[0], TCP_NSTATES,
|
||||
"TCP connection counts by TCP state");
|
||||
|
||||
static void
|
||||
tcp_vnet_init(const void *unused)
|
||||
{
|
||||
|
||||
COUNTER_ARRAY_ALLOC(V_tcps_states, TCP_NSTATES, M_WAITOK);
|
||||
VNET_PCPUSTAT_ALLOC(tcpstat, M_WAITOK);
|
||||
}
|
||||
VNET_SYSINIT(tcp_vnet_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
|
||||
tcp_vnet_init, NULL);
|
||||
|
||||
#ifdef VIMAGE
|
||||
static void
|
||||
tcp_vnet_uninit(const void *unused)
|
||||
{
|
||||
|
||||
COUNTER_ARRAY_FREE(V_tcps_states, TCP_NSTATES);
|
||||
VNET_PCPUSTAT_FREE(tcpstat);
|
||||
}
|
||||
VNET_SYSUNINIT(tcp_vnet_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
|
||||
tcp_vnet_uninit, NULL);
|
||||
#endif /* VIMAGE */
|
||||
|
||||
/*
|
||||
* Kernel module interface for updating tcpstat. The first argument is an index
|
||||
* into tcpstat treated as an array.
|
||||
|
@ -1503,6 +1503,9 @@ tcp_init(void)
|
||||
|
||||
tcp_fastopen_init();
|
||||
|
||||
COUNTER_ARRAY_ALLOC(V_tcps_states, TCP_NSTATES, M_WAITOK);
|
||||
VNET_PCPUSTAT_ALLOC(tcpstat, M_WAITOK);
|
||||
|
||||
/* Skip initialization of globals for non-default instances. */
|
||||
if (!IS_DEFAULT_VNET(curvnet))
|
||||
return;
|
||||
@ -1614,6 +1617,9 @@ tcp_destroy(void *unused __unused)
|
||||
*/
|
||||
tcp_fastopen_destroy();
|
||||
|
||||
COUNTER_ARRAY_FREE(V_tcps_states, TCP_NSTATES);
|
||||
VNET_PCPUSTAT_FREE(tcpstat);
|
||||
|
||||
#ifdef TCP_HHOOK
|
||||
error = hhook_head_deregister(V_tcp_hhh[HHOOK_TCP_EST_IN]);
|
||||
if (error != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user