[SCTP] Make init & delayed sack timeouts configurable by user.
authorVlad Yasevich <vladislav.yasevich@hp.com>
Tue, 28 Jun 2005 20:24:23 +0000 (13:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Jun 2005 20:24:23 +0000 (13:24 -0700)
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/sysctl.h
include/net/sctp/constants.h
include/net/sctp/structs.h
net/sctp/endpointola.c
net/sctp/protocol.c
net/sctp/sysctl.c
net/sctp/transport.c

index ebfe1250f0a4a3ba1fc8158cdeb02b6c413f6ff6..5b5f434ac9a08e96634564ae77a06f1dfe570fda 100644 (file)
@@ -641,6 +641,7 @@ enum {
        NET_SCTP_ADDIP_ENABLE            = 13,
        NET_SCTP_PRSCTP_ENABLE           = 14,
        NET_SCTP_SNDBUF_POLICY           = 15,
+       NET_SCTP_SACK_TIMEOUT            = 16,
 };
 
 /* /proc/sys/net/bridge */
index 4868c7f7749dab76a2abbffdf81ca28e2d0609b8..5999e5684bbfc5136f36964fb3ebe2c0e669f9b1 100644 (file)
@@ -263,23 +263,11 @@ enum { SCTP_MIN_PMTU = 576 };
 enum { SCTP_MAX_DUP_TSNS = 16 };
 enum { SCTP_MAX_GABS = 16 };
 
-/* Here we define the default timers.  */
+/* Heartbeat interval - 30 secs */
+#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30 * HZ)
 
-/* cookie timer def = ? seconds */
-#define SCTP_DEFAULT_TIMEOUT_T1_COOKIE (3 * HZ)
-
-/* init timer def = 3 seconds  */
-#define SCTP_DEFAULT_TIMEOUT_T1_INIT   (3 * HZ)
-
-/* shutdown timer def = 300 ms */
-#define SCTP_DEFAULT_TIMEOUT_T2_SHUTDOWN ((300 * HZ) / 1000)
-
-/* 0 seconds + RTO */
-#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (10 * HZ)
-
-/* recv timer def = 200ms (in usec) */
+/* Delayed sack timer - 200ms */
 #define SCTP_DEFAULT_TIMEOUT_SACK      ((200 * HZ) / 1000)
-#define SCTP_DEFAULT_TIMEOUT_SACK_MAX  ((500 * HZ) / 1000) /* 500 ms */
 
 /* RTO.Initial              - 3  seconds
  * RTO.Min                  - 1  second
index dfad4d3c581c483c149321df4346b6e52532cacb..47727c7cc628abe7af68a9c69defdb7f11343ee0 100644 (file)
@@ -161,6 +161,9 @@ extern struct sctp_globals {
         */
        int sndbuf_policy;
 
+       /* Delayed SACK timeout  200ms default*/
+       int sack_timeout;
+
        /* HB.interval              - 30 seconds  */
        int hb_interval;
 
@@ -217,6 +220,7 @@ extern struct sctp_globals {
 #define sctp_sndbuf_policy             (sctp_globals.sndbuf_policy)
 #define sctp_max_retrans_path          (sctp_globals.max_retrans_path)
 #define sctp_max_retrans_init          (sctp_globals.max_retrans_init)
+#define sctp_sack_timeout              (sctp_globals.sack_timeout)
 #define sctp_hb_interval               (sctp_globals.hb_interval)
 #define sctp_max_instreams             (sctp_globals.max_instreams)
 #define sctp_max_outstreams            (sctp_globals.max_outstreams)
index 2ec0320fac3b5634bbd62e6f8905d179314431ce..c44bf4165c6e6214d8e4a4c6b3192d2638fa95ff 100644 (file)
@@ -102,9 +102,9 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
        /* Set up the base timeout information.  */
        ep->timeouts[SCTP_EVENT_TIMEOUT_NONE] = 0;
        ep->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] =
-               SCTP_DEFAULT_TIMEOUT_T1_COOKIE;
+               msecs_to_jiffies(sp->rtoinfo.srto_initial);
        ep->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] =
-               SCTP_DEFAULT_TIMEOUT_T1_INIT;
+               msecs_to_jiffies(sp->rtoinfo.srto_initial);
        ep->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] =
                msecs_to_jiffies(sp->rtoinfo.srto_initial);
        ep->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] = 0;
@@ -117,12 +117,9 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
         ep->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD]
                = 5 * msecs_to_jiffies(sp->rtoinfo.srto_max);
 
-       ep->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] =
-               SCTP_DEFAULT_TIMEOUT_HEARTBEAT;
-       ep->timeouts[SCTP_EVENT_TIMEOUT_SACK] =
-               SCTP_DEFAULT_TIMEOUT_SACK;
-       ep->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
-               sp->autoclose * HZ;
+       ep->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0;
+       ep->timeouts[SCTP_EVENT_TIMEOUT_SACK] = sctp_sack_timeout;
+       ep->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ;
 
        /* Use SCTP specific send buffer space queues.  */
        ep->sndbuf_policy = sctp_sndbuf_policy;
index 5135e1a25d25c1413984520c7204f6df3d7d2df4..e7f37faba7c0f8be68b432d885d1bf513d525e61 100644 (file)
@@ -1050,7 +1050,10 @@ SCTP_STATIC __init int sctp_init(void)
        sctp_sndbuf_policy              = 0;
 
        /* HB.interval              - 30 seconds */
-       sctp_hb_interval                = 30 * HZ;
+       sctp_hb_interval                = SCTP_DEFAULT_TIMEOUT_HEARTBEAT;
+
+       /* delayed SACK timeout */
+       sctp_sack_timeout               = SCTP_DEFAULT_TIMEOUT_SACK;
 
        /* Implementation specific variables. */
 
index 7fc31849312ba85976eb1024161d057b02c672a2..dc4893474f186e68b93225cdba82ba71000f9831 100644 (file)
@@ -47,6 +47,8 @@
 static ctl_handler sctp_sysctl_jiffies_ms;
 static long rto_timer_min = 1;
 static long rto_timer_max = 86400000; /* One day */
+static long sack_timer_min = 1;
+static long sack_timer_max = 500;
 
 static ctl_table sctp_table[] = {
        {
@@ -187,6 +189,17 @@ static ctl_table sctp_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_dointvec
        },
+       {
+               .ctl_name       = NET_SCTP_SACK_TIMEOUT,
+               .procname       = "sack_timeout",
+               .data           = &sctp_sack_timeout,
+               .maxlen         = sizeof(long),
+               .mode           = 0644,
+               .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
+               .strategy       = &sctp_sysctl_jiffies_ms,
+               .extra1         = &sack_timer_min,
+               .extra2         = &sack_timer_max,
+       },
        { .ctl_name = 0 }
 };
 
index 0ec0fde6e6c596d19727fa831dd61991fa4c7a47..a63b691796074bbaa52ac24f216f75a5e46c93fa 100644 (file)
@@ -103,7 +103,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
 
        /* Set up the heartbeat timer. */
        init_timer(&peer->hb_timer);
-       peer->hb_interval = SCTP_DEFAULT_TIMEOUT_HEARTBEAT;
        peer->hb_timer.function = sctp_generate_heartbeat_event;
        peer->hb_timer.data = (unsigned long)peer;