A flow control method, device and forwarding chip
Based on traffic control, based on the distribution bandwidth and target cache data amount estimated the quantity of the queue can be available, combined with the scaling volume of the single -broadcast queue to judge the bandwidth distribution, solve the time for the existing technology to suppress bandwidth allocation. Early issues improved the reliability and bandwidth utilization of the broadcast.
Patent Information
- Application Number
- CN202211423069.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-15
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2042-11-15
AI Technical Summary
In the prior art, in traffic control, whether to suppress bandwidth allocation is determined based on the actual cache number occupied by the unicast queue and the multicast queue, resulting in the suppression time being too early, reducing the amount of data sent by packets, which can easily lead to packet blockage and packet loss. Low multicast reliability.
Based on the bandwidth and target cache data volume based on the bandwidth assigned to the broadcast queue, determine the cache volume of the broadcast line, and combine it with the single -broadcast queue can be matched. Bandwidth allocation.
It improves the reliability of multicast, reduces the possibility of packet blocking and packet loss, and improves bandwidth utilization.
Smart Images

Figure CN115914108B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of flow control, and in particular to a flow control method, device and forwarding chip. Background Art
[0002] In order to avoid packet blocking and packet loss, distributed network devices will manage the traffic of unicast and multicast packets. Figure 1 As shown, when the source sends a message to a distributed network device, it will first apply for bandwidth allocation from the bandwidth allocation device of the distributed network device. After obtaining the bandwidth allocation, it will send unicast messages and multicast messages according to the allocated bandwidth. The distributed network device will cache the received messages and the multicast messages obtained after multicast replication of the multicast messages into the egress port cache device. The bandwidth allocation device will allocate bandwidth for the unicast messages and multicast messages, and the egress port cache device will schedule the unicast messages and multicast messages that have been allocated bandwidth and then output them. When the cache space in the egress port cache device is occupied more, it is necessary to suppress the bandwidth allocation device from allocating bandwidth, and no longer receive new messages to avoid occupying too much cache at the egress port.
[0003] In the prior art, whether to suppress bandwidth allocation is usually determined based on whether the sum of the cache actually occupied by the unicast queue and the multicast queue reaches the cache threshold. However, since there are multicast messages generated by the distributed network equipment after copying the received multicast messages, these newly generated multicast messages need to be reallocated bandwidth by the bandwidth allocation device. In other words, the multicast queue contains messages that have been allocated bandwidth and messages that have not been allocated bandwidth. If it is determined whether to suppress bandwidth allocation based on the cache actually occupied by the unicast queue and the multicast queue, since the cache actually occupied by the multicast queue is usually larger than the amount of cache occupied by the messages in the multicast queue that have been allocated bandwidth, it will make the timing of suppressing bandwidth allocation too early, reduce the amount of sent message data, and easily cause message blocking and packet loss, making the multicast reliability low.
[0004] In some cases, such as when only multicast queues are cached in a distributed network device and the multicast replication speed is high, the number of caches occupied by the multicast queue increases rapidly. If bandwidth allocation is suppressed based only on whether the number of caches occupied by the multicast queue reaches the cache threshold, the amount of message data sent out of the egress port cache device is much smaller than the increased amount of message data, which can easily cause the allocable bandwidth to decrease rapidly. The amount of multicast message data generated by multicast replication is much larger than the amount of multicast message data that can be sent after bandwidth allocation, which ultimately results in that although the number of caches occupied in the egress port cache device reaches the cache threshold, each multicast message in the cached multicast queue has not been allocated bandwidth. At this time, the messages in the multicast queue that have not been allocated bandwidth will not be able to obtain bandwidth allocation, and enter an infinite loop.
[0005] It can be seen that the existing flow control method makes the reliability of multicast low. Summary of the invention
[0006] The purpose of the embodiments of the present invention is to provide a flow control method, device and forwarding chip to improve multicast reliability. The specific technical solution is as follows:
[0007] An embodiment of the present invention provides a flow control method, which is applied to a forwarding chip, wherein the forwarding chip is used to forward unicast messages and / or multicast messages that have been allocated bandwidth, and the method includes:
[0008] Based on the bandwidth allocated to the multicast queue and the target cache slice data volume, determining the available cache volume of the multicast queue, wherein the target cache slice data volume is: the estimated multicast message data volume of the allocated bandwidth stored in each cache unit; the available cache volume of the multicast queue is positively correlated with the bandwidth allocated to the multicast queue, and negatively correlated with the target cache slice data volume;
[0009] If the sum of the available buffer amount of the unicast queue and the available buffer amount of the multicast queue is not greater than the preset buffer threshold, bandwidth allocation is performed, and the available buffer amount of the unicast queue is the amount of buffer occupied by the unicast queue.
[0010] In a possible embodiment, the method further includes:
[0011] The amount of data stored in each cache unit occupied by the multicast queue is counted to obtain the target cache slice data amount.
[0012] In a possible embodiment, the counting of the amount of data stored in each cache unit occupied by the multicast queue to obtain the target cache slice data amount includes:
[0013] Counting the amount of data stored in each cache unit occupied by the multicast queue to obtain a statistical value;
[0014] An integer power of 2 closest to the statistical value is determined as the target cache slice data amount.
[0015] In a possible embodiment, the method further includes:
[0016] If the bandwidth allocated to the multicast queue is greater than the amount of data contained in the multicast queue, the amount of buffer occupied by the multicast queue is used as the available buffer amount of the multicast queue;
[0017] If the bandwidth allocated to the multicast queue is not greater than the amount of data contained in the multicast queue, the step of determining the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume is performed.
[0018] In a possible embodiment, before determining the available cache amount of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data amount, the method further includes:
[0019] The amount of buffer occupied by the unicast queue, the amount of buffer occupied by the multicast queue, the amount of data contained in the multicast queue, and the bandwidth allocated to the multicast queue are updated.
[0020] In a possible embodiment, the method further includes:
[0021] If the sum of the available buffer amount of the unicast queue and the available buffer amount of the multicast queue is greater than a preset buffer threshold, bandwidth allocation is stopped.
[0022] The embodiment of the present invention further provides a flow control device, which is applied to a forwarding chip, wherein the forwarding chip is used to forward unicast messages and / or multicast messages that have been allocated bandwidth, and the device includes:
[0023] The available cache capacity determination module is used to determine the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume, wherein the target cache slice data volume is: the estimated multicast message data volume of the allocated bandwidth stored in each cache unit; the available cache capacity of the multicast queue is positively correlated with the bandwidth allocated to the multicast queue, and negatively correlated with the target cache slice data volume;
[0024] The flow control module is used to allocate bandwidth if the sum of the available buffer amount of the unicast queue and the available buffer amount of the multicast queue is not greater than a preset buffer threshold, and the available buffer amount of the unicast queue is the amount of buffer occupied by the unicast queue.
[0025] In a possible embodiment, the device further includes:
[0026] The determination module is used to count the amount of data stored in each cache unit occupied by the multicast queue to obtain the target cache slice data amount.
[0027] In a possible embodiment, the determining module is used to count the amount of data stored in each cache unit occupied by the multicast queue to obtain a statistical value;
[0028] An integer power of 2 closest to the statistical value is determined as the target cache slice data amount.
[0029] In a possible embodiment, the device further includes:
[0030] A judgment module, configured to use the amount of buffer occupied by the multicast queue as the available buffer amount of the multicast queue if the bandwidth allocated to the multicast queue is greater than the amount of data contained in the multicast queue;
[0031] If the bandwidth allocated to the multicast queue is not greater than the amount of data contained in the multicast queue, the step of determining the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume is performed.
[0032] In a possible embodiment, the device further includes:
[0033] The updating module is used to update the amount of buffer occupied by the unicast queue, the amount of buffer occupied by the multicast queue, the amount of data contained in the multicast queue, and the bandwidth allocated to the multicast queue.
[0034] In a possible embodiment, the traffic control module is configured to stop bandwidth allocation if the sum of the available buffer amount of the unicast queue and the available buffer amount of the multicast queue is greater than a preset buffer threshold.
[0035] The present invention also provides a forwarding chip, comprising a processing unit and a storage unit;
[0036] A storage unit, used for storing a unicast queue and / or a multicast queue;
[0037] A processing unit, used to implement any of the flow control method steps described above.
[0038] Beneficial effects of the embodiments of the present invention:
[0039] The flow control method provided by the embodiment of the present invention determines the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume, and the target cache slice data volume is: the estimated multicast message data volume of the allocated bandwidth stored in each cache unit; the available cache capacity of the multicast queue is positively correlated with the bandwidth allocated to the multicast queue and negatively correlated with the target cache slice data volume; if the sum of the available cache capacity of the unicast queue and the available cache capacity of the multicast queue is not greater than the preset cache threshold, bandwidth allocation is performed, and the available cache capacity of the unicast queue is the amount of cache occupied by the unicast queue. Applying the embodiment of the present invention, the available cache capacity of the multicast queue is estimated by the bandwidth allocated to the multicast queue and the target cache slice data volume, and the sum of the available cache capacity of the multicast queue and the available cache capacity of the unicast queue is compared with the preset cache threshold to determine whether bandwidth allocation is performed. Since the available buffer size of the multicast queue and the available buffer size of the unicast queue respectively reflect the amount of buffer occupied by the messages that have been allocated bandwidth and can be sent in the multicast queue and the unicast queue, the determination of whether to allocate bandwidth is based on the amount of buffer occupied by the messages that have been allocated bandwidth, that is, the determination of whether to allocate bandwidth is based on the actual bandwidth usage, rather than the determination of whether to allocate bandwidth based on the messages that have been allocated bandwidth and the messages that have not been allocated bandwidth, so as to avoid stopping bandwidth allocation too early, thereby reducing the possibility of message blocking and packet loss and improving multicast reliability. At the same time, when the amount of buffer occupied by the messages that have been allocated bandwidth does not reach the preset buffer threshold, bandwidth allocation can continue to be performed to improve bandwidth utilization.
[0040] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0042] Figure 1 It is the data flow diagram during the multicast process;
[0043] Figure 2 A flow chart of a flow control method provided by an embodiment of the present invention;
[0044] Figure 3 A flow chart of a specific example of a flow control method provided by an embodiment of the present invention;
[0045] Figure 4A schematic diagram of a process for updating queue data in an embodiment of the present invention;
[0046] Figure 5 A schematic diagram of the structure of a flow control device provided by an embodiment of the present invention;
[0047] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field based on the present invention belong to the scope of protection of the present invention.
[0049] In order to improve the reliability of multicast, the embodiment of the present invention provides a flow control method, device and forwarding chip. The flow control method provided by the present invention is first exemplarily described below:
[0050] The flow control method provided by the embodiment of the present invention can be applied to a distributed network device with a multicast replication function in a distributed network, and the device can be a router, a switch, etc., and can be implemented by a forwarding chip in the device. The forwarding chip is used to forward unicast messages and multicast messages that have been allocated bandwidth.
[0051] like Figure 2 As shown, Figure 2 A flow chart of a flow control method provided by an embodiment of the present invention, the method may include the following steps:
[0052] Step S201: based on the bandwidth allocated to the multicast queue and the target cache slice data volume, determine the available cache volume of the multicast queue, wherein the target cache slice data volume is: the estimated multicast message data volume of the allocated bandwidth stored in each cache unit; the available cache volume of the multicast queue is positively correlated with the bandwidth allocated to the multicast queue, and negatively correlated with the target cache slice data volume;
[0053] Step S202: If the sum of the available buffer amount of the unicast queue and the available buffer amount of the multicast queue is not greater than the preset buffer threshold, bandwidth allocation is performed, and the available buffer amount of the unicast queue is the amount of buffer occupied by the unicast queue.
[0054] As described above, the forwarding chip is used to forward unicast messages and multicast messages that have been allocated bandwidth. Before the forwarding chip forwards the unicast messages and multicast messages that have been allocated bandwidth, it is necessary to allocate bandwidth for the received unicast messages, multicast messages, and multicast messages generated by multicast replication inside the forwarding chip. The above process of allocating bandwidth for the received unicast messages, multicast messages, and multicast messages generated by multicast replication can be understood as a process of authorizing downstream unicast messages and multicast messages, and only authorized downstream unicast messages and multicast messages can be sent.
[0055] By using the embodiment of the present invention, the available cache capacity of the multicast queue is estimated by the bandwidth allocated to the multicast queue and the target cache slice data volume, and the sum of the available cache capacity of the multicast queue and the available cache capacity of the unicast queue is compared with the preset cache threshold to determine whether to allocate bandwidth. Since the available cache capacity of the multicast queue and the available cache capacity of the unicast queue respectively reflect the amount of cache occupied by the messages that have been allocated bandwidth and can be sent in the multicast queue and the unicast queue, it is determined whether to allocate bandwidth based on the cache capacity occupied by the messages that have been allocated bandwidth, that is, whether to authorize the downlink unicast message and the multicast message based on the actual bandwidth usage.
[0056] As described above, in the prior art, whether to allocate bandwidth is determined based on the actual number of buffers occupied by the unicast queue and the multicast queue. Since the multicast queue contains messages with allocated bandwidth and messages without allocated bandwidth, the actual number of buffers occupied by the multicast queue is usually greater than the number of buffers occupied by messages with allocated bandwidth in the multicast queue. Therefore, determining whether to authorize downlink unicast messages and multicast messages based on the actual number of buffers occupied by the multicast queue can easily stop bandwidth allocation too early, resulting in message blocking and packet loss. Moreover, since it is easy to stop bandwidth allocation too early, bandwidth allocation will be stopped even if there is still bandwidth to allocate, resulting in low bandwidth utilization.
[0057] It can be seen that compared with the prior art, the embodiment of the present invention determines whether to stop bandwidth allocation based on the amount of buffer occupied by the packets that have been allocated bandwidth, which can avoid stopping bandwidth allocation too early, thereby reducing the possibility of packet blocking and packet loss and improving multicast reliability. At the same time, when the amount of buffer occupied by the packets that have been allocated bandwidth does not reach the preset buffer threshold, bandwidth allocation can continue to be performed to improve bandwidth utilization.
[0058] For the scenario where only multicast messages are stored in the above-mentioned distributed network device, bandwidth allocation is stopped when the amount of multicast messages available for outgoing buffer reaches the preset buffer threshold. The amount of multicast messages available for outgoing buffer reflects the amount of buffer occupied by messages that have been allocated bandwidth. When the allocated bandwidth is 0, that is, when the amount of multicast message data that has been allocated bandwidth is 0, bandwidth allocation will continue, and there will be no phenomenon that messages in the multicast queue that have not been allocated bandwidth cannot obtain bandwidth allocation.
[0059] In addition, in the related art, whether to allocate bandwidth is determined based on the actual amount of buffer occupied by the unicast queue and the multicast queue, and the multicast queue contains multicast messages with allocated bandwidth and multicast messages with unallocated bandwidth. Therefore, some chips cannot perform authorization control of downlink unicast messages and multicast messages based on the multicast messages that have been allocated bandwidth in the multicast queue, that is, they cannot realize the downlink multicast message authorization control function. Some chips add a first-level multicast queue cache and scheduling device in front of the egress port cache device to cache and schedule the multicast queue separately, and the authorized multicast message enters the egress port cache device to realize the downlink multicast message authorization control function, but this method greatly increases the area and power consumption of the chip. The flow control method provided by the embodiment of the present invention is applied to determine whether to allocate bandwidth based on the amount of buffer occupied by the message that has been allocated bandwidth, that is, to determine whether to authorize the downlink unicast message and multicast message based on the actual use of the bandwidth. While realizing the authorization control function of the downlink multicast message, there is no need to add any hardware device or queue in the chip, and it will not increase too much resource overhead, nor will it increase the area and power consumption of the chip.
[0060] The above steps S201-S202 are exemplarily described below:
[0061] For a multicast queue, since there are multicast messages distributed after multicast replication inside the distributed network device, it is necessary to reallocate bandwidth to it. This makes the bandwidth allocated to the multicast queue possibly smaller than the amount of data contained in the multicast queue, that is, the multicast queue contains multicast messages that have been allocated bandwidth and multicast messages that have not been allocated bandwidth. In other words, the amount of buffer occupied by the multicast queue is different from the amount of buffer occupied by the multicast messages that have been allocated bandwidth. Therefore, if bandwidth allocation is determined based on the amount of buffer occupied by the multicast queue, bandwidth allocation will be stopped too early.
[0062] The bandwidth allocated to the multicast queue indicates the amount of data that can be sent in the multicast queue, and the distributed network device sends data packets according to the cache unit. The utilization rate of the data packet to the cache unit is usually not 100%, so the amount of data that has obtained bandwidth allocation is different from the amount of cache occupied by the data. In the embodiment of the present invention, the amount of cache that may be occupied by the multicast message that has been allocated bandwidth in the multicast queue can be estimated to participate in the subsequent judgment of whether to stop bandwidth allocation.
[0063] As a specific implementation, the amount of buffer that may be occupied by the multicast message with allocated bandwidth may be determined based on the bandwidth allocated to the multicast queue and the amount of multicast message data with allocated bandwidth actually stored in each buffer unit.
[0064] Since the unicast messages and multicast messages received by the distributed network device come from different source ends, and the message encapsulation methods used by each source end when sending unicast messages or multicast messages may not be consistent, this may cause the lengths of each data packet to be inconsistent. When storing data packets, the distributed network device usually determines the length of each cache unit based on the length of the maximum data packet. Due to the different lengths of the data packets, the utilization rate of the cache space for each data packet is also different. In other words, the amount of data stored in the storage units storing different data packets is not equal. Therefore, the method of directly obtaining the amount of multicast message data that has been allocated bandwidth and is actually stored in each cache unit is difficult to operate and has low feasibility.
[0065] Therefore, as another specific implementation, the amount of multicast message data with allocated bandwidth stored in each cache unit can be estimated. When estimating, the same value can be estimated for all cache units, or different values can be estimated for non-cacheable units, which is not specifically limited in the present invention.
[0066] The following takes estimating the same value for all cache units as an example to illustrate estimating the amount of multicast message data with allocated bandwidth stored in each cache unit. For ease of description, the estimated amount of multicast message data with allocated bandwidth stored in each cache unit is referred to as the target cache slice data amount.
[0067] The target cache slice data volume can be set according to actual needs, such as 8 bytes, 4 bytes, etc.
[0068] As another implementation, the target cache slice data volume may be set by the following steps:
[0069] The amount of data stored in each cache unit occupied by the multicast queue is counted to obtain the target cache slice data amount.
[0070] That is to say, the target cache slice data volume can be estimated according to the actual data volume stored in each cache unit occupied by the multicast queue, so that the calculated available cache volume of the multicast queue is closer to the actual cache volume occupied by the multicast packets that have been allocated bandwidth.
[0071] Exemplarily, the amount of data stored in each of the above cache units can be obtained, and the median thereof can be used as the target cache slice data amount. For example, the multicast queue occupies 7 cache units, and the amount of data stored in each cache unit is 5, 5, 2, 4, 4, 4, and 3, respectively, in bytes, then 4 can be used as the target cache slice data amount.
[0072] Of course, the average value of the data amount stored in the above cache units can also be used as the target cache slice data amount. The target cache slice amount can also be obtained by increasing or decreasing a preset number of bytes, such as 1 byte or 2 bytes, based on the average value or median.
[0073] As described above, the flow control method provided by the embodiment of the present invention is usually implemented by a chip. When executing the above step S101, the chip needs to calculate the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume. The chip usually performs binary logic operations. Therefore, when the number involved in the calculation is an integer power of 2, the difficulty of the chip processing logic operations is relatively low. However, the above average value or median is usually not an integer power of 2, which makes chip operations more difficult.
[0074] Therefore, as a specific implementation, the target cache slice data volume can be obtained by the following steps:
[0075] Step S21, counting the amount of data stored in each cache unit occupied by the multicast queue to obtain a statistical value;
[0076] Step S22: determine the integer power of 2 closest to the statistical value as the target cache slice data amount.
[0077] The above steps S21-S22 are exemplarily described below:
[0078] In step S21, the statistical value may be an average value, a median value, etc. of the amount of data stored in each cache unit occupied by the multicast queue, and the present invention does not make any specific limitation on this.
[0079] In step S22, the integer power of 2 closest to the statistical value may be an integer power of 2 that is larger than the statistical value and closest to the statistical value, or an integer power of 2 that is smaller than the statistical value and closest to the statistical value. The integer power of 2 closest to the statistical value is the target cache slice number.
[0080] For example, if the above statistical value is 3 bytes, then the above target cache slice data volume can be 2 bytes or 4 bytes.
[0081] In this way, by determining the integer power of 2 closest to the above statistical value as the target cache slice data volume, the chip operation difficulty can be reduced and resource overhead can be further saved.
[0082] After obtaining the target cache slice data volume, the available cache volume of the multicast queue can be determined based on the bandwidth allocated to the multicast queue and the target cache slice data volume.
[0083] As an implementation method, the quotient of the bandwidth allocated to the multicast queue and the target cache slice data volume can be used as the available cache volume of the multicast queue. Of course, the preset bytes, such as 1 byte or 2 bytes, can also be increased or decreased on this basis to obtain the available cache volume of the multicast queue. The available cache volume of the multicast queue is the estimated cache volume occupied by the multicast messages in the multicast queue that have been allocated bandwidth.
[0084] As mentioned above, when receiving unicast messages, the distributed network device will allocate bandwidth to the unicast messages, and the source will send unicast messages of corresponding size according to the bandwidth. Therefore, the number of buffers occupied by unicast messages is the number of buffers of unicast messages that can be sent after bandwidth allocation.
[0085] Therefore, in step S202, it can be determined whether the sum of the number of buffers occupied by the unicast queue and the available buffer amount of the multicast message is greater than the preset buffer threshold. If it is greater, the bandwidth allocation can be stopped, and the bandwidth allocation can be re-performed after the message that has been allocated bandwidth is sent, so as to avoid occupying too much buffer space in the egress port buffer device. The bandwidth allocation can also be reduced. If it is not greater, the bandwidth allocation can be continued.
[0086] In an embodiment of the present invention, it may be determined whether it is necessary to estimate the available buffer capacity of the multicast queue. Specifically, the above step S201 may further include the following steps:
[0087] Determine whether the bandwidth allocated to the multicast queue is greater than the amount of data contained in the multicast queue. If so, use the amount of buffer occupied by the multicast queue as the available buffer amount of the multicast queue. If not, execute the above step S201.
[0088] If the bandwidth allocated to the multicast queue is greater than the amount of data actually stored in the multicast queue, it means that all multicast messages in the multicast queue can be sent. Therefore, the actual amount of buffer occupied by the multicast queue is the amount of buffer required for sending multicast messages that have been allocated bandwidth. In this case, the actual amount of buffer occupied by the multicast queue can be directly used as the available buffer of the multicast queue. If the bandwidth allocated to the multicast queue is not greater than the amount of data actually stored in the multicast queue, it is necessary to estimate the amount of buffer that may be occupied by the bandwidth allocated to the multicast queue.
[0089] like Figure 3 As shown, Figure 3 A flow chart showing a specific example of the flow control method provided by an embodiment of the present invention is shown, which may specifically include the following steps:
[0090] S301, determine whether the current queue is a unicast queue. If the current queue is a unicast queue, use the actual buffer quantity Uc_que_buf_len occupied by the unicast queue as the available buffer quantity Uc_que_cal_len of the unicast queue, and execute S306; if the current queue is not a unicast queue, execute S302.
[0091] S302, calculating an average cache slice size avg_buf_size; wherein the average cache slice size avg_buf_size is the quotient of the amount of data stored in the multicast queue Mc_que_byte_len and the amount of cache Mc_que_buf_len actually occupied by the multicast queue.
[0092] The average cache slice size is the statistical value obtained by counting the amount of data stored in each cache unit occupied by the multicast queue. The statistical value is an average value, which reflects the actual situation of the amount of data stored in each cache unit occupied by the multicast queue.
[0093] S303, determine whether the allocated bandwidth Mc_que_credit in the multicast queue is greater than the data volume Mc_que_byte_len stored in the multicast queue. If so, use the buffer quantity Mc_que_buf_len actually occupied by the multicast queue as the available buffer quantity Mc_que_cal_len of the multicast queue and execute S306; if not, execute S304.
[0094] If the allocated bandwidth Mc_que_credit in the multicast queue is greater than the amount of data Mc_que_byte_len stored in the multicast queue, it means that all multicast messages in the multicast queue can be sent, and the amount of buffer occupied when sending (i.e., the amount of buffer available) is the amount of buffer actually occupied by the multicast queue. If not all multicast messages in the multicast queue can be sent after bandwidth allocation, S304 can be executed to estimate the buffer that may be occupied by the bandwidth allocated to the multicast queue.
[0095] S304, determine whether the average cache slice size avg_buf_size is greater than 1 / 2 of the maximum storable byte length buf_size of a single cache unit; if greater, the available cache capacity Mc_que_cal_len of the multicast queue is the quotient of the allocated bandwidth Mc_que_credit in the multicast queue and the maximum storable byte length buf_size of a single cache unit, and execute S306; if not greater, execute S305.
[0096] The maximum storable byte length of the above-mentioned single cache unit can be preset according to actual conditions, such as 8 bytes or 4 bytes. Since 1 byte is 8 bits, and 1 bit is one digit in a binary number, the maximum storable byte length of the above-mentioned single cache unit is an integer power of 2.
[0097] In this embodiment, when determining the power of 2 closest to the average cache slice size as the target cache slice data amount, the maximum storable byte length of the single cache unit can be divided into two multiple times and compared with the average cache slice size. Since the maximum storable byte length of a single cache unit is an integer power of 2, the result of dividing it into two is also an integer power of 2.
[0098] If the average cache slice size avg_buf_size is greater than 1 / 2 of the maximum storable byte length buf_size of a single cache unit, it means that the statistical value falls within [buf_size / 2,buf_size]. Therefore, buf_size can be used as the target cache slice data size.
[0099] Of course, buf_size / 2 can also be used as the target cache slice data size. In this embodiment, if the above average cache slice size avg_buf_size is less than buf_size / 2, you can continue to look for the integer power of 2 closest to the average cache slice size.
[0100] The above-mentioned target cache slice data volume is the estimated amount of multicast message data with allocated bandwidth that can be stored in the cache unit. Therefore, the quotient of the allocated bandwidth Mc_que_credit in the multicast queue and the target cache slice data volume is: the estimated amount of cache that may be occupied by the messages with allocated bandwidth in the multicast queue, that is, the amount of cache required to send the multicast messages with allocated bandwidth.
[0101] S305. Determine whether the average cache slice size avg_buf_size is greater than 1 / 4 of the maximum storable byte length buf_size of a single cache unit; if greater, the available cache capacity Mc_que_cal_len of the multicast queue is the quotient of Mc_que_credit and buf_size / 2; if not greater, the available cache capacity Mc_que_cal_len of the multicast queue is the quotient of Mc_que_credit and buf_size / 4.
[0102] Of course, if the above average cache slice size avg_buf_size is greater than buf_size / 4, buf_size / 4 can also be selected as the target cache slice data size.
[0103] If the average cache slice size avg_buf_size is not greater than buf_size / 4, the average cache slice size avg_buf_size may be further compared with buf_size / 8 and buf_size / 16. The number of times buf_size is divided into two and compared with the average cache slice size avg_buf_size may be determined according to chip performance, and the present invention does not specifically limit this.
[0104] S306: Determine the available outgoing buffer capacity port_cal_len of the port as the sum of the available outgoing buffer capacity Uc_que_cal_len of the unicast queue and the available outgoing buffer capacity Mc_que_cal_len of the multicast queue.
[0105] S307 , determining whether the available port cache capacity port_cal_len is greater than a preset cache capacity threshold que_th; if so, executing S308 ; if not, executing S309 .
[0106] S308: Suppress the bandwidth allocation device to control port buffer occupancy.
[0107] The above-mentioned bandwidth allocation suppression device may stop bandwidth allocation or reduce bandwidth allocation.
[0108] S309: Continue to allocate bandwidth.
[0109] In an embodiment of the present invention, the amount of buffer occupied by the unicast queue, the amount of buffer occupied by the multicast queue, the amount of data contained in the multicast queue, and the bandwidth allocated to the multicast queue may also be updated before executing step S201.
[0110] As can be seen from the above, when determining the available buffer amount of the unicast queue and the multicast queue, the buffer amount occupied by the unicast queue, the buffer amount occupied by the multicast queue, the amount of data contained in the multicast queue, and the bandwidth allocated to the multicast queue are used to update. Therefore, each time the flow control method provided by the embodiment of the present invention is executed, the above data can be updated first. The above data can also be updated according to a preset period, for example, the above data can be updated once every 5s, 10s, etc., and the present invention does not specifically limit this.
[0111] For example, Figure 4 As shown, the number of buffers occupied by a queue (unicast queue / multicast queue), the amount of data contained in the queue, and the bandwidth allocated to the queue can be updated by following the steps below:
[0112] S401, determine whether there is any queue entry in the current cycle, if there is a queue entry, execute S402; if there is no queue entry, execute S404.
[0113] S402: Update the number of buffers occupied by the queue Que_buf_len. The new Que_buf_len is equal to the old Que_buf_len plus the number of buffers occupied by the queued message enq_buf_len.
[0114] S403: Update the amount of data contained in the queue Que_byte_len. The new Que_byte_len is equal to the old Que_byte_len plus the amount of data contained in the queued message enq_byte_len.
[0115] S404: Determine whether there is a queue exit in the current cycle. If there is a queue exit, execute S405; if there is no queue exit, execute S408.
[0116] S405: Update the buffer quantity Que_buf_len occupied by the queue. The new Que_buf_len is equal to the old Que_buf_len minus the buffer quantity deq_buf_len occupied by the dequeued message.
[0117] S406: Update the amount of data Que_byte_len contained in the queue. The new Que_byte_len is equal to the old Que_byte_len minus the amount of data deq_byte_len contained in the dequeued message.
[0118] S407: Update the bandwidth Que_credit allocated to the queue. The new Que_credit is equal to the old Que_credit minus the amount of data deq_byte_len contained in the dequeued message.
[0119] S408: Determine whether there is bandwidth allocation in the current cycle. If there is bandwidth allocation, execute S409; if there is no bandwidth allocation, end the process.
[0120] S409: Update the bandwidth Que_credit assigned to the queue. The new Que_credit is equal to the old Que_credit plus the bandwidth assign_credit assigned this time.
[0121] The multicast queue can update the actual buffer quantity Mc_que_buf_len occupied by the multicast queue, the amount of data stored in the multicast queue Mc_que_byte_len, and the allocated bandwidth Mc_que_credit in the multicast queue through the above steps S401-S409. The unicast queue can update the actual buffer quantity Uc_que_buf_len occupied by the unicast queue, the amount of data stored in the unicast queue Uc_que_byte_len, and the allocated bandwidth Uc_que_credit in the unicast queue through the above steps S401-S409.
[0122] It can be seen that the flow control method provided by the present invention is applied to estimate the amount of multicast message data that has been allocated bandwidth and stored in each cache unit, and to estimate the amount of cache available at the multicast queue port in combination with the bandwidth allocated to the multicast queue. The calculated amount of cache available at the port is compared with the preset cache threshold, and the bandwidth allocation of the destination bandwidth allocation device is stopped after the preset cache threshold is reached. Compared with the prior art, in which a level of multicast queue cache and scheduling is added before the destination port cache device, the multicast queue is cached and scheduled separately, and the multicast message that obtains bandwidth allocation enters the destination port cache device, which increases excessive resource overhead, thereby causing the chip area and power consumption to increase, the problem that the multicast queue in the destination port cache has multicast messages that have not been allocated bandwidth and cannot participate in the port cache statistics can be solved with very little resource overhead.
[0123] Based on the same inventive concept, an embodiment of the present invention further provides a flow control device, which is applied to a forwarding chip, wherein the forwarding chip is used to forward unicast messages and / or multicast messages that have been allocated bandwidth, such as Figure 5 As shown, the device may include:
[0124] The available cache capacity determination module 501 is used to determine the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume, wherein the target cache slice data volume is: the estimated multicast message data volume of the allocated bandwidth stored in each cache unit; the available cache capacity of the multicast queue is positively correlated with the bandwidth allocated to the multicast queue, and negatively correlated with the target cache slice data volume;
[0125] The flow control module 502 is configured to allocate bandwidth if the sum of the available outgoing buffer amount of the unicast queue and the available outgoing buffer amount of the multicast queue is not greater than a preset buffer threshold, wherein the available outgoing buffer amount of the unicast queue is the amount of buffer occupied by the unicast queue.
[0126] By applying the embodiment of the present invention, the available cache capacity of the multicast queue is estimated by the bandwidth allocated to the multicast queue and the target cache slice data volume, and the sum of the available cache capacity of the multicast queue and the available cache capacity of the unicast queue is compared with the preset cache threshold to determine whether to allocate bandwidth. Since the available cache capacity of the multicast queue and the available cache capacity of the unicast queue respectively reflect the number of caches occupied by the messages that have been allocated bandwidth and can be sent in the multicast queue and the unicast queue, whether to stop bandwidth allocation is determined based on the cache capacity occupied by the messages that have been allocated bandwidth, that is, whether to stop bandwidth allocation is determined based on the actual bandwidth usage, rather than determining whether to stop bandwidth allocation based on the messages that have been allocated bandwidth and the messages that have not been allocated bandwidth, which can avoid stopping bandwidth allocation too early, thereby reducing the possibility of message blocking and packet loss, and improving multicast reliability. At the same time, when the cache capacity occupied by the messages that have been allocated bandwidth does not reach the preset cache threshold, bandwidth allocation can continue to improve bandwidth utilization.
[0127] In a possible embodiment, the device further includes:
[0128] The determination module is used to count the amount of data stored in each cache unit occupied by the multicast queue to obtain the target cache slice data amount.
[0129] In a possible embodiment, the determining module is used to count the amount of data stored in each cache unit occupied by the multicast queue to obtain a statistical value;
[0130] An integer power of 2 closest to the statistical value is determined as the target cache slice data amount.
[0131] In a possible embodiment, the device further includes:
[0132] A judgment module, configured to use the amount of buffer occupied by the multicast queue as the available buffer amount of the multicast queue if the bandwidth allocated to the multicast queue is greater than the amount of data contained in the multicast queue;
[0133] If the bandwidth allocated to the multicast queue is not greater than the amount of data contained in the multicast queue, the step of determining the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume is performed.
[0134] In a possible embodiment, the device further includes:
[0135] The updating module is used to update the amount of buffer occupied by the unicast queue, the amount of buffer occupied by the multicast queue, the amount of data contained in the multicast queue, and the bandwidth allocated to the multicast queue.
[0136] In a possible embodiment, the traffic control module is configured to stop bandwidth allocation if the sum of the available buffer amount of the unicast queue and the available buffer amount of the multicast queue is greater than a preset buffer threshold.
[0137] The present invention also provides a forwarding chip, such as Figure 6 As shown, it includes a storage unit 601 and a processing unit 602;
[0138] Storage unit 601, used to store unicast queues and / or multicast queues;
[0139] The processing unit 602 is used to implement any of the above-mentioned flow control method steps.
[0140] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0141] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0142] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and chip embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0143] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A flow control method, characterized in that: Applied to a forwarding chip, the forwarding chip is used to forward unicast messages and / or multicast messages that have been allocated bandwidth, the method comprising: Based on the bandwidth allocated to the multicast queue and the target cache slice data volume, determine the available cache volume of the multicast queue, wherein the target cache slice data volume is: the estimated amount of multicast message data with allocated bandwidth stored in each cache unit; the available cache volume of the multicast queue is positively correlated with the bandwidth allocated to the multicast queue, and negatively correlated with the target cache slice data volume, wherein the available cache volume of the multicast queue is the estimated amount of cache occupied by the multicast messages in the multicast queue that have been allocated bandwidth; If the sum of the available outgoing buffer amount of the unicast queue and the available outgoing buffer amount of the multicast queue is not greater than the preset buffer threshold, bandwidth allocation is performed, and the available outgoing buffer amount of the unicast queue is the amount of buffer occupied by the unicast queue; Counting the amount of data stored in each cache unit occupied by the multicast queue to obtain a statistical value; An integer power of 2 closest to the statistical value is determined as the target cache slice data amount.
2. The method according to claim 1, characterized in that The method further comprises: If the bandwidth allocated to the multicast queue is greater than the amount of data contained in the multicast queue, the amount of buffer occupied by the multicast queue is used as the available buffer amount of the multicast queue; If the bandwidth allocated to the multicast queue is not greater than the amount of data contained in the multicast queue, the step of determining the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume is performed.
3. The method according to claim 1, characterized in that Before determining the available cache amount of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data amount, the method further includes: The amount of buffer occupied by the unicast queue, the amount of buffer occupied by the multicast queue, the amount of data contained in the multicast queue, and the bandwidth allocated to the multicast queue are updated.
4. The method according to claim 1, characterized in that: The method further comprises: If the sum of the available buffer amount of the unicast queue and the available buffer amount of the multicast queue is greater than a preset buffer threshold, bandwidth allocation is stopped.
5. A flow control device, characterized in that: Applied to a forwarding chip, the forwarding chip is used to forward unicast messages and / or multicast messages that have been allocated bandwidth, and the device includes: The available cache capacity determination module is used to determine the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume, wherein the target cache slice data volume is: the estimated multicast message data volume with allocated bandwidth stored in each cache unit; the available cache capacity of the multicast queue is positively correlated with the bandwidth allocated to the multicast queue, and negatively correlated with the target cache slice data volume, wherein the available cache capacity of the multicast queue is the estimated cache capacity occupied by the multicast messages in the multicast queue with allocated bandwidth; A flow control module, configured to allocate bandwidth if the sum of the available outgoing buffer amount of the unicast queue and the available outgoing buffer amount of the multicast queue is not greater than a preset buffer threshold, wherein the available outgoing buffer amount of the unicast queue is the amount of buffer occupied by the unicast queue; A determination module is used to count the amount of data stored in each cache unit occupied by the multicast queue to obtain a statistical value; and determine the integer power of 2 closest to the statistical value as the target cache slice data amount.
6. The device according to claim 5, characterized in that The device also includes: A judgment module, configured to use the amount of buffer occupied by the multicast queue as the available buffer amount of the multicast queue if the bandwidth allocated to the multicast queue is greater than the amount of data contained in the multicast queue; If the bandwidth allocated to the multicast queue is not greater than the amount of data contained in the multicast queue, the step of determining the available cache capacity of the multicast queue based on the bandwidth allocated to the multicast queue and the target cache slice data volume is performed.
7. The device according to claim 5, characterized in that The device also includes: The updating module is used to update the amount of buffer occupied by the unicast queue, the amount of buffer occupied by the multicast queue, the amount of data contained in the multicast queue, and the bandwidth allocated to the multicast queue.
8. The device according to claim 5, characterized in that The flow control module is used to stop bandwidth allocation if the sum of the available buffer amount of the unicast queue and the available buffer amount of the multicast queue is greater than a preset buffer threshold.
9. A forwarding chip, characterized in that: including a processing unit and a storage unit; A storage unit, used for storing a unicast queue and / or a multicast queue; A processing unit, used to implement the method steps described in any one of claims 1-4.
Citation Information
Patent Citations
Multicast stream control method, system and field programmable gate array
CN101340393A
Multi-business unified crossing method and device
CN101754061A