diff options
Diffstat (limited to 'net/sctp/chunk.c')
-rw-r--r-- | net/sctp/chunk.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c index 9292294dbc12..7acaf15679b6 100644 --- a/net/sctp/chunk.c +++ b/net/sctp/chunk.c | |||
@@ -207,14 +207,25 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
207 | whole = 0; | 207 | whole = 0; |
208 | first_len = max; | 208 | first_len = max; |
209 | 209 | ||
210 | /* Check to see if we have a pending SACK and try to let it be bundled | ||
211 | * with this message. Do this if we don't have any data queued already. | ||
212 | * To check that, look at out_qlen and retransmit list. | ||
213 | * NOTE: we will not reduce to account for SACK, if the message would | ||
214 | * not have been fragmented. | ||
215 | */ | ||
216 | if (timer_pending(&asoc->timers[SCTP_EVENT_TIMEOUT_SACK]) && | ||
217 | asoc->outqueue.out_qlen == 0 && | ||
218 | list_empty(&asoc->outqueue.retransmit) && | ||
219 | msg_len > max) | ||
220 | max_data -= WORD_ROUND(sizeof(sctp_sack_chunk_t)); | ||
221 | |||
210 | /* Encourage Cookie-ECHO bundling. */ | 222 | /* Encourage Cookie-ECHO bundling. */ |
211 | if (asoc->state < SCTP_STATE_COOKIE_ECHOED) { | 223 | if (asoc->state < SCTP_STATE_COOKIE_ECHOED) |
212 | max_data -= SCTP_ARBITRARY_COOKIE_ECHO_LEN; | 224 | max_data -= SCTP_ARBITRARY_COOKIE_ECHO_LEN; |
213 | 225 | ||
214 | /* This is the biggesr first_len we can have */ | 226 | /* Now that we adjusted completely, reset first_len */ |
215 | if (first_len > max_data) | 227 | if (first_len > max_data) |
216 | first_len = max_data; | 228 | first_len = max_data; |
217 | } | ||
218 | 229 | ||
219 | /* Account for a different sized first fragment */ | 230 | /* Account for a different sized first fragment */ |
220 | if (msg_len >= first_len) { | 231 | if (msg_len >= first_len) { |