aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index ef3233d45a61..0a4a3d2feba5 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -19,6 +19,7 @@
19 19
20#define TFRC_CALC_X_ARRSIZE 500 20#define TFRC_CALC_X_ARRSIZE 500
21#define TFRC_CALC_X_SPLIT 50000 /* 0.05 * 1000000, details below */ 21#define TFRC_CALC_X_SPLIT 50000 /* 0.05 * 1000000, details below */
22#define TFRC_SMALLEST_P (TFRC_CALC_X_SPLIT/TFRC_CALC_X_ARRSIZE)
22 23
23/* 24/*
24 TFRC TCP Reno Throughput Equation Lookup Table for f(p) 25 TFRC TCP Reno Throughput Equation Lookup Table for f(p)
@@ -68,7 +69,9 @@
68 granularity for the practically more relevant case of small values of p (up to 69 granularity for the practically more relevant case of small values of p (up to
69 5%), the second column is used; the first one ranges up to 100%. This split 70 5%), the second column is used; the first one ranges up to 100%. This split
70 corresponds to the value of q = TFRC_CALC_X_SPLIT. At the same time this also 71 corresponds to the value of q = TFRC_CALC_X_SPLIT. At the same time this also
71 determines the smallest resolution. 72 determines the smallest resolution possible with this lookup table:
73
74 TFRC_SMALLEST_P = TFRC_CALC_X_SPLIT / TFRC_CALC_X_ARRSIZE
72 75
73 The entire table is generated by: 76 The entire table is generated by:
74 for(i=0; i < TFRC_CALC_X_ARRSIZE; i++) { 77 for(i=0; i < TFRC_CALC_X_ARRSIZE; i++) {
@@ -79,7 +82,7 @@
79 With the given configuration, we have, with M = TFRC_CALC_X_ARRSIZE-1, 82 With the given configuration, we have, with M = TFRC_CALC_X_ARRSIZE-1,
80 lookup[0][0] = g(1000000/(M+1)) = 1000000 * f(0.2%) 83 lookup[0][0] = g(1000000/(M+1)) = 1000000 * f(0.2%)
81 lookup[M][0] = g(1000000) = 1000000 * f(100%) 84 lookup[M][0] = g(1000000) = 1000000 * f(100%)
82 lookup[0][1] = g(TFRC_CALC_X_SPLIT/(M+1)) = 1000000 * f(0.01%) 85 lookup[0][1] = g(TFRC_SMALLEST_P) = 1000000 * f(0.01%)
83 lookup[M][1] = g(TFRC_CALC_X_SPLIT) = 1000000 * f(5%) 86 lookup[M][1] = g(TFRC_CALC_X_SPLIT) = 1000000 * f(5%)
84 87
85 In summary, the two columns represent f(p) for the following ranges: 88 In summary, the two columns represent f(p) for the following ranges:
@@ -616,15 +619,21 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
616 return ~0U; 619 return ~0U;
617 } 620 }
618 621
619 if (p < TFRC_CALC_X_SPLIT) /* 0 <= p < 0.05 */ 622 if (p <= TFRC_CALC_X_SPLIT) { /* 0.0000 < p <= 0.05 */
620 index = (p / (TFRC_CALC_X_SPLIT / TFRC_CALC_X_ARRSIZE)) - 1; 623 if (p < TFRC_SMALLEST_P) { /* 0.0000 < p < 0.0001 */
621 else /* 0.05 <= p <= 1.00 */ 624 DCCP_WARN("Value of p (%d) below resolution. "
622 index = (p / (1000000 / TFRC_CALC_X_ARRSIZE)) - 1; 625 "Substituting %d\n", p, TFRC_SMALLEST_P);
626 index = 0;
627 } else /* 0.0001 <= p <= 0.05 */
628 index = p/TFRC_SMALLEST_P - 1;
629
630 f = tfrc_calc_x_lookup[index][1];
631
632 } else { /* 0.05 < p <= 1.00 */
633 index = p/(1000000/TFRC_CALC_X_ARRSIZE) - 1;
623 634
624 if (p >= TFRC_CALC_X_SPLIT)
625 f = tfrc_calc_x_lookup[index][0]; 635 f = tfrc_calc_x_lookup[index][0];
626 else 636 }
627 f = tfrc_calc_x_lookup[index][1];
628 637
629 /* The following computes X = s/(R*f(p)) in bytes per second. Since f(p) 638 /* The following computes X = s/(R*f(p)) in bytes per second. Since f(p)
630 * and R are both scaled by 1000000, we need to multiply by 1000000^2. 639 * and R are both scaled by 1000000, we need to multiply by 1000000^2.