diff options
Diffstat (limited to 'net/sctp/transport.c')
-rw-r--r-- | net/sctp/transport.c | 61 |
1 files changed, 19 insertions, 42 deletions
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 165d54e07fcd..132046cb82fc 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -64,9 +64,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
64 | /* Copy in the address. */ | 64 | /* Copy in the address. */ |
65 | peer->ipaddr = *addr; | 65 | peer->ipaddr = *addr; |
66 | peer->af_specific = sctp_get_af_specific(addr->sa.sa_family); | 66 | peer->af_specific = sctp_get_af_specific(addr->sa.sa_family); |
67 | peer->asoc = NULL; | ||
68 | |||
69 | peer->dst = NULL; | ||
70 | memset(&peer->saddr, 0, sizeof(union sctp_addr)); | 67 | memset(&peer->saddr, 0, sizeof(union sctp_addr)); |
71 | 68 | ||
72 | /* From 6.3.1 RTO Calculation: | 69 | /* From 6.3.1 RTO Calculation: |
@@ -76,34 +73,21 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
76 | * parameter 'RTO.Initial'. | 73 | * parameter 'RTO.Initial'. |
77 | */ | 74 | */ |
78 | peer->rto = msecs_to_jiffies(sctp_rto_initial); | 75 | peer->rto = msecs_to_jiffies(sctp_rto_initial); |
79 | peer->rtt = 0; | ||
80 | peer->rttvar = 0; | ||
81 | peer->srtt = 0; | ||
82 | peer->rto_pending = 0; | ||
83 | peer->hb_sent = 0; | ||
84 | peer->fast_recovery = 0; | ||
85 | 76 | ||
86 | peer->last_time_heard = jiffies; | 77 | peer->last_time_heard = jiffies; |
87 | peer->last_time_ecne_reduced = jiffies; | 78 | peer->last_time_ecne_reduced = jiffies; |
88 | 79 | ||
89 | peer->init_sent_count = 0; | ||
90 | |||
91 | peer->param_flags = SPP_HB_DISABLE | | 80 | peer->param_flags = SPP_HB_DISABLE | |
92 | SPP_PMTUD_ENABLE | | 81 | SPP_PMTUD_ENABLE | |
93 | SPP_SACKDELAY_ENABLE; | 82 | SPP_SACKDELAY_ENABLE; |
94 | peer->hbinterval = 0; | ||
95 | 83 | ||
96 | /* Initialize the default path max_retrans. */ | 84 | /* Initialize the default path max_retrans. */ |
97 | peer->pathmaxrxt = sctp_max_retrans_path; | 85 | peer->pathmaxrxt = sctp_max_retrans_path; |
98 | peer->error_count = 0; | ||
99 | 86 | ||
100 | INIT_LIST_HEAD(&peer->transmitted); | 87 | INIT_LIST_HEAD(&peer->transmitted); |
101 | INIT_LIST_HEAD(&peer->send_ready); | 88 | INIT_LIST_HEAD(&peer->send_ready); |
102 | INIT_LIST_HEAD(&peer->transports); | 89 | INIT_LIST_HEAD(&peer->transports); |
103 | 90 | ||
104 | peer->T3_rtx_timer.expires = 0; | ||
105 | peer->hb_timer.expires = 0; | ||
106 | |||
107 | setup_timer(&peer->T3_rtx_timer, sctp_generate_t3_rtx_event, | 91 | setup_timer(&peer->T3_rtx_timer, sctp_generate_t3_rtx_event, |
108 | (unsigned long)peer); | 92 | (unsigned long)peer); |
109 | setup_timer(&peer->hb_timer, sctp_generate_heartbeat_event, | 93 | setup_timer(&peer->hb_timer, sctp_generate_heartbeat_event, |
@@ -115,15 +99,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
115 | get_random_bytes(&peer->hb_nonce, sizeof(peer->hb_nonce)); | 99 | get_random_bytes(&peer->hb_nonce, sizeof(peer->hb_nonce)); |
116 | 100 | ||
117 | atomic_set(&peer->refcnt, 1); | 101 | atomic_set(&peer->refcnt, 1); |
118 | peer->dead = 0; | ||
119 | |||
120 | peer->malloced = 0; | ||
121 | |||
122 | /* Initialize the state information for SFR-CACC */ | ||
123 | peer->cacc.changeover_active = 0; | ||
124 | peer->cacc.cycling_changeover = 0; | ||
125 | peer->cacc.next_tsn_at_change = 0; | ||
126 | peer->cacc.cacc_saw_newack = 0; | ||
127 | 102 | ||
128 | return peer; | 103 | return peer; |
129 | } | 104 | } |
@@ -201,7 +176,7 @@ static void sctp_transport_destroy(struct sctp_transport *transport) | |||
201 | /* Start T3_rtx timer if it is not already running and update the heartbeat | 176 | /* Start T3_rtx timer if it is not already running and update the heartbeat |
202 | * timer. This routine is called every time a DATA chunk is sent. | 177 | * timer. This routine is called every time a DATA chunk is sent. |
203 | */ | 178 | */ |
204 | void sctp_transport_reset_timers(struct sctp_transport *transport, int force) | 179 | void sctp_transport_reset_timers(struct sctp_transport *transport) |
205 | { | 180 | { |
206 | /* RFC 2960 6.3.2 Retransmission Timer Rules | 181 | /* RFC 2960 6.3.2 Retransmission Timer Rules |
207 | * | 182 | * |
@@ -211,7 +186,7 @@ void sctp_transport_reset_timers(struct sctp_transport *transport, int force) | |||
211 | * address. | 186 | * address. |
212 | */ | 187 | */ |
213 | 188 | ||
214 | if (force || !timer_pending(&transport->T3_rtx_timer)) | 189 | if (!timer_pending(&transport->T3_rtx_timer)) |
215 | if (!mod_timer(&transport->T3_rtx_timer, | 190 | if (!mod_timer(&transport->T3_rtx_timer, |
216 | jiffies + transport->rto)) | 191 | jiffies + transport->rto)) |
217 | sctp_transport_hold(transport); | 192 | sctp_transport_hold(transport); |
@@ -409,15 +384,16 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt) | |||
409 | void sctp_transport_raise_cwnd(struct sctp_transport *transport, | 384 | void sctp_transport_raise_cwnd(struct sctp_transport *transport, |
410 | __u32 sack_ctsn, __u32 bytes_acked) | 385 | __u32 sack_ctsn, __u32 bytes_acked) |
411 | { | 386 | { |
387 | struct sctp_association *asoc = transport->asoc; | ||
412 | __u32 cwnd, ssthresh, flight_size, pba, pmtu; | 388 | __u32 cwnd, ssthresh, flight_size, pba, pmtu; |
413 | 389 | ||
414 | cwnd = transport->cwnd; | 390 | cwnd = transport->cwnd; |
415 | flight_size = transport->flight_size; | 391 | flight_size = transport->flight_size; |
416 | 392 | ||
417 | /* See if we need to exit Fast Recovery first */ | 393 | /* See if we need to exit Fast Recovery first */ |
418 | if (transport->fast_recovery && | 394 | if (asoc->fast_recovery && |
419 | TSN_lte(transport->fast_recovery_exit, sack_ctsn)) | 395 | TSN_lte(asoc->fast_recovery_exit, sack_ctsn)) |
420 | transport->fast_recovery = 0; | 396 | asoc->fast_recovery = 0; |
421 | 397 | ||
422 | /* The appropriate cwnd increase algorithm is performed if, and only | 398 | /* The appropriate cwnd increase algorithm is performed if, and only |
423 | * if the cumulative TSN whould advanced and the congestion window is | 399 | * if the cumulative TSN whould advanced and the congestion window is |
@@ -446,7 +422,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport, | |||
446 | * 2) the destination's path MTU. This upper bound protects | 422 | * 2) the destination's path MTU. This upper bound protects |
447 | * against the ACK-Splitting attack outlined in [SAVAGE99]. | 423 | * against the ACK-Splitting attack outlined in [SAVAGE99]. |
448 | */ | 424 | */ |
449 | if (transport->fast_recovery) | 425 | if (asoc->fast_recovery) |
450 | return; | 426 | return; |
451 | 427 | ||
452 | if (bytes_acked > pmtu) | 428 | if (bytes_acked > pmtu) |
@@ -497,6 +473,8 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport, | |||
497 | void sctp_transport_lower_cwnd(struct sctp_transport *transport, | 473 | void sctp_transport_lower_cwnd(struct sctp_transport *transport, |
498 | sctp_lower_cwnd_t reason) | 474 | sctp_lower_cwnd_t reason) |
499 | { | 475 | { |
476 | struct sctp_association *asoc = transport->asoc; | ||
477 | |||
500 | switch (reason) { | 478 | switch (reason) { |
501 | case SCTP_LOWER_CWND_T3_RTX: | 479 | case SCTP_LOWER_CWND_T3_RTX: |
502 | /* RFC 2960 Section 7.2.3, sctpimpguide | 480 | /* RFC 2960 Section 7.2.3, sctpimpguide |
@@ -507,11 +485,11 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, | |||
507 | * partial_bytes_acked = 0 | 485 | * partial_bytes_acked = 0 |
508 | */ | 486 | */ |
509 | transport->ssthresh = max(transport->cwnd/2, | 487 | transport->ssthresh = max(transport->cwnd/2, |
510 | 4*transport->asoc->pathmtu); | 488 | 4*asoc->pathmtu); |
511 | transport->cwnd = transport->asoc->pathmtu; | 489 | transport->cwnd = asoc->pathmtu; |
512 | 490 | ||
513 | /* T3-rtx also clears fast recovery on the transport */ | 491 | /* T3-rtx also clears fast recovery */ |
514 | transport->fast_recovery = 0; | 492 | asoc->fast_recovery = 0; |
515 | break; | 493 | break; |
516 | 494 | ||
517 | case SCTP_LOWER_CWND_FAST_RTX: | 495 | case SCTP_LOWER_CWND_FAST_RTX: |
@@ -527,15 +505,15 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, | |||
527 | * cwnd = ssthresh | 505 | * cwnd = ssthresh |
528 | * partial_bytes_acked = 0 | 506 | * partial_bytes_acked = 0 |
529 | */ | 507 | */ |
530 | if (transport->fast_recovery) | 508 | if (asoc->fast_recovery) |
531 | return; | 509 | return; |
532 | 510 | ||
533 | /* Mark Fast recovery */ | 511 | /* Mark Fast recovery */ |
534 | transport->fast_recovery = 1; | 512 | asoc->fast_recovery = 1; |
535 | transport->fast_recovery_exit = transport->asoc->next_tsn - 1; | 513 | asoc->fast_recovery_exit = asoc->next_tsn - 1; |
536 | 514 | ||
537 | transport->ssthresh = max(transport->cwnd/2, | 515 | transport->ssthresh = max(transport->cwnd/2, |
538 | 4*transport->asoc->pathmtu); | 516 | 4*asoc->pathmtu); |
539 | transport->cwnd = transport->ssthresh; | 517 | transport->cwnd = transport->ssthresh; |
540 | break; | 518 | break; |
541 | 519 | ||
@@ -555,7 +533,7 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, | |||
555 | if (time_after(jiffies, transport->last_time_ecne_reduced + | 533 | if (time_after(jiffies, transport->last_time_ecne_reduced + |
556 | transport->rtt)) { | 534 | transport->rtt)) { |
557 | transport->ssthresh = max(transport->cwnd/2, | 535 | transport->ssthresh = max(transport->cwnd/2, |
558 | 4*transport->asoc->pathmtu); | 536 | 4*asoc->pathmtu); |
559 | transport->cwnd = transport->ssthresh; | 537 | transport->cwnd = transport->ssthresh; |
560 | transport->last_time_ecne_reduced = jiffies; | 538 | transport->last_time_ecne_reduced = jiffies; |
561 | } | 539 | } |
@@ -571,7 +549,7 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, | |||
571 | * interval. | 549 | * interval. |
572 | */ | 550 | */ |
573 | transport->cwnd = max(transport->cwnd/2, | 551 | transport->cwnd = max(transport->cwnd/2, |
574 | 4*transport->asoc->pathmtu); | 552 | 4*asoc->pathmtu); |
575 | break; | 553 | break; |
576 | } | 554 | } |
577 | 555 | ||
@@ -656,7 +634,6 @@ void sctp_transport_reset(struct sctp_transport *t) | |||
656 | t->error_count = 0; | 634 | t->error_count = 0; |
657 | t->rto_pending = 0; | 635 | t->rto_pending = 0; |
658 | t->hb_sent = 0; | 636 | t->hb_sent = 0; |
659 | t->fast_recovery = 0; | ||
660 | 637 | ||
661 | /* Initialize the state information for SFR-CACC */ | 638 | /* Initialize the state information for SFR-CACC */ |
662 | t->cacc.changeover_active = 0; | 639 | t->cacc.changeover_active = 0; |