Project

General

Profile

Bug #12003 » shaper-v3.patch

Anonymous, 06/11/2021 12:36 PM

View differences:

/etc/inc/shaper.inc 2021-06-11 10:51:24.623538000 -0500
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 == '') {
206
				$currentValue = $value["default"]; // default to default
216
			// check if param key is set. allows the param key to be zero.
217
			if (! isset($currentValue)) {
218
				if (!$currentValue || $currentValue == '') {
219
					$currentValue = $value["default"]; // default to default
220
				}
207 221
			}
208 222

  
209 223
			$form .= "<td class=\"col-xs-4\">" . htmlspecialchars($key) . "</td>";
......
3756 3770

  
3757 3771
	/* Limiter queue patch */
3758 3772
	var $ecn; // ecn 'on' or 'off'
3773
	var $pie_onoff;
3774
	var $pie_capdrop;
3775
	var $pie_qdelay;
3776
	var $pie_pderand;
3759 3777
	var $aqm; // key to aqm_map
3760 3778
	var $aqm_params = array(); // AQM params
3761 3779
	var $scheduler;	// key to scheduler_map
......
3784 3802
	function SetECN($ecn) {
3785 3803
			$this->ecn = $ecn;
3786 3804
	}
3805
	function GetPIE_ONOFF() {
3806
			return $this->pie_onoff;
3807
	}
3808
	function SetPIE_ONOFF($pie_onoff) {
3809
			$this->pie_onoff = $pie_onoff;
3810
	}
3811
	function GetPIE_CAPDROP() {
3812
			return $this->pie_capdrop;
3813
	}
3814
	function SetPIE_CAPDROP($pie_capdrop) {
3815
			$this->pie_capdrop = $pie_capdrop;
3816
	}
3817
	function GetPIE_QDELAY() {
3818
			return $this->pie_qdelay;
3819
	}
3820
	function SetPIE_QDELAY($pie_qdelay) {
3821
			$this->pie_qdelay = $pie_qdelay;
3822
	}
3823
	function GetPIE_PDERAND() {
3824
			return $this->pie_pderand;
3825
	}
3826
	function SetPIE_PDERAND($pie_pderand) {
3827
			$this->pie_pderand = $pie_pderand;
3828
	}
3787 3829
	function GetScheduler() {
3788 3830
			return $this->scheduler;
3789 3831
	}
......
4074 4116

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

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

  
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.');
4563
		$selectedScheduler = getSchedulers()[$this->getScheduler()];
4495 4564

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

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

  
4585
		if ($selectedScheduler["pie_capdrop"]) {
4586
			$section->addInput(new Form_Checkbox(
4587
				'pie_capdrop',
4588
				'CAPDROP',
4589
				'Enable Capdrop (capdrop,nocapdrop)',
4590
				($this->GetPIE_CAPDROP() == "on"),
4591
				'on'
4592
			))->setHelp('Enable cap drop adjustment.');
4593
		}
4594

  
4595
		if ($selectedScheduler["pie_qdelay"]) {
4596
                        $section->addInput(new Form_Checkbox(
4597
                                'pie_qdelay',
4598
                                'QUEUE DELAY TYPE',
4599
                                'Enable Type Of Qdelay (dre,ts)',
4600
                                ($this->GetPIE_QDELAY() == "on"),
4601
                                'on'
4602
                        ))->setHelp('Calculate queue delay using departure rate estimation (checked) or timestamps (unchecked).');
4603
                }
4604

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

  
4496 4615
		$sform->add($section);
4497 4616
		/* End limiter patch */
4498 4617

  
......
4570 4689
			$cflink[$config_key] = $this->GetAQMParameter($key);
4571 4690
		}
4572 4691
		$cflink['ecn'] = $this->GetECN();
4692
		$cflink['pie_onoff'] = $this->GetPIE_ONOFF();
4693
		$cflink['pie_capdrop'] = $this->GetPIE_CAPDROP();
4694
		$cflink['pie_qdelay'] = $this->GetPIE_QDELAY();
4695
		$cflink['pie_pderand'] = $this->GetPIE_PDERAND();
4573 4696
		/* End limiter queue patch */
4574 4697
	}
4575 4698

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

  
4611 4762
	function GetWeight() {
......
4746 4897

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

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

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

  
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.');
5103
		$selectedAQM = getAQMs()[$this->getAQM()];
4926 5104

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

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

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

  
......
4996 5223
			$cflink[$config_key] = $this->GetAQMParameter($key);
4997 5224
		}
4998 5225
		$cflink['ecn'] = $this->GetECN();
5226
		$cflink['pie_onoff'] = $this->GetPIE_ONOFF();
5227
		$cflink['pie_capdrop'] = $this->GetPIE_CAPDROP();
5228
		$cflink['pie_qdelay'] = $this->GetPIE_QDELAY();
5229
		$cflink['pie_pderand'] = $this->GetPIE_PDERAND();
4999 5230
		/* End limiter queue patch */
5000 5231
	}
5001 5232
}
(3-3/8)