summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Roy <seb@delphix.com>2013-08-01 17:47:00 -0800
committerChristopher Siden <chris.siden@delphix.com>2013-08-01 18:47:01 -0700
commit299625c6492013aa7bd163862f0d181854f69b3c (patch)
treed84f72b9de7c9f9cee6a7bdd01809e048a2e607f
parenta29160b0f5f650ae34e2273cacdd3eff15c62fba (diff)
downloadillumos-joyent-299625c6492013aa7bd163862f0d181854f69b3c.tar.gz
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> Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Dan McDonald <danmcd@nexenta.com>
-rw-r--r--usr/src/lib/libipadm/common/ipadm_addr.c21
-rw-r--r--usr/src/lib/libipadm/common/ipadm_prop.c111
-rw-r--r--usr/src/lib/libipadm/common/libipadm_impl.h4
-rw-r--r--usr/src/man/man1m/ipadm.1m18
-rw-r--r--usr/src/uts/common/inet/ip/icmp.c30
-rw-r--r--usr/src/uts/common/inet/ip/ip_if.c57
-rw-r--r--usr/src/uts/common/inet/ip/ip_tunables.c53
-rw-r--r--usr/src/uts/common/inet/sctp/sctp_tunables.c51
-rw-r--r--usr/src/uts/common/inet/tcp/tcp.c13
-rw-r--r--usr/src/uts/common/inet/tcp/tcp_tunables.c73
-rw-r--r--usr/src/uts/common/inet/tcp_impl.h12
-rw-r--r--usr/src/uts/common/inet/tunables.c145
-rw-r--r--usr/src/uts/common/inet/tunables.h19
-rw-r--r--usr/src/uts/common/inet/udp/udp_tunables.c43
14 files changed, 410 insertions, 240 deletions
diff --git a/usr/src/lib/libipadm/common/ipadm_addr.c b/usr/src/lib/libipadm/common/ipadm_addr.c
index 8a30694e8e..0668c1de5b 100644
--- a/usr/src/lib/libipadm/common/ipadm_addr.c
+++ b/usr/src/lib/libipadm/common/ipadm_addr.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/*
@@ -96,30 +97,30 @@ static ipadm_pd_setf_t i_ipadm_set_prefixlen, i_ipadm_set_addr_flag,
/* address properties description table */
ipadm_prop_desc_t ipadm_addrprop_table[] = {
- { "broadcast", IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
+ { "broadcast", NULL, IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
NULL, NULL, i_ipadm_get_broadcast },
- { "deprecated", IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
+ { "deprecated", NULL, IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
i_ipadm_set_addr_flag, i_ipadm_get_onoff,
i_ipadm_get_addr_flag },
- { "prefixlen", IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
+ { "prefixlen", NULL, IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
i_ipadm_set_prefixlen, i_ipadm_get_prefixlen,
i_ipadm_get_prefixlen },
- { "private", IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
+ { "private", NULL, IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
i_ipadm_set_addr_flag, i_ipadm_get_onoff, i_ipadm_get_addr_flag },
- { "transmit", IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
+ { "transmit", NULL, IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
i_ipadm_set_addr_flag, i_ipadm_get_onoff, i_ipadm_get_addr_flag },
- { "zone", IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
+ { "zone", NULL, IPADMPROP_CLASS_ADDR, MOD_PROTO_NONE, 0,
i_ipadm_set_zone, NULL, i_ipadm_get_zone },
- { NULL, 0, 0, 0, NULL, NULL, NULL }
+ { NULL, NULL, 0, 0, 0, NULL, NULL, NULL }
};
-static ipadm_prop_desc_t up_addrprop = { "up", IPADMPROP_CLASS_ADDR,
+static ipadm_prop_desc_t up_addrprop = { "up", NULL, IPADMPROP_CLASS_ADDR,
MOD_PROTO_NONE, 0, NULL, NULL, NULL };
/*
@@ -1376,7 +1377,9 @@ i_ipadm_get_addrprop_desc(const char *pname)
int i;
for (i = 0; ipadm_addrprop_table[i].ipd_name != NULL; i++) {
- if (strcmp(pname, ipadm_addrprop_table[i].ipd_name) == 0)
+ if (strcmp(pname, ipadm_addrprop_table[i].ipd_name) == 0 ||
+ (ipadm_addrprop_table[i].ipd_old_name != NULL &&
+ strcmp(pname, ipadm_addrprop_table[i].ipd_old_name) == 0))
return (&ipadm_addrprop_table[i]);
}
return (NULL);
diff --git a/usr/src/lib/libipadm/common/ipadm_prop.c b/usr/src/lib/libipadm/common/ipadm_prop.c
index cf31804661..0c3a25382f 100644
--- a/usr/src/lib/libipadm/common/ipadm_prop.c
+++ b/usr/src/lib/libipadm/common/ipadm_prop.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/*
@@ -88,63 +89,63 @@ static int protocols[] = { MOD_PROTO_IP, MOD_PROTO_RAWIP,
* Supported IP protocol properties.
*/
static ipadm_prop_desc_t ipadm_ip_prop_table[] = {
- { "arp", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
+ { "arp", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
i_ipadm_set_ifprop_flags, i_ipadm_get_onoff,
i_ipadm_get_ifprop_flags },
- { "forwarding", IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV4, 0,
+ { "forwarding", NULL, IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV4, 0,
i_ipadm_set_forwarding, i_ipadm_get_onoff,
i_ipadm_get_forwarding },
- { "metric", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
+ { "metric", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
i_ipadm_set_metric, NULL, i_ipadm_get_metric },
- { "mtu", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
+ { "mtu", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
i_ipadm_set_mtu, i_ipadm_get_mtu, i_ipadm_get_mtu },
- { "exchange_routes", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
+ { "exchange_routes", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
i_ipadm_set_ifprop_flags, i_ipadm_get_onoff,
i_ipadm_get_ifprop_flags },
- { "usesrc", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
+ { "usesrc", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
i_ipadm_set_usesrc, NULL, i_ipadm_get_usesrc },
- { "ttl", IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0,
+ { "ttl", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "forwarding", IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV6, 0,
+ { "forwarding", NULL, IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV6, 0,
i_ipadm_set_forwarding, i_ipadm_get_onoff,
i_ipadm_get_forwarding },
- { "hoplimit", IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV6, 0,
+ { "hoplimit", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV6, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "metric", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
+ { "metric", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
i_ipadm_set_metric, NULL, i_ipadm_get_metric },
- { "mtu", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
+ { "mtu", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
i_ipadm_set_mtu, i_ipadm_get_mtu, i_ipadm_get_mtu },
- { "nud", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
+ { "nud", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
i_ipadm_set_ifprop_flags, i_ipadm_get_onoff,
i_ipadm_get_ifprop_flags },
- { "exchange_routes", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
+ { "exchange_routes", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
i_ipadm_set_ifprop_flags, i_ipadm_get_onoff,
i_ipadm_get_ifprop_flags },
- { "usesrc", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
+ { "usesrc", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0,
i_ipadm_set_usesrc, NULL, i_ipadm_get_usesrc },
- { "hostmodel", IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV6, 0,
+ { "hostmodel", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV6, 0,
i_ipadm_set_hostmodel, i_ipadm_get_hostmodel,
i_ipadm_get_hostmodel },
- { "hostmodel", IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0,
+ { "hostmodel", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0,
i_ipadm_set_hostmodel, i_ipadm_get_hostmodel,
i_ipadm_get_hostmodel },
- { NULL, 0, 0, 0, NULL, NULL, NULL }
+ { NULL, NULL, 0, 0, 0, NULL, NULL, NULL }
};
/* possible values for TCP properties `ecn' and `sack' */
@@ -152,99 +153,111 @@ static const char *ecn_sack_vals[] = {"never", "passive", "active", NULL};
/* Supported TCP protocol properties */
static ipadm_prop_desc_t ipadm_tcp_prop_table[] = {
- { "ecn", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
+ { "ecn", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
i_ipadm_set_ecnsack, i_ipadm_get_ecnsack, i_ipadm_get_ecnsack },
- { "extra_priv_ports", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP,
+ { "extra_priv_ports", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP,
IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop,
i_ipadm_get_prop },
- { "largest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
+ { "largest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
+ { "max_buf", "_max_buf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "sack", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
+ { "recv_buf", "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
+ i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
+
+ { "sack", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
i_ipadm_set_ecnsack, i_ipadm_get_ecnsack, i_ipadm_get_ecnsack },
- { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
+ { "send_buf", "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "smallest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
+ { "smallest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "smallest_nonpriv_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0,
- i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
+ { "smallest_nonpriv_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP,
+ 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { NULL, 0, 0, 0, NULL, NULL, NULL }
+ { NULL, NULL, 0, 0, 0, NULL, NULL, NULL }
};
/* Supported UDP protocol properties */
static ipadm_prop_desc_t ipadm_udp_prop_table[] = {
- { "extra_priv_ports", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP,
+ { "extra_priv_ports", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP,
IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop,
i_ipadm_get_prop },
- { "largest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
+ { "largest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
+ { "max_buf", "_max_buf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
+ { "recv_buf", "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "smallest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
+ { "send_buf", "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "smallest_nonpriv_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
+ { "smallest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { NULL, 0, 0, 0, NULL, NULL, NULL }
+ { "smallest_nonpriv_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP,
+ 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
+
+ { NULL, NULL, 0, 0, 0, NULL, NULL, NULL }
};
/* Supported SCTP protocol properties */
static ipadm_prop_desc_t ipadm_sctp_prop_table[] = {
- { "extra_priv_ports", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP,
+ { "extra_priv_ports", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP,
IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop,
i_ipadm_get_prop },
- { "largest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
+ { "largest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
+ { "max_buf", "_max_buf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
+ { "recv_buf", "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "smallest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
+ { "send_buf", "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "smallest_nonpriv_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
+ { "smallest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { NULL, 0, 0, 0, NULL, NULL, NULL }
+ { "smallest_nonpriv_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP,
+ 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
+
+ { NULL, NULL, 0, 0, 0, NULL, NULL, NULL }
};
/* Supported ICMP protocol properties */
static ipadm_prop_desc_t ipadm_icmp_prop_table[] = {
- { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0,
+ { "max_buf", "_max_buf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0,
+ { "recv_buf", "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
- { NULL, 0, 0, 0, NULL, NULL, NULL }
+ { "send_buf", "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0,
+ i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
+
+ { NULL, NULL, 0, 0, 0, NULL, NULL, NULL }
};
/*
* A dummy private property structure, used while handling private
* protocol properties (properties not yet supported by libipadm).
*/
-static ipadm_prop_desc_t ipadm_privprop =\
- { NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_NONE, 0,
+static ipadm_prop_desc_t ipadm_privprop =
+ { NULL, NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_NONE, 0,
i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop };
/*
@@ -282,13 +295,17 @@ i_ipadm_get_prop_desc(const char *pname, uint_t proto, int *errp)
err = EINVAL;
goto ret;
}
+
for (ipdp = ipdtbl; ipdp->ipd_name != NULL; ipdp++) {
- if (strcmp(pname, ipdp->ipd_name) == 0) {
+ if (strcmp(pname, ipdp->ipd_name) == 0 ||
+ (ipdp->ipd_old_name != NULL &&
+ strcmp(pname, ipdp->ipd_old_name) == 0)) {
matched_name = B_TRUE;
if (ipdp->ipd_proto == proto)
break;
}
}
+
if (ipdp->ipd_name == NULL) {
err = ENOENT;
/* if we matched name, but failed protocol check */
diff --git a/usr/src/lib/libipadm/common/libipadm_impl.h b/usr/src/lib/libipadm/common/libipadm_impl.h
index eadfbe69bc..93230d8380 100644
--- a/usr/src/lib/libipadm/common/libipadm_impl.h
+++ b/usr/src/lib/libipadm/common/libipadm_impl.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#ifndef _LIBIPADM_IMPL_H
@@ -118,7 +119,8 @@ typedef ipadm_status_t ipadm_pd_getf_t(ipadm_handle_t, const void *,
struct ipadm_prop_desc {
char *ipd_name; /* property name */
- uint_t ipd_class; /* prop. class - global/perif/both */
+ char *ipd_old_name; /* for backward compatibility */
+ uint_t ipd_class; /* prop. class - global/perif/both */
uint_t ipd_proto; /* protocol to which property belongs */
uint_t ipd_flags; /* see below */
ipadm_pd_setf_t *ipd_set; /* set callback function */
diff --git a/usr/src/man/man1m/ipadm.1m b/usr/src/man/man1m/ipadm.1m
index c3fe9f1af5..e2452695df 100644
--- a/usr/src/man/man1m/ipadm.1m
+++ b/usr/src/man/man1m/ipadm.1m
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2012, Joyent, Inc. All Rights Reserved
+.\" Copyright (c) 2013 by Delphix. All rights reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
@@ -1080,10 +1081,18 @@ The IPv6 hoplimit.
Largest ephemeral port (SCTP, TCP or UDP)
.RE
-\fBrecv_maxbuf\fR
+\fBmax_buf\fR
.ad
.RS 4n
-Receive buffer size (ICMP, SCTP, TCP or UDP)
+Maximum receive or send buffer size (ICMP, SCTP, TCP, or UDP). This also
+sets the upper limit for the \fBrecv_buf\fB and \fBsend_buf\fB properties.
+.RE
+
+\fBrecv_buf\fR
+.ad
+.RS 4n
+Default receive buffer size (ICMP, SCTP, TCP, or UDP). The maximum value for
+this property is controlled by the \fBmax_buf\fR property.
.RE
\fBsack\fR
@@ -1093,10 +1102,11 @@ Selective acknowledgement (TCP).
Can be "active", "passive" or "never".
.RE
-\fBsend_maxbuf\fR
+\fBsend_buf\fR
.ad
.RS 4n
-Send buffer size (ICMP, SCTP, TCP or UDP)
+Default send buffer size (ICMP, SCTP, TCP, or UDP). The maximum value for
+this property is controlled by the \fBmax_buf\fR property.
.RE
\fBsmallest_anon_port\fR
diff --git a/usr/src/uts/common/inet/ip/icmp.c b/usr/src/uts/common/inet/ip/icmp.c
index 15daa43d20..9f6bc8b22f 100644
--- a/usr/src/uts/common/inet/ip/icmp.c
+++ b/usr/src/uts/common/inet/ip/icmp.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/* Copyright (c) 1990 Mentat Inc. */
@@ -92,7 +93,6 @@
* it is possible to I_PUSH "icmp", but that results in pushing a passthrough
* dummy module.
*/
-
static void icmp_addr_req(queue_t *q, mblk_t *mp);
static void icmp_tpi_bind(queue_t *q, mblk_t *mp);
static void icmp_bind_proto(icmp_t *icmp);
@@ -213,6 +213,22 @@ static struct T_info_ack icmp_g_t_info_ack = {
(XPG4_1|SENDZERO) /* PROVIDER_flag */
};
+static int
+icmp_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_icmp->is_propinfo_tbl,
+ stack, cr, pinfo, ifname, pval, flags));
+}
+
+static int
+icmp_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_icmp->is_propinfo_tbl, stack,
+ pinfo, ifname, val, psize, flags));
+}
+
/*
* All of these are alterable, within the min/max values given, at run time.
*
@@ -238,21 +254,21 @@ static mod_prop_info_t icmp_propinfo_tbl[] = {
mod_set_boolean, mod_get_boolean,
{B_TRUE}, {B_TRUE} },
- { "send_maxbuf", MOD_PROTO_RAWIP,
- mod_set_uint32, mod_get_uint32,
+ { "send_buf", MOD_PROTO_RAWIP,
+ icmp_set_buf_prop, icmp_get_buf_prop,
{4096, 65536, 8192}, {8192} },
{ "_xmit_lowat", MOD_PROTO_RAWIP,
mod_set_uint32, mod_get_uint32,
{0, 65536, 1024}, {1024} },
- { "recv_maxbuf", MOD_PROTO_RAWIP,
- mod_set_uint32, mod_get_uint32,
+ { "recv_buf", MOD_PROTO_RAWIP,
+ icmp_set_buf_prop, icmp_get_buf_prop,
{4096, 65536, 8192}, {8192} },
- { "_max_buf", MOD_PROTO_RAWIP,
+ { "max_buf", MOD_PROTO_RAWIP,
mod_set_uint32, mod_get_uint32,
- {65536, 1024*1024*1024, 256*1024}, {256 * 1024} },
+ {65536, ULP_MAX_BUF, 256*1024}, {256*1024} },
{ "_pmtu_discovery", MOD_PROTO_RAWIP,
mod_set_boolean, mod_get_boolean,
diff --git a/usr/src/uts/common/inet/ip/ip_if.c b/usr/src/uts/common/inet/ip/ip_if.c
index bb6b8aa631..226a7fd212 100644
--- a/usr/src/uts/common/inet/ip/ip_if.c
+++ b/usr/src/uts/common/inet/ip/ip_if.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1990 Mentat Inc.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/*
@@ -8854,14 +8855,9 @@ ip_sioctl_getsetprop(queue_t *q, mblk_t *mp)
mod_ioc_prop_t *pioc;
mod_prop_info_t *ptbl = NULL, *pinfo = NULL;
ip_stack_t *ipst;
- icmp_stack_t *is;
- tcp_stack_t *tcps;
- sctp_stack_t *sctps;
- udp_stack_t *us;
netstack_t *stack;
- void *cbarg;
cred_t *cr;
- boolean_t set;
+ boolean_t set;
int err;
ASSERT(q->q_next == NULL);
@@ -8880,40 +8876,26 @@ ip_sioctl_getsetprop(queue_t *q, mblk_t *mp)
case MOD_PROTO_IPV4:
case MOD_PROTO_IPV6:
ptbl = ipst->ips_propinfo_tbl;
- cbarg = ipst;
break;
case MOD_PROTO_RAWIP:
- is = stack->netstack_icmp;
- ptbl = is->is_propinfo_tbl;
- cbarg = is;
+ ptbl = stack->netstack_icmp->is_propinfo_tbl;
break;
case MOD_PROTO_TCP:
- tcps = stack->netstack_tcp;
- ptbl = tcps->tcps_propinfo_tbl;
- cbarg = tcps;
+ ptbl = stack->netstack_tcp->tcps_propinfo_tbl;
break;
case MOD_PROTO_UDP:
- us = stack->netstack_udp;
- ptbl = us->us_propinfo_tbl;
- cbarg = us;
+ ptbl = stack->netstack_udp->us_propinfo_tbl;
break;
case MOD_PROTO_SCTP:
- sctps = stack->netstack_sctp;
- ptbl = sctps->sctps_propinfo_tbl;
- cbarg = sctps;
+ ptbl = stack->netstack_sctp->sctps_propinfo_tbl;
break;
default:
miocnak(q, mp, 0, EINVAL);
return;
}
- /* search for given property in respective protocol propinfo table */
- for (pinfo = ptbl; pinfo->mpi_name != NULL; pinfo++) {
- if (strcmp(pinfo->mpi_name, pioc->mpr_name) == 0 &&
- pinfo->mpi_proto == pioc->mpr_proto)
- break;
- }
- if (pinfo->mpi_name == NULL) {
+ pinfo = mod_prop_lookup(ptbl, pioc->mpr_name, pioc->mpr_proto);
+ if (pinfo == NULL) {
miocnak(q, mp, 0, ENOENT);
return;
}
@@ -8923,10 +8905,10 @@ ip_sioctl_getsetprop(queue_t *q, mblk_t *mp)
cr = msg_getcred(mp, NULL);
if (cr == NULL)
cr = iocp->ioc_cr;
- err = pinfo->mpi_setf(cbarg, cr, pinfo, pioc->mpr_ifname,
+ err = pinfo->mpi_setf(stack, cr, pinfo, pioc->mpr_ifname,
pioc->mpr_val, pioc->mpr_flags);
} else if (!set && pinfo->mpi_getf != NULL) {
- err = pinfo->mpi_getf(cbarg, pinfo, pioc->mpr_ifname,
+ err = pinfo->mpi_getf(stack, pinfo, pioc->mpr_ifname,
pioc->mpr_val, pioc->mpr_valsize, pioc->mpr_flags);
} else {
err = EPERM;
@@ -8955,7 +8937,7 @@ ip_process_legacy_nddprop(queue_t *q, mblk_t *mp)
mblk_t *mp1 = mp->b_cont;
char *pname, *pval, *buf;
uint_t bufsize, proto;
- mod_prop_info_t *ptbl = NULL, *pinfo = NULL;
+ mod_prop_info_t *pinfo = NULL;
ip_stack_t *ipst;
int err = 0;
@@ -8982,19 +8964,12 @@ ip_process_legacy_nddprop(queue_t *q, mblk_t *mp)
return;
}
- ptbl = ipst->ips_propinfo_tbl;
- for (pinfo = ptbl; pinfo->mpi_name != NULL; pinfo++) {
- if (strcmp(pinfo->mpi_name, pname) == 0 &&
- pinfo->mpi_proto == proto)
- break;
- }
-
- ASSERT(pinfo->mpi_name != NULL);
+ pinfo = mod_prop_lookup(ipst->ips_propinfo_tbl, pname, proto);
switch (iocp->ioc_cmd) {
case ND_GET:
- if ((err = pinfo->mpi_getf(ipst, pinfo, NULL, buf, bufsize,
- 0)) == 0) {
+ if ((err = pinfo->mpi_getf(ipst->ips_netstack, pinfo, NULL, buf,
+ bufsize, 0)) == 0) {
miocack(q, mp, iocp->ioc_count, 0);
return;
}
@@ -9010,8 +8985,8 @@ ip_process_legacy_nddprop(queue_t *q, mblk_t *mp)
if (!*pval || pval >= (char *)mp1->b_wptr) {
err = EINVAL;
- } else if ((err = pinfo->mpi_setf(ipst, NULL, pinfo, NULL,
- pval, 0)) == 0) {
+ } else if ((err = pinfo->mpi_setf(ipst->ips_netstack, NULL,
+ pinfo, NULL, pval, 0)) == 0) {
miocack(q, mp, 0, 0);
return;
}
diff --git a/usr/src/uts/common/inet/ip/ip_tunables.c b/usr/src/uts/common/inet/ip/ip_tunables.c
index 516d6c1a21..4ef001442c 100644
--- a/usr/src/uts/common/inet/ip/ip_tunables.c
+++ b/usr/src/uts/common/inet/ip/ip_tunables.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/* Copyright (c) 1990 Mentat Inc. */
@@ -44,15 +45,15 @@
*/
/* ARGSUSED */
static int
-ip_set_forwarding(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+ip_set_forwarding(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void* pval, uint_t flags)
{
char *end;
unsigned long new_value;
- boolean_t per_ill, isv6;
- ill_walk_context_t ctx;
- ill_t *ill;
- ip_stack_t *ipst = (ip_stack_t *)cbarg;
+ boolean_t per_ill, isv6;
+ ill_walk_context_t ctx;
+ ill_t *ill;
+ ip_stack_t *ipst = stack->netstack_ip;
if (flags & MOD_PROP_DEFAULT) {
new_value = pinfo->prop_def_bval;
@@ -94,13 +95,13 @@ ip_set_forwarding(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
}
static int
-ip_get_forwarding(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
+ip_get_forwarding(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
void *pval, uint_t pr_size, uint_t flags)
{
- boolean_t value;
- ill_walk_context_t ctx;
- ill_t *ill;
- ip_stack_t *ipst = (ip_stack_t *)cbarg;
+ boolean_t value;
+ ill_walk_context_t ctx;
+ ill_t *ill;
+ ip_stack_t *ipst = stack->netstack_ip;
boolean_t get_def = (flags & MOD_PROP_DEFAULT);
boolean_t get_perm = (flags & MOD_PROP_PERM);
boolean_t isv6;
@@ -156,10 +157,10 @@ ret:
*/
/* ARGSUSED */
int
-ip_set_debug(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+ip_set_debug(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void* pval, uint_t flags)
{
- unsigned long new_value;
+ unsigned long new_value;
int err;
if (cr != NULL && secpolicy_net_config(cr, B_FALSE) != 0)
@@ -178,7 +179,7 @@ ip_set_debug(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
*/
/* ARGSUSED */
int
-ip_get_debug(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
+ip_get_debug(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
void *pval, uint_t psize, uint_t flags)
{
boolean_t get_def = (flags & MOD_PROP_DEFAULT);
@@ -208,11 +209,11 @@ ip_get_debug(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
*/
/* ARGSUSED */
static int
-ip_set_cgtp_filter(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+ip_set_cgtp_filter(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void* pval, uint_t flags)
{
unsigned long new_value;
- ip_stack_t *ipst = (ip_stack_t *)cbarg;
+ ip_stack_t *ipst = stack->netstack_ip;
char *end;
if (flags & MOD_PROP_DEFAULT) {
@@ -265,12 +266,12 @@ ip_set_cgtp_filter(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
* (IPV6_MIN_MTU/IP_MIN_MTU) and ill_max_frag.
*/
int
-ip_get_mtu(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
+ip_get_mtu(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
void *pval, uint_t psize, uint_t flags)
{
- ill_walk_context_t ctx;
- ill_t *ill;
- ip_stack_t *ipst = (ip_stack_t *)cbarg;
+ ill_walk_context_t ctx;
+ ill_t *ill;
+ ip_stack_t *ipst = stack->netstack_ip;
boolean_t isv6;
uint32_t max_mtu, def_mtu;
size_t nbytes = 0;
@@ -352,12 +353,12 @@ ip_set_src_multihoming_common(ulong_t new_value, ulong_t old_value,
/* ARGSUSED */
static int
-ip_set_src_multihoming(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+ip_set_src_multihoming(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void* pval, uint_t flags)
{
- unsigned long new_value, old_value;
+ unsigned long new_value, old_value;
boolean_t isv6;
- ip_stack_t *ipst = (ip_stack_t *)cbarg;
+ ip_stack_t *ipst = stack->netstack_ip;
int err;
old_value = pinfo->prop_cur_uval;
@@ -373,11 +374,11 @@ ip_set_src_multihoming(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
/* ARGSUSED */
static int
-ip_set_hostmodel(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+ip_set_hostmodel(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void* pval, uint_t flags)
{
ip_hostmodel_t new_value, old_value;
- ip_stack_t *ipst = (ip_stack_t *)cbarg;
+ ip_stack_t *ipst = stack->netstack_ip;
uint32_t old_src_multihoming;
int err;
ulong_t tmp;
@@ -446,11 +447,11 @@ ip_set_hostmodel(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
/* ARGSUSED */
int
-ip_get_hostmodel(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
+ip_get_hostmodel(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
void *pval, uint_t psize, uint_t flags)
{
boolean_t isv6 = (pinfo->mpi_proto == MOD_PROTO_IPV6);
- ip_stack_t *ipst = cbarg;
+ ip_stack_t *ipst = stack->netstack_ip;
ip_hostmodel_t hostmodel;
if (psize < sizeof (hostmodel))
diff --git a/usr/src/uts/common/inet/sctp/sctp_tunables.c b/usr/src/uts/common/inet/sctp/sctp_tunables.c
index b4245f5efa..b0ca5048c0 100644
--- a/usr/src/uts/common/inet/sctp/sctp_tunables.c
+++ b/usr/src/uts/common/inet/sctp/sctp_tunables.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <inet/ip.h>
@@ -42,10 +43,10 @@
*/
/* 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;
@@ -86,7 +87,7 @@ sctp_listener_conf_get(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
*/
/* 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;
@@ -94,7 +95,7 @@ sctp_listener_conf_add(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
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);
@@ -135,12 +136,12 @@ sctp_listener_conf_add(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
*/
/* 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);
@@ -163,6 +164,22 @@ sctp_listener_conf_del(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
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.
*
@@ -184,7 +201,7 @@ mod_prop_info_t sctp_propinfo_tbl[] = {
{ "_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,
@@ -235,24 +252,24 @@ mod_prop_info_t sctp_propinfo_tbl[] = {
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,
diff --git a/usr/src/uts/common/inet/tcp/tcp.c b/usr/src/uts/common/inet/tcp/tcp.c
index 1bb87e5c56..49ab70eed4 100644
--- a/usr/src/uts/common/inet/tcp/tcp.c
+++ b/usr/src/uts/common/inet/tcp/tcp.c
@@ -23,6 +23,7 @@
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, Joyent Inc. All rights reserved.
* Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/* Copyright (c) 1990 Mentat Inc. */
@@ -232,11 +233,6 @@ int tcp_squeue_flag;
*/
uint_t tcp_free_list_max_cnt = 0;
-#define TCP_XMIT_LOWATER 4096
-#define TCP_XMIT_HIWATER 49152
-#define TCP_RECV_LOWATER 2048
-#define TCP_RECV_HIWATER 128000
-
#define TIDUSZ 4096 /* transport interface data unit size */
/*
@@ -2718,7 +2714,12 @@ tcp_create_common(cred_t *credp, boolean_t isv6, boolean_t issocket,
connp->conn_rcvbuf = tcps->tcps_recv_hiwat;
connp->conn_sndbuf = tcps->tcps_xmit_hiwat;
- connp->conn_sndlowat = tcps->tcps_xmit_lowat;
+ if (tcps->tcps_snd_lowat_fraction != 0) {
+ connp->conn_sndlowat = connp->conn_sndbuf /
+ tcps->tcps_snd_lowat_fraction;
+ } else {
+ connp->conn_sndlowat = tcps->tcps_xmit_lowat;
+ }
connp->conn_so_type = SOCK_STREAM;
connp->conn_wroff = connp->conn_ht_iphc_allocated +
tcps->tcps_wroff_xtra;
diff --git a/usr/src/uts/common/inet/tcp/tcp_tunables.c b/usr/src/uts/common/inet/tcp/tcp_tunables.c
index 346903c577..1fad61d79b 100644
--- a/usr/src/uts/common/inet/tcp/tcp_tunables.c
+++ b/usr/src/uts/common/inet/tcp/tcp_tunables.c
@@ -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,28 +38,22 @@
/* 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);
/*
* 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 @@ tcp_set_1948phrase(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
*/
/* 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 @@ tcp_listener_conf_get(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
*/
/* 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 @@ tcp_listener_conf_add(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
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 @@ tcp_listener_conf_add(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
*/
/* 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,17 +183,33 @@ tcp_listener_conf_del(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
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).
*/
/* 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 @@ tcp_smallest_anon_set(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
/* 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 @@ mod_prop_info_t tcp_propinfo_tbl[] = {
{ "_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 @@ mod_prop_info_t tcp_propinfo_tbl[] = {
{ "_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 @@ mod_prop_info_t tcp_propinfo_tbl[] = {
{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 @@ mod_prop_info_t tcp_propinfo_tbl[] = {
{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?
diff --git a/usr/src/uts/common/inet/tcp_impl.h b/usr/src/uts/common/inet/tcp_impl.h
index c3274a7491..da0947bccb 100644
--- a/usr/src/uts/common/inet/tcp_impl.h
+++ b/usr/src/uts/common/inet/tcp_impl.h
@@ -22,6 +22,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, Joyent Inc. All rights reserved.
* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#ifndef _INET_TCP_IMPL_H
@@ -54,6 +55,17 @@ extern struct qinit tcp_winit;
extern sock_downcalls_t sock_tcp_downcalls;
/*
+ * Note that by default, the _snd_lowat_fraction tunable controls the value of
+ * the transmit low water mark. TCP_XMIT_LOWATER (and thus the _xmit_lowat
+ * property) is only used if the administrator has disabled _snd_lowat_fraction
+ * by setting it to 0.
+ */
+#define TCP_XMIT_LOWATER 4096
+#define TCP_XMIT_HIWATER 49152
+#define TCP_RECV_LOWATER 2048
+#define TCP_RECV_HIWATER 128000
+
+/*
* Bind hash list size and has function. It has to be a power of 2 for
* hashing.
*/
diff --git a/usr/src/uts/common/inet/tunables.c b/usr/src/uts/common/inet/tunables.c
index 29d70f5894..fef5b5428b 100644
--- a/usr/src/uts/common/inet/tunables.c
+++ b/usr/src/uts/common/inet/tunables.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1990 Mentat Inc.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <inet/tunables.h>
@@ -38,6 +39,24 @@
#include <inet/sctp/sctp_impl.h>
#include <inet/tunables.h>
+mod_prop_info_t *
+mod_prop_lookup(mod_prop_info_t ptbl[], const char *prop_name, uint_t proto)
+{
+ mod_prop_info_t *pinfo;
+
+ /*
+ * Walk the ptbl array looking for a property that has the requested
+ * name and protocol number. Note that we assume that all protocol
+ * tables are terminated by an entry with a NULL property name.
+ */
+ for (pinfo = ptbl; pinfo->mpi_name != NULL; pinfo++) {
+ if (strcmp(pinfo->mpi_name, prop_name) == 0 &&
+ pinfo->mpi_proto == proto)
+ return (pinfo);
+ }
+ return (NULL);
+}
+
static int
prop_perm2const(mod_prop_info_t *pinfo)
{
@@ -54,11 +73,11 @@ prop_perm2const(mod_prop_info_t *pinfo)
*/
/* ARGSUSED */
int
-mod_set_boolean(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+mod_set_boolean(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void* pval, uint_t flags)
{
- char *end;
- unsigned long new_value;
+ char *end;
+ unsigned long new_value;
if (flags & MOD_PROP_DEFAULT) {
pinfo->prop_cur_bval = pinfo->prop_def_bval;
@@ -79,7 +98,7 @@ mod_set_boolean(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
*/
/* ARGSUSED */
int
-mod_get_boolean(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
+mod_get_boolean(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
void *pval, uint_t psize, uint_t flags)
{
boolean_t get_def = (flags & MOD_PROP_DEFAULT);
@@ -128,7 +147,7 @@ mod_uint32_value(const void *pval, mod_prop_info_t *pinfo, uint_t flags,
*/
/* ARGSUSED */
int
-mod_set_uint32(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+mod_set_uint32(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void *pval, uint_t flags)
{
unsigned long new_value;
@@ -145,12 +164,12 @@ mod_set_uint32(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
*/
/* ARGSUSED */
int
-mod_set_aligned(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+mod_set_aligned(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void* pval, uint_t flags)
{
int err;
- if ((err = mod_set_uint32(cbarg, cr, pinfo, ifname, pval, flags)) != 0)
+ if ((err = mod_set_uint32(stack, cr, pinfo, ifname, pval, flags)) != 0)
return (err);
/* if required, align the value to multiple of 8 */
@@ -168,7 +187,7 @@ mod_set_aligned(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
*/
/* ARGSUSED */
int
-mod_get_uint32(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
+mod_get_uint32(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
void *pval, uint_t psize, uint_t flags)
{
boolean_t get_def = (flags & MOD_PROP_DEFAULT);
@@ -192,21 +211,86 @@ mod_get_uint32(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
}
/*
+ * The range of the buffer size properties has a static lower bound configured
+ * in the property info structure of the property itself, and a dynamic upper
+ * bound. The upper bound is the current value of the "max_buf" property
+ * in the appropriate protocol property table.
+ */
+static void
+mod_get_buf_prop_range(mod_prop_info_t ptbl[], mod_prop_info_t *pinfo,
+ uint32_t *min, uint32_t *max)
+{
+ mod_prop_info_t *maxbuf_pinfo = mod_prop_lookup(ptbl, "max_buf",
+ pinfo->mpi_proto);
+
+ *min = pinfo->prop_min_uval;
+ *max = maxbuf_pinfo->prop_cur_uval;
+}
+
+/*
+ * Modifies the value of the buffer size property to its default value or to
+ * the value specified by the user. This is similar to mod_set_uint32() except
+ * that the value has a dynamically bounded range (see mod_get_buf_prop_range()
+ * for details).
+ */
+/* ARGSUSED */
+int
+mod_set_buf_prop(mod_prop_info_t ptbl[], netstack_t *stack, cred_t *cr,
+ mod_prop_info_t *pinfo, const char *ifname, const void *pval, uint_t flags)
+{
+ unsigned long new_value;
+ char *end;
+ uint32_t min, max;
+
+ if (flags & MOD_PROP_DEFAULT) {
+ pinfo->prop_cur_uval = pinfo->prop_def_uval;
+ return (0);
+ }
+
+ if (ddi_strtoul(pval, &end, 10, &new_value) != 0 || *end != '\0')
+ return (EINVAL);
+
+ mod_get_buf_prop_range(ptbl, pinfo, &min, &max);
+ if (new_value < min || new_value > max)
+ return (ERANGE);
+
+ pinfo->prop_cur_uval = new_value;
+ return (0);
+}
+
+/*
+ * Retrieves property permissions, default value, current value, or possible
+ * values for buffer size properties. While these properties have integer
+ * values, they have a dynamic range (see mod_get_buf_prop_range() for
+ * details). As such, they need to be handled differently.
+ */
+int
+mod_get_buf_prop(mod_prop_info_t ptbl[], netstack_t *stack,
+ mod_prop_info_t *pinfo, const char *ifname, void *pval, uint_t psize,
+ uint_t flags)
+{
+ size_t nbytes;
+ uint32_t min, max;
+
+ if (flags & MOD_PROP_POSSIBLE) {
+ mod_get_buf_prop_range(ptbl, pinfo, &min, &max);
+ nbytes = snprintf(pval, psize, "%u-%u", min, max);
+ return (nbytes < psize ? 0 : ENOBUFS);
+ }
+ return (mod_get_uint32(stack, pinfo, ifname, pval, psize, flags));
+}
+
+/*
* Implements /sbin/ndd -get /dev/ip ?, for all the modules. Needed for
* backward compatibility with /sbin/ndd.
*/
/* ARGSUSED */
int
-mod_get_allprop(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
+mod_get_allprop(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
void *val, uint_t psize, uint_t flags)
{
char *pval = val;
mod_prop_info_t *ptbl, *prop;
- ip_stack_t *ipst;
- tcp_stack_t *tcps;
- sctp_stack_t *sctps;
- udp_stack_t *us;
- icmp_stack_t *is;
uint_t size;
size_t nbytes = 0, tbytes = 0;
@@ -217,24 +301,19 @@ mod_get_allprop(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
case MOD_PROTO_IP:
case MOD_PROTO_IPV4:
case MOD_PROTO_IPV6:
- ipst = (ip_stack_t *)cbarg;
- ptbl = ipst->ips_propinfo_tbl;
+ ptbl = stack->netstack_ip->ips_propinfo_tbl;
break;
case MOD_PROTO_RAWIP:
- is = (icmp_stack_t *)cbarg;
- ptbl = is->is_propinfo_tbl;
+ ptbl = stack->netstack_icmp->is_propinfo_tbl;
break;
case MOD_PROTO_TCP:
- tcps = (tcp_stack_t *)cbarg;
- ptbl = tcps->tcps_propinfo_tbl;
+ ptbl = stack->netstack_tcp->tcps_propinfo_tbl;
break;
case MOD_PROTO_UDP:
- us = (udp_stack_t *)cbarg;
- ptbl = us->us_propinfo_tbl;
+ ptbl = stack->netstack_udp->us_propinfo_tbl;
break;
case MOD_PROTO_SCTP:
- sctps = (sctp_stack_t *)cbarg;
- ptbl = sctps->sctps_propinfo_tbl;
+ ptbl = stack->netstack_sctp->sctps_propinfo_tbl;
break;
default:
return (EINVAL);
@@ -264,7 +343,7 @@ mod_get_allprop(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
*/
/* ARGSUSED */
int
-mod_set_extra_privports(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+mod_set_extra_privports(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
const char *ifname, const void* val, uint_t flags)
{
uint_t proto = pinfo->mpi_proto;
@@ -293,19 +372,19 @@ mod_set_extra_privports(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
switch (proto) {
case MOD_PROTO_TCP:
- tcps = (tcp_stack_t *)cbarg;
+ tcps = stack->netstack_tcp;
lock = &tcps->tcps_epriv_port_lock;
ports = tcps->tcps_g_epriv_ports;
nports = tcps->tcps_g_num_epriv_ports;
break;
case MOD_PROTO_UDP:
- us = (udp_stack_t *)cbarg;
+ us = stack->netstack_udp;
lock = &us->us_epriv_port_lock;
ports = us->us_epriv_ports;
nports = us->us_num_epriv_ports;
break;
case MOD_PROTO_SCTP:
- sctps = (sctp_stack_t *)cbarg;
+ sctps = stack->netstack_sctp;
lock = &sctps->sctps_epriv_port_lock;
ports = sctps->sctps_g_epriv_ports;
nports = sctps->sctps_g_num_epriv_ports;
@@ -382,8 +461,8 @@ mod_set_extra_privports(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
*/
/* ARGSUSED */
int
-mod_get_extra_privports(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
- void *val, uint_t psize, uint_t flags)
+mod_get_extra_privports(netstack_t *stack, mod_prop_info_t *pinfo,
+ const char *ifname, void *val, uint_t psize, uint_t flags)
{
uint_t proto = pinfo->mpi_proto;
tcp_stack_t *tcps;
@@ -411,17 +490,17 @@ mod_get_extra_privports(void *cbarg, mod_prop_info_t *pinfo, const char *ifname,
switch (proto) {
case MOD_PROTO_TCP:
- tcps = (tcp_stack_t *)cbarg;
+ tcps = stack->netstack_tcp;
ports = tcps->tcps_g_epriv_ports;
nports = tcps->tcps_g_num_epriv_ports;
break;
case MOD_PROTO_UDP:
- us = (udp_stack_t *)cbarg;
+ us = stack->netstack_udp;
ports = us->us_epriv_ports;
nports = us->us_num_epriv_ports;
break;
case MOD_PROTO_SCTP:
- sctps = (sctp_stack_t *)cbarg;
+ sctps = stack->netstack_sctp;
ports = sctps->sctps_g_epriv_ports;
nports = sctps->sctps_g_num_epriv_ports;
break;
diff --git a/usr/src/uts/common/inet/tunables.h b/usr/src/uts/common/inet/tunables.h
index f9290d259f..cd425e6947 100644
--- a/usr/src/uts/common/inet/tunables.h
+++ b/usr/src/uts/common/inet/tunables.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1990 Mentat Inc.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#ifndef _INET_TUNABLES_H
@@ -88,10 +89,10 @@ typedef struct mod_ioc_prop_s {
typedef struct mod_prop_info_s mod_prop_info_t;
/* set/get property callback functions */
-typedef int mod_prop_setf_t(void *, cred_t *, mod_prop_info_t *,
+typedef int mod_prop_setf_t(netstack_t *, cred_t *, mod_prop_info_t *,
const char *, const void *, uint_t);
-typedef int mod_prop_getf_t(void *, mod_prop_info_t *, const char *,
- void *val, uint_t, uint_t);
+typedef int mod_prop_getf_t(netstack_t *, mod_prop_info_t *, const char *,
+ void *, uint_t, uint_t);
typedef struct mod_propval_uint32_s {
uint32_t mod_propval_umin;
@@ -149,6 +150,8 @@ struct mod_prop_info_s {
#define ULP_DEF_EPRIV_PORT1 2049
#define ULP_DEF_EPRIV_PORT2 4045
+#define ULP_MAX_BUF (1<<30) /* Largest possible send/receive buffer */
+
/* generic function to set/get global module properties */
extern mod_prop_setf_t mod_set_boolean, mod_set_uint32,
mod_set_aligned, mod_set_extra_privports;
@@ -156,8 +159,14 @@ extern mod_prop_setf_t mod_set_boolean, mod_set_uint32,
extern mod_prop_getf_t mod_get_boolean, mod_get_uint32,
mod_get_allprop, mod_get_extra_privports;
-extern int mod_uint32_value(const void *, mod_prop_info_t *, uint_t,
- unsigned long *);
+extern int mod_uint32_value(const void *, mod_prop_info_t *,
+ uint_t, unsigned long *);
+extern mod_prop_info_t *mod_prop_lookup(mod_prop_info_t[], const char *,
+ uint_t);
+extern int mod_set_buf_prop(mod_prop_info_t[], netstack_t *,
+ cred_t *cr, mod_prop_info_t *, const char *, const void *, uint_t);
+extern int mod_get_buf_prop(mod_prop_info_t[], netstack_t *,
+ mod_prop_info_t *, const char *, void *, uint_t, uint_t);
#endif /* _KERNEL */
diff --git a/usr/src/uts/common/inet/udp/udp_tunables.c b/usr/src/uts/common/inet/udp/udp_tunables.c
index 917dddf62f..3c00d09277 100644
--- a/usr/src/uts/common/inet/udp/udp_tunables.c
+++ b/usr/src/uts/common/inet/udp/udp_tunables.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/* Copyright (c) 1990 Mentat Inc. */
@@ -29,17 +30,33 @@
#include <inet/udp_impl.h>
#include <sys/sunddi.h>
+static int
+udp_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_udp->us_propinfo_tbl, stack,
+ cr, pinfo, ifname, pval, flags));
+}
+
+static int
+udp_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_udp->us_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).
*/
/* ARGSUSED */
static int
-udp_smallest_anon_set(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+udp_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;
- udp_stack_t *us = (udp_stack_t *)cbarg;
+ udp_stack_t *us = stack->netstack_udp;
int err;
if ((err = mod_uint32_value(pval, pinfo, flags, &new_value)) != 0)
@@ -53,11 +70,11 @@ udp_smallest_anon_set(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
/* ARGSUSED */
static int
-udp_largest_anon_set(void *cbarg, cred_t *cr, mod_prop_info_t *pinfo,
+udp_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;
- udp_stack_t *us = (udp_stack_t *)cbarg;
+ udp_stack_t *us = stack->netstack_udp;
int err;
if ((err = mod_uint32_value(pval, pinfo, flags, &new_value)) != 0)
@@ -105,25 +122,25 @@ mod_prop_info_t udp_propinfo_tbl[] = {
udp_largest_anon_set, mod_get_uint32,
{1024, ULP_MAX_PORT, ULP_MAX_PORT}, {ULP_MAX_PORT} },
- { "send_maxbuf", MOD_PROTO_UDP,
- mod_set_uint32, mod_get_uint32,
- {UDP_XMIT_LOWATER, (1<<30), UDP_XMIT_HIWATER},
+ { "send_buf", MOD_PROTO_UDP,
+ udp_set_buf_prop, udp_get_buf_prop,
+ {UDP_XMIT_LOWATER, ULP_MAX_BUF, UDP_XMIT_HIWATER},
{UDP_XMIT_HIWATER} },
{ "_xmit_lowat", MOD_PROTO_UDP,
mod_set_uint32, mod_get_uint32,
- {0, (1<<30), UDP_XMIT_LOWATER},
+ {0, ULP_MAX_BUF, UDP_XMIT_LOWATER},
{UDP_XMIT_LOWATER} },
- { "recv_maxbuf", MOD_PROTO_UDP,
- mod_set_uint32, mod_get_uint32,
- {UDP_RECV_LOWATER, (1<<30), UDP_RECV_HIWATER},
+ { "recv_buf", MOD_PROTO_UDP,
+ udp_set_buf_prop, udp_get_buf_prop,
+ {UDP_RECV_LOWATER, ULP_MAX_BUF, UDP_RECV_HIWATER},
{UDP_RECV_HIWATER} },
/* tunable - 10 */
- { "_max_buf", MOD_PROTO_UDP,
+ { "max_buf", MOD_PROTO_UDP,
mod_set_uint32, mod_get_uint32,
- {65536, (1<<30), 2*1024*1024}, {2*1024*1024} },
+ {65536, ULP_MAX_BUF, 2*1024*1024}, {2*1024*1024} },
{ "_pmtu_discovery", MOD_PROTO_UDP,
mod_set_boolean, mod_get_boolean,