Summary of the invention
Technical problem to be solved by this invention is, the method for a kind of dynamic assignment buffer is provided, thereby guarantees the relative fairness that between each port buffer taken.
In order to address the above problem, the invention discloses a kind of method of dynamic assignment buffer memory, for each port is provided with the buffer memory number thresholding that it can take, comprise first thresholding and second thresholding, wherein, described first thresholding is used to the buffer memory number that guarantees that port takies at least, and described second thresholding is used for the buffer memory number that restrictive ports takies, and described second threshold value is greater than described first threshold value;
When port is received message, if when judging that the current buffer memory number that takies of this port is between described first threshold value and second threshold value, the 3rd thresholding is set, whether be this port assignment buffer memory in order to decision according to the current network demand, wherein, described the 3rd thresholding dynamic adjustable.
Further, in the said method, the setting of described first thresholding and second thresholding is provided with according to following one or more parameters:
The priority of port traffic, port traffic flow, each port on average can take the buffer memory number.
Wherein, when the number that on average can take buffer memory according to described each port was provided with described first thresholding and second thresholding, described first thresholding is not more than each port on average can take the buffer memory number, and described second thresholding is not less than described each port on average can take the buffer memory number.
It is linear that described first thresholding and described each port on average can take the buffer memory number.
It is linear that described second thresholding and described each port on average can take the buffer memory number.
According to described current network demand the 3rd thresholding is set and is meant, be provided with according to following one or more parameters:
The priority of this port traffic, this port traffic flow, the buffer memory number of current free time.
The buffer memory number of described the 3rd threshold value and described current free time is linear, and described the 3rd thresholding is not more than described second thresholding.
The linear coefficient scope of the buffer memory number of described the 3rd threshold value and described current free time is 0.2 to 2.
Further, in the said method, after described port is received message, if the current number that takies buffer memory of this port is less than described first thresholding, and there is free buffer, then to this port assignment buffer memory.
Further, in the said method, after described port is received message, if the current number that takies buffer memory of this port is greater than described second thresholding, then not to this port assignment buffer memory.
Compared with prior art, the method of fair dynamic assignment buffer memory relatively that the present invention adopts, taken into full account the port operating position of switch, promptly used the buffer in the switch most possibly, also guarantee the relative fairness that buffer uses between each port, guaranteed the performance of whole switch.
Embodiment
Main design of the present invention is, distribute in the process of buffer memory at switch, elder generation is according to the network requirement of each port, as the kind of each port traffic and/or service traffics etc. is each port arrangement first thresholding and second thresholding, wherein, first thresholding is used to the buffer memory number that guarantees that port takies at least, second threshold value is used for the buffer memory number that restrictive ports takies, like this, after arbitrary port is received message, switch compares with current first thresholding and second thresholding that takies buffer memory number and this port of being provided with of this port, and in conjunction with the number of free buffer, determines whether to be this port assignment buffer memory.
Below in conjunction with embodiment and accompanying drawing technical solution of the present invention is described in further detail.
A kind of switch is realized the process of dynamic assignment buffer, is each port arrangement parameter earlier, i.e. first threshold value, and second threshold value, and then be each port dynamic assignment buffer.Wherein, configuration parameter is as follows:
Switch is according to the actual connection situation of port, for each port is provided with first, second threshold value respectively, and the buffer minimal amount that first threshold value can take for each port, the buffer maximum number that second threshold value can take for each port;
In the present embodiment, switch calculates the buffer number that each port on average can take earlier, it is the port number of the actual connection of buffer sum/switch in each port buffer number=switch that on average can take, and then be provided with first respectively for each port according to the network requirement (for example kind of this port traffic and/or service traffics) of this number and each port, second threshold value, wherein, the buffer number that first threshold value on average can take smaller or equal to each port, the buffer number that second threshold value on average can take more than or equal to each port, particularly, first of switch setting, the buffer number that second threshold value can be respectively on average can take with each port is linear, to make things convenient for the operation of switch, certainly, first, second threshold value also can become non-linear relation with the buffer number that each port on average can take respectively;
In other embodiments, switch also can be directly be provided with first thresholding and second thresholding according to the kind of each port traffic and service traffics etc., for example, when the high more or service traffics of the priority of port traffic were big more, first thresholding and second threshold value of setting were big more; Otherwise, the low more or service traffics of the priority of port traffic more hour, first thresholding and second threshold value of setting are all smaller.
After the above-mentioned parameter configuration was finished, the process of switch dynamic assignment buffer memory was divided into following steps as shown in Figure 1:
Step 101. switch ports themselves is received message;
Step 102. judges whether the current buffer number that takies of this port reaches this port first threshold value that has set, if enterstep 103, otherwise enterstep 107;
Step 103. judges whether the current buffer number that takies of this port reaches this port second threshold value that has set, if enterstep 109, otherwise enterstep 104;
Above-mentionedsteps 102 and 103 step interchangeable.
Step 104. judges whether there is idle buffer in the switch, if enterstep 105, otherwise enterstep 109;
Step 105. is determined the 3rd thresholding of dynamic adjustable according to current idle buffer number, i.e. the dynamic available buffer number of this port;
In this step, network requirement according to this port, the kind and/or the service traffics that are each port traffic are determined the 3rd thresholding, the 3rd thresholding is used to limit the buffer number that this port takies and is no more than second threshold value, in the present embodiment, dynamic available buffer number and idle buffer number of each port is linear, the linear coefficient preferable range is 0.2 to 2, in other embodiments, each port can be non-linear relation with idle buffer number with the 3rd threshold value of buffer number.
Step 106. judges that whether the current buffer number that takies of this port is less than the 3rd threshold value that has set, if enterstep 108, otherwise enterstep 109;
Whether there is idle buffer instep 107. switch, if enterstep 108, otherwise enterstep 109;
Step 108. is this port assignment buffer, deposits this message, process ends;
This port ofstep 109. does not have available buffer, abandons this message, process ends.
Be example with a switch that has 2000 buffer and 50 physical ports below, describe the process of above-mentioned dynamic assignment buffer again in detail:
Suppose only to have in this switch practical application 20 ports to connect, each port buffer number=2000/20=100 that on average can take then, at this moment, according to the network requirement (for example kind of this port traffic and service traffics etc.) of this buffer number and each port, for each port is provided with first thresholding and second thresholding respectively;
For example, according to the kind and/or the service traffics of current port traffic, first thresholding that this port is set equal buffer number that each port on average can take promptly 3 times of 100, the second thresholdings buffer number that on average can take for each port be 300;
After setting is finished, when this port is received message, if the current buffer number that takies of this port does not also reach first thresholding 100, and have idle buffer in the switch, then switch is used to deposit message to this port assignment buffer;
If the current buffer number that takies of this port reaches second thresholding 300, then no matter whether there is idle buffer in the switch, not to this port assignment buffer;
If the current buffer number that takies of this port is between first thresholding 100 and second thresholding 300, as the current buffer number that takies of port is 150, and when 200 idle buffer are arranged in the switch, if switch is provided with the number 200 that port can equal idle buffer with the 3rd threshold value of buffer number, then since the current buffer number 150 that takies of port less than the 3rd threshold value 200 that has been provided with, therefore, switch can be used to deposit message to this port assignment buffer, up to buffer number that this port takies greater than switch in till the remaining buffer number.
From the foregoing description as can be seen, technical scheme proposed by the invention is in the process that exchanger chip buffer distributes, for each port is provided with first thresholding and second thresholding, thereby kind and/or service traffics according to each port traffic, the needs of each port have been satisfied preferably, the technical program also further is provided with the 3rd thresholding of dynamic adjustable for each port, the buffer that restrictive ports takies outnumbers second thresholding, thereby guaranteed relatively fairness to use between each port idle buffer, in sum, the technical program adopts fair relatively dynamic cache allocation method, taken into full account the port operating position of switch, promptly use the buffer in the chip most possibly, also guaranteed the relative fairness that buffer takies between each port, guaranteed the performance of whole switch.
The above embodiment is the preferred embodiment that proves absolutely that the present invention lifts, and protection scope of the present invention is not limited thereto.Being equal to that those skilled in the art are done on basis of the present invention substitutes or conversion, all within protection scope of the present invention.Protection scope of the present invention is as the criterion with claims.