diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2008-06-19 18:17:24 -0400 |
---|---|---|
committer | Vlad Yasevich <vladislav.yasevich@hp.com> | 2008-10-01 11:33:06 -0400 |
commit | ab5216a5bd453752f04bb79c29e8f01b11d69006 (patch) | |
tree | 414dacc0b4275e9477d5d9f10f77a3543ee7cb96 /net/sctp/outqueue.c | |
parent | 2cd9b822bfa79fc1335d3e71a0449f3cd0b5078e (diff) |
sctp: Optimize SFR-CACC transport list walking during SACK processing
There is a possibility of walking the transport list twice during
SACK processing when doing SFR-CACC algorithm. We can restructure
the code to only do this once.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp/outqueue.c')
-rw-r--r-- | net/sctp/outqueue.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index ef5ea7423cc8..c8de4da57f36 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -1145,27 +1145,31 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1145 | * on the current primary, the CHANGEOVER_ACTIVE flag SHOULD be | 1145 | * on the current primary, the CHANGEOVER_ACTIVE flag SHOULD be |
1146 | * cleared. The CYCLING_CHANGEOVER flag SHOULD also be cleared for | 1146 | * cleared. The CYCLING_CHANGEOVER flag SHOULD also be cleared for |
1147 | * all destinations. | 1147 | * all destinations. |
1148 | */ | ||
1149 | if (TSN_lte(primary->cacc.next_tsn_at_change, sack_ctsn)) { | ||
1150 | primary->cacc.changeover_active = 0; | ||
1151 | list_for_each_entry(transport, transport_list, | ||
1152 | transports) { | ||
1153 | transport->cacc.cycling_changeover = 0; | ||
1154 | } | ||
1155 | } | ||
1156 | |||
1157 | /* | ||
1158 | * SFR-CACC algorithm: | ||
1159 | * 2) If the SACK contains gap acks and the flag CHANGEOVER_ACTIVE | 1148 | * 2) If the SACK contains gap acks and the flag CHANGEOVER_ACTIVE |
1160 | * is set the receiver of the SACK MUST take the following actions: | 1149 | * is set the receiver of the SACK MUST take the following actions: |
1161 | * | 1150 | * |
1162 | * A) Initialize the cacc_saw_newack to 0 for all destination | 1151 | * A) Initialize the cacc_saw_newack to 0 for all destination |
1163 | * addresses. | 1152 | * addresses. |
1153 | * | ||
1154 | * Only bother if changeover_active is set. Otherwise, this is | ||
1155 | * totally suboptimal to do on every SACK. | ||
1164 | */ | 1156 | */ |
1165 | if (gap_ack_blocks && | 1157 | if (primary->cacc.changeover_active) { |
1166 | primary->cacc.changeover_active) { | 1158 | u8 clear_cycling = 0; |
1167 | list_for_each_entry(transport, transport_list, transports) { | 1159 | |
1168 | transport->cacc.cacc_saw_newack = 0; | 1160 | if (TSN_lte(primary->cacc.next_tsn_at_change, sack_ctsn)) { |
1161 | primary->cacc.changeover_active = 0; | ||
1162 | clear_cycling = 1; | ||
1163 | } | ||
1164 | |||
1165 | if (clear_cycling || gap_ack_blocks) { | ||
1166 | list_for_each_entry(transport, transport_list, | ||
1167 | transports) { | ||
1168 | if (clear_cycling) | ||
1169 | transport->cacc.cycling_changeover = 0; | ||
1170 | if (gap_ack_blocks) | ||
1171 | transport->cacc.cacc_saw_newack = 0; | ||
1172 | } | ||
1169 | } | 1173 | } |
1170 | } | 1174 | } |
1171 | 1175 | ||