Message processing method and device, communication equipment and switching circuit
By dynamically determining the message processing method and using adaptive hierarchical waterline management, the problem of indiscriminate discarding in shared caches is solved, achieving differential discarding and fairness in bandwidth allocation, and protecting the invocation of high-priority and non-congestion hierarchical caches.
Patent Information
- Application Number
- CN201810912207.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-08-10
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2038-08-10
AI Technical Summary
In existing technologies, congestion control methods using shared buffers result in the indiscriminate discarding of high-priority packets and packets at non-congestion levels, leading to unfair bandwidth allocation and functional failure.
By dynamically determining the message processing method, differential discarding is achieved based on the upper limit, occupancy value, and message size of the lowest-level buffer, avoiding indiscriminate discarding. Adaptive hierarchical waterline management and differential backpressure indication are adopted.
It implements differential message discarding, protects high-priority and non-congestion level caches, avoids bandwidth allocation failure, and ensures high throughput of high-priority level cache calls and non-congestion level caches.
Smart Images

Figure CN110830382B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular, to a message processing method and apparatus, communication equipment, and a switching circuit. Background Art
[0002] Shared cache is the mainstream configuration parameter of existing routers, switch forwarding chips (traffic manager, TM) and switching networks. The shared cache is usually allocated and managed from multiple levels, where the multi-level cache can include: queue cache, port cache and global cache from low to high. Among them, the global cache can include at least one port cache, and the port cache can include at least one queue cache. When the high-level cache is congested, regardless of whether the low-level cache is congested, the messages to be stored in the low-level cache will be discarded indiscriminately. For example, when the message stored in the low-priority queue cache 1 causes the port cache to be congested, the message to be stored in the high-priority queue cache 2 will be discarded indiscriminately.
[0003] Based on the above congestion control method, when congestion occupies too much shared cache, it will cause indiscriminate discarding of high-priority messages and non-congested layer messages, and will also cause bandwidth allocation errors such as low-priority messages occupying high-priority bandwidth and unfair bandwidth allocation within the same priority level. Summary of the invention
[0004] The embodiments of the present application provide a message processing method and apparatus, a communication device, and a switching circuit, which are used to avoid the failure of the bandwidth allocation function caused by indiscriminate discarding and realize differentiated discarding of messages.
[0005] In a first aspect, an embodiment of the present application provides a message processing method, including:
[0006] The first device receives a message from the second device;
[0007] The first device determines a first queue buffer for storing the message;
[0008] The first device determines a first upper limit value of the first queue buffer according to an available value of the first port buffer and an available value of the global buffer, the global buffer includes at least one port buffer, the first port buffer is one of the at least one port buffer, the first port buffer includes at least one queue buffer, and the first queue buffer is one of the at least one queue buffer;
[0009] The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message.
[0010] Through the message processing method provided in the first aspect, the first device can dynamically determine the message processing method according to the upper limit value of the lowest level cache, the lowest level occupancy value and the size of the message, thereby avoiding the problem of the first device indiscriminately discarding messages to be input into the non-congested low-level cache and the congested low-level cache, and indiscriminately discarding messages to be input into the high-priority cache and the low-priority cache due to the existing high-level cache management method, realizing differential discarding of messages, and solving the problem of failure of bandwidth allocation function due to indiscriminate discarding of messages in the prior art.
[0011] In one possible design, the first device determines a first upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, including:
[0012] The first device determines a first upper limit value of the first queue cache according to the port sharing upper limit value and the global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of the available value of the first port cache and the first coefficient, and the global sharing upper limit value is equal to the product of the available value of the global cache and the second coefficient.
[0013] In one possible design, the first device determines a first upper limit value of a first queue buffer according to a port sharing upper limit value and a global sharing upper limit value, including:
[0014] The first device determines a first upper limit value of the first queue buffer according to the port sharing upper limit value, the global sharing upper limit value, and a preset lower limit value of the first queue buffer.
[0015] The message processing method provided in this implementation can ensure that the first device can call the message process from any level of cache, protect each level of cache of the first device, and avoid the phenomenon that any level of cache is locked.
[0016] In one possible design, the method includes:
[0017] The first device determines the available value of the global cache according to the upper limit value of the global cache and the occupancy value of the global cache;
[0018] The first device determines an upper limit value of the first port cache according to the third coefficient and the available value of the global cache;
[0019] The first device determines the available value of the first port buffer according to the upper limit value of the first port buffer and the occupancy value of the first port buffer.
[0020] In a possible design, the first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including:
[0021] The first device discards the message when the sum of the occupancy value of the first queue buffer and the size of the message is greater than the first upper limit value of the first queue buffer; or,
[0022] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer.
[0023] The message processing method provided by this implementation can realize adaptive hierarchical waterline management of the shared cache by the first device. The first device will only discard messages in the hierarchical cache with high occupancy values, and will not discard messages in the hierarchical cache with low occupancy values. This avoids the problem of the first device indiscriminately discarding messages to be input into a non-congested low-level cache and a congested low-level cache, and indiscriminately discarding messages to be input into a high-priority cache and a low-priority cache, caused by the existing high-level cache management method. This protects the call of the high-priority hierarchical cache and solves the problem of discarding the high-priority hierarchical cache due to indifferent discard.
[0024] In a possible design, the first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including:
[0025] When the sum of the occupancy value of the first queue buffer and the size of the message is greater than the first upper limit of the first queue buffer, the first device adds a congestion flag to the message, and stores the message with the added congestion flag in the first queue buffer, where the congestion flag is used to indicate that the first queue buffer is in a congested state; or
[0026] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer.
[0027] The message processing method provided by this implementation enables the second device to reduce the size and rate of messages input into the first queue cache, thereby realizing the differential marking of messages in lossless services by the first device, protecting the high-priority layer cache and non-congestion layer cache in the first device from triggering the message source (second device) to reduce the speed when sending messages, and avoiding the problem of the first device's indiscriminate marking causing the second device to reduce its speed.
[0028] In a possible design, the first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including:
[0029] When the sum of the occupancy value of the first queue buffer and the size of the message is greater than the first upper limit value of the first queue buffer, the first device stores the message in the first queue buffer and sends a back pressure signal to the second device, where the back pressure signal is used to instruct the second device to stop sending messages or stop sending messages after sending at least one message whose total size is a certain value; or,
[0030] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer.
[0031] The message processing method provided by this implementation can implement differentiated back pressure indication of messages by the first device, thereby protecting the high throughput of the non-congested layer cache, avoiding the impact of the congested layer cache on the non-congested layer cache, and avoiding the problem of reduced throughput caused by indifferent back pressure indication.
[0032] In one possible design, the method further includes:
[0033] The first device determines a second upper limit value of the first queue cache according to the available value of the first port cache and the available value of the global cache, and the first upper limit value is greater than the second upper limit value;
[0034] The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including:
[0035] The first device discards the message when the sum of the occupancy value of the first queue buffer and the size of the message is greater than the first upper limit value of the first queue buffer; or,
[0036] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than the second upper limit value of the first queue buffer; or,
[0037] When the sum of the occupancy value of the first queue buffer and the size of the message is greater than the second upper limit value of the first queue buffer and less than the first upper limit value of the first queue buffer, the first device selects to discard the message or store the message in the first queue buffer according to a probability value.
[0038] The message processing method provided by this implementation can realize adaptive hierarchical WRED management of the shared cache by the first device. The first device will only discard more messages in the layer cache with high occupancy values, and discard fewer messages input into the queue cache with low occupancy values. This can avoid the low-priority cache occupying too much shared cache, resulting in the indiscriminate discarding of messages input into the high-priority layer and non-congested layer cache, thereby realizing differentiated discarding of messages.
[0039] In one possible design, the method further includes:
[0040] The first device determines a second upper limit value of the first queue cache according to the available value of the first port cache and the available value of the global cache, and the first upper limit value is greater than the second upper limit value;
[0041] The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including:
[0042] When the sum of the occupancy value of the first queue buffer and the size of the message is greater than the first upper limit of the first queue buffer, the first device adds a congestion flag to the message, and stores the message with the added congestion flag in the first queue buffer, where the congestion flag is used to indicate that the first queue buffer is in a congested state; or
[0043] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than the second upper limit value of the first queue buffer; or,
[0044] When the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, the first device selects to store the message in the first queue cache or to add a congestion flag to the message according to a probability value, and stores the message after the congestion flag is added in the first queue cache.
[0045] Through the message processing method provided by this implementation, it can be achieved that the second device can reduce the size and rate of the message input into the first queue cache, realize the indiscriminate marking of the message by the first device, and protect the high priority level cache and non-congestion level cache in the first device from triggering the message source (second device) to reduce the speed when sending the message, thereby avoiding the speed reduction problem caused by the indiscriminate marking of the first device.
[0046] In a second aspect, an embodiment of the present application provides a communication device, including: an interface unit, a processing unit, and a memory;
[0047] Wherein, the interface unit is used to receive a message from another communication device;
[0048] A processing unit, configured to determine a first queue buffer for storing the message;
[0049] The processing unit is further used to determine a first upper limit value of the first queue cache according to the available value of the first port cache and the available value of the global cache;
[0050] The memory includes: a global cache, the global cache includes at least one port cache, the first port cache is one of the at least one port cache, the first port cache includes at least one queue cache, the first queue cache is one of the at least one queue cache;
[0051] The processing unit is further used to process the message according to the first upper limit value of the first queue buffer, the occupancy value of the first queue buffer and the size of the message.
[0052] In one possible design, the processing unit is used to determine a first upper limit value of the first queue cache based on a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of an available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of an available value of the global cache and a second coefficient.
[0053] In one possible design, the processing unit is used to determine a first upper limit value of the first queue cache based on the port sharing upper limit value, the global sharing upper limit value and a preset lower limit value of the first queue cache.
[0054] In one possible design, the processing unit is specifically used to determine the available value of the global cache based on the upper limit value of the global cache and the occupancy value of the global cache; determine the upper limit value of the first port cache based on the third coefficient and the available value of the global cache; determine the available value of the first port cache based on the upper limit value of the first port cache and the occupancy value of the first port cache.
[0055] In one possible design, the processing unit is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0056] In one possible design, the processing unit is specifically used to add a congestion flag in the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and store the message after the congestion flag is added in the first queue cache, wherein the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to a first upper limit value of the first queue cache, store the message in the first queue cache.
[0057] In one possible design, the processing unit is specifically used to store the message in the first queue cache and send an indication signal to the interface unit when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0058] In one possible design, the interface unit is also used to send a back pressure signal to another communication device when receiving an indication signal, and the back pressure signal is used to instruct the other communication device to stop sending messages or to stop sending messages after sending at least one message whose total size is a certain value.
[0059] In one possible design, the processing unit is further used to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, the first upper limit value being greater than the second upper limit value;
[0060] The processing unit is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache; or store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than the second upper limit value of the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select to discard the message or store the message in the first queue cache according to a probability value.
[0061] In one possible design, the processing unit is further used to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, the first upper limit value being greater than the second upper limit value;
[0062] The processing unit is specifically used to add a congestion mark in the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, and store the message after the congestion mark is added in the first queue cache, wherein the congestion mark is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than the second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, store the message in the first queue cache or add a congestion mark in the message according to a probability value, and store the message after the congestion mark is added in the first queue cache.
[0063] In a third aspect, an embodiment of the present application provides a switching circuit, including: a processing unit and a memory;
[0064] Wherein, the processing unit is used to receive a message from another device;
[0065] The processing unit is further used to determine a first queue buffer for storing the message;
[0066] The processing unit is further used to determine a first upper limit value of the first queue cache according to the available value of the first port cache and the available value of the global cache;
[0067] The memory includes: a global cache, the global cache includes at least one port cache, the first port cache is one of the at least one port cache, the first port cache includes at least one queue cache, the first queue cache is one of the at least one queue cache;
[0068] The processing unit is further used to process the message according to the first upper limit value of the first queue buffer, the occupancy value of the first queue buffer and the size of the message.
[0069] In one possible design, the processing unit is used to determine a first upper limit value of the first queue cache based on a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of an available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of an available value of the global cache and a second coefficient.
[0070] In one possible design, the processing unit is used to determine a first upper limit value of the first queue cache based on the port sharing upper limit value, the global sharing upper limit value and a preset lower limit value of the first queue cache.
[0071] In one possible design, the processing unit is used to determine the available value of the global cache based on the upper limit value of the global cache and the occupancy value of the global cache; determine the upper limit value of the first port cache based on the third coefficient and the available value of the global cache; and determine the available value of the first port cache based on the upper limit value of the first port cache and the occupancy value of the first port cache.
[0072] In one possible design, the processing unit is specifically used to store the message in the first queue cache and send an indication signal when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the indication signal is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0073] In one possible design, the processing unit is specifically used to add a congestion flag in the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and store the message after the congestion flag is added in the first queue cache, wherein the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to a first upper limit value of the first queue cache, store the message in the first queue cache.
[0074] In one possible design, the processing unit is specifically used to store the message in the first queue cache and send an indication signal when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the indication signal is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0075] In one possible design, the processing unit is further used to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, the first upper limit value being greater than the second upper limit value;
[0076] The processing unit is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache; or store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than the second upper limit value of the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select to discard the message or store the message in the first queue cache according to a probability value.
[0077] In one possible design, the processing unit is further used to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, the first upper limit value being greater than the second upper limit value;
[0078] The processing unit is specifically used to add a congestion mark in the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, and store the message after the congestion mark is added in the first queue cache, wherein the congestion mark is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than the second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select according to a probability value to store the message in the first queue cache or add the congestion mark in the message, and store the message after the congestion mark is added in the first queue cache.
[0079] In a fourth aspect, an embodiment of the present application provides a first device, including:
[0080] A receiving module, used for receiving a message from a second device;
[0081] A determination module, used to determine a first queue buffer for storing messages;
[0082] a determination module, configured to determine a first upper limit value of a first queue buffer according to an available value of a first port buffer and an available value of a global buffer, wherein the global buffer includes at least one port buffer, the first port buffer is one of the at least one port buffer, the first port buffer includes at least one queue buffer, and the first queue buffer is one of the at least one queue buffer;
[0083] The message is processed according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message.
[0084] In one possible design, a determination module is specifically used to determine a first upper limit value of a first queue cache based on a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of an available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of an available value of the global cache and a second coefficient.
[0085] In one possible design, the determination module is specifically used to determine a first upper limit value of the first queue cache based on a port sharing upper limit value, a global sharing upper limit value, and a preset lower limit value of the first queue cache.
[0086] In one possible design, the determination module is specifically used to determine the available value of the global cache based on the upper limit value of the global cache and the occupancy value of the global cache; determine the upper limit value of the first port cache based on the third coefficient and the available value of the global cache; determine the available value of the first port cache based on the upper limit value of the first port cache and the occupancy value of the first port cache.
[0087] In one possible design, the processing module is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0088] In one possible design, the processing module is specifically used to add a congestion flag in the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and store the message after the congestion flag is added in the first queue cache, wherein the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to a first upper limit value of the first queue cache, store the message in the first queue cache.
[0089] In one possible design, the processing module is specifically used to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and send a back pressure signal to the second device, the back pressure signal being used to instruct the second device to stop sending messages or to stop sending messages after sending at least one message whose total size is a certain value; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0090] In one possible design, the determination module is specifically used to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, and the first upper limit value is greater than the second upper limit value;
[0091] The processing module is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than the second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select to discard the message or store the message in the first queue cache according to a probability value.
[0092] In one possible design, the determination module is specifically used to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, and the first upper limit value is greater than the second upper limit value;
[0093] The processing module is specifically used to add a congestion mark in the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, and store the message after the congestion mark is added in the first queue cache, wherein the congestion mark is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than the second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select according to a probability value to store the message in the first queue cache or add the congestion mark in the message, and store the message after the congestion mark is added in the first queue cache.
[0094] In a fifth aspect, an embodiment of the present application provides a first device, comprising: a memory and a processor, the memory being used to store program instructions, and the processor being used to call the program instructions in the memory to execute the communication method of the first aspect.
[0095] In a sixth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon; when the computer program is executed, it implements any communication method of the embodiment of the present application in the first aspect.
[0096] The message processing method and apparatus, communication equipment, and switching circuit provided in the embodiments of the present application determine, by a first device, a first queue cache for storing the message according to a message sent by a second device, and then determine a first upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, and then process the message according to the first upper limit value of the first queue cache, the occupancy value of the first queue cache, and the size of the message. Compared with the prior art which requires comparing the occupancy values of the caches at each level with the sizes of their respective fixed discard waterlines, which easily leads to the problem of indiscriminate discarding of messages, in the embodiment of the present application, the upper limit value of the lowest level cache not only fully considers the impact of the current availability of caches at other levels except the lowest level cache on it, but can also be adaptively adjusted according to the available values of caches at other levels in the current state, always keeping dynamic changes rather than being fixed, so that the first device can dynamically determine the processing method of the message, that is, only the messages input into the cache at the level with high cache occupancy will be discarded, and the messages input into the cache at the level with low cache occupancy will not be discarded, and the low-priority cache will preempt the shared cache too much, thereby avoiding the problem that the first device will indiscriminately discard the messages to be input into the non-congested low-level cache and the congested low-level cache due to the existing high-level cache management method, and indiscriminately discard the messages to be input into the high-priority cache and the low-priority cache, thereby realizing differential discarding of messages and solving the problem of failure of the bandwidth allocation function due to indiscriminate discarding of messages. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] Figure 1 A schematic diagram of a communication system provided in one embodiment of the present application;
[0098] Figure 2 A flowchart of a message processing method provided in one embodiment of the present application;
[0099] Figure 3 A schematic diagram of two-level hierarchical waterline management provided in one embodiment of the present application;
[0100] Figure 4 A flowchart of a message processing method provided in one embodiment of the present application;
[0101] Figure 5 A schematic diagram of the structure of a communication device provided in one embodiment of the present application;
[0102] Figure 6 A schematic diagram of the structure of a switching circuit provided in an embodiment of the present application;
[0103] Figure 7 A schematic diagram of the structure of a first device provided in an embodiment of the present application;
[0104] Figure 8 A schematic diagram of the hardware structure of a first device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0105] Figure 1 A schematic diagram of a communication system provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the communication system includes a first device and a second device. When the first device receives a message sent by the second device, it can determine whether to discard or store the message according to the specific situation of its own cache. Figure 1 As shown, the communication system may further include a third device. After storing the received message, the first device may send the received message to the third device.
[0106] The first device mentioned in the embodiment of the present application may be any physical device or virtual device having a message processing function, such as a switch or a router, etc. The second device mentioned in the embodiment of the present application may be any physical device or virtual device having a message sending function, and the third device mentioned in the embodiment of the present application may be any physical device or virtual device having a message receiving function.
[0107] The first device may be a switch or a router. For example, the first device may include a port module, an ingress packet processing (Ingress PP) module, an egress packet processing (Egress PP) module, an active queue management (AQM) module, a scheduler, a queue management module, and a packet buffer (PB), wherein the queue management module includes an enqueue (ENQ) module and a dequeue (DEQ) module.
[0108] Specifically, the message sent by the second device can enter the Ingress PP module through the port module. After the Ingress PP module performs ingress message processing on the message (such as searching the forwarding table, etc.), it adds egress information to the message. The egress information includes, for example, information such as the identifier of the queue cache. The Ingress PP module then sends the message to the AQM module. The AQM module outputs the message to the ENQ module for enqueuing. The ENQ module reports the information to the scheduler and stores the message in the PB. Subsequently, the scheduler can notify the DEQ module to take out the message from the PB and send it to the Egress PP module. After the EgressPP module performs egress message processing on the message (such as encapsulation or decapsulation, etc.), it sends the message to the third device through the port module.
[0109] The first device may include a switching chip, such as a switch buffer (SWB) chip or a queue manager (TM) chip, etc. The above AQM module, scheduler, queue management module and data packet buffer may be included in the switching chip.
[0110] The data packet cache on the first device can be used as a shared cache. Further, in order to make full use of the shared cache, the first device usually manages the shared cache in a hierarchical manner from multiple levels, thereby improving the ability to absorb sudden increase messages when non-congested, and achieving the purpose of allocating the cache as fairly as possible when congested. Among them, the embodiment of the present application does not limit the number of hierarchical caches. For example, the multi-level cache may include queue cache, port cache and global cache, or queue cache, queue group cache and port cache, or queue cache, port cache, port group cache and global cache, or port cache and global cache, or port cache, port group cache and global cache. In the above-mentioned caches at each level, the order of levels from low to high is queue cache, queue group cache, port cache, port group cache and global cache. For example, when the first device includes queue cache, port cache and global cache, all or part of the data packet cache is used as a global cache, all or part of the global cache includes one or more port caches, and all or part of each port cache includes one or more queue caches. Therefore, after the first device stores the received message in the queue buffer, the message occupies a part of the queue buffer, a part of the port buffer where the queue buffer is located, and a part of the global buffer where the port buffer is located.
[0111] In a specific implementation method of hierarchical management of a shared cache, when a first device performs hierarchical watermark management on a shared cache, the first device compares the occupancy value of each level of cache and the discard watermark of each level of cache. The discard watermark is a threshold. When the occupancy value of any level of cache exceeds the discard watermark of the level of cache, the first device will discard the received message. When the occupancy values of all levels of cache do not exceed the discard watermark, the first device will store the received message. Thus, when the occupancy value of a higher level cache exceeds the discard watermark of the level of cache, even if the occupancy value of a lower level cache does not exceed the discard watermark of the lower level cache, the first device will still discard the message to be input into the lower level cache, resulting in indiscriminate discarding of the message.
[0112] The embodiments of the present application provide a message processing method and apparatus, a communication device, and a switching circuit, which can achieve differential discarding and solve the problem of indiscriminate discarding of messages due to improper management of shared cache in the prior art. Figure 2 , taking the first device as the execution subject, the various levels of cache in the first device include, from low to high, queue cache, port cache and global cache as an example, the specific implementation process of the message processing method of the embodiment of the present application is described in detail.
[0113] Figure 2 A flowchart of a message processing method provided in an embodiment of the present application, such as Figure 2 As shown, the message processing method of the embodiment of the present application may include:
[0114] S201. A first device receives a message from a second device.
[0115] S202: The first device determines a first queue buffer for storing messages.
[0116] In an embodiment of the present application, when the first device receives a message sent by the second device, it will not immediately store the message. Since the lowest level cache among the various levels of cache of the first device is a queue cache, the first device can determine the first queue cache that stores the message based on the message. After receiving the message sent by the second device, the first device can determine the queue cache corresponding to the message based on the destination address, priority or other information of the message, so as to store messages with different destination addresses, priorities or other information in different queue caches. The first device can add an information identifier to the message for identifying the queue cache corresponding to the message. The information for identifying the queue cache may include a queue identifier, and then the messages stored in the same queue cache have the same queue identifier. The information for identifying the queue cache may also include a priority identifier, and then the messages stored in the same queue cache have the same priority identifier, wherein the messages with the same priority identifier belong to the same priority group.
[0117] S203. The first device determines a first upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, wherein the global cache includes at least one port cache, the first port cache is one of the at least one port cache, the first port cache includes at least one queue cache, and the first queue cache is one of the at least one queue cache.
[0118] The sum of the sizes of all messages included in a cache at any level is the occupancy value of the cache, the maximum sum of the sizes of messages that can be stored in the cache is the upper limit value of the cache, and the upper limit value of the cache minus the occupancy value of the cache is the available value of the cache. The above cache is, for example, a port cache, a queue cache or a global cache.
[0119] Furthermore, the first device can obtain the available value of the first port cache and the available value of the global cache in the current state, and then determine the first upper limit value of the first queue cache based on these two available values, and when at least one of the available value of the first port cache and the available value of the global cache changes, the first upper limit value of the first queue cache will also change accordingly.
[0120] The embodiment of the present application does not limit the specific structure of the global cache and the first port cache. The global cache may include only the first port cache, or the global cache may include multiple port caches including the first port cache. The first port cache may include only the first queue cache, or the first port cache may include multiple queue caches including the first queue cache.
[0121] S204: The first device processes the message according to the first upper limit value of the first queue buffer, the occupancy value of the first queue buffer, and the size of the message.
[0122] In the embodiment of the present application, the first device can also obtain the occupancy value of the first queue cache in the current state and calculate the size of the message, wherein the size of the message is the memory size occupied by the message data, and the unit of measurement of the message size can be cell or number of bytes. Since the first upper limit value of the first queue cache takes into account the impact of the current usage of the first port cache and the global cache on it, the first device can directly determine the specific method of processing the message according to the first upper limit value of the first queue cache, the occupancy value of the first queue cache and the size of the message, without considering whether the occupancy value of the global cache exceeds its fixed discard waterline and whether the occupancy value of the first port cache exceeds its fixed discard waterline. In addition, since the first upper limit value of the first queue cache will change dynamically with the change of the available value of the first port cache and the available value of the global cache, the first upper limit value will be limited by the available value of the first port cache and the available value of the global cache. When the available values of the first port cache and the global cache are reduced to a certain value, the entry of messages into the first queue cache will be restricted, thereby preventing the first port cache and the global cache from being over-occupied due to a large number of messages entering the first queue cache. This helps to ensure that other queue caches have opportunities to store messages, and helps to ensure that messages input into high-priority layer caches and non-congested layer caches are not indiscriminately discarded, thereby achieving differentiated discard of messages.
[0123] It should be noted that whenever the first device receives a message sent by the second device, it can re-determine the first queue cache used to store the message, and re-obtain the available value of the first port cache, the available value of the global cache and the occupancy value of the first queue cache at this time, thereby obtaining the specific method of message processing based on the first upper limit value of the first queue cache, the occupancy value of the first queue cache and the size of the message.
[0124] In the embodiment of the present application, the upper limit value of the lowest level cache not only fully considers the impact of the current availability of other level caches except the lowest level cache on it, but can also be adaptively adjusted according to the available values of other level caches in the current state, and always maintains dynamic changes rather than being fixed, so that the first device can dynamically determine the processing method of the message, that is, only the messages input into the level cache with high cache occupancy will be discarded, and the messages input into the level cache with low cache occupancy will not be discarded. The low-priority cache preempts the shared cache too much, avoiding the problem of the existing high-level cache management method causing the first device to indiscriminately discard messages to be input into the non-congested low-level cache and the congested low-level cache, and indiscriminately discard messages to be input into the high-priority cache and the low-priority cache, thereby realizing differential discard of messages and solving the problem of bandwidth allocation function failure due to indiscriminate discard of messages.
[0125] For example, in the above Figure 2 On the basis of the illustrated embodiment, in a specific implementation method of S203, the first device determines a first upper limit value of the first queue cache based on the port sharing upper limit value and the global sharing upper limit value, the port sharing upper limit value is equal to the product of the available value of the first port cache and the first coefficient, and the global sharing upper limit value is equal to the product of the available value of the global cache and the second coefficient.
[0126] The first device can obtain the port sharing upper limit value through formula one.
[0127] QueueLimitPort i,j =γ i,j ×RemainPort i Formula 1;
[0128] Among them, QueueLimitPort i,j is the port sharing upper limit value used to calculate the upper limit value of the j-th queue buffer in the i-th port buffer in the global buffer, and the first coefficient γ i,j The possible range is, for example, 1 / 128 to 8, RemainPort i The available value cached for the i-th port.
[0129] In the embodiment of the present application, the subscript i indicates the i-th port buffer, and the subscript j indicates the j-th queue buffer. In the embodiment of the present application, it is assumed that the first port buffer is the i-th port buffer in the global buffer, and the first queue buffer is the j-th queue buffer in the i-th port buffer.
[0130] The first device can obtain the global sharing upper limit value through formula 2.
[0131] QueueLimitGlobal i,j =α i,j ×RemainGlobal Formula 2;
[0132] Among them, QueueLimitGlobal i,j is the global shared upper limit value used to calculate the upper limit value of the j-th queue buffer in the i-th port buffer in the global buffer, and the second coefficient α i,j The possible range of is, for example, 1 / 128 to 8, and RemainGlobal is an available value for the global cache.
[0133] Further, the first device may determine the first upper limit value of the first queue cache according to the port sharing upper limit value and the global sharing upper limit value. Optionally, in order to avoid the first upper limit value of the first queue cache being too small, resulting in the first device being unable to retrieve the message from the first queue cache, the first device may set a preset lower limit value of the first queue cache, so that the first device determines the first upper limit value of the first queue cache according to the port sharing upper limit value, the global sharing upper limit value and the preset lower limit value of the first queue cache.
[0134] In an embodiment of the present application, the first device can use formula three to take the minimum value between the port sharing upper limit value and the global sharing upper limit value, then take the maximum value between the minimum value and the preset lower limit value of the first queue cache, and then use the maximum value as the first upper limit value of the first queue cache, so as to avoid the first device being unable to retrieve the message from the first queue cache.
[0135] QueueLimit i,j =max(min(QueueLimitPort i,j ,QueueLimitGlobal i,j ),QueueMin i,j )Formula 3;
[0136] Among them, QueueLimit i,j QueueLimitPort is the upper limit of the jth queue cache in the i-th port cache in the global cache, which is also the first upper limit of the first queue cache. i,j QueueLimitGlobal is the upper limit of port sharing. i,j is the global shared upper limit, QueueMin i,j The preset lower limit of the first queue buffer.
[0137] On the basis of the above embodiment, since the order of the levels of the queue cache, the port cache and the global cache is from low to high, in addition to the available value of the queue cache being affected by the available value of the global cache and the available value of the port cache, the available value of the port cache can also be affected by the available value of the global cache. Therefore, in a specific implementation method for determining the available value of the first port cache, optionally, the first device can determine the available value of the global cache according to the upper limit value of the global cache and the occupancy value of the global cache through formula 4. The first device determines the upper limit value of the first port cache according to the third coefficient and the available value of the global cache. The first device determines the available value of the first port cache according to the upper limit value of the first port cache and the occupancy value of the first port cache.
[0138]
[0139] Among them, RemainGlobal is the available value of the global cache, GlobalLimit is the upper limit of the global cache, GlobalCnt is the occupancy value of the global cache, PortLimit i is the upper limit of the i-th port cache, and the third coefficient β i The possible range is, for example, 1 / 128 to 8, RemainPort i PortCnt is the available value of the i-th port cache. i is the occupancy value of the i-th port buffer.
[0140] In the above Figure 2 On the basis of the illustrated embodiment, when the first device performs hierarchical waterline management on the shared cache, in a specific implementation of S204, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, the first device discards the message; or,
[0141] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer.
[0142] In an embodiment of the present application, the first device does not need to consider whether the occupancy value of the first port cache exceeds the discard watermark of the first port cache and whether the occupancy value of the global cache exceeds the discard watermark of the global cache. The first upper limit value of the first queue cache can be used as a basis for determining whether to discard or store the message.
[0143] Specifically, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, the first device discards the message. When the sum of the occupancy value of the first queue cache and the size of the message is less than the first upper limit value of the first queue cache, the first device stores the message in the first queue cache. When the sum of the occupancy value of the first queue cache and the size of the message is equal to the first upper limit value of the first queue cache, the first device may discard the message or store the message in the first queue cache, which is not limited in the embodiments of the present application.
[0144] Furthermore, once the occupancy value of the high-level cache is about to reach its upper limit, the upper limit of the lowest-level cache can be dynamically lowered, and the lowest-level cache that exceeds the upper limit stops storing messages, while the lowest-level cache of the same or different priority that does not reach the upper limit can still store messages, and these stored messages are equivalent to being stored in the high-level cache. This prevents the messages stored in a certain low-level cache from occupying too much of the high-level cache, thereby causing the first device to indiscriminately discard messages in the non-congested cache and the high-priority cache. The above uses the first coefficient and the second coefficient for the j-th queue cache in the i-th port cache, and other coefficients with different values can be used for other queue caches. This allows the restriction relationship between the high-level cache and the low-level cache to be flexibly set, as well as the different priorities between the same-level caches to be flexibly set. For example, a higher-priority cache can be set with a larger coefficient value than a low-priority cache so that the high-priority cache has a larger upper limit value than the low-priority cache. For ease of explanation, the following uses Figure 3 The above process is illustrated by taking as an example.
[0145] Figure 3 A schematic diagram of a two-level hierarchical waterline management provided in an embodiment of the present application. Figure 3 As shown, the first device includes a port cache 1, and the port cache 1 includes a queue cache 1 and a queue cache 2. The port cache 1 is a high-level cache, and the queue cache 1 and the queue cache 2 are low-level caches. Figure 3 (a) corresponds to the specific implementation process of the prior art, Figure 3 (b) corresponds to the specific implementation process of the embodiment of the present application, Figure 3 The drop watermark of port buffer 1 is the upper limit of port buffer 1, the drop watermark of queue buffer 1 is the upper limit of queue buffer 1, and the drop watermark of queue buffer 2 is the upper limit of queue buffer 2.
[0146] like Figure 3 As shown in (a) in FIG. 1 , when the occupancy value of port buffer 1 exceeds its discard waterline, since port buffer 1 is a high-level buffer, the first device will directly discard the packets input to queue buffer 1 and queue buffer 2. Figure 3 As shown in (b) in FIG. 1 , when the occupancy value of port buffer 1 is about to reach its discard waterline, the first device will reduce the first upper limit values of queue buffer 1 and queue buffer 2. At this time, since the occupancy value of queue buffer 1 exceeds the current first upper limit value of queue buffer 1, the first device will discard the message input to queue buffer 1. Since the occupancy value of queue 2 buffer does not exceed the current first upper limit value of queue 2, the first device will store the message input to queue 2.
[0147] Furthermore, the first device implements adaptive hierarchical waterline management for the shared cache, and only discards messages in the hierarchical cache with high occupancy values, but does not discard messages in the hierarchical cache with low occupancy values. This avoids the problem of the existing high-level cache management method causing the first device to indiscriminately discard messages to be input into a non-congested low-level cache and a congested low-level cache, and indiscriminately discard messages to be input into a high-priority cache and a low-priority cache. This implements differentiated discard of multiple-level caches, protects the call of the high-priority level cache, and solves the discard phenomenon of the high-priority level cache caused by indifferent discard.
[0148] In the above Figure 2 On the basis of the illustrated embodiment, in another specific implementation of S204, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, the first device adds a congestion flag to the message, and stores the message with the added congestion flag in the first queue cache, and the congestion flag is used to indicate that the first queue cache is in a congested state; or,
[0149] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to the first upper limit of the first queue buffer. The congestion indicator is, for example, an explicit congestion notification (ECN) field in the Internet Protocol (IP) header of the message.
[0150] In an embodiment of the present application, based on the adaptive hierarchical waterline management of the shared cache performed by the first device, the first device can use the first upper limit value of the first queue cache as a basis for determining whether to add a congestion flag, thereby avoiding the phenomenon that the low-priority cache occupies too much shared cache, causing the first device to still mark the message as congestion when the message is input into the high-priority cache and the non-congested cache.
[0151] The congestion indicator is used to indicate that the current occupancy value of the first queue cache has reached the first upper limit value of the first queue cache, and the first queue cache is currently in a congested state. When the sum of the occupancy value of the first queue cache and the size of the message is equal to the first upper limit value of the first queue cache, the first device can add a congestion indicator to the message, and store the message with the added congestion indicator in the first queue cache, or store the message in the first queue cache, which is not limited in the embodiments of the present application.
[0152] Furthermore, combined with Figure 1When the communication system includes a third device, the first device can send a message with a congestion flag added to the third device. When the third device receives the message with the congestion flag added, it can send a message containing the congestion flag to the second device via the first device. The congestion flag is, for example, the ECN echo (ECN-Echo, ECE) field in the Transmission Control Protocol (TCP) header of the message. The second device can know that the first queue cache is in a congested state based on the congestion flag, so that the second device can reduce the rate of sending messages to the first device, realizing the differential marking of the first device on the message, so that the messages output by the high priority level cache and the non-congestion level cache in the first device will not trigger the speed reduction of the message source (such as the second device), avoiding the speed reduction problem caused by the indifferent marking of the first device.
[0153] In the above Figure 2 On the basis of the illustrated embodiment, when the first device performs hierarchical waterline management on the shared cache, in another specific implementation of S204, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, the first device stores the message in the first queue cache and sends a back pressure signal to the second device, where the back pressure signal is used to instruct the second device to stop sending the message or stop sending the message after sending at least one message whose total size is a certain value; or,
[0154] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer.
[0155] The back pressure signal may instruct the second device to stop sending messages using a priority-based flow control mechanism. Alternatively, the back pressure signal may include a value for instructing the second device to stop sending messages after sending at least one message having a total size of the value to the first device using a credit-based flow control mechanism.
[0156] In an embodiment of the present application, based on the adaptive hierarchical waterline management of the shared cache by the first device, the first device can use the first upper limit value of the first queue cache as a basis for determining whether to send a back pressure signal to the second sending device, thereby realizing differential back pressure indication for the message, and avoiding the phenomenon that low-priority cache and / or low-level cache occupy too much shared cache, causing the first device to still send a back pressure signal to the second device when the message is input into a non-congested cache or a high-priority cache.
[0157] The back pressure signal is used to inform the second device that the current occupancy value of the first queue cache has exceeded the first upper limit value of the first queue cache, and the first queue cache is currently in a congested state. When the sum of the occupancy value of the first queue cache and the size of the message is equal to the first upper limit value of the first queue cache, the first device can store the message in the first queue cache and send a back pressure signal to the second device, or store the message in the first queue cache, which is not limited in the embodiments of the present application.
[0158] It should be noted that the first device can place the two processes of receiving and processing messages in different modules. The first device can receive the message sent by the second device through its port module, and the AQM module in the first device processes the message. When the AQM module in the first device determines that the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, the AQM module in the first device can send a trigger signal to the port module in the first device, and the port module in the first device can generate a back pressure signal according to the trigger signal, and then send the back pressure signal to the second device.
[0159] In addition, the first device can also set the back pressure cancellation value of the first queue cache by the difference between the first upper limit value of the first queue cache and the preset offset value of the first queue cache. In this way, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the back pressure cancellation value of the first queue cache, the AQM module in the first device can send a trigger signal to the port module in the first device, so that the port module in the first device can generate a back pressure cancellation signal according to the trigger signal and send it to the second device, thereby instructing the second device to resume sending messages.
[0160] exist Figure 2 On the basis of the illustrated embodiment, the first device may perform hierarchical weighted random early detection (WRED) management on the shared cache. The first device may determine the first upper limit value and the second upper limit value of the first queue cache according to the available value of the first port cache and the available value of the global cache, the second upper limit value being less than the first upper limit value, and then the first device selects a processing method for the message according to the WRED algorithm, the first upper limit value and the second upper limit value. Among them, the first device may also adopt the RED algorithm, and the specific implementation process is similar to that of the WRED algorithm, and the specific implementation process of the WRED algorithm may be referred to, which will not be described in detail here.
[0161] Next, combine Figure 4 , the specific implementation process of the message processing method is described in detail. Figure 4 A flowchart of a message processing method provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the message processing method of the embodiment of the present application may include:
[0162] S401: A first device receives a message from a second device.
[0163] S402: The first device determines a first queue buffer for storing messages.
[0164] The specific implementation process of S401-S402 can be found in Figure 2 The relevant description of S201-S202 in the illustrated embodiment will not be repeated here.
[0165] S403. The first device determines a first upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, the global cache includes at least one port cache, the first port cache is one of the at least one port cache, the first port cache includes at least one queue cache, and the first queue cache is one of the at least one queue cache.
[0166] S404: The first device determines a second upper limit value of the first queue cache according to the available value of the first port cache and the available value of the global cache, and the first upper limit value is greater than the second upper limit value.
[0167] In the embodiment of the present application, when the first device performs hierarchical WRED management on the shared cache, two thresholds for the WRED algorithm, namely, the WRED maximum value and the WRED minimum value, are calculated. The first device can determine the first upper limit value of the first queue cache and the second upper limit value of the first queue cache respectively according to the available value of the first port cache and the available value of the global cache, and then use the first upper limit value of the first queue cache as the WRED maximum value and the second upper limit value of the first queue cache as the WRED minimum value.
[0168] Specifically, as described in the previous embodiment, the first device can calculate the first upper limit value through formula one, formula two, formula three and formula four. This embodiment uses the above method to calculate the first upper limit value to obtain the maximum available value of the first queue cache. The first device can obtain the first upper limit value of the first queue cache in the hierarchical WRED management through formula five according to the fourth coefficient, the maximum available value of the first queue cache and the preset lower limit value of the first queue cache. The first device can obtain the second upper limit value of the first queue cache in the hierarchical WRED management through formula six according to the fifth coefficient, the maximum available value of the first queue cache and the preset lower limit value of the first queue cache.
[0169] MIN_TH i,j =max(MIN_RATIO*QueueLimit i,j ,QueueMin i,j ) Formula 5;
[0170] Among them, MIN_TH i,j is the second upper limit of the jth queue buffer in the i-th port buffer in the global buffer in the hierarchical WRED management. The fourth coefficient MIN_RATIO is, for example, 10%. QueueLimit i,j is the second upper limit of the jth queue cache in the i-th port cache in the global cache in the hierarchical waterline management, QueueMin i,j It is the preset lower limit of the j-th queue buffer in the i-th port buffer in the global buffer in the hierarchical waterline management.
[0171] MAX_TH i,j =max(MAX_RATIO*QueueLimit i,j ,QueueMin i,j ) Formula 6;
[0172] Among them, MAX_TH i,j is the first upper limit of the jth queue buffer in the i-th port buffer in the global buffer in the hierarchical WRED management, and the fifth coefficient MAX_RATIO is greater than MIN_TH i,j , for example, 50%, 70% or 100%.
[0173] S405: The first device processes the message according to the first upper limit value of the first queue buffer, the second upper limit value of the first queue buffer, the occupancy value of the first queue buffer, and the size of the message.
[0174] The first upper limit value and the second upper limit value of the first queue cache obtained by S404 fully consider the influence of the current usage of the first port cache and the global cache on it. Therefore, the first device can determine the specific way to process the message according to the first upper limit value of the first queue cache, the second upper limit value of the first queue cache, the occupancy value of the first queue cache and the size of the message, without considering the discard probability of the global cache and the first port cache. The first upper limit value of the first queue cache and the second upper limit value of the first queue cache will change dynamically with the change of the available value of the first port cache and the available value of the global cache. Therefore, the first device will only discard more messages input into the queue cache with high occupancy value, and less messages input into the queue cache with low occupancy value, which can avoid the low priority cache from occupying too much shared cache, so that the messages input into the high priority level and the non-congested level cache are discarded indiscriminately, and realize the differential discard of the message.
[0175] In the above Figure 4On the basis of the illustrated embodiment, when the first device performs hierarchical WRED management on the shared cache, in a specific implementation of S405, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, the first device discards the message; or,
[0176] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than the second upper limit value of the first queue buffer; or,
[0177] When the sum of the occupancy value of the first queue buffer and the size of the message is greater than the second upper limit value of the first queue buffer and less than the first upper limit value of the first queue buffer, the first device selects to discard the message or store the message in the first queue buffer according to a probability value. For example, if the probability value is 70%, if the first device processes 1000 messages, there are about 700 discard operations to discard the message, and about 300 storage operations to store the message in the first queue buffer.
[0178] The first device can calculate the probability value based on the WRED algorithm according to the first upper limit value of the first queue cache, the second upper limit value of the first queue cache, the occupancy value of the first queue cache, and the sum of the size of the message. When the probability value is between the first upper limit value and the second upper limit value, the closer the sum of the occupancy value of the first queue cache and the size of the message is to the first upper limit value, the larger the probability value is, the greater the probability that the message is discarded, that is, the smaller the probability that the message is stored. When the probability value is between the first upper limit value and the second upper limit value, the closer the sum of the occupancy value of the first queue cache and the size of the message is to the second upper limit value, the smaller the probability value is, the greater the probability that the message is stored, that is, the smaller the probability that the message is discarded.
[0179] In the above Figure 4 On the basis of the illustrated embodiment, in another specific implementation of S405, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the first upper limit value of the first queue cache, the first device adds a congestion flag to the message, and stores the message with the added congestion flag in the first queue cache, and the congestion flag is used to indicate that the first queue cache is in a congested state; or,
[0180] The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than the second upper limit value of the first queue buffer; or,
[0181] When the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, the first device selects to store the message in the first queue cache or to add a congestion mark in the message and store the message with the added congestion mark in the first queue cache according to a probability value. For example, if the probability value is 70%, if the first device processes 1000 messages, there are about 700 operations of selecting to store the message with the added congestion mark in the first queue cache, and about 300 operations of selecting to directly store the message without the added congestion mark in the first queue cache. The calculation of the probability value can refer to the previous specific implementation of S1005 mentioned above. When the probability value is between the first upper limit value and the second upper limit value, the closer the sum of the occupancy value of the first queue cache and the size of the message is to the first upper limit value, the larger the probability value is, the greater the probability of the message adding the congestion mark is, and the closer the sum of the occupancy value of the first queue cache and the size of the message is to the second upper limit value, the smaller the probability value is, the smaller the probability of the message adding the congestion mark is.
[0182] Further, referring to the aforementioned description that the first device sends a message with a congestion flag to the third device, the second device can subsequently reduce the rate of sending messages to the first device, thereby realizing differential marking of messages by the first device.
[0183] Exemplarily, an embodiment of the present application further provides a communication device, Figure 5 A schematic diagram of the structure of a communication device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the communication device 500 can be any physical device or virtual device with a message processing function, such as a switch, a router, etc., for implementing the operation corresponding to the first device in any of the above method embodiments. The communication device 500 in the embodiment of the present application may include: an interface unit 501, a processing unit 502 and a memory 503. The processing unit 502 can be an integrated circuit, a field-programmable gate array (FPGA) or a chip, such as an AQM module. The processing unit 502 and the memory 503 can be included in a switching circuit, such as a SWB chip or a TM chip. The interface unit 501 is, for example, a port module, which can communicate with other devices through an optical port, an electrical port or a combination thereof. The memory 503 can be a volatile memory, such as a RAM, or a non-volatile memory, such as a ROM.
[0184] The interface unit 501 is used to receive a message from another communication device.
[0185] The processing unit 502 is configured to determine a first queue buffer for storing the message.
[0186] The processing unit 502 is further configured to determine a first upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache.
[0187] The memory 503 includes a global cache, the global cache includes at least one port cache, the first port cache is one of the at least one port cache, the first port cache includes at least one queue cache, the first queue cache is one of the at least one queue cache. The shared cache described in the embodiment of the present application may be included in the memory 503.
[0188] The processing unit 502 is further configured to process the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message.
[0189] In some embodiments, the processing unit 502 is used to determine a first upper limit value of the first queue cache based on a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of the available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of the available value of the global cache and a second coefficient.
[0190] In some embodiments, the processing unit 502 is configured to determine a first upper limit value of the first queue buffer according to the port sharing upper limit value, the global sharing upper limit value and a preset lower limit value of the first queue buffer.
[0191] In some embodiments, the processing unit 502 is specifically used to determine the available value of the global cache based on the upper limit value of the global cache and the occupancy value of the global cache; determine the upper limit value of the first port cache based on the third coefficient and the available value of the global cache; determine the available value of the first port cache based on the upper limit value of the first port cache and the occupancy value of the first port cache.
[0192] In some embodiments, the processing unit 502 is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0193] In some embodiments, the processing unit 502 is specifically used to add a congestion flag to the message and store the message with the added congestion flag in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to a first upper limit value of the first queue cache, store the message in the first queue cache.
[0194] In some embodiments, the processing unit 502 is specifically used to store the message in the first queue cache and send an indication signal to the interface unit when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0195] In some embodiments, the interface unit 502 is also used to send a back pressure signal to the other communication device when receiving the indication signal, and the back pressure signal is used to instruct the other communication device to stop sending messages or stop sending messages after sending at least one message whose total size is a certain value.
[0196] In some embodiments, the processing unit 502 is further configured to determine a second upper limit value of the first queue cache according to the available value of the first port cache and the available value of the global cache, wherein the first upper limit value is greater than the second upper limit value;
[0197] The processing unit 502 is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than a second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select to discard the message or to store the message in the first queue cache according to a probability value.
[0198] In some embodiments, the processing unit 502 is further configured to determine a second upper limit value of the first queue cache according to the available value of the first port cache and the available value of the global cache, wherein the first upper limit value is greater than the second upper limit value;
[0199] The processing unit 502 is specifically used to add a congestion flag to the message and store the message with the congestion flag added in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than a second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select according to a probability value to store the message in the first queue cache or to add the congestion flag to the message and store the message with the congestion flag added in the first queue cache.
[0200] The communication device of the embodiment of the present application can be used to execute the technical solution of the first device in the above-mentioned method embodiments. Its implementation principle and technical effect are similar and will not be repeated here.
[0201] Exemplarily, an embodiment of the present application further provides a switching circuit, Figure 6 A schematic diagram of a switching circuit according to an embodiment of the present application is shown in FIG. Figure 6 As shown, the switching circuit 600 is an integrated circuit or chip with storage function and message processing function, such as a switching chip such as a SWB chip or a TM chip, which is used to implement the operation corresponding to the first device in any of the above method embodiments. The switching circuit 600 can be Figure 5 The switching circuit in the communication device of the illustrated embodiment includes a processing unit 601 and a memory 602 .
[0202] The processing unit 601 is used to receive a message from another device.
[0203] The processing unit 601 is further configured to determine a first queue buffer for storing the message.
[0204] The processing unit 601 is further configured to determine a first upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache.
[0205] The memory 602 includes: the global cache, the global cache includes at least one port cache, the first port cache is one of the at least one port cache, the first port cache includes at least one queue cache, and the first queue cache is one of the at least one queue cache.
[0206] The processing unit 601 is further configured to process the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message.
[0207] In some embodiments, the processing unit 601 is used to determine a first upper limit value of the first queue cache based on a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of the available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of the available value of the global cache and a second coefficient.
[0208] In some embodiments, the processing unit 601 is used to determine a first upper limit value of the first queue cache according to the port sharing upper limit value, the global sharing upper limit value and a preset lower limit value of the first queue cache.
[0209] In some embodiments, the processing unit 601 is used to determine the available value of the global cache based on the upper limit value of the global cache and the occupancy value of the global cache; determine the upper limit value of the first port cache based on the third coefficient and the available value of the global cache; determine the available value of the first port cache based on the upper limit value of the first port cache and the occupancy value of the first port cache.
[0210] In some embodiments, the processing unit 601 is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0211] In some embodiments, the processing unit 601 is specifically used to add a congestion flag to the message and store the message with the added congestion flag in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to a first upper limit value of the first queue cache, store the message in the first queue cache.
[0212] In some embodiments, the processing unit 601 is specifically configured to store the message in the first queue buffer and send an indication signal when the sum of the occupancy value of the first queue buffer and the size of the message is greater than a first upper limit value of the first queue buffer, wherein the indication signal is used to indicate that the first queue buffer is in a congested state; or, when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer, store the message in the first queue buffer. The indication signal may be sent to an interface unit, for example Figure 5 The interface unit 501 shown is used to trigger the interface unit to jump upward, that is, the other device sends a back pressure signal.
[0213] In some embodiments, the processing unit 601 is further configured to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, wherein the first upper limit value is greater than the second upper limit value;
[0214] The processing unit 601 is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than a second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select to discard the message or to store the message in the first queue cache according to a probability value.
[0215] In some embodiments, the processing unit 601 is further configured to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, wherein the first upper limit value is greater than the second upper limit value;
[0216] The processing unit 601 is specifically configured to, when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, add a congestion flag to the message, and store the message with the added congestion flag in the first queue cache, wherein the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than a second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select, according to a probability value, to store the message in the first queue cache or to add the congestion flag to the message and store the message with the added congestion flag in the first queue cache.
[0217] The switching circuit of the embodiment of the present application can be used to execute the technical solution of the first device in the above-mentioned method embodiments. Its implementation principle and technical effect are similar and will not be repeated here.
[0218] Exemplarily, the present application embodiment further provides a first device, Figure 7 A schematic diagram of the structure of a first device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the first device 700 may be any physical device or virtual device having a message processing function, such as a switch, a router, etc., for implementing the operation corresponding to the first device in any of the above method embodiments. The first device 700 in the embodiment of the present application may include:
[0219] The receiving module 701 is used to receive a message from a second device;
[0220] A determination module 702, configured to determine a first queue buffer for storing the message;
[0221] The determining module 702 is used to determine a first upper limit value of the first queue buffer according to an available value of the first port buffer and an available value of the global buffer, the global buffer includes at least one port buffer, the first port buffer is one of the at least one port buffer, the first port buffer includes at least one queue buffer, and the first queue buffer is one of the at least one queue buffer;
[0222] The processing module 703 is used to process the message according to the first upper limit value of the first queue buffer, the occupancy value of the first queue buffer and the size of the message.
[0223] In some embodiments, the determination module 702 is specifically used to determine a first upper limit value of the first queue cache based on a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of the available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of the available value of the global cache and a second coefficient.
[0224] In some embodiments, the determination module 702 is specifically configured to determine a first upper limit value of the first queue cache according to the port sharing upper limit value, the global sharing upper limit value and a preset lower limit value of the first queue cache.
[0225] In some embodiments, the determination module 702 is specifically used to determine the available value of the global cache based on the upper limit value of the global cache and the occupancy value of the global cache; determine the upper limit value of the first port cache based on the third coefficient and the available value of the global cache; determine the available value of the first port cache based on the upper limit value of the first port cache and the occupancy value of the first port cache.
[0226] In some embodiments, the processing module 703 is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0227] In some embodiments, the processing module 703 is specifically used to add a congestion flag to the message and store the message with the added congestion flag in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to a first upper limit value of the first queue cache, store the message in the first queue cache.
[0228] In some embodiments, the processing module 703 is specifically used to store the message in the first queue cache and send a back pressure signal to the second device when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the back pressure signal is used to instruct the second device to stop sending messages or stop sending messages after sending at least one message whose total size is a certain value; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
[0229] In some embodiments, the determination module 702 is specifically configured to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, wherein the first upper limit value is greater than the second upper limit value;
[0230] The processing module 703 is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than a second upper limit value of the first queue cache; or to select to discard the message or to store the message in the first queue cache according to a probability value when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache.
[0231] In some embodiments, the determination module 702 is specifically configured to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, wherein the first upper limit value is greater than the second upper limit value;
[0232] The processing module 703 is specifically used to add a congestion flag to the message and store the message with the congestion flag added in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than a second upper limit value of the first queue cache, store the message in the first queue cache; or, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, select according to a probability value to store the message in the first queue cache or add the congestion flag to the message, and store the message with the congestion flag added in the first queue cache.
[0233] The first device of the embodiment of the present application can be used to execute the technical solutions in the above-mentioned method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.
[0234] Figure 8 A schematic diagram of the hardware structure of a first device provided in an embodiment of the present application is shown in FIG. Figure 8As shown, the first device 800 may be any physical device or virtual device having a message processing function, such as a switch, a router, etc., for implementing the operation corresponding to the first device in any of the above method embodiments. The first device 800 of the embodiment of the present application may include: a memory 801 and a processor 802. The memory 801 and the processor 802 may be connected via a bus 803.
[0235] Memory 801, used for storing program codes;
[0236] The processor 802 calls the program code, and when the program code is executed, it is used to execute the message processing method in any of the above embodiments. For details, please refer to the relevant description in the above method embodiments.
[0237] Optionally, the embodiment of the present application further includes a communication interface 804, which can be connected to the processor 802 through the bus 803. The processor 802 can control the communication interface 803 to implement the above-mentioned receiving and sending functions of the first device 800.
[0238] The first device of the embodiment of the present application can be used to execute the technical solutions in the above-mentioned method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.
[0239] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0240] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0241] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0242] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application.
[0243] It should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented by a hardware processor or implemented by a combination of hardware and software modules in the processor.
[0244] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0245] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0246] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using 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 application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may 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 may be transmitted from a 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.) mode to another website site, computer, server or data center. The computer-readable storage medium may 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 may 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 drive Solid State Disk (SSD)), etc.
Claims
1. A message processing method, characterized in that: include: The first device receives a message from the second device; The first device determines a first queue buffer for storing the message; The first device determines a first upper limit value of the first queue buffer according to an available value of the first port buffer and an available value of the global buffer, the global buffer includes at least one port buffer, the first port buffer is one of the at least one port buffer, the first port buffer includes at least one queue buffer, and the first queue buffer is one of the at least one queue buffer; The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message.
2. The method according to claim 1, characterized in that The first device determines a first upper limit value of the first queue buffer according to an available value of the first port buffer and an available value of the global buffer, including: The first device determines a first upper limit value of the first queue cache based on a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of an available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of an available value of the global cache and a second coefficient.
3. The method according to claim 2, characterized in that The first device determines a first upper limit value of the first queue buffer according to the port sharing upper limit value and the global sharing upper limit value, including: The first device determines a first upper limit value of the first queue buffer according to the port sharing upper limit value, the global sharing upper limit value, and a preset lower limit value of the first queue buffer.
4. The method according to claim 1, characterized in that: The method comprises: The first device determines the available value of the global cache according to the upper limit value of the global cache and the occupancy value of the global cache; The first device determines an upper limit value of the first port buffer according to a third coefficient and an available value of the global buffer; The first device determines an available value of the first port buffer according to an upper limit value of the first port buffer and an occupancy value of the first port buffer.
5. The method according to any one of claims 1 to 4, characterized in that: The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including: The first device discards the message when the sum of the occupancy value of the first queue buffer and the size of the message is greater than a first upper limit value of the first queue buffer; or, The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer.
6. The method according to any one of claims 1 to 4, characterized in that: The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including: When the sum of the occupancy value of the first queue buffer and the size of the message is greater than a first upper limit value of the first queue buffer, the first device adds a congestion flag to the message, and stores the message with the added congestion flag in the first queue buffer, wherein the congestion flag is used to indicate that the first queue buffer is in a congested state; or The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer.
7. The method according to any one of claims 1 to 4, characterized in that: The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including: When the sum of the occupancy value of the first queue buffer and the size of the message is greater than a first upper limit value of the first queue buffer, the first device stores the message in the first queue buffer and sends a back pressure signal to the second device, wherein the back pressure signal is used to instruct the second device to stop sending messages or stop sending messages after sending at least one message whose total size is a certain value; or The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than or equal to a first upper limit value of the first queue buffer.
8. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The first device determines a second upper limit value of the first queue buffer according to an available value of the first port buffer and an available value of the global buffer, wherein the first upper limit value is greater than the second upper limit value; The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including: The first device discards the message when the sum of the occupancy value of the first queue buffer and the size of the message is greater than a first upper limit value of the first queue buffer; or, The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than a second upper limit value of the first queue buffer; or, When the sum of the occupancy value of the first queue cache and the size of the message is greater than a second upper limit value of the first queue cache and less than a first upper limit value of the first queue cache, the first device selects to discard the message or store the message in the first queue cache according to a probability value.
9. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The first device determines a second upper limit value of the first queue buffer according to an available value of the first port buffer and an available value of the global buffer, wherein the first upper limit value is greater than the second upper limit value; The first device processes the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message, including: When the sum of the occupancy value of the first queue buffer and the size of the message is greater than a first upper limit value of the first queue buffer, the first device adds a congestion flag to the message, and stores the message with the added congestion flag in the first queue buffer, wherein the congestion flag is used to indicate that the first queue buffer is in a congested state; or The first device stores the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than a second upper limit value of the first queue buffer; or, When the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, the first device selects, according to a probability value, to store the message in the first queue cache or to add the congestion flag to the message and store the message after the congestion flag is added in the first queue cache.
10. A communication device, characterized in that: include: interface unit, processing unit and memory; Wherein, the interface unit is used to receive a message from another communication device; The processing unit is used to determine a first queue buffer for storing the message; The processing unit is further configured to determine a first upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache; The memory comprises: a global cache, the global cache comprises at least one port cache, the first port cache is one of the at least one port cache, the first port cache comprises at least one queue cache, the first queue cache is one of the at least one queue cache; The processing unit is further configured to process the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message.
11. The communication device according to claim 10, characterized in that The processing unit is used to determine a first upper limit value of the first queue cache according to a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of an available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of an available value of the global cache and a second coefficient.
12. The communication device according to claim 11, characterized in that The processing unit is used to determine a first upper limit value of the first queue buffer according to the port sharing upper limit value, the global sharing upper limit value and a preset lower limit value of the first queue buffer.
13. The communication device according to claim 10, characterized in that The processing unit is specifically used to determine the available value of the global cache according to the upper limit value of the global cache and the occupancy value of the global cache; determine the upper limit value of the first port cache according to the third coefficient and the available value of the global cache; determine the available value of the first port cache according to the upper limit value of the first port cache and the occupancy value of the first port cache.
14. The communication device according to any one of claims 10 to 13, characterized in that: The processing unit is specifically used to discard the message when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
15. The communication device according to any one of claims 10 to 13, characterized in that: The processing unit is specifically used to add a congestion flag to the message and store the message with the congestion flag added in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, and the congestion flag is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to a first upper limit value of the first queue cache, store the message in the first queue cache.
16. The communication device according to any one of claims 10 to 13, characterized in that: The processing unit is specifically used to store the message in the first queue cache and send an indication signal to the interface unit when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache; or to store the message in the first queue cache when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to the first upper limit value of the first queue cache.
17. The communication device according to claim 16, characterized in that The interface unit is further used to send a back pressure signal to the other communication device when receiving the indication signal, wherein the back pressure signal is used to instruct the other communication device to stop sending messages or to stop sending messages after sending at least one message whose total size is a certain value.
18. The communication device according to any one of claims 10 to 13, characterized in that: The processing unit is further configured to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, wherein the first upper limit value is greater than the second upper limit value; The processing unit is specifically configured to discard the message when the sum of the occupancy value of the first queue buffer and the size of the message is greater than a first upper limit value of the first queue buffer; or store the message in the first queue buffer when the sum of the occupancy value of the first queue buffer and the size of the message is less than a second upper limit value of the first queue buffer; Alternatively, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, the message is discarded or stored in the first queue cache according to a probability value.
19. The communication device according to any one of claims 10 to 13, characterized in that: The processing unit is further configured to determine a second upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache, wherein the first upper limit value is greater than the second upper limit value; The processing unit is specifically configured to add a congestion flag to the message when the sum of the occupancy value of the first queue buffer and the size of the message is greater than a first upper limit value of the first queue buffer, and store the message after the congestion flag is added into the first queue buffer, wherein the congestion flag is used to indicate that the first queue buffer is in a congested state; or, when the sum of the occupancy value of the first queue buffer and the size of the message is less than a second upper limit value of the first queue buffer, store the message into the first queue buffer; Alternatively, when the sum of the occupancy value of the first queue cache and the size of the message is greater than the second upper limit value of the first queue cache and less than the first upper limit value of the first queue cache, a probability value is used to select whether to store the message in the first queue cache or to add the congestion flag to the message and store the message after adding the congestion flag in the first queue cache.
20. A switching circuit, characterized in that: include: processing unit and memory; Wherein, the processing unit is used to receive a message from another device; The processing unit is further configured to determine a first queue buffer for storing the message; The processing unit is further configured to determine a first upper limit value of the first queue cache according to an available value of the first port cache and an available value of the global cache; The memory comprises: the global cache, the global cache comprises at least one port cache, the first port cache is one of the at least one port cache, the first port cache comprises at least one queue cache, the first queue cache is one of the at least one queue cache; The processing unit is further configured to process the message according to a first upper limit value of the first queue buffer, an occupancy value of the first queue buffer, and a size of the message.
21. The switching circuit according to claim 20, characterized in that: The processing unit is used to determine a first upper limit value of the first queue cache according to a port sharing upper limit value and a global sharing upper limit value, wherein the port sharing upper limit value is equal to the product of an available value of the first port cache and a first coefficient, and the global sharing upper limit value is equal to the product of an available value of the global cache and a second coefficient.
22. The switching circuit according to claim 21, characterized in that: The processing unit is used to determine a first upper limit value of the first queue buffer according to the port sharing upper limit value, the global sharing upper limit value and a preset lower limit value of the first queue buffer.
23. The switching circuit according to any one of claims 20 to 22, characterized in that: The processing unit is used to determine the available value of the global cache according to the upper limit value of the global cache and the occupancy value of the global cache; An upper limit value of the first port buffer is determined according to the third coefficient and the available value of the global buffer; and an available value of the first port buffer is determined according to the upper limit value of the first port buffer and the occupancy value of the first port buffer.
24. The switching circuit according to any one of claims 20 to 22, characterized in that: The processing unit is specifically used to store the message in the first queue cache and send an indication signal when the sum of the occupancy value of the first queue cache and the size of the message is greater than a first upper limit value of the first queue cache, wherein the indication signal is used to indicate that the first queue cache is in a congested state; or, when the sum of the occupancy value of the first queue cache and the size of the message is less than or equal to a first upper limit value of the first queue cache, store the message in the first queue cache.
25. A first device, characterized in that: include: A receiving module, used for receiving a message from a second device; A determination module, used to determine a first queue cache for storing the message; The determining module is configured to determine a first upper limit value of the first queue buffer according to an available value of the first port buffer and an available value of the global buffer, the global buffer including at least one port buffer, the first port buffer being one of the at least one port buffer, the first port buffer including at least one queue buffer, the first queue buffer being one of the at least one queue buffer; The processing module is used to process the message according to the first upper limit value of the first queue buffer, the occupancy value of the first queue buffer and the size of the message.
26. A readable storage medium, characterized in that: The readable storage medium stores a computer program; when the computer program is executed, it implements the message processing method according to any one of claims 1 to 9.
27. A first device, characterized in that: include: A memory and a processor, the memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute the message processing method as described in any one of claims 1-9.
Citation Information
Patent Citations
Cache management method and apparatus in network device
CN106789729A
Queue cache resource control method and device, server and storage medium
CN107404443A