Lines Matching defs: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
90 /* Allocate and initialize a new transport. */
95 struct sctp_transport *transport;
97 transport = kzalloc(sizeof(*transport), gfp);
98 if (!transport)
101 if (!sctp_transport_init(net, transport, addr, gfp))
104 SCTP_DBG_OBJCNT_INC(transport);
106 return transport;
109 kfree(transport);
115 /* This transport is no longer needed. Free up if possible, or
118 void sctp_transport_free(struct sctp_transport *transport)
121 if (del_timer(&transport->hb_timer))
122 sctp_transport_put(transport);
127 * the transport is going away.
129 if (del_timer(&transport->T3_rtx_timer))
130 sctp_transport_put(transport);
132 if (del_timer(&transport->reconf_timer))
133 sctp_transport_put(transport);
135 if (del_timer(&transport->probe_timer))
136 sctp_transport_put(transport);
139 if (del_timer(&transport->proto_unreach_timer))
140 sctp_transport_put(transport);
142 sctp_transport_put(transport);
147 struct sctp_transport *transport;
149 transport = container_of(head, struct sctp_transport, rcu);
151 dst_release(transport->dst);
152 kfree(transport);
153 SCTP_DBG_OBJCNT_DEC(transport);
156 /* Destroy the transport data structure.
159 static void sctp_transport_destroy(struct sctp_transport *transport)
161 if (unlikely(refcount_read(&transport->refcnt))) {
162 WARN(1, "Attempt to destroy undead transport %p!\n", transport);
166 sctp_packet_free(&transport->packet);
168 if (transport->asoc)
169 sctp_association_put(transport->asoc);
171 call_rcu(&transport->rcu, sctp_transport_destroy_rcu);
177 void sctp_transport_reset_t3_rtx(struct sctp_transport *transport)
187 if (!timer_pending(&transport->T3_rtx_timer))
188 if (!mod_timer(&transport->T3_rtx_timer,
189 jiffies + transport->rto))
190 sctp_transport_hold(transport);
193 void sctp_transport_reset_hb_timer(struct sctp_transport *transport)
198 expires = jiffies + sctp_transport_timeout(transport);
199 if (!mod_timer(&transport->hb_timer,
200 expires + get_random_u32_below(transport->rto)))
201 sctp_transport_hold(transport);
204 void sctp_transport_reset_reconf_timer(struct sctp_transport *transport)
206 if (!timer_pending(&transport->reconf_timer))
207 if (!mod_timer(&transport->reconf_timer,
208 jiffies + transport->rto))
209 sctp_transport_hold(transport);
212 void sctp_transport_reset_probe_timer(struct sctp_transport *transport)
214 if (!mod_timer(&transport->probe_timer,
215 jiffies + transport->probe_interval))
216 sctp_transport_hold(transport);
219 void sctp_transport_reset_raise_timer(struct sctp_transport *transport)
221 if (!mod_timer(&transport->probe_timer,
222 jiffies + transport->probe_interval * 30))
223 sctp_transport_hold(transport);
226 /* This transport has been assigned to an association.
230 void sctp_transport_set_owner(struct sctp_transport *transport,
233 transport->asoc = asoc;
237 /* Initialize the pmtu of a transport. */
238 void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
241 if (!transport->dst || transport->dst->obsolete) {
242 sctp_transport_dst_release(transport);
243 transport->af_specific->get_dst(transport, &transport->saddr,
244 &transport->fl, sk);
247 if (transport->param_flags & SPP_PMTUD_DISABLE) {
248 struct sctp_association *asoc = transport->asoc;
250 if (!transport->pathmtu && asoc && asoc->pathmtu)
251 transport->pathmtu = asoc->pathmtu;
252 if (transport->pathmtu)
256 if (transport->dst)
257 transport->pathmtu = sctp_dst_mtu(transport->dst);
259 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
261 sctp_transport_pl_update(transport);
303 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n",
310 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n",
355 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, ptb: %d\n",
445 /* Caches the dst entry and source address for a transport's destination
448 void sctp_transport_route(struct sctp_transport *transport,
451 struct sctp_association *asoc = transport->asoc;
452 struct sctp_af *af = transport->af_specific;
454 sctp_transport_dst_release(transport);
455 af->get_dst(transport, saddr, &transport->fl, sctp_opt2sk(opt));
458 memcpy(&transport->saddr, saddr, sizeof(union sctp_addr));
460 af->get_saddr(opt, transport, &transport->fl);
462 sctp_transport_pmtu(transport, sctp_opt2sk(opt));
464 /* Initialize sk->sk_rcv_saddr, if the transport is the
467 if (transport->dst && asoc &&
468 (!asoc->peer.primary_path || transport == asoc->peer.active_path))
469 opt->pf->to_sk_saddr(&transport->saddr, asoc->base.sk);
472 /* Hold a reference to a transport. */
473 int sctp_transport_hold(struct sctp_transport *transport)
475 return refcount_inc_not_zero(&transport->refcnt);
478 /* Release a reference to a transport and clean up
481 void sctp_transport_put(struct sctp_transport *transport)
483 if (refcount_dec_and_test(&transport->refcnt))
484 sctp_transport_destroy(transport);
487 /* Update transport's RTO based on the newly calculated RTT. */
492 pr_debug("%s: rto_pending not set on transport %p!\n", __func__, tp);
548 pr_debug("%s: transport:%p, rtt:%d, srtt:%d rttvar:%d, rto:%ld\n",
552 /* This routine updates the transport's cwnd and partial_bytes_acked
555 void sctp_transport_raise_cwnd(struct sctp_transport *transport,
558 struct sctp_association *asoc = transport->asoc;
561 cwnd = transport->cwnd;
562 flight_size = transport->flight_size;
569 ssthresh = transport->ssthresh;
570 pba = transport->partial_bytes_acked;
571 pmtu = transport->asoc->pathmtu;
604 pr_debug("%s: slow start: transport:%p, bytes_acked:%d, "
606 __func__, transport, bytes_acked, cwnd, ssthresh,
639 pr_debug("%s: congestion avoidance: transport:%p, "
642 transport, bytes_acked, cwnd, ssthresh,
646 transport->cwnd = cwnd;
647 transport->partial_bytes_acked = pba;
650 /* This routine is used to lower the transport's cwnd when congestion is
653 void sctp_transport_lower_cwnd(struct sctp_transport *transport,
656 struct sctp_association *asoc = transport->asoc;
667 transport->ssthresh = max(transport->cwnd/2,
669 transport->cwnd = asoc->pathmtu;
695 transport->ssthresh = max(transport->cwnd/2,
697 transport->cwnd = transport->ssthresh;
713 if (time_after(jiffies, transport->last_time_ecne_reduced +
714 transport->rtt)) {
715 transport->ssthresh = max(transport->cwnd/2,
717 transport->cwnd = transport->ssthresh;
718 transport->last_time_ecne_reduced = jiffies;
725 * transport address, the cwnd of the transport address
731 transport->cwnd = max(transport->cwnd/2,
734 transport->ssthresh = transport->cwnd;
738 transport->partial_bytes_acked = 0;
740 pr_debug("%s: transport:%p, reason:%d, cwnd:%d, ssthresh:%d\n",
741 __func__, transport, reason, transport->cwnd,
742 transport->ssthresh);
782 /* What is the next timeout value for this transport? */
795 /* Reset transport variables to their initial values */
828 /* Schedule retransmission on the given transport */