Print this page
3942 inject sanity into ipadm tcp buffer size properties
3943 _snd_lowat_fraction tcp tunable has no effect
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Peng Dai <peng.dai@delphix.com>

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
  */
 
 #include <inet/ip.h>
 #include <inet/ip6.h>
 #include <inet/sctp/sctp_stack.h>

@@ -40,14 +41,14 @@
 /*
  * returns the current list of listener limit configuration.
  */
 /* ARGSUSED */
 static int
-sctp_listener_conf_get(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
-    void *val, uint_t psize, uint_t flags)
+sctp_listener_conf_get(netstack_t *stack, mod_prop_info_t *pinfo,
+    const char *ifname, void *val, uint_t psize, uint_t flags)
 {
-        sctp_stack_t    *sctps = (sctp_stack_t *)cbarg;
+        sctp_stack_t    *sctps = stack->netstack_sctp;
         sctp_listener_t *sl;
         char            *pval = val;
         size_t          nbytes = 0, tbytes = 0;
         uint_t          size;
         int             err = 0;

@@ -84,19 +85,19 @@
 /*
  * add a new listener limit configuration.
  */
 /* ARGSUSED */
 static int
-sctp_listener_conf_add(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+sctp_listener_conf_add(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
     const char *ifname, const void* pval, uint_t flags)
 {
         sctp_listener_t *new_sl;
         sctp_listener_t *sl;
         long            lport;
         long            ratio;
         char            *colon;
-        sctp_stack_t    *sctps = (sctp_stack_t *)cbarg;
+        sctp_stack_t    *sctps = stack->netstack_sctp;
 
         if (flags & MOD_PROP_DEFAULT)
                 return (ENOTSUP);
 
         if (ddi_strtol(pval, &colon, 10, &lport) != 0 || lport <= 0 ||

@@ -133,16 +134,16 @@
 /*
  * remove a listener limit configuration.
  */
 /* ARGSUSED */
 static int
-sctp_listener_conf_del(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+sctp_listener_conf_del(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
     const char *ifname, const void* pval, uint_t flags)
 {
         sctp_listener_t *sl;
         long            lport;
-        sctp_stack_t    *sctps = (sctp_stack_t *)cbarg;
+        sctp_stack_t    *sctps = stack->netstack_sctp;
 
         if (flags & MOD_PROP_DEFAULT)
                 return (ENOTSUP);
 
         if (ddi_strtol(pval, NULL, 10, &lport) != 0 || lport <= 0 ||

@@ -161,10 +162,26 @@
         }
         mutex_exit(&sctps->sctps_listener_conf_lock);
         return (ESRCH);
 }
 
+static int
+sctp_set_buf_prop(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
+    const char *ifname, const void *pval, uint_t flags)
+{
+        return (mod_set_buf_prop(stack->netstack_sctp->sctps_propinfo_tbl,
+            stack, cr, pinfo, ifname, pval, flags));
+}
+
+static int
+sctp_get_buf_prop(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
+    void *val, uint_t psize, uint_t flags)
+{
+        return (mod_get_buf_prop(stack->netstack_sctp->sctps_propinfo_tbl,
+            stack, pinfo, ifname, val, psize, flags));
+}
+
 /*
  * All of these are alterable, within the min/max values given, at run time.
  *
  * Note: All those tunables which do not start with "_" are Committed and
  * therefore are public. See PSARC 2010/080.

@@ -182,11 +199,11 @@
             mod_set_uint32, mod_get_uint32,
             {1, 128, 5}, {5} },
 
         { "_cwnd_max", MOD_PROTO_SCTP,
             mod_set_uint32, mod_get_uint32,
-            {128, (1<<30), 1024*1024}, {1024*1024} },
+            {128, ULP_MAX_BUF, 1024*1024}, {1024*1024} },
 
         { "smallest_nonpriv_port", MOD_PROTO_SCTP,
             mod_set_uint32, mod_get_uint32,
             {1024, (32*1024), 1024}, {1024} },
 

@@ -233,28 +250,28 @@
 
         { "largest_anon_port", MOD_PROTO_SCTP,
             mod_set_uint32, mod_get_uint32,
             {1024, ULP_MAX_PORT, ULP_MAX_PORT}, {ULP_MAX_PORT} },
 
-        { "send_maxbuf", MOD_PROTO_SCTP,
-            mod_set_uint32, mod_get_uint32,
-            {SCTP_XMIT_LOWATER,  (1<<30),  SCTP_XMIT_HIWATER},
+        { "send_buf", MOD_PROTO_SCTP,
+            sctp_set_buf_prop, sctp_get_buf_prop,
+            {SCTP_XMIT_LOWATER,  ULP_MAX_BUF,  SCTP_XMIT_HIWATER},
             {SCTP_XMIT_HIWATER} },
 
         { "_xmit_lowat", MOD_PROTO_SCTP,
             mod_set_uint32, mod_get_uint32,
-            {SCTP_XMIT_LOWATER,  (1<<30),  SCTP_XMIT_LOWATER},
+            {SCTP_XMIT_LOWATER,  ULP_MAX_BUF,  SCTP_XMIT_LOWATER},
             {SCTP_XMIT_LOWATER} },
 
-        { "recv_maxbuf", MOD_PROTO_SCTP,
-            mod_set_uint32, mod_get_uint32,
-            {SCTP_RECV_LOWATER,  (1<<30),  SCTP_RECV_HIWATER},
+        { "recv_buf", MOD_PROTO_SCTP,
+            sctp_set_buf_prop, sctp_get_buf_prop,
+            {SCTP_RECV_LOWATER,  ULP_MAX_BUF,  SCTP_RECV_HIWATER},
             {SCTP_RECV_HIWATER} },
 
-        { "_max_buf", MOD_PROTO_SCTP,
+        { "max_buf", MOD_PROTO_SCTP,
             mod_set_uint32, mod_get_uint32,
-            {8192, (1<<30), 1024*1024}, {1024*1024} },
+            {8192, ULP_MAX_BUF, 1024*1024}, {1024*1024} },
 
         /* tunable - 20 */
         { "_rtt_updates", MOD_PROTO_SCTP,
             mod_set_uint32, mod_get_uint32,
             {0, 65536, 20}, {20} },