diff options
Diffstat (limited to 'net/sctp/outqueue.c')
-rw-r--r-- | net/sctp/outqueue.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 392012f5ab83..213c2e2926a9 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -221,12 +221,12 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) | |||
221 | void sctp_outq_teardown(struct sctp_outq *q) | 221 | void sctp_outq_teardown(struct sctp_outq *q) |
222 | { | 222 | { |
223 | struct sctp_transport *transport; | 223 | struct sctp_transport *transport; |
224 | struct list_head *lchunk, *pos, *temp; | 224 | struct list_head *lchunk, *temp; |
225 | struct sctp_chunk *chunk, *tmp; | 225 | struct sctp_chunk *chunk, *tmp; |
226 | 226 | ||
227 | /* Throw away unacknowledged chunks. */ | 227 | /* Throw away unacknowledged chunks. */ |
228 | list_for_each(pos, &q->asoc->peer.transport_addr_list) { | 228 | list_for_each_entry(transport, &q->asoc->peer.transport_addr_list, |
229 | transport = list_entry(pos, struct sctp_transport, transports); | 229 | transports) { |
230 | while ((lchunk = sctp_list_dequeue(&transport->transmitted)) != NULL) { | 230 | while ((lchunk = sctp_list_dequeue(&transport->transmitted)) != NULL) { |
231 | chunk = list_entry(lchunk, struct sctp_chunk, | 231 | chunk = list_entry(lchunk, struct sctp_chunk, |
232 | transmitted_list); | 232 | transmitted_list); |
@@ -538,7 +538,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, | |||
538 | int rtx_timeout, int *start_timer) | 538 | int rtx_timeout, int *start_timer) |
539 | { | 539 | { |
540 | struct list_head *lqueue; | 540 | struct list_head *lqueue; |
541 | struct list_head *lchunk, *lchunk1; | 541 | struct list_head *lchunk; |
542 | struct sctp_transport *transport = pkt->transport; | 542 | struct sctp_transport *transport = pkt->transport; |
543 | sctp_xmit_t status; | 543 | sctp_xmit_t status; |
544 | struct sctp_chunk *chunk, *chunk1; | 544 | struct sctp_chunk *chunk, *chunk1; |
@@ -649,9 +649,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, | |||
649 | * to be marked as ineligible for a subsequent fast retransmit. | 649 | * to be marked as ineligible for a subsequent fast retransmit. |
650 | */ | 650 | */ |
651 | if (rtx_timeout && !lchunk) { | 651 | if (rtx_timeout && !lchunk) { |
652 | list_for_each(lchunk1, lqueue) { | 652 | list_for_each_entry(chunk1, lqueue, transmitted_list) { |
653 | chunk1 = list_entry(lchunk1, struct sctp_chunk, | ||
654 | transmitted_list); | ||
655 | if (chunk1->fast_retransmit > 0) | 653 | if (chunk1->fast_retransmit > 0) |
656 | chunk1->fast_retransmit = -1; | 654 | chunk1->fast_retransmit = -1; |
657 | } | 655 | } |
@@ -1037,7 +1035,6 @@ static void sctp_sack_update_unack_data(struct sctp_association *assoc, | |||
1037 | static __u32 sctp_highest_new_tsn(struct sctp_sackhdr *sack, | 1035 | static __u32 sctp_highest_new_tsn(struct sctp_sackhdr *sack, |
1038 | struct sctp_association *asoc) | 1036 | struct sctp_association *asoc) |
1039 | { | 1037 | { |
1040 | struct list_head *ltransport, *lchunk; | ||
1041 | struct sctp_transport *transport; | 1038 | struct sctp_transport *transport; |
1042 | struct sctp_chunk *chunk; | 1039 | struct sctp_chunk *chunk; |
1043 | __u32 highest_new_tsn, tsn; | 1040 | __u32 highest_new_tsn, tsn; |
@@ -1045,12 +1042,9 @@ static __u32 sctp_highest_new_tsn(struct sctp_sackhdr *sack, | |||
1045 | 1042 | ||
1046 | highest_new_tsn = ntohl(sack->cum_tsn_ack); | 1043 | highest_new_tsn = ntohl(sack->cum_tsn_ack); |
1047 | 1044 | ||
1048 | list_for_each(ltransport, transport_list) { | 1045 | list_for_each_entry(transport, transport_list, transports) { |
1049 | transport = list_entry(ltransport, struct sctp_transport, | 1046 | list_for_each_entry(chunk, &transport->transmitted, |
1050 | transports); | 1047 | transmitted_list) { |
1051 | list_for_each(lchunk, &transport->transmitted) { | ||
1052 | chunk = list_entry(lchunk, struct sctp_chunk, | ||
1053 | transmitted_list); | ||
1054 | tsn = ntohl(chunk->subh.data_hdr->tsn); | 1048 | tsn = ntohl(chunk->subh.data_hdr->tsn); |
1055 | 1049 | ||
1056 | if (!chunk->tsn_gap_acked && | 1050 | if (!chunk->tsn_gap_acked && |
@@ -1073,7 +1067,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1073 | struct sctp_association *asoc = q->asoc; | 1067 | struct sctp_association *asoc = q->asoc; |
1074 | struct sctp_transport *transport; | 1068 | struct sctp_transport *transport; |
1075 | struct sctp_chunk *tchunk = NULL; | 1069 | struct sctp_chunk *tchunk = NULL; |
1076 | struct list_head *lchunk, *transport_list, *pos, *temp; | 1070 | struct list_head *lchunk, *transport_list, *temp; |
1077 | sctp_sack_variable_t *frags = sack->variable; | 1071 | sctp_sack_variable_t *frags = sack->variable; |
1078 | __u32 sack_ctsn, ctsn, tsn; | 1072 | __u32 sack_ctsn, ctsn, tsn; |
1079 | __u32 highest_tsn, highest_new_tsn; | 1073 | __u32 highest_tsn, highest_new_tsn; |
@@ -1099,9 +1093,8 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1099 | */ | 1093 | */ |
1100 | if (TSN_lte(primary->cacc.next_tsn_at_change, sack_ctsn)) { | 1094 | if (TSN_lte(primary->cacc.next_tsn_at_change, sack_ctsn)) { |
1101 | primary->cacc.changeover_active = 0; | 1095 | primary->cacc.changeover_active = 0; |
1102 | list_for_each(pos, transport_list) { | 1096 | list_for_each_entry(transport, transport_list, |
1103 | transport = list_entry(pos, struct sctp_transport, | 1097 | transports) { |
1104 | transports); | ||
1105 | transport->cacc.cycling_changeover = 0; | 1098 | transport->cacc.cycling_changeover = 0; |
1106 | } | 1099 | } |
1107 | } | 1100 | } |
@@ -1116,9 +1109,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1116 | */ | 1109 | */ |
1117 | if (sack->num_gap_ack_blocks && | 1110 | if (sack->num_gap_ack_blocks && |
1118 | primary->cacc.changeover_active) { | 1111 | primary->cacc.changeover_active) { |
1119 | list_for_each(pos, transport_list) { | 1112 | list_for_each_entry(transport, transport_list, transports) { |
1120 | transport = list_entry(pos, struct sctp_transport, | ||
1121 | transports); | ||
1122 | transport->cacc.cacc_saw_newack = 0; | 1113 | transport->cacc.cacc_saw_newack = 0; |
1123 | } | 1114 | } |
1124 | } | 1115 | } |
@@ -1147,9 +1138,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1147 | * | 1138 | * |
1148 | * This is a MASSIVE candidate for optimization. | 1139 | * This is a MASSIVE candidate for optimization. |
1149 | */ | 1140 | */ |
1150 | list_for_each(pos, transport_list) { | 1141 | list_for_each_entry(transport, transport_list, transports) { |
1151 | transport = list_entry(pos, struct sctp_transport, | ||
1152 | transports); | ||
1153 | sctp_check_transmitted(q, &transport->transmitted, | 1142 | sctp_check_transmitted(q, &transport->transmitted, |
1154 | transport, sack, highest_new_tsn); | 1143 | transport, sack, highest_new_tsn); |
1155 | /* | 1144 | /* |
@@ -1161,9 +1150,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1161 | count_of_newacks ++; | 1150 | count_of_newacks ++; |
1162 | } | 1151 | } |
1163 | 1152 | ||
1164 | list_for_each(pos, transport_list) { | 1153 | list_for_each_entry(transport, transport_list, transports) { |
1165 | transport = list_entry(pos, struct sctp_transport, | ||
1166 | transports); | ||
1167 | sctp_mark_missing(q, &transport->transmitted, transport, | 1154 | sctp_mark_missing(q, &transport->transmitted, transport, |
1168 | highest_new_tsn, count_of_newacks); | 1155 | highest_new_tsn, count_of_newacks); |
1169 | } | 1156 | } |
@@ -1220,9 +1207,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1220 | if (!q->empty) | 1207 | if (!q->empty) |
1221 | goto finish; | 1208 | goto finish; |
1222 | 1209 | ||
1223 | list_for_each(pos, transport_list) { | 1210 | list_for_each_entry(transport, transport_list, transports) { |
1224 | transport = list_entry(pos, struct sctp_transport, | ||
1225 | transports); | ||
1226 | q->empty = q->empty && list_empty(&transport->transmitted); | 1211 | q->empty = q->empty && list_empty(&transport->transmitted); |
1227 | if (!q->empty) | 1212 | if (!q->empty) |
1228 | goto finish; | 1213 | goto finish; |
@@ -1596,14 +1581,12 @@ static void sctp_mark_missing(struct sctp_outq *q, | |||
1596 | int count_of_newacks) | 1581 | int count_of_newacks) |
1597 | { | 1582 | { |
1598 | struct sctp_chunk *chunk; | 1583 | struct sctp_chunk *chunk; |
1599 | struct list_head *pos; | ||
1600 | __u32 tsn; | 1584 | __u32 tsn; |
1601 | char do_fast_retransmit = 0; | 1585 | char do_fast_retransmit = 0; |
1602 | struct sctp_transport *primary = q->asoc->peer.primary_path; | 1586 | struct sctp_transport *primary = q->asoc->peer.primary_path; |
1603 | 1587 | ||
1604 | list_for_each(pos, transmitted_queue) { | 1588 | list_for_each_entry(chunk, transmitted_queue, transmitted_list) { |
1605 | 1589 | ||
1606 | chunk = list_entry(pos, struct sctp_chunk, transmitted_list); | ||
1607 | tsn = ntohl(chunk->subh.data_hdr->tsn); | 1590 | tsn = ntohl(chunk->subh.data_hdr->tsn); |
1608 | 1591 | ||
1609 | /* RFC 2960 7.2.4, sctpimpguide-05 2.8.2 M3) Examine all | 1592 | /* RFC 2960 7.2.4, sctpimpguide-05 2.8.2 M3) Examine all |