Home | History | Annotate | Download | only in netinet

Lines Matching defs:asoc

62 sctp_set_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
64 asoc->my_rwnd = sctp_calc_rwnd(stcb, asoc);
69 sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
82 if (stcb->asoc.sb_cc == 0 &&
83 asoc->size_on_reasm_queue == 0 &&
84 asoc->size_on_all_streams == 0) {
90 calc = (uint32_t) sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv);
96 calc = sctp_sbspace_sub(calc, (uint32_t)(asoc->size_on_reasm_queue +
97 asoc->cnt_on_reasm_queue * MSIZE));
98 calc = sctp_sbspace_sub(calc, (uint32_t)(asoc->size_on_all_streams +
99 asoc->cnt_on_all_streams * MSIZE));
107 calc = sctp_sbspace_sub(calc, stcb->asoc.my_rwnd_control_len);
111 if (calc < stcb->asoc.my_rwnd_control_len) {
180 read_queue_e->sinfo_context = stcb->asoc.context;
330 sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn)
338 cumackp1 = asoc->cumulative_tsn + 1;
345 SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn);
346 if (!SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) {
348 sctp_print_mapping_array(asoc);
353 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
354 SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
355 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
356 asoc->highest_tsn_inside_nr_map = tsn;
358 if (tsn == asoc->highest_tsn_inside_map) {
360 for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) {
361 SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn);
362 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) {
363 asoc->highest_tsn_inside_map = i;
369 asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1;
381 sctp_service_reassembly(struct sctp_tcb *stcb, struct sctp_association *asoc)
395 (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) ||
396 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) {
399 asoc->fragmented_delivery_inprogress = 0;
400 TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) {
401 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
402 asoc->size_on_reasm_queue -= chk->send_size;
403 sctp_ucount_decr(asoc->cnt_on_reasm_queue);
419 TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) {
420 if (chk->rec.data.TSN_seq != (asoc->tsn_last_delivered + 1)) {
425 nxt_todel = asoc->strmin[stream_no].last_sequence_delivered + 1;
442 stcb->asoc.control_pdapi = control;
447 sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq);
457 sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq);
459 stcb->asoc.control_pdapi,
468 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
472 if ((stcb->asoc.control_pdapi == NULL) || (stcb->asoc.control_pdapi->tail_mbuf == NULL)) {
478 if ((stcb->asoc.control_pdapi == NULL) || (stcb->asoc.control_pdapi->tail_mbuf == NULL)) {
491 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
493 asoc->fragmented_delivery_inprogress = 0;
495 asoc->strmin[stream_no].last_sequence_delivered++;
505 asoc->fragmented_delivery_inprogress = 1;
507 asoc->tsn_of_pdapi_last_delivered = chk->rec.data.TSN_seq;
508 asoc->last_flags_delivered = chk->rec.data.rcv_flags;
509 asoc->last_strm_seq_delivered = chk->rec.data.stream_seq;
510 asoc->last_strm_no_delivered = chk->rec.data.stream_number;
512 asoc->tsn_last_delivered = chk->rec.data.TSN_seq;
513 asoc->size_on_reasm_queue -= chk->send_size;
514 sctp_ucount_decr(asoc->cnt_on_reasm_queue);
519 if (asoc->fragmented_delivery_inprogress == 0) {
526 strm = &asoc->strmin[stream_no];
532 asoc->size_on_all_streams -= ctl->length;
533 sctp_ucount_decr(asoc->cnt_on_all_streams);
535 sctp_mark_non_revokable(asoc, ctl->sinfo_tsn);
557 sctp_queue_data_to_stream(struct sctp_tcb *stcb, struct sctp_association *asoc,
586 asoc->size_on_all_streams += control->length;
587 sctp_ucount_incr(asoc->cnt_on_all_streams);
588 strm = &asoc->strmin[control->sinfo_stream];
625 asoc->size_on_all_streams -= control->length;
626 sctp_ucount_decr(asoc->cnt_on_all_streams);
629 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
639 asoc->size_on_all_streams -= control->length;
640 sctp_ucount_decr(asoc->cnt_on_all_streams);
652 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
668 if (SCTP_TSN_GE(asoc->cumulative_tsn, control->sinfo_tsn)) {
708 asoc->size_on_all_streams -= control->length;
709 sctp_ucount_decr(asoc->cnt_on_all_streams);
742 sctp_is_all_msg_on_reasm(struct sctp_association *asoc, uint32_t *t_size)
748 chk = TAILQ_FIRST(&asoc->reasmqueue);
758 TAILQ_FOREACH(chk, &asoc->reasmqueue, sctp_next) {
772 sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc)
779 chk = TAILQ_FIRST(&asoc->reasmqueue);
782 asoc->size_on_reasm_queue = 0;
783 asoc->cnt_on_reasm_queue = 0;
786 if (asoc->fragmented_delivery_inprogress == 0) {
788 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered + 1;
802 if (sctp_is_all_msg_on_reasm(asoc, &tsize) || (tsize >= pd_point)) {
808 asoc->fragmented_delivery_inprogress = 1;
809 asoc->tsn_last_delivered =
811 asoc->str_of_pdapi =
813 asoc->ssn_of_pdapi = chk->rec.data.stream_seq;
814 asoc->pdapi_ppid = chk->rec.data.payloadtype;
815 asoc->fragment_flags = chk->rec.data.rcv_flags;
816 sctp_service_reassembly(stcb, asoc);
825 sctp_service_reassembly(stcb, asoc);
826 if (asoc->fragmented_delivery_inprogress == 0) {
842 sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
851 cum_ackp1 = asoc->tsn_last_delivered + 1;
852 if (TAILQ_EMPTY(&asoc->reasmqueue)) {
854 TAILQ_INSERT_HEAD(&asoc->reasmqueue, chk, sctp_next);
859 asoc->size_on_reasm_queue = chk->send_size;
860 sctp_ucount_incr(asoc->cnt_on_reasm_queue);
862 if (asoc->fragmented_delivery_inprogress == 0 &&
880 } else if (asoc->fragmented_delivery_inprogress &&
897 } else if (asoc->fragmented_delivery_inprogress) {
903 asoc->str_of_pdapi) {
907 asoc->str_of_pdapi);
910 asoc->str_of_pdapi,
918 } else if ((asoc->fragment_flags & SCTP_DATA_UNORDERED) !=
920 chk->rec.data.stream_seq != asoc->ssn_of_pdapi) {
924 asoc->ssn_of_pdapi);
927 asoc->ssn_of_pdapi,
941 TAILQ_FOREACH(at, &asoc->reasmqueue, sctp_next) {
948 asoc->size_on_reasm_queue += chk->send_size;
949 sctp_ucount_incr(asoc->cnt_on_reasm_queue);
976 asoc->size_on_reasm_queue += chk->send_size;
977 sctp_ucount_incr(asoc->cnt_on_reasm_queue);
978 TAILQ_INSERT_AFTER(&asoc->reasmqueue, at, chk, sctp_next);
1207 sctp_deliver_reasm_check(stcb, asoc);
1217 sctp_does_tsn_belong_to_reasm(struct sctp_association *asoc,
1223 TAILQ_FOREACH(at, &asoc->reasmqueue, sctp_next) {
1271 sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
1296 asoc->send_sack = 1;
1301 sctp_log_map(tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_TSN_ENTERS);
1307 if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) {
1310 if (asoc->numduptsns < SCTP_MAX_DUP_TSNS) {
1312 asoc->dup_tsns[asoc->numduptsns] = tsn;
1313 asoc->numduptsns++;
1315 asoc->send_sack = 1;
1319 SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn);
1324 if (gap >= (uint32_t) (asoc->mapping_array_size << 3)) {
1326 if (sctp_expand_mapping_array(asoc, gap)) {
1335 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap) ||
1336 SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap)) {
1338 if (asoc->numduptsns < SCTP_MAX_DUP_TSNS) {
1340 asoc->dup_tsns[asoc->numduptsns] = tsn;
1341 asoc->numduptsns++;
1343 asoc->send_sack = 1;
1352 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET))) {
1369 if (((asoc->cnt_on_all_streams +
1370 asoc->cnt_on_reasm_queue +
1371 asoc->cnt_msg_on_sb) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue)) ||
1372 (((int)asoc->my_rwnd) <= 0)) {
1383 atomic_add_int(&stcb->asoc.refcnt, 1);
1387 atomic_subtract_int(&stcb->asoc.refcnt, 1);
1388 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
1400 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_map) &&
1401 SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
1403 sctp_set_rwnd(stcb, asoc);
1404 if ((asoc->cnt_on_all_streams +
1405 asoc->cnt_on_reasm_queue +
1406 asoc->cnt_msg_on_sb) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue)) {
1416 if (strmno >= asoc->streamincnt) {
1444 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
1445 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
1446 asoc->highest_tsn_inside_nr_map = tsn;
1448 if (tsn == (asoc->cumulative_tsn + 1)) {
1450 asoc->cumulative_tsn = tsn;
1464 if (asoc->tsn_in_at >= SCTP_TSN_LOG_SIZE) {
1465 asoc->tsn_in_at = 0;
1466 asoc->tsn_in_wrapped = 1;
1468 asoc->in_tsnlog[asoc->tsn_in_at].tsn = tsn;
1469 asoc->in_tsnlog[asoc->tsn_in_at].strm = strmno;
1470 asoc->in_tsnlog[asoc->tsn_in_at].seq = strmseq;
1471 asoc->in_tsnlog[asoc->tsn_in_at].sz = chk_length;
1472 asoc->in_tsnlog[asoc->tsn_in_at].flgs = chunk_flags;
1473 asoc->in_tsnlog[asoc->tsn_in_at].stcb = (void *)stcb;
1474 asoc->in_tsnlog[asoc->tsn_in_at].in_pos = asoc->tsn_in_at;
1475 asoc->in_tsnlog[asoc->tsn_in_at].in_out = 1;
1476 asoc->tsn_in_at++;
1479 (TAILQ_EMPTY(&asoc->resetHead)) &&
1481 SCTP_SSN_GE(asoc->strmin[strmno].last_sequence_delivered, strmseq)) {
1484 strmseq, asoc->strmin[strmno].last_sequence_delivered);
1487 asoc->strmin[strmno].last_sequence_delivered,
1545 asoc->fragmented_delivery_inprogress == 0 &&
1546 TAILQ_EMPTY(&asoc->resetHead) &&
1548 ((uint16_t)(asoc->strmin[strmno].last_sequence_delivered + 1) == strmseq &&
1549 TAILQ_EMPTY(&asoc->strmin[strmno].inqueue)))) {
1561 sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn,
1569 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
1570 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
1571 asoc->highest_tsn_inside_nr_map = tsn;
1579 asoc->strmin[strmno].last_sequence_delivered++;
1595 if ((asoc->fragmented_delivery_inprogress) &&
1596 (stcb->asoc.control_pdapi) &&
1597 (asoc->str_of_pdapi == strmno) &&
1598 (asoc->ssn_of_pdapi == strmseq)
1600 control = stcb->asoc.control_pdapi;
1619 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
1620 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
1621 asoc->highest_tsn_inside_nr_map = tsn;
1624 asoc->tsn_last_delivered = tsn;
1625 asoc->fragment_flags = chunk_flags;
1626 asoc->tsn_of_pdapi_last_delivered = tsn;
1627 asoc->last_flags_delivered = chunk_flags;
1628 asoc->last_strm_seq_delivered = strmseq;
1629 asoc->last_strm_no_delivered = strmno;
1632 asoc->fragmented_delivery_inprogress = 0;
1634 asoc->strmin[strmno].last_sequence_delivered++;
1636 stcb->asoc.control_pdapi = NULL;
1637 if (TAILQ_EMPTY(&asoc->reasmqueue) == 0) {
1649 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
1650 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
1651 asoc->highest_tsn_inside_nr_map = tsn;
1654 SCTP_SET_TSN_PRESENT(asoc->mapping_array, gap);
1655 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_map)) {
1656 asoc->highest_tsn_inside_map = tsn;
1675 chk->rec.data.context = stcb->asoc.context;
1678 chk->asoc = asoc;
1685 sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn,
1706 if (asoc->fragmented_delivery_inprogress) {
1715 estimate_tsn = asoc->tsn_last_delivered + 1;
1716 if (TAILQ_EMPTY(&asoc->reasmqueue) &&
1737 if (sctp_does_tsn_belong_to_reasm(asoc, control->sinfo_tsn)) {
1759 if (!TAILQ_EMPTY(&asoc->reasmqueue)) {
1766 if (sctp_does_tsn_belong_to_reasm(asoc, control->sinfo_tsn)) {
1790 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
1810 if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) &&
1816 if (TAILQ_EMPTY(&asoc->pending_reply_queue)) {
1818 TAILQ_INSERT_TAIL(&asoc->pending_reply_queue, control, next);
1823 TAILQ_FOREACH_SAFE(ctlOn, &asoc->pending_reply_queue, next, nctlOn) {
1839 TAILQ_INSERT_TAIL(&asoc->pending_reply_queue, control, next);
1843 sctp_queue_data_to_stream(stcb, asoc, control, abort_flag);
1854 sctp_queue_data_for_reasm(stcb, asoc, chk, abort_flag);
1867 if (tsn == (asoc->cumulative_tsn + 1)) {
1869 asoc->cumulative_tsn = tsn;
1885 sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn,
1886 asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE);
1889 if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) &&
1890 SCTP_TSN_GE(asoc->cumulative_tsn, liste->tsn)) {
1900 TAILQ_REMOVE(&asoc->resetHead, liste, next_resp);
1903 liste = TAILQ_FIRST(&asoc->resetHead);
1904 if (TAILQ_EMPTY(&asoc->resetHead)) {
1906 TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) {
1907 TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next);
1908 sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag);
1914 TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) {
1923 TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next);
1924 sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag);
1934 sctp_deliver_reasm_check(stcb, asoc);
1940 sctp_deliver_reasm_check(stcb, asoc);
1998 struct sctp_association *asoc;
2004 asoc = &stcb->asoc;
2006 old_cumack = asoc->cumulative_tsn;
2007 old_base = asoc->mapping_array_base_tsn;
2008 old_highest = asoc->highest_tsn_inside_map;
2014 for (slide_from = 0; slide_from < stcb->asoc.mapping_array_size; slide_from++) {
2015 val = asoc->nr_mapping_array[slide_from] | asoc->mapping_array[slide_from];
2024 asoc->cumulative_tsn = asoc->mapping_array_base_tsn + (at-1);
2026 if (SCTP_TSN_GT(asoc->cumulative_tsn, asoc->highest_tsn_inside_map) &&
2027 SCTP_TSN_GT(asoc->cumulative_tsn, asoc->highest_tsn_inside_nr_map)) {
2030 asoc->cumulative_tsn, asoc->highest_tsn_inside_map);
2033 asoc->cumulative_tsn, asoc->highest_tsn_inside_map);
2034 sctp_print_mapping_array(asoc);
2036 sctp_log_map(0, 6, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
2038 asoc->highest_tsn_inside_map = asoc->cumulative_tsn;
2039 asoc->highest_tsn_inside_nr_map = asoc->cumulative_tsn;
2042 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) {
2043 highest_tsn = asoc->highest_tsn_inside_nr_map;
2045 highest_tsn = asoc->highest_tsn_inside_map;
2047 if ((asoc->cumulative_tsn == highest_tsn) && (at >= 8)) {
2057 if (clr > asoc->mapping_array_size) {
2058 clr = asoc->mapping_array_size;
2060 memset(asoc->mapping_array, 0, clr);
2061 memset(asoc->nr_mapping_array, 0, clr);
2063 for (i = 0; i < asoc->mapping_array_size; i++) {
2064 if ((asoc->mapping_array[i]) || (asoc->nr_mapping_array[i])) {
2066 sctp_print_mapping_array(asoc);
2070 asoc->mapping_array_base_tsn = asoc->cumulative_tsn + 1;
2071 asoc->highest_tsn_inside_nr_map = asoc->highest_tsn_inside_map = asoc->cumulative_tsn;
2080 SCTP_CALC_TSN_TO_GAP(lgap, highest_tsn, asoc->mapping_array_base_tsn);
2083 sctp_print_mapping_array(asoc);
2092 if (slide_end > asoc->mapping_array_size) {
2097 asoc->mapping_array_size, slide_end);
2098 slide_end = asoc->mapping_array_size;
2108 if (distance + slide_from > asoc->mapping_array_size ||
2119 (uint32_t) asoc->mapping_array_size,
2126 asoc->mapping_array[ii] = asoc->mapping_array[slide_from + ii];
2127 asoc->nr_mapping_array[ii] = asoc->nr_mapping_array[slide_from + ii];
2130 for (ii = distance; ii < asoc->mapping_array_size; ii++) {
2131 asoc->mapping_array[ii] = 0;
2132 asoc->nr_mapping_array[ii] = 0;
2134 if (asoc->highest_tsn_inside_map + 1 == asoc->mapping_array_base_tsn) {
2135 asoc->highest_tsn_inside_map += (slide_from << 3);
2137 if (asoc->highest_tsn_inside_nr_map + 1 == asoc->mapping_array_base_tsn) {
2138 asoc->highest_tsn_inside_nr_map += (slide_from << 3);
2140 asoc->mapping_array_base_tsn += (slide_from << 3);
2142 sctp_log_map(asoc->mapping_array_base_tsn,
2143 asoc->cumulative_tsn, asoc->highest_tsn_inside_map,
2153 struct sctp_association *asoc;
2156 asoc = &stcb->asoc;
2157 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) {
2158 highest_tsn = asoc->highest_tsn_inside_nr_map;
2160 highest_tsn = asoc->highest_tsn_inside_map;
2167 if (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) {
2173 if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
2178 ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination));
2184 is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn);
2190 stcb->asoc.cmt_dac_pkts_rcvd++;
2192 if ((stcb->asoc.send_sack == 1) || /* We need to send a SACK */
2195 (stcb->asoc.numduptsns) || /* we have dup's */
2197 (stcb->asoc.delayed_ack == 0) || /* Delayed sack disabled */
2198 (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */
2201 if ((stcb->asoc.sctp_cmt_on_off > 0) &&
2203 (stcb->asoc.send_sack == 0) &&
2204 (stcb->asoc.numduptsns == 0) &&
2205 (stcb->asoc.delayed_ack) &&
2206 (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer))) {
2229 (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);
2233 if (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
2242 sctp_service_queues(struct sctp_tcb *stcb, struct sctp_association *asoc)
2248 if (asoc->fragmented_delivery_inprogress) {
2249 sctp_service_reassembly(stcb, asoc);
2252 if (asoc->fragmented_delivery_inprogress) {
2261 chk = TAILQ_FIRST(&asoc->reasmqueue);
2263 asoc->size_on_reasm_queue = 0;
2264 asoc->cnt_on_reasm_queue = 0;
2267 nxt_todel = asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered + 1;
2287 if (sctp_is_all_msg_on_reasm(asoc, &tsize) || (tsize >= pd_point)) {
2288 asoc->fragmented_delivery_inprogress = 1;
2289 asoc->tsn_last_delivered = chk->rec.data.TSN_seq - 1;
2290 asoc->str_of_pdapi = chk->rec.data.stream_number;
2291 asoc->ssn_of_pdapi = chk->rec.data.stream_seq;
2292 asoc->pdapi_ppid = chk->rec.data.payloadtype;
2293 asoc->fragment_flags = chk->rec.data.rcv_flags;
2294 sctp_service_reassembly(stcb, asoc);
2295 if (asoc->fragmented_delivery_inprogress == 0) {
2313 struct sctp_association *asoc;
2322 sctp_set_rwnd(stcb, &stcb->asoc);
2326 asoc = &stcb->asoc;
2327 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) {
2328 highest_tsn = asoc->highest_tsn_inside_nr_map;
2330 highest_tsn = asoc->highest_tsn_inside_map;
2332 was_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn);
2338 asoc->last_data_chunk_from = net;
2379 *high_tsn = asoc->cumulative_tsn;
2381 asoc->data_pkts_seen++;
2436 if (sctp_process_a_data_chunk(stcb, asoc, mm, *offset, ch,
2571 stcb->asoc.overall_error_count,
2576 stcb->asoc.overall_error_count = 0;
2577 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_last_rcvd);
2580 if (!(TAILQ_EMPTY(&asoc->reasmqueue)))
2581 sctp_service_queues(stcb, asoc);
2583 if (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) {
2585 stcb->asoc.send_sack = 1;
2607 tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue);
2720 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
2721 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged)(tp1->whoTo,
2740 &stcb->asoc,
2757 stcb->asoc.this_sack_highest_gap)) {
2758 stcb->asoc.this_sack_highest_gap =
2762 sctp_ucount_decr(stcb->asoc.sent_queue_retran_cnt);
2765 (stcb->asoc.sent_queue_retran_cnt & 0x000000ff));
2785 if (stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
2786 stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues--;
2795 sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1);
2810 tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue);
2815 tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue);
2825 sctp_handle_segments(struct mbuf *m, int *offset, struct sctp_tcb *stcb, struct sctp_association *asoc,
2838 tp1 = TAILQ_FIRST(&asoc->sent_queue);
2845 tp1 = TAILQ_FIRST(&asoc->sent_queue);
2862 tp1 = TAILQ_FIRST(&asoc->sent_queue);
2890 struct sctp_association *asoc, uint32_t cumack,
2895 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
2927 sctp_log_sack(asoc->last_acked_seq,
2946 sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
2961 tp1 = TAILQ_FIRST(&stcb->asoc.send_queue);
2963 sending_seq = asoc->sending_seq;
2969 if ((asoc->sctp_cmt_on_off > 0) &&
2971 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
2976 if (stcb->asoc.peer_supports_prsctp) {
2979 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
2997 if (stcb->asoc.peer_supports_prsctp) {
3015 if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, asoc->this_sack_highest_gap)) {
3059 * if (accum_moved && asoc->fast_retran_loss_recovery && (sctp_cmt_on_off == 0)) {
3061 if (accum_moved && asoc->fast_retran_loss_recovery) {
3075 if ((asoc->sctp_cmt_on_off > 0) &&
3100 (asoc->sctp_cmt_on_off == 0)) {
3111 * this for singly homed asoc's. However if the FR's
3115 (asoc->numnets < 2)
3138 if ((asoc->sctp_cmt_on_off > 0) &&
3195 if ((asoc->sctp_cmt_on_off > 0) &&
3234 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
3235 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged)(tp1->whoTo,
3242 asoc->peers_rwnd, tp1->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
3245 asoc->peers_rwnd += (tp1->send_size + SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
3250 if ((stcb->asoc.peer_supports_prsctp) &&
3273 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
3274 if (asoc->sctp_cmt_on_off > 0) {
3283 if (asoc->sctp_cmt_pf > 0) {
3328 if (TAILQ_EMPTY(&asoc->send_queue)) {
3347 ttt = TAILQ_FIRST(&asoc->send_queue);
3376 struct sctp_association *asoc)
3382 if (asoc->peer_supports_prsctp == 0) {
3385 TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
3396 asoc->advanced_peer_ack_point,
3403 * retransmitted until the asoc fails.
3449 if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, asoc->advanced_peer_ack_point)) {
3450 asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq;
3452 } else if (tp1->rec.data.TSN_seq == asoc->advanced_peer_ack_point) {
3468 sctp_fs_audit(struct sctp_association *asoc)
3474 entry_flight = asoc->total_flight;
3475 entry_cnt = asoc->total_flight_count;
3478 if (asoc->pr_sctp_cnt >= asoc->sent_queue_cnt)
3481 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
3503 SCTP_PRINTF("asoc->total_flight:%d cnt:%d\n",
3517 struct sctp_association *asoc,
3531 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
3532 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged)(tp1->whoTo,
3539 sctp_ucount_incr(asoc->sent_queue_retran_cnt);
3555 struct sctp_association *asoc;
3565 rwnd, stcb->asoc.last_acked_seq, stcb->asoc.peers_rwnd);
3569 stcb->asoc.cumack_log[stcb->asoc.cumack_log_at] = cumack;
3570 stcb->asoc.cumack_log_at++;
3571 if (stcb->asoc.cumack_log_at > SCTP_TSN_LOG_SIZE) {
3572 stcb->asoc.cumack_log_at = 0;
3575 asoc = &stcb->asoc;
3576 old_rwnd = asoc->peers_rwnd;
3577 if (SCTP_TSN_GT(asoc->last_acked_seq, cumack)) {
3580 } else if (asoc->last_acked_seq == cumack) {
3582 asoc->peers_rwnd = sctp_sbspace_sub(rwnd,
3583 (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
3584 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
3586 asoc->peers_rwnd = 0;
3588 if (asoc->peers_rwnd > old_rwnd) {
3595 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3610 if (stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) {
3611 (*stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack)(stcb, net);
3617 if (!TAILQ_EMPTY(&asoc->sent_queue)) {
3618 tp1 = TAILQ_LAST(&asoc->sent_queue,
3622 send_s = asoc->sending_seq;
3645 asoc->this_sack_highest_gap = cumack;
3648 stcb->asoc.overall_error_count,
3653 stcb->asoc.overall_error_count = 0;
3654 if (SCTP_TSN_GT(cumack, asoc->last_acked_seq)) {
3656 TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
3676 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
3677 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged)(tp1->whoTo,
3701 asoc, tp1->whoTo,
3735 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
3743 if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
3744 asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--;
3751 TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
3754 sctp_free_bufspace(stcb, asoc, tp1, 1);
3759 sctp_log_sack(asoc->last_acked_seq,
3766 asoc->sent_queue_cnt--;
3781 inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk));
3782 sb_free_now = SCTP_SB_LIMIT_SND(stcb->sctp_socket) - (inqueue_bytes + stcb->asoc.sb_send_resv);
3788 (stcb->asoc.chunks_on_out_queue <= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) ||
3790 atomic_add_int(&stcb->asoc.refcnt, 1);
3794 atomic_subtract_int(&stcb->asoc.refcnt, 1);
3813 atomic_add_int(&stcb->asoc.refcnt, 1);
3817 atomic_subtract_int(&stcb->asoc.refcnt, 1);
3818 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
3835 if ((asoc->last_acked_seq != cumack) && (ecne_seen == 0)) {
3836 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3849 if (net == stcb->asoc.primary_destination) {
3850 if (stcb->asoc.alternate) {
3852 sctp_free_remote_addr(stcb->asoc.alternate);
3853 stcb->asoc.alternate = NULL;
3860 asoc->cc_functions.sctp_cwnd_update_exit_pf(stcb, net);
3866 if (net->RTO < stcb->asoc.minrto) {
3867 net->RTO = stcb->asoc.minrto;
3869 if (net->RTO > stcb->asoc.maxrto) {
3870 net->RTO = stcb->asoc.maxrto;
3874 asoc->cc_functions.sctp_cwnd_update_after_sack(stcb, asoc, 1, 0, 0);
3876 asoc->last_acked_seq = cumack;
3878 if (TAILQ_EMPTY(&asoc->sent_queue)) {
3880 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3884 asoc->total_flight = 0;
3885 asoc->total_flight_count = 0;
3889 asoc->peers_rwnd = sctp_sbspace_sub(rwnd,
3890 (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
3891 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
3893 asoc->peers_rwnd = 0;
3895 if (asoc->peers_rwnd > old_rwnd) {
3901 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3910 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
3913 sctp_window_probe_recovery(stcb, asoc, tp1);
3919 to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto);
3946 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
3947 (asoc->sent_queue_retran_cnt == 0) &&
3953 if (sctp_fs_audit(asoc)) {
3954 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3957 asoc->total_flight = 0;
3958 asoc->total_flight_count = 0;
3959 asoc->sent_queue_retran_cnt = 0;
3960 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
3965 sctp_ucount_incr(asoc->sent_queue_retran_cnt);
3975 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue)) {
3978 if ((asoc->stream_queue_cnt == 1) &&
3979 ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
3980 (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED)) &&
3981 (asoc->locked_on_sending)
3988 * sp will be cleaned during free of the asoc.
3990 sp = TAILQ_LAST(&((asoc->locked_on_sending)->outqueue),
3995 asoc->stream_queue_cnt--;
3997 asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT;
3998 asoc->locked_on_sending = NULL;
3999 asoc->stream_queue_cnt--;
4003 if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) &&
4004 (asoc->stream_queue_cnt == 0)) {
4005 if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
4018 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
4019 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4022 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
4023 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4025 if (asoc->alternate) {
4026 netp = asoc->alternate;
4028 netp = asoc->primary_destination;
4036 } else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) &&
4037 (asoc->stream_queue_cnt == 0)) {
4040 if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
4044 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
4045 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4047 if (asoc->alternate) {
4048 netp = asoc->alternate;
4050 netp = asoc->primary_destination;
4062 if (SCTP_TSN_GT(cumack, asoc->advanced_peer_ack_point)) {
4063 asoc->advanced_peer_ack_point = cumack;
4066 if ((asoc->peer_supports_prsctp) && (asoc->pr_sctp_cnt > 0)) {
4070 old_adv_peer_ack_point = asoc->advanced_peer_ack_point;
4071 lchk = sctp_try_advance_peer_ack_point(stcb, asoc);
4073 if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, cumack)) {
4077 if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, old_adv_peer_ack_point)) {
4078 send_forward_tsn(stcb, asoc);
4082 send_forward_tsn(stcb, asoc);
4095 stcb->asoc.peers_rwnd,
4096 stcb->asoc.total_flight,
4097 stcb->asoc.total_output_queue_size);
4108 struct sctp_association *asoc;
4152 stcb->asoc.cumack_log[stcb->asoc.cumack_log_at] = cum_ack;
4153 stcb->asoc.cumack_log_at++;
4154 if (stcb->asoc.cumack_log_at > SCTP_TSN_LOG_SIZE) {
4155 stcb->asoc.cumack_log_at = 0;
4162 rwnd, stcb->asoc.last_acked_seq, stcb->asoc.peers_rwnd);
4165 old_rwnd = stcb->asoc.peers_rwnd;
4168 stcb->asoc.overall_error_count,
4173 stcb->asoc.overall_error_count = 0;
4174 asoc = &stcb->asoc;
4176 sctp_log_sack(asoc->last_acked_seq,
4198 if (!TAILQ_EMPTY(&asoc->sent_queue)) {
4199 tp1 = TAILQ_LAST(&asoc->sent_queue,
4204 send_s = asoc->sending_seq;
4234 if (SCTP_TSN_GT(asoc->last_acked_seq, last_tsn)) {
4240 if (TAILQ_EMPTY(&asoc->sent_queue) &&
4241 TAILQ_EMPTY(&asoc->send_queue) &&
4242 (asoc->stream_queue_cnt == 0)) {
4246 asoc->peers_rwnd, 0, 0, a_rwnd);
4248 asoc->peers_rwnd = a_rwnd;
4249 if (asoc->sent_queue_retran_cnt) {
4250 asoc->sent_queue_retran_cnt = 0;
4252 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4254 asoc->peers_rwnd = 0;
4257 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4263 asoc->total_flight = 0;
4264 asoc->total_flight_count = 0;
4274 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4289 if (stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) {
4290 (*stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack)(stcb, net);
4294 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4328 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
4329 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged)(tp1->whoTo,
4352 asoc, tp1->whoTo,
4382 sctp_log_sack(asoc->last_acked_seq,
4394 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
4397 (asoc->sent_queue_retran_cnt & 0x000000ff));
4415 asoc->this_sack_highest_gap = last_tsn;
4424 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4435 if (sctp_handle_segments(m, &offset_seg, stcb, asoc, last_tsn, &biggest_tsn_acked,
4459 if (asoc->sctp_cmt_on_off > 0) {
4460 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4469 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4478 asoc->last_acked_seq = cum_ack;
4480 TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
4485 if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
4486 asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--;
4493 TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
4495 if (asoc->pr_sctp_cnt != 0)
4496 asoc->pr_sctp_cnt--;
4498 asoc->sent_queue_cnt--;
4501 sctp_free_bufspace(stcb, asoc, tp1, 1);
4504 if (asoc->peer_supports_prsctp && PR_SCTP_BUF_ENABLED(tp1->flags)) {
4505 asoc->sent_queue_cnt_removeable--;
4509 sctp_log_sack(asoc->last_acked_seq,
4519 if (TAILQ_EMPTY(&asoc->sent_queue) && (asoc->total_flight > 0)) {
4524 asoc->total_flight);
4526 asoc->total_flight = 0;
4536 inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk));
4537 asoc.sb_send_resv);
4543 atomic_add_int(&stcb->asoc.refcnt, 1);
4547 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4565 atomic_add_int(&stcb->asoc.refcnt, 1);
4569 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4570 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
4586 if (asoc->fast_retran_loss_recovery && accum_moved) {
4587 if (SCTP_TSN_GE(asoc->last_acked_seq, asoc->fast_recovery_tsn)) {
4603 sctp_check_for_revoked(stcb, asoc, cum_ack, biggest_tsn_acked);
4604 asoc->saw_sack_with_frags = 1;
4605 } else if (asoc->saw_sack_with_frags) {
4609 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4636 asoc->saw_sack_with_frags = 0;
4639 asoc->saw_sack_with_nr_frags = 1;
4641 asoc->saw_sack_with_nr_frags = 0;
4645 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4659 if (net == stcb->asoc.primary_destination) {
4660 if (stcb->asoc.alternate) {
4662 sctp_free_remote_addr(stcb->asoc.alternate);
4663 stcb->asoc.alternate = NULL;
4671 asoc->cc_functions.sctp_cwnd_update_exit_pf(stcb, net);
4677 if (net->RTO < stcb->asoc.minrto) {
4678 net->RTO = stcb->asoc.minrto;
4680 if (net->RTO > stcb->asoc.maxrto) {
4681 net->RTO = stcb->asoc.maxrto;
4685 asoc->cc_functions.sctp_cwnd_update_after_sack(stcb, asoc, accum_moved, reneged_all, will_exit_fast_recovery);
4688 if (TAILQ_EMPTY(&asoc->sent_queue)) {
4690 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4697 asoc->total_flight = 0;
4698 asoc->total_flight_count = 0;
4704 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue)) {
4708 asoc->peers_rwnd, 0, 0, a_rwnd);
4710 asoc->peers_rwnd = a_rwnd;
4711 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4713 asoc->peers_rwnd = 0;
4716 if ((asoc->stream_queue_cnt == 1) &&
4717 ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
4718 (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED)) &&
4719 (asoc->locked_on_sending)
4727 sp = TAILQ_LAST(&((asoc->locked_on_sending)->outqueue),
4730 asoc->locked_on_sending = NULL;
4732 asoc->stream_queue_cnt--;
4734 asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT;
4735 asoc->stream_queue_cnt--;
4739 if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) &&
4740 (asoc->stream_queue_cnt == 0)) {
4741 if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
4755 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
4756 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4759 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
4760 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4762 if (asoc->alternate) {
4763 netp = asoc->alternate;
4765 netp = asoc->primary_destination;
4774 } else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) &&
4775 (asoc->stream_queue_cnt == 0)) {
4778 if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
4782 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
4783 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4785 if (asoc->alternate) {
4786 netp = asoc->alternate;
4788 netp = asoc->primary_destination;
4800 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4809 if ((asoc->sctp_cmt_on_off > 0) &&
4815 sctp_strike_gap_ack_chunks(stcb, asoc, biggest_tsn_acked,
4819 asoc->cc_functions.sctp_cwnd_update_after_fr(stcb, asoc);
4824 asoc->fast_retran_loss_recovery = 0;
4826 if ((asoc->sat_t3_loss_recovery) &&
4827 SCTP_TSN_GE(asoc->last_acked_seq, asoc->sat_t3_recovery_tsn)) {
4829 asoc->sat_t3_loss_recovery = 0;
4834 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4844 asoc->peers_rwnd, asoc->total_flight, (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)), a_rwnd);
4846 asoc->peers_rwnd = sctp_sbspace_sub(a_rwnd,
4847 (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
4848 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4850 asoc->peers_rwnd = 0;
4852 if (asoc->peers_rwnd > old_rwnd) {
4863 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4872 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4874 sctp_window_probe_recovery(stcb, asoc, tp1);
4904 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
4905 (asoc->sent_queue_retran_cnt == 0) &&
4911 if (sctp_fs_audit(asoc)) {
4912 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4915 asoc->total_flight = 0;
4916 asoc->total_flight_count = 0;
4917 asoc->sent_queue_retran_cnt = 0;
4918 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4923 sctp_ucount_incr(asoc->sent_queue_retran_cnt);
4935 if (SCTP_TSN_GT(cum_ack, asoc->advanced_peer_ack_point)) {
4936 asoc->advanced_peer_ack_point = cum_ack;
4939 if ((asoc->peer_supports_prsctp) && (asoc->pr_sctp_cnt > 0)) {
4943 old_adv_peer_ack_point = asoc->advanced_peer_ack_point;
4944 lchk = sctp_try_advance_peer_ack_point(stcb, asoc);
4946 if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, cum_ack)) {
4952 0xee, cum_ack, asoc->advanced_peer_ack_point,
4955 if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, old_adv_peer_ack_point)) {
4956 send_forward_tsn(stcb, asoc);
4960 send_forward_tsn(stcb, asoc);
4973 stcb->asoc.peers_rwnd,
4974 stcb->asoc.total_flight,
4975 stcb->asoc.total_output_queue_size);
4987 a_rwnd = stcb->asoc.peers_rwnd + stcb->asoc.total_flight;
4998 struct sctp_association *asoc;
5001 asoc = &stcb->asoc;
5012 asoc->size_on_all_streams -= ctl->length;
5013 sctp_ucount_decr(asoc->cnt_on_all_streams);
5016 sctp_mark_non_revokable(asoc, ctl->sinfo_tsn);
5036 asoc->size_on_all_streams -= ctl->length;
5037 sctp_ucount_decr(asoc->cnt_on_all_streams);
5041 sctp_mark_non_revokable(asoc
5056 struct sctp_association *asoc,
5070 TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) {
5081 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
5082 if (SCTP_TSN_GT(chk->rec.data.TSN_seq, asoc->tsn_last_delivered)) {
5083 asoc->tsn_last_delivered = chk->rec.data.TSN_seq;
5084 asoc->str_of_pdapi = chk->rec.data.stream_number;
5085 asoc->ssn_of_pdapi = chk->rec.data.stream_seq;
5086 asoc->fragment_flags = chk->rec.data.rcv_flags;
5088 asoc->size_on_reasm_queue -= chk->send_size;
5089 sctp_ucount_decr(asoc->cnt_on_reasm_queue);
5093 SCTP_SSN_GT(chk->rec.data.stream_seq, asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered)) {
5111 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered = chk->rec.data.stream_seq;
5143 struct sctp_association *asoc;
5151 asoc = &stcb->asoc;
5157 m_size = (stcb->asoc.mapping_array_size << 3);
5163 if (SCTP_TSN_GE(asoc->cumulative_tsn, new_cum_tsn)) {
5171 SCTP_CALC_TSN_TO_GAP(gap, new_cum_tsn, asoc->mapping_array_base_tsn);
5172 asoc->cumulative_tsn = new_cum_tsn;
5174 if ((long)gap > sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv)) {
5185 new_cum_tsn, asoc->highest_tsn_inside_map);
5193 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
5194 asoc->mapping_array_base_tsn = new_cum_tsn + 1;
5195 asoc->highest_tsn_inside_map = new_cum_tsn;
5197 memset(stcb->asoc.nr_mapping_array, 0, stcb->asoc.mapping_array_size);
5198 asoc->highest_tsn_inside_nr_map = new_cum_tsn;
5201 sctp_log_map(0, 3, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
5206 if (!SCTP_IS_TSN_PRESENT(asoc->mapping_array, i) &&
5207 !SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, i)) {
5208 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, i);
5209 if (SCTP_TSN_GT(asoc->mapping_array_base_tsn + i, asoc->highest_tsn_inside_nr_map)) {
5210 asoc->highest_tsn_inside_nr_map = asoc->mapping_array_base_tsn + i;
5222 if (asoc->fragmented_delivery_inprogress) {
5223 sctp_service_reassembly(stcb, asoc);
5234 TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) {
5237 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
5238 if (SCTP_TSN_GT(chk->rec.data.TSN_seq, asoc->tsn_last_delivered)) {
5239 asoc->tsn_last_delivered = chk->rec.data.TSN_seq;
5240 asoc->str_of_pdapi = chk->rec.data.stream_number;
5241 asoc->ssn_of_pdapi = chk->rec.data.stream_seq;
5242 asoc->fragment_flags = chk->rec.data.rcv_flags;
5244 asoc->size_on_reasm_queue -= chk->send_size;
5245 sctp_ucount_decr(asoc->cnt_on_reasm_queue);
5249 SCTP_SSN_GT(chk->rec.data.stream_seq, asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered)) {
5267 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered = chk->rec.data.stream_seq;
5317 if (stseq->stream >= asoc->streamincnt) {
5321 if ((asoc->str_of_pdapi == stseq->stream) &&
5322 (asoc->ssn_of_pdapi == stseq->sequence)) {
5327 asoc->fragmented_delivery_inprogress = 0;
5329 sctp_flush_reassm_for_str_seq(stcb, asoc, stseq->stream, stseq->sequence);
5336 sv = stcb->asoc.control_pdapi;
5337 stcb->asoc.control_pdapi = ctl;
5343 stcb->asoc.control_pdapi = sv;
5351 strm = &asoc->strmin[stseq->stream];
5367 if (!TAILQ_EMPTY(&asoc->reasmqueue)) {
5370 sctp_deliver_reasm_check(stcb, &stcb->asoc);