tbrconfig

Configure a token bucket regulator for an output queue

Syntax:

tbrconfig interface [tokenrate [bucketsize]]
tbrconfig -d interface
tbrconfig -a

Runs on:

QNX Neutrino

Options:

-a
Display information about all interfaces in the system.
-d
Remove the token bucket regulator for the specified interface.
tokenrate
Limits the average rate at which tokens accumulate in the buckets.
bucketsize
Limits the maximum burst size.

Description:

The trbconfig utility configures a token bucket regulator for the output network interface queue. A token bucket regulator limits both the average amount and instantaneous amount of packets that the underlying driver can dequeue from the network interface.

Conceptually, tokens accumulate in a bucket at the average tokenrate, to the bucketsize. The driver can dequeue packets as long as there are positive amount of tokens, and the length of the dequeued packet is subtracted from the remaining tokens. Tokens can be negative as a deficit, and packets aren't dequeued from the interface queue until the tokens become positive again.

Limiting the burst size is essential to packet scheduling, since the scheduler schedules packets backlogged at the network interface. Limiting the burst size is also needed for drivers which dequeues more packets than they can send and end up with discarding excess packets.

When the tokenrate is set to higher than the actual transmission rate, the transmission complete interrupt will trigger the next dequeue. On the other hand, when the tokenrate is set to lower than the actual transmission rate, the transmission complete interrupt would occur before the tokens become positive. In this case, the next dequeue will be triggered by a timer event.

Because the kernel timer has a limited granularity, a larger bucketsize is required for a higher tokenrate.

The interface parameter is a string that consists of a name followed by a unit, for example, en0. The tokenrate parameter specifies the average rate in bits per second; you can append K or M as shorthand for Kbps or Mbps.

When tokenrate is omitted, tbrconfig displays the current parameter values.

The bucketsize parameter specifies the bucket size in bytes; you can append a K to indicate kilobytes. When bucketsize is omitted, tbrconfig assumes the regulator is driven by transmission complete interrupts and, using heuristics, assigns a small bucket size according to the tokenrate. When the keyword auto is given as bucketsize, assumes the regulator is driven by transmission complete interrupts and, using heuristics, assigns a small bucket size according to the tokenrate.

When the keyword is given as bucketsize, tbrconfig assumes the regulator is driven by the kernel timer, and computes the bucket size from the tokenrate and the kernel clock frequency.

Examples:

Configure a token bucket regulator for the interface en0 with 10 Mbps token rate and 8 KB bucket size:

tbrconfig en0 10M 8K

Rate-limit the interface en0 up to 3 Mbps:

tbrconfig en0 3M auto