diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2016-03-28 17:08:52 -0500 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2016-03-28 17:13:35 -0500 |
commit | 22752ae78bd2f0e3c04ed9ebb00e6cf72415f083 (patch) | |
tree | ac15e69adbe2799c8d6e692d020753f31650f23f /src/etc | |
parent | f6742d9a4402030d2b69602f0f48add96ea202a2 (diff) | |
download | pfsense-22752ae78bd2f0e3c04ed9ebb00e6cf72415f083.zip pfsense-22752ae78bd2f0e3c04ed9ebb00e6cf72415f083.tar.gz |
Set the ALTQ root queue bandwidth.
Whenever possible set it to 1Gb, if the sum of child queues if higher than 1Gb, set it the correct value so we do not break any existing setup.
Ticket #5721
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc index fb1bb6f..f160eb3 100644 --- a/src/etc/inc/globals.inc +++ b/src/etc/inc/globals.inc @@ -99,7 +99,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "14.8", + "latest_config" => "14.9", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 131535e..15fc0b4 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -4752,4 +4752,31 @@ function upgrade_147_to_148() { } } } + +function upgrade_148_to_149() { + global $config; + global $altq_list_queues; + + if (!isset($config['shaper']['queue']) || !is_array($config['shaper']['queue'])) + return; + + read_altq_config(); + + /* Set root queue bandwidth. */ + foreach ($altq_list_queues as $altq) { + $sum = $altq->GetTotalBw(); + while ($sum > get_queue_bandwidth($altq)) { + if (intval(($sum / 1000) * 1.2) < 1024 * 1024) + /* 1Gb where possible. */ + $bw = 1024 * 1024; + else + /* Increase by 20% until it fits. */ + $bw = intval(($sum / 1000) * 1.2); + $altq->SetBandwidth($bw); + $altq->SetBwscale("Kb"); + $altq->wconfig(); + $sum = $altq->GetTotalBw(); + } + } +} ?> |