Commit 1e7d3d90c95b32374057e454417b2f50440be20e

Authored by Vladislav Yasevich
Committed by David S. Miller
1 parent 23ec47a088

[SCTP]: Remove timeouts[] array from sctp_endpoint.

The socket level timeout values are maintained in sctp_sock and
association level timeouts are in sctp_association. So there is
no need for ep->timeouts.

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>

Showing 5 changed files with 25 additions and 32 deletions Side-by-side Diff

include/net/sctp/structs.h
... ... @@ -1222,9 +1222,6 @@
1222 1222 int last_key;
1223 1223 int key_changed_at;
1224 1224  
1225   - /* Default timeouts. */
1226   - int timeouts[SCTP_NUM_TIMEOUT_TYPES];
1227   -
1228 1225 /* sendbuf acct. policy. */
1229 1226 __u32 sndbuf_policy;
1230 1227 };
net/sctp/associola.c
... ... @@ -128,9 +128,29 @@
128 128 */
129 129 asoc->max_burst = sctp_max_burst;
130 130  
131   - /* Copy things from the endpoint. */
  131 + /* initialize association timers */
  132 + asoc->timeouts[SCTP_EVENT_TIMEOUT_NONE] = 0;
  133 + asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = asoc->rto_initial;
  134 + asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = asoc->rto_initial;
  135 + asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = asoc->rto_initial;
  136 + asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] = 0;
  137 + asoc->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = 0;
  138 +
  139 + /* sctpimpguide Section 2.12.2
  140 + * If the 'T5-shutdown-guard' timer is used, it SHOULD be set to the
  141 + * recommended value of 5 times 'RTO.Max'.
  142 + */
  143 + asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD]
  144 + = 5 * asoc->rto_max;
  145 +
  146 + asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0;
  147 + asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] =
  148 + SCTP_DEFAULT_TIMEOUT_SACK;
  149 + asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
  150 + sp->autoclose * HZ;
  151 +
  152 + /* Initilizes the timers */
132 153 for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) {
133   - asoc->timeouts[i] = ep->timeouts[i];
134 154 init_timer(&asoc->timers[i]);
135 155 asoc->timers[i].function = sctp_timer_events[i];
136 156 asoc->timers[i].data = (unsigned long) asoc;
net/sctp/endpointola.c
... ... @@ -70,7 +70,6 @@
70 70 struct sock *sk,
71 71 gfp_t gfp)
72 72 {
73   - struct sctp_sock *sp = sctp_sk(sk);
74 73 memset(ep, 0, sizeof(struct sctp_endpoint));
75 74  
76 75 /* Initialize the base structure. */
... ... @@ -99,28 +98,6 @@
99 98  
100 99 /* Create the lists of associations. */
101 100 INIT_LIST_HEAD(&ep->asocs);
102   -
103   - /* Set up the base timeout information. */
104   - ep->timeouts[SCTP_EVENT_TIMEOUT_NONE] = 0;
105   - ep->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] =
106   - msecs_to_jiffies(sp->rtoinfo.srto_initial);
107   - ep->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] =
108   - msecs_to_jiffies(sp->rtoinfo.srto_initial);
109   - ep->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] =
110   - msecs_to_jiffies(sp->rtoinfo.srto_initial);
111   - ep->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] = 0;
112   - ep->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = 0;
113   -
114   - /* sctpimpguide-05 Section 2.12.2
115   - * If the 'T5-shutdown-guard' timer is used, it SHOULD be set to the
116   - * recommended value of 5 times 'RTO.Max'.
117   - */
118   - ep->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD]
119   - = 5 * msecs_to_jiffies(sp->rtoinfo.srto_max);
120   -
121   - ep->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0;
122   - ep->timeouts[SCTP_EVENT_TIMEOUT_SACK] = sctp_sack_timeout;
123   - ep->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ;
124 101  
125 102 /* Use SCTP specific send buffer space queues. */
126 103 ep->sndbuf_policy = sctp_sndbuf_policy;
net/sctp/sm_sideeffect.c
... ... @@ -385,7 +385,7 @@
385 385 NULL,
386 386 sctp_generate_t4_rto_event,
387 387 sctp_generate_t5_shutdown_guard_event,
388   - sctp_generate_heartbeat_event,
  388 + NULL,
389 389 sctp_generate_sack_event,
390 390 sctp_generate_autoclose_event,
391 391 };
392 392  
... ... @@ -689,9 +689,9 @@
689 689 * increased due to timer expirations.
690 690 */
691 691 asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] =
692   - asoc->ep->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT];
  692 + asoc->rto_initial;
693 693 asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] =
694   - asoc->ep->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE];
  694 + asoc->rto_initial;
695 695 }
696 696  
697 697 if (sctp_state(asoc, ESTABLISHED) ||
... ... @@ -1932,7 +1932,6 @@
1932 1932 if (copy_from_user(&sp->autoclose, optval, optlen))
1933 1933 return -EFAULT;
1934 1934  
1935   - sp->ep->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ;
1936 1935 return 0;
1937 1936 }
1938 1937