Project

General

Profile

Bug #12003 » shaper-full-v4.patch

Anonymous, 06/29/2021 12:54 PM

View differences:

/etc/inc/shaper.inc 2021-06-29 12:46:52.467248000 -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 == '') {
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
		$cflink['pie_onoff'] = $this->GetPIE_ONOFF();
4688
		$cflink['pie_capdrop'] = $this->GetPIE_CAPDROP();
4689
		$cflink['pie_qdelay'] = $this->GetPIE_QDELAY();
4690
		$cflink['pie_pderand'] = $this->GetPIE_PDERAND();
4573 4691
		/* End limiter queue patch */
4574 4692
	}
4575 4693

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

  
4611 4757
	function GetWeight() {
......
4641 4787
		if (!empty($data['aqm']) && !$selectedAqm) {
4642 4788
			$input_errors[] = gettext("Selected AQM not recognized.");
4643 4789
		}
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 4790
		/* End limiter patch */
4648 4791

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

  
4747 4890
		// ecn flag
4748 4891
		$this->SetECN($q['ecn']);
4892
		// PIE Flags.
4893
		$this->SetPIE_ONOFF($q['pie_onoff']);
4894
		$this->SetPIE_CAPDROP($q['pie_capdrop']);
4895
		$this->SetPIE_QDELAY($q['pie_qdelay']);
4896
		$this->SetPIE_PDERAND($q['pie_pderand']);
4749 4897
		/* End limiter patch */
4750 4898
	}
4751 4899

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

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

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

  
5097
		if ($selectedAQM["ecn"]) {
5098
			$section->addInput(new Form_Checkbox(
5099
				'ecn',
5100
				'ECN',
5101
				'Enable Explicit Congestion Notification (ECN)',
5102
				($this->GetECN() == "on"),
5103
				'on'
5104
			))->setHelp('ECN sets a reserved TCP flag when the queue is nearing or exceeding capacity. Not all AQMs or schedulers support this.');
5105
		}
5106

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

  
5137
		if ($selectedAQM["pie_pderand"]) {
5138
			$section->addInput(new Form_Checkbox(
5139
				'pie_pderand',
5140
				'PROB DERAND',
5141
				'Enable Drop Probability De-randomisation (derand,noderand)',
5142
				($this->GetPIE_PDERAND() == "on"),
5143
				'on'
5144
			))->setHelp('Enable (checked) or disable (unchecked) drop probability de-randomisation.');
5145
		}
4927 5146
		$sform->add($section);
4928 5147
		/* End limiter patch */
4929 5148

  
......
4996 5215
			$cflink[$config_key] = $this->GetAQMParameter($key);
4997 5216
		}
4998 5217
		$cflink['ecn'] = $this->GetECN();
5218
		$cflink['pie_onoff'] = $this->GetPIE_ONOFF();
5219
		$cflink['pie_capdrop'] = $this->GetPIE_CAPDROP();
5220
		$cflink['pie_qdelay'] = $this->GetPIE_QDELAY();
5221
		$cflink['pie_pderand'] = $this->GetPIE_PDERAND();
4999 5222
		/* End limiter queue patch */
5000 5223
	}
5001 5224
}
(4-4/8)