diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-01-23 05:06:46 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-01-23 05:06:46 +0000 |
commit | f1227b8406b0a53b82bb449b08fd602aa2f853b6 (patch) | |
tree | 5ad9e37534f249ac903cfddfcdba16517cc1e8ca /etc/inc/shaper.inc | |
parent | f9b2bf43df49af2f5449d483e90f4b1ed2cec2d3 (diff) | |
download | pfsense-f1227b8406b0a53b82bb449b08fd602aa2f853b6.zip pfsense-f1227b8406b0a53b82bb449b08fd602aa2f853b6.tar.gz |
MFC 9611
Ticket #792 - fix 6 month old shaper bug that caused erratic speeds and latencies. With a 10Mbit queue and 4 iperf jobs running through it in default and otherL queues, I can get an icmp through in otherH with a mere 25ms additional latency on average.
Diffstat (limited to 'etc/inc/shaper.inc')
-rw-r--r-- | etc/inc/shaper.inc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index 78e80b6..6dd40e6 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -100,6 +100,8 @@ function filter_generate_altq_queues($altq_ints) { $altq_rules .= "bandwidth {$rule['bandwidth']}{$rule['bandwidthtype']} "; if (isset($rule['priority']) and $rule['priority'] <> "") $altq_rules .= "priority {$rule['priority']} "; + if (isset($rule['qlimit']) and $rule['qlimit'] <> "") + $altq_rules .= "qlimit {$rule['qlimit']} "; if(isset($rule['red']) and $rule['red'] <> "") $options .= " red"; if(isset($rule['borrow']) and $rule['borrow'] <> "") @@ -201,12 +203,8 @@ function filter_setup_altq_interfaces() { if($queue_names <> ""){ $altq_rules .= "altq on {$config['interfaces'][$ifname]['if']} "; - /* Default bandwidth to 10Mbit - this handles virtual interfaces (vlan) that have - * no bandwidth associated with them. - */ - $bandwidth = "bandwidth 10Mb"; - if($config['interfaces'][$ifname]['bandwidth'] <> "" and $config['interfaces'][$ifname]['bandwidthtype'] <> "" ) - $bandwidth = "bandwidth {$config['interfaces'][$ifname]['bandwidth']}{$config['interfaces'][$ifname]['bandwidthtype']}"; + $bandwidth_arr = get_queue_bandwidth($queue_names); + $bandwidth = "bandwidth {$bandwidth_arr['bandwidth']}{$bandwidth_arr['bandwidthtype']}"; $altq_rules .= "{$config['shaper']['schedulertype']} {$bandwidth} "; $altq_rules .= "queue { {$queue_names} }"; } @@ -216,6 +214,8 @@ function filter_setup_altq_interfaces() { return $altq_rules; } + + /* Find the root queue for an interface */ function find_root_queue($ifname) { global $config; @@ -228,7 +228,8 @@ function find_root_queue($ifname) { /* Confirm that this is a valid queue for this interface */ $rule_interface = is_subqueue_used_on_interface($q['name'], $ifname); if ($rule_interface == 1) { - $queue_names .= " "; + if (strlen($queue_names) > 0) + $queue_names .= " "; $queue_names .= $q['name']; } } @@ -236,6 +237,18 @@ function find_root_queue($ifname) { return $queue_names; } +function get_queue_bandwidth($name) { + global $config; + foreach ($config['shaper']['queue'] as $queue) { + if ($queue['name'] == $name) { + return array( + 'bandwidth' => $queue['bandwidth'], + 'bandwidthtype' => $queue['bandwidthtype'] + ); + } + } +} + function is_queue_attached_children($name) { global $config; if (!is_array($config['shaper']['queue'])) return 0; |