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
120 transport->dead = 1; in sctp_transport_free()
123 if (del_timer(&transport->hb_timer)) in sctp_transport_free()
124 sctp_transport_put(transport); in sctp_transport_free()
129 * the transport is going away. in sctp_transport_free()
131 if (del_timer(&transport->T3_rtx_timer)) in sctp_transport_free()
132 sctp_transport_put(transport); in sctp_transport_free()
134 if (del_timer(&transport->reconf_timer)) in sctp_transport_free()
135 sctp_transport_put(transport); in sctp_transport_free()
137 if (del_timer(&transport->probe_timer)) in sctp_transport_free()
138 sctp_transport_put(transport); in sctp_transport_free()
141 if (del_timer(&transport->proto_unreach_timer)) in sctp_transport_free()
142 sctp_transport_put(transport); in sctp_transport_free()
144 sctp_transport_put(transport); in sctp_transport_free()
149 struct sctp_transport *transport; in sctp_transport_destroy_rcu() local
151 transport = container_of(head, struct sctp_transport, rcu); in sctp_transport_destroy_rcu()
153 dst_release(transport->dst); in sctp_transport_destroy_rcu()
154 kfree(transport); in sctp_transport_destroy_rcu()
155 SCTP_DBG_OBJCNT_DEC(transport); in sctp_transport_destroy_rcu()
158 /* Destroy the transport data structure.
161 static void sctp_transport_destroy(struct sctp_transport *transport) in sctp_transport_destroy() argument
163 if (unlikely(refcount_read(&transport->refcnt))) { in sctp_transport_destroy()
164 WARN(1, "Attempt to destroy undead transport %p!\n", transport); in sctp_transport_destroy()
168 sctp_packet_free(&transport->packet); in sctp_transport_destroy()
170 if (transport->asoc) in sctp_transport_destroy()
171 sctp_association_put(transport->asoc); in sctp_transport_destroy()
173 call_rcu(&transport->rcu, sctp_transport_destroy_rcu); in sctp_transport_destroy()
179 void sctp_transport_reset_t3_rtx(struct sctp_transport *transport) in sctp_transport_reset_t3_rtx() argument
189 if (!timer_pending(&transport->T3_rtx_timer)) in sctp_transport_reset_t3_rtx()
190 if (!mod_timer(&transport->T3_rtx_timer, in sctp_transport_reset_t3_rtx()
191 jiffies + transport->rto)) in sctp_transport_reset_t3_rtx()
192 sctp_transport_hold(transport); in sctp_transport_reset_t3_rtx()
195 void sctp_transport_reset_hb_timer(struct sctp_transport *transport) in sctp_transport_reset_hb_timer() argument
200 expires = jiffies + sctp_transport_timeout(transport); in sctp_transport_reset_hb_timer()
201 if (!mod_timer(&transport->hb_timer, in sctp_transport_reset_hb_timer()
202 expires + get_random_u32_below(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 (!mod_timer(&transport->probe_timer, in sctp_transport_reset_probe_timer()
217 jiffies + transport->probe_interval)) in sctp_transport_reset_probe_timer()
218 sctp_transport_hold(transport); in sctp_transport_reset_probe_timer()
221 void sctp_transport_reset_raise_timer(struct sctp_transport *transport) in sctp_transport_reset_raise_timer() argument
223 if (!mod_timer(&transport->probe_timer, in sctp_transport_reset_raise_timer()
224 jiffies + transport->probe_interval * 30)) in sctp_transport_reset_raise_timer()
225 sctp_transport_hold(transport); in sctp_transport_reset_raise_timer()
228 /* This transport has been assigned to an association.
232 void sctp_transport_set_owner(struct sctp_transport *transport, in sctp_transport_set_owner() argument
235 transport->asoc = asoc; in sctp_transport_set_owner()
239 /* Initialize the pmtu of a transport. */
240 void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) in sctp_transport_pmtu() argument
243 if (!transport->dst || transport->dst->obsolete) { in sctp_transport_pmtu()
244 sctp_transport_dst_release(transport); in sctp_transport_pmtu()
245 transport->af_specific->get_dst(transport, &transport->saddr, in sctp_transport_pmtu()
246 &transport->fl, sk); in sctp_transport_pmtu()
249 if (transport->param_flags & SPP_PMTUD_DISABLE) { in sctp_transport_pmtu()
250 struct sctp_association *asoc = transport->asoc; in sctp_transport_pmtu()
252 if (!transport->pathmtu && asoc && asoc->pathmtu) in sctp_transport_pmtu()
253 transport->pathmtu = asoc->pathmtu; in sctp_transport_pmtu()
254 if (transport->pathmtu) in sctp_transport_pmtu()
258 if (transport->dst) in sctp_transport_pmtu()
259 transport->pathmtu = sctp_dst_mtu(transport->dst); in sctp_transport_pmtu()
261 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; in sctp_transport_pmtu()
263 sctp_transport_pl_update(transport); in sctp_transport_pmtu()
305 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n", in sctp_transport_pl_send()
312 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n", in sctp_transport_pl_recv()
357 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 */