From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: davem@davemloft.net
Cc: dccp@vger.kernel.org, netdev@vger.kernel.org,
Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Subject: [PATCH 4/6] dccp: generalise data-loss condition
Date: Tue, 12 Oct 2010 07:15:49 +0200 [thread overview]
Message-ID: <1286860551-6809-5-git-send-email-gerrit@erg.abdn.ac.uk> (raw)
In-Reply-To: <1286860551-6809-4-git-send-email-gerrit@erg.abdn.ac.uk>
From: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
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>
---
net/dccp/dccp.h | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -153,18 +153,27 @@ static inline u64 max48(const u64 seq1, const u64 seq2)
}
/**
- * dccp_loss_free - Evaluates condition for data loss from RFC 4340, 7.7.1
- * @s1: start sequence number
- * @s2: end sequence number
+ * dccp_loss_count - Approximate the number of lost data packets in a burst loss
+ * @s1: last known sequence number before the loss ('hole')
+ * @s2: first sequence number seen after the 'hole'
* @ndp: NDP count on packet with sequence number @s2
- * Returns true if the sequence range s1...s2 has no data loss.
*/
-static inline bool dccp_loss_free(const u64 s1, const u64 s2, const u64 ndp)
+static inline u64 dccp_loss_count(const u64 s1, const u64 s2, const u64 ndp)
{
s64 delta = dccp_delta_seqno(s1, s2);
WARN_ON(delta < 0);
- return (u64)delta <= ndp + 1;
+ delta -= ndp + 1;
+
+ return delta > 0 ? delta : 0;
+}
+
+/**
+ * dccp_loss_free - Evaluate condition for data loss from RFC 4340, 7.7.1
+ */
+static inline bool dccp_loss_free(const u64 s1, const u64 s2, const u64 ndp)
+{
+ return dccp_loss_count(s1, s2, ndp) == 0;
}
enum {
next prev parent reply other threads:[~2010-10-12 5:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <dccp_misc_fixes_and_helper_functions___a_set_of_six_patches_sent_today>
2010-10-12 5:15 ` net-next-2.6 [PATCH 0/6] dccp: miscellaneous fixes and helper functions Gerrit Renker
2010-10-12 5:15 ` [PATCH 1/6] dccp: fix the adjustments to AWL and SWL Gerrit Renker
2010-10-12 5:15 ` [PATCH 2/6] dccp: merge now-reduced connect_init() function Gerrit Renker
2010-10-12 5:15 ` [PATCH 3/6] dccp: remove unused argument in CCID tx function Gerrit Renker
2010-10-12 5:15 ` Gerrit Renker [this message]
2010-10-12 5:15 ` [PATCH 5/6] dccp: schedule an Ack when receiving timestamps Gerrit Renker
2010-10-12 5:15 ` [PATCH 6/6] dccp: cosmetics - warning format Gerrit Renker
2010-10-12 18:45 ` net-next-2.6 [PATCH 0/6] dccp: miscellaneous fixes and helper functions David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1286860551-6809-5-git-send-email-gerrit@erg.abdn.ac.uk \
--to=gerrit@erg.abdn.ac.uk \
--cc=davem@davemloft.net \
--cc=dccp@vger.kernel.org \
--cc=ivocalado@embedded.ufcg.edu.br \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).