UI cleanup, phase 5, ARM (functional changes)
[tomato.git] / release / src-rt-6.x.4708 / router / www / qos-settings.asp
blob06aead93d74d415aefe6eef024f7e83588a6e542
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,ne_vegas,ne_valpha,ne_vbeta,ne_vgamma,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].name.indexOf('ne_v') == -1)) f[i].disabled = b;
115 var abg = ['alpha', 'beta', 'gamma'];
116 b = E('_f_ne_vegas').checked;
117 for (i = 0; i < 3; ++i) {
118 f = E('_ne_v' + abg[i]);
119 f.disabled = !b;
120 if (b) {
121 if (!v_range(f, quiet, 0, 65535)) return 0;
125 return 1;
128 function save()
130 var fom = E('_fom');
131 var i, a, qos, c;
134 fom.qos_enable.value = E('_f_qos_enable').checked ? 1 : 0;
135 fom.qos_ack.value = E('_f_qos_ack').checked ? 1 : 0;
136 fom.qos_syn.value = E('_f_qos_syn').checked ? 1 : 0;
137 fom.qos_fin.value = E('_f_qos_fin').checked ? 1 : 0;
138 fom.qos_rst.value = E('_f_qos_rst').checked ? 1 : 0;
139 fom.qos_icmp.value = E('_f_qos_icmp').checked ? 1 : 0;
140 fom.qos_udp.value = E('_f_qos_udp').checked ? 1 : 0;
141 fom.qos_reset.value = E('_f_qos_reset').checked ? 1 : 0;
143 qos = [];
144 for (i = 1; i < 11; ++i) {
145 qos.push(E('_f_qos_' + (i - 1)).value);
148 fom = E('_fom');
149 fom.qos_classnames.value = qos.join(' ');
151 a = [];
152 for (i = 0; i < 10; ++i) {
153 a.push(E('_f_orate_' + i).value + '-' + E('_f_oceil_' + i).value);
155 fom.qos_orates.value = a.join(',');
157 a = [];
159 for (i = 0; i < 10; ++i)
161 //a.push(E('_f_iceil_' + i).value);
162 a.push(E('_f_irate_' + i).value + '-' + E('_f_iceil_' + i).value);
165 fom.qos_irates.value = a.join(',');
167 fom.ne_vegas.value = E('_f_ne_vegas').checked ? 1 : 0;
169 form.submit(fom, 1);
174 </script>
176 </head>
177 <body>
178 <form id='_fom' method='post' action='tomato.cgi'>
179 <table id='container' cellspacing=0>
180 <tr><td colspan=2 id='header'>
181 <div class='title'>Tomato</div>
182 <div class='version'>Version <% version(); %></div>
183 </td></tr>
184 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
185 <td id='content'>
186 <div id='ident'><% ident(); %></div>
188 <!-- / / / -->
191 <input type='hidden' name='_nextpage' value='qos-settings.asp'>
192 <input type='hidden' name='_service' value='qos-restart'>
194 <input type='hidden' name='qos_classnames'>
195 <input type='hidden' name='qos_enable'>
196 <input type='hidden' name='qos_ack'>
197 <input type='hidden' name='qos_syn'>
198 <input type='hidden' name='qos_fin'>
199 <input type='hidden' name='qos_rst'>
200 <input type='hidden' name='qos_icmp'>
201 <input type='hidden' name='qos_udp'>
202 <input type='hidden' name='qos_orates'>
203 <input type='hidden' name='qos_irates'>
204 <input type='hidden' name='qos_reset'>
205 <input type='hidden' name='ne_vegas'>
209 <div class='section-title'>Basic Settings</div>
210 <div class='section'>
211 <script type='text/javascript'>
213 classList = [];
214 for (i = 0; i < 10; ++i) {
215 classList.push([i, classNames[i]]);
217 createFieldTable('', [
218 { title: 'Enable QoS', name: 'f_qos_enable', type: 'checkbox', value: nvram.qos_enable == '1' },
219 { title: 'Prioritize small packets with these control flags', multi: [
220 { suffix: ' ACK &nbsp;', name: 'f_qos_ack', type: 'checkbox', value: nvram.qos_ack == '1' },
221 { suffix: ' SYN &nbsp;', name: 'f_qos_syn', type: 'checkbox', value: nvram.qos_syn == '1' },
222 { suffix: ' FIN &nbsp;', name: 'f_qos_fin', type: 'checkbox', value: nvram.qos_fin == '1' },
223 { suffix: ' RST &nbsp;', name: 'f_qos_rst', type: 'checkbox', value: nvram.qos_rst == '1' }
224 ] },
225 { title: 'Prioritize ICMP', name: 'f_qos_icmp', type: 'checkbox', value: nvram.qos_icmp == '1' },
226 { title: 'No Ingress QOS for UDP', name: 'f_qos_udp', type: 'checkbox', value: nvram.qos_udp == '1' },
227 { title: 'Reset class when changing settings', name: 'f_qos_reset', type: 'checkbox', value: nvram.qos_reset == '1' },
228 { title: 'Default class', name: 'qos_default', type: 'select', options: classList, value: nvram.qos_default },
229 /* REMOVE-BEGIN
230 !!TB - added qos_pfifo
231 REMOVE-END */
232 { title: 'Qdisc Scheduler', name: 'qos_pfifo', type: 'select', options: [['0','sfq'],['1','pfifo'],['2','codel'],['3','fq_codel']], value: nvram.qos_pfifo }
234 </script>
235 </div>
237 <div class='section-title'>Settings for DSL only</div>
238 <div class='section'>
239 <script type='text/javascript'>
241 createFieldTable('', [
242 { title: 'DSL Overhead Value - ATM Encapsulation Type', multi:[
243 {name: 'atm_overhead', type: 'select', options: [['0','None'],['32','32-PPPoE VC-Mux'],['40','40-PPPoE LLC/Snap'],
244 ['10','10-PPPoA VC-Mux'],['14','14-PPPoA LLC/Snap'],
245 ['8','8-RFC2684/RFC1483 Routed VC-Mux'],['16','16-RFC2684/RFC1483 Routed LLC/Snap'],
246 ['24','24-RFC2684/RFC1483 Bridged VC-Mux'],
247 ['32','32-RFC2684/RFC1483 Bridged LLC/Snap']], value:nvram.atm_overhead }
250 </script>
251 </div>
253 <div class='section-title'>Outbound Rates / Limits</div>
254 <div class='section'>
255 <script type='text/javascript'>
256 cc = nvram.qos_orates.split(/[,-]/);
257 f = [];
258 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 });
259 f.push(null);
260 j = 0;
261 for (i = 0; i < 10; ++i) {
262 x = cc[j++] || 1;
263 y = cc[j++] || 1;
264 f.push({ title: classNames[i], multi: [
265 { name: 'f_orate_' + i, type: 'select', options: pctListout, value: x, suffix: ' ' },
266 { name: 'f_oceil_' + i, type: 'select', options: pctListout, value: y },
267 { type: 'custom', custom: ' &nbsp; <span id="_okbps_' + i + '"></span>' } ]
270 createFieldTable('', f);
271 </script>
272 </div>
276 <div class='section-title'>Inbound Rates / Limits</div>
277 <div class='section'>
278 <script type='text/javascript'>
279 allRates = nvram.qos_irates.split(',');
280 f = [];
281 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 });
282 f.push(null);
284 f.push(
286 title: '', multi: [
287 { title: 'Rate' },
288 { title: 'Limit' } ]
289 });
291 for (i = 0; i < 10; ++i)
293 splitRate = allRates[i].split('-');
294 incoming_rate = splitRate[0] || 1;
295 incoming_ceil = splitRate[1] || 100;
297 f.push(
299 title: classNames[i], multi: [
300 { name: 'f_irate_' + i, type: 'select', options: pctListin, value: incoming_rate, suffix: ' ' },
301 { name: 'f_iceil_' + i, type: 'select', options: pctListin, value: incoming_ceil },
302 { custom: ' &nbsp; <span id="_ikbps_' + i + '"></span>' } ]
305 createFieldTable('', f);
306 </script>
307 </div>
311 <div class='section-title'>QOS Class Names <small><i><a href='javascript:toggleFiltersVisibility();'>(Toggle Visibility)</a></i></small></div>
312 <div class='section' id='qosclassnames' style='display:none'>
313 <script type='text/javascript'>
315 if ((v = nvram.qos_classnames.match(/^(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)$/)) == null) {
316 v = ["-","Highest","High","Medium","Low","Lowest","A","B","C","D","E"];
318 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'];
319 f = [{ title: ' ', text: '<small>(Maximum 10 characters, no spaces)</small>' }];
320 for (i = 1; i < 11; ++i) {
321 f.push({ title: titles[i], name: ('f_qos_' + (i - 1)),
322 type: 'text', maxlen: 10, size: 15, value: v[i],
323 suffix: '<span id="count' + i + '"></span>' });
325 createFieldTable('', f);
326 </script>
327 </div>
329 <span id='s_vegas' style='display:none'>
330 <div class='section-title'>TCP Vegas <small>(Network Congestion Control)</small></div>
331 <div class='section'>
332 <script type='text/javascript'>
333 createFieldTable('', [
334 { title: 'Enable TCP Vegas', name: 'f_ne_vegas', type: 'checkbox', value: nvram.ne_vegas == '1' },
335 { title: 'Alpha', name: 'ne_valpha', type: 'text', maxlen: 6, size: 8, value: nvram.ne_valpha },
336 { title: 'Beta', name: 'ne_vbeta', type: 'text', maxlen: 6, size: 8, value: nvram.ne_vbeta },
337 { title: 'Gamma', name: 'ne_vgamma', type: 'text', maxlen: 6, size: 8, value: nvram.ne_vgamma }
339 </script>
340 </div>
341 </span>
343 <!-- / / / -->
345 </td></tr>
346 <tr><td id='footer' colspan=2>
347 <span id='footer-msg'></span>
348 <input type='button' value='Save' id='save-button' onclick='save()'>
349 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
350 </td></tr>
351 </table>
352 </form>
353 <script type='text/javascript'>verifyFields(null, 1);</script>
354 </body>
355 </html>