Skip to content

Commit b93d647

Browse files
Wei YongjunVlad Yasevich
authored andcommitted
sctp: implement the sender side for SACK-IMMEDIATELY extension
This patch implement the sender side for SACK-IMMEDIATELY extension. Section 4.1. Sender Side Considerations Whenever the sender of a DATA chunk can benefit from the corresponding SACK chunk being sent back without delay, the sender MAY set the I-bit in the DATA chunk header. Reasons for setting the I-bit include o The sender is in the SHUTDOWN-PENDING state. o The application requests to set the I-bit of the last DATA chunk of a user message when providing the user message to the SCTP implementation. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
1 parent 6dc7694 commit b93d647

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎include/net/sctp/user.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ enum sctp_sinfo_flags {
206206
SCTP_UNORDERED = 1, /* Send/receive message unordered. */
207207
SCTP_ADDR_OVER = 2, /* Override the primary destination. */
208208
SCTP_ABORT=4, /* Send an ABORT message to the peer. */
209+
SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */
209210
SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */
210211
};
211212

‎net/sctp/chunk.c‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,18 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
263263
if (0 == i)
264264
frag |= SCTP_DATA_FIRST_FRAG;
265265

266-
if ((i == (whole - 1)) && !over)
266+
if ((i == (whole - 1)) && !over) {
267267
frag |= SCTP_DATA_LAST_FRAG;
268268

269+
/* The application requests to set the I-bit of the
270+
* last DATA chunk of a user message when providing
271+
* the user message to the SCTP implementation.
272+
*/
273+
if ((sinfo->sinfo_flags & SCTP_EOF) ||
274+
(sinfo->sinfo_flags & SCTP_SACK_IMMEDIATELY))
275+
frag |= SCTP_DATA_SACK_IMM;
276+
}
277+
269278
chunk = sctp_make_datafrag_empty(asoc, sinfo, len, frag, 0);
270279

271280
if (!chunk)
@@ -297,6 +306,10 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
297306
else
298307
frag = SCTP_DATA_LAST_FRAG;
299308

309+
if ((sinfo->sinfo_flags & SCTP_EOF) ||
310+
(sinfo->sinfo_flags & SCTP_SACK_IMMEDIATELY))
311+
frag |= SCTP_DATA_SACK_IMM;
312+
300313
chunk = sctp_make_datafrag_empty(asoc, sinfo, over, frag, 0);
301314

302315
if (!chunk)

‎net/sctp/outqueue.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,13 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
10111011
break;
10121012

10131013
case SCTP_XMIT_OK:
1014+
/* The sender is in the SHUTDOWN-PENDING state,
1015+
* The sender MAY set the I-bit in the DATA
1016+
* chunk header.
1017+
*/
1018+
if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING)
1019+
chunk->chunk_hdr->flags |= SCTP_DATA_SACK_IMM;
1020+
10141021
break;
10151022

10161023
default:

0 commit comments

Comments
 (0)