Project

General

Profile

Bug #12003 » shaper-pie-001.patch

Anonymous, 06/29/2021 12:54 PM

View differences:

/etc/inc/shaper.inc 2021-06-29 12:42:44.964662000 -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)",
......
3756 3767

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

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

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

  
4560
		$selectedScheduler = getSchedulers()[$this->getScheduler()];
4561

  
4488 4562
		$section->addInput(new Form_Checkbox(
4489 4563
			'ecn',
4490 4564
			'ECN',
......
4493 4567
			'on'
4494 4568
		))->setHelp('ECN sets a reserved TCP flag when the queue is nearing or exceeding capacity. Not all AQMs or schedulers support this.');
4495 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() {
......
4746 4892

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

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

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

  
5098
		$selectedAQM = getAQMs()[$this->getAQM()];
5099

  
4919 5100
		$section->addInput(new Form_Checkbox(
4920 5101
			'ecn',
4921 5102
			'ECN',
......
4924 5105
			'on'
4925 5106
		))->setHelp('ECN sets a reserved TCP flag when the queue is nearing or exceeding capacity. Not all AQMs or schedulers support this.');
4926 5107

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

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

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