Lines Matching +full:fan +full:- +full:stop +full:- +full:to +full:- +full:start +full:- +full:us

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (c) 1999-2001 Motorola, Inc.
10 * to implement that state operations. These functions implement the
13 * Please send any bug reports or fixes you make to the
15 * lksctp developers <linux-[email protected]>
19 * Karl Knutson <[email protected].us>
23 * Daisy Chang <daisyc@us.ibm.com>
24 * Sridhar Samudrala <sri@us.ibm.com>
25 * Ardelle Fan <ardelle.fan@intel.com>
69 asoc->last_ecne_tsn = lowest_tsn; in sctp_do_ecn_ce_work()
70 asoc->need_ecne = 1; in sctp_do_ecn_ce_work()
76 * RFC 2481 details a specific bit for a sender to send in
77 * the header of its next outbound TCP segment to indicate to
97 /* First, try to determine if we want to actually lower in sctp_do_ecn_ecne_work()
101 if (TSN_lt(asoc->last_cwr_tsn, lowest_tsn)) { in sctp_do_ecn_ecne_work()
105 * need to be adjusted. in sctp_do_ecn_ecne_work()
113 asoc->last_cwr_tsn = lowest_tsn; in sctp_do_ecn_ecne_work()
116 /* Always try to quiet the other end. In case of lost CWR, in sctp_do_ecn_ecne_work()
119 repl = sctp_make_cwr(asoc, asoc->last_cwr_tsn, chunk); in sctp_do_ecn_ecne_work()
127 /* Helper function to do delayed processing of ECN CWR chunk. */
131 /* Turn off ECNE getting auto-prepended to every outgoing in sctp_do_ecn_cwr_work()
134 asoc->need_ecne = 0; in sctp_do_ecn_cwr_work()
141 struct sctp_transport *trans = asoc->peer.last_data_from; in sctp_gen_sack()
147 (!trans && (asoc->param_flags & SPP_SACKDELAY_DISABLE)) || in sctp_gen_sack()
148 (trans && (trans->param_flags & SPP_SACKDELAY_DISABLE))) in sctp_gen_sack()
149 asoc->peer.sack_needed = 1; in sctp_gen_sack()
151 ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); in sctp_gen_sack()
152 max_tsn_seen = sctp_tsnmap_get_max_tsn_seen(&asoc->peer.tsn_map); in sctp_gen_sack()
157 * : is to be responded to with a SACK. ... in sctp_gen_sack()
162 * implement it here anyway. --piggy] in sctp_gen_sack()
165 asoc->peer.sack_needed = 1; in sctp_gen_sack()
175 if (!asoc->peer.sack_needed) { in sctp_gen_sack()
176 asoc->peer.sack_cnt++; in sctp_gen_sack()
185 if (asoc->peer.sack_cnt >= trans->sackfreq - 1) in sctp_gen_sack()
186 asoc->peer.sack_needed = 1; in sctp_gen_sack()
188 asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = in sctp_gen_sack()
189 trans->sackdelay; in sctp_gen_sack()
192 if (asoc->peer.sack_cnt >= asoc->sackfreq - 1) in sctp_gen_sack()
193 asoc->peer.sack_needed = 1; in sctp_gen_sack()
195 asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = in sctp_gen_sack()
196 asoc->sackdelay; in sctp_gen_sack()
203 __u32 old_a_rwnd = asoc->a_rwnd; in sctp_gen_sack()
205 asoc->a_rwnd = asoc->rwnd; in sctp_gen_sack()
208 asoc->a_rwnd = old_a_rwnd; in sctp_gen_sack()
212 asoc->peer.sack_needed = 0; in sctp_gen_sack()
213 asoc->peer.sack_cnt = 0; in sctp_gen_sack()
217 /* Stop the SACK timer. */ in sctp_gen_sack()
224 error = -ENOMEM; in sctp_gen_sack()
228 /* When the T3-RTX timer expires, it calls this function to create the
235 struct sctp_association *asoc = transport->asoc; in sctp_generate_t3_rtx_event()
236 struct sock *sk = asoc->base.sk; in sctp_generate_t3_rtx_event()
247 if (!mod_timer(&transport->T3_rtx_timer, jiffies + (HZ/20))) in sctp_generate_t3_rtx_event()
255 asoc->state, in sctp_generate_t3_rtx_event()
256 asoc->ep, asoc, in sctp_generate_t3_rtx_event()
260 sk->sk_err = -error; in sctp_generate_t3_rtx_event()
273 struct sock *sk = asoc->base.sk; in sctp_generate_timeout_event()
283 if (!mod_timer(&asoc->timers[timeout_type], jiffies + (HZ/20))) in sctp_generate_timeout_event()
289 * the timer to let go of the reference? in sctp_generate_timeout_event()
291 if (asoc->base.dead) in sctp_generate_timeout_event()
297 asoc->state, asoc->ep, asoc, in sctp_generate_timeout_event()
301 sk->sk_err = -error; in sctp_generate_timeout_event()
365 struct sctp_association *asoc = transport->asoc; in sctp_generate_heartbeat_event()
366 struct sock *sk = asoc->base.sk; in sctp_generate_heartbeat_event()
376 if (!mod_timer(&transport->hb_timer, jiffies + (HZ/20))) in sctp_generate_heartbeat_event()
382 elapsed = jiffies - transport->last_time_sent; in sctp_generate_heartbeat_event()
385 elapsed = timeout - elapsed; in sctp_generate_heartbeat_event()
386 if (!mod_timer(&transport->hb_timer, jiffies + elapsed)) in sctp_generate_heartbeat_event()
393 asoc->state, asoc->ep, asoc, in sctp_generate_heartbeat_event()
397 sk->sk_err = -error; in sctp_generate_heartbeat_event()
411 struct sctp_association *asoc = transport->asoc; in sctp_generate_proto_unreach_event()
412 struct sock *sk = asoc->base.sk; in sctp_generate_proto_unreach_event()
420 if (!mod_timer(&transport->proto_unreach_timer, in sctp_generate_proto_unreach_event()
426 /* Is this structure just waiting around for us to actually in sctp_generate_proto_unreach_event()
429 if (asoc->base.dead) in sctp_generate_proto_unreach_event()
434 asoc->state, asoc->ep, asoc, transport, GFP_ATOMIC); in sctp_generate_proto_unreach_event()
441 /* Handle the timeout of the RE-CONFIG timer. */
446 struct sctp_association *asoc = transport->asoc; in sctp_generate_reconf_event()
447 struct sock *sk = asoc->base.sk; in sctp_generate_reconf_event()
456 if (!mod_timer(&transport->reconf_timer, jiffies + (HZ / 20))) in sctp_generate_reconf_event()
462 if (!asoc->strreset_chunk) in sctp_generate_reconf_event()
467 asoc->state, asoc->ep, asoc, in sctp_generate_reconf_event()
471 sk->sk_err = -error; in sctp_generate_reconf_event()
482 struct sctp_association *asoc = transport->asoc; in sctp_generate_probe_event()
483 struct sock *sk = asoc->base.sk; in sctp_generate_probe_event()
492 if (!mod_timer(&transport->probe_timer, jiffies + (HZ / 20))) in sctp_generate_probe_event()
499 asoc->state, asoc->ep, asoc, in sctp_generate_probe_event()
503 sk->sk_err = -error; in sctp_generate_probe_event()
537 * When its peer endpoint is multi-homed, an endpoint should keep a
541 * Each time the T3-rtx timer expires on any address, or when a
542 * HEARTBEAT sent to an idle address is not acknowledged within a RTO,
547 * notification SHOULD be sent to the upper layer.
558 /* We are here due to a timer expiration. If the timer was in sctp_do_8_2_transport_strike()
566 asoc->overall_error_count++; in sctp_do_8_2_transport_strike()
567 if (transport->state != SCTP_INACTIVE) in sctp_do_8_2_transport_strike()
568 transport->error_count++; in sctp_do_8_2_transport_strike()
569 } else if (transport->hb_sent) { in sctp_do_8_2_transport_strike()
570 if (transport->state != SCTP_UNCONFIRMED) in sctp_do_8_2_transport_strike()
571 asoc->overall_error_count++; in sctp_do_8_2_transport_strike()
572 if (transport->state != SCTP_INACTIVE) in sctp_do_8_2_transport_strike()
573 transport->error_count++; in sctp_do_8_2_transport_strike()
581 if (asoc->base.net->sctp.pf_enable && in sctp_do_8_2_transport_strike()
582 transport->state == SCTP_ACTIVE && in sctp_do_8_2_transport_strike()
583 transport->error_count < transport->pathmaxrxt && in sctp_do_8_2_transport_strike()
584 transport->error_count > transport->pf_retrans) { in sctp_do_8_2_transport_strike()
590 /* Update the hb timer to resend a heartbeat every rto */ in sctp_do_8_2_transport_strike()
594 if (transport->state != SCTP_INACTIVE && in sctp_do_8_2_transport_strike()
595 (transport->error_count > transport->pathmaxrxt)) { in sctp_do_8_2_transport_strike()
597 __func__, asoc, &transport->ipaddr.sa); in sctp_do_8_2_transport_strike()
604 if (transport->error_count > transport->ps_retrans && in sctp_do_8_2_transport_strike()
605 asoc->peer.primary_path == transport && in sctp_do_8_2_transport_strike()
606 asoc->peer.active_path != transport) in sctp_do_8_2_transport_strike()
607 sctp_assoc_set_primary(asoc, asoc->peer.active_path); in sctp_do_8_2_transport_strike()
610 * expires, set RTO <- RTO * 2 ("back off the timer"). The in sctp_do_8_2_transport_strike()
612 * used to provide an upper bound to this doubling operation. in sctp_do_8_2_transport_strike()
618 if (!is_hb || transport->hb_sent) { in sctp_do_8_2_transport_strike()
619 transport->rto = min((transport->rto * 2), transport->asoc->rto_max); in sctp_do_8_2_transport_strike()
624 /* Worker routine to handle INIT command failure. */
643 asoc->outqueue.error = error; in sctp_cmd_init_failed()
647 /* Worker routine to handle SCTP_CMD_ASSOC_FAILED. */
659 asoc->stream.si->abort_pd(&asoc->ulpq, GFP_ATOMIC); in sctp_cmd_assoc_failed()
673 if (asoc->overall_error_count >= asoc->max_retrans) { in sctp_cmd_assoc_failed()
684 asoc->outqueue.error = error; in sctp_cmd_assoc_failed()
688 /* Process an init chunk (may be real INIT/INIT-ACK or an embedded INIT
689 * inside the cookie. In reality, this is only used for INIT-ACK processing
702 * case. This is when we process the INIT-ACK. If we in sctp_cmd_process_init()
703 * fail during INIT processing (due to malloc problems), in sctp_cmd_process_init()
704 * just return the error and stop processing the stack. in sctp_cmd_process_init()
707 error = -ENOMEM; in sctp_cmd_process_init()
714 /* Helper function to break out starting up of heartbeat timers. */
720 /* Start a heartbeat timer for each transport on the association. in sctp_cmd_hb_timers_start()
721 * hold a reference on the transport to make sure none of in sctp_cmd_hb_timers_start()
724 list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) in sctp_cmd_hb_timers_start()
733 /* Stop all heartbeat timers. */ in sctp_cmd_hb_timers_stop()
735 list_for_each_entry(t, &asoc->peer.transport_addr_list, in sctp_cmd_hb_timers_stop()
737 if (del_timer(&t->hb_timer)) in sctp_cmd_hb_timers_stop()
742 /* Helper function to stop any pending T3-RTX timers */
748 list_for_each_entry(t, &asoc->peer.transport_addr_list, in sctp_cmd_t3_rtx_timers_stop()
750 if (del_timer(&t->T3_rtx_timer)) in sctp_cmd_t3_rtx_timers_stop()
756 /* Helper function to handle the reception of an HEARTBEAT ACK. */
767 * transport address to which the HEARTBEAT was sent. in sctp_cmd_transport_on()
769 t->error_count = 0; in sctp_cmd_transport_on()
775 * window shut forever, we may never be able to transmit our in sctp_cmd_transport_on()
777 * to shutdown the association. in sctp_cmd_transport_on()
779 if (t->asoc->state < SCTP_STATE_SHUTDOWN_PENDING) in sctp_cmd_transport_on()
780 t->asoc->overall_error_count = 0; in sctp_cmd_transport_on()
782 /* Clear the hb_sent flag to signal that we had a good in sctp_cmd_transport_on()
785 t->hb_sent = 0; in sctp_cmd_transport_on()
790 if ((t->state == SCTP_INACTIVE) || (t->state == SCTP_UNCONFIRMED)) { in sctp_cmd_transport_on()
796 if (t->state == SCTP_PF) in sctp_cmd_transport_on()
800 /* HB-ACK was received for a the proper HB. Consider this in sctp_cmd_transport_on()
803 if (t->dst) in sctp_cmd_transport_on()
810 * it was most likely due to a retransmit. However, we want in sctp_cmd_transport_on()
811 * to re-enable it to properly update the rto. in sctp_cmd_transport_on()
813 if (t->rto_pending == 0) in sctp_cmd_transport_on()
814 t->rto_pending = 1; in sctp_cmd_transport_on()
816 hbinfo = (struct sctp_sender_hb_info *)chunk->skb->data; in sctp_cmd_transport_on()
817 sctp_transport_update_rto(t, (jiffies - hbinfo->sent_at)); in sctp_cmd_transport_on()
822 if (was_unconfirmed && asoc->peer.transport_count == 1) in sctp_cmd_transport_on()
827 /* Helper function to process the process SACK command. */
834 if (sctp_outq_sack(&asoc->outqueue, chunk)) { in sctp_cmd_process_sack()
836 err = sctp_do_sm(asoc->base.net, SCTP_EVENT_T_OTHER, in sctp_cmd_process_sack()
838 asoc->state, asoc->ep, asoc, NULL, in sctp_cmd_process_sack()
845 /* Helper function to set the timeout value for T2-SHUTDOWN timer and to set
854 if (chunk->transport) in sctp_cmd_setup_t2()
855 t = chunk->transport; in sctp_cmd_setup_t2()
858 asoc->shutdown_last_sent_to); in sctp_cmd_setup_t2()
859 chunk->transport = t; in sctp_cmd_setup_t2()
861 asoc->shutdown_last_sent_to = t; in sctp_cmd_setup_t2()
862 asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = t->rto; in sctp_cmd_setup_t2()
865 /* Helper function to change the state of an association. */
870 struct sock *sk = asoc->base.sk; in sctp_cmd_new_state()
872 asoc->state = state; in sctp_cmd_new_state()
877 /* Change the sk->sk_state of a TCP-style socket that has in sctp_cmd_new_state()
887 sk->sk_shutdown |= RCV_SHUTDOWN; in sctp_cmd_new_state()
893 * increased due to timer expirations. in sctp_cmd_new_state()
895 asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = in sctp_cmd_new_state()
896 asoc->rto_initial; in sctp_cmd_new_state()
897 asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = in sctp_cmd_new_state()
898 asoc->rto_initial; in sctp_cmd_new_state()
902 kfree(asoc->peer.cookie); in sctp_cmd_new_state()
903 asoc->peer.cookie = NULL; in sctp_cmd_new_state()
912 if (waitqueue_active(&asoc->wait)) in sctp_cmd_new_state()
913 wake_up_interruptible(&asoc->wait); in sctp_cmd_new_state()
916 * a TCP-style or UDP-style peeled-off socket in in sctp_cmd_new_state()
918 * For a UDP-style socket, the waiters are woken up by the in sctp_cmd_new_state()
922 sk->sk_state_change(sk); in sctp_cmd_new_state()
926 !sctp_outq_is_empty(&asoc->outqueue)) in sctp_cmd_new_state()
927 sctp_outq_uncork(&asoc->outqueue, GFP_ATOMIC); in sctp_cmd_new_state()
930 /* Helper function to delete an association. */
934 struct sock *sk = asoc->base.sk; in sctp_cmd_delete_tcb()
936 /* If it is a non-temporary association belonging to a TCP-style in sctp_cmd_delete_tcb()
941 (!asoc->temp) && (sk->sk_shutdown != SHUTDOWN_MASK)) in sctp_cmd_delete_tcb()
949 * A4) Start a T-4 RTO timer, using the RTO value of the selected
959 t = sctp_assoc_choose_alter_transport(asoc, chunk->transport); in sctp_cmd_setup_t4()
960 asoc->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = t->rto; in sctp_cmd_setup_t4()
961 chunk->transport = t; in sctp_cmd_setup_t4()
972 while (chunk->chunk_end > chunk->skb->data) { in sctp_cmd_process_operr()
973 err_hdr = (struct sctp_errhdr *)(chunk->skb->data); in sctp_cmd_process_operr()
980 asoc->stream.si->enqueue_event(&asoc->ulpq, ev); in sctp_cmd_process_operr()
982 switch (err_hdr->cause) { in sctp_cmd_process_operr()
988 switch (unk_chunk_hdr->type) { in sctp_cmd_process_operr()
989 /* ADDIP 4.1 A9) If the peer responds to an ASCONF with in sctp_cmd_process_operr()
992 * NOT send any further ASCONF chunks and MUST stop its in sctp_cmd_process_operr()
993 * T-4 timer. in sctp_cmd_process_operr()
996 if (asoc->peer.asconf_capable == 0) in sctp_cmd_process_operr()
999 asoc->peer.asconf_capable = 0; in sctp_cmd_process_operr()
1014 /* Helper function to remove the association non-primary peer
1023 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { in sctp_cmd_del_non_primary()
1025 if (!sctp_cmp_addr_exact(&t->ipaddr, in sctp_cmd_del_non_primary()
1026 &asoc->peer.primary_addr)) { in sctp_cmd_del_non_primary()
1032 /* Helper function to set sk_err on a 1-1 style socket. */
1035 struct sock *sk = asoc->base.sk; in sctp_cmd_set_sk_err()
1038 sk->sk_err = error; in sctp_cmd_set_sk_err()
1041 /* Helper function to generate an association change event */
1049 asoc->c.sinit_num_ostreams, in sctp_cmd_assoc_change()
1050 asoc->c.sinit_max_instreams, in sctp_cmd_assoc_change()
1053 asoc->stream.si->enqueue_event(&asoc->ulpq, ev); in sctp_cmd_assoc_change()
1063 asoc->stream.si->enqueue_event(&asoc->ulpq, ev); in sctp_cmd_peer_no_auth()
1066 /* Helper function to generate an adaptation indication event */
1075 asoc->stream.si->enqueue_event(&asoc->ulpq, ev); in sctp_cmd_adaptation_ind()
1085 t = asoc->init_last_sent_to; in sctp_cmd_t1_timer_update()
1086 asoc->init_err_counter++; in sctp_cmd_t1_timer_update()
1088 if (t->init_sent_count > (asoc->init_cycle + 1)) { in sctp_cmd_t1_timer_update()
1089 asoc->timeouts[timer] *= 2; in sctp_cmd_t1_timer_update()
1090 if (asoc->timeouts[timer] > asoc->max_init_timeo) { in sctp_cmd_t1_timer_update()
1091 asoc->timeouts[timer] = asoc->max_init_timeo; in sctp_cmd_t1_timer_update()
1093 asoc->init_cycle++; in sctp_cmd_t1_timer_update()
1097 asoc->init_err_counter, asoc->init_cycle, in sctp_cmd_t1_timer_update()
1098 asoc->timeouts[timer]); in sctp_cmd_t1_timer_update()
1103 /* Send the whole message, chunk by chunk, to the outqueue.
1112 list_for_each_entry(chunk, &msg->chunks, frag_list) in sctp_cmd_send_msg()
1113 sctp_outq_tail(&asoc->outqueue, chunk, gfp); in sctp_cmd_send_msg()
1115 asoc->outqueue.sched->enqueue(&asoc->outqueue, msg); in sctp_cmd_send_msg()
1119 /* These three macros allow us to pull the debugging code out of the
1120 * main flow of sctp_do_sm() to keep attention focused on the real
1124 pr_debug("%s[pre-fn]: ep:%p, %s, %s, asoc:%p[%s], %s\n", __func__, \
1126 asoc, sctp_state_tbl[state], state_fn->name)
1129 pr_debug("%s[post-fn]: asoc:%p, status:%s\n", __func__, asoc, \
1133 pr_debug("%s[post-sfx]: error:%d, asoc:%p[%s]\n", __func__, error, \
1134 asoc, sctp_state_tbl[(asoc && sctp_id2assoc(ep->base.sk, \
1135 sctp_assoc2id(asoc))) ? asoc->state : SCTP_STATE_CLOSED])
1140 * If you want to understand all of lksctp, this is a
1141 * good place to start.
1166 status = state_fn->fn(net, ep, asoc, subtype, event_arg, &commands); in sctp_do_sm()
1192 /* FIXME - Most of the dispositions left today would be categorized in sctp_side_effects()
1194 * may not be proper to run through any of the commands at all. in sctp_side_effects()
1206 pr_debug("%s: ignored sctp protocol event - state:%d, " in sctp_side_effects()
1212 /* We ran out of memory, so we need to discard this in sctp_side_effects()
1215 /* BUG--we should now recover some memory, probably by in sctp_side_effects()
1218 error = -ENOMEM; in sctp_side_effects()
1229 * We should no longer have much work to do here as the in sctp_side_effects()
1255 error = -EINVAL; in sctp_side_effects()
1268 /* This is the side-effect interpreter. */
1279 struct sctp_sock *sp = sctp_sk(ep->base.sk); in sctp_cmd_interpreter()
1298 * cmd->handle(x, y, z) in sctp_cmd_interpreter()
1299 * --jgrimm in sctp_cmd_interpreter()
1302 switch (cmd->verb) { in sctp_cmd_interpreter()
1310 sctp_outq_uncork(&asoc->outqueue, gfp); in sctp_cmd_interpreter()
1315 asoc = cmd->obj.asoc; in sctp_cmd_interpreter()
1316 BUG_ON(asoc->peer.primary_path == NULL); in sctp_cmd_interpreter()
1321 sctp_outq_teardown(&asoc->outqueue); in sctp_cmd_interpreter()
1326 sctp_outq_uncork(&asoc->outqueue, gfp); in sctp_cmd_interpreter()
1336 sctp_cmd_new_state(commands, asoc, cmd->obj.state); in sctp_cmd_interpreter()
1341 error = sctp_tsnmap_mark(&asoc->peer.tsn_map, in sctp_cmd_interpreter()
1342 cmd->obj.u32, NULL); in sctp_cmd_interpreter()
1346 asoc->stream.si->report_ftsn(&asoc->ulpq, cmd->obj.u32); in sctp_cmd_interpreter()
1350 asoc->stream.si->handle_ftsn(&asoc->ulpq, in sctp_cmd_interpreter()
1351 cmd->obj.chunk); in sctp_cmd_interpreter()
1356 * The argument tells us whether to just count in sctp_cmd_interpreter()
1360 force = cmd->obj.i32; in sctp_cmd_interpreter()
1367 cmd->obj.chunk); in sctp_cmd_interpreter()
1375 error = -ENOMEM; in sctp_cmd_interpreter()
1385 * Note: Only used during INIT-ACK processing. If in sctp_cmd_interpreter()
1386 * there is an error just return to the outter in sctp_cmd_interpreter()
1390 cmd->obj.init, gfp); in sctp_cmd_interpreter()
1397 if (cmd->obj.chunk) in sctp_cmd_interpreter()
1398 sctp_chunk_free(cmd->obj.chunk); in sctp_cmd_interpreter()
1399 error = -ENOMEM; in sctp_cmd_interpreter()
1405 /* If there is an ERROR chunk to be sent along with in sctp_cmd_interpreter()
1408 if (cmd->obj.chunk) in sctp_cmd_interpreter()
1410 SCTP_CHUNK(cmd->obj.chunk)); in sctp_cmd_interpreter()
1412 if (new_obj->transport) { in sctp_cmd_interpreter()
1413 new_obj->transport->init_sent_count++; in sctp_cmd_interpreter()
1414 asoc->init_last_sent_to = new_obj->transport; in sctp_cmd_interpreter()
1417 /* FIXME - Eventually come up with a cleaner way to in sctp_cmd_interpreter()
1418 * enabling COOKIE-ECHO + DATA bundling during in sctp_cmd_interpreter()
1420 * command plays with asoc->peer.retran_path to in sctp_cmd_interpreter()
1421 * avoid the problem of sending the COOKIE-ECHO and in sctp_cmd_interpreter()
1426 * to be executed only during failed attempts of in sctp_cmd_interpreter()
1429 if ((asoc->peer.retran_path != in sctp_cmd_interpreter()
1430 asoc->peer.primary_path) && in sctp_cmd_interpreter()
1431 (asoc->init_err_counter > 0)) { in sctp_cmd_interpreter()
1443 asoc->overall_error_count = 0; in sctp_cmd_interpreter()
1448 error = -ENOMEM; in sctp_cmd_interpreter()
1456 /* Send a chunk to the sockets layer. */ in sctp_cmd_interpreter()
1458 __func__, cmd->obj.chunk, &asoc->ulpq); in sctp_cmd_interpreter()
1460 asoc->stream.si->ulpevent_data(&asoc->ulpq, in sctp_cmd_interpreter()
1461 cmd->obj.chunk, in sctp_cmd_interpreter()
1466 /* Send a notification to the sockets layer. */ in sctp_cmd_interpreter()
1468 __func__, cmd->obj.ulpevent, &asoc->ulpq); in sctp_cmd_interpreter()
1470 asoc->stream.si->enqueue_event(&asoc->ulpq, in sctp_cmd_interpreter()
1471 cmd->obj.ulpevent); in sctp_cmd_interpreter()
1476 if (!asoc->outqueue.cork) { in sctp_cmd_interpreter()
1477 sctp_outq_cork(&asoc->outqueue); in sctp_cmd_interpreter()
1480 /* Send a chunk to our peer. */ in sctp_cmd_interpreter()
1481 sctp_outq_tail(&asoc->outqueue, cmd->obj.chunk, gfp); in sctp_cmd_interpreter()
1485 /* Send a full packet to our peer. */ in sctp_cmd_interpreter()
1486 packet = cmd->obj.packet; in sctp_cmd_interpreter()
1493 sctp_retransmit(&asoc->outqueue, cmd->obj.transport, in sctp_cmd_interpreter()
1499 sctp_retransmit(&asoc->outqueue, cmd->obj.transport, in sctp_cmd_interpreter()
1505 sctp_do_ecn_ce_work(asoc, cmd->obj.u32); in sctp_cmd_interpreter()
1510 new_obj = sctp_do_ecn_ecne_work(asoc, cmd->obj.u32, in sctp_cmd_interpreter()
1519 sctp_do_ecn_cwr_work(asoc, cmd->obj.u32); in sctp_cmd_interpreter()
1523 sctp_cmd_setup_t2(commands, asoc, cmd->obj.chunk); in sctp_cmd_interpreter()
1527 timer = &asoc->timers[cmd->obj.to]; in sctp_cmd_interpreter()
1534 timer = &asoc->timers[cmd->obj.to]; in sctp_cmd_interpreter()
1535 timeout = asoc->timeouts[cmd->obj.to]; in sctp_cmd_interpreter()
1540 * timer starts as side effects, it can be hard to tell if we in sctp_cmd_interpreter()
1541 * have already started a timer or not, which leads to BUG in sctp_cmd_interpreter()
1552 timer = &asoc->timers[cmd->obj.to]; in sctp_cmd_interpreter()
1553 timeout = asoc->timeouts[cmd->obj.to]; in sctp_cmd_interpreter()
1559 timer = &asoc->timers[cmd->obj.to]; in sctp_cmd_interpreter()
1565 chunk = cmd->obj.chunk; in sctp_cmd_interpreter()
1567 asoc->init_last_sent_to); in sctp_cmd_interpreter()
1568 asoc->init_last_sent_to = t; in sctp_cmd_interpreter()
1569 chunk->transport = t; in sctp_cmd_interpreter()
1570 t->init_sent_count++; in sctp_cmd_interpreter()
1602 * COOKIE-ECHO we need to resend. in sctp_cmd_interpreter()
1604 list_for_each_entry(t, &asoc->peer.transport_addr_list, in sctp_cmd_interpreter()
1606 sctp_retransmit_mark(&asoc->outqueue, t, in sctp_cmd_interpreter()
1616 sctp_cmd_init_failed(commands, asoc, cmd->obj.u16); in sctp_cmd_interpreter()
1621 subtype, chunk, cmd->obj.u16); in sctp_cmd_interpreter()
1625 asoc->init_err_counter++; in sctp_cmd_interpreter()
1629 asoc->init_err_counter = 0; in sctp_cmd_interpreter()
1630 asoc->init_cycle = 0; in sctp_cmd_interpreter()
1631 list_for_each_entry(t, &asoc->peer.transport_addr_list, in sctp_cmd_interpreter()
1633 t->init_sent_count = 0; in sctp_cmd_interpreter()
1638 sctp_tsnmap_mark_dup(&asoc->peer.tsn_map, in sctp_cmd_interpreter()
1639 cmd->obj.u32); in sctp_cmd_interpreter()
1649 cmd->obj.transport, 0); in sctp_cmd_interpreter()
1653 t = cmd->obj.transport; in sctp_cmd_interpreter()
1658 t = cmd->obj.transport; in sctp_cmd_interpreter()
1661 t->hb_sent = 1; in sctp_cmd_interpreter()
1665 t = cmd->obj.transport; in sctp_cmd_interpreter()
1674 t = cmd->obj.transport; in sctp_cmd_interpreter()
1683 t = cmd->obj.transport; in sctp_cmd_interpreter()
1688 error = cmd->obj.error; in sctp_cmd_interpreter()
1693 sackh.cum_tsn_ack = cmd->obj.be32; in sctp_cmd_interpreter()
1694 sackh.a_rwnd = htonl(asoc->peer.rwnd + in sctp_cmd_interpreter()
1695 asoc->outqueue.outstanding_bytes); in sctp_cmd_interpreter()
1698 chunk->subh.sack_hdr = &sackh; in sctp_cmd_interpreter()
1704 /* We need to discard the whole packet. in sctp_cmd_interpreter()
1708 chunk->pdiscard = 1; in sctp_cmd_interpreter()
1710 sctp_outq_uncork(&asoc->outqueue, gfp); in sctp_cmd_interpreter()
1716 t = cmd->obj.transport; in sctp_cmd_interpreter()
1717 t->rto_pending = 1; in sctp_cmd_interpreter()
1721 asoc->stream.si->start_pd(&asoc->ulpq, GFP_ATOMIC); in sctp_cmd_interpreter()
1725 asoc->stream.si->renege_events(&asoc->ulpq, in sctp_cmd_interpreter()
1726 cmd->obj.chunk, in sctp_cmd_interpreter()
1731 sctp_cmd_setup_t4(commands, asoc, cmd->obj.chunk); in sctp_cmd_interpreter()
1738 asoc->peer.i.init_tag = 0; in sctp_cmd_interpreter()
1747 t = asoc->peer.retran_path; in sctp_cmd_interpreter()
1748 asoc->peer.retran_path = asoc->peer.primary_path; in sctp_cmd_interpreter()
1749 sctp_outq_uncork(&asoc->outqueue, gfp); in sctp_cmd_interpreter()
1751 asoc->peer.retran_path = t; in sctp_cmd_interpreter()
1754 sctp_cmd_set_sk_err(asoc, cmd->obj.error); in sctp_cmd_interpreter()
1758 cmd->obj.u8); in sctp_cmd_interpreter()
1772 asoc->peer.i.init_tag = cmd->obj.u32; in sctp_cmd_interpreter()
1775 if (!asoc->outqueue.cork) { in sctp_cmd_interpreter()
1776 sctp_outq_cork(&asoc->outqueue); in sctp_cmd_interpreter()
1779 sctp_cmd_send_msg(asoc, cmd->obj.msg, gfp); in sctp_cmd_interpreter()
1787 sctp_outq_uncork(&asoc->outqueue, gfp); in sctp_cmd_interpreter()
1790 asoc = cmd->obj.asoc; in sctp_cmd_interpreter()
1795 cmd->verb); in sctp_cmd_interpreter()
1802 if (cmd->verb == SCTP_CMD_REPLY) in sctp_cmd_interpreter()
1803 sctp_chunk_free(cmd->obj.chunk); in sctp_cmd_interpreter()
1810 /* If this is in response to a received chunk, wait until in sctp_cmd_interpreter()
1811 * we are done with the packet to open the queue so that we don't in sctp_cmd_interpreter()
1812 * send multiple packets in response to a single request. in sctp_cmd_interpreter()
1815 if (chunk->end_of_packet || chunk->singleton) in sctp_cmd_interpreter()
1816 sctp_outq_uncork(&asoc->outqueue, gfp); in sctp_cmd_interpreter()
1818 sctp_outq_uncork(&asoc->outqueue, gfp); in sctp_cmd_interpreter()
1820 if (sp->data_ready_signalled) in sctp_cmd_interpreter()
1821 sp->data_ready_signalled = 0; in sctp_cmd_interpreter()