svn commit: r296881 - in head: contrib/bsnmp/snmp_mibII sys/netinet

Bjoern A. Zeeb bz at FreeBSD.org
Sat Apr 2 19:30:46 UTC 2016


On Tue, 15 Mar 2016, Gleb Smirnoff wrote:

> Author: glebius
> Date: Tue Mar 15 00:15:10 2016
> New Revision: 296881
> URL: https://svnweb.freebsd.org/changeset/base/296881
>
> Log:
>  Redo r294869. The array of counters for TCP states doesn't belong to
>  struct tcpstat, because the structure can be zeroed out by netstat(1) -z,
>  and of course running connection counts shouldn't be touched.
>
>  Place running connection counts into separate array, and provide
>  separate read-only sysctl oid for it.

This has VNET(xxx) macros in the middle of the code.  We do that
nowhere else.   Could you please
 	#define	V_xxx	VNET(xxx)
and get rid of them?

> +
> +static void
> +tcp_vnet_init(const void *unused)

Also that function name is very badly chosen.


> +	COUNTER_ARRAY_ALLOC(VNET(tcps_states), TCP_NSTATES, M_WAITOK);

 			^^^^^^^^^^^

> +	COUNTER_ARRAY_FREE(VNET(tcps_states), TCP_NSTATES);

> +		    counter_u64_fetch(VNET(tcps_states)[TCPS_SYN_RECEIVED]);

> +	m = counter_u64_fetch(VNET(tcps_states)[TCPS_SYN_RECEIVED]);

> /*
> + * 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)
                                                      ^^^^^^^^^^^


More information about the svn-src-all mailing list