Lines Matching full:asoc
65 struct sctp_association *asoc,
69 sctp_set_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
71 asoc->my_rwnd = sctp_calc_rwnd(stcb, asoc);
76 sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
90 KASSERT(asoc->cnt_on_reasm_queue > 0 || asoc->size_on_reasm_queue == 0,
91 ("size_on_reasm_queue is %u", asoc->size_on_reasm_queue));
92 KASSERT(asoc->cnt_on_all_streams > 0 || asoc->size_on_all_streams == 0,
93 ("size_on_all_streams is %u", asoc->size_on_all_streams));
94 if (stcb->asoc.sb_cc == 0 &&
95 asoc->cnt_on_reasm_queue == 0 &&
96 asoc->cnt_on_all_streams == 0) {
102 calc = (uint32_t)sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv);
107 calc = sctp_sbspace_sub(calc, (uint32_t)(asoc->size_on_reasm_queue +
108 asoc->cnt_on_reasm_queue * MSIZE));
109 calc = sctp_sbspace_sub(calc, (uint32_t)(asoc->size_on_all_streams +
110 asoc->cnt_on_all_streams * MSIZE));
117 calc = sctp_sbspace_sub(calc, stcb->asoc.my_rwnd_control_len);
122 if (calc < stcb->asoc.my_rwnd_control_len) {
161 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
283 sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn)
291 if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) {
298 SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn);
299 in_r = SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap);
300 in_nr = SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap);
303 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
304 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
305 asoc->highest_tsn_inside_nr_map = tsn;
309 SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
310 if (tsn == asoc->highest_tsn_inside_map) {
312 for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) {
313 SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn);
314 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) {
315 asoc->highest_tsn_inside_map = i;
319 if (!SCTP_TSN_GE(i, asoc->mapping_array_base_tsn)) {
320 asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1;
328 struct sctp_association *asoc,
339 if (asoc->idata_supported == 0) {
370 if (SCTP_MID_GT(asoc->idata_supported, at->mid, control->mid)) {
382 } else if (SCTP_MID_EQ(asoc->idata_supported, at->mid, control->mid)) {
421 if (stcb->asoc.idata_supported) {
479 struct sctp_association *asoc,
507 strm = &asoc->strmin[control->sinfo_stream];
511 if (SCTP_MID_GT((asoc->idata_supported), strm->last_mid_delivered, control->mid)) {
520 if (asoc->idata_supported) {
538 asoc->size_on_all_streams += control->length;
539 sctp_ucount_incr(asoc->cnt_on_all_streams);
541 if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) {
548 if (asoc->size_on_all_streams >= control->length) {
549 asoc->size_on_all_streams -= control->length;
552 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
554 asoc->size_on_all_streams = 0;
557 sctp_ucount_decr(asoc->cnt_on_all_streams);
559 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
567 if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid) &&
571 if (asoc->size_on_all_streams >= control->length) {
572 asoc->size_on_all_streams -= control->length;
575 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
577 asoc->size_on_all_streams = 0;
580 sctp_ucount_decr(asoc->cnt_on_all_streams);
599 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
606 } else if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) {
617 if (sctp_place_control_in_stream(strm, asoc, control)) {
751 struct sctp_association *asoc,
788 sctp_add_chk_to_control(control, strm, stcb, asoc, chk, inp_read_lock_held);
804 if (asoc->size_on_reasm_queue >= tchk->send_size) {
805 asoc->size_on_reasm_queue -= tchk->send_size;
808 panic("size_on_reasm_queue = %u smaller than chunk length %u", asoc->size_on_reasm_queue, tchk->send_size);
810 asoc->size_on_reasm_queue = 0;
813 sctp_ucount_decr(asoc->cnt_on_reasm_queue);
819 sctp_mark_non_revokable(asoc, tchk->rec.data.tsn);
896 struct sctp_association *asoc,
993 sctp_mark_non_revokable(asoc, chk->rec.data.tsn);
1007 asoc->size_on_reasm_queue += chk->send_size;
1008 sctp_ucount_incr(asoc->cnt_on_reasm_queue);
1026 asoc->size_on_reasm_queue += chk->send_size;
1027 sctp_ucount_incr(asoc->cnt_on_reasm_queue);
1034 sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc,
1057 (asoc->idata_supported == 0)) {
1059 if (sctp_handle_old_unordered_data(stcb, asoc, strm, control, pd_point, inp_read_lock_held)) {
1082 if (asoc->size_on_all_streams >= control->length) {
1083 asoc->size_on_all_streams -= control->length;
1086 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
1088 asoc->size_on_all_streams = 0;
1091 sctp_ucount_decr(asoc->cnt_on_all_streams);
1124 if (SCTP_MID_EQ(asoc->idata_supported, strm->last_mid_delivered, control->mid)) {
1147 if (asoc->size_on_all_streams >= control->length) {
1148 asoc->size_on_all_streams -= control->length;
1151 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
1153 asoc->size_on_all_streams = 0;
1156 sctp_ucount_decr(asoc->cnt_on_all_streams);
1187 if (SCTP_MID_EQ(asoc->idata_supported, control->mid, next_to_del) &&
1203 if (asoc->size_on_all_streams >= control->length) {
1204 asoc->size_on_all_streams -= control->length;
1207 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
1209 asoc->size_on_all_streams = 0;
1212 sctp_ucount_decr(asoc->cnt_on_all_streams);
1222 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
1239 if (asoc->size_on_all_streams >= control->length) {
1240 asoc->size_on_all_streams -= control->length;
1243 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
1245 asoc->size_on_all_streams = 0;
1270 struct sctp_tcb *stcb, struct sctp_association *asoc,
1297 asoc->size_on_reasm_queue -= chk->send_size;
1298 sctp_ucount_decr(asoc->cnt_on_reasm_queue);
1299 sctp_mark_non_revokable(asoc, chk->rec.data.tsn);
1325 sctp_ucount_decr(asoc->cnt_on_all_streams);
1352 sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
1364 strm = &asoc->strmin[control->sinfo_stream];
1375 if ((unordered == 0) || (asoc->idata_supported)) {
1376 sctp_ucount_incr(asoc->cnt_on_all_streams);
1378 if (sctp_place_control_in_stream(strm, asoc, control)) {
1386 if ((tsn == (asoc->cumulative_tsn + 1) && (asoc->idata_supported == 0))) {
1400 if ((asoc->idata_supported == 0) && (unordered == 1)) {
1401 sctp_inject_old_unordered_data(stcb, asoc, control, chk, abort_flag);
1433 sctp_mark_non_revokable(asoc, chk->rec.data.tsn);
1437 asoc->size_on_all_streams += control->length;
1466 if (asoc->idata_supported || control->first_frag_seen) {
1495 if (asoc->idata_supported || control->first_frag_seen) {
1557 asoc->size_on_reasm_queue += chk->send_size;
1558 sctp_ucount_incr(asoc->cnt_on_reasm_queue);
1588 asoc->size_on_reasm_queue += chk->send_size;
1589 sctp_ucount_incr(asoc->cnt_on_reasm_queue);
1613 lenadded = sctp_add_chk_to_control(control, strm, stcb, asoc, at, SCTP_READ_LOCK_NOT_HELD);
1624 asoc->size_on_all_streams += lenadded;
1677 sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
1740 asoc->send_sack = 1;
1744 sctp_log_map(tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_TSN_ENTERS);
1750 if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) {
1753 if (asoc->numduptsns < SCTP_MAX_DUP_TSNS) {
1755 asoc->dup_tsns[asoc->numduptsns] = tsn;
1756 asoc->numduptsns++;
1758 asoc->send_sack = 1;
1762 SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn);
1767 if (gap >= (uint32_t)(asoc->mapping_array_size << 3)) {
1769 if (sctp_expand_mapping_array(asoc, gap)) {
1778 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap) ||
1779 SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap)) {
1781 if (asoc->numduptsns < SCTP_MAX_DUP_TSNS) {
1783 asoc->dup_tsns[asoc->numduptsns] = tsn;
1784 asoc->numduptsns++;
1786 asoc->send_sack = 1;
1795 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET))) {
1812 if (sid >= asoc->streamincnt) {
1835 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
1836 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
1837 asoc->highest_tsn_inside_nr_map = tsn;
1839 if (tsn == (asoc->cumulative_tsn + 1)) {
1841 asoc->cumulative_tsn = tsn;
1860 control = sctp_find_reasm_entry(&asoc->strmin[sid], mid, ordered, asoc->idata_supported);
1904 if (ordered || asoc->idata_supported) {
1924 if (((asoc->cnt_on_all_streams +
1925 asoc->cnt_on_reasm_queue +
1926 asoc->cnt_msg_on_sb) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue)) ||
1927 (((int)asoc->my_rwnd) <= 0)) {
1938 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_map) &&
1939 SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
1942 sctp_set_rwnd(stcb, asoc);
1943 if ((asoc->cnt_on_all_streams +
1944 asoc->cnt_on_reasm_queue +
1945 asoc->cnt_msg_on_sb) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue)) {
1964 if (asoc->tsn_in_at >= SCTP_TSN_LOG_SIZE) {
1965 asoc->tsn_in_at = 0;
1966 asoc->tsn_in_wrapped = 1;
1968 asoc->in_tsnlog[asoc->tsn_in_at].tsn = tsn;
1969 asoc->in_tsnlog[asoc->tsn_in_at].strm = sid;
1970 asoc->in_tsnlog[asoc->tsn_in_at].seq = mid;
1971 asoc->in_tsnlog[asoc->tsn_in_at].sz = chk_length;
1972 asoc->in_tsnlog[asoc->tsn_in_at].flgs = chunk_flags;
1973 asoc->in_tsnlog[asoc->tsn_in_at].stcb = (void *)stcb;
1974 asoc->in_tsnlog[asoc->tsn_in_at].in_pos = asoc->tsn_in_at;
1975 asoc->in_tsnlog[asoc->tsn_in_at].in_out = 1;
1976 asoc->tsn_in_at++;
1986 (TAILQ_EMPTY(&asoc->resetHead)) &&
1988 SCTP_MID_GE(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered, mid)) {
1991 mid, asoc->strmin[sid].last_mid_delivered);
1993 if (asoc->idata_supported) {
1995 asoc->strmin[sid].last_mid_delivered,
2001 (uint16_t)asoc->strmin[sid].last_mid_delivered,
2073 sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn,
2104 TAILQ_EMPTY(&asoc->resetHead) &&
2106 (SCTP_MID_EQ(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered + 1, mid) &&
2107 TAILQ_EMPTY(&asoc->strmin[sid].inqueue)))) {
2116 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
2117 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
2118 asoc->highest_tsn_inside_nr_map = tsn;
2129 asoc->strmin[sid].last_mid_delivered++;
2158 chk->rec.data.context = stcb->asoc.context;
2161 chk->asoc = asoc;
2172 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
2173 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
2174 asoc->highest_tsn_inside_nr_map = tsn;
2177 SCTP_SET_TSN_PRESENT(asoc->mapping_array, gap);
2178 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_map)) {
2179 asoc->highest_tsn_inside_map = tsn;
2192 if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) &&
2198 if (TAILQ_EMPTY(&asoc->pending_reply_queue)) {
2200 TAILQ_INSERT_TAIL(&asoc->pending_reply_queue, control, next);
2205 TAILQ_FOREACH_SAFE(lcontrol, &asoc->pending_reply_queue, next, nlcontrol) {
2221 TAILQ_INSERT_TAIL(&asoc->pending_reply_queue, control, next);
2230 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
2239 sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check);
2254 sctp_queue_data_for_reasm(stcb, asoc, control, chk, created_control, abort_flag, tsn);
2267 if (tsn == (asoc->cumulative_tsn + 1)) {
2269 asoc->cumulative_tsn = tsn;
2285 sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn,
2286 asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE);
2289 (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[sid], SCTP_READ_LOCK_NOT_HELD);
2293 if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) &&
2294 SCTP_TSN_GE(asoc->cumulative_tsn, liste->tsn)) {
2302 TAILQ_REMOVE(&asoc->resetHead, liste, next_resp);
2306 liste = TAILQ_FIRST(&asoc->resetHead);
2307 if (TAILQ_EMPTY(&asoc->resetHead)) {
2309 TAILQ_FOREACH_SAFE(control, &asoc->pending_reply_queue, next, ncontrol) {
2310 TAILQ_REMOVE(&asoc->pending_reply_queue, control, next);
2311 strm = &asoc->strmin[control->sinfo_stream];
2312 sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check);
2317 (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD);
2322 TAILQ_FOREACH_SAFE(control, &asoc->pending_reply_queue, next, ncontrol) {
2331 TAILQ_REMOVE(&asoc->pending_reply_queue, control, next);
2332 strm = &asoc->strmin[control->sinfo_stream];
2333 sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check);
2338 (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD);
2397 struct sctp_association *asoc;
2403 asoc = &stcb->asoc;
2405 old_cumack = asoc->cumulative_tsn;
2406 old_base = asoc->mapping_array_base_tsn;
2407 old_highest = asoc->highest_tsn_inside_map;
2413 for (slide_from = 0; slide_from < stcb->asoc.mapping_array_size; slide_from++) {
2414 val = asoc->nr_mapping_array[slide_from] | asoc->mapping_array[slide_from];
2423 asoc->cumulative_tsn = asoc->mapping_array_base_tsn + (at - 1);
2425 if (SCTP_TSN_GT(asoc->cumulative_tsn, asoc->highest_tsn_inside_map) &&
2426 SCTP_TSN_GT(asoc->cumulative_tsn, asoc->highest_tsn_inside_nr_map)) {
2429 asoc->cumulative_tsn, asoc->highest_tsn_inside_map);
2432 asoc->cumulative_tsn, asoc->highest_tsn_inside_map);
2433 sctp_print_mapping_array(asoc);
2435 sctp_log_map(0, 6, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
2437 asoc->highest_tsn_inside_map = asoc->cumulative_tsn;
2438 asoc->highest_tsn_inside_nr_map = asoc->cumulative_tsn;
2441 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) {
2442 highest_tsn = asoc->highest_tsn_inside_nr_map;
2444 highest_tsn = asoc->highest_tsn_inside_map;
2446 if ((asoc->cumulative_tsn == highest_tsn) && (at >= 8)) {
2456 if (clr > asoc->mapping_array_size) {
2457 clr = asoc->mapping_array_size;
2459 memset(asoc->mapping_array, 0, clr);
2460 memset(asoc->nr_mapping_array, 0, clr);
2462 for (i = 0; i < asoc->mapping_array_size; i++) {
2463 if ((asoc->mapping_array[i]) || (asoc->nr_mapping_array[i])) {
2465 sctp_print_mapping_array(asoc);
2469 asoc->mapping_array_base_tsn = asoc->cumulative_tsn + 1;
2470 asoc->highest_tsn_inside_nr_map = asoc->highest_tsn_inside_map = asoc->cumulative_tsn;
2479 SCTP_CALC_TSN_TO_GAP(lgap, highest_tsn, asoc->mapping_array_base_tsn);
2482 sctp_print_mapping_array(asoc);
2491 if (slide_end > asoc->mapping_array_size) {
2496 asoc->mapping_array_size, slide_end);
2497 slide_end = asoc->mapping_array_size;
2507 if (distance + slide_from > asoc->mapping_array_size ||
2517 (uint32_t)asoc->mapping_array_size,
2524 asoc->mapping_array[ii] = asoc->mapping_array[slide_from + ii];
2525 asoc->nr_mapping_array[ii] = asoc->nr_mapping_array[slide_from + ii];
2527 for (ii = distance; ii < asoc->mapping_array_size; ii++) {
2528 asoc->mapping_array[ii] = 0;
2529 asoc->nr_mapping_array[ii] = 0;
2531 if (asoc->highest_tsn_inside_map + 1 == asoc->mapping_array_base_tsn) {
2532 asoc->highest_tsn_inside_map += (slide_from << 3);
2534 if (asoc->highest_tsn_inside_nr_map + 1 == asoc->mapping_array_base_tsn) {
2535 asoc->highest_tsn_inside_nr_map += (slide_from << 3);
2537 asoc->mapping_array_base_tsn += (slide_from << 3);
2539 sctp_log_map(asoc->mapping_array_base_tsn,
2540 asoc->cumulative_tsn, asoc->highest_tsn_inside_map,
2550 struct sctp_association *asoc;
2555 asoc = &stcb->asoc;
2556 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) {
2557 highest_tsn = asoc->highest_tsn_inside_nr_map;
2559 highest_tsn = asoc->highest_tsn_inside_map;
2562 is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn);
2574 if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
2580 ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination));
2589 stcb->asoc.cmt_dac_pkts_rcvd++;
2591 if ((stcb->asoc.send_sack == 1) || /* We need to send a
2595 (stcb->asoc.numduptsns) || /* we have dup's */
2597 (stcb->asoc.delayed_ack == 0) || /* Delayed sack disabled */
2598 (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq)) { /* hit limit of pkts */
2599 if ((stcb->asoc.sctp_cmt_on_off > 0) &&
2601 (stcb->asoc.send_sack == 0) &&
2602 (stcb->asoc.numduptsns == 0) &&
2603 (stcb->asoc.delayed_ack) &&
2604 (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer))) {
2628 if (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
2642 struct sctp_association *asoc;
2652 sctp_set_rwnd(stcb, &stcb->asoc);
2656 asoc = &stcb->asoc;
2657 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) {
2658 highest_tsn = asoc->highest_tsn_inside_nr_map;
2660 highest_tsn = asoc->highest_tsn_inside_map;
2662 was_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn);
2668 asoc->last_data_chunk_from = net;
2708 *high_tsn = asoc->cumulative_tsn;
2710 asoc->data_pkts_seen++;
2719 if ((asoc->idata_supported == 1) &&
2730 if ((asoc->idata_supported == 0) &&
2774 if (sctp_process_a_data_chunk(stcb, asoc, mm, *offset,
2911 stcb->asoc.overall_error_count,
2916 stcb->asoc.overall_error_count = 0;
2917 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_last_rcvd);
2922 stcb->asoc.send_sack = 1;
2944 tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue);
3059 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
3060 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) (tp1->whoTo,
3078 &stcb->asoc,
3093 stcb->asoc.this_sack_highest_gap)) {
3094 stcb->asoc.this_sack_highest_gap =
3098 sctp_ucount_decr(stcb->asoc.sent_queue_retran_cnt);
3101 (stcb->asoc.sent_queue_retran_cnt & 0x000000ff));
3121 if (stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues > 0) {
3122 stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues--;
3128 if ((stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues == 0) &&
3129 (stcb->asoc.strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) &&
3130 TAILQ_EMPTY(&stcb->asoc.strmout[tp1->rec.data.sid].outqueue)) {
3131 stcb->asoc.trigger_reset = 1;
3139 sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1);
3154 tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue);
3159 tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue);
3168 sctp_handle_segments(struct mbuf *m, int *offset, struct sctp_tcb *stcb, struct sctp_association *asoc,
3181 tp1 = TAILQ_FIRST(&asoc->sent_queue);
3188 tp1 = TAILQ_FIRST(&asoc->sent_queue);
3205 tp1 = TAILQ_FIRST(&asoc->sent_queue);
3233 struct sctp_association *asoc, uint32_t cumack,
3238 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
3272 sctp_log_sack(asoc->last_acked_seq,
3290 sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
3304 tp1 = TAILQ_FIRST(&stcb->asoc.send_queue);
3306 sending_seq = asoc->sending_seq;
3312 if ((asoc->sctp_cmt_on_off > 0) &&
3314 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3319 if (stcb->asoc.prsctp_supported) {
3322 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
3340 if (stcb->asoc.prsctp_supported) {
3353 if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->this_sack_highest_gap) &&
3354 !(accum_moved && asoc->fast_retran_loss_recovery)) {
3381 !(accum_moved && asoc->fast_retran_loss_recovery)) {
3400 * asoc->fast_retran_loss_recovery && (sctp_cmt_on_off ==
3403 if (accum_moved && asoc->fast_retran_loss_recovery) {
3417 if ((asoc->sctp_cmt_on_off > 0) &&
3443 (asoc->sctp_cmt_on_off == 0)) {
3454 * this for singly homed asoc's. However if the FR's
3458 (asoc->numnets < 2)
3480 if ((asoc->sctp_cmt_on_off > 0) &&
3541 if ((asoc->sctp_cmt_on_off > 0) &&
3581 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
3582 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) (tp1->whoTo,
3589 asoc->peers_rwnd, tp1->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
3592 asoc->peers_rwnd += (tp1->send_size + SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
3597 if ((stcb->asoc.prsctp_supported) &&
3628 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
3629 if (asoc->sctp_cmt_on_off > 0) {
3638 if (asoc->sctp_cmt_pf > 0) {
3688 if (TAILQ_EMPTY(&asoc->send_queue)) {
3707 ttt = TAILQ_FIRST(&asoc->send_queue);
3736 struct sctp_association *asoc)
3742 if (asoc->prsctp_supported == 0) {
3745 TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
3756 asoc->advanced_peer_ack_point,
3763 * retransmitted until the asoc fails.
3805 if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->advanced_peer_ack_point)) {
3806 asoc->advanced_peer_ack_point = tp1->rec.data.tsn;
3808 } else if (tp1->rec.data.tsn == asoc->advanced_peer_ack_point) {
3824 sctp_fs_audit(struct sctp_association *asoc)
3835 entry_flight = asoc->total_flight;
3836 entry_cnt = asoc->total_flight_count;
3838 if (asoc->pr_sctp_cnt >= asoc->sent_queue_cnt)
3841 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
3864 SCTP_PRINTF("asoc->total_flight: %d cnt: %d\n",
3876 struct sctp_association *asoc,
3890 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
3891 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) (tp1->whoTo,
3898 sctp_ucount_incr(asoc->sent_queue_retran_cnt);
3914 struct sctp_association *asoc;
3925 rwnd, stcb->asoc.last_acked_seq, stcb->asoc.peers_rwnd);
3929 stcb->asoc.cumack_log[stcb->asoc.cumack_log_at] = cumack;
3930 stcb->asoc.cumack_log_at++;
3931 if (stcb->asoc.cumack_log_at > SCTP_TSN_LOG_SIZE) {
3932 stcb->asoc.cumack_log_at = 0;
3935 asoc = &stcb->asoc;
3936 old_rwnd = asoc->peers_rwnd;
3937 if (SCTP_TSN_GT(asoc->last_acked_seq, cumack)) {
3940 } else if (asoc->last_acked_seq == cumack) {
3942 asoc->peers_rwnd = sctp_sbspace_sub(rwnd,
3943 (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
3944 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
3946 asoc->peers_rwnd = 0;
3948 if (asoc->peers_rwnd > old_rwnd) {
3955 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3970 if (stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) {
3971 (*stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) (stcb, net);
3974 if (!TAILQ_EMPTY(&asoc->sent_queue)) {
3975 tp1 = TAILQ_LAST(&asoc->sent_queue,
3979 send_s = asoc->sending_seq;
3995 asoc->this_sack_highest_gap = cumack;
3998 stcb->asoc.overall_error_count,
4003 stcb->asoc.overall_error_count = 0;
4004 if (SCTP_TSN_GT(cumack, asoc->last_acked_seq)) {
4006 TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
4026 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
4027 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) (tp1->whoTo,
4046 &stcb->asoc,
4079 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
4087 if (asoc->strmout[tp1->rec.data.sid].chunks_on_queues > 0) {
4088 asoc->strmout[tp1->rec.data.sid].chunks_on_queues--;
4095 if ((asoc->strmout[tp1->rec.data.sid].chunks_on_queues == 0) &&
4096 (asoc->strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) &&
4097 TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.sid].outqueue)) {
4098 asoc->trigger_reset = 1;
4100 TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
4103 sctp_free_bufspace(stcb, asoc, tp1, 1);
4108 sctp_log_sack(asoc->last_acked_seq,
4115 asoc->sent_queue_cnt--;
4137 if ((asoc->last_acked_seq != cumack) && (ecne_seen == 0)) {
4138 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4151 if (net == stcb->asoc.primary_destination) {
4152 if (stcb->asoc.alternate) {
4157 sctp_free_remote_addr(stcb->asoc.alternate);
4158 stcb->asoc.alternate = NULL;
4167 asoc->cc_functions.sctp_cwnd_update_exit_pf(stcb, net);
4173 if (net->RTO < stcb->asoc.minrto) {
4174 net->RTO = stcb->asoc.minrto;
4176 if (net->RTO > stcb->asoc.maxrto) {
4177 net->RTO = stcb->asoc.maxrto;
4181 asoc->cc_functions.sctp_cwnd_update_after_sack(stcb, asoc, 1, 0, 0);
4183 asoc->last_acked_seq = cumack;
4185 if (TAILQ_EMPTY(&asoc->sent_queue)) {
4187 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4191 asoc->total_flight = 0;
4192 asoc->total_flight_count = 0;
4196 asoc->peers_rwnd = sctp_sbspace_sub(rwnd,
4197 (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
4198 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4200 asoc->peers_rwnd = 0;
4202 if (asoc->peers_rwnd > old_rwnd) {
4208 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4216 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4219 sctp_window_probe_recovery(stcb, asoc, tp1);
4248 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
4249 (asoc->sent_queue_retran_cnt == 0) &&
4256 if (sctp_fs_audit(asoc)) {
4257 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4260 asoc->total_flight = 0;
4261 asoc->total_flight_count = 0;
4262 asoc->sent_queue_retran_cnt = 0;
4263 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4268 sctp_ucount_incr(asoc->sent_queue_retran_cnt);
4278 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue)) {
4281 if ((asoc->stream_queue_cnt == 1) &&
4282 ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
4284 ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc))) {
4287 if (((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
4289 (asoc->stream_queue_cnt == 1) &&
4290 (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) {
4300 if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) &&
4301 (asoc->stream_queue_cnt == 0)) {
4310 if (asoc->alternate) {
4311 netp = asoc->alternate;
4313 netp = asoc->primary_destination;
4321 (asoc->stream_queue_cnt == 0)) {
4327 if (asoc->alternate) {
4328 netp = asoc->alternate;
4330 netp = asoc->primary_destination;
4342 if (SCTP_TSN_GT(cumack, asoc->advanced_peer_ack_point)) {
4343 asoc->advanced_peer_ack_point = cumack;
4346 if ((asoc->prsctp_supported) && (asoc->pr_sctp_cnt > 0)) {
4350 old_adv_peer_ack_point = asoc->advanced_peer_ack_point;
4351 lchk = sctp_try_advance_peer_ack_point(stcb, asoc);
4353 if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, cumack)) {
4357 if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, old_adv_peer_ack_point)) {
4358 send_forward_tsn(stcb, asoc);
4362 send_forward_tsn(stcb, asoc);
4380 stcb->asoc.peers_rwnd,
4381 stcb->asoc.total_flight,
4382 stcb->asoc.total_output_queue_size);
4393 struct sctp_association *asoc;
4438 stcb->asoc.cumack_log[stcb->asoc.cumack_log_at] = cum_ack;
4439 stcb->asoc.cumack_log_at++;
4440 if (stcb->asoc.cumack_log_at > SCTP_TSN_LOG_SIZE) {
4441 stcb->asoc.cumack_log_at = 0;
4448 rwnd, stcb->asoc.last_acked_seq, stcb->asoc.peers_rwnd);
4451 old_rwnd = stcb->asoc.peers_rwnd;
4454 stcb->asoc.overall_error_count,
4459 stcb->asoc.overall_error_count = 0;
4460 asoc = &stcb->asoc;
4462 sctp_log_sack(asoc->last_acked_seq,
4483 if (!TAILQ_EMPTY(&asoc->sent_queue)) {
4484 tp1 = TAILQ_LAST(&asoc->sent_queue,
4489 send_s = asoc->sending_seq;
4519 if (SCTP_TSN_GT(asoc->last_acked_seq, last_tsn)) {
4525 if (TAILQ_EMPTY(&asoc->sent_queue) &&
4526 TAILQ_EMPTY(&asoc->send_queue) &&
4527 (asoc->stream_queue_cnt == 0)) {
4531 asoc->peers_rwnd, 0, 0, a_rwnd);
4533 asoc->peers_rwnd = a_rwnd;
4534 if (asoc->sent_queue_retran_cnt) {
4535 asoc->sent_queue_retran_cnt = 0;
4537 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4539 asoc->peers_rwnd = 0;
4542 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4548 asoc->total_flight = 0;
4549 asoc->total_flight_count = 0;
4559 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4574 if (stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) {
4575 (*stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) (stcb, net);
4587 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4621 if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
4622 (*stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) (tp1->whoTo,
4644 &stcb->asoc,
4672 sctp_log_sack(asoc->last_acked_seq,
4684 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
4687 (asoc->sent_queue_retran_cnt & 0x000000ff));
4705 asoc->this_sack_highest_gap = last_tsn;
4714 if (sctp_handle_segments(m, &offset_seg, stcb, asoc, last_tsn, &biggest_tsn_acked,
4736 if (asoc->sctp_cmt_on_off > 0) {
4737 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4745 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4754 asoc->last_acked_seq = cum_ack;
4756 TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
4761 if (asoc->strmout[tp1->rec.data.sid].chunks_on_queues > 0) {
4762 asoc->strmout[tp1->rec.data.sid].chunks_on_queues--;
4769 if ((asoc->strmout[tp1->rec.data.sid].chunks_on_queues == 0) &&
4770 (asoc->strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) &&
4771 TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.sid].outqueue)) {
4772 asoc->trigger_reset = 1;
4774 TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
4776 if (asoc->pr_sctp_cnt != 0)
4777 asoc->pr_sctp_cnt--;
4779 asoc->sent_queue_cnt--;
4782 sctp_free_bufspace(stcb, asoc, tp1, 1);
4785 if (asoc->prsctp_supported && PR_SCTP_BUF_ENABLED(tp1->flags)) {
4786 asoc->sent_queue_cnt_removeable--;
4790 sctp_log_sack(asoc->last_acked_seq,
4800 if (TAILQ_EMPTY(&asoc->sent_queue) && (asoc->total_flight > 0)) {
4805 asoc->total_flight);
4807 asoc->total_flight = 0;
4823 if (asoc->fast_retran_loss_recovery && accum_moved) {
4824 if (SCTP_TSN_GE(asoc->last_acked_seq, asoc->fast_recovery_tsn)) {
4840 sctp_check_for_revoked(stcb, asoc, cum_ack, biggest_tsn_acked);
4841 asoc->saw_sack_with_frags = 1;
4842 } else if (asoc->saw_sack_with_frags) {
4846 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4872 asoc->saw_sack_with_frags = 0;
4875 asoc->saw_sack_with_nr_frags = 1;
4877 asoc->saw_sack_with_nr_frags = 0;
4881 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4895 if (net == stcb->asoc.primary_destination) {
4896 if (stcb->asoc.alternate) {
4901 sctp_free_remote_addr(stcb->asoc.alternate);
4902 stcb->asoc.alternate = NULL;
4912 asoc->cc_functions.sctp_cwnd_update_exit_pf(stcb, net);
4918 if (net->RTO < stcb->asoc.minrto) {
4919 net->RTO = stcb->asoc.minrto;
4921 if (net->RTO > stcb->asoc.maxrto) {
4922 net->RTO = stcb->asoc.maxrto;
4926 asoc->cc_functions.sctp_cwnd_update_after_sack(stcb, asoc, accum_moved, reneged_all, will_exit_fast_recovery);
4929 if (TAILQ_EMPTY(&asoc->sent_queue)) {
4931 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4939 asoc->total_flight = 0;
4940 asoc->total_flight_count = 0;
4946 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue)) {
4950 asoc->peers_rwnd, 0, 0, a_rwnd);
4952 asoc->peers_rwnd = a_rwnd;
4953 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4955 asoc->peers_rwnd = 0;
4958 if ((asoc->stream_queue_cnt == 1) &&
4959 ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
4961 ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc))) {
4964 if (((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
4966 (asoc->stream_queue_cnt == 1) &&
4967 (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) {
4977 if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) &&
4978 (asoc->stream_queue_cnt == 0)) {
4987 if (asoc->alternate) {
4988 netp = asoc->alternate;
4990 netp = asoc->primary_destination;
4999 (asoc->stream_queue_cnt == 0)) {
5005 if (asoc->alternate) {
5006 netp = asoc->alternate;
5008 netp = asoc->primary_destination;
5020 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5029 if ((asoc->sctp_cmt_on_off > 0) &&
5035 sctp_strike_gap_ack_chunks(stcb, asoc, biggest_tsn_acked,
5039 asoc->cc_functions.sctp_cwnd_update_after_fr(stcb, asoc);
5044 asoc->fast_retran_loss_recovery = 0;
5046 if ((asoc->sat_t3_loss_recovery) &&
5047 SCTP_TSN_GE(asoc->last_acked_seq, asoc->sat_t3_recovery_tsn)) {
5049 asoc->sat_t3_loss_recovery = 0;
5054 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5064 asoc->peers_rwnd, asoc->total_flight, (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)), a_rwnd);
5066 asoc->peers_rwnd = sctp_sbspace_sub(a_rwnd,
5067 (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
5068 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
5070 asoc->peers_rwnd = 0;
5072 if (asoc->peers_rwnd > old_rwnd) {
5083 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5092 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
5094 sctp_window_probe_recovery(stcb, asoc, tp1);
5126 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
5127 (asoc->sent_queue_retran_cnt == 0) &&
5134 if (sctp_fs_audit(asoc)) {
5135 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5138 asoc->total_flight = 0;
5139 asoc->total_flight_count = 0;
5140 asoc->sent_queue_retran_cnt = 0;
5141 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
5146 sctp_ucount_incr(asoc->sent_queue_retran_cnt);
5158 if (SCTP_TSN_GT(cum_ack, asoc->advanced_peer_ack_point)) {
5159 asoc->advanced_peer_ack_point = cum_ack;
5162 if ((asoc->prsctp_supported) && (asoc->pr_sctp_cnt > 0)) {
5166 old_adv_peer_ack_point = asoc->advanced_peer_ack_point;
5167 lchk = sctp_try_advance_peer_ack_point(stcb, asoc);
5169 if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, cum_ack)) {
5175 0xee, cum_ack, asoc->advanced_peer_ack_point,
5178 if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, old_adv_peer_ack_point)) {
5179 send_forward_tsn(stcb, asoc);
5183 send_forward_tsn(stcb, asoc);
5201 stcb->asoc.peers_rwnd,
5202 stcb->asoc.total_flight,
5203 stcb->asoc.total_output_queue_size);
5215 a_rwnd = stcb->asoc.peers_rwnd + stcb->asoc.total_flight;
5226 struct sctp_association *asoc;
5234 asoc = &stcb->asoc;
5241 if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) {
5258 if (asoc->size_on_all_streams >= control->length) {
5259 asoc->size_on_all_streams -= control->length;
5262 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
5264 asoc->size_on_all_streams = 0;
5267 sctp_ucount_decr(asoc->cnt_on_all_streams);
5270 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
5295 ret = sctp_deliver_reasm_check(stcb, &stcb->asoc, strmin, SCTP_READ_LOCK_HELD);
5296 if (SCTP_MID_GT(asoc->idata_supported, mid, strmin->last_mid_delivered)) {
5312 if (SCTP_MID_EQ(asoc->idata_supported, mid, control->mid)) {
5329 if (asoc->size_on_all_streams >= control->length) {
5330 asoc->size_on_all_streams -= control->length;
5333 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
5335 asoc->size_on_all_streams = 0;
5338 sctp_ucount_decr(asoc->cnt_on_all_streams);
5342 sctp_mark_non_revokable(asoc, control->sinfo_tsn);
5365 (void)sctp_deliver_reasm_check(stcb, &stcb->asoc, strmin, SCTP_READ_LOCK_HELD);
5371 struct sctp_association *asoc, struct sctp_stream_in *strm,
5389 if (!asoc->idata_supported && !ordered &&
5396 if (!asoc->idata_supported && !ordered) {
5402 if (asoc->size_on_reasm_queue >= chk->send_size) {
5403 asoc->size_on_reasm_queue -= chk->send_size;
5406 panic("size_on_reasm_queue = %u smaller than chunk length %u", asoc->size_on_reasm_queue, chk->send_size);
5408 asoc->size_on_reasm_queue = 0;
5411 sctp_ucount_decr(asoc->cnt_on_reasm_queue);
5419 KASSERT(!asoc->idata_supported,
5441 sctp_add_chk_to_control(control, strm, stcb, asoc,
5444 sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_HELD);
5449 if (asoc->size_on_all_streams >= control->length) {
5450 asoc->size_on_all_streams -= control->length;
5453 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
5455 asoc->size_on_all_streams = 0;
5458 sctp_ucount_decr(asoc->cnt_on_all_streams);
5497 struct sctp_association *asoc;
5503 asoc = &stcb->asoc;
5509 m_size = (stcb->asoc.mapping_array_size << 3);
5515 if (SCTP_TSN_GE(asoc->cumulative_tsn, new_cum_tsn)) {
5523 SCTP_CALC_TSN_TO_GAP(gap, new_cum_tsn, asoc->mapping_array_base_tsn);
5524 asoc->cumulative_tsn = new_cum_tsn;
5526 if ((long)gap > sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv)) {
5537 new_cum_tsn, asoc->highest_tsn_inside_map);
5545 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
5546 asoc->mapping_array_base_tsn = new_cum_tsn + 1;
5547 asoc->highest_tsn_inside_map = new_cum_tsn;
5549 memset(stcb->asoc.nr_mapping_array, 0, stcb->asoc.mapping_array_size);
5550 asoc->highest_tsn_inside_nr_map = new_cum_tsn;
5553 sctp_log_map(0, 3, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
5558 if (!SCTP_IS_TSN_PRESENT(asoc->mapping_array, i) &&
5559 !SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, i)) {
5560 SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, i);
5561 if (SCTP_TSN_GT(asoc->mapping_array_base_tsn + i, asoc->highest_tsn_inside_nr_map)) {
5562 asoc->highest_tsn_inside_nr_map = asoc->mapping_array_base_tsn + i;
5572 if (asoc->idata_supported == 0) {
5577 for (sid = 0; sid < asoc->streamincnt; sid++) {
5578 strm = &asoc->strmin[sid];
5580 sctp_flush_reassm_for_str_seq(stcb, asoc, strm, TAILQ_FIRST(&strm->uno_inqueue), 0, new_cum_tsn);
5602 if (asoc->idata_supported) {
5608 if (asoc->idata_supported) {
5645 if (sid >= asoc->streamincnt) {
5649 if ((asoc->str_of_pdapi == sid) &&
5650 (asoc->ssn_of_pdapi == mid)) {
5657 asoc->fragmented_delivery_inprogress = 0;
5659 strm = &asoc->strmin[sid];
5662 if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) {
5663 sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn);
5667 if (asoc->idata_supported) {
5669 if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) {
5670 sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn);
5675 sctp_flush_reassm_for_str_seq(stcb, asoc, strm, TAILQ_FIRST(&strm->uno_inqueue), ordered, new_cum_tsn);
5681 (SCTP_MID_EQ(asoc->idata_supported, control->mid, mid))) {
5686 if (asoc->size_on_all_streams >= control->length) {
5687 asoc->size_on_all_streams -= control->length;
5690 panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length);
5692 asoc->size_on_all_streams = 0;
5695 sctp_ucount_decr(asoc->cnt_on_all_streams);
5712 SCTP_MID_GT(asoc->idata_supported, control->mid, mid)) {
5717 if (SCTP_MID_GT(asoc->idata_supported, mid, strm->last_mid_delivered)) {