aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sctp/structs.h3
-rw-r--r--net/sctp/outqueue.c32
2 files changed, 7 insertions, 28 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 67b5d0068273..0a248b323d87 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1046,9 +1046,6 @@ struct sctp_outq {
1046 1046
1047 /* Corked? */ 1047 /* Corked? */
1048 char cork; 1048 char cork;
1049
1050 /* Is this structure empty? */
1051 char empty;
1052}; 1049};
1053 1050
1054void sctp_outq_init(struct sctp_association *, struct sctp_outq *); 1051void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index f51ba985a36e..59268f6e2c36 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -208,8 +208,6 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
208 INIT_LIST_HEAD(&q->retransmit); 208 INIT_LIST_HEAD(&q->retransmit);
209 INIT_LIST_HEAD(&q->sacked); 209 INIT_LIST_HEAD(&q->sacked);
210 INIT_LIST_HEAD(&q->abandoned); 210 INIT_LIST_HEAD(&q->abandoned);
211
212 q->empty = 1;
213} 211}
214 212
215/* Free the outqueue structure and any related pending chunks. 213/* Free the outqueue structure and any related pending chunks.
@@ -332,7 +330,6 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk)
332 SCTP_INC_STATS(net, SCTP_MIB_OUTUNORDERCHUNKS); 330 SCTP_INC_STATS(net, SCTP_MIB_OUTUNORDERCHUNKS);
333 else 331 else
334 SCTP_INC_STATS(net, SCTP_MIB_OUTORDERCHUNKS); 332 SCTP_INC_STATS(net, SCTP_MIB_OUTORDERCHUNKS);
335 q->empty = 0;
336 break; 333 break;
337 } 334 }
338 } else { 335 } else {
@@ -654,7 +651,6 @@ redo:
654 if (chunk->fast_retransmit == SCTP_NEED_FRTX) 651 if (chunk->fast_retransmit == SCTP_NEED_FRTX)
655 chunk->fast_retransmit = SCTP_DONT_FRTX; 652 chunk->fast_retransmit = SCTP_DONT_FRTX;
656 653
657 q->empty = 0;
658 q->asoc->stats.rtxchunks++; 654 q->asoc->stats.rtxchunks++;
659 break; 655 break;
660 } 656 }
@@ -1065,8 +1061,6 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
1065 1061
1066 sctp_transport_reset_timers(transport); 1062 sctp_transport_reset_timers(transport);
1067 1063
1068 q->empty = 0;
1069
1070 /* Only let one DATA chunk get bundled with a 1064 /* Only let one DATA chunk get bundled with a
1071 * COOKIE-ECHO chunk. 1065 * COOKIE-ECHO chunk.
1072 */ 1066 */
@@ -1275,29 +1269,17 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
1275 "advertised peer ack point:0x%x\n", __func__, asoc, ctsn, 1269 "advertised peer ack point:0x%x\n", __func__, asoc, ctsn,
1276 asoc->adv_peer_ack_point); 1270 asoc->adv_peer_ack_point);
1277 1271
1278 /* See if all chunks are acked. 1272 return sctp_outq_is_empty(q);
1279 * Make sure the empty queue handler will get run later.
1280 */
1281 q->empty = (list_empty(&q->out_chunk_list) &&
1282 list_empty(&q->retransmit));
1283 if (!q->empty)
1284 goto finish;
1285
1286 list_for_each_entry(transport, transport_list, transports) {
1287 q->empty = q->empty && list_empty(&transport->transmitted);
1288 if (!q->empty)
1289 goto finish;
1290 }
1291
1292 pr_debug("%s: sack queue is empty\n", __func__);
1293finish:
1294 return q->empty;
1295} 1273}
1296 1274
1297/* Is the outqueue empty? */ 1275/* Is the outqueue empty?
1276 * The queue is empty when we have not pending data, no in-flight data
1277 * and nothing pending retransmissions.
1278 */
1298int sctp_outq_is_empty(const struct sctp_outq *q) 1279int sctp_outq_is_empty(const struct sctp_outq *q)
1299{ 1280{
1300 return q->empty; 1281 return q->out_qlen == 0 && q->outstanding_bytes == 0 &&
1282 list_empty(&q->retransmit);
1301} 1283}
1302 1284
1303/******************************************************************** 1285/********************************************************************