3 if (!
(linespeed
> 0)) linespeed =
128
12 avgrate
[n
] =
($
3 * linespeed
/ 100)
15 maxrate
[n
] =
($
6 * linespeed
/ 100)
23 for (i =
1; i
<= n
; i
++) {
25 if (!
(pktsize
[i
] > 0)) pktsize
[i
] =
1500
26 if (!
(prio
[i
] > 0)) prio
[i
] =
1
28 allocated
+= avgrate
[i
]
30 if ((avgrate
[i
] > 0) && !
(delay
[i
] > 0)) {
35 # allocation of m1 in rt classes:
36 # sum(d * m1) must not exceed dmax * (linespeed - allocated)
38 for (i =
1; i
<= n
; i
++) {
44 d
[i
] =
2 * pktsize
[i
] * 1000 / (linespeed
* 1024)
45 if (d
[i
] > dmax
) dmax = d
[i
]
50 ds_avail = dmax
* (linespeed
- allocated
)
51 for (i =
1; i
<= n
; i
++) {
54 lsm2
[i
] = linespeed
* prio
[i
] / sum_prio
55 if ((avgrate
[i
] > 0) && (d
[i
] > 0)) {
56 if (!
(delay
[i
] > 0)) {
57 ds = ds_avail
* prio
[i
] / sum_rtprio
59 rtm1
[i
] = rtm2
[i
] + ds
/d
[i
]
69 for (i =
1; i
<= n
; i
++) {
70 printf "tc class add dev "device
" parent 1:1 classid 1:"class
[i
]"0 hfsc"
71 if (qdisc_esfq
[i
] != "") {
73 print "esfq " qdisc_esfq
[i
] " limit " ql
74 } else if (rtm1
[i
] > 0) {
76 printf " rt m1 " int
(rtm1
[i
]) "kbit d " int
(d
[i
] * 1000) "us m2 " int
(rtm2
[i
])"kbit"
78 printf " ls m1 " int
(lsm1
[i
]) "kbit d " int
(d
[i
] * 1000) "us m2 " int
(lsm2
[i
]) "kbit"
79 print " ul rate " int
(maxrate
[i
]) "kbit"
84 for (i =
1; i
<= n
; i
++) {
85 printf "tc qdisc add dev "device
" parent 1:"class
[i
]"0 handle "class
[i
]"00: "
87 # RED parameters - also used to determine the queue length for sfq
88 # calculate min value. for links <= 256 kbit, we use 1500 bytes
89 # use 50 ms queue length as min threshold for faster links
90 # max threshold is fixed to 3*min
94 if (maxrate
[i
] <= base_rate
) min = base_pkt
95 else min = int
(maxrate
[i
] * 1024 / 8 * 0.05)
97 limit =
(min
+ max
) * 3
101 print "sfq perturb 2 limit " limit
103 # non-rt class - use RED
106 # don't use avpkt values less than 500 bytes
107 if (avpkt
< 500) avpkt =
500
108 # if avpkt is too close to min, scale down avpkt to allow proper bursting
109 if (avpkt
> min
* 0.70) avpkt
*=
0.70
112 # according to http://www.cs.unc.edu/~jeffay/papers/IEEE-ToN-01.pdf a drop
113 # probability somewhere between 0.1 and 0.2 should be a good tradeoff
114 # between link utilization and response time (0.1: response; 0.2: utilization)
117 rburst=int
((2*min
+ max
) / (3 * avpkt
))
118 if (rburst
< 2) rburst =
2
119 print "red min " min
" max " max
" burst " rburst
" avpkt " avpkt
" limit " limit
" probability " prob
" ecn"
124 for (i =
1; i
<= n
; i
++) {
125 print "tc filter add dev "device
" parent 1: prio "class
[i
]" protocol ip handle "class
[i
]" fw flowid 1:"class
[i
] "0"
This page took 0.051742 seconds and 5 git commands to generate.