From cc46c180081c2f30ed96c701cdee0a19281ad3d3 Mon Sep 17 00:00:00 2001 From: Tom Barbette Date: Mon, 28 Oct 2024 16:59:10 +0100 Subject: [PATCH 1/2] Set BURST to 1 by default for bandwidthratedunqueue Reading 32 packets will lead to very large imprecision in term of byts --- elements/standard/ratedunqueue.cc | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/elements/standard/ratedunqueue.cc b/elements/standard/ratedunqueue.cc index ecc6f36ac..6e6c198f4 100644 --- a/elements/standard/ratedunqueue.cc +++ b/elements/standard/ratedunqueue.cc @@ -38,7 +38,7 @@ int RatedUnqueue::configure(Vector &conf, ErrorHandler *errh) { if (Args(this, errh).bind(conf) - .read_or_set("BURST", _burst, 32) + .read_or_set("BURST", _burst, -1) .read_or_set("ACTIVE", _active, true) .consume() < 0) return -1; @@ -86,6 +86,10 @@ int RatedUnqueue::initialize(ErrorHandler *errh) { ScheduleInfo::initialize_task(this, &_task, errh); + + if (_burst == -1) + _burst = (is_bandwidth()?1:32); + _signal = Notifier::upstream_empty_signal(this, 0, &_task); _timer.initialize(this); return 0; @@ -172,17 +176,12 @@ RatedUnqueue::write_param(const String &conf, Element *e, void *user_data, RatedUnqueue *u = static_cast(e); switch (reinterpret_cast(user_data)) { case h_active: - click_chatter("Active handler"); - if (!BoolArg().parse(conf, u->_active)) - return errh->error("syntax error"); - if (u->_active && !u->_task.scheduled()) { - - click_chatter("Scheduling"); - u->_task.reschedule(); - } - - break; - + if (!BoolArg().parse(conf, u->_active)) + return errh->error("syntax error"); + if (u->_active && !u->_task.scheduled()) { + u->_task.reschedule(); + } + break; } return 0; } From e6d0bb6cabc8fe487a49133cb88dd34dce65938f Mon Sep 17 00:00:00 2001 From: Tom Barbette Date: Tue, 29 Oct 2024 11:23:31 +0100 Subject: [PATCH 2/2] As BW got more precision we have to fix the tests --- test/standard/BandwidthRatedSplitter-01.clicktest | 2 +- test/standard/BandwidthRatedUnqueue-01.clicktest | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/standard/BandwidthRatedSplitter-01.clicktest b/test/standard/BandwidthRatedSplitter-01.clicktest index b49a7b83a..4f1377e82 100644 --- a/test/standard/BandwidthRatedSplitter-01.clicktest +++ b/test/standard/BandwidthRatedSplitter-01.clicktest @@ -38,7 +38,7 @@ Script(wait 10, read c1.count, read c2.count, read c3.count, read c4.count, writ %expect stdout %expect -w stderr c1.count: -20 +21 c2.count: 70 c3.count: diff --git a/test/standard/BandwidthRatedUnqueue-01.clicktest b/test/standard/BandwidthRatedUnqueue-01.clicktest index 50bc4101a..43598df4c 100644 --- a/test/standard/BandwidthRatedUnqueue-01.clicktest +++ b/test/standard/BandwidthRatedUnqueue-01.clicktest @@ -36,8 +36,8 @@ Script(wait 10, read c1.count, read c2.count, read c3.count, read c4.count, writ c1.count: 21 c2.count: -71 +70 c3.count: -71 +70 c4.count: -{{1001|1002}} +1001