Lines Matching +full:tsn +full:- +full:capable
2 * Copyright (c) 1999-2000 Cisco, Inc.
3 * Copyright (c) 1999-2001 Motorola, Inc.
4 * Copyright (c) 2001-2003 International Business Machines Corp.
32 * lksctp developers <linux-sctp@vger.kernel.org>
61 peer->ipaddr = *addr; in sctp_transport_init()
62 peer->af_specific = sctp_get_af_specific(addr->sa.sa_family); in sctp_transport_init()
63 memset(&peer->saddr, 0, sizeof(union sctp_addr)); in sctp_transport_init()
65 peer->sack_generation = 0; in sctp_transport_init()
73 peer->rto = msecs_to_jiffies(net->sctp.rto_initial); in sctp_transport_init()
75 peer->last_time_heard = 0; in sctp_transport_init()
76 peer->last_time_ecne_reduced = jiffies; in sctp_transport_init()
78 peer->param_flags = SPP_HB_DISABLE | in sctp_transport_init()
83 peer->pathmaxrxt = net->sctp.max_retrans_path; in sctp_transport_init()
84 peer->pf_retrans = net->sctp.pf_retrans; in sctp_transport_init()
86 INIT_LIST_HEAD(&peer->transmitted); in sctp_transport_init()
87 INIT_LIST_HEAD(&peer->send_ready); in sctp_transport_init()
88 INIT_LIST_HEAD(&peer->transports); in sctp_transport_init()
90 timer_setup(&peer->T3_rtx_timer, sctp_generate_t3_rtx_event, 0); in sctp_transport_init()
91 timer_setup(&peer->hb_timer, sctp_generate_heartbeat_event, 0); in sctp_transport_init()
92 timer_setup(&peer->reconf_timer, sctp_generate_reconf_event, 0); in sctp_transport_init()
93 timer_setup(&peer->proto_unreach_timer, in sctp_transport_init()
96 /* Initialize the 64-bit random nonce sent with heartbeat. */ in sctp_transport_init()
97 get_random_bytes(&peer->hb_nonce, sizeof(peer->hb_nonce)); in sctp_transport_init()
99 refcount_set(&peer->refcnt, 1); in sctp_transport_init()
135 if (del_timer(&transport->hb_timer)) in sctp_transport_free()
143 if (del_timer(&transport->T3_rtx_timer)) in sctp_transport_free()
146 if (del_timer(&transport->reconf_timer)) in sctp_transport_free()
150 if (del_timer(&transport->proto_unreach_timer)) in sctp_transport_free()
151 sctp_association_put(transport->asoc); in sctp_transport_free()
162 dst_release(transport->dst); in sctp_transport_destroy_rcu()
172 if (unlikely(refcount_read(&transport->refcnt))) { in sctp_transport_destroy()
177 sctp_packet_free(&transport->packet); in sctp_transport_destroy()
179 if (transport->asoc) in sctp_transport_destroy()
180 sctp_association_put(transport->asoc); in sctp_transport_destroy()
182 call_rcu(&transport->rcu, sctp_transport_destroy_rcu); in sctp_transport_destroy()
193 * retransmission), if the T3-rtx timer of that address is not running in sctp_transport_reset_t3_rtx()
198 if (!timer_pending(&transport->T3_rtx_timer)) in sctp_transport_reset_t3_rtx()
199 if (!mod_timer(&transport->T3_rtx_timer, in sctp_transport_reset_t3_rtx()
200 jiffies + transport->rto)) in sctp_transport_reset_t3_rtx()
210 if ((time_before(transport->hb_timer.expires, expires) || in sctp_transport_reset_hb_timer()
211 !timer_pending(&transport->hb_timer)) && in sctp_transport_reset_hb_timer()
212 !mod_timer(&transport->hb_timer, in sctp_transport_reset_hb_timer()
213 expires + prandom_u32_max(transport->rto))) in sctp_transport_reset_hb_timer()
219 if (!timer_pending(&transport->reconf_timer)) in sctp_transport_reset_reconf_timer()
220 if (!mod_timer(&transport->reconf_timer, in sctp_transport_reset_reconf_timer()
221 jiffies + transport->rto)) in sctp_transport_reset_reconf_timer()
232 transport->asoc = asoc; in sctp_transport_set_owner()
240 if (!transport->dst || transport->dst->obsolete) { in sctp_transport_pmtu()
242 transport->af_specific->get_dst(transport, &transport->saddr, in sctp_transport_pmtu()
243 &transport->fl, sk); in sctp_transport_pmtu()
246 if (transport->param_flags & SPP_PMTUD_DISABLE) { in sctp_transport_pmtu()
247 struct sctp_association *asoc = transport->asoc; in sctp_transport_pmtu()
249 if (!transport->pathmtu && asoc && asoc->pathmtu) in sctp_transport_pmtu()
250 transport->pathmtu = asoc->pathmtu; in sctp_transport_pmtu()
251 if (transport->pathmtu) in sctp_transport_pmtu()
255 if (transport->dst) in sctp_transport_pmtu()
256 transport->pathmtu = sctp_dst_mtu(transport->dst); in sctp_transport_pmtu()
258 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; in sctp_transport_pmtu()
264 struct sock *sk = t->asoc->base.sk; in sctp_transport_update_pmtu()
276 struct sctp_pf *pf = sctp_get_pf_specific(dst->ops->family); in sctp_transport_update_pmtu()
279 pf->af->from_sk(&addr, sk); in sctp_transport_update_pmtu()
280 pf->to_sk_daddr(&t->ipaddr, sk); in sctp_transport_update_pmtu()
281 dst->ops->update_pmtu(dst, sk, NULL, pmtu, true); in sctp_transport_update_pmtu()
282 pf->to_sk_daddr(&addr, sk); in sctp_transport_update_pmtu()
288 t->af_specific->get_dst(t, &t->saddr, &t->fl, sk); in sctp_transport_update_pmtu()
289 dst = t->dst; in sctp_transport_update_pmtu()
293 /* Re-fetch, as under layers may have a higher minimum size */ in sctp_transport_update_pmtu()
295 change = t->pathmtu != pmtu; in sctp_transport_update_pmtu()
297 t->pathmtu = pmtu; in sctp_transport_update_pmtu()
308 struct sctp_association *asoc = transport->asoc; in sctp_transport_route()
309 struct sctp_af *af = transport->af_specific; in sctp_transport_route()
312 af->get_dst(transport, saddr, &transport->fl, sctp_opt2sk(opt)); in sctp_transport_route()
315 memcpy(&transport->saddr, saddr, sizeof(union sctp_addr)); in sctp_transport_route()
317 af->get_saddr(opt, transport, &transport->fl); in sctp_transport_route()
321 /* Initialize sk->sk_rcv_saddr, if the transport is the in sctp_transport_route()
324 if (transport->dst && asoc && in sctp_transport_route()
325 (!asoc->peer.primary_path || transport == asoc->peer.active_path)) in sctp_transport_route()
326 opt->pf->to_sk_saddr(&transport->saddr, asoc->base.sk); in sctp_transport_route()
332 return refcount_inc_not_zero(&transport->refcnt); in sctp_transport_hold()
340 if (refcount_dec_and_test(&transport->refcnt)) in sctp_transport_put()
347 if (unlikely(!tp->rto_pending)) in sctp_transport_update_rto()
351 if (tp->rttvar || tp->srtt) { in sctp_transport_update_rto()
352 struct net *net = sock_net(tp->asoc->base.sk); in sctp_transport_update_rto()
354 * RTTVAR <- (1 - RTO.Beta) * RTTVAR + RTO.Beta * |SRTT - R'| in sctp_transport_update_rto()
355 * SRTT <- (1 - RTO.Alpha) * SRTT + RTO.Alpha * R' in sctp_transport_update_rto()
364 tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta) in sctp_transport_update_rto()
365 + (((__u32)abs((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta); in sctp_transport_update_rto()
366 tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha) in sctp_transport_update_rto()
367 + (rtt >> net->sctp.rto_alpha); in sctp_transport_update_rto()
370 * SRTT <- R, RTTVAR <- R/2. in sctp_transport_update_rto()
372 tp->srtt = rtt; in sctp_transport_update_rto()
373 tp->rttvar = rtt >> 1; in sctp_transport_update_rto()
377 * adjust RTTVAR <- G, where G is the CLOCK GRANULARITY. in sctp_transport_update_rto()
379 if (tp->rttvar == 0) in sctp_transport_update_rto()
380 tp->rttvar = SCTP_CLOCK_GRANULARITY; in sctp_transport_update_rto()
382 /* 6.3.1 C3) After the computation, update RTO <- SRTT + 4 * RTTVAR. */ in sctp_transport_update_rto()
383 tp->rto = tp->srtt + (tp->rttvar << 2); in sctp_transport_update_rto()
388 if (tp->rto < tp->asoc->rto_min) in sctp_transport_update_rto()
389 tp->rto = tp->asoc->rto_min; in sctp_transport_update_rto()
394 if (tp->rto > tp->asoc->rto_max) in sctp_transport_update_rto()
395 tp->rto = tp->asoc->rto_max; in sctp_transport_update_rto()
397 sctp_max_rto(tp->asoc, tp); in sctp_transport_update_rto()
398 tp->rtt = rtt; in sctp_transport_update_rto()
403 tp->rto_pending = 0; in sctp_transport_update_rto()
406 __func__, tp, rtt, tp->srtt, tp->rttvar, tp->rto); in sctp_transport_update_rto()
415 struct sctp_association *asoc = transport->asoc; in sctp_transport_raise_cwnd()
418 cwnd = transport->cwnd; in sctp_transport_raise_cwnd()
419 flight_size = transport->flight_size; in sctp_transport_raise_cwnd()
422 if (asoc->fast_recovery && in sctp_transport_raise_cwnd()
423 TSN_lte(asoc->fast_recovery_exit, sack_ctsn)) in sctp_transport_raise_cwnd()
424 asoc->fast_recovery = 0; in sctp_transport_raise_cwnd()
426 ssthresh = transport->ssthresh; in sctp_transport_raise_cwnd()
427 pba = transport->partial_bytes_acked; in sctp_transport_raise_cwnd()
428 pmtu = transport->asoc->pathmtu; in sctp_transport_raise_cwnd()
433 * endpoint MUST use the slow-start algorithm to increase in sctp_transport_raise_cwnd()
435 * utilized, an incoming SACK advances the Cumulative TSN in sctp_transport_raise_cwnd()
443 * against the ACK-Splitting attack outlined in [SAVAGE99]. in sctp_transport_raise_cwnd()
445 if (asoc->fast_recovery) in sctp_transport_raise_cwnd()
470 * acknowledged by the new Cumulative TSN Ack and by Gap in sctp_transport_raise_cwnd()
485 * to (partial_bytes_acked - cwnd). Next, cwnd is in sctp_transport_raise_cwnd()
492 pba = pba - cwnd; in sctp_transport_raise_cwnd()
503 transport->cwnd = cwnd; in sctp_transport_raise_cwnd()
504 transport->partial_bytes_acked = pba; in sctp_transport_raise_cwnd()
513 struct sctp_association *asoc = transport->asoc; in sctp_transport_lower_cwnd()
518 * When the T3-rtx timer expires on an address, SCTP should in sctp_transport_lower_cwnd()
524 transport->ssthresh = max(transport->cwnd/2, in sctp_transport_lower_cwnd()
525 4*asoc->pathmtu); in sctp_transport_lower_cwnd()
526 transport->cwnd = asoc->pathmtu; in sctp_transport_lower_cwnd()
528 /* T3-rtx also clears fast recovery */ in sctp_transport_lower_cwnd()
529 asoc->fast_recovery = 0; in sctp_transport_lower_cwnd()
545 if (asoc->fast_recovery) in sctp_transport_lower_cwnd()
549 asoc->fast_recovery = 1; in sctp_transport_lower_cwnd()
550 asoc->fast_recovery_exit = asoc->next_tsn - 1; in sctp_transport_lower_cwnd()
552 transport->ssthresh = max(transport->cwnd/2, in sctp_transport_lower_cwnd()
553 4*asoc->pathmtu); in sctp_transport_lower_cwnd()
554 transport->cwnd = transport->ssthresh; in sctp_transport_lower_cwnd()
559 * If the sender receives an ECN-Echo ACK packet in sctp_transport_lower_cwnd()
563 * congestion loss in non-ECN Capable TCP. That is, the TCP in sctp_transport_lower_cwnd()
568 * data (or more loosely more than once every round-trip time). in sctp_transport_lower_cwnd()
570 if (time_after(jiffies, transport->last_time_ecne_reduced + in sctp_transport_lower_cwnd()
571 transport->rtt)) { in sctp_transport_lower_cwnd()
572 transport->ssthresh = max(transport->cwnd/2, in sctp_transport_lower_cwnd()
573 4*asoc->pathmtu); in sctp_transport_lower_cwnd()
574 transport->cwnd = transport->ssthresh; in sctp_transport_lower_cwnd()
575 transport->last_time_ecne_reduced = jiffies; in sctp_transport_lower_cwnd()
588 transport->cwnd = max(transport->cwnd/2, in sctp_transport_lower_cwnd()
589 4*asoc->pathmtu); in sctp_transport_lower_cwnd()
591 transport->ssthresh = transport->cwnd; in sctp_transport_lower_cwnd()
595 transport->partial_bytes_acked = 0; in sctp_transport_lower_cwnd()
598 __func__, transport, reason, transport->cwnd, in sctp_transport_lower_cwnd()
599 transport->ssthresh); in sctp_transport_lower_cwnd()
603 * sctpimpguide-05 2.14.2
614 struct sctp_association *asoc = t->asoc; in sctp_transport_burst_limited()
615 u32 old_cwnd = t->cwnd; in sctp_transport_burst_limited()
618 if (t->burst_limited || asoc->max_burst == 0) in sctp_transport_burst_limited()
621 max_burst_bytes = t->flight_size + (asoc->max_burst * asoc->pathmtu); in sctp_transport_burst_limited()
623 t->cwnd = max_burst_bytes; in sctp_transport_burst_limited()
624 t->burst_limited = old_cwnd; in sctp_transport_burst_limited()
633 if (t->burst_limited) { in sctp_transport_burst_reset()
634 t->cwnd = t->burst_limited; in sctp_transport_burst_reset()
635 t->burst_limited = 0; in sctp_transport_burst_reset()
642 /* RTO + timer slack +/- 50% of RTO */ in sctp_transport_timeout()
643 unsigned long timeout = trans->rto >> 1; in sctp_transport_timeout()
645 if (trans->state != SCTP_UNCONFIRMED && in sctp_transport_timeout()
646 trans->state != SCTP_PF) in sctp_transport_timeout()
647 timeout += trans->hbinterval; in sctp_transport_timeout()
655 struct sctp_association *asoc = t->asoc; in sctp_transport_reset()
662 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380)); in sctp_transport_reset()
663 t->burst_limited = 0; in sctp_transport_reset()
664 t->ssthresh = asoc->peer.i.a_rwnd; in sctp_transport_reset()
665 t->rto = asoc->rto_initial; in sctp_transport_reset()
667 t->rtt = 0; in sctp_transport_reset()
668 t->srtt = 0; in sctp_transport_reset()
669 t->rttvar = 0; in sctp_transport_reset()
672 t->partial_bytes_acked = 0; in sctp_transport_reset()
673 t->flight_size = 0; in sctp_transport_reset()
674 t->error_count = 0; in sctp_transport_reset()
675 t->rto_pending = 0; in sctp_transport_reset()
676 t->hb_sent = 0; in sctp_transport_reset()
678 /* Initialize the state information for SFR-CACC */ in sctp_transport_reset()
679 t->cacc.changeover_active = 0; in sctp_transport_reset()
680 t->cacc.cycling_changeover = 0; in sctp_transport_reset()
681 t->cacc.next_tsn_at_change = 0; in sctp_transport_reset()
682 t->cacc.cacc_saw_newack = 0; in sctp_transport_reset()
689 if (del_timer(&t->T3_rtx_timer)) in sctp_transport_immediate_rtx()
692 sctp_retransmit(&t->asoc->outqueue, t, SCTP_RTXR_T3_RTX); in sctp_transport_immediate_rtx()
693 if (!timer_pending(&t->T3_rtx_timer)) { in sctp_transport_immediate_rtx()
694 if (!mod_timer(&t->T3_rtx_timer, jiffies + t->rto)) in sctp_transport_immediate_rtx()
702 dst_release(t->dst); in sctp_transport_dst_release()
703 t->dst = NULL; in sctp_transport_dst_release()
704 t->dst_pending_confirm = 0; in sctp_transport_dst_release()
710 t->dst_pending_confirm = 1; in sctp_transport_dst_confirm()