diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-07-26 06:59:09 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-07-26 06:59:09 -0400 |
commit | 59435444a13ed52d3444c5df26b73d3086bcd57b (patch) | |
tree | 72846dbcb8c6c41e6d630bcb81297801dfe7fb16 /net/dccp/timer.c | |
parent | cdec7e50a4896c5197d5575d9ca635eea6825149 (diff) |
dccp: Allow to distinguish original and retransmitted packets
This patch allows the sender to distinguish original and retransmitted packets,
which is in particular needed for the retransmission of DCCP-Requests:
* the first Request uses ISS (generated in net/dccp/ip*.c), and sets GSS = ISS;
* all retransmitted Requests use GSS' = GSS + 1, so that the n-th retransmitted
Request has sequence number ISS + n (mod 48).
To add generic support, the patch reorganises existing code so that:
* icsk_retransmits == 0 for the original packet and
* icsk_retransmits = n > 0 for the n-th retransmitted packet
at the time dccp_transmit_skb() is called, via dccp_retransmit_skb().
Thanks to Wei Yongjun for pointing this problem out.
Further changes:
----------------
* removed the `skb' argument from dccp_retransmit_skb(), since sk_send_head
is used for all retransmissions (the exception is client-Acks in PARTOPEN
state, but these do not use sk_send_head);
* since sk_send_head always contains the original skb (via dccp_entail()),
skb_cloned() never evaluated to true and thus pskb_copy() was never used.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/timer.c')
-rw-r--r-- | net/dccp/timer.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/net/dccp/timer.c b/net/dccp/timer.c index 6a5b961b6f5c..54b3c7e9e016 100644 --- a/net/dccp/timer.c +++ b/net/dccp/timer.c | |||
@@ -99,21 +99,11 @@ static void dccp_retransmit_timer(struct sock *sk) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * sk->sk_send_head has to have one skb with | ||
103 | * DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP | ||
104 | * packet types. The only packets eligible for retransmission are: | ||
105 | * -- Requests in client-REQUEST state (sec. 8.1.1) | ||
106 | * -- Acks in client-PARTOPEN state (sec. 8.1.5) | ||
107 | * -- CloseReq in server-CLOSEREQ state (sec. 8.3) | ||
108 | * -- Close in node-CLOSING state (sec. 8.3) */ | ||
109 | WARN_ON(sk->sk_send_head == NULL); | ||
110 | |||
111 | /* | ||
112 | * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was | 102 | * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was |
113 | * sent, no need to retransmit, this sock is dead. | 103 | * sent, no need to retransmit, this sock is dead. |
114 | */ | 104 | */ |
115 | if (dccp_write_timeout(sk)) | 105 | if (dccp_write_timeout(sk)) |
116 | goto out; | 106 | return; |
117 | 107 | ||
118 | /* | 108 | /* |
119 | * We want to know the number of packets retransmitted, not the | 109 | * We want to know the number of packets retransmitted, not the |
@@ -122,30 +112,28 @@ static void dccp_retransmit_timer(struct sock *sk) | |||
122 | if (icsk->icsk_retransmits == 0) | 112 | if (icsk->icsk_retransmits == 0) |
123 | DCCP_INC_STATS_BH(DCCP_MIB_TIMEOUTS); | 113 | DCCP_INC_STATS_BH(DCCP_MIB_TIMEOUTS); |
124 | 114 | ||
125 | if (dccp_retransmit_skb(sk, sk->sk_send_head) < 0) { | 115 | if (dccp_retransmit_skb(sk) != 0) { |
126 | /* | 116 | /* |
127 | * Retransmission failed because of local congestion, | 117 | * Retransmission failed because of local congestion, |
128 | * do not backoff. | 118 | * do not backoff. |
129 | */ | 119 | */ |
130 | if (icsk->icsk_retransmits == 0) | 120 | if (--icsk->icsk_retransmits == 0) |
131 | icsk->icsk_retransmits = 1; | 121 | icsk->icsk_retransmits = 1; |
132 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | 122 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, |
133 | min(icsk->icsk_rto, | 123 | min(icsk->icsk_rto, |
134 | TCP_RESOURCE_PROBE_INTERVAL), | 124 | TCP_RESOURCE_PROBE_INTERVAL), |
135 | DCCP_RTO_MAX); | 125 | DCCP_RTO_MAX); |
136 | goto out; | 126 | return; |
137 | } | 127 | } |
138 | 128 | ||
139 | backoff: | 129 | backoff: |
140 | icsk->icsk_backoff++; | 130 | icsk->icsk_backoff++; |
141 | icsk->icsk_retransmits++; | ||
142 | 131 | ||
143 | icsk->icsk_rto = min(icsk->icsk_rto << 1, DCCP_RTO_MAX); | 132 | icsk->icsk_rto = min(icsk->icsk_rto << 1, DCCP_RTO_MAX); |
144 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, | 133 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, |
145 | DCCP_RTO_MAX); | 134 | DCCP_RTO_MAX); |
146 | if (icsk->icsk_retransmits > sysctl_dccp_retries1) | 135 | if (icsk->icsk_retransmits > sysctl_dccp_retries1) |
147 | __sk_dst_reset(sk); | 136 | __sk_dst_reset(sk); |
148 | out:; | ||
149 | } | 137 | } |
150 | 138 | ||
151 | static void dccp_write_timer(unsigned long data) | 139 | static void dccp_write_timer(unsigned long data) |