Lines Matching refs:transport

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
89 /* Allocate and initialize a new transport. */
94 struct sctp_transport *transport;
96 transport = kzalloc(sizeof(*transport), gfp);
97 if (!transport)
100 if (!sctp_transport_init(net, transport, addr, gfp))
103 SCTP_DBG_OBJCNT_INC(transport);
105 return transport;
108 kfree(transport);
114 /* This transport is no longer needed. Free up if possible, or
117 void sctp_transport_free(struct sctp_transport *transport)
120 if (del_timer(&transport->hb_timer))
121 sctp_transport_put(transport);
128 if (del_timer(&transport->T3_rtx_timer))
129 sctp_transport_put(transport);
131 if (del_timer(&transport->reconf_timer))
132 sctp_transport_put(transport);
135 if (del_timer(&transport->proto_unreach_timer))
136 sctp_transport_put(transport);
138 sctp_transport_put(transport);
143 struct sctp_transport *transport;
145 transport = container_of(head, struct sctp_transport, rcu);
147 dst_release(transport->dst);
148 kfree(transport);
149 SCTP_DBG_OBJCNT_DEC(transport);
152 /* Destroy the transport data structure.
155 static void sctp_transport_destroy(struct sctp_transport *transport)
157 if (unlikely(refcount_read(&transport->refcnt))) {
158 WARN(1, "Attempt to destroy undead transport %p!\n", transport);
162 sctp_packet_free(&transport->packet);
164 if (transport->asoc)
165 sctp_association_put(transport->asoc);
167 call_rcu(&transport->rcu, sctp_transport_destroy_rcu);
173 void sctp_transport_reset_t3_rtx(struct sctp_transport *transport)
183 if (!timer_pending(&transport->T3_rtx_timer))
184 if (!mod_timer(&transport->T3_rtx_timer,
185 jiffies + transport->rto))
186 sctp_transport_hold(transport);
189 void sctp_transport_reset_hb_timer(struct sctp_transport *transport)
194 expires = jiffies + sctp_transport_timeout(transport);
195 if ((time_before(transport->hb_timer.expires, expires) ||
196 !timer_pending(&transport->hb_timer)) &&
197 !mod_timer(&transport->hb_timer,
198 expires + prandom_u32_max(transport->rto)))
199 sctp_transport_hold(transport);
202 void sctp_transport_reset_reconf_timer(struct sctp_transport *transport)
204 if (!timer_pending(&transport->reconf_timer))
205 if (!mod_timer(&transport->reconf_timer,
206 jiffies + transport->rto))
207 sctp_transport_hold(transport);
210 /* This transport has been assigned to an association.
214 void sctp_transport_set_owner(struct sctp_transport *transport,
217 transport->asoc = asoc;
221 /* Initialize the pmtu of a transport. */
222 void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
225 if (!transport->dst || transport->dst->obsolete) {
226 sctp_transport_dst_release(transport);
227 transport->af_specific->get_dst(transport, &transport->saddr,
228 &transport->fl, sk);
231 if (transport->param_flags & SPP_PMTUD_DISABLE) {
232 struct sctp_association *asoc = transport->asoc;
234 if (!transport->pathmtu && asoc && asoc->pathmtu)
235 transport->pathmtu = asoc->pathmtu;
236 if (transport->pathmtu)
240 if (transport->dst)
241 transport->pathmtu = sctp_dst_mtu(transport->dst);
243 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
287 /* Caches the dst entry and source address for a transport's destination
290 void sctp_transport_route(struct sctp_transport *transport,
293 struct sctp_association *asoc = transport->asoc;
294 struct sctp_af *af = transport->af_specific;
296 sctp_transport_dst_release(transport);
297 af->get_dst(transport, saddr, &transport->fl, sctp_opt2sk(opt));
300 memcpy(&transport->saddr, saddr, sizeof(union sctp_addr));
302 af->get_saddr(opt, transport, &transport->fl);
304 sctp_transport_pmtu(transport, sctp_opt2sk(opt));
306 /* Initialize sk->sk_rcv_saddr, if the transport is the
309 if (transport->dst && asoc &&
310 (!asoc->peer.primary_path || transport == asoc->peer.active_path))
311 opt->pf->to_sk_saddr(&transport->saddr, asoc->base.sk);
314 /* Hold a reference to a transport. */
315 int sctp_transport_hold(struct sctp_transport *transport)
317 return refcount_inc_not_zero(&transport->refcnt);
320 /* Release a reference to a transport and clean up
323 void sctp_transport_put(struct sctp_transport *transport)
325 if (refcount_dec_and_test(&transport->refcnt))
326 sctp_transport_destroy(transport);
329 /* Update transport's RTO based on the newly calculated RTT. */
334 pr_debug("%s: rto_pending not set on transport %p!\n", __func__, tp);
390 pr_debug("%s: transport:%p, rtt:%d, srtt:%d rttvar:%d, rto:%ld\n",
394 /* This routine updates the transport's cwnd and partial_bytes_acked
397 void sctp_transport_raise_cwnd(struct sctp_transport *transport,
400 struct sctp_association *asoc = transport->asoc;
403 cwnd = transport->cwnd;
404 flight_size = transport->flight_size;
411 ssthresh = transport->ssthresh;
412 pba = transport->partial_bytes_acked;
413 pmtu = transport->asoc->pathmtu;
446 pr_debug("%s: slow start: transport:%p, bytes_acked:%d, "
448 __func__, transport, bytes_acked, cwnd, ssthresh,
481 pr_debug("%s: congestion avoidance: transport:%p, "
484 transport, bytes_acked, cwnd, ssthresh,
488 transport->cwnd = cwnd;
489 transport->partial_bytes_acked = pba;
492 /* This routine is used to lower the transport's cwnd when congestion is
495 void sctp_transport_lower_cwnd(struct sctp_transport *transport,
498 struct sctp_association *asoc = transport->asoc;
509 transport->ssthresh = max(transport->cwnd/2,
511 transport->cwnd = asoc->pathmtu;
537 transport->ssthresh = max(transport->cwnd/2,
539 transport->cwnd = transport->ssthresh;
555 if (time_after(jiffies, transport->last_time_ecne_reduced +
556 transport->rtt)) {
557 transport->ssthresh = max(transport->cwnd/2,
559 transport->cwnd = transport->ssthresh;
560 transport->last_time_ecne_reduced = jiffies;
567 * transport address, the cwnd of the transport address
573 transport->cwnd = max(transport->cwnd/2,
576 transport->ssthresh = transport->cwnd;
580 transport->partial_bytes_acked = 0;
582 pr_debug("%s: transport:%p, reason:%d, cwnd:%d, ssthresh:%d\n",
583 __func__, transport, reason, transport->cwnd,
584 transport->ssthresh);
624 /* What is the next timeout value for this transport? */
637 /* Reset transport variables to their initial values */
670 /* Schedule retransmission on the given transport */