diff options
author | Ivo Calado <ivocalado@embedded.ufcg.edu.br> | 2010-10-11 14:40:04 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2010-10-12 00:57:42 -0400 |
commit | d196c9a5d4e150cdff675662214c80c69b906958 (patch) | |
tree | 0819ea92cdfe9c2ae9716a3eef920849a98c01b9 /net/dccp/dccp.h | |
parent | baf9e782e1dc4991edecfa3b8700cf8739c40259 (diff) |
dccp: generalise data-loss condition
This patch generalises the task of determining data loss from RFC 4340, 7.7.1.
Let S_A, S_B be sequence numbers such that S_B is "after" S_A, and let
N_B be the NDP count of packet S_B. Then, using modulo-2^48 arithmetic,
D = S_B - S_A - 1 is an upper bound of the number of lost data packets,
D - N_B is an approximation of the number of lost data packets
(there are cases where this is not exact).
The patch implements this as
dccp_loss_count(S_A, S_B, N_B) := max(S_B - S_A - 1 - N_B, 0)
Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/dccp.h')
-rw-r--r-- | net/dccp/dccp.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index e051c774ef5c..60f4f9622ab3 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -153,18 +153,27 @@ static inline u64 max48(const u64 seq1, const u64 seq2) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | /** | 155 | /** |
156 | * dccp_loss_free - Evaluates condition for data loss from RFC 4340, 7.7.1 | 156 | * dccp_loss_count - Approximate the number of lost data packets in a burst loss |
157 | * @s1: start sequence number | 157 | * @s1: last known sequence number before the loss ('hole') |
158 | * @s2: end sequence number | 158 | * @s2: first sequence number seen after the 'hole' |
159 | * @ndp: NDP count on packet with sequence number @s2 | 159 | * @ndp: NDP count on packet with sequence number @s2 |
160 | * Returns true if the sequence range s1...s2 has no data loss. | ||
161 | */ | 160 | */ |
162 | static inline bool dccp_loss_free(const u64 s1, const u64 s2, const u64 ndp) | 161 | static inline u64 dccp_loss_count(const u64 s1, const u64 s2, const u64 ndp) |
163 | { | 162 | { |
164 | s64 delta = dccp_delta_seqno(s1, s2); | 163 | s64 delta = dccp_delta_seqno(s1, s2); |
165 | 164 | ||
166 | WARN_ON(delta < 0); | 165 | WARN_ON(delta < 0); |
167 | return (u64)delta <= ndp + 1; | 166 | delta -= ndp + 1; |
167 | |||
168 | return delta > 0 ? delta : 0; | ||
169 | } | ||
170 | |||
171 | /** | ||
172 | * dccp_loss_free - Evaluate condition for data loss from RFC 4340, 7.7.1 | ||
173 | */ | ||
174 | static inline bool dccp_loss_free(const u64 s1, const u64 s2, const u64 ndp) | ||
175 | { | ||
176 | return dccp_loss_count(s1, s2, ndp) == 0; | ||
168 | } | 177 | } |
169 | 178 | ||
170 | enum { | 179 | enum { |