Skip to content

Commit

Permalink
sctp: fast recovery algorithm is per association.
Browse files Browse the repository at this point in the history
SCTP fast recovery algorithm really applies per association
and impacts all transports.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
  • Loading branch information
Vlad Yasevich committed May 1, 2010
1 parent b2cf9b6 commit cf9b481
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
12 changes: 6 additions & 6 deletions include/net/sctp/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -895,9 +895,6 @@ struct sctp_transport {
*/
hb_sent:1,

/* Flag to track the current fast recovery state */
fast_recovery:1,

/* Is the Path MTU update pending on this tranport */
pmtu_pending:1,

Expand Down Expand Up @@ -952,9 +949,6 @@ struct sctp_transport {

__u32 burst_limited; /* Holds old cwnd when max.burst is applied */

/* TSN marking the fast recovery exit point */
__u32 fast_recovery_exit;

/* Destination */
struct dst_entry *dst;
/* Source address. */
Expand Down Expand Up @@ -1723,6 +1717,12 @@ struct sctp_association {
/* Highest TSN that is acknowledged by incoming SACKs. */
__u32 highest_sacked;

/* TSN marking the fast recovery exit point */
__u32 fast_recovery_exit;

/* Flag to track the current fast recovery state */
__u8 fast_recovery;

/* The number of unacknowledged data chunks. Reported through
* the SCTP_STATUS sockopt.
*/
Expand Down
32 changes: 17 additions & 15 deletions net/sctp/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,16 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
void sctp_transport_raise_cwnd(struct sctp_transport *transport,
__u32 sack_ctsn, __u32 bytes_acked)
{
struct sctp_association *asoc = transport->asoc;
__u32 cwnd, ssthresh, flight_size, pba, pmtu;

cwnd = transport->cwnd;
flight_size = transport->flight_size;

/* See if we need to exit Fast Recovery first */
if (transport->fast_recovery &&
TSN_lte(transport->fast_recovery_exit, sack_ctsn))
transport->fast_recovery = 0;
if (asoc->fast_recovery &&
TSN_lte(asoc->fast_recovery_exit, sack_ctsn))
asoc->fast_recovery = 0;

/* The appropriate cwnd increase algorithm is performed if, and only
* if the cumulative TSN whould advanced and the congestion window is
Expand Down Expand Up @@ -415,7 +416,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,
* 2) the destination's path MTU. This upper bound protects
* against the ACK-Splitting attack outlined in [SAVAGE99].
*/
if (transport->fast_recovery)
if (asoc->fast_recovery)
return;

if (bytes_acked > pmtu)
Expand Down Expand Up @@ -466,6 +467,8 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,
void sctp_transport_lower_cwnd(struct sctp_transport *transport,
sctp_lower_cwnd_t reason)
{
struct sctp_association *asoc = transport->asoc;

switch (reason) {
case SCTP_LOWER_CWND_T3_RTX:
/* RFC 2960 Section 7.2.3, sctpimpguide
Expand All @@ -476,11 +479,11 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
* partial_bytes_acked = 0
*/
transport->ssthresh = max(transport->cwnd/2,
4*transport->asoc->pathmtu);
transport->cwnd = transport->asoc->pathmtu;
4*asoc->pathmtu);
transport->cwnd = asoc->pathmtu;

/* T3-rtx also clears fast recovery on the transport */
transport->fast_recovery = 0;
/* T3-rtx also clears fast recovery */
asoc->fast_recovery = 0;
break;

case SCTP_LOWER_CWND_FAST_RTX:
Expand All @@ -496,15 +499,15 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
* cwnd = ssthresh
* partial_bytes_acked = 0
*/
if (transport->fast_recovery)
if (asoc->fast_recovery)
return;

/* Mark Fast recovery */
transport->fast_recovery = 1;
transport->fast_recovery_exit = transport->asoc->next_tsn - 1;
asoc->fast_recovery = 1;
asoc->fast_recovery_exit = asoc->next_tsn - 1;

transport->ssthresh = max(transport->cwnd/2,
4*transport->asoc->pathmtu);
4*asoc->pathmtu);
transport->cwnd = transport->ssthresh;
break;

Expand All @@ -524,7 +527,7 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
if (time_after(jiffies, transport->last_time_ecne_reduced +
transport->rtt)) {
transport->ssthresh = max(transport->cwnd/2,
4*transport->asoc->pathmtu);
4*asoc->pathmtu);
transport->cwnd = transport->ssthresh;
transport->last_time_ecne_reduced = jiffies;
}
Expand All @@ -540,7 +543,7 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
* interval.
*/
transport->cwnd = max(transport->cwnd/2,
4*transport->asoc->pathmtu);
4*asoc->pathmtu);
break;
}

Expand Down Expand Up @@ -625,7 +628,6 @@ void sctp_transport_reset(struct sctp_transport *t)
t->error_count = 0;
t->rto_pending = 0;
t->hb_sent = 0;
t->fast_recovery = 0;

/* Initialize the state information for SFR-CACC */
t->cacc.changeover_active = 0;
Expand Down

0 comments on commit cf9b481

Please sign in to comment.