diff options
author | Sebastien Roy <seb@delphix.com> | 2013-08-01 17:47:00 -0800 |
---|---|---|
committer | Christopher Siden <chris.siden@delphix.com> | 2013-08-01 18:47:01 -0700 |
commit | 299625c6492013aa7bd163862f0d181854f69b3c (patch) | |
tree | d84f72b9de7c9f9cee6a7bdd01809e048a2e607f /usr/src/uts/common/inet/tcp/tcp_tunables.c | |
parent | a29160b0f5f650ae34e2273cacdd3eff15c62fba (diff) | |
download | illumos-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>
Diffstat (limited to 'usr/src/uts/common/inet/tcp/tcp_tunables.c')
-rw-r--r-- | usr/src/uts/common/inet/tcp/tcp_tunables.c | 73 |
1 files changed, 42 insertions, 31 deletions
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? |