Skip to content

Commit cb95ea3

Browse files
author
Vlad Yasevich
committed
sctp: Don't do NAGLE delay on large writes that were fragmented small
SCTP will delay the last part of a large write due to NAGLE, if that part is smaller then MTU. Since we are doing large writes, we might as well send the last portion now instead of waiting untill the next large write happens. The small portion will be sent as is regardless, so it's better to not delay it. This is a result of much discussions with Wei Yongjun <yjwei@cn.fujitsu.com> and Doug Graham <dgraham@nortel.com>. Many thanks go out to them. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
1 parent b29e790 commit cb95ea3

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎include/net/sctp/structs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ struct sctp_datamsg {
628628
/* Chunks waiting to be submitted to lower layer. */
629629
struct list_head chunks;
630630
/* Chunks that have been transmitted. */
631-
struct list_head track;
631+
size_t msg_size;
632632
/* Reference counting. */
633633
atomic_t refcnt;
634634
/* When is this message no longer interesting to the peer? */

‎net/sctp/chunk.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ static void sctp_datamsg_init(struct sctp_datamsg *msg)
5959
msg->can_abandon = 0;
6060
msg->expires_at = 0;
6161
INIT_LIST_HEAD(&msg->chunks);
62+
msg->msg_size = 0;
6263
}
6364

6465
/* Allocate and initialize datamsg. */
@@ -155,6 +156,7 @@ static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chu
155156
{
156157
sctp_datamsg_hold(msg);
157158
chunk->msg = msg;
159+
msg->msg_size += chunk->skb->len;
158160
}
159161

160162

‎net/sctp/output.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,10 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
703703
/* Check whether this chunk and all the rest of pending
704704
* data will fit or delay in hopes of bundling a full
705705
* sized packet.
706+
* Don't delay large message writes that may have been
707+
* fragmeneted into small peices.
706708
*/
707-
if (len < max) {
709+
if ((len < max) && (chunk->msg->msg_size < max)) {
708710
retval = SCTP_XMIT_NAGLE_DELAY;
709711
goto finish;
710712
}

0 commit comments

Comments
 (0)