Lines Matching defs:asoc

107 sctp_set_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
121 asoc->size_on_delivery_queue,
122 asoc->size_on_reasm_queue,
123 asoc->size_on_all_streams);
127 asoc->size_on_delivery_queue == 0 &&
128 asoc->size_on_reasm_queue == 0 &&
129 asoc->size_on_all_streams == 0) {
131 asoc->my_rwnd = uimax(stcb->sctp_socket->so_rcv.sb_hiwat,
141 calc = sctp_sbspace_sub(calc, (u_int32_t)asoc->size_on_delivery_queue);
142 calc = sctp_sbspace_sub(calc, (u_int32_t)asoc->size_on_reasm_queue);
143 calc = sctp_sbspace_sub(calc, (u_int32_t)asoc->size_on_all_streams);
146 calc_w_oh = sctp_sbspace_sub(calc, stcb->asoc.my_rwnd_control_len);
148 asoc->my_rwnd = calc;
155 asoc->my_rwnd = 1;
158 if (asoc->my_rwnd &&
159 (asoc->my_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_receiver)) {
161 asoc->my_rwnd = 1;
214 outinfo->sinfo_cumtsn = stcb->asoc.cumulative_tsn;
221 stcb->asoc.my_rwnd_control_len +=
265 outinfo->sinfo_cumtsn = stcb->asoc.cumulative_tsn;
267 stcb->asoc.my_rwnd_control_len +=
274 sctp_deliver_data(struct sctp_tcb *stcb, struct sctp_association *asoc,
313 TAILQ_FOREACH(chk, &asoc->delivery_queue, sctp_next) {
314 asoc->size_on_delivery_queue -= chk->send_size;
315 asoc->cnt_on_delivery_queue--;
336 TAILQ_INSERT_TAIL(&asoc->delivery_queue, chk, sctp_next);
337 asoc->size_on_delivery_queue += chk->send_size;
338 asoc->cnt_on_delivery_queue++;
340 if (asoc->fragmented_delivery_inprogress) {
356 chk = TAILQ_FIRST(&asoc->delivery_queue);
364 asoc->size_on_delivery_queue = 0;
365 asoc->cnt_on_delivery_queue = 0;
441 stcb->asoc.my_rwnd_control_len -=
447 to, chk->data, control, stcb->asoc.my_vtag,
452 stcb->asoc.my_rwnd_control_len -=
458 stcb->asoc.my_rwnd_control_len +=
462 stcb->asoc.my_rwnd_control_len += sizeof(struct mbuf);
487 TAILQ_REMOVE(&asoc->delivery_queue, chk, sctp_next);
488 asoc->size_on_delivery_queue -= chk->send_size;
489 asoc->cnt_on_delivery_queue--;
512 sctp_service_reassembly(struct sctp_tcb *stcb, struct sctp_association *asoc, int hold_locks)
533 asoc->fragmented_delivery_inprogress = 0;
534 TAILQ_FOREACH(chk, &asoc->reasmqueue, sctp_next) {
535 asoc->size_on_delivery_queue -= chk->send_size;
536 asoc->cnt_on_delivery_queue--;
568 chk = TAILQ_FIRST(&asoc->reasmqueue);
579 if (chk->rec.data.TSN_seq != (asoc->tsn_last_delivered + 1)) {
591 nxt_todel = asoc->strmin[stream_no].last_sequence_delivered + 1;
663 stcb->asoc.my_rwnd_control_len -=
674 to, chk->data, control, stcb->asoc.my_vtag,
679 stcb->asoc.my_rwnd_control_len -=
691 stcb->asoc.my_rwnd_control_len +=
695 stcb->asoc.my_rwnd_control_len += sizeof(struct mbuf);
714 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
716 asoc->fragmented_delivery_inprogress = 0;
718 asoc->strmin[stream_no].last_sequence_delivered++;
721 asoc->tsn_last_delivered = chk->rec.data.TSN_seq;
722 asoc->size_on_reasm_queue -= chk->send_size;
723 asoc->cnt_on_reasm_queue--;
733 if (asoc->fragmented_delivery_inprogress == 0) {
741 strm = &asoc->strmin[stream_no];
752 asoc->size_on_all_streams -=
754 asoc->cnt_on_all_streams--;
764 sctp_deliver_data(stcb, asoc, chk, 1);
773 if (!TAILQ_EMPTY(&asoc->delivery_queue)) {
775 if (sctp_deliver_data(stcb, asoc, NULL, 1) == 0)
784 chk = TAILQ_FIRST(&asoc->reasmqueue);
801 sctp_queue_data_to_stream(struct sctp_tcb *stcb, struct sctp_association *asoc,
816 asoc->size_on_all_streams += chk->send_size;
817 asoc->cnt_on_all_streams++;
818 strm = &asoc->strmin[chk->rec.data.stream_number];
877 asoc->size_on_all_streams -= chk->send_size;
878 asoc->cnt_on_all_streams--;
880 sctp_deliver_data(stcb, asoc, chk, 0);
888 asoc->size_on_all_streams -= chk->send_size;
889 asoc->cnt_on_all_streams--;
901 sctp_deliver_data(stcb, asoc, chk, 0);
956 asoc->size_on_all_streams -= chk->send_size;
957 asoc->cnt_on_all_streams--;
1003 sctp_is_all_msg_on_reasm(struct sctp_association *asoc, int *t_size)
1009 chk = TAILQ_FIRST(&asoc->reasmqueue);
1040 sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
1050 cum_ackp1 = asoc->tsn_last_delivered + 1;
1052 if (TAILQ_EMPTY(&asoc->reasmqueue)) {
1054 TAILQ_INSERT_HEAD(&asoc->reasmqueue, chk, sctp_next);
1059 asoc->size_on_reasm_queue = chk->send_size;
1060 asoc->cnt_on_reasm_queue++;
1062 if (asoc->fragmented_delivery_inprogress == 0 &&
1093 } else if (asoc->fragmented_delivery_inprogress &&
1123 } else if (asoc->fragmented_delivery_inprogress) {
1126 asoc->str_of_pdapi) {
1132 asoc->str_of_pdapi);
1154 } else if ((asoc->fragment_flags & SCTP_DATA_UNORDERED) !=
1157 asoc->ssn_of_pdapi) {
1163 asoc->ssn_of_pdapi);
1191 at = TAILQ_FIRST(&asoc->reasmqueue);
1194 TAILQ_FOREACH(at, &asoc->reasmqueue, sctp_next) {
1202 asoc->size_on_reasm_queue += chk->send_size;
1203 asoc->cnt_on_reasm_queue++;
1233 asoc->size_on_reasm_queue += chk->send_size;
1234 asoc->cnt_on_reasm_queue++;
1235 TAILQ_INSERT_AFTER(&asoc->reasmqueue, at, chk, sctp_next);
1560 chk = TAILQ_FIRST(&asoc->reasmqueue);
1563 asoc->size_on_reasm_queue = 0;
1564 asoc->cnt_on_reasm_queue = 0;
1567 if (asoc->fragmented_delivery_inprogress == 0) {
1569 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered + 1;
1577 if (TAILQ_EMPTY(&asoc->delivery_queue) &&
1578 (sctp_is_all_msg_on_reasm(asoc, &tsize) ||
1579 (asoc->size_on_reasm_queue >=
1587 asoc->fragmented_delivery_inprogress = 1;
1588 asoc->tsn_last_delivered =
1590 asoc->str_of_pdapi =
1592 asoc->ssn_of_pdapi = chk->rec.data.stream_seq;
1593 asoc->fragment_flags = chk->rec.data.rcv_flags;
1594 sctp_service_reassembly(stcb, asoc, 0);
1598 sctp_service_reassembly(stcb, asoc, 0);
1609 sctp_does_chk_belong_to_reasm(struct sctp_association *asoc,
1615 TAILQ_FOREACH(at, &asoc->reasmqueue, sctp_next) {
1664 sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
1681 sctp_log_map(0, tsn, asoc->cumulative_tsn, SCTP_MAP_PREPARE_SLIDE);
1683 if (compare_with_wrap(asoc->cumulative_tsn, tsn, MAX_TSN) ||
1684 asoc->cumulative_tsn == tsn) {
1687 if (asoc->numduptsns < SCTP_MAX_DUP_TSNS) {
1689 asoc->dup_tsns[asoc->numduptsns] = tsn;
1690 asoc->numduptsns++;
1695 if (tsn >= asoc->mapping_array_base_tsn) {
1696 gap = tsn - asoc->mapping_array_base_tsn;
1698 gap = (MAX_TSN - asoc->mapping_array_base_tsn) + tsn + 1;
1704 if (gap >= (uint32_t)(asoc->mapping_array_size << 3)) {
1705 if (sctp_expand_mapping_array(asoc)) {
1714 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) {
1716 if (asoc->numduptsns < SCTP_MAX_DUP_TSNS) {
1718 asoc->dup_tsns[asoc->numduptsns] = tsn;
1719 asoc->numduptsns++;
1721 if (!callout_pending(&asoc->dack_timer.timer)) {
1754 if (((asoc->cnt_on_all_streams +
1755 asoc->cnt_on_delivery_queue +
1756 asoc->cnt_on_reasm_queue +
1757 asoc->cnt_msg_on_sb) > sctp_max_chunks_on_queue) ||
1758 (((int)asoc->my_rwnd) <= 0)) {
1769 asoc->highest_tsn_inside_map, MAX_TSN)) {
1775 (u_long)tsn, (u_long)asoc->my_rwnd,
1777 stcb->asoc.cnt_on_delivery_queue);
1780 sctp_set_rwnd(stcb, asoc);
1781 if ((asoc->cnt_on_all_streams +
1782 asoc->cnt_on_delivery_queue +
1783 asoc->cnt_on_reasm_queue +
1784 asoc->cnt_msg_on_sb) > sctp_max_chunks_on_queue) {
1794 if (strmno >= asoc->streamincnt) {
1835 (compare_with_wrap(asoc->strmin[strmno].last_sequence_delivered,
1837 asoc->strmin[strmno].last_sequence_delivered == strmseq)) {
1843 asoc->strmin[strmno].last_sequence_delivered);
1891 asoc->fragmented_delivery_inprogress == 0 &&
1892 TAILQ_EMPTY(&asoc->delivery_queue) &&
1894 ((asoc->strmin[strmno].last_sequence_delivered + 1) == strmseq &&
1895 TAILQ_EMPTY(&asoc->strmin[strmno].inqueue))) &&
1928 stcb->asoc.my_rwnd_control_len -=
1967 if (compare_with_wrap(tsn, asoc->highest_tsn_inside_map, MAX_TSN)) {
1969 asoc->highest_tsn_inside_map = tsn;
1971 sctp_log_map(0, 1, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
1978 control, stcb->asoc.my_vtag, stcb->sctp_ep)) {
1981 stcb->asoc.my_rwnd_control_len -=
1989 stcb->asoc.my_rwnd_control_len += sizeof(struct mbuf);
1992 stcb->asoc.my_rwnd_control_len += sizeof(struct mbuf);
1999 asoc->strmin[strmno].last_sequence_delivered++;
2035 chk->asoc = asoc;
2047 if (asoc->fragmented_delivery_inprogress) {
2055 estimate_tsn = asoc->tsn_last_delivered + 1;
2056 if (TAILQ_EMPTY(&asoc->reasmqueue) &&
2081 if (sctp_does_chk_belong_to_reasm(asoc, chk)) {
2108 if (!TAILQ_EMPTY(&asoc->reasmqueue)) {
2115 if (sctp_does_chk_belong_to_reasm(asoc, chk)) {
2144 sctp_deliver_data(stcb, asoc, chk, 0);
2160 if ((asoc->pending_reply) &&
2161 ((compare_with_wrap(tsn, ntohl(asoc->pending_reply->reset_at_tsn), MAX_TSN)) ||
2162 (tsn == ntohl(asoc->pending_reply->reset_at_tsn)))
2167 TAILQ_INSERT_TAIL(&asoc->pending_reply_queue , chk, sctp_next);
2169 sctp_queue_data_to_stream(stcb, asoc, chk, abort_flag);
2174 sctp_queue_data_for_reasm(stcb, asoc, chk, abort_flag);
2180 if (compare_with_wrap(tsn, asoc->highest_tsn_inside_map, MAX_TSN)) {
2182 asoc->highest_tsn_inside_map = tsn;
2184 sctp_log_map(0, 2, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
2197 sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn,
2198 asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE);
2200 SCTP_SET_TSN_PRESENT(asoc->mapping_array, gap);
2211 struct sctp_association *asoc;
2220 asoc = &stcb->asoc;
2224 old_cumack = asoc->cumulative_tsn;
2225 old_base = asoc->mapping_array_base_tsn;
2226 old_highest = asoc->highest_tsn_inside_map;
2227 if (asoc->mapping_array_size < 64)
2228 memcpy(aux_array, asoc->mapping_array,
2229 asoc->mapping_array_size);
2231 memcpy(aux_array, asoc->mapping_array, 64);
2239 m_size = stcb->asoc.mapping_array_size << 3;
2241 if (!SCTP_IS_TSN_PRESENT(asoc->mapping_array, i)) {
2248 asoc->cumulative_tsn = asoc->mapping_array_base_tsn +
2253 if (compare_with_wrap(asoc->cumulative_tsn,
2254 asoc->highest_tsn_inside_map,
2259 (asoc->cumulative_tsn == asoc->highest_tsn_inside_map && at >= 8)) {
2263 asoc->cumulative_tsn = asoc->highest_tsn_inside_map;
2266 clr = asoc->mapping_array_size;
2273 if (clr > asoc->mapping_array_size)
2274 clr = asoc->mapping_array_size;
2276 memset(asoc->mapping_array, 0, clr);
2278 asoc->mapping_array_base_tsn = asoc->cumulative_tsn + 1;
2282 sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn,
2283 asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_CLEARED);
2290 if (asoc->highest_tsn_inside_map >= asoc->mapping_array_base_tsn) {
2291 lgap = asoc->highest_tsn_inside_map -
2292 asoc->mapping_array_base_tsn;
2294 lgap = (MAX_TSN - asoc->mapping_array_base_tsn) +
2295 asoc->highest_tsn_inside_map + 1;
2308 if (distance + slide_from > asoc->mapping_array_size ||
2324 (uint32_t)asoc->mapping_array_size,
2330 asoc->mapping_array[ii] =
2331 asoc->mapping_array[slide_from + ii];
2334 asoc->mapping_array[ii] = 0;
2336 asoc->mapping_array_base_tsn += (slide_from << 3);
2338 sctp_log_map(asoc->mapping_array_base_tsn,
2339 asoc->cumulative_tsn, asoc->highest_tsn_inside_map,
2346 if ((asoc->pending_reply) &&
2347 ((compare_with_wrap((asoc->cumulative_tsn+1), ntohl(asoc->pending_reply->reset_at_tsn), MAX_TSN)) ||
2348 ((asoc->cumulative_tsn+1) == ntohl(asoc->pending_reply->reset_at_tsn)))
2357 sctp_handle_stream_reset_response(stcb, asoc->pending_reply);
2358 free(asoc->pending_reply, M_PCB);
2359 asoc->pending_reply = NULL;
2360 chk = TAILQ_FIRST(&asoc->pending_reply_queue);
2362 TAILQ_REMOVE(&asoc->pending_reply_queue, chk, sctp_next);
2363 sctp_queue_data_to_stream(stcb, asoc, chk, abort_flag);
2367 chk = TAILQ_FIRST(&asoc->pending_reply_queue);
2375 if (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) {
2381 if (callout_pending(&stcb->asoc.dack_timer.timer)) {
2393 sctp_send_shutdown(stcb, stcb->asoc.primary_destination);
2398 is_a_gap = compare_with_wrap(stcb->asoc.highest_tsn_inside_map,
2399 stcb->asoc.cumulative_tsn, MAX_TSN);
2400 if ((stcb->asoc.first_ack_sent == 0) || /* First time we send a sack */
2402 (stcb->asoc.numduptsns) || /* we have dup's */
2404 (callout_pending(&stcb->asoc.dack_timer.timer)) /* timer was up . second packet */
2411 stcb->asoc.first_ack_sent = 1;
2423 sctp_service_queues(struct sctp_tcb *stcb, struct sctp_association *asoc, int hold_locks)
2430 if (asoc->fragmented_delivery_inprogress) {
2431 sctp_service_reassembly(stcb, asoc, hold_locks);
2434 if (asoc->fragmented_delivery_inprogress) {
2450 if (sctp_deliver_data(stcb, asoc, (struct sctp_tmit_chunk *)NULL, hold_locks) == 0)
2453 chk = TAILQ_FIRST(&asoc->delivery_queue);
2462 chk = TAILQ_FIRST(&asoc->reasmqueue);
2464 asoc->size_on_reasm_queue = 0;
2465 asoc->cnt_on_reasm_queue = 0;
2468 nxt_todel = asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered + 1;
2484 if (TAILQ_EMPTY(&asoc->delivery_queue) &&
2485 (sctp_is_all_msg_on_reasm(asoc, &tsize) ||
2486 (asoc->size_on_reasm_queue >=
2488 asoc->fragmented_delivery_inprogress = 1;
2489 asoc->tsn_last_delivered = chk->rec.data.TSN_seq-1;
2490 asoc->str_of_pdapi = chk->rec.data.stream_number;
2491 asoc->ssn_of_pdapi = chk->rec.data.stream_seq;
2492 asoc->fragment_flags = chk->rec.data.rcv_flags;
2493 sctp_service_reassembly(stcb, asoc, hold_locks);
2504 struct sctp_association *asoc;
2511 sctp_set_rwnd(stcb, &stcb->asoc);
2514 asoc = &stcb->asoc;
2515 if (compare_with_wrap(stcb->asoc.highest_tsn_inside_map,
2516 stcb->asoc.cumulative_tsn, MAX_TSN)) {
2526 asoc->last_data_chunk_from = net;
2583 *high_tsn = asoc->cumulative_tsn;
2628 if (sctp_process_a_data_chunk(stcb, asoc, mm, *offset, ch,
2675 stcb->asoc.overall_error_count = 0;
2676 SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_last_rcvd);
2679 sctp_service_queues(stcb, asoc, 0);
2680 if (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) {
2698 sctp_handle_segments(struct sctp_tcb *stcb, struct sctp_association *asoc,
2716 if (asoc->primary_destination->dest_state & SCTP_ADDR_SWITCH_PRIMARY) {
2742 tp1 = TAILQ_FIRST(&asoc->sent_queue);
2766 tp1 = TAILQ_FIRST(&asoc->sent_queue);
2811 asoc,
2822 asoc->this_sack_highest_gap,
2824 asoc->this_sack_highest_gap =
2837 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
2840 (asoc->sent_queue_retran_cnt & 0x000000ff));
2866 sctp_check_for_revoked(struct sctp_association *asoc, u_long cum_ack,
2872 tp1 = TAILQ_FIRST(&asoc->sent_queue);
2913 tp1 = TAILQ_FIRST(&asoc->send_queue);
2915 asoc->nonce_resync_tsn = asoc->sending_seq;
2917 asoc->nonce_resync_tsn = tp1->rec.data.TSN_seq;
2919 asoc->nonce_wait_for_ecne = 0;
2920 asoc->nonce_sum_check = 0;
2928 sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
2945 tp1 = TAILQ_FIRST(&stcb->asoc.send_queue);
2947 sending_seq = asoc->sending_seq;
2952 if (asoc->primary_destination->dest_state & SCTP_ADDR_SWITCH_PRIMARY) {
2955 if (asoc->primary_destination->dest_state & SCTP_ADDR_DOUBLE_SWITCH) {
2958 if (stcb->asoc.peer_supports_prsctp ) {
2961 tp1 = TAILQ_FIRST(&asoc->sent_queue);
2984 &asoc->sent_queue);
2992 asoc->this_sack_highest_gap, MAX_TSN)) {
3003 if (tp1->whoTo != asoc->primary_destination) {
3022 (compare_with_wrap(asoc->primary_destination->next_tsn_at_change,
3037 if (accum_moved && asoc->fast_retran_loss_recovery) {
3054 * must only do this for singly homed asoc's. However
3058 if (asoc->numnets < 2)
3107 asoc->sent_queue_retran_cnt++;
3122 if (TAILQ_EMPTY(&asoc->send_queue)) {
3140 ttt = TAILQ_FIRST(&asoc->send_queue);
3158 asoc->peers_rwnd , tp1->send_size, sctp_peer_chunk_oh);
3161 asoc->peers_rwnd += (tp1->send_size + sctp_peer_chunk_oh);
3181 asoc->nonce_resync_tsn = sending_seq;
3182 asoc->nonce_wait_for_ecne = 0;
3183 asoc->nonce_sum_check = 0;
3190 struct sctp_association *asoc)
3196 if (asoc->peer_supports_prsctp == 0) {
3199 tp1 = TAILQ_FIRST(&asoc->sent_queue);
3209 * aka retransmitted until the asoc fails.
3241 &asoc->sent_queue);
3258 asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq;
3266 sctp_free_bufspace(stcb, asoc, tp1);
3270 (u_long)asoc->total_output_queue_size,
3271 (u_long)asoc->total_output_mbuf_queue_size);
3469 struct sctp_association *asoc;
3484 asoc = &stcb->asoc;
3494 asoc->overall_error_count = 0;
3496 if (asoc->sent_queue_retran_cnt) {
3499 printf("Handling SACK for asoc:%p retran:%d\n",
3500 asoc, asoc->sent_queue_retran_cnt);
3505 sctp_service_queues(stcb, asoc, 0);
3546 if (TAILQ_EMPTY(&asoc->send_queue)) {
3547 send_s = asoc->sending_seq;
3549 tp1 = TAILQ_FIRST(&asoc->send_queue);
3583 if (asoc->sent_queue_retran_cnt) {
3587 cum_ack, (u_int)num_seg, asoc->last_acked_seq);
3591 if (compare_with_wrap(asoc->t3timeout_highest_marked, cum_ack, MAX_TSN)) {
3598 if (compare_with_wrap(asoc->last_acked_seq, last_tsn, MAX_TSN)) {
3600 if (asoc->sent_queue_retran_cnt) {
3610 if (TAILQ_EMPTY(&asoc->sent_queue)) {
3614 asoc->peers_rwnd, 0, 0, a_rwnd);
3616 asoc->peers_rwnd = a_rwnd;
3617 if (asoc->sent_queue_retran_cnt) {
3623 asoc->sent_queue_retran_cnt = 0;
3625 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
3627 asoc->peers_rwnd = 0;
3630 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3636 asoc->total_flight = 0;
3637 asoc->total_flight_count = 0;
3647 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3653 tp1 = TAILQ_FIRST(&asoc->sent_queue);
3660 asoc->nonce_sum_expect_base += tp1->rec.data.ect_nonce;
3692 asoc, tp1->whoTo,
3705 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
3708 (asoc->sent_queue_retran_cnt & 0x000000ff));
3723 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3730 asoc->this_sack_highest_gap = last_tsn;
3739 if (asoc->primary_destination->dest_state &
3742 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3750 sctp_handle_segments(stcb, asoc, ch, last_tsn,
3768 if (asoc->primary_destination->dest_state &
3771 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3789 asoc->last_acked_seq = cum_ack;
3790 if (asoc->primary_destination->dest_state & SCTP_ADDR_SWITCH_PRIMARY) {
3791 if ((cum_ack == asoc->primary_destination->next_tsn_at_change) ||
3793 asoc->primary_destination->next_tsn_at_change, MAX_TSN))) {
3796 TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) {
3797 asoc->primary_destination->dest_state &=
3804 asoc->t3timeout_highest_marked = cum_ack;
3806 tp1 = TAILQ_FIRST(&asoc->sent_queue);
3817 TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
3819 sctp_free_bufspace(stcb, asoc, tp1);
3823 (u_long)asoc->total_output_queue_size,
3824 (u_long)asoc->total_output_mbuf_queue_size);
3830 asoc->sent_queue_cnt_removeable--;
3835 asoc->sent_queue_cnt--;
3838 asoc->chunks_on_out_queue--;
3850 if (asoc->fast_retran_loss_recovery && accum_moved) {
3851 if (compare_with_wrap(asoc->last_acked_seq,
3852 asoc->fast_recovery_tsn, MAX_TSN) ||
3853 asoc->last_acked_seq == asoc->fast_recovery_tsn) {
3864 if (asoc->saw_sack_with_frags)
3865 sctp_check_for_revoked(asoc, cum_ack, biggest_tsn_acked);
3868 asoc->saw_sack_with_frags = 1;
3870 asoc->saw_sack_with_frags = 0;
3875 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3900 if (asoc->fast_retran_loss_recovery &&
3945 asoc->total_output_queue_size;
3947 asoc->sent_queue_cnt;
3949 asoc->send_queue_cnt;
3999 asoc->total_output_queue_size;
4001 asoc->sent_queue_cnt;
4003 asoc->send_queue_cnt;
4023 if (net->RTO < stcb->asoc.minrto) {
4024 net->RTO = stcb->asoc.minrto;
4026 if (net->RTO > stcb->asoc.maxrto) {
4027 net->RTO = stcb->asoc.maxrto;
4038 if (!TAILQ_EMPTY(&asoc->out_wheel)) {
4041 TAILQ_FOREACH(outs, &asoc->out_wheel, next_spoke) {
4048 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue) &&
4054 asoc->peers_rwnd, 0, 0, a_rwnd);
4056 asoc->peers_rwnd = a_rwnd;
4057 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4059 asoc->peers_rwnd = 0;
4062 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4068 asoc->total_flight = 0;
4069 asoc->total_flight_count = 0;
4071 if (asoc->state & SCTP_STATE_SHUTDOWN_PENDING) {
4072 asoc->state = SCTP_STATE_SHUTDOWN_SENT;
4082 stcb->asoc.primary_destination);
4084 stcb->sctp_ep, stcb, asoc->primary_destination);
4086 stcb->sctp_ep, stcb, asoc->primary_destination);
4087 } else if (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) {
4088 asoc->state = SCTP_STATE_SHUTDOWN_ACK_SENT;
4091 stcb->asoc.primary_destination);
4094 stcb->sctp_ep, stcb, asoc->primary_destination);
4102 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4106 sctp_strike_gap_ack_chunks(stcb, asoc, biggest_tsn_acked,
4115 if (compare_with_wrap(cum_ack, asoc->advanced_peer_ack_point, MAX_TSN)) {
4116 asoc->advanced_peer_ack_point = cum_ack;
4119 if (asoc->peer_supports_prsctp) {
4121 lchk = sctp_try_advance_peer_ack_point(stcb, asoc);
4123 if (compare_with_wrap(asoc->advanced_peer_ack_point, cum_ack,
4130 send_forward_tsn(stcb, asoc);
4133 asoc->nonce_sum_check = 0;
4134 asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
4142 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4143 if (asoc->fast_retran_loss_recovery == 0) {
4171 lchk = TAILQ_FIRST(&asoc->send_queue);
4175 asoc->fast_retran_loss_recovery = 1;
4178 asoc->fast_recovery_tsn = asoc->sending_seq - 1;
4180 asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
4185 asoc->nonce_sum_check = 0;
4186 asoc->nonce_resync_tsn = asoc->fast_recovery_tsn + 1;
4210 if (asoc->ecn_nonce_allowed) {
4211 if (asoc->nonce_sum_check) {
4212 if (nonce_sum_flag != ((asoc->nonce_sum_expect_base + ecn_seg_sums) & SCTP_SACK_NONCE_SUM)) {
4213 if (asoc->nonce_wait_for_ecne == 0) {
4215 lchk = TAILQ_FIRST(&asoc->send_queue);
4216 asoc->nonce_wait_for_ecne = 1;
4218 asoc->nonce_wait_tsn = lchk->rec.data.TSN_seq;
4220 asoc->nonce_wait_tsn = asoc->sending_seq;
4223 if (compare_with_wrap(asoc->last_acked_seq, asoc->nonce_wait_tsn, MAX_TSN) ||
4224 (asoc->last_acked_seq == asoc->nonce_wait_tsn)) {
4227 asoc->ecn_allowed = 0;
4228 asoc->ecn_nonce_allowed = 0;
4234 if (compare_with_wrap(asoc->last_acked_seq, asoc->nonce_resync_tsn, MAX_TSN)) {
4235 asoc->nonce_sum_check = 1;
4242 * table to back-calculate the new value of asoc->nonce_sum_expect_base:
4250 asoc->nonce_sum_expect_base = (ecn_seg_sums ^ nonce_sum_flag) & SCTP_SACK_NONCE_SUM;
4257 asoc->fast_retran_loss_recovery = 0;
4259 if ((asoc->sat_t3_loss_recovery) &&
4260 ((compare_with_wrap(asoc->last_acked_seq, asoc->sat_t3_recovery_tsn,
4262 (asoc->last_acked_seq == asoc->sat_t3_recovery_tsn)))) {
4264 asoc->sat_t3_loss_recovery = 0;
4269 asoc->peers_rwnd, asoc->total_flight, (asoc->sent_queue_cnt * sctp_peer_chunk_oh), a_rwnd);
4272 asoc->peers_rwnd = sctp_sbspace_sub(a_rwnd,
4273 (u_int32_t)(asoc->total_flight + (asoc->sent_queue_cnt * sctp_peer_chunk_oh)));
4274 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4276 asoc->peers_rwnd = 0;
4282 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4284 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
4315 htonl(stcb->asoc.peers_rwnd + stcb->asoc.total_flight);
4333 struct sctp_association *asoc;
4336 asoc = &stcb->asoc;
4350 asoc->size_on_all_streams -= chk->send_size;
4351 asoc->cnt_on_all_streams--;
4353 sctp_deliver_data(stcb, &stcb->asoc, chk, 0);
4372 asoc->size_on_all_streams -= chk->send_size;
4373 asoc->cnt_on_all_streams--;
4377 sctp_deliver_data(stcb, &stcb->asoc, chk, 0);
4417 struct sctp_association *asoc;
4424 asoc = &stcb->asoc;
4434 m_size = (stcb->asoc.mapping_array_size << 3);
4440 if (compare_with_wrap(asoc->cumulative_tsn, new_cum_tsn, MAX_TSN) ||
4441 asoc->cumulative_tsn == new_cum_tsn) {
4446 back_out_htsn = asoc->highest_tsn_inside_map;
4447 if (compare_with_wrap(new_cum_tsn, asoc->highest_tsn_inside_map,
4449 asoc->highest_tsn_inside_map = new_cum_tsn;
4451 sctp_log_map(0, 0, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
4458 if ((compare_with_wrap(new_cum_tsn, asoc->mapping_array_base_tsn,
4460 (new_cum_tsn == asoc->mapping_array_base_tsn)) {
4461 gap = new_cum_tsn - asoc->mapping_array_base_tsn;
4464 gap = new_cum_tsn + (MAX_TSN - asoc->mapping_array_base_tsn) + 1;
4468 asoc->highest_tsn_inside_map = back_out_htsn;
4477 if (asoc->highest_tsn_inside_map >
4478 asoc->mapping_array_base_tsn) {
4479 gap = asoc->highest_tsn_inside_map -
4480 asoc->mapping_array_base_tsn;
4482 gap = asoc->highest_tsn_inside_map +
4483 (MAX_TSN - asoc->mapping_array_base_tsn) + 1;
4488 SCTP_SET_TSN_PRESENT(asoc->mapping_array, i);
4504 asoc->highest_tsn_inside_map = new_cum_tsn - 1;
4505 asoc->mapping_array_base_tsn = new_cum_tsn;
4506 asoc->cumulative_tsn = asoc->highest_tsn_inside_map;
4508 sctp_log_map(0, 3, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
4510 asoc->last_echo_tsn = asoc->highest_tsn_inside_map;
4520 if (asoc->fragmented_delivery_inprogress) {
4521 sctp_service_reassembly(stcb, asoc, 0);
4523 if (!TAILQ_EMPTY(&asoc->reasmqueue)) {
4533 chk = TAILQ_FIRST(&asoc->reasmqueue);
4536 if (compare_with_wrap(asoc->cumulative_tsn,
4538 asoc->cumulative_tsn == chk->rec.data.TSN_seq) {
4540 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
4542 asoc->tsn_last_delivered, MAX_TSN)) {
4543 asoc->tsn_last_delivered =
4545 asoc->str_of_pdapi =
4547 asoc->ssn_of_pdapi =
4549 asoc->fragment_flags =
4552 asoc->size_on_reasm_queue -= chk->send_size;
4553 asoc->cnt_on_reasm_queue--;
4560 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered,
4578 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered =
4595 if ((asoc->fragmented_delivery_inprogress) &&
4601 asoc->fragmented_delivery_inprogress = 0;
4611 if (asoc->fragmented_delivery_inprogress) {
4619 asoc->fragmented_delivery_inprogress = 0;
4648 if (stseq[i].stream > asoc->streamincnt) {
4653 stseq[i].stream, asoc->streamincnt);
4664 strm = &asoc->strmin[stseq[i].stream];