CN103026671B - A kind of method and apparatus of traffic shaping - Google Patents

A kind of method and apparatus of traffic shaping Download PDF

Info

Publication number
CN103026671B
CN103026671B CN201180001490.1A CN201180001490A CN103026671B CN 103026671 B CN103026671 B CN 103026671B CN 201180001490 A CN201180001490 A CN 201180001490A CN 103026671 B CN103026671 B CN 103026671B
Authority
CN
China
Prior art keywords
transmit queue
time
token
packet
described transmit
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.)
Active
Application number
CN201180001490.1A
Other languages
Chinese (zh)
Other versions
CN103026671A (en
Inventor
艾刚·豪帕纳斯
倪思慕·丹尼尔
伊学文
吴瑶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changshu intellectual property operation center Co.,Ltd.
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN103026671A publication Critical patent/CN103026671A/en
Application granted granted Critical
Publication of CN103026671B publication Critical patent/CN103026671B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/22Traffic shaping
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/21Flow control; Congestion control using leaky-bucket

Abstract

Embodiments provide a kind of method and apparatus of traffic shaping, relate to the communications field, described method comprises: the first packet goes out team from transmit queue; According to the very first time, the second time and be in advance described transmit queue arrange bandwidth, refresh token bucket corresponding to described transmit queue or leaky bucket, wherein, the described very first time is described first packet goes out team time from this transmit queue, described second time is that the second packet goes out the time of team from described transmit queue, described second packet is before described first packet goes out team from described transmit queue, and the last time goes out the packet of team.Described equipment comprises: go out group module and refresh module.The present invention can reduce the refreshing frequency of token bucket corresponding to each transmit queue or leaky bucket and ensure that the token bucket that each transmit queue is corresponding or leaky bucket can be refreshed.

Description

A kind of method and apparatus of traffic shaping
Technical field
The present invention relates to the communications field, particularly a kind of method and apparatus of traffic shaping.
Background technology
Can send packet by communication process chip in the communications field, communication process chip generally includes scheduler, memory, queue management module and traffic shaping module.
Wherein, traffic shaping module can realize traffic shaping function, and traffic shaping function can make communication process chip send packet according to the bandwidth pre-set.
One or more relatively independent memory space is had in memory, each memory space can be called a transmit queue, transmit queue is used for the packet that buffer memory needs to send, the corresponding token bucket of each transmit queue or leaky bucket, token bucket is for storing token, and leaky bucket is for storing the flow of the packet of transmission; When a packet is transmitted, scheduler dispatches transmit queue from memory, queue management module goes out group packet from this transmit queue and sends out the packet of team, simultaneously traffic shaping module deducts the token of certain flow or add flow in leaky bucket corresponding to this transmit queue from token bucket corresponding to this transmit queue, and traffic shaping module deduct the flow of token, interpolation flow equal with the flow that queue management module goes out group packet from this transmit queue respectively.
In addition, traffic shaping module needs to refresh according to the bandwidth in advance for the setting of this transmit queue the flow stored in the token that stores in token bucket corresponding to this transmit queue or leaky bucket corresponding to this transmit queue.Such as, the token bucket that in the periodic refresh memory of traffic shaping module, each transmit queue is corresponding, when flushing to token bucket corresponding to certain transmit queue, calculate the token amount needing to add in token bucket corresponding to this transmit queue according to the length gauge of bandwidth sum refresh cycle arranged for this transmit queue in advance, add token according to the token amount calculated to the token bucket that this transmit queue is corresponding; Or, the traffic shaping module leaky bucket that periodically each transmit queue is corresponding in refresh memory, when flushing to leaky bucket corresponding to certain transmit queue, calculate the flow needing to deduct from leaky bucket corresponding to this transmit queue according to the length gauge of bandwidth sum refresh cycle arranged for this transmit queue in advance, from the leaky bucket that this transmit queue is corresponding, deduct the flow calculated.
But, in existing scheme, because the access bandwidth of memory is limited, if the transmit queue number in memory be greater than memory allow within a refresh cycle access number of times time, traffic shaping module just cannot flush to token bucket corresponding to each transmit queue or leaky bucket when doing traffic shaping function within a refresh cycle.
Summary of the invention
In order to reduce the refreshing frequency of token bucket corresponding to each transmit queue or leaky bucket and ensure that the token bucket that each transmit queue is corresponding or leaky bucket can be refreshed, embodiments provide a kind of method and apparatus of traffic shaping.Described technical scheme is as follows:
A method for traffic shaping, described method comprises:
First packet goes out team from the transmit queue communication process chip;
According to the very first time, the second time and be in advance described transmit queue arrange bandwidth, refresh token bucket corresponding to described transmit queue or leaky bucket, wherein, the described very first time is described first packet goes out team time from this transmit queue, described second time is that the second packet goes out the time of team from described transmit queue, described second packet is before described first packet goes out team from described transmit queue, and the last time goes out the packet of team.
An equipment for traffic shaping, described equipment comprises:
Go out group module, for the first packet is gone out team from the transmit queue communication process chip;
Refresh module, for refreshing token bucket corresponding to described transmit queue or leaky bucket according to the very first time, the second time and the bandwidth that arranges for described transmit queue in advance, wherein, the described very first time is described first packet goes out team time from this transmit queue, described second time is that the second packet goes out the time of team from described transmit queue, described second packet is before described first packet goes out team from described transmit queue, and the last time goes out the packet of team.
In the present invention, first packet goes out team from transmit queue, and according to the very first time, the second time and in advance for this transmit queue arrange bandwidth refresh token bucket corresponding to this transmit queue or leaky bucket, the very first time is the time going out team from this transmit queue of the first packet, second time was that the second packet goes out the time of team from this transmit queue, second packet is before the first packet goes out team from this transmit queue, and the last time goes out the packet of team.Because the team that goes out of packet all will according to token bucket or leaky bucket with transmission, therefore, the equipment provided according to the embodiment of the present invention carries out the refreshing of token bucket or leaky bucket, just can reduce the number of times and frequency that refresh token bucket corresponding to each transmit queue or leaky bucket, realize traffic shaping.
Accompanying drawing explanation
Fig. 1 ~ 10 are several flow charts of the method for the traffic shaping that the embodiment of the present invention 1 provides;
Figure 11 is the method flow diagram of a kind of traffic shaping that the embodiment of the present invention 2 provides;
Figure 12 is the method flow diagram of a kind of traffic shaping that the embodiment of the present invention 3 provides;
Figure 13 ~ 20 are several schematic diagrames of the equipment of the traffic shaping that the embodiment of the present invention 4 provides.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment 1
As shown in Figure 1, embodiments provide a kind of method of traffic shaping, comprising:
101: the first packets go out team from transmit queue;
102: according to the very first time, the second time and be in advance this transmit queue arrange bandwidth, refresh token bucket corresponding to this transmit queue or leaky bucket; Wherein, the very first time is described first packet goes out team time from this transmit queue, second time was that the second packet goes out the time of team from this transmit queue, and the second packet is before the first packet goes out team from this transmit queue, and the last time goes out the packet of team.
Optionally, as shown in Figure 2,102 can specifically comprise:
1021: the time difference calculating the very first time and the second time;
1022: according to the time difference calculated be the bandwidth that this transmit queue is arranged in advance, calculate the token amount needing to add to token bucket corresponding to this transmit queue;
1023: according to the token amount calculated, the token bucket corresponding to this transmit queue adds token, to refresh token bucket corresponding to this transmit queue.
Optionally, as shown in Figure 3, after 102, the method also comprises:
103: the numerical value utilizing the very first time, upgraded for the second time.
Optionally, as shown in Figure 4, after 102, the method also comprises:
104: according to the first token amount, the second token amount and the 3rd token amount, calculate token bucket corresponding to this transmit queue be refreshed after token amount.
Wherein, before the first token amount refers to that the first packet goes out team from this transmit queue, the token amount in the token bucket that this transmit queue is corresponding; When second token amount refers to that the first packet to go out group from this transmit queue, the token amount deducted from the token bucket that this transmit queue is corresponding, usually, the second token amount is equal with the first data packet flow; After 3rd token amount refers to that the first packet goes out team from this transmit queue, when refreshing token bucket corresponding to this transmit queue, to the token amount that the token bucket that this transmit queue is corresponding adds.
Optionally, as shown in Figure 5, after 104, the method also comprises:
105: if token bucket corresponding to this transmit queue be refreshed after token amount be less than default first threshold, then the dispatch state of this transmit queue is set to the state of non-scheduling, and after a preset amount of time the dispatch state of this transmit queue is set to schedulable state.
Such as, if when the first data contract out group from deducting too much token token bucket, after refreshing, the token amount of token bucket is still very little, assuming that be less than default first threshold, then need upper once refresh token bucket corresponding to this transmit queue time add more token amount.Therefore, by the dispatch state of this transmit queue is set to non-scheduling state, and after a preset amount of time the dispatch state of this transmit queue is set to schedulable state, can increase the time difference of the above-mentioned very first time and the second time, thus the needs calculated also can be more to the token amount that the token bucket that this transmit queue is corresponding adds.
Optionally, as shown in Figure 6, after 104, the method also comprises:
106: the numerical value of the token amount after the token bucket that this transmit queue that utilization calculates is corresponding is refreshed, upgrades the first token amount.
Optionally, as shown in Figure 7,102 can comprise:
1024: the time difference calculating the very first time and the second time;
1025: according to the time difference calculated be the bandwidth of this transmit queue setting in advance, calculate the flow that needs deduct from leaky bucket corresponding to this transmit queue;
1026: from the leaky bucket that this transmit queue is corresponding, deduct the flow calculated, to refresh leaky bucket corresponding to this transmit queue.
Optionally, as shown in Figure 8, after 102, the method also comprises:
107: according to first flow, the second flow and the 3rd flow, calculate leaky bucket corresponding to this transmit queue be refreshed after flow.
Wherein, first flow is before the first packet goes out team from this transmit queue, the flow in the leaky bucket that this transmit queue is corresponding; Second flow is when to be the first packet to go out group from this transmit queue, the flow added in the leaky bucket that this transmit queue is corresponding; 3rd flow is the flow needing to deduct from leaky bucket corresponding to this transmit queue.
Optionally, as shown in Figure 9, after 107, the method also comprises:
108: if leaky bucket corresponding to this transmit queue be refreshed after flow be greater than default Second Threshold, then the dispatch state of this transmit queue is set to the state of non-scheduling, and after a preset amount of time the dispatch state of this transmit queue is set to schedulable state.
Such as, if when the first data contract out group to the flow that the interpolation in leaky bucket is too much, the flow or too much of leaky bucket after refreshing, assuming that be greater than default Second Threshold, then need upper once refresh leaky bucket corresponding to this transmit queue time deduct more flow.Therefore, by the dispatch state of this transmit queue is set to non-scheduling state, and after a preset amount of time the dispatch state of this transmit queue is set to schedulable state, can increase the time difference of the above-mentioned very first time and the second time, thus the flow that the needs calculated deduct from leaky bucket corresponding to this transmit queue also can be more.
Optionally, as shown in Figure 10, after 107, also comprise:
109: the numerical value of the flow after the leaky bucket that this transmit queue that utilization calculates is corresponding is refreshed, upgrade first flow.
In embodiments of the present invention, the first packet goes out team from transmit queue, deducts token or add flow to the leaky bucket that this transmit queue is corresponding according to the flow of the first packet from the token bucket that this transmit queue is corresponding; And according to the very first time, the second time and in advance for this transmit queue arrange bandwidth refresh token bucket corresponding to this transmit queue or leaky bucket, the very first time is the time going out team from this transmit queue of the first packet, second time was that the second packet goes out the time of team from this transmit queue, second packet is before the first packet goes out team from this transmit queue, and the last time goes out the packet of team.Because the team that goes out of packet all will according to token bucket or leaky bucket with transmission, therefore, the method provided according to the embodiment of the present invention carries out the refreshing of token bucket or leaky bucket, just can reduce the number of times and frequency that refresh token bucket corresponding to each transmit queue or leaky bucket, realize traffic shaping.
Embodiment 2
As shown in figure 11, embodiments provide a kind of method of traffic shaping, comprising:
201: the first packets go out team from the transmit queue communication process chip;
Such as, when needs send packet, transmit queue in scheduler schedules memory in communication process chip, first data go out team from from this transmit queue, and be sent out away, simultaneously the traffic shaping module of communication process chip is according to the flow of the first packet going out team from this transmit queue, from the token bucket that this transmit queue is corresponding, deduct token, wherein, the token amount that deducts of traffic shaping module is equal with the first data packet flow.
Optionally, in advance can a timer be set in communication process chip, when the first packet to go out group from this transmit queue, current time during this timer can be read, and using the current time that reads as the very first time.
Wherein, in the present embodiment, communication process chip each reset restart after, the token amount of the token bucket that in the memory of communication process chip, each transmit queue is corresponding can equal 0, be greater than 0 or be less than 0.
202: the time difference calculating the very first time and the second time, wherein, the very first time is that the first packet goes out the time of team from this transmit queue, second time was that the second packet goes out the time of team from this transmit queue, second packet is before the first packet goes out team from this transmit queue, and the last time goes out the packet of team;
Optionally, can buffer memory above-mentioned second time, when each communication process chip reset restarts, the second time of buffer memory can be set to 0.
203: according to calculate time difference and be in advance this transmit queue setting bandwidth, refresh the token bucket that this transmit queue is corresponding;
Particularly, according to calculate time difference and be in advance this transmit queue setting bandwidth, calculate the token amount needing to add token in token bucket corresponding to this transmit queue, in token bucket corresponding to this transmit queue, add token according to the token amount calculated, so achieve the token bucket corresponding to this transmit queue and refresh.
Optionally, the time difference of calculating and the bandwidth arranged for this transmit queue in advance can be done the token amount that product calculation obtains needing to add token in token bucket corresponding to this transmit queue.
204: obtain token bucket corresponding to this transmit queue be refreshed after token amount, if be less than default first threshold, then perform 205:
Such as, before the first packet is gone out team from this transmit queue, the token amount in the token bucket that this transmit queue is corresponding is labeled as old_tokenbucket; When to be gone out group from this transmit queue by the first packet, the token amount deducted from the token bucket that this transmit queue is corresponding is labeled as plen; After first packet is gone out team from this transmit queue, when refreshing token bucket corresponding to this transmit queue, the token amount that the token bucket to this transmit queue adds is labeled as △ token.Then according to following formula (1) calculate token bucket corresponding to this transmit queue be refreshed after token amount new_tokenbucket:
new_tokenbucket=old_tokentbucket+△token-plen……(1)
If the token amount new_tokenbucket after refreshing is less than default first threshold, then perform 205.Wherein, the first threshold preset can be greater than 0, be less than 0 or equal 0.
Further, old_tokenbucket can be upgraded with the numerical value of new_tokenbucket.
Wherein, if token amount new_tokenbucket is more than or equal to default first threshold after refreshing, then, when this transmit queue is scheduled again and go out group packet from this transmit queue, returns 201 and restart to carry out.
205: the state dispatch state of this transmit queue being set to non-scheduling, and after a preset amount of time the dispatch state of this transmit queue is set to schedulable state.
Particularly, the dispatch state of this transmit queue is set to the state of non-scheduling, and starts timing, when the time of timing reaches the default time, the dispatch state of this transmit queue is set to schedulable state.
Wherein, after the dispatch state of this transmit queue being set to the state of non-scheduling, scheduler cannot dispatch this transmit queue, so that cannot go out group packet from this transmit queue, traffic shaping module also cannot deduct token from token bucket corresponding to this transmit queue.After the dispatch state of this transmit queue is set to schedulable state, the device scheduling if this transmit queue is scheduled again also, when going out group packet from this transmit queue, can return execution 201.
Optionally, k bit can be reserved for identifying dispatch state in this transmit queue, k be more than or equal to 1 integer.
Wherein, for each transmit queue in the memory of communication process chip, all press the flow process of above-mentioned 201-205, just refresh token bucket corresponding to transmit queue when packet to go out group from transmit queue.
Wherein, the memory of communication process chip is owing to being subject to the restriction of access bandwidth, allow out the number of the transmit queue of group packet to be less than or equal to the number of times of memory permission each second access in each second, and in the present invention, when going out group packet from transmit queue, the token bucket corresponding to the transmit queue going out group packet refreshes, therefore the number of times carrying out refreshing per second with per second go out the number of times of group packet identical, the number of times of refreshing token bucket per second is made to be less than or equal to the memory number of times allowing access per second, and the number of times of refreshing token bucket is by the restriction of the number of the transmit queue in the restriction of access bandwidth of memory and memory, thus significantly reduce the refreshing frequency of token bucket, therefore, as long as go out group packet from each transmit queue memory, just can flush to each transmit queue in memory.
In embodiments of the present invention, the first packet goes out team from transmit queue, and the flow according to the first packet deducts token from the token bucket that this transmit queue is corresponding; Calculate the time difference of the very first time and the second time, the very first time is that the first packet goes out the time of team from this transmit queue, second time was that the second packet goes out the time of team from this transmit queue, second packet is that the first packet goes out from this transmit queue the packet that the last time before team goes out team, according to the time difference calculated and in advance for the bandwidth meter of this transmit queue setting calculates the token amount needing to add, add token according to the token amount calculated to the token bucket that this transmit queue is corresponding.Because the team that goes out of packet all will according to token bucket with transmission, therefore, the method provided according to the embodiment of the present invention carries out the refreshing of token bucket, just can reduce the number of times and frequency that refresh token bucket corresponding to each transmit queue, realize traffic shaping.
Embodiment 3
As shown in figure 12, embodiments provide a kind of method of traffic shaping, comprising:
301: the first packets go out team from the transmit queue communication process chip;
Wherein, when needs send packet, transmit queue in scheduler schedules memory in communication process chip, first packet goes out team and is sent out away from this transmit queue, the traffic shaping module of communication process chip goes out the flow of the first packet of team according to this transmit queue simultaneously, in the leaky bucket that this transmit queue is corresponding, add flow, wherein, the flow that traffic shaping module is added is equal with the flow of the first packet.
Optionally, in advance can a timer be set in communication process chip, when the first packet to go out group from this transmit queue, current time during this timer can be read, and using the current time that reads as the very first time.
302: the time difference calculating the very first time and the second time, wherein, the very first time is the time going out team first packet from this transmit queue, second time was that the second packet goes out the time of team from this transmit queue, second packet is before the first packet goes out team from this transmit queue, the last packet going out team from this transmit queue;
Optionally, can buffer memory above-mentioned second time, when each communication process chip reset restarts, buffer memory second time can be set to 0.
303: according to calculate time difference and be in advance this transmit queue setting bandwidth, refresh the leaky bucket that this transmit queue is corresponding;
Particularly, according to calculate time difference and be in advance this transmit queue setting bandwidth, calculate the flow needing to deduct from leaky bucket corresponding to this transmit queue, from the leaky bucket that this transmit queue is corresponding, deduct the flow calculated, so achieve the leaky bucket corresponding to this transmit queue and refresh.
Optionally, the time difference of calculating and the bandwidth arranged for this transmit queue in advance can be done product calculation, obtain the flow needing to deduct from leaky bucket corresponding to this transmit queue.
304: obtain the flow that leaky bucket corresponding to this transmit queue is refreshed rear storage, if exceed default Second Threshold, then perform 305:
Such as, before the first packet is gone out team from this transmit queue, the flux scale stored in the leaky bucket that this transmit queue is corresponding is designated as old_leakybucket; When to be gone out group from this transmit queue by the first packet, the flux scale added in the leaky bucket that this transmit queue is corresponding is designated as addflow; After first packet is gone out team from this transmit queue, when refreshing leaky bucket corresponding to this transmit queue, the flux scale deducted from the leaky bucket of this transmit queue is designated as decreaseflow.Then calculate according to following formula (2) the flow new_leakybucket that leaky bucket corresponding to this transmit queue is refreshed rear storage:
new_leakybucket=old_leakybucket+addflow-decreaseflow……(2)
If the flow new_leakybucket after refreshing is greater than default Second Threshold, then perform 305.Wherein, the Second Threshold preset can be greater than 0.
Further, old_leakybucket can be upgraded with the numerical value of new_leakybucket.
Wherein, if token amount new_leakybucket is less than or equal to default Second Threshold after refreshing, then, when this transmit queue is scheduled again and go out group packet from this transmit queue, returns 301 and restart to carry out.
305: the state dispatch state of this transmit queue being set to non-scheduling, and after a preset amount of time the dispatch state of this transmit queue is set to schedulable state.
Particularly, the dispatch state of this transmit queue is set to the state of non-scheduling, and starts timing, when the time of timing reaches the default time, the dispatch state of this transmit queue is set to schedulable state.
Wherein, after the dispatch state of this transmit queue being set to the state of non-scheduling, scheduler cannot dispatch this transmit queue, so that cannot go out group packet from this transmit queue, traffic shaping module also cannot add flow in leaky bucket corresponding to this transmit queue.After the dispatch state of this transmit queue is set to schedulable state, the device scheduling if this transmit queue is scheduled again also, when going out group packet from this transmit queue, can return execution 301.
Optionally, k bit can be reserved for identifying dispatch state in this transmit queue, k be more than or equal to 1 integer.
Wherein, for each transmit queue in the memory of communication process chip, all press the flow process of above-mentioned 301-305, just refresh leaky bucket corresponding to transmit queue when packet to go out group from transmit queue.
Wherein, the memory of communication process chip is owing to being subject to the restriction of access bandwidth, allow out the number of the transmit queue of group packet to be less than or equal to the number of times of memory permission each second access in each second, and in the present invention, when going out group packet from transmit queue, the leaky bucket corresponding to the transmit queue going out group packet refreshes, therefore the number of times carrying out refreshing per second with per second go out the number of times of group packet identical, the number of times of refreshing leaky bucket per second is made to be less than or equal to the memory number of times allowing access per second, and the number of times refreshing leaky bucket is by the restriction of the number of the transmit queue in the restriction of access bandwidth of memory and memory, thus significantly reduce the refreshing frequency of leaky bucket, therefore, as long as each transmit queue in memory carries out data contract out team, just can flush to each transmit queue in memory.
In embodiments of the present invention, the first packet goes out team from transmit queue, and the flow according to the first packet adds flow to the leaky bucket that this transmit queue is corresponding; Calculate the time difference of the very first time and the second time, the very first time is the time going out team first packet from this transmit queue, second time was that the second packet goes out the time of team from this transmit queue, second packet is that the first packet goes out from this transmit queue the packet that the last time before team goes out team, according to the time difference calculated and in advance for the bandwidth meter of this transmit queue setting calculates the flow needing to deduct, deduct the flow of calculating from the leaky bucket that this transmit queue is corresponding.Because the team that goes out of packet all will according to leaky bucket with transmission, therefore, the method provided according to the embodiment of the present invention carries out the refreshing of leaky bucket, just can reduce the number of times and frequency that refresh leaky bucket corresponding to each transmit queue, realize traffic shaping.
Embodiment 4
As shown in figure 13, embodiments provide a kind of equipment of traffic shaping, comprising:
Go out group module 401, for the first packet is gone out team from transmit queue;
Refresh module 402, for according to the very first time, the second time and in advance for this transmit queue arrange bandwidth refresh token bucket corresponding to this transmit queue, the very first time is described first packet goes out team time from this transmit queue, second time was that the second packet goes out the time of team from this transmit queue, second packet is before the first packet goes out team from this transmit queue, and the last time goes out the packet of team.
Optionally, as shown in figure 14, refresh module 402 comprises:
First computing unit 4021, for calculating the time difference of the very first time and the second time;
Second computing unit 4022, the time difference calculated for basis and the bandwidth meter arranged for this transmit queue in advance calculate the token amount needing to add to the token bucket that this transmit queue is corresponding;
First refresh unit 4023, for adding token, to refresh token bucket corresponding to this transmit queue according to the token amount calculated to the token bucket that this transmit queue is corresponding.
Optionally, as shown in figure 15, this equipment also comprises:
First computing module 503, for according to the first token amount, the second token amount and the 3rd token amount, calculate token bucket corresponding to this transmit queue be refreshed after token amount; Wherein, the first token amount is before the first packet goes out team from this transmit queue, the token amount in the token bucket that this transmit queue is corresponding; Second token amount is when to be the first packet to go out group from this transmit queue, the token amount deducted from the token bucket that this transmit queue is corresponding; 3rd token amount is the token amount that described needs add to the token bucket that this transmit queue is corresponding.
Further alternatively, (for easy, illustrate only following two simultaneous situations of module in figure) as shown in figure 16, this equipment also comprises:
First arranges mould 504 pieces, if the token amount being refreshed rear storage for the token bucket that this transmit queue is corresponding is less than default first threshold, then the dispatch state of this transmit queue is set to the state of non-scheduling, and after a preset amount of time the dispatch state of this transmit queue is set to schedulable state.And/or
First update module 505, the numerical value of the token amount after the token bucket for utilizing this transmit queue of calculating corresponding is refreshed, upgrades the first token amount.
Optionally, as shown in figure 17, refresh module 402 comprises:
3rd computing unit 4024, for calculating the time difference of the very first time and the second time;
4th computing unit 4025, for according to the time difference calculated be the bandwidth of this transmit queue setting in advance, calculates the flow that needs deduct from leaky bucket corresponding to this transmit queue;
Second refresh unit 4026, for deducting the flow calculated, to refresh leaky bucket corresponding to this transmit queue from leaky bucket corresponding to this transmit queue.
Optionally, as shown in figure 18, this equipment also comprises:
Second computing module 603, for according to first flow, the second flow and the 3rd flow, calculate leaky bucket corresponding to this transmit queue be refreshed after flow; Wherein, first flow is before team first packet goes out from this transmit queue, the flow in the leaky bucket that this transmit queue is corresponding; Second flow is when to be the first packet to go out group from this transmit queue, the flow added in the leaky bucket that this transmit queue is corresponding; 3rd flow is the flow needing to deduct from leaky bucket corresponding to this transmit queue.
Further alternatively, (for easy, illustrate only following two simultaneous situations of module in figure) as shown in figure 19, this equipment also comprises:
Second arranges module 604, if be greater than default Second Threshold for the flow after the leaky bucket that this transmit queue is corresponding is refreshed, then the dispatch state of this transmit queue is set to the state of non-scheduling, and after a preset amount of time the dispatch state of this transmit queue is set to schedulable state.And/or
Second update module 605, the numerical value of the flow after the leaky bucket for utilizing this transmit queue of calculating corresponding is refreshed, upgrades first flow.
Optionally, as shown in figure 20, this equipment also comprises:
3rd update module 403, for utilizing the numerical value of the very first time, upgraded for the second time.
In embodiments of the present invention, first packet goes out team from transmit queue, and according to the very first time, the second time and in advance for this transmit queue arrange bandwidth refresh token bucket corresponding to this transmit queue or leaky bucket, the very first time is the time going out team from this transmit queue of the first packet, second time was that the second packet goes out the time of team from this transmit queue, second packet is before the first packet goes out team from this transmit queue, and the last time goes out the packet of team.Because the team that goes out of packet all will according to token bucket or leaky bucket with transmission, therefore, the equipment provided according to the embodiment of the present invention carries out the refreshing of token bucket or leaky bucket, just can reduce the number of times and frequency that refresh token bucket corresponding to each transmit queue or leaky bucket, realize traffic shaping.
It should be noted that: the equipment of a kind of traffic shaping that above-described embodiment provides is when refreshing token bucket corresponding to transmit queue or leaky bucket, only be illustrated with the division of above-mentioned each functional module, in practical application, can distribute as required and by above-mentioned functions and be completed by different functional modules, internal structure by equipment is divided into different functional modules, to complete all or part of function described above.In addition, above-described embodiment provides the equipment of traffic shaping and the embodiment of the method for traffic shaping to belong to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be read-only memory, disk or CD etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (20)

1. a method for traffic shaping, is characterized in that, described method comprises:
First packet goes out team from the transmit queue communication process chip;
According to the very first time, the second time and be in advance described transmit queue arrange bandwidth, refresh the token bucket that described transmit queue is corresponding, wherein, the described very first time is described first packet goes out team time from this transmit queue, described second time is that the second packet goes out the time of team from described transmit queue, described second packet is before described first packet goes out team from described transmit queue, and the last time goes out the packet of team;
Wherein, refresh token bucket corresponding to described transmit queue according to the described very first time, the second time and the bandwidth that arranges for described transmit queue in advance, comprising:
Calculate the time difference of the described very first time and the second time;
According to described time difference be the bandwidth that described transmit queue is arranged in advance, calculate the token amount needing to add to token bucket corresponding to described transmit queue;
According to the token amount that the described needs calculated add to the token bucket that described transmit queue is corresponding, the token bucket corresponding to described transmit queue adds token, to refresh token bucket corresponding to described transmit queue.
2. the method for claim 1, is characterized in that, after refreshing token bucket corresponding to described transmit queue, also comprises according to the described very first time, the second time and the bandwidth that arranges for described transmit queue in advance:
According to the first token amount, the second token amount and the 3rd token amount, calculate token bucket corresponding to described transmit queue be refreshed after token amount;
Wherein, described first token amount is before the first packet goes out team from described transmit queue, the token amount in the token bucket that described transmit queue is corresponding; Described second token amount is when to be the first packet to go out group from described transmit queue, the token amount deducted from the token bucket that described transmit queue is corresponding; Described 3rd token amount is the token amount that described needs add to the token bucket that described transmit queue is corresponding.
3. method as claimed in claim 2, is characterized in that, described calculate token bucket corresponding to described transmit queue be refreshed after token amount after, also comprise:
If the token amount after the token bucket that described transmit queue is corresponding is refreshed is less than default first threshold, then the dispatch state of described transmit queue is set to the state of non-scheduling, and after a preset amount of time the dispatch state of described transmit queue is set to schedulable state.
4. as claimed in claim 2 or claim 3 method, is characterized in that, described in calculate after token bucket corresponding to described transmit queue be refreshed the token amount of rear storage, also comprise:
The numerical value of the token amount after the token bucket that the described transmit queue that utilization calculates is corresponding is refreshed, upgrades described first token amount.
5. the method as described in claim 1 or 2 or 3, is characterized in that, after refreshing token bucket corresponding to described transmit queue, also comprises according to the described very first time, the second time and the bandwidth that arranges for described transmit queue in advance:
Utilize the numerical value of the described very first time, upgrade described second time.
6. method as claimed in claim 4, is characterized in that, after refreshing token bucket corresponding to described transmit queue, also comprises according to the described very first time, the second time and the bandwidth that arranges for described transmit queue in advance:
Utilize the numerical value of the described very first time, upgrade described second time.
7. a method for traffic shaping, is characterized in that, described method comprises:
First packet goes out team from the transmit queue communication process chip;
According to the very first time, the second time and be in advance described transmit queue arrange bandwidth, refresh the leaky bucket that described transmit queue is corresponding, wherein, the described very first time is described first packet goes out team time from this transmit queue, described second time is that the second packet goes out the time of team from described transmit queue, described second packet is before described first packet goes out team from described transmit queue, and the last time goes out the packet of team
Refresh leaky bucket corresponding to described transmit queue according to the described very first time, the second time and the bandwidth that arranges for described transmit queue in advance, comprising:
Calculate the time difference of the described very first time and the second time;
According to described time difference be the bandwidth that described transmit queue is arranged in advance, calculate the flow needing to deduct from leaky bucket corresponding to described transmit queue;
The flow calculated described in deducting from the leaky bucket that described transmit queue is corresponding, to refresh leaky bucket corresponding to described transmit queue.
8. method as claimed in claim 7, is characterized in that, after refreshing leaky bucket corresponding to described transmit queue, also comprises according to the described very first time, the second time and the bandwidth that arranges for described transmit queue in advance:
According to first flow, the second flow and the 3rd flow, calculate leaky bucket corresponding to described transmit queue be refreshed after flow;
Wherein, described first flow is before the first packet goes out team from described transmit queue, the flow in the leaky bucket that described transmit queue is corresponding; Described second flow is when to be the first packet to go out group from described transmit queue, the flow added in the leaky bucket that described transmit queue is corresponding; The described 3rd flow flow that to be described needs deduct from leaky bucket corresponding to described transmit queue.
9. method as claimed in claim 8, is characterized in that, described calculate leaky bucket corresponding to described transmit queue be refreshed after flow after, also comprise:
If the flow after the leaky bucket that described transmit queue is corresponding is refreshed is greater than default Second Threshold, then the dispatch state of described transmit queue is set to the state of non-scheduling, and after a preset amount of time the dispatch state of described transmit queue is set to schedulable state.
10. as claimed in claim 8 or 9 method, is characterized in that, described in calculate after leaky bucket corresponding to described transmit queue be refreshed the flow of rear storage, also comprise:
The numerical value of the flow after the leaky bucket that the described transmit queue that utilization calculates is corresponding is refreshed, upgrades described first flow.
11. methods as described in claim 7 or 8 or 9, is characterized in that, after refreshing leaky bucket corresponding to described transmit queue, also comprise according to the described very first time, the second time and the bandwidth that arranges for described transmit queue in advance:
Utilize the numerical value of the described very first time, upgrade described second time.
12. methods as claimed in claim 10, is characterized in that, after refreshing leaky bucket corresponding to described transmit queue, also comprise according to the described very first time, the second time and the bandwidth that arranges for described transmit queue in advance:
Utilize the numerical value of the described very first time, upgrade described second time.
The equipment of 13. 1 kinds of traffic shapings, is characterized in that, described equipment comprises:
Go out group module, for the first packet is gone out team from the transmit queue communication process chip;
Refresh module, for refreshing token bucket corresponding to described transmit queue according to the very first time, the second time and the bandwidth that arranges for described transmit queue in advance, wherein, the described very first time is described first packet goes out team time from this transmit queue, described second time is that the second packet goes out the time of team from described transmit queue, described second packet is before described first packet goes out team from described transmit queue, and the last time goes out the packet of team;
Wherein, described refresh module comprises:
First computing unit, for calculating the time difference of the described very first time and the second time;
Second computing unit, for calculating according to described time difference and the bandwidth meter that arranges for described transmit queue in advance the token amount needing to add to the token bucket that described transmit queue is corresponding;
First refresh unit, adds token, to refresh token bucket corresponding to described transmit queue for the token amount calculated described in basis to the token bucket that described transmit queue is corresponding.
14. equipment as claimed in claim 13, it is characterized in that, described equipment also comprises:
First computing module, for according to the first token amount, the second token amount and the 3rd token amount, calculate token bucket corresponding to described transmit queue be refreshed after token amount; Wherein, described first token amount is before the first packet goes out team from described transmit queue, the token amount in the token bucket that described transmit queue is corresponding; Described second token amount is when to be the first packet to go out group from described transmit queue, the token amount deducted from the token bucket that described transmit queue is corresponding; Described 3rd token amount is the token amount that described needs add to the token bucket that described transmit queue is corresponding.
15. equipment as claimed in claim 13, it is characterized in that, described equipment also comprises:
3rd update module, for utilizing the numerical value of the described very first time, upgrades described second time.
16. equipment as claimed in claim 14, it is characterized in that, described equipment also comprises:
First arranges module, if be less than default first threshold for the token amount after the token bucket that described transmit queue is corresponding is refreshed, then the dispatch state of described transmit queue is set to the state of non-scheduling, and after a preset amount of time the dispatch state of described transmit queue is set to schedulable state; And/or
First update module, the numerical value of the token amount after the token bucket for utilizing the described transmit queue that calculates corresponding is refreshed, upgrades described first token amount.
The equipment of 17. 1 kinds of traffic shapings, is characterized in that, described equipment comprises:
Go out group module, for the first packet is gone out team from the transmit queue communication process chip;
Refresh module, for refreshing leaky bucket corresponding to described transmit queue according to the very first time, the second time and the bandwidth that arranges for described transmit queue in advance, wherein, the described very first time is described first packet goes out team time from this transmit queue, described second time is that the second packet goes out the time of team from described transmit queue, described second packet is before described first packet goes out team from described transmit queue, and the last time goes out the packet of team
Described refresh module comprises:
3rd computing unit, for calculating the time difference of the described very first time and the second time;
4th computing unit, for according to described time difference be the bandwidth that described transmit queue is arranged in advance, calculates the flow needing to deduct from leaky bucket corresponding to described transmit queue;
Second refresh unit, for the flow calculated described in deducting from leaky bucket corresponding to described transmit queue, to refresh leaky bucket corresponding to described transmit queue.
18. equipment as claimed in claim 17, it is characterized in that, described equipment also comprises:
Second computing module, for according to first flow, the second flow and the 3rd flow, calculate leaky bucket corresponding to described transmit queue be refreshed after flow; Wherein, described first flow is before the first packet goes out team from described transmit queue, the flow in the leaky bucket that described transmit queue is corresponding; Described second flow is when to be the first packet to go out group from described transmit queue, the flow added in the leaky bucket that described transmit queue is corresponding; The described 3rd flow flow that to be described needs deduct from leaky bucket corresponding to described transmit queue.
19. equipment as claimed in claim 18, it is characterized in that, described equipment also comprises:
Second arranges module, if be greater than default Second Threshold for the flow after the leaky bucket that described transmit queue is corresponding is refreshed, then the dispatch state of described transmit queue is set to the state of non-scheduling, and after a preset amount of time the dispatch state of described transmit queue is set to schedulable state; And/or
Second update module, the numerical value of the flow after the leaky bucket for utilizing the described transmit queue that calculates corresponding is refreshed, upgrades described first flow.
20. equipment as claimed in claim 17, it is characterized in that, described equipment also comprises:
3rd update module, for utilizing the numerical value of the described very first time, upgrades described second time.
CN201180001490.1A 2011-08-01 2011-08-01 A kind of method and apparatus of traffic shaping Active CN103026671B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/077884 WO2012159362A1 (en) 2011-08-01 2011-08-01 Traffic shaping method and device

Publications (2)

Publication Number Publication Date
CN103026671A CN103026671A (en) 2013-04-03
CN103026671B true CN103026671B (en) 2016-01-20

Family

ID=47216586

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201180001490.1A Active CN103026671B (en) 2011-08-01 2011-08-01 A kind of method and apparatus of traffic shaping

Country Status (2)

Country Link
CN (1) CN103026671B (en)
WO (1) WO2012159362A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104753809B (en) 2013-12-25 2019-04-02 深圳市中兴微电子技术有限公司 The method and device of token is added in a kind of traffic shaping
CN112866135A (en) * 2018-01-26 2021-05-28 华为技术有限公司 Method for sending message, first network equipment and computer readable storage medium
CN111045810B (en) * 2019-12-17 2023-08-29 浙江大华技术股份有限公司 Task scheduling processing method and device
CN113067778B (en) * 2021-06-04 2021-09-17 新华三半导体技术有限公司 Flow management method and flow management chip
CN113645147A (en) * 2021-07-01 2021-11-12 苏州裕太微电子有限公司 Token updating system and method of flow shaper

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1525717A (en) * 2003-02-25 2004-09-01 ������������ʽ���� Flow quantity truing method and apparatus
CN1751481A (en) * 2003-02-14 2006-03-22 西门子公司 Method for allocating transmission bandwidth in a packet-oriented communications facility

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100574278C (en) * 2006-12-26 2009-12-23 华为技术有限公司 The method of refreshing token bucket and device in the flow limiting technology
US7843825B2 (en) * 2007-10-02 2010-11-30 Broadcom Corporation Method and system for packet rate shaping
CN101217495A (en) * 2008-01-11 2008-07-09 北京邮电大学 Traffic monitoring method and device applied under T-MPLS network environment
CN101841461B (en) * 2010-02-11 2012-05-30 北京星网锐捷网络技术有限公司 Method and device for controlling update of token bucket

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1751481A (en) * 2003-02-14 2006-03-22 西门子公司 Method for allocating transmission bandwidth in a packet-oriented communications facility
CN1525717A (en) * 2003-02-25 2004-09-01 ������������ʽ���� Flow quantity truing method and apparatus

Also Published As

Publication number Publication date
WO2012159362A1 (en) 2012-11-29
CN103026671A (en) 2013-04-03

Similar Documents

Publication Publication Date Title
CN103026671B (en) A kind of method and apparatus of traffic shaping
CN100574278C (en) The method of refreshing token bucket and device in the flow limiting technology
CN104427555B (en) The method for blocking the period of service, network controller and website
CN103096419A (en) Management method and accessing point of terminal and terminal
CN105392188A (en) Wireless communication apparatus, wireless communication system, and slot assignment method
US20170329632A1 (en) Device scheduling method, task manager and storage medium
CN101425890A (en) Transmitted clock implementing apparatus and method
CN103327079A (en) Multimedia resource caching method and device
CN102508717B (en) Memory scheduling method and memory scheduling device for multi-core processor
TWI475491B (en) System and method for updating electronic shelf labels and updating apparatus and method of an electronic shelf label
CN105511387A (en) PLC IO extension module and extension method therefor
CN109981206A (en) Time synchronization method, device, system and terminal device, storage medium
Pullmann et al. Increasing energy efficiency by minimizing collisions in long-range IoT networks
CN103139925A (en) Upstream data dispatch method used for local thermodynamic equilibrium (LTE) system and device
CN103701721A (en) Message transmission method and device
CN104052831A (en) Data transmission method and device based on queues and communication system
CN103412785B (en) A kind of multi tate remote measurement method for synchronizing time
CN109117295A (en) A kind of overtime monitoring method of transaction and device
Schneider et al. Optimized schedule synthesis under real-time constraints for the dynamic segment of FlexRay
KR101301466B1 (en) System for correcting error, apparatus thereof, method thereof and computer recordable medium storing the method
CN105550089B (en) A kind of FC network frame head error in data method for implanting based on digital circuit
CN103684863B (en) The treating method and apparatus of traffic policing
CN103078766B (en) The auditing method of network traffics, device and the network equipment
CN103024715B (en) A kind of method that business datum flow based on tariff period is added up and device
Musengimana et al. Real-time scheduling based on multi-channel communication in IEEE 802.15. 4 industrial Internet of things (IIoT)

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201119

Address after: Unit 2414-2416, main building, no.371, Wushan Road, Tianhe District, Guangzhou City, Guangdong Province

Patentee after: GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

Effective date of registration: 20201119

Address after: 215500 No.13, Caotang Road, Changshu, Suzhou, Jiangsu Province

Patentee after: Changshu intellectual property operation center Co.,Ltd.

Address before: Unit 2414-2416, main building, no.371, Wushan Road, Tianhe District, Guangzhou City, Guangdong Province

Patentee before: GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION Co.,Ltd.

CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 215500 5th floor, building 4, 68 Lianfeng Road, Changfu street, Changshu City, Suzhou City, Jiangsu Province

Patentee after: Changshu intellectual property operation center Co.,Ltd.

Address before: No.13 caodang Road, Changshu City, Suzhou City, Jiangsu Province

Patentee before: Changshu intellectual property operation center Co.,Ltd.