aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/outqueue.c
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2018-05-14 13:34:41 -0400
committerDavid S. Miller <davem@davemloft.net>2018-05-14 22:57:15 -0400
commit4bf21b61f2bb3611ddb4fb75170c83905dd5c29e (patch)
treed889de8e32053a6930496c09e9627560ad5797c8 /net/sctp/outqueue.c
parentcb93cc5d06d9b1016326376a4980d11a9040afd2 (diff)
sctp: move transport flush code out of sctp_outq_flush
To the new sctp_outq_flush_transports. Comment on Nagle is outdated and removed. Nagle is performed earlier, while checking if the chunk fits the packet: if the outq length is not enough to fill the packet, it returns SCTP_XMIT_DELAY. So by when it gets to sctp_outq_flush_transports, it has to go through all enlisted transports. Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/outqueue.c')
-rw-r--r--net/sctp/outqueue.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index bfa2e43dfd31..44465e64857b 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -1176,6 +1176,29 @@ static void sctp_outq_flush_data(struct sctp_outq *q,
1176 } 1176 }
1177} 1177}
1178 1178
1179static void sctp_outq_flush_transports(struct sctp_outq *q,
1180 struct list_head *transport_list,
1181 gfp_t gfp)
1182{
1183 struct list_head *ltransport;
1184 struct sctp_packet *packet;
1185 struct sctp_transport *t;
1186 int error = 0;
1187
1188 while ((ltransport = sctp_list_dequeue(transport_list)) != NULL) {
1189 t = list_entry(ltransport, struct sctp_transport, send_ready);
1190 packet = &t->packet;
1191 if (!sctp_packet_empty(packet)) {
1192 error = sctp_packet_transmit(packet, gfp);
1193 if (error < 0)
1194 q->asoc->base.sk->sk_err = -error;
1195 }
1196
1197 /* Clear the burst limited state, if any */
1198 sctp_transport_burst_reset(t);
1199 }
1200}
1201
1179/* 1202/*
1180 * Try to flush an outqueue. 1203 * Try to flush an outqueue.
1181 * 1204 *
@@ -1187,17 +1210,10 @@ static void sctp_outq_flush_data(struct sctp_outq *q,
1187 */ 1210 */
1188static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp) 1211static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)
1189{ 1212{
1190 struct sctp_packet *packet; 1213 /* Current transport being used. It's NOT the same as curr active one */
1191 struct sctp_association *asoc = q->asoc;
1192 struct sctp_transport *transport = NULL; 1214 struct sctp_transport *transport = NULL;
1193 int error = 0;
1194
1195 /* These transports have chunks to send. */ 1215 /* These transports have chunks to send. */
1196 struct list_head transport_list; 1216 LIST_HEAD(transport_list);
1197 struct list_head *ltransport;
1198
1199 INIT_LIST_HEAD(&transport_list);
1200 packet = NULL;
1201 1217
1202 /* 1218 /*
1203 * 6.10 Bundling 1219 * 6.10 Bundling
@@ -1218,27 +1234,7 @@ static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)
1218 1234
1219sctp_flush_out: 1235sctp_flush_out:
1220 1236
1221 /* Before returning, examine all the transports touched in 1237 sctp_outq_flush_transports(q, &transport_list, gfp);
1222 * this call. Right now, we bluntly force clear all the
1223 * transports. Things might change after we implement Nagle.
1224 * But such an examination is still required.
1225 *
1226 * --xguo
1227 */
1228 while ((ltransport = sctp_list_dequeue(&transport_list)) != NULL) {
1229 struct sctp_transport *t = list_entry(ltransport,
1230 struct sctp_transport,
1231 send_ready);
1232 packet = &t->packet;
1233 if (!sctp_packet_empty(packet)) {
1234 error = sctp_packet_transmit(packet, gfp);
1235 if (error < 0)
1236 asoc->base.sk->sk_err = -error;
1237 }
1238
1239 /* Clear the burst limited state, if any */
1240 sctp_transport_burst_reset(t);
1241 }
1242} 1238}
1243 1239
1244/* Update unack_data based on the incoming SACK chunk */ 1240/* Update unack_data based on the incoming SACK chunk */