Commit b93d6471748de2ce02cc24774b774deb306a57a8

Authored by Wei Yongjun
Committed by Vlad Yasevich
1 parent 6dc7694f9d

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>

Showing 3 changed files with 22 additions and 1 deletions Side-by-side Diff

include/net/sctp/user.h
... ... @@ -206,6 +206,7 @@
206 206 SCTP_UNORDERED = 1, /* Send/receive message unordered. */
207 207 SCTP_ADDR_OVER = 2, /* Override the primary destination. */
208 208 SCTP_ABORT=4, /* Send an ABORT message to the peer. */
  209 + SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */
209 210 SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */
210 211 };
211 212  
... ... @@ -263,9 +263,18 @@
263 263 if (0 == i)
264 264 frag |= SCTP_DATA_FIRST_FRAG;
265 265  
266   - if ((i == (whole - 1)) && !over)
  266 + if ((i == (whole - 1)) && !over) {
267 267 frag |= SCTP_DATA_LAST_FRAG;
268 268  
  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 +
269 278 chunk = sctp_make_datafrag_empty(asoc, sinfo, len, frag, 0);
270 279  
271 280 if (!chunk)
... ... @@ -296,6 +305,10 @@
296 305 frag = SCTP_DATA_NOT_FRAG;
297 306 else
298 307 frag = SCTP_DATA_LAST_FRAG;
  308 +
  309 + if ((sinfo->sinfo_flags & SCTP_EOF) ||
  310 + (sinfo->sinfo_flags & SCTP_SACK_IMMEDIATELY))
  311 + frag |= SCTP_DATA_SACK_IMM;
299 312  
300 313 chunk = sctp_make_datafrag_empty(asoc, sinfo, over, frag, 0);
301 314  
... ... @@ -1011,6 +1011,13 @@
1011 1011 break;
1012 1012  
1013 1013 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 +
1014 1021 break;
1015 1022  
1016 1023 default: