svn commit: r294867 - in head/sys: net netinet

Gleb Smirnoff glebius at FreeBSD.org
Wed Jan 27 00:20:09 UTC 2016


Author: glebius
Date: Wed Jan 27 00:20:07 2016
New Revision: 294867
URL: https://svnweb.freebsd.org/changeset/base/294867

Log:
  Provide TCPSTAT_DEC() and TCPSTAT_FETCH() macros.

Modified:
  head/sys/net/vnet.h
  head/sys/netinet/tcp_var.h

Modified: head/sys/net/vnet.h
==============================================================================
--- head/sys/net/vnet.h	Wed Jan 27 00:12:58 2016	(r294866)
+++ head/sys/net/vnet.h	Wed Jan 27 00:20:07 2016	(r294867)
@@ -101,6 +101,9 @@ struct vnet {
 #define	VNET_PCPUSTAT_ADD(type, name, f, v)	\
     counter_u64_add(VNET(name)[offsetof(type, f) / sizeof(uint64_t)], (v))
 
+#define	VNET_PCPUSTAT_FETCH(type, name, f)	\
+    counter_u64_fetch(VNET(name)[offsetof(type, f) / sizeof(uint64_t)])
+
 #define	VNET_PCPUSTAT_SYSINIT(name)	\
 static void				\
 vnet_##name##_init(const void *unused)	\

Modified: head/sys/netinet/tcp_var.h
==============================================================================
--- head/sys/netinet/tcp_var.h	Wed Jan 27 00:12:58 2016	(r294866)
+++ head/sys/netinet/tcp_var.h	Wed Jan 27 00:20:07 2016	(r294867)
@@ -605,6 +605,9 @@ VNET_PCPUSTAT_DECLARE(struct tcpstat, tc
 #define	TCPSTAT_ADD(name, val)	\
     VNET_PCPUSTAT_ADD(struct tcpstat, tcpstat, name, (val))
 #define	TCPSTAT_INC(name)	TCPSTAT_ADD(name, 1)
+#define	TCPSTAT_DEC(name)	TCPSTAT_ADD(name, -1)
+#define	TCPSTAT_FETCH(name)	VNET_PCPUSTAT_FETCH(struct tcpstat, tcpstat, \
+				    name)
 
 /*
  * Kernel module consumers must use this accessor macro.


More information about the svn-src-head mailing list