Author: andre
Date: Sun Oct 28 17:59:46 2012
New Revision: 242253
URL: http://svn.freebsd.org/changeset/base/242253

Log:
  Simplify implementation of net.inet.tcp.reass.maxsegments and
  net.inet.tcp.reass.cursegments.
  
  MFC after:    2 weeks

Modified:
  head/sys/netinet/tcp_reass.c

Modified: head/sys/netinet/tcp_reass.c
==============================================================================
--- head/sys/netinet/tcp_reass.c        Sun Oct 28 17:40:35 2012        
(r242252)
+++ head/sys/netinet/tcp_reass.c        Sun Oct 28 17:59:46 2012        
(r242253)
@@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$");
 #include <netinet/tcp_debug.h>
 #endif /* TCPDEBUG */
 
-static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS);
 static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS);
 
 static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
@@ -82,16 +81,12 @@ static SYSCTL_NODE(_net_inet_tcp, OID_AU
 
 static VNET_DEFINE(int, tcp_reass_maxseg) = 0;
 #define        V_tcp_reass_maxseg              VNET(tcp_reass_maxseg)
-SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments,
-    CTLTYPE_INT | CTLFLAG_RDTUN,
-    &VNET_NAME(tcp_reass_maxseg), 0, &tcp_reass_sysctl_maxseg, "I",
+SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
+    &VNET_NAME(tcp_reass_maxseg), 0,
     "Global maximum number of TCP Segments in Reassembly Queue");
 
-static VNET_DEFINE(int, tcp_reass_qsize) = 0;
-#define        V_tcp_reass_qsize               VNET(tcp_reass_qsize)
 SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments,
-    CTLTYPE_INT | CTLFLAG_RD,
-    &VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I",
+    (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;
@@ -109,8 +104,10 @@ static void
 tcp_reass_zone_change(void *tag)
 {
 
+       /* Set the zone limit and read back the effective value. */
        V_tcp_reass_maxseg = nmbclusters / 16;
        uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg);
+       V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
 }
 
 void
@@ -122,7 +119,9 @@ tcp_reass_init(void)
            &V_tcp_reass_maxseg);
        V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent),
            NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+       /* Set the zone limit and read back the effective value. */
        uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg);
+       V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
        EVENTHANDLER_REGISTER(nmbclusters_change,
            tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY);
 }
@@ -156,17 +155,12 @@ tcp_reass_flush(struct tcpcb *tp)
 }
 
 static int
-tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS)
-{
-       V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
-       return (sysctl_handle_int(oidp, arg1, arg2, req));
-}
-
-static int
 tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS)
 {
-       V_tcp_reass_qsize = uma_zone_get_cur(V_tcp_reass_zone);
-       return (sysctl_handle_int(oidp, arg1, arg2, req));
+       int qsize;
+
+       qsize = uma_zone_get_cur(V_tcp_reass_zone);
+       return (sysctl_handle_int(oidp, &qsize, sizeof(qsize), req));
 }
 
 int
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to