Project

General

Profile

Bug #12003 » shaper-v2.patch

Anonymous, 06/09/2021 04:47 PM

View differences:

/etc/inc/shaper.inc 2021-06-09 16:41:09.591786000 -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 .= ' dre';
4244
				} else {
4245
					$pfq_rule .= ' ts';
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

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

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

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

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

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

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

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

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

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

  
4611 4759
	function GetWeight() {
......
4746 4894

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

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

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

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

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

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

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

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