dccp ccid-3: TFRC reverse-lookup Bug-Fix

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, June 13, 2008 - 5:00 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1e8a28...
Commit:     1e8a287c79f64226541f5c44aa52d4698bb84cf5
Parent:     65907a433ac0ca450c4408080f24c6e4743386b2
Author:     Gerrit Renker <gerrit@erg.abdn.ac.uk>
AuthorDate: Wed Jun 11 11:19:10 2008 +0100
Committer:  Gerrit Renker <gerrit@erg.abdn.ac.uk>
CommitDate: Wed Jun 11 11:19:10 2008 +0100

    dccp ccid-3: TFRC reverse-lookup Bug-Fix
    
    This fixes a bug in the reverse lookup of p: given a value f(p), instead of p,
    the function returned the smallest tabulated value f(p).
    
    The smallest tabulated value of
    
       10^6 * f(p) =  sqrt(2*p/3) + 12 * sqrt(3*p/8) * (32 * p^3 + p)
    
    for p=0.0001 is 8172.
    
    Since this value is scaled by 10^6, the outcome of this bug is that a loss
    of 8172/10^6 = 0.8172% was reported whenever the input was below the table
    resolution of 0.01%.
    
    This means that the value was over 80 times too high, resulting in large spikes
    of the initial loss interval, thus unnecessarily reducing the throughput.
    
    Also corrected the printk format (%u for u32).
    
    Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/ccids/lib/tfrc_equation.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index e4e64b7..2f20a29 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -661,7 +661,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
 
 EXPORT_SYMBOL_GPL(tfrc_calc_x);
 
-/*
+/**
  *  tfrc_calc_x_reverse_lookup  -  try to find p given f(p)
  *
  *  @fvalue: function value to match, scaled by 1000000
@@ -676,11 +676,11 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue)
 
 	/* Error cases. */
 	if (fvalue < tfrc_calc_x_lookup[0][1]) {
-		DCCP_WARN("fvalue %d smaller than resolution\n", fvalue);
-		return tfrc_calc_x_lookup[0][1];
+		DCCP_WARN("fvalue %u smaller than resolution\n", fvalue);
+		return TFRC_SMALLEST_P;
 	}
 	if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) {
-		DCCP_WARN("fvalue %d exceeds bounds!\n", fvalue);
+		DCCP_WARN("fvalue %u exceeds bounds!\n", fvalue);
 		return 1000000;
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
dccp ccid-3: TFRC reverse-lookup Bug-Fix, Linux Kernel Mailing ..., (Fri Jun 13, 5:00 pm)