Tiny refactor of r294869/r296881: use defines to mask the VNET() macro.

Suggested by:	bz
This commit is contained in:
Gleb Smirnoff 2016-05-17 23:14:17 +00:00
parent 0ac974ec78
commit f59d975e10
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300096
3 changed files with 7 additions and 6 deletions

View File

@ -250,7 +250,7 @@ static void
tcp_vnet_init(const void *unused)
{
COUNTER_ARRAY_ALLOC(VNET(tcps_states), TCP_NSTATES, M_WAITOK);
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,
@ -261,7 +261,7 @@ static void
tcp_vnet_uninit(const void *unused)
{
COUNTER_ARRAY_FREE(VNET(tcps_states), TCP_NSTATES);
COUNTER_ARRAY_FREE(V_tcps_states, TCP_NSTATES);
VNET_PCPUSTAT_FREE(tcpstat);
}
VNET_SYSUNINIT(tcp_vnet_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,

View File

@ -1642,7 +1642,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
*/
if (req->oldptr == NULL) {
n = V_tcbinfo.ipi_count +
counter_u64_fetch(VNET(tcps_states)[TCPS_SYN_RECEIVED]);
counter_u64_fetch(V_tcps_states[TCPS_SYN_RECEIVED]);
n += imax(n / 8, 10);
req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xtcpcb);
return (0);
@ -1659,7 +1659,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
n = V_tcbinfo.ipi_count;
INP_LIST_RUNLOCK(&V_tcbinfo);
m = counter_u64_fetch(VNET(tcps_states)[TCPS_SYN_RECEIVED]);
m = counter_u64_fetch(V_tcps_states[TCPS_SYN_RECEIVED]);
error = sysctl_wire_old_buffer(req, 2 * (sizeof xig)
+ (n + m) * sizeof(struct xtcpcb));

View File

@ -629,8 +629,9 @@ void kmod_tcpstat_inc(int statnum);
* Running TCP connection count by state.
*/
VNET_DECLARE(counter_u64_t, tcps_states[TCP_NSTATES]);
#define TCPSTATES_INC(state) counter_u64_add(VNET(tcps_states)[state], 1)
#define TCPSTATES_DEC(state) counter_u64_add(VNET(tcps_states)[state], -1)
#define V_tcps_states VNET(tcps_states)
#define TCPSTATES_INC(state) counter_u64_add(V_tcps_states[state], 1)
#define TCPSTATES_DEC(state) counter_u64_add(V_tcps_states[state], -1)
/*
* TCP specific helper hook point identifiers.