diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-07-13 06:51:40 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-07-13 06:51:40 -0400 |
commit | 2013c7e35aeba39777f9b3eef8a70207b3931152 (patch) | |
tree | 5d63ce9f8c512ffd17b8084002e6dc0e0f998b84 /net/dccp/dccp.h | |
parent | 79d16385c7f287a33ea771c4dbe60ae43f791b49 (diff) |
dccp ccid-3: Fix error in loss detection
The TFRC loss detection code used the wrong loss condition (RFC 4340, 7.7.1):
* the difference between sequence numbers s1 and s2 instead of
* the number of packets missing between s1 and s2 (one less than the distance).
Since this condition appears in many places of the code, it has been put into a
separate function, dccp_loss_free().
Further changes:
----------------
* tidied up incorrect typing (it was using `int' for u64/s64 types);
* optimised conditional statements for common case of non-reordered packets;
* rewrote comments/documentation to match the changes.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/dccp.h')
-rw-r--r-- | net/dccp/dccp.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 1b2cea244e12..32617e0576cb 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -153,6 +153,21 @@ static inline u64 max48(const u64 seq1, const u64 seq2) | |||
153 | return after48(seq1, seq2) ? seq1 : seq2; | 153 | return after48(seq1, seq2) ? seq1 : seq2; |
154 | } | 154 | } |
155 | 155 | ||
156 | /** | ||
157 | * dccp_loss_free - Evaluates condition for data loss from RFC 4340, 7.7.1 | ||
158 | * @s1: start sequence number | ||
159 | * @s2: end sequence number | ||
160 | * @ndp: NDP count on packet with sequence number @s2 | ||
161 | * Returns true if the sequence range s1...s2 has no data loss. | ||
162 | */ | ||
163 | static inline bool dccp_loss_free(const u64 s1, const u64 s2, const u64 ndp) | ||
164 | { | ||
165 | s64 delta = dccp_delta_seqno(s1, s2); | ||
166 | |||
167 | BUG_TRAP(delta >= 0); | ||
168 | return (u64)delta <= ndp + 1; | ||
169 | } | ||
170 | |||
156 | enum { | 171 | enum { |
157 | DCCP_MIB_NUM = 0, | 172 | DCCP_MIB_NUM = 0, |
158 | DCCP_MIB_ACTIVEOPENS, /* ActiveOpens */ | 173 | DCCP_MIB_ACTIVEOPENS, /* ActiveOpens */ |