aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/outqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/outqueue.c')
-rw-r--r--net/sctp/outqueue.c94
1 files changed, 41 insertions, 53 deletions
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index abfc0b8dee74..5d057178ce0c 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -62,7 +62,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
62 struct list_head *transmitted_queue, 62 struct list_head *transmitted_queue,
63 struct sctp_transport *transport, 63 struct sctp_transport *transport,
64 struct sctp_sackhdr *sack, 64 struct sctp_sackhdr *sack,
65 __u32 highest_new_tsn); 65 __u32 *highest_new_tsn);
66 66
67static void sctp_mark_missing(struct sctp_outq *q, 67static void sctp_mark_missing(struct sctp_outq *q,
68 struct list_head *transmitted_queue, 68 struct list_head *transmitted_queue,
@@ -308,7 +308,7 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk)
308 /* If it is data, queue it up, otherwise, send it 308 /* If it is data, queue it up, otherwise, send it
309 * immediately. 309 * immediately.
310 */ 310 */
311 if (SCTP_CID_DATA == chunk->chunk_hdr->type) { 311 if (sctp_chunk_is_data(chunk)) {
312 /* Is it OK to queue data chunks? */ 312 /* Is it OK to queue data chunks? */
313 /* From 9. Termination of Association 313 /* From 9. Termination of Association
314 * 314 *
@@ -598,11 +598,23 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
598 if (fast_rtx && !chunk->fast_retransmit) 598 if (fast_rtx && !chunk->fast_retransmit)
599 continue; 599 continue;
600 600
601redo:
601 /* Attempt to append this chunk to the packet. */ 602 /* Attempt to append this chunk to the packet. */
602 status = sctp_packet_append_chunk(pkt, chunk); 603 status = sctp_packet_append_chunk(pkt, chunk);
603 604
604 switch (status) { 605 switch (status) {
605 case SCTP_XMIT_PMTU_FULL: 606 case SCTP_XMIT_PMTU_FULL:
607 if (!pkt->has_data && !pkt->has_cookie_echo) {
608 /* If this packet did not contain DATA then
609 * retransmission did not happen, so do it
610 * again. We'll ignore the error here since
611 * control chunks are already freed so there
612 * is nothing we can do.
613 */
614 sctp_packet_transmit(pkt);
615 goto redo;
616 }
617
606 /* Send this packet. */ 618 /* Send this packet. */
607 error = sctp_packet_transmit(pkt); 619 error = sctp_packet_transmit(pkt);
608 620
@@ -647,14 +659,6 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
647 if (chunk->fast_retransmit == SCTP_NEED_FRTX) 659 if (chunk->fast_retransmit == SCTP_NEED_FRTX)
648 chunk->fast_retransmit = SCTP_DONT_FRTX; 660 chunk->fast_retransmit = SCTP_DONT_FRTX;
649 661
650 /* Force start T3-rtx timer when fast retransmitting
651 * the earliest outstanding TSN
652 */
653 if (!timer && fast_rtx &&
654 ntohl(chunk->subh.data_hdr->tsn) ==
655 asoc->ctsn_ack_point + 1)
656 timer = 2;
657
658 q->empty = 0; 662 q->empty = 0;
659 break; 663 break;
660 } 664 }
@@ -854,6 +858,12 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
854 if (status != SCTP_XMIT_OK) { 858 if (status != SCTP_XMIT_OK) {
855 /* put the chunk back */ 859 /* put the chunk back */
856 list_add(&chunk->list, &q->control_chunk_list); 860 list_add(&chunk->list, &q->control_chunk_list);
861 } else if (chunk->chunk_hdr->type == SCTP_CID_FWD_TSN) {
862 /* PR-SCTP C5) If a FORWARD TSN is sent, the
863 * sender MUST assure that at least one T3-rtx
864 * timer is running.
865 */
866 sctp_transport_reset_timers(transport);
857 } 867 }
858 break; 868 break;
859 869
@@ -906,8 +916,7 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
906 rtx_timeout, &start_timer); 916 rtx_timeout, &start_timer);
907 917
908 if (start_timer) 918 if (start_timer)
909 sctp_transport_reset_timers(transport, 919 sctp_transport_reset_timers(transport);
910 start_timer-1);
911 920
912 /* This can happen on COOKIE-ECHO resend. Only 921 /* This can happen on COOKIE-ECHO resend. Only
913 * one chunk can get bundled with a COOKIE-ECHO. 922 * one chunk can get bundled with a COOKIE-ECHO.
@@ -1040,7 +1049,7 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
1040 list_add_tail(&chunk->transmitted_list, 1049 list_add_tail(&chunk->transmitted_list,
1041 &transport->transmitted); 1050 &transport->transmitted);
1042 1051
1043 sctp_transport_reset_timers(transport, 0); 1052 sctp_transport_reset_timers(transport);
1044 1053
1045 q->empty = 0; 1054 q->empty = 0;
1046 1055
@@ -1100,32 +1109,6 @@ static void sctp_sack_update_unack_data(struct sctp_association *assoc,
1100 assoc->unack_data = unack_data; 1109 assoc->unack_data = unack_data;
1101} 1110}
1102 1111
1103/* Return the highest new tsn that is acknowledged by the given SACK chunk. */
1104static __u32 sctp_highest_new_tsn(struct sctp_sackhdr *sack,
1105 struct sctp_association *asoc)
1106{
1107 struct sctp_transport *transport;
1108 struct sctp_chunk *chunk;
1109 __u32 highest_new_tsn, tsn;
1110 struct list_head *transport_list = &asoc->peer.transport_addr_list;
1111
1112 highest_new_tsn = ntohl(sack->cum_tsn_ack);
1113
1114 list_for_each_entry(transport, transport_list, transports) {
1115 list_for_each_entry(chunk, &transport->transmitted,
1116 transmitted_list) {
1117 tsn = ntohl(chunk->subh.data_hdr->tsn);
1118
1119 if (!chunk->tsn_gap_acked &&
1120 TSN_lt(highest_new_tsn, tsn) &&
1121 sctp_acked(sack, tsn))
1122 highest_new_tsn = tsn;
1123 }
1124 }
1125
1126 return highest_new_tsn;
1127}
1128
1129/* This is where we REALLY process a SACK. 1112/* This is where we REALLY process a SACK.
1130 * 1113 *
1131 * Process the SACK against the outqueue. Mostly, this just frees 1114 * Process the SACK against the outqueue. Mostly, this just frees
@@ -1145,6 +1128,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack)
1145 struct sctp_transport *primary = asoc->peer.primary_path; 1128 struct sctp_transport *primary = asoc->peer.primary_path;
1146 int count_of_newacks = 0; 1129 int count_of_newacks = 0;
1147 int gap_ack_blocks; 1130 int gap_ack_blocks;
1131 u8 accum_moved = 0;
1148 1132
1149 /* Grab the association's destination address list. */ 1133 /* Grab the association's destination address list. */
1150 transport_list = &asoc->peer.transport_addr_list; 1134 transport_list = &asoc->peer.transport_addr_list;
@@ -1193,18 +1177,15 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack)
1193 if (gap_ack_blocks) 1177 if (gap_ack_blocks)
1194 highest_tsn += ntohs(frags[gap_ack_blocks - 1].gab.end); 1178 highest_tsn += ntohs(frags[gap_ack_blocks - 1].gab.end);
1195 1179
1196 if (TSN_lt(asoc->highest_sacked, highest_tsn)) { 1180 if (TSN_lt(asoc->highest_sacked, highest_tsn))
1197 highest_new_tsn = highest_tsn;
1198 asoc->highest_sacked = highest_tsn; 1181 asoc->highest_sacked = highest_tsn;
1199 } else {
1200 highest_new_tsn = sctp_highest_new_tsn(sack, asoc);
1201 }
1202 1182
1183 highest_new_tsn = sack_ctsn;
1203 1184
1204 /* Run through the retransmit queue. Credit bytes received 1185 /* Run through the retransmit queue. Credit bytes received
1205 * and free those chunks that we can. 1186 * and free those chunks that we can.
1206 */ 1187 */
1207 sctp_check_transmitted(q, &q->retransmit, NULL, sack, highest_new_tsn); 1188 sctp_check_transmitted(q, &q->retransmit, NULL, sack, &highest_new_tsn);
1208 1189
1209 /* Run through the transmitted queue. 1190 /* Run through the transmitted queue.
1210 * Credit bytes received and free those chunks which we can. 1191 * Credit bytes received and free those chunks which we can.
@@ -1213,7 +1194,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack)
1213 */ 1194 */
1214 list_for_each_entry(transport, transport_list, transports) { 1195 list_for_each_entry(transport, transport_list, transports) {
1215 sctp_check_transmitted(q, &transport->transmitted, 1196 sctp_check_transmitted(q, &transport->transmitted,
1216 transport, sack, highest_new_tsn); 1197 transport, sack, &highest_new_tsn);
1217 /* 1198 /*
1218 * SFR-CACC algorithm: 1199 * SFR-CACC algorithm:
1219 * C) Let count_of_newacks be the number of 1200 * C) Let count_of_newacks be the number of
@@ -1223,16 +1204,22 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack)
1223 count_of_newacks ++; 1204 count_of_newacks ++;
1224 } 1205 }
1225 1206
1207 /* Move the Cumulative TSN Ack Point if appropriate. */
1208 if (TSN_lt(asoc->ctsn_ack_point, sack_ctsn)) {
1209 asoc->ctsn_ack_point = sack_ctsn;
1210 accum_moved = 1;
1211 }
1212
1226 if (gap_ack_blocks) { 1213 if (gap_ack_blocks) {
1214
1215 if (asoc->fast_recovery && accum_moved)
1216 highest_new_tsn = highest_tsn;
1217
1227 list_for_each_entry(transport, transport_list, transports) 1218 list_for_each_entry(transport, transport_list, transports)
1228 sctp_mark_missing(q, &transport->transmitted, transport, 1219 sctp_mark_missing(q, &transport->transmitted, transport,
1229 highest_new_tsn, count_of_newacks); 1220 highest_new_tsn, count_of_newacks);
1230 } 1221 }
1231 1222
1232 /* Move the Cumulative TSN Ack Point if appropriate. */
1233 if (TSN_lt(asoc->ctsn_ack_point, sack_ctsn))
1234 asoc->ctsn_ack_point = sack_ctsn;
1235
1236 /* Update unack_data field in the assoc. */ 1223 /* Update unack_data field in the assoc. */
1237 sctp_sack_update_unack_data(asoc, sack); 1224 sctp_sack_update_unack_data(asoc, sack);
1238 1225
@@ -1315,7 +1302,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1315 struct list_head *transmitted_queue, 1302 struct list_head *transmitted_queue,
1316 struct sctp_transport *transport, 1303 struct sctp_transport *transport,
1317 struct sctp_sackhdr *sack, 1304 struct sctp_sackhdr *sack,
1318 __u32 highest_new_tsn_in_sack) 1305 __u32 *highest_new_tsn_in_sack)
1319{ 1306{
1320 struct list_head *lchunk; 1307 struct list_head *lchunk;
1321 struct sctp_chunk *tchunk; 1308 struct sctp_chunk *tchunk;
@@ -1387,7 +1374,6 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1387 * instance). 1374 * instance).
1388 */ 1375 */
1389 if (!tchunk->tsn_gap_acked && 1376 if (!tchunk->tsn_gap_acked &&
1390 !tchunk->resent &&
1391 tchunk->rtt_in_progress) { 1377 tchunk->rtt_in_progress) {
1392 tchunk->rtt_in_progress = 0; 1378 tchunk->rtt_in_progress = 0;
1393 rtt = jiffies - tchunk->sent_at; 1379 rtt = jiffies - tchunk->sent_at;
@@ -1404,6 +1390,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1404 */ 1390 */
1405 if (!tchunk->tsn_gap_acked) { 1391 if (!tchunk->tsn_gap_acked) {
1406 tchunk->tsn_gap_acked = 1; 1392 tchunk->tsn_gap_acked = 1;
1393 *highest_new_tsn_in_sack = tsn;
1407 bytes_acked += sctp_data_size(tchunk); 1394 bytes_acked += sctp_data_size(tchunk);
1408 if (!tchunk->transport) 1395 if (!tchunk->transport)
1409 migrate_bytes += sctp_data_size(tchunk); 1396 migrate_bytes += sctp_data_size(tchunk);
@@ -1677,7 +1664,8 @@ static void sctp_mark_missing(struct sctp_outq *q,
1677 struct sctp_chunk *chunk; 1664 struct sctp_chunk *chunk;
1678 __u32 tsn; 1665 __u32 tsn;
1679 char do_fast_retransmit = 0; 1666 char do_fast_retransmit = 0;
1680 struct sctp_transport *primary = q->asoc->peer.primary_path; 1667 struct sctp_association *asoc = q->asoc;
1668 struct sctp_transport *primary = asoc->peer.primary_path;
1681 1669
1682 list_for_each_entry(chunk, transmitted_queue, transmitted_list) { 1670 list_for_each_entry(chunk, transmitted_queue, transmitted_list) {
1683 1671