aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/lib/tfrc_equation.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids/lib/tfrc_equation.c')
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index c5d3a9e5a5a4..22ca1cf0eb55 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * net/dccp/ccids/lib/tfrc_equation.c
3 *
4 * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand. 2 * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand.
5 * Copyright (c) 2005 Ian McDonald <ian.mcdonald@jandi.co.nz> 3 * Copyright (c) 2005 Ian McDonald <ian.mcdonald@jandi.co.nz>
6 * Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@conectiva.com.br> 4 * Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
@@ -79,10 +77,10 @@
79 } 77 }
80 78
81 With the given configuration, we have, with M = TFRC_CALC_X_ARRSIZE-1, 79 With the given configuration, we have, with M = TFRC_CALC_X_ARRSIZE-1,
82 lookup[0][0] = g(1000000/(M+1)) = 1000000 * f(0.2%) 80 lookup[0][0] = g(1000000/(M+1)) = 1000000 * f(0.2%)
83 lookup[M][0] = g(1000000) = 1000000 * f(100%) 81 lookup[M][0] = g(1000000) = 1000000 * f(100%)
84 lookup[0][1] = g(TFRC_SMALLEST_P) = 1000000 * f(0.01%) 82 lookup[0][1] = g(TFRC_SMALLEST_P) = 1000000 * f(0.01%)
85 lookup[M][1] = g(TFRC_CALC_X_SPLIT) = 1000000 * f(5%) 83 lookup[M][1] = g(TFRC_CALC_X_SPLIT) = 1000000 * f(5%)
86 84
87 In summary, the two columns represent f(p) for the following ranges: 85 In summary, the two columns represent f(p) for the following ranges:
88 * The first column is for 0.002 <= p <= 1.0 86 * The first column is for 0.002 <= p <= 1.0
@@ -610,11 +608,10 @@ static inline u32 tfrc_binsearch(u32 fval, u8 small)
610 608
611/** 609/**
612 * tfrc_calc_x - Calculate the send rate as per section 3.1 of RFC3448 610 * tfrc_calc_x - Calculate the send rate as per section 3.1 of RFC3448
613 * 611 * @s: packet size in bytes
614 * @s: packet size in bytes 612 * @R: RTT scaled by 1000000 (i.e., microseconds)
615 * @R: RTT scaled by 1000000 (i.e., microseconds) 613 * @p: loss ratio estimate scaled by 1000000
616 * @p: loss ratio estimate scaled by 1000000 614 * Returns X_calc in bytes per second (not scaled).
617 * Returns X_calc in bytes per second (not scaled).
618 */ 615 */
619u32 tfrc_calc_x(u16 s, u32 R, u32 p) 616u32 tfrc_calc_x(u16 s, u32 R, u32 p)
620{ 617{
@@ -630,17 +627,17 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
630 return ~0U; 627 return ~0U;
631 } 628 }
632 629
633 if (p <= TFRC_CALC_X_SPLIT) { /* 0.0000 < p <= 0.05 */ 630 if (p <= TFRC_CALC_X_SPLIT) { /* 0.0000 < p <= 0.05 */
634 if (p < TFRC_SMALLEST_P) { /* 0.0000 < p < 0.0001 */ 631 if (p < TFRC_SMALLEST_P) { /* 0.0000 < p < 0.0001 */
635 DCCP_WARN("Value of p (%d) below resolution. " 632 DCCP_WARN("Value of p (%d) below resolution. "
636 "Substituting %d\n", p, TFRC_SMALLEST_P); 633 "Substituting %d\n", p, TFRC_SMALLEST_P);
637 index = 0; 634 index = 0;
638 } else /* 0.0001 <= p <= 0.05 */ 635 } else /* 0.0001 <= p <= 0.05 */
639 index = p/TFRC_SMALLEST_P - 1; 636 index = p/TFRC_SMALLEST_P - 1;
640 637
641 f = tfrc_calc_x_lookup[index][1]; 638 f = tfrc_calc_x_lookup[index][1];
642 639
643 } else { /* 0.05 < p <= 1.00 */ 640 } else { /* 0.05 < p <= 1.00 */
644 index = p/(1000000/TFRC_CALC_X_ARRSIZE) - 1; 641 index = p/(1000000/TFRC_CALC_X_ARRSIZE) - 1;
645 642
646 f = tfrc_calc_x_lookup[index][0]; 643 f = tfrc_calc_x_lookup[index][0];
@@ -661,7 +658,6 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
661 658
662/** 659/**
663 * tfrc_calc_x_reverse_lookup - try to find p given f(p) 660 * tfrc_calc_x_reverse_lookup - try to find p given f(p)
664 *
665 * @fvalue: function value to match, scaled by 1000000 661 * @fvalue: function value to match, scaled by 1000000
666 * Returns closest match for p, also scaled by 1000000 662 * Returns closest match for p, also scaled by 1000000
667 */ 663 */