Remove TCP Vegas support (ARM)
[tomato.git] / release / src-rt-6.x.4708 / router / www / qos-settings.asp
bloba1ee1499bb45a74a9033570cead97b96f7d4307c
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <meta name="viewport" content="width=device-width">
15 <title>[<% ident(); %>] QoS: Basic Settings</title>
16 <link rel='stylesheet' type='text/css' href='tomato.css'>
17 <link rel='stylesheet' type='text/css' href='color.css'>
18 <script type='text/javascript' src='tomato.js'></script>
20 <!-- / / / -->
21 <script type='text/javascript' src='debug.js'></script>
23 <script type='text/javascript'>
25 /* REMOVE-BEGIN
26 !!TB - added qos_pfifo
27 REMOVE-END */
28 // <% nvram("qos_classnames,qos_enable,qos_ack,qos_syn,qos_fin,qos_rst,qos_icmp,qos_udp,qos_default,qos_pfifo,qos_obw,qos_ibw,qos_orates,qos_irates,qos_reset,atm_overhead"); %>
30 var classNames = nvram.qos_classnames.split(' '); // Toastman - configurable class names
32 pctListin = [[0, 'No Limit']];
33 for (i = 1; i <= 100; ++i) pctListin.push([i, i + '%']);
35 pctListout = [[0, 'No Limit']];
36 for (i = 1; i <= 100; ++i) pctListout.push([i, i + '%']);
38 function scale(bandwidth, rate, ceil)
40 if (bandwidth <= 0) return '';
41 if (rate <= 0) return '';
43 var s = comma(MAX(Math.floor((bandwidth * rate) / 100), 1));
44 if (ceil > 0) s += ' - ' + MAX(Math.round((bandwidth * ceil) / 100), 1);
45 return s + ' <small>kbit/s</small>';
48 function toggleFiltersVisibility(){
49 if(E('qosclassnames').style.display=='')
50 E('qosclassnames').style.display='none';
51 else
52 E('qosclassnames').style.display='';
55 function verifyClassCeilingAndRate(bandwidthString, rateString, ceilingString, resultsFieldName)
57 if (parseInt(ceilingString) >= parseInt(rateString))
59 elem.setInnerHTML(
60 resultsFieldName,
61 scale(
62 bandwidthString,
63 rateString,
64 ceilingString));
66 else
68 elem.setInnerHTML(
69 resultsFieldName,
70 'Ceiling must be greater than or equal to rate.');
72 return 0;
75 return 1;
78 function verifyFields(focused, quiet)
80 var i, e, b, f;
82 if (!v_range('_qos_obw', quiet, 10, 999999)) return 0;
83 for (i = 0; i < 10; ++i)
85 if (!verifyClassCeilingAndRate(
86 E('_qos_obw').value,
87 E('_f_orate_' + i).value,
88 E('_f_oceil_' + i).value,
89 '_okbps_' + i))
91 return 0;
95 if (!v_range('_qos_ibw', quiet, 10, 999999)) return 0;
96 for (i = 0; i < 10; ++i)
98 if (!verifyClassCeilingAndRate(
99 E('_qos_ibw').value,
100 E('_f_irate_' + i).value,
101 E('_f_iceil_' + i).value,
102 '_ikbps_' + i))
104 return 0;
108 f = E('_fom').elements;
109 b = !E('_f_qos_enable').checked;
110 for (i = 0; i < f.length; ++i) {
111 if ((f[i].name.substr(0, 1) != '_') && (f[i].type != 'button') && (f[i].name.indexOf('enable') == -1)) {
112 f[i].disabled = b;
116 return 1;
119 function save()
121 var fom = E('_fom');
122 var i, a, qos, c;
125 fom.qos_enable.value = E('_f_qos_enable').checked ? 1 : 0;
126 fom.qos_ack.value = E('_f_qos_ack').checked ? 1 : 0;
127 fom.qos_syn.value = E('_f_qos_syn').checked ? 1 : 0;
128 fom.qos_fin.value = E('_f_qos_fin').checked ? 1 : 0;
129 fom.qos_rst.value = E('_f_qos_rst').checked ? 1 : 0;
130 fom.qos_icmp.value = E('_f_qos_icmp').checked ? 1 : 0;
131 fom.qos_udp.value = E('_f_qos_udp').checked ? 1 : 0;
132 fom.qos_reset.value = E('_f_qos_reset').checked ? 1 : 0;
134 qos = [];
135 for (i = 1; i < 11; ++i) {
136 qos.push(E('_f_qos_' + (i - 1)).value);
139 fom = E('_fom');
140 fom.qos_classnames.value = qos.join(' ');
142 a = [];
143 for (i = 0; i < 10; ++i) {
144 a.push(E('_f_orate_' + i).value + '-' + E('_f_oceil_' + i).value);
146 fom.qos_orates.value = a.join(',');
148 a = [];
150 for (i = 0; i < 10; ++i)
152 //a.push(E('_f_iceil_' + i).value);
153 a.push(E('_f_irate_' + i).value + '-' + E('_f_iceil_' + i).value);
156 fom.qos_irates.value = a.join(',');
158 form.submit(fom, 1);
163 </script>
165 </head>
166 <body>
167 <form id='_fom' method='post' action='tomato.cgi'>
168 <table id='container' cellspacing=0>
169 <tr><td colspan=2 id='header'>
170 <div class='title'>Tomato</div>
171 <div class='version'>Version <% version(); %></div>
172 </td></tr>
173 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
174 <td id='content'>
175 <div id='ident'><% ident(); %></div>
177 <!-- / / / -->
180 <input type='hidden' name='_nextpage' value='qos-settings.asp'>
181 <input type='hidden' name='_service' value='qos-restart'>
183 <input type='hidden' name='qos_classnames'>
184 <input type='hidden' name='qos_enable'>
185 <input type='hidden' name='qos_ack'>
186 <input type='hidden' name='qos_syn'>
187 <input type='hidden' name='qos_fin'>
188 <input type='hidden' name='qos_rst'>
189 <input type='hidden' name='qos_icmp'>
190 <input type='hidden' name='qos_udp'>
191 <input type='hidden' name='qos_orates'>
192 <input type='hidden' name='qos_irates'>
193 <input type='hidden' name='qos_reset'>
197 <div class='section-title'>Basic Settings</div>
198 <div class='section'>
199 <script type='text/javascript'>
201 classList = [];
202 for (i = 0; i < 10; ++i) {
203 classList.push([i, classNames[i]]);
205 createFieldTable('', [
206 { title: 'Enable QoS', name: 'f_qos_enable', type: 'checkbox', value: nvram.qos_enable == '1' },
207 { title: 'Prioritize small packets with these control flags', multi: [
208 { suffix: ' ACK &nbsp;', name: 'f_qos_ack', type: 'checkbox', value: nvram.qos_ack == '1' },
209 { suffix: ' SYN &nbsp;', name: 'f_qos_syn', type: 'checkbox', value: nvram.qos_syn == '1' },
210 { suffix: ' FIN &nbsp;', name: 'f_qos_fin', type: 'checkbox', value: nvram.qos_fin == '1' },
211 { suffix: ' RST &nbsp;', name: 'f_qos_rst', type: 'checkbox', value: nvram.qos_rst == '1' }
212 ] },
213 { title: 'Prioritize ICMP', name: 'f_qos_icmp', type: 'checkbox', value: nvram.qos_icmp == '1' },
214 { title: 'No Ingress QOS for UDP', name: 'f_qos_udp', type: 'checkbox', value: nvram.qos_udp == '1' },
215 { title: 'Reset class when changing settings', name: 'f_qos_reset', type: 'checkbox', value: nvram.qos_reset == '1' },
216 { title: 'Default class', name: 'qos_default', type: 'select', options: classList, value: nvram.qos_default },
217 /* REMOVE-BEGIN
218 !!TB - added qos_pfifo
219 REMOVE-END */
220 { title: 'Qdisc Scheduler', name: 'qos_pfifo', type: 'select', options: [['0','sfq'],['1','pfifo'],['2','codel'],['3','fq_codel']], value: nvram.qos_pfifo }
222 </script>
223 </div>
225 <div class='section-title'>Settings for DSL only</div>
226 <div class='section'>
227 <script type='text/javascript'>
229 createFieldTable('', [
230 { title: 'DSL Overhead Value - ATM Encapsulation Type', multi:[
231 {name: 'atm_overhead', type: 'select', options: [['0','None'],['32','32-PPPoE VC-Mux'],['40','40-PPPoE LLC/Snap'],
232 ['10','10-PPPoA VC-Mux'],['14','14-PPPoA LLC/Snap'],
233 ['8','8-RFC2684/RFC1483 Routed VC-Mux'],['16','16-RFC2684/RFC1483 Routed LLC/Snap'],
234 ['24','24-RFC2684/RFC1483 Bridged VC-Mux'],
235 ['32','32-RFC2684/RFC1483 Bridged LLC/Snap']], value:nvram.atm_overhead }
238 </script>
239 </div>
241 <div class='section-title'>Outbound Rates / Limits</div>
242 <div class='section'>
243 <script type='text/javascript'>
244 cc = nvram.qos_orates.split(/[,-]/);
245 f = [];
246 f.push({ title: 'Max Bandwidth Limit', name: 'qos_obw', type: 'text', maxlen: 6, size: 8, suffix: ' <small>kbit/s (set to measured bandwidth less 15-30%)</small>', value: nvram.qos_obw });
247 f.push(null);
248 j = 0;
249 for (i = 0; i < 10; ++i) {
250 x = cc[j++] || 1;
251 y = cc[j++] || 1;
252 f.push({ title: classNames[i], multi: [
253 { name: 'f_orate_' + i, type: 'select', options: pctListout, value: x, suffix: ' ' },
254 { name: 'f_oceil_' + i, type: 'select', options: pctListout, value: y },
255 { type: 'custom', custom: ' &nbsp; <span id="_okbps_' + i + '"></span>' } ]
258 createFieldTable('', f);
259 </script>
260 </div>
264 <div class='section-title'>Inbound Rates / Limits</div>
265 <div class='section'>
266 <script type='text/javascript'>
267 allRates = nvram.qos_irates.split(',');
268 f = [];
269 f.push({ title: 'Max Bandwidth Limit', name: 'qos_ibw', type: 'text', maxlen: 6, size: 8, suffix: ' <small>kbit/s (set to measured bandwidth less 15-30%)</small>', value: nvram.qos_ibw });
270 f.push(null);
272 f.push(
274 title: '', multi: [
275 { title: 'Rate' },
276 { title: 'Limit' } ]
277 });
279 for (i = 0; i < 10; ++i)
281 splitRate = allRates[i].split('-');
282 incoming_rate = splitRate[0] || 1;
283 incoming_ceil = splitRate[1] || 100;
285 f.push(
287 title: classNames[i], multi: [
288 { name: 'f_irate_' + i, type: 'select', options: pctListin, value: incoming_rate, suffix: ' ' },
289 { name: 'f_iceil_' + i, type: 'select', options: pctListin, value: incoming_ceil },
290 { custom: ' &nbsp; <span id="_ikbps_' + i + '"></span>' } ]
293 createFieldTable('', f);
294 </script>
295 </div>
299 <div class='section-title'>QOS Class Names <small><i><a href='javascript:toggleFiltersVisibility();'>(Toggle Visibility)</a></i></small></div>
300 <div class='section' id='qosclassnames' style='display:none'>
301 <script type='text/javascript'>
303 if ((v = nvram.qos_classnames.match(/^(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)$/)) == null) {
304 v = ["-","Highest","High","Medium","Low","Lowest","A","B","C","D","E"];
306 titles = ['-','Priority Class 1', 'Priority Class 2', 'Priority Class 3', 'Priority Class 4', 'Priority Class 5', 'Priority Class 6', 'Priority Class 7', 'Priority Class 8', 'Priority Class 9', 'Priority Class 10'];
307 f = [{ title: ' ', text: '<small>(Maximum 10 characters, no spaces)</small>' }];
308 for (i = 1; i < 11; ++i) {
309 f.push({ title: titles[i], name: ('f_qos_' + (i - 1)),
310 type: 'text', maxlen: 10, size: 15, value: v[i],
311 suffix: '<span id="count' + i + '"></span>' });
313 createFieldTable('', f);
314 </script>
315 </div>
317 <!-- / / / -->
319 </td></tr>
320 <tr><td id='footer' colspan=2>
321 <span id='footer-msg'></span>
322 <input type='button' value='Save' id='save-button' onclick='save()'>
323 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
324 </td></tr>
325 </table>
326 </form>
327 <script type='text/javascript'>verifyFields(null, 1);</script>
328 </body>
329 </html>