diff options
author | tuexen <tuexen@FreeBSD.org> | 2011-09-09 13:52:37 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2011-09-09 13:52:37 +0000 |
commit | 0d8130b65db60058afa3eda868eb806f269e636c (patch) | |
tree | e1db66119084c7a269b804d48370a14b36810eb6 /sys/netinet | |
parent | 0eb84391c819fc6650d3fbcc1baac9307c8ae599 (diff) | |
download | FreeBSD-src-0d8130b65db60058afa3eda868eb806f269e636c.zip FreeBSD-src-0d8130b65db60058afa3eda868eb806f269e636c.tar.gz |
Improve implementation of the Nagle algorithm for SCTP:
Don't delay the final fragment of a fragmented user message.
Approved by: re
MFC after: 4 weeks
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/sctp_output.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 81c9e70..d91f898 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -9821,19 +9821,22 @@ sctp_chunk_output(struct sctp_inpcb *inp, unsigned int burst_cnt = 0; struct timeval now; int now_filled = 0; - int nagle_on = 0; + int nagle_on; int frag_point = sctp_get_frag_point(stcb, &stcb->asoc); int un_sent = 0; int fr_done; unsigned int tot_frs = 0; asoc = &stcb->asoc; + /* The Nagle algorithm is only applied when handling a send call. */ if (from_where == SCTP_OUTPUT_FROM_USR_SEND) { if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NODELAY)) { nagle_on = 0; } else { nagle_on = 1; } + } else { + nagle_on = 0; } SCTP_TCB_LOCK_ASSERT(stcb); @@ -10007,15 +10010,18 @@ sctp_chunk_output(struct sctp_inpcb *inp, } } if (nagle_on) { - /*- - * When nagle is on, we look at how much is un_sent, then - * if its smaller than an MTU and we have data in - * flight we stop. + /* + * When the Nagle algorithm is used, look at how + * much is unsent, then if its smaller than an MTU + * and we have data in flight we stop, except if we + * are handling a fragmented user message. */ un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); if ((un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD)) && - (stcb->asoc.total_flight > 0)) { + (stcb->asoc.total_flight > 0) && + ((stcb->asoc.locked_on_sending == NULL) || + sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) { break; } } |