All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] Implement loss counting on TFRC-SP receiver
@ 2009-09-02  2:44 ` Ivo Calado
  0 siblings, 0 replies; 26+ messages in thread
From: Ivo Calado @ 2009-09-02  2:44 UTC (permalink / raw)
  To: dccp

Implement loss counting on TFRC-SP receiver. Consider transmission's
hole size as loss count.

Changes:
 - Adds field li_losses to tfrc_loss_interval to track loss count per interval
 - Adds field num_losses to tfrc_rx_hist, used to store loss count per
loss event
 - Adds dccp_loss_count function to net/dccp/dccp.h, responsible for
loss count using sequence numbers

Signed-off-by: Ivo Calado, Erivaldo Xavier, Leandro Sales
<ivocalado@embedded.ufcg.edu.br>, <desadoc@gmail.com>,
<leandroal@gmail.com>

Index: b/net/dccp/ccids/lib/loss_interval_sp.c
=================================--- a/net/dccp/ccids/lib/loss_interval_sp.c     2009-08-26
21:50:23.000000000 -0300
+++ b/net/dccp/ccids/lib/loss_interval_sp.c     2009-08-26
22:51:32.000000000 -0300
@@ -184,6 +184,7 @@
               s64 len = dccp_delta_seqno(cur->li_seqno, cong_evt_seqno);
               if ((len <= 0)||(!tfrc_lh_closed_check(cur,
cong_evt->tfrchrx_ccval)))
               {
+                       cur->li_losses += rh->num_losses;
                       return false;
               }

@@ -201,6 +202,7 @@
       cur->li_seqno     = cong_evt_seqno;
       cur->li_ccval     = cong_evt->tfrchrx_ccval;
       cur->li_is_closed = false;
+       cur->li_losses    = rh->num_losses;

       if (++lh->counter = 1)
               lh->i_mean = cur->li_length = (*calc_first_li)(sk);
Index: b/net/dccp/ccids/lib/loss_interval_sp.h
=================================--- a/net/dccp/ccids/lib/loss_interval_sp.h     2009-08-26
21:30:11.000000000 -0300
+++ b/net/dccp/ccids/lib/loss_interval_sp.h     2009-08-26
22:52:20.000000000 -0300
@@ -30,12 +30,14 @@
 *  @li_ccval:         The CCVal belonging to @li_seqno
 *  @li_is_closed:     Whether @li_seqno is older than 1 RTT
 *  @li_length:                Loss interval sequence length
+ *  @li_losses:        Number of losses counted on this interval
 */
 struct tfrc_loss_interval {
       u64              li_seqno:48,
                        li_ccval:4,
                        li_is_closed:1;
       u32              li_length;
+       u32              li_losses;
 };

 /**
Index: b/net/dccp/ccids/lib/packet_history_sp.c
=================================--- a/net/dccp/ccids/lib/packet_history_sp.c    2009-08-26
21:46:36.000000000 -0300
+++ b/net/dccp/ccids/lib/packet_history_sp.c    2009-08-26
22:55:01.000000000 -0300
@@ -236,6 +236,7 @@
       if (likely(dccp_delta_seqno(s2, s3) > 0)) {     /* S2  <  S3 */
               h->loss_count = 3;
               tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h,
3), skb, n3);
+               h->num_losses = dccp_loss_count(s2, s3, n3);
               return 1;
       }

@@ -248,6 +249,7 @@
               tfrc_rx_hist_swap(h, 2, 3);
               tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h,
2), skb, n3);
               h->loss_count = 3;
+               h->num_losses = dccp_loss_count(s1, s3, n3);
               return 1;
       }

@@ -283,6 +285,7 @@
       h->loss_start = tfrc_rx_hist_index(h, 3);
       tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 1), skb, n3);
       h->loss_count = 3;
+       h->num_losses = dccp_loss_count(s0, s3, n3);

       return 1;
 }
Index: b/net/dccp/ccids/lib/packet_history_sp.h
=================================--- a/net/dccp/ccids/lib/packet_history_sp.h    2009-08-26
21:40:55.000000000 -0300
+++ b/net/dccp/ccids/lib/packet_history_sp.h    2009-08-26
22:55:58.000000000 -0300
@@ -101,6 +101,7 @@
 * @packet_size:       Packet size in bytes (as per RFC 3448, 3.1)
 * @bytes_recvd:       Number of bytes received since @bytes_start
 * @bytes_start:       Start time for counting @bytes_recvd
+ * @num_losses:        Number of losses contained on this loss event
 */
 struct tfrc_rx_hist {
       struct tfrc_rx_hist_entry *ring[TFRC_NDUPACK + 1];
@@ -113,6 +114,7 @@
       u32                       packet_size,
                                 bytes_recvd;
       ktime_t                   bytes_start;
+       u8                        num_losses;
 };

 /**
Index: b/net/dccp/dccp.h
=================================--- a/net/dccp/dccp.h   2009-08-25 20:21:45.000000000 -0300
+++ b/net/dccp/dccp.h   2009-08-26 22:59:10.000000000 -0300
@@ -168,6 +168,21 @@
       return (u64)delta <= ndp + 1;
 }

+static inline u64 dccp_loss_count(const u64 s1, const u64 s2, const u64 ndp)
+{
+       s64 delta, count;
+
+       delta = dccp_delta_seqno(s1, s2);
+       WARN_ON(delta < 0);
+
+       count = ndp + 1;
+       count -= delta;
+
+       count = (count > 0)? count: 0;
+
+       return (u64) count;
+}
+
 enum {
       DCCP_MIB_NUM = 0,
       DCCP_MIB_ACTIVEOPENS,                   /* ActiveOpens */

^ permalink raw reply	[flat|nested] 26+ messages in thread
* [PATCHv2 2/4] Implement loss counting on TFRC-SP receiver
@ 2009-10-13 17:18 ` Ivo Calado
  0 siblings, 0 replies; 26+ messages in thread
From: Ivo Calado @ 2009-10-13 17:18 UTC (permalink / raw)
  To: dccp

Implement loss counting on TFRC-SP receiver. Consider transmission's hole size as loss count.

Changes:
 - Adds field li_losses to tfrc_loss_interval to track loss count per interval
 - Adds field num_losses to tfrc_rx_hist, used to store loss count per loss event
 - Adds dccp_loss_count function to net/dccp/dccp.h, responsible for loss count using sequence numbers

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>

Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c
=================================--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:54:16.819408361 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:07.439908552 -0300
@@ -183,8 +183,11 @@
 		if (len <= 0)
 			return false;
 
-		if (!tfrc_lh_closed_check(cur, cong_evt->tfrchrx_ccval))
+		if (!tfrc_lh_closed_check(cur, cong_evt->tfrchrx_ccval)) {
+			cur->li_losses += rh->num_losses;
+			rh->num_losses = 0;
 			return false;
+		}
 
 		/* RFC 5348, 5.3: length between subsequent intervals */
 		cur->li_length = len;
@@ -200,6 +203,8 @@
 	cur->li_seqno	  = cong_evt_seqno;
 	cur->li_ccval	  = cong_evt->tfrchrx_ccval;
 	cur->li_is_closed = false;
+	cur->li_losses    = rh->num_losses;
+	rh->num_losses = 0;
 
 	if (++lh->counter = 1)
 		lh->i_mean = cur->li_length = (*calc_first_li)(sk);
Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h
=================================--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:54:16.838907787 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:07.439908552 -0300
@@ -30,12 +30,14 @@
  *  @li_ccval:		The CCVal belonging to @li_seqno
  *  @li_is_closed:	Whether @li_seqno is older than 1 RTT
  *  @li_length:		Loss interval sequence length
+ *  @li_losses:        Number of losses counted on this interval
  */
 struct tfrc_loss_interval {
 	u64		 li_seqno:48,
 			 li_ccval:4,
 			 li_is_closed:1;
 	u32		 li_length;
+	u32              li_losses;
 };
 
 /**
Index: dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.h
=================================--- dccp_tree_work03.orig/net/dccp/ccids/lib/packet_history_sp.h	2009-10-08 22:58:53.134907870 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.h	2009-10-08 22:59:07.439908552 -0300
@@ -104,6 +104,7 @@
  * @packet_size:	Packet size in bytes (as per RFC 3448, 3.1)
  * @bytes_recvd:	Number of bytes received since @bytes_start
  * @bytes_start:	Start time for counting @bytes_recvd
+ * @num_losses:		Number of losses detected
  */
 struct tfrc_rx_hist {
 	struct tfrc_rx_hist_entry *ring[TFRC_NDUPACK + 1];
@@ -116,6 +117,7 @@
 	u32			  packet_size,
 				  bytes_recvd;
 	ktime_t			  bytes_start;
+	u64			  num_losses;
 };
 
 /**
Index: dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.c
=================================--- dccp_tree_work03.orig/net/dccp/ccids/lib/packet_history_sp.c	2009-10-08 22:58:21.418908270 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.c	2009-10-08 22:59:07.442411383 -0300
@@ -243,6 +243,7 @@
 {
 	u64 s0 = tfrc_rx_hist_loss_prev(h)->tfrchrx_seqno,
 	    s1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_seqno,
+	    n1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_ndp,
 	    s2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_seqno,
 	    s3 = DCCP_SKB_CB(skb)->dccpd_seq;
 
@@ -250,6 +251,7 @@
 		h->loss_count = 3;
 		tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 3),
 					       skb, n3);
+		h->num_losses = dccp_loss_count(s0, s1, n1);
 		return 1;
 	}
 
@@ -263,6 +265,7 @@
 		tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 2),
 					       skb, n3);
 		h->loss_count = 3;
+		h->num_losses = dccp_loss_count(s0, s1, n1);
 		return 1;
 	}
 
@@ -299,6 +302,7 @@
 	h->loss_start = tfrc_rx_hist_index(h, 3);
 	tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 1), skb, n3);
 	h->loss_count = 3;
+	h->num_losses = dccp_loss_count(s0, s3, n3);
 
 	return 1;
 }
Index: dccp_tree_work03/net/dccp/dccp.h
=================================--- dccp_tree_work03.orig/net/dccp/dccp.h	2009-10-08 22:54:16.858907920 -0300
+++ dccp_tree_work03/net/dccp/dccp.h	2009-10-08 22:59:07.442411383 -0300
@@ -154,6 +154,22 @@
 }
 
 /**
+ * dccp_loss_count - Approximate the number of data packets lost in a row
+ * @s1:   last known sequence number before the loss ('hole')
+ * @s2:   first sequence number seen after the 'hole'
+ * @ndp:  ndp count associated with packet having sequence number @s2
+ */
+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);
+       delta -= ndp + 1;
+
+       return delta > 0 ? delta : 0;
+}
+
+/**
  * dccp_loss_free  -  Evaluates condition for data loss from RFC 4340, 7.7.1
  * @s1:	 start sequence number
  * @s2:  end sequence number
@@ -162,10 +178,7 @@
  */
 static inline bool dccp_loss_free(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;
+       return dccp_loss_count(s1, s2, ndp) = 0;
 }
 
 enum {


^ permalink raw reply	[flat|nested] 26+ messages in thread
* dccp-test-tree [PATCH 1/1]: Count lost data packets in a burst loss
  2009-10-13 17:18 ` Ivo Calado
@ 2009-10-19  5:16 ` Gerrit Renker
  -1 siblings, 0 replies; 26+ messages in thread
From: Gerrit Renker @ 2009-10-19  5:16 UTC (permalink / raw)
  To: dccp

dccp: Generalise data-loss condition

This patch is thanks to Ivo Calado who had integrated this function into one
of the TFRC-SP patches.

It generalises the task of determining data loss from RFC 43430, 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 module-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: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/dccp.h |   21 +++++++++++++++------
 1 file 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, 
 }
 
 /**
- * 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 {

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: dccp-test-tree [PATCH 1/1]: Count lost data packets in a burst
  2009-10-19  5:16 ` Gerrit Renker
@ 2009-11-06  0:16 ` Ivo Calado
  -1 siblings, 0 replies; 26+ messages in thread
From: Ivo Calado @ 2009-11-06  0:16 UTC (permalink / raw)
  To: dccp

On Mon, Oct 19, 2009 at 02:16, Gerrit Renker <gerrit@erg.abdn.ac.uk> wrote:
> dccp: Generalise data-loss condition
>
> This patch is thanks to Ivo Calado who had integrated this function into one
> of the TFRC-SP patches.
>
> It generalises the task of determining data loss from RFC 43430, 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 module-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: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> ---
>  net/dccp/dccp.h |   21 +++++++++++++++------
>  1 file 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,
>  }
>
>  /**
> - * 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 {
>


Agree

-- 
Ivo Augusto Andrade Rocha Calado
MSc. Candidate
Embedded Systems and Pervasive Computing Lab - http://embedded.ufcg.edu.br
Systems and Computing Department - http://www.dsc.ufcg.edu.br
Electrical Engineering and Informatics Center - http://www.ceei.ufcg.edu.br
Federal University of Campina Grande - http://www.ufcg.edu.br

PGP: 0x03422935
Putt's Law:
       Technology is dominated by two types of people:
               Those who understand what they do not manage.
               Those who manage what they do not understand.

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2009-11-06  0:16 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-02  2:44 [PATCH 2/5] Implement loss counting on TFRC-SP receiver Ivo Calado
2009-09-02  2:44 ` Ivo Calado
2009-09-04 12:25 ` Ivo Calado
2009-09-04 12:25   ` Ivo Calado
2009-09-08 18:28 ` Ivo Calado
2009-09-08 18:28   ` Ivo Calado
2009-09-13 16:12 ` Gerrit Renker
2009-09-13 16:12   ` Gerrit Renker
2009-09-15  0:39 ` Ivo Calado
2009-09-15  0:39   ` Ivo Calado
2009-09-19 12:11 ` gerrit
2009-09-19 12:11   ` gerrit
2009-09-24  1:43 ` Ivo Calado
2009-09-24  1:43   ` Ivo Calado
2009-10-01 20:40 ` Gerrit Renker
2009-10-01 20:40   ` Gerrit Renker
  -- strict thread matches above, loose matches on Subject: below --
2009-10-13 17:18 [PATCHv2 2/4] " Ivo Calado
2009-10-13 17:18 ` Ivo Calado
2009-10-19  5:26 ` Gerrit Renker
2009-10-19  5:26   ` Gerrit Renker
2009-10-19 16:04 ` Leandro Sales
2009-10-19 16:04   ` Leandro Sales
2009-10-19  5:16 dccp-test-tree [PATCH 1/1]: Count lost data packets in a burst loss Gerrit Renker
2009-10-19  5:16 ` Gerrit Renker
2009-11-06  0:16 dccp-test-tree [PATCH 1/1]: Count lost data packets in a burst Ivo Calado
2009-11-06  0:16 ` dccp-test-tree [PATCH 1/1]: Count lost data packets in a burst loss Ivo Calado

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.