Project

General

Profile

Bug #12003 » shaper-v5-full.patch

Anonymous, 12/19/2021 09:23 PM

View differences:

/etc/inc/shaper.inc 2021-12-19 20:53:46.708392000 -0600
93 93
		),
94 94
		"fq_pie" => array(
95 95
			"name" => "FQ_PIE",
96
			"parameter_format" => "type fq_pie target %sms tupdate %sms alpha %s beta %s max_burst %s max_ecnth %s",
96
			"parameter_format" => "type fq_pie target %sms tupdate %sms alpha %s beta %s max_burst %s max_ecnth %s quantum %s limit %s flows %s",
97 97
			"description" => "Fair Queue Proportional Integral controller Enhanced AQM (FQ_PIE) is similar to FQ_CODEL but uses a slightly different algorithm.",
98 98
			"parameters" => array(
99 99
				"target" => array("name" => "Target Delay (ms)", "type" => "number", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.target")) / 1000),
100 100
				"tupdate" => array("name" => "Interval (ms)", "type" => "number", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.tupdate")) / 1000),
101
				"alpha" => array("name" => "alpha", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.alpha")),
102
				"beta" => array("name" => "beta", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.beta")),
103
				"max_burst" => array("name" => "max_burst", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.max_burst")),
104
				"max_ecnth" => array("name" => "max_ecnth", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.max_ecnth"))
101
				"alpha" => array("name" => "alpha", "type" => "number step=any", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.alpha")) / 1000),
102
				"beta" => array("name" => "beta", "type" => "number step=any", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.beta")) / 1000),
103
				"max_burst" => array("name" => "max_burst", "type" => "number", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.max_burst")) / 1000),
104
				"max_ecnth" => array("name" => "max_ecnth", "type" => "number step=any", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.max_ecnth")) / 1000),
105
				"quantum" => array("name" => "quantum", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.quantum")),
106
				"limit" => array("name" => "limit", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.limit")),
107
				"flows" => array("name" => "flows", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.flows"))
105 108
			),
106
			"ecn" => true
109
			"ecn" => true,
110
			"pie_onoff" => true,
111
			"pie_capdrop" => true,
112
			"pie_qdelay" => true,
113
			"pie_pderand" => true
107 114
		)
108 115
	);
109 116
}
......
134 141
			"parameters" => array(
135 142
				"target" => array("name" => "Target Delay (ms)", "type" => "number", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.target")) / 1000),
136 143
				"tupdate" => array("name" => "Interval (ms)", "type" => "number", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.tupdate")) / 1000),
137
				"alpha" => array("name" => "alpha", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.alpha")),
138
				"beta" => array("name" => "beta", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.beta")),
139
				"max_burst" => array("name" => "max_burst", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.max_burst")),
140
				"max_ecnth" => array("name" => "max_ecnth", "type" => "number", "default" => get_single_sysctl("net.inet.ip.dummynet.fqpie.max_ecnth"))
144
				"alpha" => array("name" => "alpha", "type" => "number step=any", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.alpha")) / 1000),
145
				"beta" => array("name" => "beta", "type" => "number step=any", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.beta")) / 1000),
146
				"max_burst" => array("name" => "max_burst", "type" => "number", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.max_burst")) / 1000),
147
				"max_ecnth" => array("name" => "max_ecnth", "type" => "number step=any", "default" => intval(get_single_sysctl("net.inet.ip.dummynet.fqpie.max_ecnth")) / 1000)
141 148
			),
142
			"ecn" => true
149
			"ecn" => true,
150
			"pie_onoff" => true,
151
			"pie_capdrop" => true,
152
			"pie_qdelay" => true,
153
			"pie_pderand" => true
143 154
		),
144 155
		"red" => array(
145 156
			"name" => "Random Early Detection (RED)",
......
202 213

  
203 214
			// get current value, or default.
204 215
			$currentValue = $params[$key];
205
			if (!$currentValue || $currentValue == '') {
216
			// check if param key is set. using isset allows the param key to be zero.
217
			if (! isset($currentValue)) {
206 218
				$currentValue = $value["default"]; // default to default
207 219
			}
208 220

  
......
3756 3768

  
3757 3769
	/* Limiter queue patch */
3758 3770
	var $ecn; // ecn 'on' or 'off'
3771
	var $pie_onoff;
3772
	var $pie_capdrop;
3773
	var $pie_qdelay;
3774
	var $pie_pderand;
3759 3775
	var $aqm; // key to aqm_map
3760 3776
	var $aqm_params = array(); // AQM params
3761 3777
	var $scheduler;	// key to scheduler_map
......
3784 3800
	function SetECN($ecn) {
3785 3801
			$this->ecn = $ecn;
3786 3802
	}
3803
	function GetPIE_ONOFF() {
3804
			return $this->pie_onoff;
3805
	}
3806
	function SetPIE_ONOFF($pie_onoff) {
3807
			$this->pie_onoff = $pie_onoff;
3808
	}
3809
	function GetPIE_CAPDROP() {
3810
			return $this->pie_capdrop;
3811
	}
3812
	function SetPIE_CAPDROP($pie_capdrop) {
3813
			$this->pie_capdrop = $pie_capdrop;
3814
	}
3815
	function GetPIE_QDELAY() {
3816
			return $this->pie_qdelay;
3817
	}
3818
	function SetPIE_QDELAY($pie_qdelay) {
3819
			$this->pie_qdelay = $pie_qdelay;
3820
	}
3821
	function GetPIE_PDERAND() {
3822
			return $this->pie_pderand;
3823
	}
3824
	function SetPIE_PDERAND($pie_pderand) {
3825
			$this->pie_pderand = $pie_pderand;
3826
	}
3787 3827
	function GetScheduler() {
3788 3828
			return $this->scheduler;
3789 3829
	}
......
3949 3989
		if (!empty($data['aqm']) && !$selectedAqm) {
3950 3990
			$input_errors[] = gettext("Selected AQM not recognized.");
3951 3991
		}
3952
		if ($data['ecn'] && $data['ecn'] == 'on' && !$selectedScheduler["ecn"] && !$selectedAqm["ecn"]) {
3953
			$input_errors[] = gettext("Explicit Congestion Notification is selected, but neither " . $selectedAqm["name"] . " nor " . $selectedScheduler["name"] . " support it.");
3954
		}
3955 3992
		/* End limiter patch */
3956 3993
	}
3957 3994

  
......
4074 4111

  
4075 4112
		// ecn flag
4076 4113
		$this->SetECN($q['ecn']);
4114
		// PIE Flags.
4115
		$this->SetPIE_ONOFF($q['pie_onoff']);
4116
		$this->SetPIE_CAPDROP($q['pie_capdrop']);
4117
		$this->SetPIE_QDELAY($q['pie_qdelay']);
4118
		$this->SetPIE_PDERAND($q['pie_pderand']);
4077 4119
		/* End limiter patch */
4078 4120
	}
4079 4121

  
......
4180 4222
					$pfq_rule .= ' noecn';
4181 4223
				}
4182 4224
			}
4225
			if ($selectedScheduler["pie_onoff"]) {
4226
				if ($this->getPIE_ONOFF() == 'on') {
4227
					$pfq_rule .= 'onoff';
4228
				} else {
4229
					$pfq_rule .= '';
4230
				}
4231
			}
4232
			if ($selectedScheduler["pie_capdrop"]) {
4233
				if ($this->getPIE_CAPDROP() == 'on') {
4234
					$pfq_rule .= ' capdrop';
4235
				} else {
4236
					$pfq_rule .= ' nocapdrop';
4237
				}
4238
			}
4239
			if ($selectedScheduler["pie_qdelay"]) {
4240
				if ($this->getPIE_QDELAY() == 'on') {
4241
					$pfq_rule .= ' ts';
4242
				} else {
4243
					$pfq_rule .= ' dre';
4244
				}
4245
			}
4246
			if ($selectedScheduler["pie_pderand"]) {
4247
				if ($this->getPIE_PDERAND() == 'on') {
4248
					$pfq_rule .= ' derand';
4249
				} else {
4250
					$pfq_rule .= ' noderand';
4251
				}
4252
			}
4183 4253
		}
4184 4254
		$pfq_rule .= "\n";
4185 4255
		/* End patch */
......
4485 4555
		))->setHelp('Specifies the length of the limiter\'s queue, which the scheduler and AQM are responsible for. ' .
4486 4556
			'This field may be left empty.');
4487 4557

  
4488
		$section->addInput(new Form_Checkbox(
4489
			'ecn',
4490
			'ECN',
4491
			'Enable Explicit Congestion Notification (ECN)',
4492
			($this->GetECN() == "on"),
4493
			'on'
4494
		))->setHelp('ECN sets a reserved TCP flag when the queue is nearing or exceeding capacity. Not all AQMs or schedulers support this.');
4558
		$selectedScheduler = getSchedulers()[$this->getScheduler()];
4495 4559

  
4560
		if ($selectedScheduler["ecn"]) {
4561
			$section->addInput(new Form_Checkbox(
4562
				'ecn',
4563
				'ECN',
4564
				'Enable Explicit Congestion Notification (ECN)',
4565
				($this->GetECN() == "on"),
4566
				'on'
4567
			))->setHelp('ECN sets a reserved TCP flag when the queue is nearing or exceeding capacity. Not all AQMs or schedulers support this.');
4568
		}
4569

  
4570
		if ($selectedScheduler["pie_onoff"]) {
4571
			$section->addInput(new Form_Checkbox(
4572
				'pie_onoff',
4573
				'ONOFF',
4574
				'Enable Onoff (onoff,)',
4575
				($this->GetPIE_ONOFF() == "on"),
4576
				'on'
4577
                	))->setHelp('Enable turning PIE on and off depending on queue load.');
4578
		}
4579

  
4580
		if ($selectedScheduler["pie_capdrop"]) {
4581
			$section->addInput(new Form_Checkbox(
4582
				'pie_capdrop',
4583
				'CAPDROP',
4584
				'Enable Capdrop (capdrop,nocapdrop)',
4585
				($this->GetPIE_CAPDROP() == "on"),
4586
				'on'
4587
			))->setHelp('Enable cap drop adjustment.');
4588
		}
4589

  
4590
		if ($selectedScheduler["pie_qdelay"]) {
4591
                        $section->addInput(new Form_Checkbox(
4592
                                'pie_qdelay',
4593
                                'QUEUE DELAY TYPE',
4594
                                'Enable Type Of Qdelay (ts,dre)',
4595
                                ($this->GetPIE_QDELAY() == "on"),
4596
                                'on'
4597
                        ))->setHelp('Set queue delay type to timestamps (checked) or departure rate estimation (unchecked).');
4598
                }
4599

  
4600
		if ($selectedScheduler["pie_pderand"]) {
4601
			$section->addInput(new Form_Checkbox(
4602
				'pie_pderand',
4603
				'PROB DERAND',
4604
				'Enable Drop Probability De-randomisation (derand,noderand)',
4605
				($this->GetPIE_PDERAND() == "on"),
4606
				'on'
4607
			))->setHelp('Enable (checked) or disable (unchecked) drop probability de-randomisation.');
4608
		}
4609

  
4496 4610
		$sform->add($section);
4497 4611
		/* End limiter patch */
4498 4612

  
......
4570 4684
			$cflink[$config_key] = $this->GetAQMParameter($key);
4571 4685
		}
4572 4686
		$cflink['ecn'] = $this->GetECN();
4687

  
4688
		$selectedScheduler = getSchedulers()[$this->getScheduler()];
4689
		if ($selectedScheduler["pie_onoff"]) {
4690
			$cflink['pie_onoff'] = $this->GetPIE_ONOFF();
4691
		}
4692
		if ($selectedScheduler["pie_capdrop"]) {
4693
			$cflink['pie_capdrop'] = $this->GetPIE_CAPDROP();
4694
		}
4695
		if ($selectedScheduler["pie_qdelay"]) {
4696
			$cflink['pie_qdelay'] = $this->GetPIE_QDELAY();
4697
		}
4698
		if ($selectedScheduler["pie_pderand"]) {
4699
			$cflink['pie_pderand'] = $this->GetPIE_PDERAND();
4700
		}
4573 4701
		/* End limiter queue patch */
4574 4702
	}
4575 4703

  
......
4580 4708
	var $weight;
4581 4709
	/* Limiter queue patch */
4582 4710
    var $ecn; // ecn 'on' or 'off'
4711
	var $pie_onoff;
4712
	var $pie_capdrop;
4713
	var $pie_qdelay;
4714
	var $pie_pderand;
4583 4715
    var $aqm; // key to aqm_map
4584 4716
    var $aqm_params = array(); // AQM params
4585 4717
	function GetAQM() {
......
4606 4738
	function SetECN($ecn) {
4607 4739
			$this->ecn = $ecn;
4608 4740
	}
4741
	function GetPIE_ONOFF() {
4742
			return $this->pie_onoff;
4743
	}
4744
	function SetPIE_ONOFF($pie_onoff) {
4745
			$this->pie_onoff = $pie_onoff;
4746
	}
4747
	function GetPIE_CAPDROP() {
4748
			return $this->pie_capdrop;
4749
	}
4750
	function SetPIE_CAPDROP($pie_capdrop) {
4751
			$this->pie_capdrop = $pie_capdrop;
4752
	}
4753
	function GetPIE_QDELAY() {
4754
			return $this->pie_qdelay;
4755
	}
4756
	function SetPIE_QDELAY($pie_qdelay) {
4757
			$this->pie_qdelay = $pie_qdelay;
4758
	}
4759
	function GetPIE_PDERAND() {
4760
			return $this->pie_pderand;
4761
	}
4762
	function SetPIE_PDERAND($pie_pderand) {
4763
			$this->pie_pderand = $pie_pderand;
4764
	}
4609 4765
	/* End limiter queue patch */
4610 4766

  
4611 4767
	function GetWeight() {
......
4641 4797
		if (!empty($data['aqm']) && !$selectedAqm) {
4642 4798
			$input_errors[] = gettext("Selected AQM not recognized.");
4643 4799
		}
4644
		if ($data['ecn'] && $data['ecn'] == 'on' && !$selectedAqm["ecn"]) {
4645
			$input_errors[] = gettext("Explicit Congestion Notification is selected, but " . $selectedAqm["name"] . " does not support it.");
4646
		}
4647 4800
		/* End limiter patch */
4648 4801

  
4649 4802
		if ($data['weight'] && ((!is_numeric($data['weight'])) ||
......
4746 4899

  
4747 4900
		// ecn flag
4748 4901
		$this->SetECN($q['ecn']);
4902
		// PIE Flags.
4903
		$this->SetPIE_ONOFF($q['pie_onoff']);
4904
		$this->SetPIE_CAPDROP($q['pie_capdrop']);
4905
		$this->SetPIE_QDELAY($q['pie_qdelay']);
4906
		$this->SetPIE_PDERAND($q['pie_pderand']);
4749 4907
		/* End limiter patch */
4750 4908
	}
4751 4909

  
......
4787 4945
					$pfq_rule .= ' noecn';
4788 4946
				}
4789 4947
			}
4948
			if ($selectedAQM["pie_onoff"]) {
4949
				if ($this->getPIE_ONOFF() == 'on') {
4950
				$pfq_rule .= 'onoff';
4951
				} else {
4952
					$pfq_rule .= '';
4953
				}
4954
			}
4955
			if ($selectedAQM["pie_capdrop"]) {
4956
				if ($this->getPIE_CAPDROP() == 'on') {
4957
					$pfq_rule .= ' capdrop';
4958
				} else {
4959
					$pfq_rule .= ' nocapdrop';
4960
				}
4961
			}
4962
			if ($selectedAQM["pie_qdelay"]) {
4963
				if ($this->getPIE_QDELAY() == 'on') {
4964
					$pfq_rule .= ' ts';
4965
				} else {
4966
					$pfq_rule .= ' dre';
4967
				}
4968
			}
4969
			if ($selectedAQM["pie_pderand"]) {
4970
				if ($this->getPIE_PDERAND() == 'on') {
4971
					$pfq_rule .= ' derand';
4972
				} else {
4973
					$pfq_rule .= ' noderand';
4974
				}
4975
			}
4790 4976
		}
4791 4977
		/* End patch */
4792 4978

  
......
4916 5102
				$this->GetQlimit()
4917 5103
		))->setHelp('Specifies the length of this queue, which the AQM is responsible for.  This field may be left empty.');
4918 5104

  
4919
		$section->addInput(new Form_Checkbox(
4920
			'ecn',
4921
			'ECN',
4922
			'Enable Explicit Congestion Notification (ECN)',
4923
			($this->GetECN() == "on"),
4924
			'on'
4925
		))->setHelp('ECN sets a reserved TCP flag when the queue is nearing or exceeding capacity. Not all AQMs or schedulers support this.');
5105
		$selectedAQM = getAQMs()[$this->getAQM()];
4926 5106

  
5107
		if ($selectedAQM["ecn"]) {
5108
			$section->addInput(new Form_Checkbox(
5109
				'ecn',
5110
				'ECN',
5111
				'Enable Explicit Congestion Notification (ECN)',
5112
				($this->GetECN() == "on"),
5113
				'on'
5114
			))->setHelp('ECN sets a reserved TCP flag when the queue is nearing or exceeding capacity. Not all AQMs or schedulers support this.');
5115
		}
5116

  
5117
		if ($selectedAQM["pie_onoff"]) {
5118
			$section->addInput(new Form_Checkbox(
5119
				'pie_onoff',
5120
				'ONOFF',
5121
				'Enable Onoff (onoff,)',
5122
				($this->GetPIE_ONOFF() == "on"),
5123
				'on'
5124
			))->setHelp('Enable turning PIE on and off depending on queue load.');
5125
		}
5126
                                 
5127
		if ($selectedAQM["pie_capdrop"]) {
5128
			$section->addInput(new Form_Checkbox(
5129
				'pie_capdrop',
5130
				'CAPDROP',
5131
				'Enable Capdrop (capdrop,nocapdrop)',
5132
				($this->GetPIE_CAPDROP() == "on"),
5133
				'on'
5134
			))->setHelp('Enable cap drop adjustment.');
5135
		}
5136
                 
5137
		if ($selectedAQM["pie_qdelay"]) {
5138
			$section->addInput(new Form_Checkbox(
5139
				'pie_qdelay',
5140
				'QUEUE DELAY TYPE',
5141
				'Enable Type Of Qdelay (ts,dre)',
5142
				($this->GetPIE_QDELAY() == "on"),
5143
				'on'
5144
			))->setHelp('Set queue delay type to timestamps (checked) or departure rate estimation (unchecked).');
5145
		}
5146

  
5147
		if ($selectedAQM["pie_pderand"]) {
5148
			$section->addInput(new Form_Checkbox(
5149
				'pie_pderand',
5150
				'PROB DERAND',
5151
				'Enable Drop Probability De-randomisation (derand,noderand)',
5152
				($this->GetPIE_PDERAND() == "on"),
5153
				'on'
5154
			))->setHelp('Enable (checked) or disable (unchecked) drop probability de-randomisation.');
5155
		}
4927 5156
		$sform->add($section);
4928 5157
		/* End limiter patch */
4929 5158

  
......
4996 5225
			$cflink[$config_key] = $this->GetAQMParameter($key);
4997 5226
		}
4998 5227
		$cflink['ecn'] = $this->GetECN();
5228

  
5229
		$selectedAQM = getAQMs()[$this->getAQM()];
5230
		if ($selectedAQM["pie_onoff"]) {
5231
			$cflink['pie_onoff'] = $this->GetPIE_ONOFF();
5232
		}
5233
		if ($selectedAQM["pie_capdrop"]) {
5234
			$cflink['pie_capdrop'] = $this->GetPIE_CAPDROP();
5235
		}
5236
		if ($selectedAQM["pie_qdelay"]) {
5237
			$cflink['pie_qdelay'] = $this->GetPIE_QDELAY();
5238
		}
5239
		if ($selectedAQM["pie_pderand"]) {
5240
			$cflink['pie_pderand'] = $this->GetPIE_PDERAND();
5241
		}
4999 5242
		/* End limiter queue patch */
5000 5243
	}
5001 5244
}
(8-8/8)