linux/net/ipv4/tcp_illinois.c
<<
0.18 /spaon> /formn> a 0.18 href="../linux+v3on>9/net/ipv4/tcp_illinois.c">0.18 img src="../.static/gfx/right.png" alt=">>">0. /spaon>0. spao class="lxr_search">0.180.18 input typ hidden" nam navtarget" 28" ">0.18 input typ text" nam search" id search">0.18 butt23"typ submit">Search /formn> /spaon>0. spao class="lxr_prefs"n> a href="+prefs?return=net/ipv4/tcp_illinois.c"0.18 onclick="return ajax_prefs();">0.18 Prefs> /a>0. /spaon>18 /divn>18 form acptio="ajax+*" method="post" onsubmit="return false;">0. input typ hidden" nam ajax_lookup" id ajax_lookup" 28" ">018 /formn>018 div class="headingbott2m">18 18 div id search_results" class="search_results"> n>18 /divn> div id content">> div id file_contents"n
   1 /a> spao class="comment">/* /spaon>   2 /a> spao class="comment"> * TCP Illinois congespt23"control. /spaon>   3 /a> spao class="comment"> * Home page: /spaon>   4 /a> spao class="comment"> * 18
  http://www.ews.uiuc.edu/~shaoliu/tcpillinois/index.html /spaon>   5 /a> spao class="comment"> * /spaon>   6 /a> spao class="comment"> * The algorithm is described in: /spaon>   7 /a> spao class="comment"> * "TCP-Illinois: A Loss and Delay-Based Congespt23"Control Algorithm /spaon>   8 /a> spao class="comment"> * 1for High-Speed Networks" /spaon>   9 /a> spao class="comment"> * http://www.ifp.illinois.edu/~srikant/Papers/liubassri06perf.pdf /spaon>  .10 spao class="comment"> * /spaon>  11 /a> spao class="comment"> * Implemented from descriopt23"in paper and ns-2 simulapt23. /spaon>  12 /a> spao class="comment"> * Copyright (C) 2007 Stephen Hemminger <shemminger@linux-foundapt23.org> /spaon>  13 /a> spao class="comment"> */ /spaon>  14 /a>>  15 /a>#include <linux/module.h /a>>>  16 /a>#include <linux/skbuff.h /a>>>  17 /a>#include <linux/inet_diag.h /a>>>  18 /a>#include <asm/div64.h /a>>>  19 /a>#include <net/tcp.h /a>>>  20 /a>>  21 /a>#define  a href="+code=ALPHA_SHIFT" class="sref">ALPHA_SHIFT /a>18
  7>  22 /a>#define  a href="+code=ALPHA_SCALE" class="sref">ALPHA_SCALE /a>18
  (1u<<ALPHA_SHIFT /a>)>  23 /a>#define  a href="+code=ALPHA_MIN" class="sref">ALPHA_MIN /a>18
    ((3* a href="+code=ALPHA_SCALE" class="sref">ALPHA_SCALE /a>)/10)
    spao class="comment">/* ~0.3 */ /spaon>  24 /a>#define  a href="+code=ALPHA_MAX" class="sref">ALPHA_MAX /a>18
    (10* a href="+code=ALPHA_SCALE" class="sref">ALPHA_SCALE /a>)18
      spao class="comment">/* 10.0 */ /spaon>  25 /a>#define  a href="+code=ALPHA_BASE" class="sref">ALPHA_BASE /a>18
    a href="+code=ALPHA_SCALE" class="sref">ALPHA_SCALE /a>18
  18
      spao class="comment">/* 1.0 */ /spaon>  26 /a>#define  a href="+code=U32_MAX" class="sref">U32_MAX /a>18
  18
 (( a href="+code=u32" class="sref">u32 /a>)~0U)>  27 /a>#define  a href="+code=RTT_MAX" class="sref">RTT_MAX /a>18
  18
 ( a href="+code=U32_MAX" class="sref">U32_MAX /a>1/  a href="+code=ALPHA_MAX" class="sref">ALPHA_MAX /a>)    spao class="comment">/* 3.3 secs */ /spaon>  28 /a>>  29 /a>#define  a href="+code=BETA_SHIFT" class="sref">BETA_SHIFT /a>18
  16>  30 /a>#define  a href="+code=BETA_SCALE" class="sref">BETA_SCALE /a>18
  1(1u<<BETA_SHIFT /a>)>  31 /a>#define  a href="+code=BETA_MIN" class="sref">BETA_MIN /a>18
  18
( a href="+code=BETA_SCALE" class="sref">BETA_SCALE /a>/8)18
        spao class="comment">/* 10.15 */ /spaon>  32 /a>#define  a href="+code=BETA_MAX" class="sref">BETA_MAX /a>18
  18
( a href="+code=BETA_SCALE" class="sref">BETA_SCALE /a>/2)18
        spao class="comment">/* 105 */ /spaon>  33 /a>#define  a href="+code=BETA_BASE" class="sref">BETA_BASE /a>18
  18 a href="+code=BETA_MAX" class="sref">BETA_MAX /a>>  34 /a>>  35 /a>static int8 a href="+code=win_thresh" class="sref">win_thresh /a>1 a href="+code=__read_mostly" class="sref">__read_mostly /a>1= 15;>  36 /a> a href="+code=module_param" class="sref">module_param /a>( a href="+code=win_thresh" class="sref">win_thresh /a>, int, 0);>  37 /a> a href="+code=MODULE_PARM_DESC" class="sref">MODULE_PARM_DESC /a>( a href="+code=win_thresh" class="sref">win_thresh /a>,  spao class="string">"Window threshold1for starting adaptive sizing" /spaon);>  38 /a>>  39 /a>static int8 a href="+code=theta" class="sref">theta /a>1 a href="+code=__read_mostly" class="sref">__read_mostly /a>1= 5;>  40 /a> a href="+code=module_param" class="sref">module_param /a>( a href="+code=theta" class="sref">theta /a>, int, 0);>  41 /a> a href="+code=MODULE_PARM_DESC" class="sref">MODULE_PARM_DESC /a>( a href="+code=theta" class="sref">theta /a>,  spao class="string">"# of fast RTT's before full growth" /spaon);>  42 /a>>  43 /a> spao class="comment">/* TCP Illinois Parameters */ /spaon>  44 /a>struct8 a href="+code=illinois" class="sref">illinois /a>1{>  45 /a>18
  18
 a href="+code=u64" class="sref">u64 /a>18
   a href="+code=sum_rtt" class="sref">sum_rtt /a>;
        spao class="comment">/* sum of rtt's measured within last rtt */ /spaon>  46 /a>18
  18
 a href="+code=u16" class="sref">u16 /a>18
   a href="+code=cnt_rtt" class="sref">cnt_rtt /a>;
        spao class="comment">/* # of rtts measured within last rtt */ /spaon>  47 /a>18
  18
 a href="+code=u32" class="sref">u32 /a>  18
 a href="+code=base_rtt" class="sref">base_rtt /a>;
       spao class="comment">/* min of all rtt in usec */ /spaon>  48 /a>18
  18
 a href="+code=u32" class="sref">u32 /a>  18
 a href="+code=max_rtt" class="sref">max_rtt /a>;
        spao class="comment">/* max of all rtt in usec */ /spaon>  49 /a>18
  18
 a href="+code=u32" class="sref">u32 /a>  18
 a href="+code=end_seq" class="sref">end_seq /a>;
        spao class="comment">/* right edge of current RTT */ /spaon>  50 /a>18
  18
 a href="+code=u32" class="sref">u32 /a>  18
 a href="+code=alpha" class="sref">alpha /a>;
          spao class="comment">/* Additive increase */ /spaon>  51 /a>18
  18
 a href="+code=u32" class="sref">u32 /a>  18
 a href="+code=beta" class="sref">beta /a>;
           spao class="comment">/* Muliplicative decrease */ /spaon>  52 /a>18
  18
 a href="+code=u16" class="sref">u16 /a>18
   a href="+code=acked" class="sref">acked /a>;
          spao class="comment">/* # packets acked by current ACK */ /spaon>  53 /a>18
  18
 a href="+code=u8" class="sref">u8 /a>18
  1 a href="+code=rtt_above" class="sref">rtt_above /a>;
      spao class="comment">/* average rtt has gone above threshold1*/ /spaon>  54 /a>18
  18
 a href="+code=u8" class="sref">u8 /a>18
  1 a href="+code=rtt_low" class="sref">rtt_low /a>;
        spao class="comment">/* # of rtts measurements below threshold1*/ /spaon>  55 /a>};>  56 /a>>  57 /a>static void1 a href="+code=rtt_reset" class="sref">rtt_reset /a>(struct8 a href="+code=sock" class="sref">sock /a>1* a href="+code=sk" class="sref">sk /a>)>  58 /a>{>  59 /a>18
  18
struct8 a href="+code=tcp_sock" class="sref">tcp_sock /a>1* a href="+code=tp" class="sref">tp /a>1=  a href="+code=tcp_sk" class="sref">tcp_sk /a>( a href="+code=sk" class="sref">sk /a>);>  60 /a>18
  18
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>1=  a href="+code=inet_csk_ca" class="sref">inet_csk_ca /a>( a href="+code=sk" class="sref">sk /a>);>  61 /a>>  62 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=end_seq" class="sref">end_seq /a>1=  a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_nxt" class="sref">snd_nxt /a>;>  63 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=cnt_rtt" class="sref">cnt_rtt /a>1= 0;>  64 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=sum_rtt" class="sref">sum_rtt /a>1= 0;>  65 /a>>  66 /a>18
  18
 spao class="comment">/* TODO: age max_rtt?1*/ /spaon>  67 /a>}>  68 /a>>  69 /a>static void1 a href="+code=tcp_illinois_init" class="sref">tcp_illinois_init /a>(struct8 a href="+code=sock" class="sref">sock /a>1* a href="+code=sk" class="sref">sk /a>)>  70 /a>{>  71 /a>18
  18
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>1=  a href="+code=inet_csk_ca" class="sref">inet_csk_ca /a>( a href="+code=sk" class="sref">sk /a>);>  72 /a>>  73 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=alpha" class="sref">alpha /a>1=  a href="+code=ALPHA_MAX" class="sref">ALPHA_MAX /a>;>  74 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=beta" class="sref">beta /a>1=  a href="+code=BETA_BASE" class="sref">BETA_BASE /a>;>  75 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=base_rtt" class="sref">base_rtt /a>1= 0x7fffffff;>  76 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=max_rtt" class="sref">max_rtt /a>1= 0;>  77 /a>>  78 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=acked" class="sref">acked /a>1= 0;>  79 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_low" class="sref">rtt_low /a>1= 0;>  80 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_above" class="sref">rtt_above /a>1= 0;>  81 /a>>  82 /a>18
  18
 a href="+code=rtt_reset" class="sref">rtt_reset /a>( a href="+code=sk" class="sref">sk /a>);>  83 /a>}>  84 /a>>  85 /a> spao class="comment">/* Measure RTT for each ack.1*/ /spaon>  86 /a>static void1 a href="+code=tcp_illinois_acked" class="sref">tcp_illinois_acked /a>(struct8 a href="+code=sock" class="sref">sock /a>1* a href="+code=sk" class="sref">sk /a>,
 a href="+code=u32" class="sref">u32 /a>  a href="+code=pkts_acked" class="sref">pkts_acked /a>,
 a href="+code=s32" class="sref">s32 /a>  a href="+code=rtt" class="sref">rtt /a>)>  87 /a>{>  88 /a>18
  18
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>1=  a href="+code=inet_csk_ca" class="sref">inet_csk_ca /a>( a href="+code=sk" class="sref">sk /a>);>  89 /a>>  90 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=acked" class="sref">acked /a>1=  a href="+code=pkts_acked" class="sref">pkts_acked /a>;>  91 /a>>  92 /a>18
  18
 spao class="comment">/* dup ack, no rtt sample1*/ /spaon>  93 /a>18
  18
if
( a href="+code=rtt" class="sref">rtt /a> < 0)>  94 /a>18
  18








return;>  95 /a>>  96 /a>18
  18
 spao class="comment">/* ignore bogus 
28"
s, this prevents wraparound in alpha math1*/ /spaon>  97 /a>18
  18
if
( a href="+code=rtt" class="sref">rtt /a> >  a href="+code=RTT_MAX" class="sref">RTT_MAX /a>)>  98 /a>18
  18








 a href="+code=rtt" class="sref">rtt /a> =  a href="+code=RTT_MAX" class="sref">RTT_MAX /a>;>  99 /a>> 100 /a>18
  18
 spao class="comment">/* keep track of minimum RTT seen so far */ /spaon> 101 /a>18
  18
if
( a href="+code=ca" class="sref">ca /a>-> a href="+code=base_rtt" class="sref">base_rtt /a>1>  a href="+code=rtt" class="sref">rtt /a>)> 102 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=base_rtt" class="sref">base_rtt /a>1=  a href="+code=rtt" class="sref">rtt /a>;> 103 /a>> 104 /a>18
  18
 spao class="comment">/* and max */ /spaon> 105 /a>18
  18
if
( a href="+code=ca" class="sref">ca /a>-> a href="+code=max_rtt" class="sref">max_rtt /a>1<  a href="+code=rtt" class="sref">rtt /a>)> 106 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=max_rtt" class="sref">max_rtt /a>1=  a href="+code=rtt" class="sref">rtt /a>;> 107 /a>> 108 /a>18
  18
++ a href="+code=ca" class="sref">ca /a>-> a href="+code=cnt_rtt" class="sref">cnt_rtt /a>;> 109 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=sum_rtt" class="sref">sum_rtt /a>1+=  a href="+code=rtt" class="sref">rtt /a>;> 1.10}> 111 /a>> 112 /a> spao class="comment">/* Maximum queuing delay */ /spaon> 113 /a>static  a href="+code=inline" class="sref">inline /a>  a href="+code=u32" class="sref">u32 /a>  a href="+code=max_delay" class="sref">max_delay /a>(const
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>)> 114 /a>{> 115 /a>18
  18
return  a href="+code=ca" class="sref">ca /a>-> a href="+code=max_rtt" class="sref">max_rtt /a>1-
 a href="+code=ca" class="sref">ca /a>-> a href="+code=base_rtt" class="sref">base_rtt /a>;> 116 /a>}> 117 /a>> 118 /a> spao class="comment">/* Average queuing delay */ /spaon> 119 /a>static  a href="+code=inline" class="sref">inline /a>  a href="+code=u32" class="sref">u32 /a>  a href="+code=avg_delay" class="sref">avg_delay /a>(const
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>)> 120 /a>{> 121 /a>18
  18
 a href="+code=u64" class="sref">u64 /a>1 a href="+code=t" class="sref">t /a>1=  a href="+code=ca" class="sref">ca /a>-> a href="+code=sum_rtt" class="sref">sum_rtt /a>;> 122 /a>> 123 /a>18
  18
 a href="+code=do_div" class="sref">do_div /a>( a href="+code=t" class="sref">t /a>,
 a href="+code=ca" class="sref">ca /a>-> a href="+code=cnt_rtt" class="sref">cnt_rtt /a>);> 124 /a>18
  18
return  a href="+code=t" class="sref">t /a>1-
 a href="+code=ca" class="sref">ca /a>-> a href="+code=base_rtt" class="sref">base_rtt /a>;> 125 /a>}> 126 /a>> 127 /a> spao class="comment">/* /spaon> 128 /a> spao class="comment"> * Compute 
28"
 of alpha used for additive increase. /spaon> 129 /a> spao class="comment"> * If small window then use 1.0, equi
28ent to Reno. /spaon> 1310 spao class="comment"> * /spaon> 131 /a> spao class="comment"> * For larger windows, adjust
based on average delay. /spaon> 132 /a> spao class="comment"> * A. If average delay is at minimum (we are uncongesped), /spaon> 133 /a> spao class="comment"> *    then use large alpha (10.0) to increase faster. /spaon> 134 /a> spao class="comment"> * B. If average delay is at maximum (getting congesped) /spaon> 135 /a> spao class="comment"> *    then use small alpha (0.3) /spaon> 136 /a> spao class="comment"> * /spaon> 137 /a> spao class="comment"> * The result is a convex window growth curve. /spaon> 138 /a> spao class="comment"> */ /spaon> 139 /a>static  a href="+code=u32" class="sref">u32 /a>  a href="+code=alpha" class="sref">alpha /a>(struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>,
 a href="+code=u32" class="sref">u32 /a>  a href="+code=da" class="sref">da /a>,
 a href="+code=u32" class="sref">u32 /a>  a href="+code=dm" class="sref">dm /a>)> 140 /a>{> 141 /a>18
  18
 a href="+code=u32" class="sref">u32 /a>  a href="+code=d1" class="sref">d1 /a>1=  a href="+code=dm" class="sref">dm /a> / 100;
      spao class="comment">/* Low threshold1*/ /spaon> 142 /a>> 143 /a>18
  18
if
( a href="+code=da" class="sref">da /a>1<=  a href="+code=d1" class="sref">d1 /a>)1{> 144 /a>18
  18








 spao class="comment">/* If never got out of low delay zone, then use max */ /spaon> 145 /a>18
  18
18
  18
if
(! a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_above" class="sref">rtt_above /a>)> 146 /a>18
  18








18
  18
return  a href="+code=ALPHA_MAX" class="sref">ALPHA_MAX /a>;> 147 /a>> 148 /a>18
  18








 spao class="comment">/* Wait for 5 good RTT's before allowing alpha to go alpha max. /spaon> 149 /a> spao class="comment">                 * This prevents one good RTT from causing sudden window increase. /spaon> 1510 spao class="comment">                 */ /spaon> 151 /a>18
  18
18
  18
if
(++ a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_low" class="sref">rtt_low /a>1<  a href="+code=theta" class="sref">theta /a>)> 152 /a>18
  18








18
  18
return  a href="+code=ca" class="sref">ca /a>-> a href="+code=alpha" class="sref">alpha /a>;> 153 /a>> 154 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_low" class="sref">rtt_low /a>1= 0;> 155 /a>18
  18
18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_above" class="sref">rtt_above /a>1= 0;> 156 /a>18
  18








return  a href="+code=ALPHA_MAX" class="sref">ALPHA_MAX /a>;> 157 /a>18
  18
}> 158 /a>> 159 /a>18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_above" class="sref">rtt_above /a>1= 1;> 160 /a>> 161 /a>18
  18
 spao class="comment">/* /spaon> 162 /a> spao class="comment">         * Based on: /spaon> 163 /a> spao class="comment">         * /spaon> 164 /a> spao class="comment">         *      (dm - d1) amin amax /spaon> 165 /a> spao class="comment">         * k11= ------------------- /spaon> 166 /a> spao class="comment">         *         amax - amin /spaon> 167 /a> spao class="comment">         * /spaon> 168 /a> spao class="comment">         *       (dm - d1) amin /spaon> 169 /a> spao class="comment">         * k21= ----------------  - d1 /spaon> 1710 spao class="comment">         *        amax - amin /spaon> 171 /a> spao class="comment">         * /spaon> 172 /a> spao class="comment">         *             k1 /spaon> 173 /a> spao class="comment">         * alpha = ---------- /spaon> 174 /a> spao class="comment">         *          k2 + da /spaon> 175 /a> spao class="comment">         */ /spaon> 176 /a>> 177 /a>18
  18
 a href="+code=dm" class="sref">dm /a> -=  a href="+code=d1" class="sref">d1 /a>;> 178 /a>18
  18
 a href="+code=da" class="sref">da /a>1-=  a href="+code=d1" class="sref">d1 /a>;> 179 /a>18
  18
return ( a href="+code=dm" class="sref">dm /a> *  a href="+code=ALPHA_MAX" class="sref">ALPHA_MAX /a>) /> 180 /a>18
  18








( a href="+code=dm" class="sref">dm /a> +
( a href="+code=da" class="sref">da /a>1 * ( a href="+code=ALPHA_MAX" class="sref">ALPHA_MAX /a>1-
 a href="+code=ALPHA_MIN" class="sref">ALPHA_MIN /a>))1/  a href="+code=ALPHA_MIN" class="sref">ALPHA_MIN /a>);> 181 /a>}> 182 /a>> 183 /a> spao class="comment">/* /spaon> 184 /a> spao class="comment"> * Beta used for multiplicative decrease. /spaon> 185 /a> spao class="comment"> * For small window sizes
returns same 
28"
 as Reno (0.5) /spaon> 186 /a> spao class="comment"> * /spaon> 187 /a> spao class="comment"> * If delay is small (10% of max) then beta1= 1/8 /spaon> 188 /a> spao class="comment"> * If delay is up to 80% of max then beta1= 1/2 /spaon> 189 /a> spao class="comment"> * In between is a linear funcptio /spaon> 1910 spao class="comment"> */ /spaon> 191 /a>static  a href="+code=u32" class="sref">u32 /a>  a href="+code=beta" class="sref">beta /a>( a href="+code=u32" class="sref">u32 /a>  a href="+code=da" class="sref">da /a>,
 a href="+code=u32" class="sref">u32 /a>  a href="+code=dm" class="sref">dm /a>)> 192 /a>{> 193 /a>18
  18
 a href="+code=u32" class="sref">u32 /a>  a href="+code=d2" class="sref">d2 /a>,
 a href="+code=d3" class="sref">d3 /a>;> 194 /a>> 195 /a>18
  18
 a href="+code=d2" class="sref">d2 /a>1=  a href="+code=dm" class="sref">dm /a> / 10;> 196 /a>18
  18
if
( a href="+code=da" class="sref">da /a>1<=  a href="+code=d2" class="sref">d2 /a>)> 197 /a>18
  18
18
  18
return  a href="+code=BETA_MIN" class="sref">BETA_MIN /a>;> 198 /a>> 199 /a>18
  18
 a href="+code=d3" class="sref">d3 /a>1= (8 *  a href="+code=dm" class="sref">dm /a>) / 10;> 200 /a>18
  18
if
( a href="+code=da" class="sref">da /a>1>=  a href="+code=d3" class="sref">d3 /a>1||  a href="+code=d3" class="sref">d3 /a>1<=  a href="+code=d2" class="sref">d2 /a>)> 201 /a>18
  18
18
  18
return  a href="+code=BETA_MAX" class="sref">BETA_MAX /a>;> 202 /a>> 203 /a>18
  18
 spao class="comment">/* /spaon> 204 /a> spao class="comment">         * Based on: /spaon> 205 /a> spao class="comment">         * /spaon> 206 /a> spao class="comment">         *       bmin d31-
bmax d2 /spaon> 207 /a> spao class="comment">         * k31= ------------------- /spaon> 208 /a> spao class="comment">         *         d31-
d2 /spaon> 209 /a> spao class="comment">         * /spaon> 2110 spao class="comment">         *       bmax - bmin /spaon> 211 /a> spao class="comment">         * k41= ------------- /spaon> 212 /a> spao class="comment">         *         d31-
d2 /spaon> 213 /a> spao class="comment">         * /spaon> 214 /a> spao class="comment">         * b1= k31+ k41da /spaon> 215 /a> spao class="comment">         */ /spaon> 216 /a>18
  18
return ( a href="+code=BETA_MIN" class="sref">BETA_MIN /a>1*  a href="+code=d3" class="sref">d3 /a>1-
 a href="+code=BETA_MAX" class="sref">BETA_MAX /a>1*  a href="+code=d2" class="sref">d2 /a>1+
( a href="+code=BETA_MAX" class="sref">BETA_MAX /a>1-
 a href="+code=BETA_MIN" class="sref">BETA_MIN /a>)1*  a href="+code=da" class="sref">da /a>)> 217 /a>18
  18
18
  18
/
( a href="+code=d3" class="sref">d3 /a>1-
 a href="+code=d2" class="sref">d2 /a>);> 218 /a>}> 219 /a>> 2210 spao class="comment">/* Update alpha and beta1
28"
s once per RTT */ /spaon> 221 /a>static void1 a href="+code=update_params" class="sref">update_params /a>(struct8 a href="+code=sock" class="sref">sock /a>1* a href="+code=sk" class="sref">sk /a>)> 222 /a>{> 223 /a>18
  18
struct8 a href="+code=tcp_sock" class="sref">tcp_sock /a>1* a href="+code=tp" class="sref">tp /a>1=  a href="+code=tcp_sk" class="sref">tcp_sk /a>( a href="+code=sk" class="sref">sk /a>);> 224 /a>18
  18
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>1=  a href="+code=inet_csk_ca" class="sref">inet_csk_ca /a>( a href="+code=sk" class="sref">sk /a>);> 225 /a>> 226 /a>18
  18
if
( a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd" class="sref">snd_cwnd /a>1<  a href="+code=win_thresh" class="sref">win_thresh /a>)1{> 227 /a>18
  18
18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=alpha" class="sref">alpha /a>1=  a href="+code=ALPHA_BASE" class="sref">ALPHA_BASE /a>;> 228 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=beta" class="sref">beta /a>1=  a href="+code=BETA_BASE" class="sref">BETA_BASE /a>;> 229 /a>18
  18
} else
if
( a href="+code=ca" class="sref">ca /a>-> a href="+code=cnt_rtt" class="sref">cnt_rtt /a>1> 0)1{> 230 /a>18
  18








 a href="+code=u32" class="sref">u32 /a>  a href="+code=dm" class="sref">dm /a>1=  a href="+code=max_delay" class="sref">max_delay /a>( a href="+code=ca" class="sref">ca /a>);> 231 /a>18
  18
18
  18
 a href="+code=u32" class="sref">u32 /a>  a href="+code=da" class="sref">da /a>1=  a href="+code=avg_delay" class="sref">avg_delay /a>( a href="+code=ca" class="sref">ca /a>);> 232 /a>> 233 /a>18
  18
18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=alpha" class="sref">alpha /a>1=  a href="+code=alpha" class="sref">alpha /a>( a href="+code=ca" class="sref">ca /a>,
 a href="+code=da" class="sref">da /a>,
 a href="+code=dm" class="sref">dm /a>);> 234 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=beta" class="sref">beta /a>1=  a href="+code=beta" class="sref">beta /a>( a href="+code=da" class="sref">da /a>,
 a href="+code=dm" class="sref">dm /a>);> 235 /a>18
  18
}> 236 /a>> 237 /a>18
  18
 a href="+code=rtt_reset" class="sref">rtt_reset /a>( a href="+code=sk" class="sref">sk /a>);> 238 /a>}> 239 /a>> 2410 spao class="comment">/* /spaon> 241 /a> spao class="comment"> * Io case of loss, reset to default 
28"
s /spaon> 242 /a> spao class="comment"> */ /spaon> 243 /a>static void1 a href="+code=tcp_illinois_state" class="sref">tcp_illinois_state /a>(struct8 a href="+code=sock" class="sref">sock /a>1* a href="+code=sk" class="sref">sk /a>,
 a href="+code=u8" class="sref">u8 /a>1 a href="+code=new_state" class="sref">new_state /a>)> 244 /a>{> 245 /a>18
  18
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>1=  a href="+code=inet_csk_ca" class="sref">inet_csk_ca /a>( a href="+code=sk" class="sref">sk /a>);> 246 /a>> 247 /a>18
  18
if
( a href="+code=new_state" class="sref">new_state /a> ==  a href="+code=TCP_CA_Loss" class="sref">TCP_CA_Loss /a>)1{> 248 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=alpha" class="sref">alpha /a>1=  a href="+code=ALPHA_BASE" class="sref">ALPHA_BASE /a>;> 249 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=beta" class="sref">beta /a>1=  a href="+code=BETA_BASE" class="sref">BETA_BASE /a>;> 250 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_low" class="sref">rtt_low /a>1= 0;> 251 /a>18
  18
18
  18
 a href="+code=ca" class="sref">ca /a>-> a href="+code=rtt_above" class="sref">rtt_above /a>1= 0;> 252 /a>18
  18








 a href="+code=rtt_reset" class="sref">rtt_reset /a>( a href="+code=sk" class="sref">sk /a>);> 253 /a>18
  18
}> 254 /a>}> 255 /a>> 256 /a> spao class="comment">/* /spaon> 257 /a> spao class="comment"> * Increase window in response to successful acknowledgment. /spaon> 258 /a> spao class="comment"> */ /spaon> 259 /a>static void1 a href="+code=tcp_illinois_cong_avoid" class="sref">tcp_illinois_cong_avoid /a>(struct8 a href="+code=sock" class="sref">sock /a>1* a href="+code=sk" class="sref">sk /a>,
 a href="+code=u32" class="sref">u32 /a>  a href="+code=ack" class="sref">ack /a>,
 a href="+code=u32" class="sref">u32 /a>  a href="+code=in_flight" class="sref">in_flight /a>)> 260 /a>{> 261 /a>18
  18
struct8 a href="+code=tcp_sock" class="sref">tcp_sock /a>1* a href="+code=tp" class="sref">tp /a>1=  a href="+code=tcp_sk" class="sref">tcp_sk /a>( a href="+code=sk" class="sref">sk /a>);> 262 /a>18
  18
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>1=  a href="+code=inet_csk_ca" class="sref">inet_csk_ca /a>( a href="+code=sk" class="sref">sk /a>);> 263 /a>> 264 /a>18
  18
if
( a href="+code=after" class="sref">after /a>( a href="+code=ack" class="sref">ack /a>,
 a href="+code=ca" class="sref">ca /a>-> a href="+code=end_seq" class="sref">end_seq /a>))> 265 /a>18
  18
18
  18
 a href="+code=update_params" class="sref">update_params /a>( a href="+code=sk" class="sref">sk /a>);> 266 /a>> 267 /a>18
  18
 spao class="comment">/* RFC2861 only increase cwnd
if
fully utilized1*/ /spaon> 268 /a>18
  18
if
(! a href="+code=tcp_is_cwnd_limited" class="sref">tcp_is_cwnd_limited /a>( a href="+code=sk" class="sref">sk /a>,
 a href="+code=in_flight" class="sref">in_flight /a>))> 269 /a>18
  18








return;> 270 /a>> 271 /a>18
  18
 spao class="comment">/* Io slow start1*/ /spaon> 272 /a>18
  18
if
( a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd" class="sref">snd_cwnd /a>1<=  a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_ssthresh" class="sref">snd_ssthresh /a>)> 273 /a>18
  18
18
  18
 a href="+code=tcp_slow_start" class="sref">tcp_slow_start /a>( a href="+code=tp" class="sref">tp /a>);> 274 /a>> 275 /a>18
  18
else
{> 276 /a>18
  18








 a href="+code=u32" class="sref">u32 /a>  a href="+code=delta" class="sref">delta /a>;> 277 /a>> 278 /a>18
  18








 spao class="comment">/* snd_cwnd_cnt is # of packets since last cwnd
increment1*/ /spaon> 279 /a>18
  18








 a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd_cnt" class="sref">snd_cwnd_cnt /a>1+=  a href="+code=ca" class="sref">ca /a>-> a href="+code=acked" class="sref">acked /a>;> 280 /a>18
  18








 a href="+code=ca" class="sref">ca /a>-> a href="+code=acked" class="sref">acked /a>1= 1;> 281 /a>> 282 /a>18
  18








 spao class="comment">/* This is close
approximaptio of: /spaon> 283 /a> spao class="comment">18
  18








 * tp->snd_cwnd1+= alpha/tp->snd_cwnd /spaon> 284 /a> spao class="comment"> 
  18








 */ /spaon> 285 /a>18
  18
18
  18
 a href="+code=delta" class="sref">delta /a>1= ( a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd_cnt" class="sref">snd_cwnd_cnt /a>1*  a href="+code=ca" class="sref">ca /a>-> a href="+code=alpha" class="sref">alpha /a>)1>>  a href="+code=ALPHA_SHIFT" class="sref">ALPHA_SHIFT /a>;> 286 /a>18
  18








if
( a href="+code=delta" class="sref">delta /a>1>=  a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd" class="sref">snd_cwnd /a>)1{> 287 /a>18
  18
18
  18








 a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd" class="sref">snd_cwnd /a>1=  a href="+code=min" class="sref">min /a>( a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd" class="sref">snd_cwnd /a>1+
 a href="+code=delta" class="sref">delta /a>1/  a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd" class="sref">snd_cwnd /a>,> 288 /a>18
  18



































( a href="+code=u32" class="sref">u32 /a>)
 a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd_clamp" class="sref">snd_cwnd_clamp /a>);> 289 /a>18
  18
















 a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd_cnt" class="sref">snd_cwnd_cnt /a>1= 0;> 290 /a>18
  18








}> 291 /a>18
  18
}> 292 /a>}> 293 /a>> 294 /a>static  a href="+code=u32" class="sref">u32 /a>  a href="+code=tcp_illinois_ssthresh" class="sref">tcp_illinois_ssthresh /a>(struct8 a href="+code=sock" class="sref">sock /a>1* a href="+code=sk" class="sref">sk /a>)> 295 /a>{> 296 /a>18
  18
struct8 a href="+code=tcp_sock" class="sref">tcp_sock /a>1* a href="+code=tp" class="sref">tp /a>1=  a href="+code=tcp_sk" class="sref">tcp_sk /a>( a href="+code=sk" class="sref">sk /a>);> 297 /a>18
  18
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>1=  a href="+code=inet_csk_ca" class="sref">inet_csk_ca /a>( a href="+code=sk" class="sref">sk /a>);> 298 /a>> 299 /a>18
  18
 spao class="comment">/* Multiplicative decrease */ /spaon> 300 /a>18
  18
return  a href="+code=max" class="sref">max /a>( a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd" class="sref">snd_cwnd /a>1- (( a href="+code=tp" class="sref">tp /a>-> a href="+code=snd_cwnd" class="sref">snd_cwnd /a>1*  a href="+code=ca" class="sref">ca /a>-> a href="+code=beta" class="sref">beta /a>)1>>  a href="+code=BETA_SHIFT" class="sref">BETA_SHIFT /a>), 2U);> 301 /a>}> 302 /a>> 303 /a>> 304 /a> spao class="comment">/* Extract8info for Tcp socket8info provided via netlink. */ /spaon> 305 /a>static void1 a href="+code=tcp_illinois_info" class="sref">tcp_illinois_info /a>(struct8 a href="+code=sock" class="sref">sock /a>1* a href="+code=sk" class="sref">sk /a>,
 a href="+code=u32" class="sref">u32 /a>  a href="+code=ext" class="sref">ext /a>,> 306 /a>18
  18








18
  18

  18
struct8 a href="+code=sk_buff" class="sref">sk_buff /a>1* a href="+code=skb" class="sref">skb /a>)> 307 /a>{> 308 /a>18
  18
const
struct8 a href="+code=illinois" class="sref">illinois /a>1* a href="+code=ca" class="sref">ca /a>1=  a href="+code=inet_csk_ca" class="sref">inet_csk_ca /a>( a href="+code=sk" class="sref">sk /a>);> 309 /a>> 310 /a>18
  18
if
( a href="+code=ext" class="sref">ext /a> & (11<< ( a href="+code=INET_DIAG_VEGASINFO" class="sref">INET_DIAG_VEGASINFO /a>1- 1)))1{> 311 /a>18
  18
18
  18
struct8 a href="+code=tcpvegas_info" class="sref">tcpvegas_info /a>  a href="+code=info" class="sref">info /a> =1{> 312 /a>18
  18








18
  18
. a href="+code=tcpv_enabled" class="sref">tcpv_enabled /a>1= 1,> 313 /a>18
  18
18
  18
18
  18
. a href="+code=tcpv_rttcnt" class="sref">tcpv_rttcnt /a>1=  a href="+code=ca" class="sref">ca /a>-> a href="+code=cnt_rtt" class="sref">cnt_rtt /a>,> 314 /a>18
  18








18
  18
. a href="+code=tcpv_minrtt" class="sref">tcpv_minrtt /a>1=  a href="+code=ca" class="sref">ca /a>-> a href="+code=base_rtt" class="sref">base_rtt /a>,> 315 /a>18
  18
18
  18
};> 316 /a>> 317 /a>18
  18
18
  18
if
( a href="+code=info" class="sref">info /a>. a href="+code=tcpv_rttcnt" class="sref">tcpv_rttcnt /a>1> 0)1{> 318 /a>18
  18
















 a href="+code=u64" class="sref">u64 /a>1 a href="+code=t" class="sref">t /a>1=  a href="+code=ca" class="sref">ca /a>-> a href="+code=sum_rtt" class="sref">sum_rtt /a>;> 319 /a>> 320 /a>18
  18
















 a href="+code=do_div" class="sref">do_div /a>( a href="+code=t" class="sref">t /a>,
 a href="+code=info" class="sref">info /a>. a href="+code=tcpv_rttcnt" class="sref">tcpv_rttcnt /a>);> 321 /a>18
  18
18
  18








 a href="+code=info" class="sref">info /a>. a href="+code=tcpv_rtt" class="sref">tcpv_rtt /a>1=  a href="+code=t" class="sref">t /a>;> 322 /a>18
  18








}> 323 /a>18
  18
18
  18
 a href="+code=nla_put" class="sref">nla_put /a>( a href="+code=skb" class="sref">skb /a>,
 a href="+code=INET_DIAG_VEGASINFO" class="sref">INET_DIAG_VEGASINFO /a>, sizeof( a href="+code=info" class="sref">info /a>), & a href="+code=info" class="sref">info /a>);> 324 /a>18
  18
}> 325 /a>}> 326 /a>> 327 /a>static struct8 a href="+code=tcp_congesptio_ops" class="sref">tcp_congesptio_ops /a>  a href="+code=tcp_illinois" class="sref">tcp_illinois /a>  a href="+code=__read_mostly" class="sref">__read_mostly /a> =1{> 328 /a>18
  18
. a href="+code=flags" class="sref">flags /a>18
  18
18=  a href="+code=TCP_CONG_RTT_STAMP" class="sref">TCP_CONG_RTT_STAMP /a>,> 329 /a>18
  18
. a href="+code=init" class="sref">init /a>18
  18
18
=  a href="+code=tcp_illinois_init" class="sref">tcp_illinois_init /a>,> 330 /a>18
  18
. a href="+code=ssthresh" class="sref">ssthresh /a> 18
18
=  a href="+code=tcp_illinois_ssthresh" class="sref">tcp_illinois_ssthresh /a>,> 331 /a>18
  18
. a href="+code=min_cwnd" class="sref">min_cwnd /a> 18
18
=  a href="+code=tcp_reno_min_cwnd" class="sref">tcp_reno_min_cwnd /a>,> 332 /a>18
  18
. a href="+code=cong_avoid" class="sref">cong_avoid /a>8
18
=  a href="+code=tcp_illinois_cong_avoid" class="sref">tcp_illinois_cong_avoid /a>,> 333 /a>18
  18
. a href="+code=set_state" class="sref">set_state /a>18
  1=  a href="+code=tcp_illinois_state" class="sref">tcp_illinois_state /a>,> 334 /a>18
  18
. a href="+code=get_info" class="sref">get_info /a> 18
18
=  a href="+code=tcp_illinois_info" class="sref">tcp_illinois_info /a>,> 335 /a>18
  18
. a href="+code=pkts_acked" class="sref">pkts_acked /a>8
18
=  a href="+code=tcp_illinois_acked" class="sref">tcp_illinois_acked /a>,> 336 /a>> 337 /a>18
  18
. a href="+code=owner" class="sref">owner /a>18
  18
18=  a href="+code=THIS_MODULE" class="sref">THIS_MODULE /a>,> 338 /a>18
  18
. a href="+code=nam
" class="sref">nam
 /a>18
  18
18
=  spao class="string">"illinois" /spaon,> 339 /a>};> 340 /a>> 341 /a>static int8 a href="+code=__init" class="sref">__init /a>  a href="+code=tcp_illinois_register" class="sref">tcp_illinois_register /a>(void)> 342 /a>{> 343 /a>18
  18
 a href="+code=BUILD_BUG_ON" class="sref">BUILD_BUG_ON /a>(sizeof(struct8 a href="+code=illinois" class="sref">illinois /a>)1>
 a href="+code=ICSK_CA_PRIV_SIZE" class="sref">ICSK_CA_PRIV_SIZE /a>);> 344 /a>18
  18
return  a href="+code=tcp_register_congesptio_control" class="sref">tcp_register_congesptio_control /a>(& a href="+code=tcp_illinois" class="sref">tcp_illinois /a>);> 345 /a>}> 346 /a>> 347 /a>static void1 a href="+code=__exit" class="sref">__exit /a>  a href="+code=tcp_illinois_unregister" class="sref">tcp_illinois_unregister /a>(void)> 348 /a>{> 349 /a>18
  18
 a href="+code=tcp_unregister_congesptio_control" class="sref">tcp_unregister_congesptio_control /a>(& a href="+code=tcp_illinois" class="sref">tcp_illinois /a>);> 350 /a>}> 351 /a>> 352 /a> a href="+code=module_init" class="sref">module_init /a>( a href="+code=tcp_illinois_register" class="sref">tcp_illinois_register /a>);> 353 /a> a href="+code=module_exit" class="sref">module_exit /a>( a href="+code=tcp_illinois_unregister" class="sref">tcp_illinois_unregister /a>);> 354 /a>> 355 /a> a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR /a>( spao class="string">"Stephen Hemminger, Shao Liu" /spaon);> 356 /a> a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE /a>( spao class="string">"GPL" /spaon);> 357 /a> a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION /a>( spao class="string">"TCP Illinois" /spaon);> 358 /a> a href="+code=MODULE_VERSION" class="sref">MODULE_VERSION /a>( spao class="string">"1.0" /spaon);> 359 /a>
lxr.linux.no kindly hosted by a href="http://www.redpill-linpro.no">Redpill Linpro AS /a>, provider of Linux consulting and operaptios services since 1995.