Lines Matching full:transport

11  * This module provides the abstraction for an SCTP transport representing
12 * a remote transport address. For local transport addresses, we just use
39 /* Initialize a new transport from provided memory. */
55 * given destination transport address, set RTO to the protocol in sctp_transport_init()
90 /* Allocate and initialize a new transport. */
95 struct sctp_transport *transport; in sctp_transport_new() local
97 transport = kzalloc(sizeof(*transport), gfp); in sctp_transport_new()
98 if (!transport) in sctp_transport_new()
101 if (!sctp_transport_init(net, transport, addr, gfp)) in sctp_transport_new()
104 SCTP_DBG_OBJCNT_INC(transport); in sctp_transport_new()
106 return transport; in sctp_transport_new()
109 kfree(transport); in sctp_transport_new()
115 /* This transport is no longer needed. Free up if possible, or
118 void sctp_transport_free(struct sctp_transport *transport) in sctp_transport_free() argument
121 if (del_timer(&transport->hb_timer)) in sctp_transport_free()
122 sctp_transport_put(transport); in sctp_transport_free()
127 * the transport is going away. in sctp_transport_free()
129 if (del_timer(&transport->T3_rtx_timer)) in sctp_transport_free()
130 sctp_transport_put(transport); in sctp_transport_free()
132 if (del_timer(&transport->reconf_timer)) in sctp_transport_free()
133 sctp_transport_put(transport); in sctp_transport_free()
135 if (del_timer(&transport->probe_timer)) in sctp_transport_free()
136 sctp_transport_put(transport); in sctp_transport_free()
139 if (del_timer(&transport->proto_unreach_timer)) in sctp_transport_free()
140 sctp_transport_put(transport); in sctp_transport_free()
142 sctp_transport_put(transport); in sctp_transport_free()
147 struct sctp_transport *transport; in sctp_transport_destroy_rcu() local
149 transport = container_of(head, struct sctp_transport, rcu); in sctp_transport_destroy_rcu()
151 dst_release(transport->dst); in sctp_transport_destroy_rcu()
152 kfree(transport); in sctp_transport_destroy_rcu()
153 SCTP_DBG_OBJCNT_DEC(transport); in sctp_transport_destroy_rcu()
156 /* Destroy the transport data structure.
159 static void sctp_transport_destroy(struct sctp_transport *transport) in sctp_transport_destroy() argument
161 if (unlikely(refcount_read(&transport->refcnt))) { in sctp_transport_destroy()
162 WARN(1, "Attempt to destroy undead transport %p!\n", transport); in sctp_transport_destroy()
166 sctp_packet_free(&transport->packet); in sctp_transport_destroy()
168 if (transport->asoc) in sctp_transport_destroy()
169 sctp_association_put(transport->asoc); in sctp_transport_destroy()
171 call_rcu(&transport->rcu, sctp_transport_destroy_rcu); in sctp_transport_destroy()
177 void sctp_transport_reset_t3_rtx(struct sctp_transport *transport) in sctp_transport_reset_t3_rtx() argument
187 if (!timer_pending(&transport->T3_rtx_timer)) in sctp_transport_reset_t3_rtx()
188 if (!mod_timer(&transport->T3_rtx_timer, in sctp_transport_reset_t3_rtx()
189 jiffies + transport->rto)) in sctp_transport_reset_t3_rtx()
190 sctp_transport_hold(transport); in sctp_transport_reset_t3_rtx()
193 void sctp_transport_reset_hb_timer(struct sctp_transport *transport) in sctp_transport_reset_hb_timer() argument
198 expires = jiffies + sctp_transport_timeout(transport); in sctp_transport_reset_hb_timer()
199 if ((time_before(transport->hb_timer.expires, expires) || in sctp_transport_reset_hb_timer()
200 !timer_pending(&transport->hb_timer)) && in sctp_transport_reset_hb_timer()
201 !mod_timer(&transport->hb_timer, in sctp_transport_reset_hb_timer()
202 expires + prandom_u32_max(transport->rto))) in sctp_transport_reset_hb_timer()
203 sctp_transport_hold(transport); in sctp_transport_reset_hb_timer()
206 void sctp_transport_reset_reconf_timer(struct sctp_transport *transport) in sctp_transport_reset_reconf_timer() argument
208 if (!timer_pending(&transport->reconf_timer)) in sctp_transport_reset_reconf_timer()
209 if (!mod_timer(&transport->reconf_timer, in sctp_transport_reset_reconf_timer()
210 jiffies + transport->rto)) in sctp_transport_reset_reconf_timer()
211 sctp_transport_hold(transport); in sctp_transport_reset_reconf_timer()
214 void sctp_transport_reset_probe_timer(struct sctp_transport *transport) in sctp_transport_reset_probe_timer() argument
216 if (timer_pending(&transport->probe_timer)) in sctp_transport_reset_probe_timer()
218 if (!mod_timer(&transport->probe_timer, in sctp_transport_reset_probe_timer()
219 jiffies + transport->probe_interval)) in sctp_transport_reset_probe_timer()
220 sctp_transport_hold(transport); in sctp_transport_reset_probe_timer()
223 /* This transport has been assigned to an association.
227 void sctp_transport_set_owner(struct sctp_transport *transport, in sctp_transport_set_owner() argument
230 transport->asoc = asoc; in sctp_transport_set_owner()
234 /* Initialize the pmtu of a transport. */
235 void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) in sctp_transport_pmtu() argument
238 if (!transport->dst || transport->dst->obsolete) { in sctp_transport_pmtu()
239 sctp_transport_dst_release(transport); in sctp_transport_pmtu()
240 transport->af_specific->get_dst(transport, &transport->saddr, in sctp_transport_pmtu()
241 &transport->fl, sk); in sctp_transport_pmtu()
244 if (transport->param_flags & SPP_PMTUD_DISABLE) { in sctp_transport_pmtu()
245 struct sctp_association *asoc = transport->asoc; in sctp_transport_pmtu()
247 if (!transport->pathmtu && asoc && asoc->pathmtu) in sctp_transport_pmtu()
248 transport->pathmtu = asoc->pathmtu; in sctp_transport_pmtu()
249 if (transport->pathmtu) in sctp_transport_pmtu()
253 if (transport->dst) in sctp_transport_pmtu()
254 transport->pathmtu = sctp_dst_mtu(transport->dst); in sctp_transport_pmtu()
256 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; in sctp_transport_pmtu()
258 sctp_transport_pl_update(transport); in sctp_transport_pmtu()
307 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n", in sctp_transport_pl_send()
316 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n", in sctp_transport_pl_recv()
359 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, ptb: %d\n", in sctp_transport_pl_toobig()
447 /* Caches the dst entry and source address for a transport's destination
450 void sctp_transport_route(struct sctp_transport *transport, in sctp_transport_route() argument
453 struct sctp_association *asoc = transport->asoc; in sctp_transport_route()
454 struct sctp_af *af = transport->af_specific; in sctp_transport_route()
456 sctp_transport_dst_release(transport); in sctp_transport_route()
457 af->get_dst(transport, saddr, &transport->fl, sctp_opt2sk(opt)); in sctp_transport_route()
460 memcpy(&transport->saddr, saddr, sizeof(union sctp_addr)); in sctp_transport_route()
462 af->get_saddr(opt, transport, &transport->fl); in sctp_transport_route()
464 sctp_transport_pmtu(transport, sctp_opt2sk(opt)); in sctp_transport_route()
466 /* Initialize sk->sk_rcv_saddr, if the transport is the in sctp_transport_route()
469 if (transport->dst && asoc && in sctp_transport_route()
470 (!asoc->peer.primary_path || transport == asoc->peer.active_path)) in sctp_transport_route()
471 opt->pf->to_sk_saddr(&transport->saddr, asoc->base.sk); in sctp_transport_route()
474 /* Hold a reference to a transport. */
475 int sctp_transport_hold(struct sctp_transport *transport) in sctp_transport_hold() argument
477 return refcount_inc_not_zero(&transport->refcnt); in sctp_transport_hold()
480 /* Release a reference to a transport and clean up
483 void sctp_transport_put(struct sctp_transport *transport) in sctp_transport_put() argument
485 if (refcount_dec_and_test(&transport->refcnt)) in sctp_transport_put()
486 sctp_transport_destroy(transport); in sctp_transport_put()
489 /* Update transport's RTO based on the newly calculated RTT. */
494 pr_debug("%s: rto_pending not set on transport %p!\n", __func__, tp); in sctp_transport_update_rto()
550 pr_debug("%s: transport:%p, rtt:%d, srtt:%d rttvar:%d, rto:%ld\n", in sctp_transport_update_rto()
554 /* This routine updates the transport's cwnd and partial_bytes_acked
557 void sctp_transport_raise_cwnd(struct sctp_transport *transport, in sctp_transport_raise_cwnd() argument
560 struct sctp_association *asoc = transport->asoc; in sctp_transport_raise_cwnd()
563 cwnd = transport->cwnd; in sctp_transport_raise_cwnd()
564 flight_size = transport->flight_size; in sctp_transport_raise_cwnd()
571 ssthresh = transport->ssthresh; in sctp_transport_raise_cwnd()
572 pba = transport->partial_bytes_acked; in sctp_transport_raise_cwnd()
573 pmtu = transport->asoc->pathmtu; in sctp_transport_raise_cwnd()
606 pr_debug("%s: slow start: transport:%p, bytes_acked:%d, " in sctp_transport_raise_cwnd()
608 __func__, transport, bytes_acked, cwnd, ssthresh, in sctp_transport_raise_cwnd()
641 pr_debug("%s: congestion avoidance: transport:%p, " in sctp_transport_raise_cwnd()
644 transport, bytes_acked, cwnd, ssthresh, in sctp_transport_raise_cwnd()
648 transport->cwnd = cwnd; in sctp_transport_raise_cwnd()
649 transport->partial_bytes_acked = pba; in sctp_transport_raise_cwnd()
652 /* This routine is used to lower the transport's cwnd when congestion is
655 void sctp_transport_lower_cwnd(struct sctp_transport *transport, in sctp_transport_lower_cwnd() argument
658 struct sctp_association *asoc = transport->asoc; in sctp_transport_lower_cwnd()
669 transport->ssthresh = max(transport->cwnd/2, in sctp_transport_lower_cwnd()
671 transport->cwnd = asoc->pathmtu; in sctp_transport_lower_cwnd()
697 transport->ssthresh = max(transport->cwnd/2, in sctp_transport_lower_cwnd()
699 transport->cwnd = transport->ssthresh; in sctp_transport_lower_cwnd()
715 if (time_after(jiffies, transport->last_time_ecne_reduced + in sctp_transport_lower_cwnd()
716 transport->rtt)) { in sctp_transport_lower_cwnd()
717 transport->ssthresh = max(transport->cwnd/2, in sctp_transport_lower_cwnd()
719 transport->cwnd = transport->ssthresh; in sctp_transport_lower_cwnd()
720 transport->last_time_ecne_reduced = jiffies; in sctp_transport_lower_cwnd()
727 * transport address, the cwnd of the transport address in sctp_transport_lower_cwnd()
733 transport->cwnd = max(transport->cwnd/2, in sctp_transport_lower_cwnd()
736 transport->ssthresh = transport->cwnd; in sctp_transport_lower_cwnd()
740 transport->partial_bytes_acked = 0; in sctp_transport_lower_cwnd()
742 pr_debug("%s: transport:%p, reason:%d, cwnd:%d, ssthresh:%d\n", in sctp_transport_lower_cwnd()
743 __func__, transport, reason, transport->cwnd, in sctp_transport_lower_cwnd()
744 transport->ssthresh); in sctp_transport_lower_cwnd()
784 /* What is the next timeout value for this transport? */
797 /* Reset transport variables to their initial values */
830 /* Schedule retransmission on the given transport */