transport.c (e98bdb3059cbf2b1cd4261e126b08429f64466c3) transport.c (b564d62e67560423965c43d60249a09d8e70a27a)
1/* SCTP kernel implementation
2 * Copyright (c) 1999-2000 Cisco, Inc.
3 * Copyright (c) 1999-2001 Motorola, Inc.
4 * Copyright (c) 2001-2003 International Business Machines Corp.
5 * Copyright (c) 2001 Intel Corp.
6 * Copyright (c) 2001 La Monte H.P. Yarroll
7 *
8 * This file is part of the SCTP kernel implementation

--- 74 unchanged lines hidden (view full) ---

83 peer->pathmaxrxt = net->sctp.max_retrans_path;
84 peer->pf_retrans = net->sctp.pf_retrans;
85
86 INIT_LIST_HEAD(&peer->transmitted);
87 INIT_LIST_HEAD(&peer->send_ready);
88 INIT_LIST_HEAD(&peer->transports);
89
90 setup_timer(&peer->T3_rtx_timer, sctp_generate_t3_rtx_event,
1/* SCTP kernel implementation
2 * Copyright (c) 1999-2000 Cisco, Inc.
3 * Copyright (c) 1999-2001 Motorola, Inc.
4 * Copyright (c) 2001-2003 International Business Machines Corp.
5 * Copyright (c) 2001 Intel Corp.
6 * Copyright (c) 2001 La Monte H.P. Yarroll
7 *
8 * This file is part of the SCTP kernel implementation

--- 74 unchanged lines hidden (view full) ---

83 peer->pathmaxrxt = net->sctp.max_retrans_path;
84 peer->pf_retrans = net->sctp.pf_retrans;
85
86 INIT_LIST_HEAD(&peer->transmitted);
87 INIT_LIST_HEAD(&peer->send_ready);
88 INIT_LIST_HEAD(&peer->transports);
89
90 setup_timer(&peer->T3_rtx_timer, sctp_generate_t3_rtx_event,
91 (unsigned long)peer);
91 (unsigned long)peer);
92 setup_timer(&peer->hb_timer, sctp_generate_heartbeat_event,
92 setup_timer(&peer->hb_timer, sctp_generate_heartbeat_event,
93 (unsigned long)peer);
93 (unsigned long)peer);
94 setup_timer(&peer->reconf_timer, sctp_generate_reconf_event,
95 (unsigned long)peer);
94 setup_timer(&peer->proto_unreach_timer,
95 sctp_generate_proto_unreach_event, (unsigned long)peer);
96
97 /* Initialize the 64-bit random nonce sent with heartbeat. */
98 get_random_bytes(&peer->hb_nonce, sizeof(peer->hb_nonce));
99
100 atomic_set(&peer->refcnt, 1);
101

--- 37 unchanged lines hidden (view full) ---

139 /* Delete the T3_rtx timer if it's active.
140 * There is no point in not doing this now and letting
141 * structure hang around in memory since we know
142 * the tranport is going away.
143 */
144 if (del_timer(&transport->T3_rtx_timer))
145 sctp_transport_put(transport);
146
96 setup_timer(&peer->proto_unreach_timer,
97 sctp_generate_proto_unreach_event, (unsigned long)peer);
98
99 /* Initialize the 64-bit random nonce sent with heartbeat. */
100 get_random_bytes(&peer->hb_nonce, sizeof(peer->hb_nonce));
101
102 atomic_set(&peer->refcnt, 1);
103

--- 37 unchanged lines hidden (view full) ---

141 /* Delete the T3_rtx timer if it's active.
142 * There is no point in not doing this now and letting
143 * structure hang around in memory since we know
144 * the tranport is going away.
145 */
146 if (del_timer(&transport->T3_rtx_timer))
147 sctp_transport_put(transport);
148
149 if (del_timer(&transport->reconf_timer))
150 sctp_transport_put(transport);
151
147 /* Delete the ICMP proto unreachable timer if it's active. */
148 if (del_timer(&transport->proto_unreach_timer))
149 sctp_association_put(transport->asoc);
150
151 sctp_transport_put(transport);
152}
153
154static void sctp_transport_destroy_rcu(struct rcu_head *head)

--- 51 unchanged lines hidden (view full) ---

206 /* When a data chunk is sent, reset the heartbeat interval. */
207 expires = jiffies + sctp_transport_timeout(transport);
208 if (time_before(transport->hb_timer.expires, expires) &&
209 !mod_timer(&transport->hb_timer,
210 expires + prandom_u32_max(transport->rto)))
211 sctp_transport_hold(transport);
212}
213
152 /* Delete the ICMP proto unreachable timer if it's active. */
153 if (del_timer(&transport->proto_unreach_timer))
154 sctp_association_put(transport->asoc);
155
156 sctp_transport_put(transport);
157}
158
159static void sctp_transport_destroy_rcu(struct rcu_head *head)

--- 51 unchanged lines hidden (view full) ---

211 /* When a data chunk is sent, reset the heartbeat interval. */
212 expires = jiffies + sctp_transport_timeout(transport);
213 if (time_before(transport->hb_timer.expires, expires) &&
214 !mod_timer(&transport->hb_timer,
215 expires + prandom_u32_max(transport->rto)))
216 sctp_transport_hold(transport);
217}
218
219void sctp_transport_reset_reconf_timer(struct sctp_transport *transport)
220{
221 if (!timer_pending(&transport->reconf_timer))
222 if (!mod_timer(&transport->reconf_timer,
223 jiffies + transport->rto))
224 sctp_transport_hold(transport);
225}
226
214/* This transport has been assigned to an association.
215 * Initialize fields from the association or from the sock itself.
216 * Register the reference count in the association.
217 */
218void sctp_transport_set_owner(struct sctp_transport *transport,
219 struct sctp_association *asoc)
220{
221 transport->asoc = asoc;
222 sctp_association_hold(asoc);
223}
224
225/* Initialize the pmtu of a transport. */
226void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
227{
228 /* If we don't have a fresh route, look one up */
229 if (!transport->dst || transport->dst->obsolete) {
227/* This transport has been assigned to an association.
228 * Initialize fields from the association or from the sock itself.
229 * Register the reference count in the association.
230 */
231void sctp_transport_set_owner(struct sctp_transport *transport,
232 struct sctp_association *asoc)
233{
234 transport->asoc = asoc;
235 sctp_association_hold(asoc);
236}
237
238/* Initialize the pmtu of a transport. */
239void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
240{
241 /* If we don't have a fresh route, look one up */
242 if (!transport->dst || transport->dst->obsolete) {
230 dst_release(transport->dst);
243 sctp_transport_dst_release(transport);
231 transport->af_specific->get_dst(transport, &transport->saddr,
232 &transport->fl, sk);
233 }
234
235 if (transport->dst) {
236 transport->pathmtu = SCTP_TRUNC4(dst_mtu(transport->dst));
237 } else
238 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;

--- 386 unchanged lines hidden (view full) ---

625 t->burst_limited = 0;
626 t->ssthresh = asoc->peer.i.a_rwnd;
627 t->rto = asoc->rto_initial;
628 sctp_max_rto(asoc, t);
629 t->rtt = 0;
630 t->srtt = 0;
631 t->rttvar = 0;
632
244 transport->af_specific->get_dst(transport, &transport->saddr,
245 &transport->fl, sk);
246 }
247
248 if (transport->dst) {
249 transport->pathmtu = SCTP_TRUNC4(dst_mtu(transport->dst));
250 } else
251 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;

--- 386 unchanged lines hidden (view full) ---

638 t->burst_limited = 0;
639 t->ssthresh = asoc->peer.i.a_rwnd;
640 t->rto = asoc->rto_initial;
641 sctp_max_rto(asoc, t);
642 t->rtt = 0;
643 t->srtt = 0;
644 t->rttvar = 0;
645
633 /* Reset these additional varibles so that we have a clean
634 * slate.
635 */
646 /* Reset these additional variables so that we have a clean slate. */
636 t->partial_bytes_acked = 0;
637 t->flight_size = 0;
638 t->error_count = 0;
639 t->rto_pending = 0;
640 t->hb_sent = 0;
641
642 /* Initialize the state information for SFR-CACC */
643 t->cacc.changeover_active = 0;

--- 10 unchanged lines hidden (view full) ---

654 sctp_transport_put(t);
655
656 sctp_retransmit(&t->asoc->outqueue, t, SCTP_RTXR_T3_RTX);
657 if (!timer_pending(&t->T3_rtx_timer)) {
658 if (!mod_timer(&t->T3_rtx_timer, jiffies + t->rto))
659 sctp_transport_hold(t);
660 }
661}
647 t->partial_bytes_acked = 0;
648 t->flight_size = 0;
649 t->error_count = 0;
650 t->rto_pending = 0;
651 t->hb_sent = 0;
652
653 /* Initialize the state information for SFR-CACC */
654 t->cacc.changeover_active = 0;

--- 10 unchanged lines hidden (view full) ---

665 sctp_transport_put(t);
666
667 sctp_retransmit(&t->asoc->outqueue, t, SCTP_RTXR_T3_RTX);
668 if (!timer_pending(&t->T3_rtx_timer)) {
669 if (!mod_timer(&t->T3_rtx_timer, jiffies + t->rto))
670 sctp_transport_hold(t);
671 }
672}
673
674/* Drop dst */
675void sctp_transport_dst_release(struct sctp_transport *t)
676{
677 dst_release(t->dst);
678 t->dst = NULL;
679 t->dst_pending_confirm = 0;
680}
681
682/* Schedule neighbour confirm */
683void sctp_transport_dst_confirm(struct sctp_transport *t)
684{
685 t->dst_pending_confirm = 1;
686}