Commit 0f455982 authored by Tom Barbette's avatar Tom Barbette

LinkUnqueue : allow no bandwidth

parent a867f698
......@@ -50,8 +50,8 @@ LinkUnqueue::configure(Vector<String> &conf, ErrorHandler *errh)
.read_mp("LATENCY", _latency)
.read_mp("BANDWIDTH", BandwidthArg(), _bandwidth).complete() < 0)
return -1;
if (_bandwidth < 100)
return errh->error("bandwidth too small, minimum 100Bps");
if (_bandwidth < 100 && _bandwidth != 0)
return errh->error("bandwidth too small, minimum 100Bps, or 0 to disable bandwidth");
_bandwidth /= 100;
return 0;
}
......@@ -81,8 +81,12 @@ LinkUnqueue::cleanup(CleanupStage)
void
LinkUnqueue::delay_by_bandwidth(Packet *p, const Timestamp &tv) const
{
uint32_t length = p->length() + EXTRA_LENGTH_ANNO(p);
uint32_t delay = (length * 10000) / _bandwidth;
uint32_t delay = 0;
if (_bandwidth > 0) {
uint32_t length = p->length() + EXTRA_LENGTH_ANNO(p);
delay = (length * 10000) / _bandwidth;
}
p->set_timestamp_anno(tv + Timestamp::make_usec(delay));
}
......
......@@ -24,7 +24,7 @@ serial link with latency LATENCY (microsecond precision) and bandwidth
BANDWIDTH (such as "384kbps"). Thus, every packet is delayed at least
by LATENCY, and additionally delayed by its packet size and BANDWIDTH, and
by any packets ahead of it in the virtual link. Packets are pushed out the
single output port when their time comes.
single output port when their time comes. If BANDWITH is 0, only the LATENCY will introduce some delay.
LinkUnqueue listens for upstream notification, such as that available from
Queue.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment