aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladislav Yasevich <vladislav.yasevich@hp.com>2006-08-22 16:29:17 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:55:39 -0400
commit3fd091e73b81f131e1567c4d4a1ec042940bf2f7 (patch)
treec08ebbeee329bbc31cb578db1dddde7394431f5f
parentce556b3a591fff3bebf8c5590a86aa98e1b2f153 (diff)
[SCTP]: Remove multiple levels of msecs to jiffies conversions.
The SCTP sysctl entries are displayed in milliseconds, but stored internally in jiffies. This results in multiple levels of msecs to jiffies conversion and as a result produces a truncation error. This patch makes things consistent in that we store and display defaults in milliseconds and only convert once for use by association. This patch also adds some sane min/max values so that we don't go off the deep end. Signed-off-by: Vladislav Yasevich <vladislav.yasevich@hp.com> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/sctp/constants.h13
-rw-r--r--include/net/sctp/structs.h12
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/sctp/socket.c15
-rw-r--r--net/sctp/sysctl.c140
-rw-r--r--net/sctp/transport.c2
6 files changed, 84 insertions, 100 deletions
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 57166bfdf8eb..6c632e26f72d 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -264,10 +264,10 @@ enum { SCTP_MAX_DUP_TSNS = 16 };
264enum { SCTP_MAX_GABS = 16 }; 264enum { SCTP_MAX_GABS = 16 };
265 265
266/* Heartbeat interval - 30 secs */ 266/* Heartbeat interval - 30 secs */
267#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30 * HZ) 267#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30*1000)
268 268
269/* Delayed sack timer - 200ms */ 269/* Delayed sack timer - 200ms */
270#define SCTP_DEFAULT_TIMEOUT_SACK ((200 * HZ) / 1000) 270#define SCTP_DEFAULT_TIMEOUT_SACK (200)
271 271
272/* RTO.Initial - 3 seconds 272/* RTO.Initial - 3 seconds
273 * RTO.Min - 1 second 273 * RTO.Min - 1 second
@@ -275,9 +275,9 @@ enum { SCTP_MAX_GABS = 16 };
275 * RTO.Alpha - 1/8 275 * RTO.Alpha - 1/8
276 * RTO.Beta - 1/4 276 * RTO.Beta - 1/4
277 */ 277 */
278#define SCTP_RTO_INITIAL (3 * HZ) 278#define SCTP_RTO_INITIAL (3 * 1000)
279#define SCTP_RTO_MIN (1 * HZ) 279#define SCTP_RTO_MIN (1 * 1000)
280#define SCTP_RTO_MAX (60 * HZ) 280#define SCTP_RTO_MAX (60 * 1000)
281 281
282#define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */ 282#define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */
283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ 283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */
@@ -290,8 +290,7 @@ enum { SCTP_MAX_GABS = 16 };
290#define SCTP_DEF_MAX_INIT 6 290#define SCTP_DEF_MAX_INIT 6
291#define SCTP_DEF_MAX_SEND 10 291#define SCTP_DEF_MAX_SEND 10
292 292
293#define SCTP_DEFAULT_COOKIE_LIFE_SEC 60 /* seconds */ 293#define SCTP_DEFAULT_COOKIE_LIFE (60 * 1000) /* 60 seconds */
294#define SCTP_DEFAULT_COOKIE_LIFE_USEC 0 /* microseconds */
295 294
296#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ 295#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */
297#define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ 296#define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 0412e730c765..c6d93bb0dcd2 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -128,9 +128,9 @@ extern struct sctp_globals {
128 * RTO.Alpha - 1/8 (3 when converted to right shifts.) 128 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
129 * RTO.Beta - 1/4 (2 when converted to right shifts.) 129 * RTO.Beta - 1/4 (2 when converted to right shifts.)
130 */ 130 */
131 unsigned long rto_initial; 131 unsigned int rto_initial;
132 unsigned long rto_min; 132 unsigned int rto_min;
133 unsigned long rto_max; 133 unsigned int rto_max;
134 134
135 /* Note: rto_alpha and rto_beta are really defined as inverse 135 /* Note: rto_alpha and rto_beta are really defined as inverse
136 * powers of two to facilitate integer operations. 136 * powers of two to facilitate integer operations.
@@ -145,13 +145,13 @@ extern struct sctp_globals {
145 int cookie_preserve_enable; 145 int cookie_preserve_enable;
146 146
147 /* Valid.Cookie.Life - 60 seconds */ 147 /* Valid.Cookie.Life - 60 seconds */
148 unsigned long valid_cookie_life; 148 unsigned int valid_cookie_life;
149 149
150 /* Delayed SACK timeout 200ms default*/ 150 /* Delayed SACK timeout 200ms default*/
151 unsigned long sack_timeout; 151 unsigned int sack_timeout;
152 152
153 /* HB.interval - 30 seconds */ 153 /* HB.interval - 30 seconds */
154 unsigned long hb_interval; 154 unsigned int hb_interval;
155 155
156 /* Association.Max.Retrans - 10 attempts 156 /* Association.Max.Retrans - 10 attempts
157 * Path.Max.Retrans - 5 attempts (per destination address) 157 * Path.Max.Retrans - 5 attempts (per destination address)
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 1ab03a27a76e..5692ef5485d3 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1049,7 +1049,7 @@ SCTP_STATIC __init int sctp_init(void)
1049 sctp_rto_beta = SCTP_RTO_BETA; 1049 sctp_rto_beta = SCTP_RTO_BETA;
1050 1050
1051 /* Valid.Cookie.Life - 60 seconds */ 1051 /* Valid.Cookie.Life - 60 seconds */
1052 sctp_valid_cookie_life = 60 * HZ; 1052 sctp_valid_cookie_life = SCTP_DEFAULT_COOKIE_LIFE;
1053 1053
1054 /* Whether Cookie Preservative is enabled(1) or not(0) */ 1054 /* Whether Cookie Preservative is enabled(1) or not(0) */
1055 sctp_cookie_preserve_enable = 1; 1055 sctp_cookie_preserve_enable = 1;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 3b6e82cb372f..7c1dbb1d10df 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3045,14 +3045,14 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
3045 sp->initmsg.sinit_num_ostreams = sctp_max_outstreams; 3045 sp->initmsg.sinit_num_ostreams = sctp_max_outstreams;
3046 sp->initmsg.sinit_max_instreams = sctp_max_instreams; 3046 sp->initmsg.sinit_max_instreams = sctp_max_instreams;
3047 sp->initmsg.sinit_max_attempts = sctp_max_retrans_init; 3047 sp->initmsg.sinit_max_attempts = sctp_max_retrans_init;
3048 sp->initmsg.sinit_max_init_timeo = jiffies_to_msecs(sctp_rto_max); 3048 sp->initmsg.sinit_max_init_timeo = sctp_rto_max;
3049 3049
3050 /* Initialize default RTO related parameters. These parameters can 3050 /* Initialize default RTO related parameters. These parameters can
3051 * be modified for with the SCTP_RTOINFO socket option. 3051 * be modified for with the SCTP_RTOINFO socket option.
3052 */ 3052 */
3053 sp->rtoinfo.srto_initial = jiffies_to_msecs(sctp_rto_initial); 3053 sp->rtoinfo.srto_initial = sctp_rto_initial;
3054 sp->rtoinfo.srto_max = jiffies_to_msecs(sctp_rto_max); 3054 sp->rtoinfo.srto_max = sctp_rto_max;
3055 sp->rtoinfo.srto_min = jiffies_to_msecs(sctp_rto_min); 3055 sp->rtoinfo.srto_min = sctp_rto_min;
3056 3056
3057 /* Initialize default association related parameters. These parameters 3057 /* Initialize default association related parameters. These parameters
3058 * can be modified with the SCTP_ASSOCINFO socket option. 3058 * can be modified with the SCTP_ASSOCINFO socket option.
@@ -3061,8 +3061,7 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
3061 sp->assocparams.sasoc_number_peer_destinations = 0; 3061 sp->assocparams.sasoc_number_peer_destinations = 0;
3062 sp->assocparams.sasoc_peer_rwnd = 0; 3062 sp->assocparams.sasoc_peer_rwnd = 0;
3063 sp->assocparams.sasoc_local_rwnd = 0; 3063 sp->assocparams.sasoc_local_rwnd = 0;
3064 sp->assocparams.sasoc_cookie_life = 3064 sp->assocparams.sasoc_cookie_life = sctp_valid_cookie_life;
3065 jiffies_to_msecs(sctp_valid_cookie_life);
3066 3065
3067 /* Initialize default event subscriptions. By default, all the 3066 /* Initialize default event subscriptions. By default, all the
3068 * options are off. 3067 * options are off.
@@ -3072,10 +3071,10 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
3072 /* Default Peer Address Parameters. These defaults can 3071 /* Default Peer Address Parameters. These defaults can
3073 * be modified via SCTP_PEER_ADDR_PARAMS 3072 * be modified via SCTP_PEER_ADDR_PARAMS
3074 */ 3073 */
3075 sp->hbinterval = jiffies_to_msecs(sctp_hb_interval); 3074 sp->hbinterval = sctp_hb_interval;
3076 sp->pathmaxrxt = sctp_max_retrans_path; 3075 sp->pathmaxrxt = sctp_max_retrans_path;
3077 sp->pathmtu = 0; // allow default discovery 3076 sp->pathmtu = 0; // allow default discovery
3078 sp->sackdelay = jiffies_to_msecs(sctp_sack_timeout); 3077 sp->sackdelay = sctp_sack_timeout;
3079 sp->param_flags = SPP_HB_ENABLE | 3078 sp->param_flags = SPP_HB_ENABLE |
3080 SPP_PMTUD_ENABLE | 3079 SPP_PMTUD_ENABLE |
3081 SPP_SACKDELAY_ENABLE; 3080 SPP_SACKDELAY_ENABLE;
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index dc6f3ff32358..633cd178654b 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -45,9 +45,10 @@
45#include <net/sctp/sctp.h> 45#include <net/sctp/sctp.h>
46#include <linux/sysctl.h> 46#include <linux/sysctl.h>
47 47
48static ctl_handler sctp_sysctl_jiffies_ms; 48static int zero = 0;
49static long rto_timer_min = 1; 49static int one = 1;
50static long rto_timer_max = 86400000; /* One day */ 50static int timer_max = 86400000; /* ms in one day */
51static int int_max = INT_MAX;
51static long sack_timer_min = 1; 52static long sack_timer_min = 1;
52static long sack_timer_max = 500; 53static long sack_timer_max = 500;
53 54
@@ -56,45 +57,45 @@ static ctl_table sctp_table[] = {
56 .ctl_name = NET_SCTP_RTO_INITIAL, 57 .ctl_name = NET_SCTP_RTO_INITIAL,
57 .procname = "rto_initial", 58 .procname = "rto_initial",
58 .data = &sctp_rto_initial, 59 .data = &sctp_rto_initial,
59 .maxlen = sizeof(long), 60 .maxlen = sizeof(unsigned int),
60 .mode = 0644, 61 .mode = 0644,
61 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 62 .proc_handler = &proc_dointvec_minmax,
62 .strategy = &sctp_sysctl_jiffies_ms, 63 .strategy = &sysctl_intvec,
63 .extra1 = &rto_timer_min, 64 .extra1 = &one,
64 .extra2 = &rto_timer_max 65 .extra2 = &timer_max
65 }, 66 },
66 { 67 {
67 .ctl_name = NET_SCTP_RTO_MIN, 68 .ctl_name = NET_SCTP_RTO_MIN,
68 .procname = "rto_min", 69 .procname = "rto_min",
69 .data = &sctp_rto_min, 70 .data = &sctp_rto_min,
70 .maxlen = sizeof(long), 71 .maxlen = sizeof(unsigned int),
71 .mode = 0644, 72 .mode = 0644,
72 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 73 .proc_handler = &proc_dointvec_minmax,
73 .strategy = &sctp_sysctl_jiffies_ms, 74 .strategy = &sysctl_intvec,
74 .extra1 = &rto_timer_min, 75 .extra1 = &one,
75 .extra2 = &rto_timer_max 76 .extra2 = &timer_max
76 }, 77 },
77 { 78 {
78 .ctl_name = NET_SCTP_RTO_MAX, 79 .ctl_name = NET_SCTP_RTO_MAX,
79 .procname = "rto_max", 80 .procname = "rto_max",
80 .data = &sctp_rto_max, 81 .data = &sctp_rto_max,
81 .maxlen = sizeof(long), 82 .maxlen = sizeof(unsigned int),
82 .mode = 0644, 83 .mode = 0644,
83 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 84 .proc_handler = &proc_dointvec_minmax,
84 .strategy = &sctp_sysctl_jiffies_ms, 85 .strategy = &sysctl_intvec,
85 .extra1 = &rto_timer_min, 86 .extra1 = &one,
86 .extra2 = &rto_timer_max 87 .extra2 = &timer_max
87 }, 88 },
88 { 89 {
89 .ctl_name = NET_SCTP_VALID_COOKIE_LIFE, 90 .ctl_name = NET_SCTP_VALID_COOKIE_LIFE,
90 .procname = "valid_cookie_life", 91 .procname = "valid_cookie_life",
91 .data = &sctp_valid_cookie_life, 92 .data = &sctp_valid_cookie_life,
92 .maxlen = sizeof(long), 93 .maxlen = sizeof(unsigned int),
93 .mode = 0644, 94 .mode = 0644,
94 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 95 .proc_handler = &proc_dointvec_minmax,
95 .strategy = &sctp_sysctl_jiffies_ms, 96 .strategy = &sysctl_intvec,
96 .extra1 = &rto_timer_min, 97 .extra1 = &one,
97 .extra2 = &rto_timer_max 98 .extra2 = &timer_max
98 }, 99 },
99 { 100 {
100 .ctl_name = NET_SCTP_MAX_BURST, 101 .ctl_name = NET_SCTP_MAX_BURST,
@@ -102,7 +103,10 @@ static ctl_table sctp_table[] = {
102 .data = &sctp_max_burst, 103 .data = &sctp_max_burst,
103 .maxlen = sizeof(int), 104 .maxlen = sizeof(int),
104 .mode = 0644, 105 .mode = 0644,
105 .proc_handler = &proc_dointvec 106 .proc_handler = &proc_dointvec_minmax,
107 .strategy = &sysctl_intvec,
108 .extra1 = &zero,
109 .extra2 = &int_max
106 }, 110 },
107 { 111 {
108 .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS, 112 .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS,
@@ -110,7 +114,10 @@ static ctl_table sctp_table[] = {
110 .data = &sctp_max_retrans_association, 114 .data = &sctp_max_retrans_association,
111 .maxlen = sizeof(int), 115 .maxlen = sizeof(int),
112 .mode = 0644, 116 .mode = 0644,
113 .proc_handler = &proc_dointvec 117 .proc_handler = &proc_dointvec_minmax,
118 .strategy = &sysctl_intvec,
119 .extra1 = &one,
120 .extra2 = &int_max
114 }, 121 },
115 { 122 {
116 .ctl_name = NET_SCTP_SNDBUF_POLICY, 123 .ctl_name = NET_SCTP_SNDBUF_POLICY,
@@ -118,7 +125,8 @@ static ctl_table sctp_table[] = {
118 .data = &sctp_sndbuf_policy, 125 .data = &sctp_sndbuf_policy,
119 .maxlen = sizeof(int), 126 .maxlen = sizeof(int),
120 .mode = 0644, 127 .mode = 0644,
121 .proc_handler = &proc_dointvec 128 .proc_handler = &proc_dointvec,
129 .strategy = &sysctl_intvec
122 }, 130 },
123 { 131 {
124 .ctl_name = NET_SCTP_RCVBUF_POLICY, 132 .ctl_name = NET_SCTP_RCVBUF_POLICY,
@@ -126,7 +134,8 @@ static ctl_table sctp_table[] = {
126 .data = &sctp_rcvbuf_policy, 134 .data = &sctp_rcvbuf_policy,
127 .maxlen = sizeof(int), 135 .maxlen = sizeof(int),
128 .mode = 0644, 136 .mode = 0644,
129 .proc_handler = &proc_dointvec 137 .proc_handler = &proc_dointvec,
138 .strategy = &sysctl_intvec
130 }, 139 },
131 { 140 {
132 .ctl_name = NET_SCTP_PATH_MAX_RETRANS, 141 .ctl_name = NET_SCTP_PATH_MAX_RETRANS,
@@ -134,7 +143,10 @@ static ctl_table sctp_table[] = {
134 .data = &sctp_max_retrans_path, 143 .data = &sctp_max_retrans_path,
135 .maxlen = sizeof(int), 144 .maxlen = sizeof(int),
136 .mode = 0644, 145 .mode = 0644,
137 .proc_handler = &proc_dointvec 146 .proc_handler = &proc_dointvec_minmax,
147 .strategy = &sysctl_intvec,
148 .extra1 = &one,
149 .extra2 = &int_max
138 }, 150 },
139 { 151 {
140 .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS, 152 .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS,
@@ -142,18 +154,21 @@ static ctl_table sctp_table[] = {
142 .data = &sctp_max_retrans_init, 154 .data = &sctp_max_retrans_init,
143 .maxlen = sizeof(int), 155 .maxlen = sizeof(int),
144 .mode = 0644, 156 .mode = 0644,
145 .proc_handler = &proc_dointvec 157 .proc_handler = &proc_dointvec_minmax,
158 .strategy = &sysctl_intvec,
159 .extra1 = &one,
160 .extra2 = &int_max
146 }, 161 },
147 { 162 {
148 .ctl_name = NET_SCTP_HB_INTERVAL, 163 .ctl_name = NET_SCTP_HB_INTERVAL,
149 .procname = "hb_interval", 164 .procname = "hb_interval",
150 .data = &sctp_hb_interval, 165 .data = &sctp_hb_interval,
151 .maxlen = sizeof(long), 166 .maxlen = sizeof(unsigned int),
152 .mode = 0644, 167 .mode = 0644,
153 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 168 .proc_handler = &proc_dointvec_minmax,
154 .strategy = &sctp_sysctl_jiffies_ms, 169 .strategy = &sysctl_intvec,
155 .extra1 = &rto_timer_min, 170 .extra1 = &one,
156 .extra2 = &rto_timer_max 171 .extra2 = &timer_max
157 }, 172 },
158 { 173 {
159 .ctl_name = NET_SCTP_PRESERVE_ENABLE, 174 .ctl_name = NET_SCTP_PRESERVE_ENABLE,
@@ -161,23 +176,26 @@ static ctl_table sctp_table[] = {
161 .data = &sctp_cookie_preserve_enable, 176 .data = &sctp_cookie_preserve_enable,
162 .maxlen = sizeof(int), 177 .maxlen = sizeof(int),
163 .mode = 0644, 178 .mode = 0644,
164 .proc_handler = &proc_dointvec 179 .proc_handler = &proc_dointvec,
180 .strategy = &sysctl_intvec
165 }, 181 },
166 { 182 {
167 .ctl_name = NET_SCTP_RTO_ALPHA, 183 .ctl_name = NET_SCTP_RTO_ALPHA,
168 .procname = "rto_alpha_exp_divisor", 184 .procname = "rto_alpha_exp_divisor",
169 .data = &sctp_rto_alpha, 185 .data = &sctp_rto_alpha,
170 .maxlen = sizeof(int), 186 .maxlen = sizeof(int),
171 .mode = 0644, 187 .mode = 0444,
172 .proc_handler = &proc_dointvec 188 .proc_handler = &proc_dointvec,
189 .strategy = &sysctl_intvec
173 }, 190 },
174 { 191 {
175 .ctl_name = NET_SCTP_RTO_BETA, 192 .ctl_name = NET_SCTP_RTO_BETA,
176 .procname = "rto_beta_exp_divisor", 193 .procname = "rto_beta_exp_divisor",
177 .data = &sctp_rto_beta, 194 .data = &sctp_rto_beta,
178 .maxlen = sizeof(int), 195 .maxlen = sizeof(int),
179 .mode = 0644, 196 .mode = 0444,
180 .proc_handler = &proc_dointvec 197 .proc_handler = &proc_dointvec,
198 .strategy = &sysctl_intvec
181 }, 199 },
182 { 200 {
183 .ctl_name = NET_SCTP_ADDIP_ENABLE, 201 .ctl_name = NET_SCTP_ADDIP_ENABLE,
@@ -185,7 +203,8 @@ static ctl_table sctp_table[] = {
185 .data = &sctp_addip_enable, 203 .data = &sctp_addip_enable,
186 .maxlen = sizeof(int), 204 .maxlen = sizeof(int),
187 .mode = 0644, 205 .mode = 0644,
188 .proc_handler = &proc_dointvec 206 .proc_handler = &proc_dointvec,
207 .strategy = &sysctl_intvec
189 }, 208 },
190 { 209 {
191 .ctl_name = NET_SCTP_PRSCTP_ENABLE, 210 .ctl_name = NET_SCTP_PRSCTP_ENABLE,
@@ -193,7 +212,8 @@ static ctl_table sctp_table[] = {
193 .data = &sctp_prsctp_enable, 212 .data = &sctp_prsctp_enable,
194 .maxlen = sizeof(int), 213 .maxlen = sizeof(int),
195 .mode = 0644, 214 .mode = 0644,
196 .proc_handler = &proc_dointvec 215 .proc_handler = &proc_dointvec,
216 .strategy = &sysctl_intvec
197 }, 217 },
198 { 218 {
199 .ctl_name = NET_SCTP_SACK_TIMEOUT, 219 .ctl_name = NET_SCTP_SACK_TIMEOUT,
@@ -201,8 +221,8 @@ static ctl_table sctp_table[] = {
201 .data = &sctp_sack_timeout, 221 .data = &sctp_sack_timeout,
202 .maxlen = sizeof(long), 222 .maxlen = sizeof(long),
203 .mode = 0644, 223 .mode = 0644,
204 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 224 .proc_handler = &proc_dointvec_minmax,
205 .strategy = &sctp_sysctl_jiffies_ms, 225 .strategy = &sysctl_intvec,
206 .extra1 = &sack_timer_min, 226 .extra1 = &sack_timer_min,
207 .extra2 = &sack_timer_max, 227 .extra2 = &sack_timer_max,
208 }, 228 },
@@ -242,37 +262,3 @@ void sctp_sysctl_unregister(void)
242{ 262{
243 unregister_sysctl_table(sctp_sysctl_header); 263 unregister_sysctl_table(sctp_sysctl_header);
244} 264}
245
246/* Strategy function to convert jiffies to milliseconds. */
247static int sctp_sysctl_jiffies_ms(ctl_table *table, int __user *name, int nlen,
248 void __user *oldval, size_t __user *oldlenp,
249 void __user *newval, size_t newlen, void **context) {
250
251 if (oldval) {
252 size_t olen;
253
254 if (oldlenp) {
255 if (get_user(olen, oldlenp))
256 return -EFAULT;
257
258 if (olen != sizeof (int))
259 return -EINVAL;
260 }
261 if (put_user((*(int *)(table->data) * 1000) / HZ,
262 (int __user *)oldval) ||
263 (oldlenp && put_user(sizeof (int), oldlenp)))
264 return -EFAULT;
265 }
266 if (newval && newlen) {
267 int new;
268
269 if (newlen != sizeof (int))
270 return -EINVAL;
271
272 if (get_user(new, (int __user *)newval))
273 return -EFAULT;
274
275 *(int *)(table->data) = (new * HZ) / 1000;
276 }
277 return 1;
278}
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 2763aa93de1a..3e5936a5f671 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -75,7 +75,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
75 * parameter 'RTO.Initial'. 75 * parameter 'RTO.Initial'.
76 */ 76 */
77 peer->rtt = 0; 77 peer->rtt = 0;
78 peer->rto = sctp_rto_initial; 78 peer->rto = msecs_to_jiffies(sctp_rto_initial);
79 peer->rttvar = 0; 79 peer->rttvar = 0;
80 peer->srtt = 0; 80 peer->srtt = 0;
81 peer->rto_pending = 0; 81 peer->rto_pending = 0;