Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 May 2016 23:14:17 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300096 - head/sys/netinet
Message-ID:  <201605172314.u4HNEHE5027934@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Tue May 17 23:14:17 2016
New Revision: 300096
URL: https://svnweb.freebsd.org/changeset/base/300096

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

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Tue May 17 22:52:42 2016	(r300095)
+++ head/sys/netinet/tcp_input.c	Tue May 17 23:14:17 2016	(r300096)
@@ -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,

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Tue May 17 22:52:42 2016	(r300095)
+++ head/sys/netinet/tcp_subr.c	Tue May 17 23:14:17 2016	(r300096)
@@ -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));

Modified: head/sys/netinet/tcp_var.h
==============================================================================
--- head/sys/netinet/tcp_var.h	Tue May 17 22:52:42 2016	(r300095)
+++ head/sys/netinet/tcp_var.h	Tue May 17 23:14:17 2016	(r300096)
@@ -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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605172314.u4HNEHE5027934>