Lines Matching defs:stcb

86 sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
89 KASSERT(stcb != NULL, ("stcb is NULL"));
90 SCTP_TCB_LOCK_ASSERT(stcb);
104 stcb, 0,
112 sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED);
114 inp, stcb, net,
116 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
122 stcb->asoc.overall_error_count,
123 (stcb->asoc.overall_error_count + 1),
127 stcb->asoc.overall_error_count++;
132 stcb->asoc.overall_error_count,
133 (stcb->asoc.overall_error_count + 1),
137 stcb->asoc.overall_error_count++;
140 (void *)&stcb->asoc, stcb->asoc.overall_error_count,
147 if (stcb->asoc.overall_error_count > threshold) {
154 sctp_abort_an_association(inp, stcb, op_err, true, SCTP_SO_NOT_LOCKED);
165 sctp_find_alternate_net(struct sctp_tcb *stcb,
177 if (stcb->asoc.numnets == 1) {
179 return (TAILQ_FIRST(&stcb->asoc.nets));
190 TAILQ_FOREACH(mnet, &stcb->asoc.nets, sctp_next) {
259 if (stcb->asoc.hb_random_idx > 3) {
260 rndval = sctp_select_initial_TSN(&stcb->sctp_ep->sctp_ep);
261 memcpy(stcb->asoc.hb_random_values, &rndval, sizeof(stcb->asoc.hb_random_values));
262 this_random = stcb->asoc.hb_random_values[0];
263 stcb->asoc.hb_random_idx++;
264 stcb->asoc.hb_ect_randombit = 0;
266 this_random = stcb->asoc.hb_random_values[stcb->asoc.hb_random_idx];
267 stcb->asoc.hb_random_idx++;
268 stcb->asoc.hb_ect_randombit = 0;
287 TAILQ_FOREACH(mnet, &stcb->asoc.nets, sctp_next) {
303 if (stcb->asoc.hb_random_idx > 3) {
304 rndval = sctp_select_initial_TSN(&stcb->sctp_ep->sctp_ep);
305 memcpy(stcb->asoc.hb_random_values, &rndval,
306 sizeof(stcb->asoc.hb_random_values));
307 this_random = stcb->asoc.hb_random_values[0];
308 stcb->asoc.hb_random_idx = 0;
309 stcb->asoc.hb_ect_randombit = 0;
311 this_random = stcb->asoc.hb_random_values[stcb->asoc.hb_random_idx];
312 stcb->asoc.hb_random_idx++;
313 stcb->asoc.hb_ect_randombit = 0;
329 alt = TAILQ_FIRST(&stcb->asoc.nets);
335 alt = TAILQ_FIRST(&stcb->asoc.nets);
368 alt = TAILQ_FIRST(&stcb->asoc.nets);
374 alt = TAILQ_FIRST(&stcb->asoc.nets);
403 alt = TAILQ_FIRST(&stcb->asoc.nets);
410 sctp_backoff_on_timeout(struct sctp_tcb *stcb,
417 net->RTO = stcb->asoc.minrto;
419 net->RTO = stcb->asoc.initial_rto;
423 if (net->RTO > stcb->asoc.maxrto) {
424 net->RTO = stcb->asoc.maxrto;
429 stcb->asoc.cc_functions.sctp_cwnd_update_after_timeout(stcb, net);
435 sctp_recover_sent_list(struct sctp_tcb *stcb)
440 asoc = &stcb->asoc;
462 sctp_free_bufspace(stcb, asoc, chk, 1);
470 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
481 sctp_mark_all_for_resend(struct sctp_tcb *stcb,
521 stcb->asoc.peers_rwnd,
525 sctp_log_fr(net->flight_size, net->cwnd, stcb->asoc.total_flight, SCTP_FR_CWND_REPORT);
549 orig_tf = stcb->asoc.total_flight;
559 TAILQ_FOREACH_SAFE(chk, &stcb->asoc.sent_queue, sctp_next, nchk) {
560 if (SCTP_TSN_GE(stcb->asoc.last_acked_seq, chk->rec.data.tsn)) {
563 (unsigned int)stcb->asoc.last_acked_seq, (unsigned int)chk->rec.data.tsn);
569 sctp_recover_sent_list(stcb);
620 if (stcb->asoc.prsctp_supported && PR_SCTP_TTL_ENABLED(chk->flags)) {
625 (void)sctp_release_pr_sctp_chunk(stcb,
634 if (stcb->asoc.prsctp_supported && PR_SCTP_RTX_ENABLED(chk->flags)) {
638 (void)sctp_release_pr_sctp_chunk(stcb,
648 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
666 stcb->asoc.marked_retrans++;
675 sctp_total_flight_decrease(stcb, chk);
676 stcb->asoc.peers_rwnd += chk->send_size;
677 stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh);
700 if (TAILQ_EMPTY(&stcb->asoc.send_queue)) {
701 chk->rec.data.fast_retran_tsn = stcb->asoc.sending_seq;
703 chk->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.tsn;
709 if (stcb->asoc.sctp_cmt_on_off > 0) {
722 if ((orig_flight - net->flight_size) != (orig_tf - stcb->asoc.total_flight)) {
736 stcb->asoc.peers_rwnd);
745 TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) {
756 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
763 if ((stcb->asoc.sent_queue_retran_cnt == 0) && (could_be_sent)) {
765 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
770 if (stcb->asoc.sent_queue_retran_cnt != cnt_mk) {
773 cnt_mk, stcb->asoc.sent_queue_retran_cnt, num_mk);
776 stcb->asoc.sent_queue_retran_cnt = cnt_mk;
783 stcb->asoc.total_flight = 0;
784 stcb->asoc.total_flight_count = 0;
786 TAILQ_FOREACH(lnets, &stcb->asoc.nets, sctp_next) {
792 TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) {
803 sctp_total_flight_increase(stcb, chk);
813 struct sctp_tcb *stcb,
825 TAILQ_FOREACH(lnet, &stcb->asoc.nets, sctp_next) {
827 sctp_log_cwnd(stcb, lnet, 1, SCTP_CWND_LOG_FROM_T3);
829 sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_LOG_FROM_T3);
834 if ((stcb->asoc.peers_rwnd == 0) &&
835 (stcb->asoc.total_flight < net->mtu)) {
844 if (sctp_threshold_management(inp, stcb, net,
845 stcb->asoc.max_send_times)) {
849 if (net != stcb->asoc.primary_destination) {
867 sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED);
879 if (sctp_threshold_management(inp, stcb, NULL,
880 stcb->asoc.max_send_times)) {
885 if (stcb->asoc.sctp_cmt_on_off > 0) {
887 alt = sctp_find_alternate_net(stcb, net, 2);
894 alt = sctp_find_alternate_net(stcb, net, 1);
905 alt = sctp_find_alternate_net(stcb, net, 0);
910 (void)sctp_mark_all_for_resend(stcb, net, alt, win_probe,
913 stcb->asoc.fast_retran_loss_recovery = 0;
917 if ((stcb->asoc.cc_functions.sctp_cwnd_new_transmission_begins) &&
919 (*stcb->asoc.cc_functions.sctp_cwnd_new_transmission_begins) (stcb, net);
925 stcb->asoc.sat_t3_loss_recovery = 1;
926 stcb->asoc.sat_t3_recovery_tsn = stcb->asoc.sending_seq;
929 sctp_backoff_on_timeout(stcb, net, win_probe, num_mk, num_abandoned);
933 sctp_move_chunks_from_net(stcb, net);
949 if ((stcb->asoc.primary_destination == net) && (alt != net)) {
957 if (stcb->asoc.alternate != NULL) {
958 sctp_free_remote_addr(stcb->asoc.alternate);
960 stcb->asoc.alternate = alt;
961 atomic_add_int(&stcb->asoc.alternate->ref_count, 1);
968 if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) {
973 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net);
976 if (stcb->asoc.prsctp_supported) {
979 lchk = sctp_try_advance_peer_ack_point(stcb, &stcb->asoc);
981 if (SCTP_TSN_GT(stcb->asoc.advanced_peer_ack_point, stcb->asoc.last_acked_seq)) {
982 send_forward_tsn(stcb, &stcb->asoc);
990 sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, lchk->whoTo);
995 sctp_log_cwnd(stcb, net, net->cwnd, SCTP_CWND_LOG_FROM_RTX);
1002 struct sctp_tcb *stcb,
1006 if (stcb->asoc.delayed_connection) {
1011 stcb->asoc.delayed_connection = 0;
1012 sctp_send_initiate(inp, stcb, SCTP_SO_NOT_LOCKED);
1015 if (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT) {
1018 if (sctp_threshold_management(inp, stcb, net,
1019 stcb->asoc.max_init_times)) {
1023 stcb->asoc.dropped_special_cnt = 0;
1024 sctp_backoff_on_timeout(stcb, stcb->asoc.primary_destination, 1, 0, 0);
1025 if (stcb->asoc.initial_init_rto_max < net->RTO) {
1026 net->RTO = stcb->asoc.initial_init_rto_max;
1028 if (stcb->asoc.numnets > 1) {
1032 alt = sctp_find_alternate_net(stcb, stcb->asoc.primary_destination, 0);
1033 if (alt != stcb->asoc.primary_destination) {
1034 sctp_move_chunks_from_net(stcb, stcb->asoc.primary_destination);
1035 stcb->asoc.primary_destination = alt;
1039 sctp_send_initiate(inp, stcb, SCTP_SO_NOT_LOCKED);
1050 struct sctp_tcb *stcb,
1057 TAILQ_FOREACH(cookie, &stcb->asoc.control_send_queue, sctp_next) {
1063 if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) {
1070 sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED);
1075 SCTP_PRINTF("Strange in state %d not cookie-echoed yet c-e timer expires?\n", SCTP_GET_STATE(stcb));
1082 if (sctp_threshold_management(inp, stcb, cookie->whoTo,
1083 stcb->asoc.max_init_times)) {
1091 stcb->asoc.dropped_special_cnt = 0;
1092 sctp_backoff_on_timeout(stcb, cookie->whoTo, 1, 0, 0);
1093 alt = sctp_find_alternate_net(stcb, cookie->whoTo, 0);
1101 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
1114 sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
1119 if (stcb->asoc.stream_reset_outstanding == 0) {
1123 (void)sctp_find_stream_reset(stcb, stcb->asoc.str_reset_seq_out, &strrst);
1129 if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) {
1137 sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
1138 alt = sctp_find_alternate_net(stcb, net, 0);
1143 TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) {
1150 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
1161 sctp_move_chunks_from_net(stcb, net);
1167 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
1172 sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, inp, stcb, alt);
1177 sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
1184 if (TAILQ_EMPTY(&stcb->asoc.asconf_send_queue)) {
1186 sctp_send_asconf(stcb, net, SCTP_ADDR_NOT_LOCKED);
1193 asconf = TAILQ_FIRST(&stcb->asoc.asconf_send_queue);
1199 if (sctp_threshold_management(inp, stcb, net,
1200 stcb->asoc.max_send_times)) {
1204 if (asconf->snd_count > stcb->asoc.max_send_times) {
1213 sctp_asconf_cleanup(stcb);
1220 sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
1221 alt = sctp_find_alternate_net(stcb, net, 0);
1228 TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) {
1236 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
1241 TAILQ_FOREACH(chk, &stcb->asoc.asconf_send_queue, sctp_next) {
1248 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
1257 sctp_move_chunks_from_net(stcb, net);
1263 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
1268 sctp_send_asconf(stcb, alt, SCTP_ADDR_NOT_LOCKED);
1275 sctp_delete_prim_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
1277 if (stcb->asoc.deleted_primary == NULL) {
1283 SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &stcb->asoc.deleted_primary->ro._l_addr.sa);
1284 sctp_free_remote_addr(stcb->asoc.deleted_primary);
1285 stcb->asoc.deleted_primary = NULL;
1297 sctp_shutdown_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
1303 if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) {
1307 sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
1309 alt = sctp_find_alternate_net(stcb, net, 0);
1312 sctp_send_shutdown(stcb, alt);
1315 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, inp, stcb, alt);
1320 sctp_shutdownack_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
1326 if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) {
1330 sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
1332 alt = sctp_find_alternate_net(stcb, net, 0);
1335 sctp_send_shutdown_ack(stcb, alt);
1338 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, inp, stcb, alt);
1343 sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
1350 KASSERT(stcb != NULL, ("stcb is NULL"));
1351 SCTP_TCB_LOCK_ASSERT(stcb);
1352 KASSERT(TAILQ_EMPTY(&stcb->asoc.send_queue), ("send_queue not empty"));
1353 KASSERT(TAILQ_EMPTY(&stcb->asoc.sent_queue), ("sent_queue not empty"));
1355 if (stcb->asoc.sent_queue_retran_cnt) {
1357 stcb->asoc.sent_queue_retran_cnt);
1358 stcb->asoc.sent_queue_retran_cnt = 0;
1360 if (stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) {
1362 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc);
1363 if (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) {
1368 stcb->asoc.total_output_queue_size = 0;
1372 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
1373 if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) {
1374 TAILQ_FOREACH(sp, &stcb->asoc.strmout[i].outqueue, next) {
1381 if (chks_in_queue != stcb->asoc.stream_queue_cnt) {
1383 stcb->asoc.stream_queue_cnt, chks_in_queue);
1387 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED);
1388 if ((TAILQ_EMPTY(&stcb->asoc.send_queue)) &&
1389 (TAILQ_EMPTY(&stcb->asoc.sent_queue))) {
1401 (u_long)stcb->asoc.total_output_queue_size);
1402 stcb->asoc.total_output_queue_size = 0;
1407 sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
1423 sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
1424 if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) {
1433 if ((stcb->asoc.total_output_queue_size > 0) &&
1434 (TAILQ_EMPTY(&stcb->asoc.send_queue)) &&
1435 (TAILQ_EMPTY(&stcb->asoc.sent_queue))) {
1436 sctp_audit_stream_queues_for_size(inp, stcb);
1461 sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED);
1469 struct sctp_tcb *stcb,
1495 stcb,
1497 net, 0, stcb->asoc.vrf_id);
1524 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
1528 sctp_autoclose_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
1535 if (stcb->asoc.sctp_autoclose_ticks > 0 &&
1538 asoc = &stcb->asoc;
1556 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_AUTOCLOSE_TMR, SCTP_SO_NOT_LOCKED);
1564 if (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT) {
1568 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) ||
1569 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
1572 SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_SENT);
1573 sctp_stop_timers_for_shutdown(stcb);
1574 if (stcb->asoc.alternate) {
1575 net = stcb->asoc.alternate;
1577 net = stcb->asoc.primary_destination;
1579 sctp_send_shutdown(stcb, net);
1581 stcb->sctp_ep, stcb, net);
1583 stcb->sctp_ep, stcb, NULL);
1596 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL);