--- old/usr/src/uts/common/inet/tcp/tcp_tunables.c	Mon Jul 29 18:04:23 2013
+++ new/usr/src/uts/common/inet/tcp/tcp_tunables.c	Mon Jul 29 18:04:23 2013
@@ -22,6 +22,7 @@
  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, Joyent Inc. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
  */
 /* Copyright (c) 1990 Mentat Inc. */
 
@@ -37,21 +38,14 @@
 /* Max of the above */
 #define	TCP_MSS_MAX		TCP_MSS_MAX_IPV4
 
-#define	TCP_XMIT_LOWATER	4096
-#define	TCP_XMIT_HIWATER	49152
-#define	TCP_RECV_LOWATER	2048
-#define	TCP_RECV_HIWATER	128000
-
 /*
  * Set the RFC 1948 pass phrase
  */
 /* ARGSUSED */
 static int
-tcp_set_1948phrase(void *cbarg,  cred_t *cr, mod_prop_info_t *pinfo,
+tcp_set_1948phrase(netstack_t *stack,  cred_t *cr, mod_prop_info_t *pinfo,
     const char *ifname, const void* pr_val, uint_t flags)
 {
-	tcp_stack_t	*tcps = (tcp_stack_t *)cbarg;
-
 	if (flags & MOD_PROP_DEFAULT)
 		return (ENOTSUP);
 
@@ -58,7 +52,8 @@
 	/*
 	 * Basically, value contains a new pass phrase.  Pass it along!
 	 */
-	tcp_iss_key_init((uint8_t *)pr_val, strlen(pr_val), tcps);
+	tcp_iss_key_init((uint8_t *)pr_val, strlen(pr_val),
+	    stack->netstack_tcp);
 	return (0);
 }
 
@@ -67,10 +62,10 @@
  */
 /* ARGSUSED */
 static int
-tcp_listener_conf_get(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
-    void *val, uint_t psize, uint_t flags)
+tcp_listener_conf_get(netstack_t *stack, mod_prop_info_t *pinfo,
+    const char *ifname, void *val, uint_t psize, uint_t flags)
 {
-	tcp_stack_t	*tcps = (tcp_stack_t *)cbarg;
+	tcp_stack_t	*tcps = stack->netstack_tcp;
 	tcp_listener_t	*tl;
 	char		*pval = val;
 	size_t		nbytes = 0, tbytes = 0;
@@ -111,7 +106,7 @@
  */
 /* ARGSUSED */
 static int
-tcp_listener_conf_add(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+tcp_listener_conf_add(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
     const char *ifname, const void* pval, uint_t flags)
 {
 	tcp_listener_t	*new_tl;
@@ -119,7 +114,7 @@
 	long		lport;
 	long		ratio;
 	char		*colon;
-	tcp_stack_t	*tcps = (tcp_stack_t *)cbarg;
+	tcp_stack_t	*tcps = stack->netstack_tcp;
 
 	if (flags & MOD_PROP_DEFAULT)
 		return (ENOTSUP);
@@ -160,12 +155,12 @@
  */
 /* ARGSUSED */
 static int
-tcp_listener_conf_del(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+tcp_listener_conf_del(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
     const char *ifname, const void* pval, uint_t flags)
 {
 	tcp_listener_t	*tl;
 	long		lport;
-	tcp_stack_t	*tcps = (tcp_stack_t *)cbarg;
+	tcp_stack_t	*tcps = stack->netstack_tcp;
 
 	if (flags & MOD_PROP_DEFAULT)
 		return (ENOTSUP);
@@ -188,6 +183,22 @@
 	return (ESRCH);
 }
 
+static int
+tcp_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_tcp->tcps_propinfo_tbl, stack,
+	    cr, pinfo, ifname, pval, flags));
+}
+
+static int
+tcp_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_tcp->tcps_propinfo_tbl, stack,
+	    pinfo, ifname, val, psize, flags));
+}
+
 /*
  * Special checkers for smallest/largest anonymous port so they don't
  * ever happen to be (largest < smallest).
@@ -194,11 +205,11 @@
  */
 /* ARGSUSED */
 static int
-tcp_smallest_anon_set(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+tcp_smallest_anon_set(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
     const char *ifname, const void *pval, uint_t flags)
 {
 	unsigned long new_value;
-	tcp_stack_t *tcps = (tcp_stack_t *)cbarg;
+	tcp_stack_t *tcps = stack->netstack_tcp;
 	int err;
 
 	if ((err = mod_uint32_value(pval, pinfo, flags, &new_value)) != 0)
@@ -212,11 +223,11 @@
 
 /* ARGSUSED */
 static int
-tcp_largest_anon_set(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+tcp_largest_anon_set(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
     const char *ifname, const void *pval, uint_t flags)
 {
 	unsigned long new_value;
-	tcp_stack_t *tcps = (tcp_stack_t *)cbarg;
+	tcp_stack_t *tcps = stack->netstack_tcp;
 	int err;
 
 	if ((err = mod_uint32_value(pval, pinfo, flags, &new_value)) != 0)
@@ -258,7 +269,7 @@
 
 	{ "_cwnd_max", MOD_PROTO_TCP,
 	    mod_set_uint32, mod_get_uint32,
-	    {128, (1<<30), 1024*1024}, {1024*1024} },
+	    {128, ULP_MAX_BUF, 1024*1024}, {1024*1024} },
 
 	{ "_debug", MOD_PROTO_TCP,
 	    mod_set_uint32, mod_get_uint32,
@@ -338,7 +349,7 @@
 
 	{ "_snd_lowat_fraction", MOD_PROTO_TCP,
 	    mod_set_uint32, mod_get_uint32,
-	    {0, 16, 0}, {0} },
+	    {0, 16, 10}, {10} },
 
 	{ "_dupack_fast_retransmit", MOD_PROTO_TCP,
 	    mod_set_uint32, mod_get_uint32,
@@ -357,20 +368,20 @@
 	    {1024, ULP_MAX_PORT, ULP_MAX_PORT},
 	    {ULP_MAX_PORT} },
 
-	{ "send_maxbuf", MOD_PROTO_TCP,
-	    mod_set_uint32, mod_get_uint32,
-	    {TCP_XMIT_LOWATER, (1<<30), TCP_XMIT_HIWATER},
+	{ "send_buf", MOD_PROTO_TCP,
+	    tcp_set_buf_prop, tcp_get_buf_prop,
+	    {TCP_XMIT_LOWATER, ULP_MAX_BUF, TCP_XMIT_HIWATER},
 	    {TCP_XMIT_HIWATER} },
 
 	/* tunable - 30 */
 	{ "_xmit_lowat", MOD_PROTO_TCP,
 	    mod_set_uint32, mod_get_uint32,
-	    {TCP_XMIT_LOWATER, (1<<30), TCP_XMIT_LOWATER},
+	    {TCP_XMIT_LOWATER, ULP_MAX_BUF, TCP_XMIT_LOWATER},
 	    {TCP_XMIT_LOWATER} },
 
-	{ "recv_maxbuf", MOD_PROTO_TCP,
-	    mod_set_uint32, mod_get_uint32,
-	    {TCP_RECV_LOWATER, (1<<30), TCP_RECV_HIWATER},
+	{ "recv_buf", MOD_PROTO_TCP,
+	    tcp_set_buf_prop, tcp_get_buf_prop,
+	    {TCP_RECV_LOWATER, ULP_MAX_BUF, TCP_RECV_HIWATER},
 	    {TCP_RECV_HIWATER} },
 
 	{ "_recv_hiwat_minmss", MOD_PROTO_TCP,
@@ -382,9 +393,9 @@
 	    {1*SECONDS, 2*HOURS, 60*SECONDS},
 	    {60*SECONDS} },
 
-	{ "_max_buf", MOD_PROTO_TCP,
+	{ "max_buf", MOD_PROTO_TCP,
 	    mod_set_uint32, mod_get_uint32,
-	    {8192, (1<<30), 1024*1024}, {1024*1024} },
+	    {8192, ULP_MAX_BUF, 1024*1024}, {1024*1024} },
 
 	/*
 	 * Question:  What default value should I set for tcp_strong_iss?
