svn commit: r261594 - head/sys/netinet

Gleb Smirnoff glebius at FreeBSD.org
Fri Feb 7 14:31:52 UTC 2014


Author: glebius
Date: Fri Feb  7 14:31:51 2014
New Revision: 261594
URL: http://svnweb.freebsd.org/changeset/base/261594

Log:
  Utilize SYSCTL_UMA_CUR() to export usage of syncache and
  tcp reassembly zones.
  
  Sponsored by:	Nginx, Inc.

Modified:
  head/sys/netinet/tcp_reass.c
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_reass.c
==============================================================================
--- head/sys/netinet/tcp_reass.c	Fri Feb  7 14:29:03 2014	(r261593)
+++ head/sys/netinet/tcp_reass.c	Fri Feb  7 14:31:51 2014	(r261594)
@@ -75,8 +75,6 @@ __FBSDID("$FreeBSD$");
 #include <netinet/tcp_debug.h>
 #endif /* TCPDEBUG */
 
-static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS);
-
 static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
     "TCP Segment Reassembly Queue");
 
@@ -86,10 +84,6 @@ SYSCTL_VNET_INT(_net_inet_tcp_reass, OID
     &VNET_NAME(tcp_reass_maxseg), 0,
     "Global maximum number of TCP Segments in Reassembly Queue");
 
-SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments,
-    (CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I",
-    "Global number of TCP Segments currently in Reassembly Queue");
-
 static VNET_DEFINE(int, tcp_reass_overflows) = 0;
 #define	V_tcp_reass_overflows		VNET(tcp_reass_overflows)
 SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows,
@@ -99,6 +93,9 @@ SYSCTL_VNET_INT(_net_inet_tcp_reass, OID
 
 static VNET_DEFINE(uma_zone_t, tcp_reass_zone);
 #define	V_tcp_reass_zone		VNET(tcp_reass_zone)
+SYSCTL_UMA_CUR(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_VNET,
+    &VNET_NAME(tcp_reass_zone),
+    "Global number of TCP Segments currently in Reassembly Queue");
 
 /* Initialize TCP reassembly queue */
 static void
@@ -155,15 +152,6 @@ tcp_reass_flush(struct tcpcb *tp)
 	    tp, tp->t_segqlen));
 }
 
-static int
-tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS)
-{
-	int qsize;
-
-	qsize = uma_zone_get_cur(V_tcp_reass_zone);
-	return (sysctl_handle_int(oidp, &qsize, 0, req));
-}
-
 int
 tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
 {

Modified: head/sys/netinet/tcp_syncache.c
==============================================================================
--- head/sys/netinet/tcp_syncache.c	Fri Feb  7 14:29:03 2014	(r261593)
+++ head/sys/netinet/tcp_syncache.c	Fri Feb  7 14:31:51 2014	(r261594)
@@ -126,7 +126,6 @@ struct syncache *syncache_lookup(struct 
 static int	 syncache_respond(struct syncache *);
 static struct	 socket *syncache_socket(struct syncache *, struct socket *,
 		    struct mbuf *m);
-static int	 syncache_sysctl_count(SYSCTL_HANDLER_ARGS);
 static void	 syncache_timeout(struct syncache *sc, struct syncache_head *sch,
 		    int docallout);
 static void	 syncache_timer(void *);
@@ -170,9 +169,8 @@ SYSCTL_VNET_UINT(_net_inet_tcp_syncache,
     &VNET_NAME(tcp_syncache.cache_limit), 0,
     "Overall entry limit for syncache");
 
-SYSCTL_VNET_PROC(_net_inet_tcp_syncache, OID_AUTO, count, (CTLTYPE_UINT|CTLFLAG_RD),
-    NULL, 0, &syncache_sysctl_count, "IU",
-    "Current number of entries in syncache");
+SYSCTL_UMA_CUR(_net_inet_tcp_syncache, OID_AUTO, count, CTLFLAG_VNET,
+    &VNET_NAME(tcp_syncache.zone), "Current number of entries in syncache");
 
 SYSCTL_VNET_UINT(_net_inet_tcp_syncache, OID_AUTO, hashsize, CTLFLAG_RDTUN,
     &VNET_NAME(tcp_syncache.hashsize), 0,
@@ -328,15 +326,6 @@ syncache_destroy(void)
 }
 #endif
 
-static int
-syncache_sysctl_count(SYSCTL_HANDLER_ARGS)
-{
-	int count;
-
-	count = uma_zone_get_cur(V_tcp_syncache.zone);
-	return (sysctl_handle_int(oidp, &count, 0, req));
-}
-
 /*
  * Inserts a syncache entry into the specified bucket row.
  * Locks and unlocks the syncache_head autonomously.


More information about the svn-src-all mailing list