1. Field of the Invention
The invention relates to a control module and a control method thereof, more particularly to a bandwidth control module and a bandwidth control method thereof.
2. Description of the Related Art
A network includes many network devices and connections among the network devices. If each network device outputs a large amount of data at unspecific times to the connections, a large amount of bandwidth of the connections will be occupied, resulting in data congestion. Therefore, different models are available for the network devices to control the bandwidth used thereby.
Leaky bucket, or token bucket, is a model used to simulate network bandwidth control so as to shape irregular network flow to a fixed flow rate. FIG. 1 schematically illustrates use of a leaky bucket to simulate network bandwidth control. A leaky bucket 31 stores tokens (not shown). Each token corresponds to a transmittable data amount. A packet queue 32 stores packets (not shown) to be transmitted. The packet queue 32 must first obtain tokens in order to be able to output the packets to be transmitted. This is equivalent to a network device (not shown) that is capable of outputting a data amount corresponding to the tokens. Therefore, by controlling the rate at which the leaky bucket 31 is refilled with the tokens, the network device can adjust the rate of data transmission to thereby control the bandwidth used thereby.
A control parameter RATE represents the rate at which the leaky bucket 31 is refilled with tokens, and corresponds to the data transmission rate (i.e., bandwidth). Burst size represents the maximum number of tokens that can be stored in the leaky bucket 31. When the number of tokens accumulated in the leaky bucket 31 exceeds the burst size, subsequently arriving tokens will be discarded.
Referring to FIG. 2, to facilitate processing, in a bandwidth control method conventionally employed by a network device, C clock periods are specified as a time interval according to a system clock with frequency F, and a determined number B of tokens are added as refill every time interval so as to achieve a target bandwidth RATE=F÷C×B, where C and B are integers. For example, if the data that each token corresponds to is 8 bits (1 byte), and the system clock is 75 MHz, 8 tokens (64 bits) are added for refilling every 125 ms of 9375 system clock periods, and the bandwidth R is equal to 512 Kbps.
In the conventional bandwidth control method, B units of data are added as refill every C system clock period. However, given that C and B must be integers, the actually used bandwidth oftentimes cannot be equal to the intended target bandwidth RATE. For example, if the target bandwidth RATE to be set is equal to 832000 bytes per second under the condition that the system clock is 75 MHz, the rate closest to the target bandwidth RATE is 62 bytes every 5589 system clock periods, and the actually used bandwidth will be 831991 bytes per second.
In addition, use of the conventional bandwidth control method will lead to bandwidth instability problems. When the number of system clock periods per time interval is large, the number of tokens required for refilling is large. If there are several packets to be transmitted concurrently at this time, they may be sent out in one batch, thereby creating a burst flow, which makes the bandwidth unstable.
USPTO Backgrounds
USPTO Backgrounds