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
This commit is contained in:
parent
4144951277
commit
e4f820b3c6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=225462
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user