CN112751777A - High-rate flow control method and device - Google Patents
High-rate flow control method and device Download PDFInfo
- Publication number
- CN112751777A CN112751777A CN202110014179.6A CN202110014179A CN112751777A CN 112751777 A CN112751777 A CN 112751777A CN 202110014179 A CN202110014179 A CN 202110014179A CN 112751777 A CN112751777 A CN 112751777A
- Authority
- CN
- China
- Prior art keywords
- token
- flow control
- token bucket
- read request
- increment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 230000000977 initiatory effect Effects 0.000 claims abstract description 22
- 238000012545 processing Methods 0.000 claims abstract description 18
- 230000001360 synchronised effect Effects 0.000 claims abstract description 11
- 238000009825 accumulation Methods 0.000 abstract description 19
- 238000004891 communication Methods 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 19
- 230000007246 mechanism Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/215—Flow control; Congestion control using token-bucket
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/24—Traffic characterised by specific attributes, e.g. priority or QoS
- H04L47/2425—Traffic characterised by specific attributes, e.g. priority or QoS for supporting services specification, e.g. SLA
- H04L47/2433—Allocation of priorities to traffic types
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/32—Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
A high-speed flow control method and a device relate to the technical field of communication, and the method comprises the following steps: initiating a flow control read request to a token bucket by a data message needing flow control according to a pipeline mode; flow control judgment is carried out in sequence according to the returned data of the flow control read request, the judged data message is forwarded, the decrement of the token is calculated at the same time, and a decrement write request is initiated to the token bucket; the token bucket is self-refreshed at regular time, increment write requests are initiated by calculating the increment of the token, and the decrement and increment are queued for accumulation to perform cache operation; after the synchronous token value is added with the accumulated increment or subtracted with the accumulated decrement, the obtained result is written into the corresponding token bucket according to the token bucket address; the invention improves the packet processing capability and ensures that the messages with different packet lengths have fair forwarding opportunities.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for controlling a flow rate at a high rate.
Background
The communication chip needs to accurately limit the flow based on the message attributes (service type, user, ip address field, etc.), that is, it performs flow control on the data messages transmitted in the network by using different Committed Access Rates (CAR), so as to achieve the purpose of fine network bandwidth allocation. The realization mode in the chip circuit is that the flow identification circuit and the flow control circuit are matched to finish speed limiting.
The flow control circuit generally adopts a method of limiting the speed of a message by using a token bucket. The circuit continuously fills the token bucket with tokens at regular intervals until full. When processing a message, the message length is compared to the token number of the token bucket. If the token is enough, allowing the message to pass and simultaneously deducting the token number corresponding to the message length; if the token is insufficient, the message is discarded or the priority of the message is reduced.
However, there are two problems with the prior art.
Problem 1: packet processing capacity is significantly reduced by token bucket based traffic restrictions, and it has been difficult for existing approaches to meet high rate packet processing requirements.
The bandwidth handling capacity of the packets (fps, number of packets per second) is at most the clock frequency f (hz). The operation of the token bucket can be generalized to a "read-modify-write" process.
When flow control is turned on, each packet process needs to read and write back tokens. Only after the current packet 'read-modify-write' is completed, the pipeline can allow the next packet to enter; even if a cache mechanism is introduced, the reading of the next packet can be started at least after the 'changing' process is finished; if the processing of the decision circuit requires k clock cycles, the bandwidth handling capability becomes
Further, in the updating process, a token is added once in each time slot, a part of time sequence operation token bucket is required to be occupied, and the packet processing capacity is also obviously influenced. Recording the time slot of the filling cycle as period, updating the depth of the token bucket as depth, and combining the loss bandwidth of the flow control, the maximum bandwidth processing capacity of the system is reduced as follows:
problem 2: the packet loss judgment is carried out by comparing the packet length with the current token value based on the flow limitation of the token bucket, the short packet preemption in the existing method can cause the long packet to lose the sending chance, and the fairness is not provided for the long and short packets of the same attribute flow.
When the speed limit is effective, judging that the short packet passes through and simultaneously deducting the corresponding token as long as the token is added to the allowable short packet length; that is, the token cannot be added to a value that allows the long packet to be long, and the long packet has no chance of being decided through.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a high-rate flow control method and a high-rate flow control device, which improve the packet processing capacity and ensure that messages with different packet lengths have fair forwarding opportunities.
To achieve the above object, in one aspect, the present invention provides a high-rate flow control method, including the steps of:
initiating a flow control read request to a token bucket by a data message needing flow control according to a pipeline mode; flow control judgment is carried out in sequence according to the returned data of the flow control read request, the judged data message is forwarded, the decrement of the token is calculated at the same time, and a decrement write request is initiated to the token bucket;
initiating an updating read request to the token bucket at regular time; updating judgment is carried out according to the returned data of the updating read request, and an increment write request is initiated for the increment of the token calculated by the token value passing the judgment;
the decrement and increment queues are accumulated, and cache operation is carried out; and after the synchronous token value is added with the accumulated increment or subtracted with the accumulated decrement, the obtained result is written into the corresponding token bucket according to the token bucket address.
Preferably, the sequentially performing flow control judgment according to the data returned by the flow control read request includes:
if the data returned by the flow control read request is larger than or equal to the preset token threshold, forwarding the data message;
if the flow control read request return data is smaller than the token threshold, discarding the data message or reducing the priority of the data message;
preferably, the making of the update decision according to the returned data of the update read request includes:
when the value of the token in the data returned by the updating read request is smaller than the maximum depth of the token bucket, the updating judgment is passed, and the increment of the token is calculated;
and when the token value in the data returned by the updating read request is greater than the maximum depth of the token bucket, the updating judgment is failed, and the operation is not carried out.
Preferably, the flow control read request and the update read request initiate reading to the token bucket through queuing, and when the flow control read request and the update read request reach the queued queue at the same time, the flow control read request and the update read request are processed first with high priority.
Preferably, the performing cache operation includes:
when increment or decrement is accumulated once, the address of the current write request token bucket is compared with the content of the cache for one round;
if the cache hits, adding the cache hit result with the increment or subtracting the cache hit result with the decrement to obtain a new increment or decrement, and writing the new increment or decrement and the corresponding token bucket address into the cache;
and if the cache does not hit, writing the increment or decrement of the write request and the corresponding token bucket address into the cache.
In another aspect, the present invention provides a high flow rate flow control device, including:
a packet receiving queue, configured to receive a data packet requiring flow control;
a token bucket to store tokens;
the flow control judgment module initiates a flow control read request to the token bucket in a pipeline mode, sequentially performs flow control judgment according to the return data of the flow control read request, and forwards the data message passing the judgment;
the decrement calculation module is used for calculating the decrement of the token while the flow control judgment module forwards the data message, and is also used for initiating a decrement write request to the token bucket;
the updating module is used for initiating an updating read request to the token bucket at regular time; carrying out updating judgment according to the returned data of the updating read request;
the increment calculation module is used for calculating the increment of the token for the token value passing the judgment and initiating an increment write request to the token bucket;
an accumulator for accumulating the enqueuing of decrements and increments; the synchronous token value is added with the accumulated increment or subtracted with the accumulated decrement, and the obtained result is written into the corresponding token bucket according to the token bucket address;
and the cache module is used for performing cache operation on the accumulator.
Preferably, the basis of the flow control judgment performed by the flow control judgment module is as follows:
if the data returned by the flow control read request is larger than or equal to the preset token threshold, forwarding the data message;
if the flow control read request return data is smaller than the token threshold, discarding the data message or reducing the priority of the data message;
preferably, the update module is further configured to initiate an update read request to the token bucket while the flow control decision module initiates a flow control read request;
the device further comprises:
a timer for generating a fixed time interval at which the update module sends the update read request;
the read queue device is used for sequentially queuing the read requests, receiving the existing token values returned by the token bucket and returning the token values to the flow control judgment module or the updating module; the read requests include flow controlled read requests and update read requests.
Preferably, the updating module performs an update decision according to the returned data of the update read request, and includes:
when the value of the token in the data returned by the updating read request is smaller than the maximum depth of the token bucket, the updating judgment is passed, and the increment of the token is calculated;
and when the token value in the data returned by the updating read request is greater than the maximum depth of the token bucket, the updating judgment is failed, and the operation is not carried out.
Preferably, the apparatus further comprises:
and the write queue device is used for queuing the increment write request and the decrement write request and transmitting the increment write request and the decrement write request to the accumulator one by one.
Preferably, the apparatus further comprises:
and the synchronizer copies a read request token bucket address and a token value returned by the token bucket to the read queue device to the synchronizer when receiving the returned token value of the token bucket, and synchronizes the read request token bucket address and the token value to the accumulator.
Preferably, the token bucket comprises a plurality of token bucket addresses, and the apparatus refreshes tokens in parallel while initiating update read requests for the plurality of token bucket addresses.
The technical scheme has the following beneficial effects:
the invention cancels the association between the decision threshold and the latest token value in the flow control and updating process, and takes the token value at the reading time as the decision reference. When the token value is written back, the difference or increment of the token operation is accumulated and written into the cache, so that the accuracy of the token value in the token bucket is ensured.
The association between the packet length and the token value is cancelled in the flow control judgment, and the token threshold with the token value larger than the preset value is used as the judgment threshold, so that the data messages with various packet lengths have the same judgment passing opportunity.
And a decrement and increment cache mechanism is used for changing the cache operation complete token into increment and decrement of the operation token value only, so that the cache storage width is obviously reduced, and the decrement and increment are saved in an accumulation mode, thereby reducing the calculation complexity.
Drawings
FIG. 1 is a high rate flow control device according to an embodiment of the present invention;
FIG. 2 is a flow chart of a flow control process according to an embodiment of the present invention;
FIG. 3 is a flowchart of an update process according to an embodiment of the present invention;
FIG. 4 is a flow chart of accumulating and writing tokens into a token bucket according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an accumulation principle of an accumulator according to an embodiment of the present invention.
Reference numerals:
1-data message access, 2-read request, 3-return data corresponding to the read request, 4-write request and corresponding write data, 5-synchronous operation, and 6-cache operation.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
The invention provides an embodiment of a high-speed flow control method, which comprises the following steps:
the data message which needs to be subjected to flow control enters a packet receiving queue, and a flow control read request is initiated to a token bucket according to a pipeline mode; sequentially carrying out flow control judgment according to the return data corresponding to the flow control read request; and calculating the decrement of the token through the flow control judgment data message, and then initiating a decrement write request to the token bucket.
Initiating an updating read request to the token bucket at regular time; carrying out update judgment according to the returned data of the update read request, calculating the increment of the token according to the token value passing the judgment, and initiating an increment write request;
and (4) queuing and accumulating the decrement and increment to perform cache operation. And adding the accumulated increment to the synchronized token value or subtracting the accumulated decrement to obtain a result, and writing the result into the token bucket according to the address of the token bucket. Wherein the token value is: and the token bucket controls the read request according to the flow control or updates the token value contained in the token data returned by the read request.
Specifically, the above-mentioned manner according to the pipeline means: and immediately starting a new flow control read request without waiting for the last flow control read request to be responded, wherein the flow control read request needs to be queued.
Further, an embodiment of flow control decision making according to the return data of the flow control read request is provided. Judging through the flow control read request return data and a preset token threshold, and forwarding a data message if the flow control read request return data is greater than or equal to the token threshold; and if the flow control read request returned data is smaller than the token threshold, discarding the data message or reducing the priority of the data message.
In this embodiment, the default value of the token threshold is 0. The token threshold may also be other values, for example, the ethernet packet may be set to a Maximum Transmission Unit (MTU) value 1518.
The decrement is generally a length value of the data packet (e.g., link layer packet length), and may also be a parameter that is embodied as a traffic characteristic.
And meanwhile, the token bucket is continuously self-refreshed, and the token is added. A fixed time interval may be generated by a timer and an update read request may be sent to the token bucket to query the token value present in the token bucket. The time interval is related to the speed limit accuracy, and is preferably 7.8125us in the embodiment.
The flow control read request and the update read request initiate reading to the token bucket through queuing together, so that the request initiated first is guaranteed to be responded first, when the flow control read request and the update read request reach the queued queue at the same time, the request with high priority is processed first, and the other one waits.
The updating judgment according to the returned data of the updating read request comprises the following steps: when the value of the token in the data returned by the updating read request is greater than the maximum depth of the token bucket, the token is filled and the operation is not carried out. When the token value in the data returned by the updating read request is smaller than the maximum depth of the token bucket, the tokens are required to be added according to the configuration, and the increment of the tokens is calculated.
The value of adding the token is the value of calculating and processing by using the message limiting rate and the filling times per second, and the value of adding the token is the message limiting rate. For example, if the packet is limited to a rate of 64kbps and 128k tokens are filled in per second (e.g., time interval 7.8125us), the value of the added token is 0.5 b; if the token is filled 1 time per second (e.g., 1s time interval), the value of this added token is 64 kb.
The cache operation specifically includes:
every time increment or decrement is accumulated once, the address of the current write request token bucket and the content of the cache are compared for one round;
if the cache hits, adding the cache hit result and the increment or subtracting the difference value, and writing the obtained new increment or decrement and the corresponding token bucket address into the cache;
and if the cache does not hit, writing the increment or decrement of the write request and the corresponding token bucket address into the cache.
If the cache has a plurality of hit results, selecting the latest entry to perform the subsequent process.
In the real-time example, the cache only needs to store increment or decrement of the token value, and compared with the storage of the token value, the storage of the increment or decrement can obviously reduce the width of the cache.
An embodiment of a high flow rate flow control device is provided, as shown in fig. 1, that can be used to implement the above method. For the sake of clarity, the reference numerals of the arrows in fig. 1 indicate different paths and data flow directions, and specifically include: the data processing method comprises a data message access 1, a read request 2, return data 3 corresponding to the read request, a write request and corresponding write data 4, a synchronous operation 5 and a cache operation 6. In this embodiment, the flow control device mainly includes a packet receiving queue, a token bucket, a flow control decision module, an update module, a decrement calculation module, an increment calculation module, and an accumulator.
The token bucket stores tokens; and the packet receiving queue receives the data message which needs to be subjected to flow control.
The flow control judgment module initiates a flow control read request to the token bucket according to a pipeline mode, and is used for sequentially carrying out flow control judgment according to the return data of the flow control read request and forwarding the data message passing the judgment to the decrement calculation module.
And the decrement calculation module is used for calculating the decrement of the token while the flow control judgment module forwards the data message, and is also used for initiating a decrement write request to the token bucket.
And the updating module is used for controlling the self-refreshing of the token bucket and initiating an updating read request to the token bucket when the flow control judgment module initiates a flow control read request.
And the increment calculation module is used for calculating the increment of the tokens in the token bucket and initiating an increment write request to the token bucket.
An accumulator to accumulate the enqueue of decrements and increments; and the method is also used for writing the obtained result into the corresponding token bucket according to the address of the token bucket after adding the accumulated increment to the synchronized token value or subtracting the accumulated decrement.
And the cache module is used for performing cache operation on the accumulator.
The basis of the flow control judgment of the flow control module is as follows:
if the data returned by the flow control read request is larger than or equal to the preset token threshold, forwarding the data message;
if the flow control read request return data is smaller than the token threshold, discarding the data message or reducing the priority of the data message;
in this embodiment, the token threshold is 0.
In addition, the flow control device can also comprise a timer and a read queue device. The timer generates a fixed time interval related to the speed limit accuracy so that the update module controls the token bucket self-refresh. The read queue device is used for sequentially queuing read requests, the read requests comprise flow control read requests and update read requests, the read queue device ensures that the requests initiated firstly are responded firstly, and if the flow control read requests and the update read requests arrive at the same time, the read requests with higher priority are responded firstly. The read queue device directly initiates a read request to the token bucket to obtain the existing token value of the token bucket; and correspondingly returning the token value to the flow control judgment module or the updating module, and releasing the corresponding queuing request.
The device also comprises a synchronizer, the read queue device copies a read request token bucket address and a token value returned by the token bucket to the read queue device to the synchronizer when receiving the returned token value of the token bucket, and the synchronizer synchronizes the read request token bucket address and the token value to the accumulator.
The apparatus may further include a write queue for queuing the incremental write requests and the decremental write requests for transfer to the accumulator one by one. And after the increment calculation is finished, a write request is initiated to the token bucket, and the increment write request can carry the write increment at the same time.
As shown in fig. 2, based on the above apparatus, an embodiment of the flow control process is provided, which includes the steps of:
s101, judging whether to start flow control, and if so, entering S102; if not, the process proceeds to S106.
And S102, the flow control judgment module initiates a flow control read request to read the existing token value in the token bucket.
S103, judging whether the token value is larger than 0, if so, entering S104; if not, the process proceeds to S107.
S104, data message forwarding is carried out, and the process goes to S105.
And S105, the decrement calculation module calculates the decrement of the token and sends a decrement write request to the write queue.
And S106, directly forwarding the data message, and ending the flow control process.
S107, discarding the data message, or reducing the priority of the data message.
As shown in fig. 3, based on the above apparatus, an embodiment of a token bucket update process is provided, which includes the steps of:
s201, judging whether to fill and update, if so, entering S202; if not, no operation is performed.
S202, reading the token value in the token bucket.
S203, judging whether the read token value is smaller than the maximum depth of the token bucket, if so, entering S204; if not, no operation is performed.
And S204, adding tokens according to configuration, and calculating the increment of the tokens.
As shown in fig. 4, an embodiment of accumulating and writing tokens into a token bucket is provided based on the above apparatus, including the steps of:
s301, judging whether a queue of the write queue device is empty, and if so, carrying out no operation; if not, the process proceeds to S302.
S302, performing cache operation on the accumulator.
S303, comparing the address of the current write request token bucket with the content of the cache for one round, judging whether the cache is hit, and if yes, entering S304; if not, the process proceeds to S305.
S304, adding the cache hit result with the increment or subtracting the decrement to obtain a new increment or decrement, writing the new increment or decrement and the corresponding token bucket address into the cache, and entering S306.
S305, writing the increment or decrement of the write request and the corresponding token bucket address into the cache, and entering S306.
And S306, writing the obtained result into the corresponding token bucket according to the token bucket address after adding the accumulated increment to the synchronized token value or subtracting the accumulated decrement.
In the above embodiment, after the token decrement is calculated each time, a decrement write request is initiated for the token bucket; after the token increment is calculated each time, initiating an increment write request to the token bucket; the specific operation of the write request is after a plurality of cycles, and the number of the cycles is determined according to the write queue and the accumulator.
An example of the principle of cyclic accumulation of an accumulator is given in fig. 5. In fig. 5, each row represents the memory state of the accumulator for a different time slot, and each box in the row represents the content written at one time, including address and data. Taking any working time to explain the principle, the existing storage content is not concerned with, and is marked as? ", is marked"? "the position setting does not have the same item as the subsequent operation.
In the 1 st state, the write request address is a0, the write data is d0, the write request address is compared with the write content at all times in the current accumulation state, the accumulation is completed if the same item exists, and the write request does not have the same item, and the write request is directly written into the address a0 and the data d 0. The 2 nd state is entered.
In the 2 nd state, the write request address is a1, the write data is d1, the write request address is compared with the write content at all times in the current accumulation state, the accumulation is completed if the same item exists, and the write request does not have the same item and is directly written into the address a1 and the data d 1. The 3 rd state is entered.
In state 3, no request, all 0 values need to be written for placeholder. The 4 th state is entered.
In the 4 th state, the write request address is a1, the write data is d2, the write request address is compared with the write content at all times in the current accumulation state, the same items need to be accumulated at this time, and the data accumulation of the record address a1 is d1+ d2 after the completion. The 5 th state is entered.
In the 5 th state, the write request address is a0, the write data is d3, the write request address is compared with the write content at all times in the current accumulation state, the same items need to be accumulated at this time, and the data accumulation of the record address a0 is d0+ d3 after the completion. The 6 th state is entered.
In the 6 th state, the write request address is a0 and the write data is d 4. The same items need to be accumulated at this time, and the address a0 and the data d0+ d3+ d4 are recorded after the accumulation is finished. The 7 th state is entered.
In the 7 th state, when the preset clear time of the 1 st state is just reached, the address a0 and the data d0 are removed. The same item needs to clear the accumulation at this time, and after the completion of the clearing, the address a0 and the data d0+ d3+ d4 become d3+ d 4. The reason why the preset zero clearing time is set is that when a read request of the token bucket is initiated until a write request is completed, the accumulated value of the time is reflected in the write token value, and the corresponding accumulated state needs to be cleared, so that the accumulator is cleared periodically.
In the 7 th state, the write request address is a2 and the write data is d 5. No same item is required to be accumulated at this time, and the address a2 and the data d5 are directly recorded. The 8 th state is entered.
In the 8 th state, when the preset clear time of the 2 nd state is just reached, the address a1 and the data d1 are removed. The same entry needs to clear the accumulation this time, and after the completion of the accumulation, the address a1 and the data d1+ d2 become d 2.
...
When the nth state is used, the (n-1) th state is shifted integrally. The preset clear time for the (n-5) th state is just reached at this point, removing the address of (n-5) and all data associated therewith. In the (n + 1) th state, a write request is initiated, the same items are in the current state, accumulation is not needed, and the address and the data are directly recorded. And if the accumulation is needed, recording after the accumulation.
Based on the above method embodiment, an example of a specific application is also provided, in this embodiment, internal processing clock cycles are denoted as T1, T2, and T3.. T9.. In this embodiment, the message relates to a flow control processing process, including a flow control read request and a decrement write request; updating refers to the process of update handling, including update read requests and incremental write requests.
The message characteristics are as follows:
message [1], token bucket address (1), packet length 2;
message [2], token bucket address (1), packet length 3;
message [3], token bucket address (2), packet length 1;
message [4], token bucket address (1), packet length 1;
message [5], token bucket address (1), packet length 4.
Token current value:
address (1), token 100;
address (2), token 200.
Each update adds a token: 5.
the process of this embodiment is as follows:
t1: message [1], read address (1), read return token {1}, value 100; and judging whether the message passes the token decrement-2, initiating a decrement write request to the token bucket, wherein the operation of the write request is performed after a plurality of cycles, the number of the cycles is determined according to the accumulator, and the operation of the write request in the embodiment is given at T6.
T2: message [2], read address (1), read return token {2}, value 100; the message is judged to pass, token decrement-3, a decrement write request is initiated to the token bucket, and the operation of the write request will be given at T7.
T3: message [3], read address (2), read return token {3}, value 200; the message is judged to pass, token decrement-1, a decrement write request is initiated to the token bucket, and the operation of the write request will be given at T8.
T4: message [4], read address (1), read return token {4}, value 100; the message is judged to pass, token decrement-1, a decrement write request is initiated to the token bucket, and the operation of the write request will be given at T9.
T5: update [1], read address (1), read return token {5}, value 100; a token is added. Token increment +5, an incremental write request is initiated to the token bucket, the operation of which will be given at T10.
T6: message [4], read address (1), read return token {6}, value 100; the message is judged to pass, token decrement-1, a decrement write request is initiated to the token bucket, and the operation of the write request will be given at T11. The write address (1) corresponding to T1 is received, the token of message [1] is decremented by 2, the accumulator value is-2, and the write token value {7} is 100 (synchronization token value {1}) -2 ═ 98.
T7: message [5], read address (1), read return token 98 (token value {7 }); the message is judged to pass, token decrement-4, a decrement write request is initiated to the token bucket, and the operation of the write request will be given at T12. The write address (1) corresponding to T2 is received, the token of message [2] is decremented by 3, the accumulator value is-2-3-5, and the write token value {8} is 100 (synchronous token value {2}) -5-95.
T8: this example does not care about this reading; the write address (2) corresponding to T3 is received, message [3], token decrement 1, accumulator value-1, write token value {9} is 200 (synchronization token value {3}) -1 ═ 199.
T9: this example does not care about this reading; the write address (1) corresponding to T4 is received, the message [4], the token is decremented by 1, the accumulator value is-5-1-6, and the write token value {9} is 100 (the sync token value {4}) -6-94.
T10: this example does not care about this reading; receiving the write address (1) corresponding to T5, updating [1], for example, this time token increment is 5, the accumulator value is-6 +5 ═ -1, and the write token value {10} is 100 (synchronous token value {5}) -1 ═ 99.
T11: this example does not care about this reading; receiving the write address (1) corresponding to T6, message [4], decrementing the token by 1, the accumulator value being-1-2, and the write token value {11} being 100 (sync token {6}) -2-98.
T12: this example does not care about this reading; the write address (1) corresponding to T7 is received, message [5], token decrement 4, accumulator value-4, and write token value {12} 98 (sync token {7}) -4 ═ 94.
Based on the above embodiment, compared to formula 1 in the background art, the maximum bandwidth processing capability of the present invention is:
wherein f is the maximum clock frequency of the bandwidth processing capacity (fps, number of packets per second) of the packet, period is a filling period time slot, and depth is the depth of the updated token bucket. The processing of the decision circuit changes from that one message is processed in k periods in formula 1 to that one message is processed in 1 period.
In the above embodiment, the token bucket includes multiple token bucket addresses, the apparatus refreshes tokens in parallel, and initiates an update read request to the multiple token bucket addresses at the same time, and assuming that the number of multiple token buckets refreshed in parallel is m, the maximum bandwidth processing capacity of the system is:
the parallel token refreshing can greatly improve the packet processing capability based on token bucket flow control, so that the parallel token refreshing method can be used in a high-speed processing system.
The present invention is not limited to the above embodiments, and any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are included in the scope of the claims of the present invention which are filed as the application.
Claims (12)
1. A method for high rate flow control, comprising the steps of:
initiating a flow control read request to a token bucket by a data message needing flow control according to a pipeline mode; flow control judgment is carried out in sequence according to the returned data of the flow control read request, the judged data message is forwarded, the decrement of the token is calculated at the same time, and a decrement write request is initiated to the token bucket;
initiating an updating read request to the token bucket at regular time; updating judgment is carried out according to the returned data of the updating read request, and an increment write request is initiated for the increment of the token calculated by the token value passing the judgment;
the decrement and increment queues are accumulated, and cache operation is carried out; and after the synchronous token value is added with the accumulated increment or subtracted with the accumulated decrement, the obtained result is written into the corresponding token bucket according to the token bucket address.
2. The method according to claim 1, wherein the sequentially performing flow control decision according to the flow control read request return data comprises:
if the data returned by the flow control read request is larger than or equal to the preset token threshold, forwarding the data message;
and if the flow control read request returned data is smaller than the token threshold, discarding the data message or reducing the priority of the data message.
3. The method of claim 1, wherein making an update decision based on returned data of an update read request comprises:
when the value of the token in the data returned by the updating read request is smaller than the maximum depth of the token bucket, the updating judgment is passed, and the increment of the token is calculated;
and when the token value in the data returned by the updating read request is greater than the maximum depth of the token bucket, the updating judgment is failed, and the operation is not carried out.
4. The method of claim 1, wherein the flow control read request and the refresh read request initiate reading to the token bucket by queuing, and when both of them arrive at the queued queue at the same time, the priority is higher for processing first.
5. The method for high-rate flow control according to claim 1, wherein said performing cache operations comprises:
when increment or decrement is accumulated once, the address of the current write request token bucket is compared with the content of the cache for one round;
if the cache hits, adding the cache hit result with the increment or subtracting the cache hit result with the decrement to obtain a new increment or decrement, and writing the new increment or decrement and the corresponding token bucket address into the cache;
and if the cache does not hit, writing the increment or decrement of the write request and the corresponding token bucket address into the cache.
6. A high flow rate flow control device, comprising:
a packet receiving queue, configured to receive a data packet requiring flow control;
a token bucket to store tokens;
the flow control judgment module initiates a flow control read request to the token bucket in a pipeline mode, sequentially performs flow control judgment according to the return data of the flow control read request, and forwards the data message passing the judgment;
the decrement calculation module is used for calculating the decrement of the token while the flow control judgment module forwards the data message, and is also used for initiating a decrement write request to the token bucket;
the updating module is used for initiating an updating read request to the token bucket at regular time; carrying out updating judgment according to the returned data of the updating read request;
the increment calculation module is used for calculating the increment of the token for the token value passing the judgment and initiating an increment write request to the token bucket;
an accumulator for accumulating the enqueuing of decrements and increments; the synchronous token value is added with the accumulated increment or subtracted with the accumulated decrement, and the obtained result is written into the corresponding token bucket according to the token bucket address;
and the cache module is used for performing cache operation on the accumulator.
7. The high flow rate flow control device of claim 6, wherein the flow control decision module makes the flow control decision based on:
if the data returned by the flow control read request is larger than or equal to the preset token threshold, forwarding the data message;
if the flow control read request return data is smaller than the token threshold, discarding the data message or reducing the priority of the data message;
8. a high flow rate flow control device according to claim 6,
the updating module is also used for initiating an updating read request to the token bucket while the flow control judgment module initiates a flow control read request;
the device further comprises:
a timer for generating a fixed time interval at which the update module sends the update read request;
the read queue device is used for sequentially queuing the read requests, receiving the existing token values returned by the token bucket and returning the token values to the flow control judgment module or the updating module; the read requests include flow controlled read requests and update read requests.
9. The high flow rate flow control device of claim 6, wherein the update module makes an update decision based on the returned data of the update read request, comprising:
when the value of the token in the data returned by the updating read request is smaller than the maximum depth of the token bucket, the updating judgment is passed, and the increment of the token is calculated;
and when the token value in the data returned by the updating read request is greater than the maximum depth of the token bucket, the updating judgment is failed, and the operation is not carried out.
10. The high flow rate flow control device of claim 8, further comprising:
and the write queue device is used for queuing the increment write request and the decrement write request and transmitting the increment write request and the decrement write request to the accumulator one by one.
11. The high flow rate flow control device of claim 8, further comprising:
and the synchronizer copies a read request token bucket address and a token value returned by the token bucket to the read queue device to the synchronizer when receiving the returned token value of the token bucket, and synchronizes the read request token bucket address and the token value to the accumulator.
12. The high flow rate flow control device of claim 8, wherein the token bucket includes a plurality of token bucket addresses, the device refreshing tokens in parallel while initiating update read requests to the plurality of token bucket addresses.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110014179.6A CN112751777A (en) | 2021-01-06 | 2021-01-06 | High-rate flow control method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110014179.6A CN112751777A (en) | 2021-01-06 | 2021-01-06 | High-rate flow control method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112751777A true CN112751777A (en) | 2021-05-04 |
Family
ID=75650113
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110014179.6A Pending CN112751777A (en) | 2021-01-06 | 2021-01-06 | High-rate flow control method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112751777A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115883472A (en) * | 2022-11-29 | 2023-03-31 | 重庆紫光华山智安科技有限公司 | Token issuing method and related device |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101094180A (en) * | 2007-07-20 | 2007-12-26 | 杭州华三通信技术有限公司 | Method and device for watching and controlling compressed flux |
CN101110716A (en) * | 2007-08-13 | 2008-01-23 | 杭州华三通信技术有限公司 | Method and device for monitoring flux of slicing messages |
CN101841461A (en) * | 2010-02-11 | 2010-09-22 | 北京星网锐捷网络技术有限公司 | Method and device for controlling update of token bucket |
CN102413042A (en) * | 2011-11-14 | 2012-04-11 | 盛科网络(苏州)有限公司 | Timestamp-updating-token-bucket-based traffic policing method and system |
CN106413002A (en) * | 2016-11-22 | 2017-02-15 | 京信通信技术(广州)有限公司 | Terminal velocity control method, terminal velocity control device and terminal velocity control base station |
CN110912834A (en) * | 2019-12-09 | 2020-03-24 | 昆高新芯微电子(江苏)有限公司 | Flow control method based on token bucket algorithm |
CN111385219A (en) * | 2018-12-28 | 2020-07-07 | 创发信息科技(苏州)有限公司 | Method for realizing high-performance high-precision software TCP speed limit by means of hardware interruption |
-
2021
- 2021-01-06 CN CN202110014179.6A patent/CN112751777A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101094180A (en) * | 2007-07-20 | 2007-12-26 | 杭州华三通信技术有限公司 | Method and device for watching and controlling compressed flux |
CN101110716A (en) * | 2007-08-13 | 2008-01-23 | 杭州华三通信技术有限公司 | Method and device for monitoring flux of slicing messages |
CN101841461A (en) * | 2010-02-11 | 2010-09-22 | 北京星网锐捷网络技术有限公司 | Method and device for controlling update of token bucket |
CN102413042A (en) * | 2011-11-14 | 2012-04-11 | 盛科网络(苏州)有限公司 | Timestamp-updating-token-bucket-based traffic policing method and system |
CN106413002A (en) * | 2016-11-22 | 2017-02-15 | 京信通信技术(广州)有限公司 | Terminal velocity control method, terminal velocity control device and terminal velocity control base station |
CN111385219A (en) * | 2018-12-28 | 2020-07-07 | 创发信息科技(苏州)有限公司 | Method for realizing high-performance high-precision software TCP speed limit by means of hardware interruption |
CN110912834A (en) * | 2019-12-09 | 2020-03-24 | 昆高新芯微电子(江苏)有限公司 | Flow control method based on token bucket algorithm |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115883472A (en) * | 2022-11-29 | 2023-03-31 | 重庆紫光华山智安科技有限公司 | Token issuing method and related device |
CN115883472B (en) * | 2022-11-29 | 2024-05-03 | 重庆紫光华山智安科技有限公司 | Token issuing method and related device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101172103B1 (en) | Method for transmitting data in messages via a communications link of a communications system and communications module, subscriber of a communications system and associated communications system | |
US6477144B1 (en) | Time linked scheduling of cell-based traffic | |
CN1017861B (en) | High-speed asynchronous transfer mode pocket swtiching network system having time slot scheduling unit | |
FR2724277A1 (en) | TRAFFIC FORMING DEVICE AND PACKET COMMUNICATION APPARATUS. | |
JP4439154B2 (en) | Method and apparatus for interleaved non-blocking packet buffer | |
EP0944208A2 (en) | Time based scheduler architecture and method for ATM networks | |
EP0241113A2 (en) | Traffic scheduler for multiple access communication channels | |
EP1126666A2 (en) | A packet flow control apparatus and a method for controlling the same | |
CN113783793B (en) | Traffic scheduling method for time-sensitive data frames and related equipment | |
US7310346B2 (en) | Node apparatus and packet transmission control method | |
CN113141320B (en) | System, method and application for rate-limited service planning and scheduling | |
CN107800644A (en) | Dynamically configurable pipelined token bucket speed limiting method and device | |
CN112751777A (en) | High-rate flow control method and device | |
US20120140668A1 (en) | Method and apparatus for calculating packet arrival time interval | |
CN110971543B (en) | Transmission scheduling method and system of TTFC network | |
US5124983A (en) | Arbitration method and device for transmit mode access to the transmission medium of a distributed switching network | |
EP1528477A1 (en) | Memory management system for processing linked list data files | |
CN113014465A (en) | Bus transmission interface system based on quality of service characteristics and design method | |
JP2795257B2 (en) | Contention control method for cell output of traffic shaper | |
CN111740922B (en) | Data transmission method, device, electronic equipment and medium | |
Yang et al. | Modeling and performance analysis of statistical priority-based multiple access protocol | |
JPH10135957A (en) | Traffic shaper device | |
US7159049B2 (en) | Memory management system including on access flow regulator for a data processing system | |
US7120706B2 (en) | Contention resolution in a memory management system | |
JP3623907B2 (en) | Cell shaping device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210504 |
|
RJ01 | Rejection of invention patent application after publication |