Web GUI: hide TCP Vegas settings
[tomato.git] / release / src / router / www / qos-settings.asp
bloba0a6be3355e173b9de0d42d56ae83c8b503414b4
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 <title>[<% ident(); %>] QoS: Basic Settings</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <link rel='stylesheet' type='text/css' href='color.css'>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
20 <script type='text/javascript' src='debug.js'></script>
22 <script type='text/javascript'>
24 /* REMOVE-BEGIN
25 !!TB - added qos_pfifo
26 REMOVE-END */
27 // <% nvram("qos_enable,qos_ack,qos_syn,qos_fin,qos_rst,qos_icmp,qos_default,qos_pfifo,qos_obw,qos_ibw,qos_orates,qos_irates,qos_reset,ne_vegas,ne_valpha,ne_vbeta,ne_vgamma"); %>
29 classNames = ['Highest', 'High', 'Medium', 'Low', 'Lowest', 'Class A', 'Class B', 'Class C', 'Class D', 'Class E'];
31 pctList = [[0, 'None']];
32 for (i = 1; i <= 100; ++i) pctList.push([i, i + '%']);
34 function oscale(rate, ceil)
36 if (rate <= 0) return '';
37 var b = E('_qos_obw').value;
38 var s = comma(MAX(Math.floor((b * rate) / 100), 1));
39 if (ceil > 0) s += ' - ' + MAX(Math.round((b * ceil) / 100), 1);
40 return s + ' <small>kbit/s</small>';
43 function iscale(ceil)
45 if (ceil < 1) return '';
46 return comma(MAX(Math.floor((E('_qos_ibw').value * ceil) / 100), 1)) + ' <small>kbit/s</small>';
49 function verifyFields(focused, quiet)
51 var i, e, b, f;
53 if (!v_range('_qos_obw', quiet, 10, 999999)) return 0;
54 for (i = 0; i < 10; ++i) {
55 elem.setInnerHTML('_okbps_' + i, oscale(E('_f_orate_' + i).value, E('_f_oceil_' + i).value));
58 if (!v_range('_qos_ibw', quiet, 10, 999999)) return 0;
59 for (i = 0; i < 10; ++i) {
60 elem.setInnerHTML('_ikbps_' + i, iscale(E('_f_iceil_' + i).value));
63 f = E('_fom').elements;
64 b = !E('_f_qos_enable').checked;
65 for (i = 0; i < f.length; ++i) {
66 if ((f[i].name.substr(0, 1) != '_') && (f[i].type != 'button') && (f[i].name.indexOf('enable') == -1) &&
67 (f[i].name.indexOf('ne_v') == -1)) f[i].disabled = b;
70 var abg = ['alpha', 'beta', 'gamma'];
71 b = E('_f_ne_vegas').checked;
72 for (i = 0; i < 3; ++i) {
73 f = E('_ne_v' + abg[i]);
74 f.disabled = !b;
75 if (b) {
76 if (!v_range(f, quiet, 0, 65535)) return 0;
80 return 1;
83 function save()
85 var fom = E('_fom');
86 var i, a, c;
88 fom.qos_enable.value = E('_f_qos_enable').checked ? 1 : 0;
89 fom.qos_ack.value = E('_f_qos_ack').checked ? 1 : 0;
90 fom.qos_syn.value = E('_f_qos_syn').checked ? 1 : 0;
91 fom.qos_fin.value = E('_f_qos_fin').checked ? 1 : 0;
92 fom.qos_rst.value = E('_f_qos_rst').checked ? 1 : 0;
93 fom.qos_icmp.value = E('_f_qos_icmp').checked ? 1 : 0;
94 fom.qos_reset.value = E('_f_qos_reset').checked ? 1 : 0;
96 a = [];
97 for (i = 0; i < 10; ++i) {
98 a.push(E('_f_orate_' + i).value + '-' + E('_f_oceil_' + i).value);
100 fom.qos_orates.value = a.join(',');
102 a = [];
103 for (i = 0; i < 10; ++i) {
104 a.push(E('_f_iceil_' + i).value);
106 fom.qos_irates.value = a.join(',');
108 fom.ne_vegas.value = E('_f_ne_vegas').checked ? 1 : 0;
110 form.submit(fom, 1);
112 </script>
114 </head>
115 <body>
116 <form id='_fom' method='post' action='tomato.cgi'>
117 <table id='container' cellspacing=0>
118 <tr><td colspan=2 id='header'>
119 <div class='title'>Tomato</div>
120 <div class='version'>Version <% version(); %></div>
121 </td></tr>
122 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
123 <td id='content'>
124 <div id='ident'><% ident(); %></div>
126 <!-- / / / -->
128 <input type='hidden' name='_nextpage' value='qos-settings.asp'>
129 <input type='hidden' name='_service' value='qos-restart'>
131 <input type='hidden' name='qos_enable'>
132 <input type='hidden' name='qos_ack'>
133 <input type='hidden' name='qos_syn'>
134 <input type='hidden' name='qos_fin'>
135 <input type='hidden' name='qos_rst'>
136 <input type='hidden' name='qos_icmp'>
137 <input type='hidden' name='qos_orates'>
138 <input type='hidden' name='qos_irates'>
139 <input type='hidden' name='qos_reset'>
140 <input type='hidden' name='ne_vegas'>
142 <div class='section-title'>Basic Settings</div>
143 <div class='section'>
144 <script type='text/javascript'>
145 classList = [];
146 for (i = 0; i < 10; ++i) {
147 classList.push([i, classNames[i]]);
149 createFieldTable('', [
150 { title: 'Enable QoS', name: 'f_qos_enable', type: 'checkbox', value: nvram.qos_enable == '1' },
151 { title: 'Prioritize small packets with these control flags', multi: [
152 { suffix: ' ACK &nbsp;', name: 'f_qos_ack', type: 'checkbox', value: nvram.qos_ack == '1' },
153 { suffix: ' SYN &nbsp;', name: 'f_qos_syn', type: 'checkbox', value: nvram.qos_syn == '1' },
154 { suffix: ' FIN &nbsp;', name: 'f_qos_fin', type: 'checkbox', value: nvram.qos_fin == '1' },
155 { suffix: ' RST &nbsp;', name: 'f_qos_rst', type: 'checkbox', value: nvram.qos_rst == '1' }
156 ] },
157 { title: 'Prioritize ICMP', name: 'f_qos_icmp', type: 'checkbox', value: nvram.qos_icmp == '1' },
158 { title: 'Reset class when changing settings', name: 'f_qos_reset', type: 'checkbox', value: nvram.qos_reset == '1' },
159 { title: 'Default class', name: 'qos_default', type: 'select', options: classList, value: nvram.qos_default },
160 /* REMOVE-BEGIN
161 !!TB - added qos_pfifo
162 REMOVE-END */
163 { title: 'Qdisc Scheduler', name: 'qos_pfifo', type: 'select', options: [['0','sfq'],['1','pfifo']], value: nvram.qos_pfifo }
165 </script>
166 </div>
168 <div class='section-title'>Outbound Rate / Limit</div>
169 <div class='section'>
170 <script type='text/javascript'>
171 cc = nvram.qos_orates.split(/[,-]/);
172 f = [];
173 f.push({ title: 'Max Bandwidth', name: 'qos_obw', type: 'text', maxlen: 6, size: 8, suffix: ' <small>kbit/s</small>', value: nvram.qos_obw });
174 f.push(null);
175 j = 0;
176 for (i = 0; i < 10; ++i) {
177 x = cc[j++] || 1;
178 y = cc[j++] || 1;
179 f.push({ title: classNames[i], multi: [
180 { name: 'f_orate_' + i, type: 'select', options: pctList, value: x, suffix: ' ' },
181 { name: 'f_oceil_' + i, type: 'select', options: pctList, value: y },
182 { type: 'custom', custom: ' &nbsp; <span id="_okbps_' + i + '"></span>' } ]
185 createFieldTable('', f);
186 </script>
187 </div>
190 <div class='section-title'>Inbound Limit</div>
191 <div class='section'>
192 <script type='text/javascript'>
193 rates = nvram.qos_irates.split(',');
194 f = [];
195 f.push({ title: 'Max Bandwidth', name: 'qos_ibw', type: 'text', maxlen: 6, size: 8, suffix: ' <small>kbit/s</small>', value: nvram.qos_ibw });
196 f.push(null);
197 for (i = 0; i < 10; ++i) {
198 f.push({ title: classNames[i], multi: [
199 { name: 'f_iceil_' + i, type: 'select', options: pctList, value: rates[i] },
200 { custom: ' &nbsp; <span id="_ikbps_' + i + '"></span>' } ]
203 createFieldTable('', f);
204 </script>
205 </div>
207 <span id='s_vegas' style='display:none'>
208 <div class='section-title'>TCP Vegas <small>(network congestion control)</small></div>
209 <div class='section'>
210 <script type='text/javascript'>
211 /* move me? */
212 createFieldTable('', [
213 { title: 'Enable TCP Vegas', name: 'f_ne_vegas', type: 'checkbox', value: nvram.ne_vegas == '1' },
214 { title: 'Alpha', name: 'ne_valpha', type: 'text', maxlen: 6, size: 8, value: nvram.ne_valpha },
215 { title: 'Beta', name: 'ne_vbeta', type: 'text', maxlen: 6, size: 8, value: nvram.ne_vbeta },
216 { title: 'Gamma', name: 'ne_vgamma', type: 'text', maxlen: 6, size: 8, value: nvram.ne_vgamma }
218 </script>
219 </div>
220 </span>
222 <!-- / / / -->
224 </td></tr>
225 <tr><td id='footer' colspan=2>
226 <span id='footer-msg'></span>
227 <input type='button' value='Save' id='save-button' onclick='save()'>
228 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
229 </td></tr>
230 </table>
231 </form>
232 <script type='text/javascript'>verifyFields(null, 1);</script>
233 </body>
234 </html>