Network traffic control method, device, equipment and storage medium
By counting the buffer occupancy rate and cache increase rate in network equipment, sending traffic warning frames and speed limit defragment frames, adjusting the packet transmission rate of upstream equipment, the problem of unstable traffic control in the prior art is solved, and smooth control and continuity guarantee of network traffic is achieved.
Patent Information
- Application Number
- CN202411008400.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-07-26
AI Technical Summary
When controlling upstream traffic, the prior art causes the traffic to be intermittent, fail to fully utilize the buffers of network equipment, and cannot control the data traffic transmitted in the network smoothly.
By controlling the downstream equipment to count the occupancy rate and cache increase rate of the buffer, when the occupancy rate continues to be higher than the preset threshold and the cache increase rate is positive, a traffic warning frame is sent to adjust the packet transmission rate of the upstream equipment; when the occupancy rate is lower than the threshold, the transmission speed limit release frame is restored to restore the transmission rate of the upstream equipment.
It achieves a smooth speed reduction, maintains network continuity, avoids network interruption, and reduces the transmission speed of upstream devices in a timely manner before congestion occurs, preventing flow interruptions caused by excessive congestion.
Smart Images

Figure CN118540282B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of flow control, and more particularly to a network flow control method, apparatus, device and storage medium. Background Art
[0002] PFC (Priority-based Flow Control) is a flow control method in the prior art, which affects and takes effect on the switch. PFC allows the creation of multiple virtual channels, i.e., queues with different priorities, on an Ethernet link. Each virtual channel is assigned a priority, and packets or data streams based on the same priority are transmitted in the same priority queue. Each virtual channel implements an independent flow control mechanism. The core principle of PFC is that the downstream device controls the virtual channel of a certain priority of the upstream device to start or stop sending packets. The control trigger timing is when the number of queues at the inlet of the downstream device reaches a certain threshold. The control method is to control the upstream device to pause or resume sending packets by sending PFC Pause frames (traffic pause frames) and Resume frames (pause resume frames).
[0003] With the development of network devices (such as network cards, switches, etc.), their buffer capacity continues to increase. In this context, although the PFC method in the prior art can still effectively control the switch of upstream traffic, it directly suspends and resumes the data packet sending of the upstream device, which will cause the upstream traffic to be intermittent, and fails to fully utilize the buffer of the network device, and cannot smoothly control the data traffic transmitted in the network. Summary of the invention
[0004] The embodiment of the present application provides a network traffic control method to solve or at least partially solve the above-mentioned problem.
[0005] Correspondingly, an embodiment of the present application also provides a network traffic control device, an electronic device, a storage medium and a computer program product to ensure the implementation and application of the above method.
[0006] In order to solve the above problems, an embodiment of the present application discloses a network traffic control method, which is applied to a network device, wherein the network device includes a network port device, an upstream device, and a downstream device, wherein data packets are transmitted between the upstream device and the downstream device through the network port device, and the network port device is provided with a buffer. The method includes:
[0007] Controlling the downstream device to count the occupancy rate and cache increase rate of the buffer, wherein the buffer stores the data packets sent by the upstream device;
[0008] When the occupancy rate is continuously higher than a first preset threshold within a preset time, and the cache increase rate is a positive value, controlling the downstream device to send a traffic warning frame to the upstream device, wherein the traffic warning frame includes at least the current downstream processing capacity;
[0009] When the upstream device receives the traffic warning frame, controlling the upstream device to adjust the rate of sending the data packet according to the current processing capacity of the downstream device;
[0010] When it is detected that the occupancy rate of the buffer is lower than the first preset threshold, the downstream device is controlled to send a rate limit release frame to the upstream device, and the rate limit release frame is used to enable the upstream device to restore the rate of sending the data packet.
[0011] In an optional embodiment of the present application, controlling the downstream device to count the occupancy rate and cache increase rate of the buffer zone includes:
[0012] Control the number of newly added data packets and the number of consumed data packets in the buffer within the statistical window time of the downstream device;
[0013] The cache increase rate is calculated based on the number of newly added data packets and the number of consumed data packets in the buffer within the window time, and the downstream current processing capacity is calculated based on the number of consumed data packets in the buffer within the window time;
[0014] Determining whether it is necessary to control the downstream device to send the traffic warning frame to the upstream device according to the occupancy rate and the cache increase rate;
[0015] If it is necessary to control the downstream device to send the traffic warning frame to the upstream device, the downstream current processing capacity is set to the first preset byte in the traffic warning frame.
[0016] In an optional embodiment of the present application, controlling the upstream device to adjust the rate of sending the data packet according to the current processing capability of the downstream device includes:
[0017] If the occupancy rate of the buffer is higher than the first preset threshold, controlling the downstream device to count the current cache increase rate and the current downstream processing capacity;
[0018] When the current cache increase rate is a positive value, the downstream current processing capacity is sent to the upstream device at a regular interval;
[0019] The upstream device is controlled to adjust the rate of sending the data packet according to the current processing capability of the downstream device.
[0020] In an optional embodiment of the present application, controlling the upstream device to adjust the rate of sending the data packet according to the current processing capability of the downstream device includes:
[0021] The upstream device is controlled to adjust the rate of sending the data packet to a first preset percentage of the processing rate corresponding to the current processing capacity of the downstream.
[0022] In an optional embodiment of the present application, when detecting that the occupancy rate of the buffer is lower than the first preset threshold, controlling the downstream device to send a rate limit release frame to the upstream device includes:
[0023] When it is detected that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold, the downstream device is controlled to send a rate limit release frame to the upstream device.
[0024] In an optional embodiment of the present application, the detecting that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold further includes:
[0025] If after controlling the upstream device to adjust the rate of sending the data packets according to the current processing capacity of the downstream, the occupancy rate of the buffer is higher than the first preset threshold and the cache increase rate is a negative value, it is detected that the occupancy rate of the buffer gradually decreases to the second preset percentage of the first preset threshold.
[0026] In an optional embodiment of the present application, after controlling the downstream device to send a traffic warning frame to the upstream device, the method further includes:
[0027] If the upstream device does not respond to the traffic warning frame in time, or the upstream device does not have the ability to identify the traffic warning frame, after detecting that the occupancy rate of the buffer is higher than a second preset threshold, control the downstream device to send a traffic pause frame to the upstream device, wherein the traffic pause frame is used to pause the upstream device from sending the data packet;
[0028] When the upstream device receives the traffic pause frame, the upstream device is controlled to pause sending the data packet.
[0029] In an optional embodiment of the present application, the method further includes:
[0030] When it is detected that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold, the downstream device is controlled to send a pause resume frame to the upstream device, and the pause resume frame is used to enable the upstream device to resume sending the data packet.
[0031] In an optional embodiment of the present application, the controlling the downstream device to send a rate limit release frame to the upstream device further includes:
[0032] When the upstream device fails to normally receive the speed limit release frame and the occupancy rate of the buffer is lower than the first preset threshold, the downstream device is controlled to periodically send the speed limit release frame to the upstream device.
[0033] In an optional embodiment of the present application, the controlling the downstream device to send a pause resume frame to the upstream device further includes:
[0034] When the upstream device fails to normally receive the pause resume frame and the occupancy rate of the buffer is lower than the first preset threshold, the downstream device is controlled to periodically send the pause resume frame to the upstream device.
[0035] In an optional embodiment of the present application, the network port device has multiple virtual channels, each of the virtual channels has a corresponding priority, and the upstream device and the downstream device transmit data packets through the virtual channels. The method also includes:
[0036] Controlling the downstream device to count the occupancy rate and cache increase rate of the buffers of the multiple virtual channels;
[0037] When the occupancy rate of the target virtual channel is continuously higher than a first preset threshold value within a preset time, and the cache increase rate is a positive value, controlling the downstream device to send a traffic warning frame to the upstream device, wherein the traffic warning frame includes at least the current downstream processing capacity and the channel identifier of the target virtual channel;
[0038] When the upstream device receives the traffic warning frame, controlling the upstream device to adjust the rate of sending the data packet to the target virtual channel according to the current processing capacity of the downstream according to the channel identifier;
[0039] When it is detected that the occupancy rate of the buffer of the target virtual channel is lower than the first preset threshold, the downstream device is controlled to send a rate limit release frame to the upstream device, wherein the rate limit release frame includes at least the channel identifier of the target virtual channel.
[0040] In an optional embodiment of the present application, the second preset byte of the traffic warning frame is a distinguishing mark, and the distinguishing mark is used to distinguish the traffic warning frame from the traffic pause frame, and to identify the traffic speed limiting capability of the traffic warning frame.
[0041] The embodiment of the present application further discloses a network traffic control device, which is applied to a network device, wherein the network device includes a network port device, an upstream device, and a downstream device, wherein data packets are transmitted between the upstream device and the downstream device via the network port device, and the network port device is provided with a buffer. The device includes:
[0042] A data statistics module, used to control the downstream device to count the occupancy rate and cache increase rate of the buffer, in which the data packets sent by the upstream device are stored;
[0043] A traffic warning module, configured to control the downstream device to send a traffic warning frame to the upstream device when the occupancy rate is continuously higher than a first preset threshold within a preset time and the cache increase rate is a positive value, wherein the traffic warning frame includes at least the current processing capacity of the downstream device;
[0044] A traffic rate limiting module, used for controlling the upstream device to adjust the rate of sending the data packet according to the current processing capacity of the downstream device when the upstream device receives the traffic warning frame;
[0045] The speed limit release module is used to control the downstream device to send a speed limit release frame to the upstream device when it detects that the occupancy rate of the buffer is lower than the first preset threshold, and the speed limit release frame is used to enable the upstream device to restore the rate of sending the data packet.
[0046] An embodiment of the present application also discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed, the processor executes the network traffic control method as described in one or more of the embodiments of the present application.
[0047] The embodiments of the present application also disclose one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes the network traffic control method as described in one or more of the embodiments of the present application.
[0048] The embodiments of the present application also disclose a computer program product, including a computer program / instruction, which, when executed by a processor, implements the network traffic control method as described in one or more of the embodiments of the present application.
[0049] Compared with the prior art, the embodiments of the present application have the following advantages:
[0050] In an embodiment of the present application, the downstream device is controlled to count the occupancy rate and cache increase rate of the buffer, and the buffer stores the data packets sent by the upstream device; when the occupancy rate is continuously higher than the first preset threshold value within the preset time, and the cache increase rate is a positive value, the downstream device is controlled to send a traffic warning frame to the upstream device, and the traffic warning frame includes at least the current downstream processing capacity; when the upstream device receives the traffic warning frame, the upstream device is controlled to adjust the rate of sending data packets according to the current downstream processing capacity; when the occupancy rate of the buffer is detected to be lower than the first preset threshold value, the downstream device is controlled to send a speed limit release frame to the upstream device, and the speed limit release frame is used to restore the rate of sending data packets by the upstream device. The embodiment of the present application effectively responds to the situation where the processing capacity of the downstream device is limited by introducing a traffic warning frame. Once it is detected that the buffer occupancy rate is too high, a traffic warning frame will be issued in advance to ensure that the speed can be smoothly reduced when the flow control is implemented, while maintaining the continuity of the network and avoiding sudden network interruption. In addition, the embodiment of the present application can also reduce the sending speed of the upstream device in time before congestion occurs, prevent excessive congestion from causing interruption, thereby ensuring the continuity of network transmission in a more gentle way and avoiding network suspension caused by sudden cessation of transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a flowchart of the steps of an embodiment of a network traffic control method of the present application;
[0052] Figure 2 This is a state switching diagram of another network traffic control method embodiment of the present application;
[0053] Figure 3 It is a structural block diagram of an embodiment of a network flow control device of the present application;
[0054] Figure 4 It is a schematic diagram of the structure of a device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0056] Reference Figure 1 , is a flowchart of a network traffic control method embodiment of the present application, comprising the following steps:
[0057] Step 101: Control the downstream device to count the occupancy rate and cache increase rate of the buffer, in which the data packets sent by the upstream device are stored.
[0058] A network traffic control method shown in some embodiments of the present application is applied to a network device, wherein the network device includes a network port device, an upstream device and a downstream device, the network port device is provided with a buffer, and data packets are transmitted between the upstream device and the downstream device through the network port device, that is, the upstream device (sending end) sends the data packet to the downstream device (receiving end) through the network port device, and the downstream device receives the data packet from the upstream device through the network port device.
[0059] In step 101, the data packet sent by the upstream device first reaches the buffer of the network port device, and the downstream device counts the occupancy rate and cache increase rate of the network port device buffer. In an optional embodiment, the cache increase rate of the buffer within the window time can be calculated by formula (1).
[0060] (1)
[0061] Among them, A is the cache increase rate; T is the window time, the unit is usually ns (nanosecond); R n is the number of new data packets received by the network port device within the window time; R u is the number of network port device buffer data packets consumed by the back end within the window time. In an optional embodiment, the window time can be set according to the buffer size and the processing capacity of the network port device.
[0062] Step 102: When the occupancy rate is continuously higher than a first preset threshold within a preset time and the cache increase rate is a positive value, control the downstream device to send a traffic warning frame to the upstream device, wherein the traffic warning frame includes at least the current downstream processing capacity.
[0063] In step 102, if the occupancy rate of the buffer zone is continuously higher than the first preset threshold value within the preset time, and the buffer increase rate A is a positive value, the downstream device will send a traffic warning frame to the upstream device. The traffic warning frame includes at least the current downstream processing capacity. In one embodiment, the traffic warning frame may also include a distinguishing mark for distinguishing from the traffic pause frame. In an optional embodiment, the current downstream processing capacity within the window time may be calculated by formula (2).
[0064] (2)
[0065] Where V is the current processing capacity of the downstream; T is the window time, usually in ns (nanosecond); R uis the number of network port device buffer packets consumed by the backend within the window time. In an optional embodiment, the downstream device can calculate the occupancy rate, cache increase rate and downstream current processing capacity within the window time for a preset number of times. If the occupancy rate is continuously higher than the first preset threshold value and the cache increase rate is a positive value in the calculation of the preset number of times, a traffic warning frame including the downstream current processing capacity is sent to the upstream device. In an optional embodiment, the first preset threshold value can be a pre-set buffer occupancy rate warning value P y The embodiment of the present application does not impose any limitation on the specific setting of the first preset threshold, and those skilled in the art may make corresponding settings as needed.
[0066] Step 103: When the upstream device receives the traffic warning frame, control the upstream device to adjust the rate of sending the data packet according to the current processing capacity of the downstream.
[0067] In step 103, after receiving the traffic warning frame, the upstream device reduces the rate of sending data packets according to the downstream current processing capacity V carried in the traffic warning frame. In an example, the upstream device can reduce the rate of sending data packets to 90% of the processing rate corresponding to the downstream current processing capacity. This value is only for example, and the embodiment of the present application does not impose any restrictions on the specific upstream device to reduce the sending rate.
[0068] Step 104: When it is detected that the occupancy rate of the buffer is lower than the first preset threshold, control the downstream device to send a rate limit release frame to the upstream device, wherein the rate limit release frame is used to enable the upstream device to restore the rate of sending the data packet.
[0069] In step 104, as the upstream device reduces the sending rate, the space in the buffer is gradually released. When it is detected that the occupancy rate of the buffer drops below the first preset threshold, the downstream device sends a rate limit release frame to the upstream device. After receiving the rate limit release frame, the upstream device resumes the rate of sending data packets before receiving the traffic warning frame. In one example, the occupancy rate of the buffer drops to the buffer occupancy warning value P y After the speed reaches 80%, the downstream device sends a speed limit release frame to the upstream device. The setting of the first preset threshold is only for example, and the embodiment of the present application does not impose any limitation on the specific setting of the first preset threshold.
[0070] In an embodiment of the present application, the downstream device is controlled to count the occupancy rate and cache increase rate of the buffer, and the buffer stores the data packets sent by the upstream device; when the occupancy rate is continuously higher than the first preset threshold value within the preset time, and the cache increase rate is a positive value, the downstream device is controlled to send a traffic warning frame to the upstream device, and the traffic warning frame includes at least the current downstream processing capacity; when the upstream device receives the traffic warning frame, the upstream device is controlled to adjust the rate of sending data packets according to the current downstream processing capacity; when the occupancy rate of the buffer is detected to be lower than the first preset threshold value, the downstream device is controlled to send a speed limit release frame to the upstream device, and the speed limit release frame is used to restore the rate of sending data packets by the upstream device. The embodiment of the present application effectively responds to the situation where the processing capacity of the downstream device is limited by introducing a traffic warning frame. Once it is detected that the buffer occupancy rate is too high, a traffic warning frame will be issued in advance to ensure that the speed can be smoothly reduced when the flow control is implemented, while maintaining the continuity of the network and avoiding sudden network interruption. In addition, the embodiment of the present application can also reduce the sending speed of the upstream device in time before congestion occurs, prevent excessive congestion from causing interruption, thereby ensuring the continuity of network transmission in a more gentle way and avoiding network suspension caused by sudden cessation of transmission.
[0071] In an optional embodiment of the present application, controlling the downstream device to count the occupancy rate and cache increase rate of the buffer zone includes:
[0072] Control the number of newly added data packets and the number of consumed data packets in the buffer within the statistical window time of the downstream device;
[0073] The cache increase rate is calculated based on the number of newly added data packets and the number of consumed data packets in the buffer within the window time, and the downstream current processing capacity is calculated based on the number of consumed data packets in the buffer within the window time;
[0074] Determining whether it is necessary to control the downstream device to send the traffic warning frame to the upstream device according to the occupancy rate and the cache increase rate;
[0075] If it is necessary to control the downstream device to send the traffic warning frame to the upstream device, the downstream current processing capacity is set to the first preset byte in the traffic warning frame.
[0076] In this embodiment, the downstream device needs to count the number of new packets and the number of consumed packets in the buffer within the window time, and calculate the cache increase rate based on the number of new packets and the number of consumed packets in the buffer within the window time. In an optional embodiment of the present application, the window time can be set according to the buffer size and the processing capacity of the network port device.
[0077] In an optional embodiment, the cache increase rate of the buffer within the window time can be calculated by formula (1).
[0078] (1)
[0079] Where A is the cache increase rate; T is the window time; R n is the number of new data packets received by the network port device within the window time; R u The number of packets in the network port device buffer consumed by the backend within the window time.
[0080] At the same time, the current downstream processing capacity is calculated according to the number of consumed data packets in the buffer within the window time. In an optional embodiment, the current downstream processing capacity within the window time can be calculated by formula (2).
[0081] (2)
[0082] Where V is the current processing capacity of the downstream; T is the window time; R u The number of packets in the network port device buffer consumed by the backend within the window time.
[0083] According to the occupancy rate and the cache increase rate, it is determined whether it is necessary to control the downstream device to send a traffic warning frame to the upstream device. Specifically, when the occupancy rate is continuously higher than the first preset threshold within the preset time and the cache increase rate is a positive value, the downstream device is controlled to send a traffic warning frame to the upstream device. If it is necessary to control the downstream device to send a traffic warning frame to the upstream device, the current downstream processing capacity is set to the first preset byte in the traffic warning frame. In an optional embodiment, the 2nd to 3rd bytes in the Pad (padding field) in the traffic warning frame can be set to the most recent current downstream processing capacity.
[0084] The embodiment of the present application monitors the number of new and consumed data packets in the buffer in real time, predicts potential congestion, and sends traffic warning frames to perform traffic control before the problem occurs, thereby avoiding network performance degradation.
[0085] In an optional embodiment of the present application, controlling the upstream device to adjust the rate of sending the data packet according to the current processing capability of the downstream device includes:
[0086] If the occupancy rate of the buffer is higher than the first preset threshold, controlling the downstream device to count the current cache increase rate and the current downstream processing capacity;
[0087] When the current cache increase rate is a positive value, the downstream current processing capacity is sent to the upstream device at a regular interval;
[0088] The upstream device is controlled to adjust the rate of sending the data packet according to the current processing capability of the downstream device.
[0089] In this embodiment, during the period when the occupancy rate of the buffer is higher than the first preset threshold, the downstream device needs to continuously count the current cache increase rate and the downstream current processing capacity according to the window time. When the current cache increase rate is a positive value, the downstream device periodically sends the downstream current processing capacity of the window time to the upstream device, so that the upstream device continues to adjust the rate of sending data packets according to the newly received downstream current processing capacity.
[0090] The embodiment of the present application sends the current processing capacity of the downstream to the upstream device in real time, so as to more flexibly adjust the sending rate of the upstream device and accelerate the relief of the pressure on the downstream device.
[0091] In an optional embodiment of the present application, controlling the upstream device to adjust the rate of sending the data packet according to the current processing capability of the downstream device includes:
[0092] The upstream device is controlled to adjust the rate of sending the data packet to a first preset percentage of the processing rate corresponding to the current processing capacity of the downstream.
[0093] In this embodiment, when the upstream device adjusts the rate of sending data packets according to the current processing capacity of the downstream, the rate of sending data packets can be adjusted to a first preset percentage of the processing rate corresponding to the current processing capacity of the downstream. In one example, the rate of sending data packets by the upstream device can be adjusted to 90% of the processing rate corresponding to the current processing capacity of the downstream. This value is only an example, and the embodiment of the present application does not impose any restrictions on the actual setting of the first preset percentage, and those skilled in the art can set it according to actual needs.
[0094] The embodiment of the present application adjusts the sending rate of the upstream device according to the current processing capacity of the downstream, realizes dynamic adjustment of the sending rate of the upstream device to adapt to changes in the processing capacity status of the downstream device, and helps to maintain the stability of network performance.
[0095] In an optional embodiment of the present application, when detecting that the occupancy rate of the buffer is lower than the first preset threshold, controlling the downstream device to send a rate limit release frame to the upstream device includes:
[0096] When it is detected that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold, the downstream device is controlled to send a rate limit release frame to the upstream device.
[0097] In this embodiment, when the occupancy rate of the buffer is lower than the second preset percentage of the first preset threshold, the downstream device will send a speed limit release frame to the upstream device to release the speed limit on the upstream device and restore the sending rate of the upstream device. y The second preset percentage can be set to 80%, that is, when the occupancy rate of the buffer zone is lower than the occupancy rate warning value P y After reaching 80% of the second preset percentage, the downstream device sends a rate limit release frame to the upstream device. This value is only an example, and the embodiment of the present application does not impose any restrictions on the actual setting of the second preset percentage, and those skilled in the art can set it according to actual needs.
[0098] The embodiment of the present application determines whether the speed limit needs to be lifted according to the occupancy rate. When the occupancy rate drops to a certain level, the speed limit is automatically lifted and the sending rate of the upstream device is restored, thereby achieving a rapid response to the network status.
[0099] In an optional embodiment of the present application, the detecting that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold further includes:
[0100] If after controlling the upstream device to adjust the rate of sending the data packets according to the current processing capacity of the downstream, the occupancy rate of the buffer is higher than the first preset threshold and the cache increase rate is a negative value, it is detected that the occupancy rate of the buffer gradually decreases to the second preset percentage of the first preset threshold.
[0101] In this embodiment, after the upstream device receives the traffic warning frame and adjusts the rate of sending data packets according to the current processing capacity of the downstream, although the buffer occupancy rate is still higher than the first preset threshold at this time, since the cache increase rate is a negative value, the buffer occupancy rate will slowly fall back. When it falls back to the second preset percentage of the first preset threshold, the downstream device sends a speed limit release frame to the upstream device to lift the speed limit on the upstream device and restore the sending rate of the upstream device.
[0102] The embodiment of the present application determines whether the speed limit needs to be lifted based on the cache increase rate and occupancy rate. When the occupancy rate drops to a certain level, the speed limit is automatically lifted and the sending rate of the upstream device is restored, thereby achieving a rapid response to the network status.
[0103] In an optional embodiment of the present application, after controlling the downstream device to send a traffic warning frame to the upstream device, the method further includes:
[0104] If the upstream device does not respond to the traffic warning frame in time, or the upstream device does not have the ability to identify the traffic warning frame, after detecting that the occupancy rate of the buffer is higher than a second preset threshold, control the downstream device to send a traffic pause frame to the upstream device, wherein the traffic pause frame is used to pause the upstream device from sending the data packet;
[0105] When the upstream device receives the traffic pause frame, the upstream device is controlled to pause sending the data packet.
[0106] In this embodiment, when the occupancy rate of the buffer is higher than the first preset threshold and the cache increase rate is a positive value, the downstream device will send a traffic warning frame to the upstream device. However, the upstream device may not be able to respond to the traffic warning frame in a timely manner, or the upstream device does not have the ability to identify the traffic warning frame, that is, the traffic warning frame is incompatible with the upstream device. In the above case, the sending rate of the upstream device fails to be adjusted in time, which may cause the buffer occupancy rate to further increase and finally reach the second preset threshold, which is higher than the first preset threshold. At this time, the downstream device sends a traffic pause frame to the upstream device to stop the upstream device from sending data packets. After receiving the traffic pause frame, the upstream device stops sending data packets.
[0107] In the embodiment of the present application, when the upstream device fails to respond to the traffic warning frame in time or is incompatible, the downstream device can send a traffic pause frame when the buffer occupancy reaches a higher second preset threshold, thereby preventing the buffer occupancy from further increasing and avoiding serious network congestion.
[0108] In an optional embodiment of the present application, the method further includes:
[0109] When it is detected that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold, the downstream device is controlled to send a pause resume frame to the upstream device, and the pause resume frame is used to enable the upstream device to resume sending the data packet.
[0110] In this embodiment, after the upstream device stops sending data packets, the occupancy rate of the buffer will gradually fall back. When it falls back to the second preset percentage of the first preset threshold, the downstream device sends a pause resume frame to the upstream device to release the pause of the upstream device's transmission, so that the upstream device resumes sending data packets. In one example, the first preset threshold is the occupancy rate warning value P y , the second preset threshold bit occupancy rate pause value P s , P y Less than P s The second preset percentage can be set to 80%, that is, when the occupancy rate of the buffer zone is lower than the occupancy rate warning value P yAfter reaching 80% of the second preset percentage, the downstream device sends a pause resume frame to the upstream device. This value is only an example, and the embodiment of the present application does not impose any restrictions on the actual setting of the second preset percentage, and those skilled in the art can set it according to actual needs.
[0111] The embodiment of the present application determines whether it is necessary to resume the transmission of the upstream device according to the occupancy rate. When the occupancy rate drops to a certain level, the pause is automatically released and the transmission rate of the upstream device is resumed, thereby achieving a rapid response to the network status.
[0112] In an optional embodiment of the present application, the controlling the downstream device to send a rate limit release frame to the upstream device further includes:
[0113] When the upstream device fails to normally receive the speed limit release frame and the occupancy rate of the buffer is lower than the first preset threshold, the downstream device is controlled to periodically send the speed limit release frame to the upstream device.
[0114] In this embodiment, if the upstream device is in a speed limit state, if the speed limit release frame is received abnormally and the trigger of speed limit release is missed, the upstream device will not know that the buffer occupancy has been restored and continue to limit the sending rate. Therefore, when the upstream device does not receive the speed limit release frame normally and the buffer occupancy is lower than the first preset threshold, the downstream device needs to send the speed limit release frame to the upstream device regularly.
[0115] The embodiment of the present application sends the speed limit release frame at a regular interval, so that even if the initial speed limit release frame cannot be normally received by the upstream device, it can ensure that the upstream device can eventually receive the speed limit release instruction, thereby improving the reliability of flow control.
[0116] In an optional embodiment of the present application, the controlling the downstream device to send a pause resume frame to the upstream device further includes:
[0117] When the upstream device fails to normally receive the pause resume frame and the occupancy rate of the buffer is lower than the first preset threshold, the downstream device is controlled to periodically send the pause resume frame to the upstream device.
[0118] In this embodiment, if the upstream device is in a pause state, if the pause resume frame is received abnormally and the pause resume trigger is missed, the upstream device will not know that the occupancy rate of the buffer has been restored and continue to suspend sending data packets. Therefore, when the upstream device does not normally receive the pause resume frame and the occupancy rate of the buffer is lower than the first preset threshold, the downstream device needs to periodically send the pause resume frame to the upstream device.
[0119] The embodiment of the present application periodically sends pause resume frames, thereby ensuring that the upstream device can eventually receive the pause resume instruction even if the initial pause resume frame cannot be normally received by the upstream device, thereby improving the reliability of flow control.
[0120] In an optional embodiment of the present application, the network port device has multiple virtual channels, each of the virtual channels has a corresponding priority, and the upstream device and the downstream device transmit data packets through the virtual channels. The method also includes:
[0121] Controlling the downstream device to count the occupancy rate and cache increase rate of the buffers of the multiple virtual channels;
[0122] When the occupancy rate of the target virtual channel is continuously higher than a first preset threshold value within a preset time, and the cache increase rate is a positive value, controlling the downstream device to send a traffic warning frame to the upstream device, wherein the traffic warning frame includes at least the current downstream processing capacity and the channel identifier of the target virtual channel;
[0123] When the upstream device receives the traffic warning frame, controlling the upstream device to adjust the rate of sending the data packet to the target virtual channel according to the current processing capacity of the downstream according to the channel identifier;
[0124] When it is detected that the occupancy rate of the buffer of the target virtual channel is lower than the first preset threshold, the downstream device is controlled to send a rate limit release frame to the upstream device, wherein the rate limit release frame includes at least the channel identifier of the target virtual channel.
[0125] In this embodiment, a network traffic control method can also be used for virtual channels of all priorities of PFC. That is, in this embodiment, the network port device has multiple virtual channels, each virtual channel has a corresponding priority, and the upstream device and the downstream device transmit data packets of corresponding priorities through virtual channels of different priorities.
[0126] In this embodiment, the downstream device counts the occupancy rates and cache increase rates of the corresponding buffers of multiple virtual channels of different priorities. When the occupancy rate of a target virtual channel is continuously higher than a first preset threshold value within a preset time, and the cache increase rate is a positive value, the downstream device sends a traffic warning frame to the upstream device, and the traffic warning frame includes at least the current downstream processing capacity and the channel identifier of the target virtual channel, and the channel identifier can be the priority of the target virtual channel. When the upstream device receives the traffic warning frame, it adjusts the rate at which the upstream device sends data packets to the corresponding target virtual channel according to the channel identifier and the current downstream processing capacity to release the buffer corresponding to the target virtual channel. When it is detected that the occupancy rate of the buffer of the target virtual channel falls back to below the first preset threshold, the downstream device sends a speed limit release frame to the upstream device, and the speed limit release frame includes at least the channel identifier of the target virtual channel, so that the upstream device can resume the rate at which data packets are sent to the target virtual channel.
[0127] In an optional embodiment, the traffic warning frame and the traffic pause frame may distinguish virtual channels of different priorities through a Priority enable vector (back pressure enable vector) byte therein.
[0128] The embodiment of the present application makes the management of network traffic more flexible by performing flow control management on virtual channels of different priorities respectively.
[0129] In an optional embodiment, the second preset byte of the traffic warning frame is a distinguishing mark, and the distinguishing mark is used to distinguish the traffic warning frame from the traffic pause frame and to identify the traffic rate limiting capability of the traffic warning frame.
[0130] In this embodiment, the second preset byte of the traffic warning frame is a distinguishing mark, which is used to distinguish the traffic warning frame from the traffic pause frame and to identify the traffic rate limiting capability of the traffic warning frame.
[0131] In one embodiment, the format of the traffic pause frame may be as shown in Table 1.
[0132] Among them, Destination address is the destination MAC address (Media Access Control) address), the value is fixed to 01-80-c2-00-00-01, occupying 6 octets (eight-bit bytes); Source address is the source MAC address, occupying 6 octets; Ethertype is the Ethernet frame type, the value is 88-08, occupying 2 octets; Control opcode is the control code, the value is 01-01, occupying 2 octets; Priority enable vector (back pressure enable vector) is the back pressure enable vector, which occupies 2 octets. E(n) corresponds to priority queue n (n is the priority), indicating whether priority queue n needs back pressure. When E(n)=1, it means that priority queue n needs back pressure, and the back pressure time is Time(n). When E(n)=0, it means that the priority queue does not need back pressure. Time(0)~Time(7) (back pressure time of queues with priorities 0~7) is the back pressure timer, which occupies 16 octets. When Time(n)=0, it means that the back pressure of priority queue n is canceled. Pad (padding field) is a reserved byte, which occupies 26 octets. When transmitting, Pad defaults to 0. CRC (cyclic redundancy check) is a cyclic redundancy check, which occupies 4 octets.
[0133] Table 1 Traffic pause frame format
[0134]
[0135] In this embodiment, the format of the traffic warning frame may be as shown in Table 2.
[0136] Among them, Destination address is the destination MAC address (Media Access Control) address), the value is fixed to 01-80-c2-00-00-01, occupying 6 octets (eight-bit bytes); Source address is the source MAC address, occupying 6 octets; Ethertype is the Ethernet frame type, the value is 88-08, occupying 2 octets; Control opcode is the control code, the value is 01-01, occupying 2 octets; Priority enable vector (back pressure enable vector) is the back pressure enable vector, which occupies 2 octets. E(n) corresponds to priority queue n (n is the priority), indicating whether priority queue n needs back pressure. When E(n)=1, it means that priority queue n needs back pressure, and the back pressure time is Time(n). When E(n)=0, it means that the priority queue does not need back pressure. Time(0)~Time(7) (back pressure time of queues with priorities 0~7) is the back pressure timer, which occupies 16 octets. When Time(n)=0, it means that the back pressure of priority queue n is canceled. Pad (padding field) is set to the distinguishing mark, which is used to distinguish traffic warning frames from traffic pause frames, and to identify the traffic rate limit capability of traffic warning frames, which occupies 26 octets. Pad[n*3]=1 indicates that priority queue n needs to be limited, and Pad[n*3+1]=V is the current downstream processing capacity V. CRC (cyclic redundancy check) is a cyclic redundancy check, which occupies 4 octets.
[0137] Table 2 Traffic warning frame format
[0138]
[0139] Comparing Table 1 with Table 2, it can be seen that the difference between the traffic warning frame and the traffic pause frame lies mainly in the Pad field. The traffic warning frame has a distinguishing mark, which represents the ability of the upstream device to limit the speed of the traffic warning frame, rather than the ability to pause the upstream device to send.
[0140] The embodiment of the present application distinguishes between traffic warning frames and traffic pause frames, and adds traffic warning processing during the traffic control process, thereby ensuring the continuity of network transmission in a more gentle manner and avoiding network pauses caused by sudden cessation of transmission.
[0141] In an optional embodiment of the present application, INT (Inband Network Telemetry) can also be used to replace the traffic warning frame to implement a network traffic control method of an embodiment of the present application. INT uses network remote sensing technology to encapsulate and parse warning information in the service message header. The network congestion warning will not use the traffic warning frame, thereby reducing the occupation of network resources. In a feasible embodiment, INT technology can also be used to realize the dynamic adjustment and update of the first preset threshold and the second preset threshold. Specifically, INT can be used to dynamically adjust the first preset threshold and the second preset threshold according to the real-time status and historical data of the network to adapt to changes in network traffic, or a machine learning algorithm can be used to predict the time and location of network congestion, and INT can be used to adjust the first preset threshold and the second preset threshold accordingly.
[0142] The embodiments of the present application use INT technology to achieve real-time monitoring, dynamic threshold adjustment and predictive maintenance, providing an efficient, flexible and automated solution for network traffic control, which helps to improve network performance, stability and user experience.
[0143] In an embodiment of the present application, the downstream device is controlled to count the occupancy rate and cache increase rate of the buffer, and the buffer stores the data packets sent by the upstream device; when the occupancy rate is continuously higher than the first preset threshold value within the preset time, and the cache increase rate is a positive value, the downstream device is controlled to send a traffic warning frame to the upstream device, and the traffic warning frame includes at least the current downstream processing capacity; when the upstream device receives the traffic warning frame, the upstream device is controlled to adjust the rate of sending data packets according to the current downstream processing capacity; when the occupancy rate of the buffer is detected to be lower than the first preset threshold value, the downstream device is controlled to send a speed limit release frame to the upstream device, and the speed limit release frame is used to restore the rate of sending data packets by the upstream device. The embodiment of the present application effectively responds to the situation where the processing capacity of the downstream device is limited by introducing a traffic warning frame. Once it is detected that the buffer occupancy rate is too high, a traffic warning frame will be issued in advance to ensure that the speed can be smoothly reduced when the flow control is implemented, while maintaining the continuity of the network and avoiding sudden network interruption. In addition, the embodiment of the present application can also reduce the sending speed of the upstream device in time before congestion occurs, prevent excessive congestion from causing interruption, thereby ensuring the continuity of network transmission in a more gentle way and avoiding network suspension caused by sudden cessation of transmission.
[0144] The following will combine Figure 2 A state switching diagram of another network traffic control method embodiment of the present application is provided, and the specific process of a network traffic control method of an embodiment of the present application is described so that those skilled in the art can better understand the technical solution of a network traffic control method of the present application.
[0145] Reference Figure 2 , shows a state switching schematic diagram of another network traffic control method embodiment of the present application.
[0146] Data is transmitted between the receiving end (i.e., the downstream device) and the sending end (i.e., the upstream device) through the network port device (with a buffer). When the buffer occupancy rate is greater than the first preset threshold, the receiving end switches from the full-speed state to the warning state, and sends a traffic warning frame to the sending end, so that the sending end switches from the full-speed state to the reduced speed state, and limits the speed of the sending end. At this time, if the buffer reception is balanced, the space is gradually released. After the buffer occupancy rate is less than 80%, the receiving end can switch from the warning state to the full-speed state, and send a speed limit release frame to the sending end, so that the sending end switches to the full-speed state.
[0147] If the processing capacity of the receiving end in the warning state continues to decrease, causing the buffer occupancy rate to continue to increase to a value greater than the second preset threshold, the receiving end switches from the warning state to the pause state, and sends a traffic pause frame to the sending end, causing the sending end to switch from the speed reduction state to the congestion pause state, and suspend the sending of the sending end. At this time, if the buffer reception is balanced and the space is gradually released, after the buffer occupancy rate is less than 80%, the receiving end can switch from the pause state to the full speed state, and send a pause recovery frame to the sending end, causing the sending end to switch to the full speed state.
[0148] In an embodiment of the present application, the downstream device is controlled to count the occupancy rate and cache increase rate of the buffer, and the buffer stores the data packets sent by the upstream device; when the occupancy rate is continuously higher than the first preset threshold value within the preset time, and the cache increase rate is a positive value, the downstream device is controlled to send a traffic warning frame to the upstream device, and the traffic warning frame includes at least the current downstream processing capacity; when the upstream device receives the traffic warning frame, the upstream device is controlled to adjust the rate of sending data packets according to the current downstream processing capacity; when the occupancy rate of the buffer is detected to be lower than the first preset threshold value, the downstream device is controlled to send a speed limit release frame to the upstream device, and the speed limit release frame is used to restore the rate of sending data packets by the upstream device. The embodiment of the present application effectively responds to the situation where the processing capacity of the downstream device is limited by introducing a traffic warning frame. Once it is detected that the buffer occupancy rate is too high, a traffic warning frame will be issued in advance to ensure that the speed can be smoothly reduced when the flow control is implemented, while maintaining the continuity of the network and avoiding sudden network interruption. In addition, the embodiment of the present application can also reduce the sending speed of the upstream device in time before congestion occurs, prevent excessive congestion from causing interruption, thereby ensuring the continuity of network transmission in a more gentle way and avoiding network suspension caused by sudden cessation of transmission.
[0149] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0150] On the basis of the above embodiments, this embodiment further provides a network traffic control device, which is applied to electronic devices such as terminal devices and servers.
[0151] Reference Figure 3 , shows a structural block diagram of an embodiment of a network traffic control device of the present application, which may specifically include the following modules:
[0152] A data statistics module 301, used to control the downstream device to count the occupancy rate and cache increase rate of the buffer, in which the data packets sent by the upstream device are stored;
[0153] The traffic warning module 302 is used to control the downstream device to send a traffic warning frame to the upstream device when the occupancy rate is continuously higher than the first preset threshold within a preset time and the cache increase rate is a positive value, wherein the traffic warning frame includes at least the current processing capacity of the downstream;
[0154] The traffic rate limiting module 303 is used to control the upstream device to adjust the rate of sending the data packet according to the current processing capacity of the downstream when the upstream device receives the traffic warning frame;
[0155] The speed limit release module 304 is used to control the downstream device to send a speed limit release frame to the upstream device when it is detected that the occupancy rate of the buffer is lower than the first preset threshold, and the speed limit release frame is used to enable the upstream device to restore the rate of sending the data packet.
[0156] In an optional embodiment of the present application, the data statistics module 301 is further used to:
[0157] Control the number of newly added data packets and the number of consumed data packets in the buffer within the statistical window time of the downstream device;
[0158] The cache increase rate is calculated based on the number of newly added data packets and the number of consumed data packets in the buffer within the window time, and the downstream current processing capacity is calculated based on the number of consumed data packets in the buffer within the window time;
[0159] Determining whether it is necessary to control the downstream device to send the traffic warning frame to the upstream device according to the occupancy rate and the cache increase rate;
[0160] If it is necessary to control the downstream device to send the traffic warning frame to the upstream device, the downstream current processing capacity is set to the first preset byte in the traffic warning frame.
[0161] In an optional embodiment of the present application, the flow rate limiting module 303 is further used to:
[0162] If the occupancy rate of the buffer is higher than the first preset threshold, controlling the downstream device to count the current cache increase rate and the current downstream processing capacity;
[0163] When the current cache increase rate is a positive value, the downstream current processing capacity is sent to the upstream device at a regular interval;
[0164] The upstream device is controlled to adjust the rate of sending the data packet according to the current processing capability of the downstream device.
[0165] In an optional embodiment of the present application, the flow rate limiting module 303 is further used to:
[0166] The upstream device is controlled to adjust the rate of sending the data packet to a first preset percentage of the processing rate corresponding to the current processing capacity of the downstream.
[0167] In an optional embodiment of the present application, the speed limit release module 304 is further configured to:
[0168] When it is detected that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold, the downstream device is controlled to send a rate limit release frame to the upstream device.
[0169] In an optional embodiment of the present application, the detecting that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold further includes:
[0170] If after controlling the upstream device to adjust the rate of sending the data packets according to the current processing capacity of the downstream, the occupancy rate of the buffer is higher than the first preset threshold and the cache increase rate is a negative value, it is detected that the occupancy rate of the buffer gradually decreases to the second preset percentage of the first preset threshold.
[0171] In an optional embodiment of the present application, the device further includes:
[0172] A traffic pause module, configured to control the downstream device to send a traffic pause frame to the upstream device after detecting that the occupancy rate of the buffer is higher than a second preset threshold value if the upstream device fails to respond to the traffic warning frame in time, or the upstream device does not have the ability to identify the traffic warning frame, wherein the traffic pause frame is used to pause the upstream device from sending the data packet;
[0173] The sending pause module is used to control the upstream device to pause sending the data packet when the upstream device receives the traffic pause frame.
[0174] In an optional embodiment of the present application, the device further includes:
[0175] The pause-resume module is used to control the downstream device to send a pause-resume frame to the upstream device when detecting that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold, wherein the pause-resume frame is used to enable the upstream device to resume sending the data packet.
[0176] In an optional embodiment of the present application, the speed limit release module 304 further includes:
[0177] The first timing submodule is used to control the downstream device to periodically send the speed limit release frame to the upstream device when the upstream device fails to normally receive the speed limit release frame and the occupancy rate of the buffer is lower than the first preset threshold.
[0178] In an optional embodiment of the present application, the pause and resume module further includes:
[0179] The second timing submodule is used to control the downstream device to periodically send the pause resume frame to the upstream device when the upstream device fails to normally receive the pause resume frame and the occupancy rate of the buffer is lower than the first preset threshold.
[0180] In an optional embodiment of the present application, the network port device has multiple virtual channels, each of the virtual channels has a corresponding priority, and the upstream device and the downstream device transmit data packets through the virtual channels, and the device further includes:
[0181] A channel data statistics module, used for controlling the downstream device to count the occupancy rate and cache increase rate of the buffer of the multiple virtual channels;
[0182] A channel warning module, configured to control the downstream device to send a traffic warning frame to the upstream device when the occupancy rate of the target virtual channel is continuously higher than a first preset threshold value within a preset time and the cache increase rate is a positive value, wherein the traffic warning frame includes at least the current processing capacity of the downstream and the channel identifier of the target virtual channel;
[0183] A channel rate limiting module, configured to control the upstream device to adjust the rate at which the data packet is sent to the target virtual channel according to the current processing capacity of the downstream device when the upstream device receives the traffic warning frame according to the channel identifier;
[0184] The channel recovery module is used to control the downstream device to send a speed limit release frame to the upstream device when it is detected that the occupancy rate of the buffer of the target virtual channel is lower than the first preset threshold, and the speed limit release frame includes at least the channel identifier of the target virtual channel.
[0185] In an optional embodiment of the present application, the second preset byte of the traffic warning frame is a distinguishing mark, and the distinguishing mark is used to distinguish the traffic warning frame from the traffic pause frame, and to identify the traffic speed limiting capability of the traffic warning frame.
[0186] In an embodiment of the present application, the downstream device is controlled to count the occupancy rate and cache increase rate of the buffer, and the buffer stores the data packets sent by the upstream device; when the occupancy rate is continuously higher than the first preset threshold value within the preset time, and the cache increase rate is a positive value, the downstream device is controlled to send a traffic warning frame to the upstream device, and the traffic warning frame includes at least the current downstream processing capacity; when the upstream device receives the traffic warning frame, the upstream device is controlled to adjust the rate of sending data packets according to the current downstream processing capacity; when the occupancy rate of the buffer is detected to be lower than the first preset threshold value, the downstream device is controlled to send a speed limit release frame to the upstream device, and the speed limit release frame is used to restore the rate of sending data packets by the upstream device. The embodiment of the present application effectively responds to the situation where the processing capacity of the downstream device is limited by introducing a traffic warning frame. Once it is detected that the buffer occupancy rate is too high, a traffic warning frame will be issued in advance to ensure that the speed can be smoothly reduced when the flow control is implemented, while maintaining the continuity of the network and avoiding sudden network interruption. In addition, the embodiment of the present application can also reduce the sending speed of the upstream device in time before congestion occurs, prevent excessive congestion from causing interruption, thereby ensuring the continuity of network transmission in a more gentle way and avoiding network suspension caused by sudden cessation of transmission.
[0187] The embodiment of the present application further provides a non-volatile readable storage medium, in which one or more modules (programs) are stored. When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.
[0188] The present application embodiment provides one or more machine-readable media, on which instructions are stored, and when executed by one or more processors, an electronic device executes one or more of the methods described in the above embodiments. In the present application embodiment, the electronic device includes various types of devices such as terminal devices, servers (clusters), etc.
[0189] The embodiments of the present disclosure may be implemented as a device that uses any appropriate hardware, firmware, software, or any combination thereof to perform a desired configuration, and the device may include electronic devices such as terminal devices and servers (clusters). Figure 4 An exemplary apparatus 400 that can be used to implement various embodiments described in this application is schematically shown.
[0190] For one embodiment, Figure 4 An exemplary apparatus 400 is shown having one or more processors 402, a control module (chip set) 404 coupled to at least one of the processor(s) 402, a memory 406 coupled to the control module 404, a non-volatile memory (NVM) / storage device 408 coupled to the control module 404, one or more input / output devices 410 coupled to the control module 404, and a network interface 412 coupled to the control module 404.
[0191] The processor 402 may include one or more single-core or multi-core processors, and the processor 402 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 400 can be used as a terminal device, server (cluster), etc. described in the embodiments of the present application.
[0192] In some embodiments, the apparatus 400 may include one or more computer-readable media (e.g., memory 406 or NVM / storage device 408) having instructions 414 and one or more processors 402 configured to execute the instructions 414 in combination with the one or more computer-readable media to implement a module to perform the actions described in the present disclosure.
[0193] For one embodiment, control module 404 may include any suitable interface controller to provide any suitable interface to at least one of processor(s) 402 and / or any suitable device or component in communication with control module 404 .
[0194] The control module 404 may include a memory controller module to provide an interface to the memory 406. The memory controller module may be a hardware module, a software module, and / or a firmware module.
[0195] The memory 406 may be used, for example, to load and store data and / or instructions 414 for the device 400. For one embodiment, the memory 406 may include any suitable volatile memory, for example, a suitable DRAM (Dynamic Random Access Memory). In some embodiments, the memory 406 may include a Double Data Rate 4 Synchronous Dynamic Random-Access Memory (DDR4 SDRAM).
[0196] For one embodiment, control module 404 may include one or more input / output controllers to provide interfaces to NVM / storage device 408 and input / output device(s) 410 .
[0197] For example, NVM / storage device 408 may be used to store data and / or instructions 414. NVM / storage device 408 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disc (CD) drives, and / or one or more digital versatile disc (DVD) drives).
[0198] NVM / storage device 408 may include storage resources that are physically part of the device on which apparatus 400 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 408 may be accessed via input / output device(s) 410 over a network.
[0199] (One or more) input / output devices 410 may provide an interface for the apparatus 400 to communicate with any other appropriate device, and the input / output device 410 may include a communication component, an audio component, a sensor component, etc. The network interface 412 may provide an interface for the apparatus 400 to communicate through one or more networks, and the apparatus 400 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.
[0200] For one embodiment, at least one of the processor(s) 402 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 404. For one embodiment, at least one of the processor(s) 402 may be packaged together with the logic of one or more controllers of the control module 404 to form a system in package (SiP). For one embodiment, at least one of the processor(s) 402 may be integrated on the same die with the logic of one or more controllers of the control module 404. For one embodiment, at least one of the processor(s) 402 may be integrated on the same die with the logic of one or more controllers of the control module 404 to form a system on a chip (SoC).
[0201] In various embodiments, the device 400 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the device 400 may have more or fewer components and / or different architectures. For example, in some embodiments, the device 400 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.
[0202] Among them, the main control chip can be used as a processor or control module in the detection device, sensor data, location information, etc. are stored in a memory or NVM / storage device, the sensor group can be used as an input / output device, and the communication interface may include a network interface.
[0203] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0204] The network traffic control method and device, an electronic device and a storage medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A network traffic control method, characterized in that: Applied to a network device, the network device includes a network port device, an upstream device and a downstream device, the network port device has a plurality of virtual channels, each of the virtual channels has a corresponding priority, the upstream device and the downstream device transmit data packets through the virtual channels, the network port device is provided with a buffer, and the method includes: Control the downstream device to count the occupancy rate of the buffer of the multiple virtual channels, the number of new data packets in the buffer within the window time, and the number of consumed data packets; The cache increase rate is calculated based on the number of newly added data packets and the number of consumed data packets in the buffer within the window time, and the downstream current processing capacity is calculated based on the number of consumed data packets in the buffer within the window time, and the buffer stores the data packets sent by the upstream device; When the occupancy rate of the target virtual channel is continuously higher than the first preset threshold value within a preset time, and the cache increase rate is a positive value, the most recent downstream current processing capacity is set as the first preset byte in the traffic warning frame, and the downstream device is controlled to send a traffic warning frame to the upstream device, wherein the traffic warning frame includes at least the downstream current processing capacity and the channel identifier of the target virtual channel; the second preset byte of the traffic warning frame is a distinguishing identifier, and the distinguishing identifier is used to distinguish the traffic warning frame from the traffic pause frame, and to identify the traffic speed limit capability of the traffic warning frame; When the upstream device receives the traffic warning frame, before congestion occurs, the upstream device is controlled to adjust the rate at which the data packets are sent to the target virtual channel to a first preset percentage of the processing rate corresponding to the current processing capacity of the downstream device according to the channel identifier; When it is detected that the occupancy rate of the buffer of the target virtual channel is lower than the first preset threshold, controlling the downstream device to send a rate limit release frame to the upstream device, wherein the rate limit release frame is used to enable the upstream device to restore the rate of sending the data packet, and the rate limit release frame at least includes the channel identifier of the target virtual channel; When the upstream device fails to normally receive the speed limit release frame and the occupancy rate of the buffer is lower than the first preset threshold, controlling the downstream device to periodically send the speed limit release frame to the upstream device; If the upstream device does not respond to the traffic warning frame in time, or the upstream device does not have the ability to identify the traffic warning frame, after detecting that the occupancy rate of the buffer is higher than a second preset threshold, control the downstream device to send a traffic pause frame to the upstream device, wherein the traffic pause frame is used to pause the upstream device from sending the data packet; When the upstream device receives the traffic pause frame, controlling the upstream device to pause sending the data packet; The controlling the upstream device to adjust the rate of sending the data packet according to the current processing capability of the downstream device includes: If the occupancy rate of the buffer is higher than the first preset threshold, control the downstream device to count the current cache increase rate and the downstream current processing capacity, and when the current cache increase rate is a positive value, periodically send the downstream current processing capacity to the upstream device; Controlling the upstream device to adjust the rate of sending the data packet according to the current processing capability of the downstream device; Wherein, the method further comprises: dynamically adjusting the first preset threshold and the second preset threshold according to the real-time status and historical data of the network; or, Use machine learning algorithms to predict when and where network congestion will occur; The first preset threshold and the second preset threshold are adjusted according to the time and location of occurrence of the network congestion.
2. The method according to claim 1, characterized in that The controlling the downstream device to count the occupancy rate and cache increase rate of the buffer zone includes: It is determined whether it is necessary to control the downstream device to send the traffic warning frame to the upstream device according to the occupancy rate and the cache increase rate.
3. The method according to claim 1, characterized in that When it is detected that the occupancy rate of the buffer is lower than the first preset threshold, controlling the downstream device to send a rate limit release frame to the upstream device includes: When it is detected that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold, the downstream device is controlled to send a rate limit release frame to the upstream device.
4. The method according to claim 3, characterized in that The detecting that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold value further includes: If after controlling the upstream device to adjust the rate of sending the data packets according to the current processing capacity of the downstream, the occupancy rate of the buffer is higher than the first preset threshold and the cache increase rate is a negative value, it is detected that the occupancy rate of the buffer gradually decreases to the second preset percentage of the first preset threshold.
5. The method according to claim 1, characterized in that: The method further comprises: When it is detected that the occupancy rate of the buffer is lower than a second preset percentage of the first preset threshold, the downstream device is controlled to send a pause resume frame to the upstream device, and the pause resume frame is used to enable the upstream device to resume sending the data packet.
6. The method according to claim 5, characterized in that The controlling the downstream device to send a pause resume frame to the upstream device further includes: When the upstream device fails to normally receive the pause resume frame and the occupancy rate of the buffer is lower than the first preset threshold, the downstream device is controlled to periodically send the pause resume frame to the upstream device.
7. A network traffic control device, characterized in that: Applied to a network device, the network device includes a network port device, an upstream device and a downstream device, the network port device has a plurality of virtual channels, each of the virtual channels has a corresponding priority, data packets are transmitted between the upstream device and the downstream device through the virtual channels, the network port device is provided with a buffer, and the device includes: a data statistics module, used to control the downstream device to count the occupancy rate of the buffer of the multiple virtual channels, the number of new packets and the number of consumed packets in the buffer within the window time, calculate the cache increase rate according to the number of new packets and the number of consumed packets in the buffer within the window time, and calculate the downstream current processing capacity according to the number of consumed packets in the buffer within the window time, wherein the buffer stores the packets sent by the upstream device; A traffic warning module, used for setting the most recent downstream current processing capacity as the first preset byte in the traffic warning frame, controlling the downstream device to send a traffic warning frame to the upstream device when the occupancy rate of the target virtual channel is continuously higher than the first preset threshold value within a preset time and the cache increase rate is a positive value, and controlling the downstream device to send a traffic warning frame to the upstream device, wherein the traffic warning frame includes at least the downstream current processing capacity and the channel identifier of the target virtual channel; the second preset byte of the traffic warning frame is a distinguishing identifier, and the distinguishing identifier is used to distinguish the traffic warning frame from the traffic pause frame, and to identify the traffic speed limit capability of the traffic warning frame; A traffic rate limiting module, configured to control the upstream device to adjust the rate at which the data packets are sent to the target virtual channel to a first preset percentage of the processing rate corresponding to the current processing capacity of the downstream device according to the channel identifier when the upstream device receives the traffic warning frame before congestion occurs; A speed limit release module, configured to control the downstream device to send a speed limit release frame to the upstream device when detecting that the occupancy rate of the buffer of the target virtual channel is lower than the first preset threshold, wherein the speed limit release frame is used to enable the upstream device to restore the rate of sending the data packet, and the speed limit release frame at least includes the channel identifier of the target virtual channel; A first timing submodule, configured to control the downstream device to periodically send the speed limit release frame to the upstream device when the upstream device fails to normally receive the speed limit release frame and the occupancy rate of the buffer is lower than the first preset threshold; A traffic pause module, configured to control the downstream device to send a traffic pause frame to the upstream device after detecting that the occupancy rate of the buffer is higher than a second preset threshold value if the upstream device fails to respond to the traffic warning frame in time, or the upstream device does not have the ability to identify the traffic warning frame, wherein the traffic pause frame is used to pause the upstream device from sending the data packet; A sending pause module, used for controlling the upstream device to stop sending the data packet when the upstream device receives the traffic pause frame; Wherein, the flow rate limiting module is also used for: If the occupancy rate of the buffer is higher than the first preset threshold, control the downstream device to count the current cache increase rate and the downstream current processing capacity, and when the current cache increase rate is a positive value, periodically send the downstream current processing capacity to the upstream device; Controlling the upstream device to adjust the rate of sending the data packet according to the current processing capability of the downstream device; Wherein, the device is also used for: dynamically adjusting the first preset threshold and the second preset threshold according to the real-time status and historical data of the network; or, Use machine learning algorithms to predict when and where network congestion will occur; The first preset threshold and the second preset threshold are adjusted according to the time and location of occurrence of the network congestion.
8. An electronic device, characterized in that: include: processor; and, A memory having executable codes stored thereon, which, when executed, causes the processor to execute the network traffic control method according to any one of claims 1 to 6.
9. A machine-readable medium having executable codes stored thereon, which, when executed, causes a processor to execute the network traffic control method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the network traffic control method as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Congestion control method, equipment and system
CN117411833A
Congestion control method, terminal and readable storage medium
US20220078118A1