A data packet processing method, apparatus and device
By calculating the load factor in a specific protocol type buffer queue and generating redundant data packets, the problem of important data packet loss during network node congestion is solved, enabling priority sending and recovery of data packets and improving transmission quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NEUSOFT CORP
- Filing Date
- 2023-05-11
- Publication Date
- 2026-04-28
AI Technical Summary
When network nodes become congested, important data packets are easily dropped, leading to malfunctions in sensitive equipment such as industrial control devices.
By calculating the load factor in a specific protocol type buffer queue and generating redundant data packets, important data packets are sent first, and lost data packets are recovered using the redundant data packets.
It improves the transmission quality of data packets of specific protocol types, reduces the impact of data loss, and ensures the integrity of important data packets.
Smart Images

Figure CN116489108B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, specifically to a data packet processing method, apparatus, and device. Background Technology
[0002] Network nodes can forward data packets. When network nodes become congested, packet loss may occur. Packet loss is the main mechanism for notifying network nodes of congestion.
[0003] Currently, when network nodes lack sufficient resources to send data packets, they add the packets to a buffer queue. Based on this traditional buffer queue management mechanism, packet loss often occurs when the buffer queue is full. When the buffer queue is full, newly arriving data packets are discarded. Therefore, when network congestion occurs, a large number of data packets are dropped.
[0004] For some critical data packets, packet loss can have serious consequences. For example, industrial control equipment is highly sensitive to packet loss; the loss of industrial control protocol data packets may cause the equipment to malfunction or fail. Therefore, how to reduce the impact of data packet loss is an urgent technical problem to be solved. Summary of the Invention
[0005] In view of this, embodiments of this application provide a data packet processing method, apparatus, and device to reduce the impact of data packet loss.
[0006] To address the above problems, the technical solutions provided in this application are as follows:
[0007] A data packet processing method, the method comprising:
[0008] When a received data packet is added to a specific protocol type cache queue, the first load factor of the specific protocol type cache queue is determined based on the maximum number of data packets that the specific protocol type cache queue can hold and the number of data packets that have been added to the specific protocol type cache queue.
[0009] When the first load is greater than the first threshold, the first redundancy is determined based on the first load, and the first redundancy is positively correlated with the first load.
[0010] Redundant data packets are generated by using the target number of added data packets that are ranked first in the cache queue of the specific protocol type, wherein the target number is determined according to the first redundancy.
[0011] Send the target number of added data packets and the redundant data packets that are at the top of the cache queue for the specific protocol type.
[0012] In one possible implementation, the method further includes:
[0013] When a received data packet is added to the normal protocol type cache queue, the second load factor of the normal protocol type cache queue is determined based on the maximum number of data packets that the normal protocol type cache queue can hold and the number of data packets that have been added to the normal protocol type cache queue.
[0014] When the second load factor exceeds the second threshold, packets that continue to be added to the normal protocol type cache queue are dropped.
[0015] In one possible implementation, determining the first load factor of the specific protocol type cache queue based on the maximum number of packets that the specific protocol type cache queue can hold and the number of packets that have been added to the specific protocol type cache queue includes:
[0016] The first load factor of the specific protocol type cache queue is obtained by dividing the number of data packets already added in the specific protocol type cache queue by the maximum number of data packets that the specific protocol type cache queue can hold.
[0017] The step of determining the second load factor of the common protocol type cache queue based on the maximum number of data packets that the common protocol type cache queue can hold and the number of data packets that have been added to the common protocol type cache queue includes:
[0018] The second load factor of the ordinary protocol type cache queue is obtained by dividing the number of added data packets in the ordinary protocol type cache queue by the maximum number of data packets that the ordinary protocol type cache queue can hold, and then multiplying by the redundancy factor, where the redundancy factor is less than 1.
[0019] In one possible implementation, the redundancy coefficient is negatively correlated with the number of cache queues for the specific protocol type.
[0020] In one possible implementation, generating redundant data packets using the target number of added data packets prioritized in the specific protocol type cache queue includes:
[0021] Perform an XOR operation on the target number of added data packets that are ranked first in the cache queue of the specific protocol type to generate redundant data packets.
[0022] In one possible implementation, the number of redundant data packets generated is determined based on the current network packet loss rate.
[0023] In one possible implementation, the method further includes:
[0024] Upon receiving a data packet, if there are no resources available for transmission, the protocol type of the data packet is determined through the target field of the data packet.
[0025] When the protocol type of the data packet is a specific protocol type, the data packet is added to the specific protocol type cache queue;
[0026] When the protocol type of the data packet is a normal protocol type, the data packet is added to the normal protocol type cache queue.
[0027] A data packet processing apparatus, the apparatus comprising:
[0028] The first determining unit is configured to, when a received data packet is added to a specific protocol type cache queue, determine the first load factor of the specific protocol type cache queue based on the maximum number of data packets that the specific protocol type cache queue can hold and the number of data packets that have been added to the specific protocol type cache queue.
[0029] The second determining unit is used to determine a first redundancy based on the first load degree when the first load degree is greater than the first threshold degree, wherein the first redundancy degree is positively correlated with the first load degree.
[0030] A generation unit is used to generate redundant data packets using the target number of added data packets that are arranged at the front of the cache queue of the specific protocol type, wherein the target number is determined according to the first redundancy.
[0031] The sending unit is used to send the target number of added data packets and the redundant data packets that are ranked first in the cache queue of the specific protocol type.
[0032] A packet processing apparatus includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the packet processing method as described in any of the preceding claims.
[0033] A computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform the data packet processing method as described in any of the preceding claims.
[0034] Therefore, the embodiments of this application have the following beneficial effects:
[0035] This application embodiment utilizes a specific protocol type buffer queue to cache important specific protocol type data packets that are not yet sent. When a received data packet is added to the specific protocol type buffer queue, the first load level of the buffer queue is determined. When the first load level is greater than a first threshold, it indicates that the specific protocol type buffer queue has reached a certain level of congestion. Then, redundant data packets with a corresponding first redundancy level need to be generated based on the first load level. The added data packets and redundant data packets at the top of the specific protocol type buffer queue are then sent. This ensures that data packets in the specific protocol type buffer queue are sent first, and when specific protocol type data packets are lost, the redundant data packets can be used to recover the lost packets, improving the transmission quality of specific protocol type data packets and effectively reducing the impact of lost specific protocol type data packets. Attached Figure Description
[0036] Figure 1 A schematic diagram illustrating an exemplary application scenario provided in this application embodiment;
[0037] Figure 2 A flowchart illustrating a data packet processing method provided in an embodiment of this application;
[0038] Figure 3 A flowchart illustrating another data packet processing method provided in this application embodiment;
[0039] Figure 4 This is a schematic diagram of a data packet processing device provided in an embodiment of this application. Detailed Implementation
[0040] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the embodiments of this application will be further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0041] To facilitate understanding and explanation of the technical solutions provided in the embodiments of this application, the background technology of this application will be described first.
[0042] Network nodes, such as firewalls and routers, can forward data packets. When a network node does not have enough resources to send data packets, it adds the packets to a buffer queue. When the buffer queue is full, any newly received data packets will be dropped, resulting in packet loss.
[0043] For some critical data packets, packet loss can have serious consequences. For example, industrial control firewalls can forward industrial control protocol data packets to industrial control devices, which are highly sensitive to packet loss. The loss of industrial control protocol data packets may cause the industrial control devices to malfunction or fail.
[0044] Based on this, embodiments of this application provide a data packet processing method, apparatus, and device. These embodiments utilize a specific protocol type buffer queue to cache important specific protocol type data packets that are not yet being sent. When a received data packet is added to the specific protocol type buffer queue, a first load level of the buffer queue is first determined. When the first load level exceeds a first threshold, it indicates that the specific protocol type buffer queue has reached a certain level of congestion. Then, redundant data packets with a corresponding first redundancy level need to be generated based on the first load level. The added data packets and redundant data packets at the top of the specific protocol type buffer queue are then sent. This ensures that data packets in the specific protocol type buffer queue are sent first. Furthermore, when specific protocol type data packets are lost, redundant data packets can be used to recover the lost packets, improving the transmission quality of specific protocol type data packets and effectively reducing the impact of lost specific protocol type data packets.
[0045] To facilitate understanding of the data packet processing method provided in the embodiments of this application, the following is combined with... Figure 1 The example scenario is shown below. See also... Figure 1 As shown in the figure, this figure is a schematic diagram of an exemplary application scenario provided in the embodiments of this application.
[0046] This application embodiment can be applied to network nodes that have sending resources to transmit data packets, for example, by setting up a sending queue. It also sets up at least one specific protocol type cache queue and at least one general protocol type cache queue. After a network node receives a data packet, if there are insufficient sending resources to transmit the data packet, it adds the data packet to either the specific protocol type cache queue or the general protocol type cache queue according to the data packet type. The specific protocol type cache queue is used to cache more important specific protocol type data packets, while the general protocol type cache queue is used to cache ordinary general protocol type data packets. The specific protocol type cache queue has a higher priority than the general protocol type cache queue; that is, when sending resources are available, data packets in the specific protocol type cache queue are sent first, and if there are no data packets in the specific protocol type cache queue, then data packets in the general protocol type cache queue are sent.
[0047] For a specific protocol type buffer queue, calculate its first load factor. When the first load factor exceeds a first threshold, the buffer queue has reached a certain level of congestion. Redundant data packets with a corresponding first redundancy level need to be generated based on the first load factor. The first redundancy level is positively correlated with the first load factor; it determines how many redundant data packets are generated using the target number of packets at the top of the buffer queue. When it is possible to send data packets from the specific protocol type buffer queue, send the target number of packets at the top of the queue, along with the redundant data packets.
[0048] For the common protocol type buffer queue, calculate the second load factor. When the second load factor exceeds the second threshold, it indicates that the common protocol type buffer queue has reached a certain level of congestion. At this point, packets that are still being added to the common protocol type buffer queue are dropped.
[0049] This ensures that data packets in the specific protocol type buffer queue are sent first. At the same time, when a specific protocol type data packet is lost, the lost specific protocol type data packet can be recovered using redundant data packets, which improves the transmission quality of specific protocol type data packets and effectively reduces the impact of the loss of specific protocol type data packets.
[0050] Those skilled in the art will understand that Figure 1 The schematic diagram shown is merely one example in which embodiments of this application can be implemented. The scope of application of the embodiments of this application is not limited by any aspect of this framework.
[0051] To facilitate understanding of this application, a data packet processing method provided by an embodiment of this application will be described below with reference to the accompanying drawings.
[0052] See Figure 2 As shown, this figure is a flowchart of a data packet processing method provided in an embodiment of this application. Figure 2 As shown, the method may include S201-S204:
[0053] S201: When a received data packet is added to a specific protocol type buffer queue, determine the first load factor of the specific protocol type buffer queue based on the maximum number of data packets that the specific protocol type buffer queue can hold and the number of data packets that have been added to the specific protocol type buffer queue.
[0054] The network node is equipped with at least one specific protocol type cache queue and at least one general protocol type cache queue. When the network node receives a data packet, if there are not enough sending resources to send the data packet, and the data packet is a relatively important specific protocol type data packet, then the data packet is added to the specific protocol type cache queue.
[0055] In one possible implementation, prior to executing S201, the embodiments of this application may further include:
[0056] A1: Upon receiving a data packet, if there are no resources available for sending, the protocol type of the data packet is determined by the target field of the data packet.
[0057] In practical applications, network nodes have the resources to send data packets. For example, they may have a sending queue, where received data packets are added and sent in the order they appear in the queue. However, when there are insufficient sending resources, data packets cannot be sent. For instance, if the sending queue is full, received data packets cannot be sent immediately.
[0058] After receiving a data packet, a network node can first determine whether it can send the packet by checking if it has remaining sending resources. If there are remaining sending resources, the node can send the packet directly.
[0059] When transmission resources are unavailable, data packets cannot be sent. Instead, they must be added to either a specific protocol type buffer queue or a general protocol type buffer queue based on their protocol type. Generally, data packets include a target field indicating the protocol type. The protocol type of a data packet can be determined by reading the content of this target field. The protocol type of a data packet can be either a specific protocol type or a general protocol type; specific protocol types are considered important, while general protocol types are considered ordinary. If a data packet's protocol type is a specific protocol type, it can be called a specific protocol type data packet; if its protocol type is a general protocol type, it can be called a general protocol type data packet. For example, data packets in the industrial control field can be divided into industrial control protocol data packets and industrial control general protocol data packets. Industrial control protocol data packets are specific protocol type data packets, while industrial control general protocol data packets are general protocol type data packets.
[0060] A2: When the protocol type of the data packet is a specific protocol type, add the data packet to the specific protocol type cache queue.
[0061] A3: When the protocol type of the data packet is a normal protocol type, add the data packet to the normal protocol type cache queue.
[0062] When a data packet's protocol type is a specific protocol type, the packet is considered important and can be added to a higher-priority specific protocol type cache queue. Conversely, when a data packet's protocol type is a general protocol type, packet loss will not have a significant impact, and it can be added to a lower-priority general protocol type cache queue. In practical applications, data packets from the same flow can be added to the same cache queue. Data packets with the same source IP address, destination IP address, source port number, destination port number, and protocol number belong to the same flow.
[0063] This application embodiment divides data packets into specific protocol type data packets and ordinary protocol type data packets for separate processing, which can prioritize the transmission of more important data packets.
[0064] After adding received data packets to a specific protocol type buffer queue, it is necessary to determine the initial load capacity of that specific protocol type buffer queue. Generally, the maximum number of data packets a specific protocol type buffer queue can hold is predetermined. After a data packet is added to the specific protocol type buffer queue, the number of data packets already added to that specific protocol type buffer queue can be counted. Based on the maximum number of data packets that the specific protocol type buffer queue can hold and the number of data packets already added to that specific protocol type buffer queue, the initial load capacity of that specific protocol type buffer queue can be determined.
[0065] In one possible implementation, the first load factor of the specific protocol type buffer queue is determined based on the maximum number of packets that the specific protocol type buffer queue can hold and the number of packets already added to the specific protocol type buffer queue, including:
[0066] The first load factor of the specific protocol type cache queue is obtained by dividing the number of packets already added in the specific protocol type cache queue by the maximum number of packets that the specific protocol type cache queue can hold.
[0067] Let Total_queue_len be the maximum number of packets a specific protocol type buffer queue can hold, and queue_len be the number of packets currently added to the specific protocol type buffer queue. Then, the first load factor of this specific protocol type buffer queue is:
[0068] S202: When the first load degree is greater than the first threshold, the first redundancy degree is determined based on the first load degree. The first redundancy degree is positively correlated with the first load degree.
[0069] When the first load exceeds the first threshold, network congestion is considered to have occurred. Data packets in the specific protocol type's buffer queue may be lost, so a first redundancy level needs to be determined. The first redundancy level determines how many data packets to use to generate redundant data packets. The first redundancy level is positively correlated with the first load level. That is, a higher first load level corresponds to a higher first redundancy level, meaning more data packets are needed to generate redundant data packets to ensure that even if any data packet is lost, it can be recovered using redundant data packets. Furthermore, the first threshold can be set according to actual conditions; for example, the first threshold could be 50%. This application embodiment does not limit the value of the first threshold.
[0070] In practical applications, the first redundancy can also be related to the first threshold. Let the first load be queue_weight. OT Then the first redundancy OT for:
[0071]
[0072] Where n is the first threshold, n is less than 1, and [] is the rounding function. The minimum value of the first redundancy is 1, and the maximum value is 10.
[0073] For example, when the first threshold is 50%, then
[0074] If the first load factor is less than or equal to the first threshold, the network is considered to be in good condition and there is no need to generate redundant data packets. Therefore, it is not necessary to determine the first redundancy factor.
[0075] S203: Generate redundant data packets using the target number of added data packets that are at the top of the cache queue for a specific protocol type. The target number is determined based on the first redundancy.
[0076] After determining the initial redundancy, it is set as the target quantity. The target quantity of data packets is then retrieved from the current protocol-specific buffer queue to generate redundant data packets. Let x be the target quantity and y be the number of redundant data packets generated. Then, for x data packets and y redundant data packets, any y data packets lost can be recovered using x data packets and y redundant data packets. In some possible implementations, the value of the number of redundant data packets y can be determined based on the current network packet loss rate. Generally, y is set to 1. When the packet loss rate is higher than the packet loss rate threshold, the value of y can be increased. That is, the packet loss rate and the value of y are positively correlated; the higher the packet loss rate, the larger the value of y, thus generating more redundant data packets to recover lost data when the packet loss rate is high.
[0077] For example, when data packet g is received and added to a specific protocol type buffer queue, the queue contains data packets a, b, c, e, f, and g added sequentially. If the target quantity x is 3 and y is 1, then the first three packets (a, b, and c) are used to generate redundant data packets. If any one of the packets a, b, c, or the redundant data packet is lost, the other packets can be used to recover the lost packet.
[0078] In one possible implementation, the specific implementation of S203 generating redundant data packets by utilizing the target number of added data packets at the front of the cache queue for a specific protocol type may include:
[0079] Perform an XOR operation on the target number of added data packets at the top of the cache queue for a specific protocol type to generate redundant data packets.
[0080] In the XOR operation, if a character (or number) w is XORed with a number m to obtain z, then XORing z with m will restore w. Using this principle, data packets can be treated as strings, and a target number of added data packets can be XORed to generate redundant data packets.
[0081] Based on the example above, data packets a, b, and c are used to generate redundant data packet d. Redundant data packet d is obtained through an XOR operation, i.e., d = a∧b∧c. If any one of the four data packets a, b, c, or d is lost, it can be recovered by performing an XOR operation on the other three data packets, based on the mathematical properties of the XOR operation.
[0082] For example, if data packet a is lost, it can be obtained again by XORing data packets b, c, and d, that is, a = a∧(b∧b)∧(c∧c) = (a∧b∧c)∧b∧c = d∧b∧c.
[0083] S204: Send the target number of added data packets and redundant data packets that are at the front of the buffer queue for a specific protocol type.
[0084] When transmission resources are available, a target number of added data packets and redundant data packets can be sent from the buffer queue for a specific protocol type. For example, redundant data packet d can be generated using data packets a, b, and c. When the transmission queue is idle, data packets a, b, c, and redundant data packet d can be added to the transmission queue for transmission. It is understood that data packets a, b, c, and d are each marked with a corresponding relationship to the other three data packets, so the data packet receiver can reconstruct data packets a, b, c, and d after receiving any three of them.
[0085] Based on the descriptions in S201 to S204, this embodiment utilizes a specific protocol type cache queue to cache relatively important specific protocol type data packets that have not yet been sent. When a received data packet is added to the specific protocol type cache queue, a first load level of the cache queue is first determined. When the first load level is greater than a first threshold, it indicates that the specific protocol type cache queue has reached a certain level of congestion. Then, redundant data packets with a corresponding first redundancy level need to be generated based on the first load level. The added data packets and redundant data packets that are at the top of the specific protocol type cache queue are then sent. This ensures that data packets in the specific protocol type cache queue are sent first, and when specific protocol type data packets are lost, redundant data packets can be used to recover the lost packets, improving the transmission quality of specific protocol type data packets and effectively reducing the impact of lost specific protocol type data packets.
[0086] In one possible implementation, based on the above embodiments, the embodiments of this application may further include:
[0087] B1: When a received data packet is added to the normal protocol type buffer queue, the second load factor of the normal protocol type buffer queue is determined based on the maximum number of data packets that the normal protocol type buffer queue can hold and the number of data packets that have been added to the normal protocol type buffer queue.
[0088] After a network node receives a data packet, if there are insufficient sending resources to transmit the packet, and the packet is a regular protocol type packet, then the packet is added to the regular protocol type buffer queue. After adding the received packet to the regular protocol type buffer queue, the second load factor of the buffer queue needs to be determined. Generally, the maximum number of packets that a regular protocol type buffer queue can hold is predetermined. After a packet is added to the queue, the number of packets already added to the queue can be counted. Based on the maximum number of packets that the queue can hold and the number of packets already added, the second load factor of the regular protocol type buffer queue can be determined.
[0089] In one possible implementation, the specific implementation of B1 determining the second load factor of the normal protocol type buffer queue based on the maximum number of packets that the normal protocol type buffer queue can hold and the number of packets that have been added to the normal protocol type buffer queue may include:
[0090] Divide the number of data packets added to the ordinary protocol type buffer queue by the maximum number of data packets that the ordinary protocol type buffer queue can hold, and then multiply by the redundancy factor to obtain the second load factor of the ordinary protocol type buffer queue. The redundancy factor is less than 1.
[0091] For packets of common protocol types, network nodes prioritize sending packets in the specific protocol type buffer queue. Packets in the common protocol type buffer queue will wait until all packets in the specific protocol type buffer queue have been sent before being sent. Therefore, the second load factor for the common protocol type buffer queue, in addition to calculating the ratio of the number of packets added to the common protocol type buffer queue to the maximum capacity of the common protocol type buffer queue, also needs to be multiplied by a redundancy factor to adjust for the growth of the common protocol type buffer queue due to delayed transmission.
[0092] In one possible implementation, the redundancy coefficient is negatively correlated with the number of specific protocol type buffer queues. That is, the more specific protocol type buffer queues there are, the smaller the redundancy coefficient, and the smaller the second load factor of the general protocol type buffer queues. With a larger number of specific protocol type buffer queues, to reduce packet loss in the general protocol type buffer queues, the second load factor of the general protocol type buffer queues can be appropriately reduced during calculation, so that the general protocol type buffer queues only begin discarding packets after a significant number of packets have been added.
[0093] Specifically, redundancy can be calculated by dividing the number of cache queues for ordinary protocol types by the sum of the number of cache queues for specific protocol types and the number of cache queues for ordinary protocol types.
[0094] Let Total_queue_len be the maximum number of packets that a normal protocol type buffer queue can hold, queue_len be the number of packets currently added to the normal protocol type buffer queue, and queue_num be the number of specific protocol type buffer queues. OT The number of cache queues for ordinary protocol types is queue_num. NA Then the second load factor of the cache queue for this specific protocol type is:
[0095]
[0096] B2: When the second load factor is greater than the second threshold, packets that continue to be added to the normal protocol type buffer queue are dropped.
[0097] When the second load factor exceeds the second threshold, network congestion is considered to have occurred, and packets that continue to be added to the normal protocol type buffer queue are dropped. When the second load factor is less than or equal to the second threshold, the network condition is considered good, and packets in the normal protocol type buffer queue continue to wait to be sent. Furthermore, the second threshold can be set according to actual conditions, for example, the second threshold can be 50%. This application embodiment does not limit the value of the second threshold.
[0098] Based on the above explanation, if the maximum number of data packets that a specific protocol type buffer queue and a regular protocol type buffer queue can hold are the same, and the first threshold and the second threshold are the same, because a redundancy coefficient is used when calculating the second load factor, the number of data packets added to the regular protocol type buffer queue will be greater when the second threshold is reached than the number of data packets added to the specific protocol type buffer queue when the first threshold is reached. For example, if the maximum number of data packets that a specific protocol type buffer queue and a regular protocol type buffer queue can hold is 100, the second threshold is reached when 60 data packets have been added to the regular protocol type buffer queue, while the first threshold is reached when 50 data packets have been added to the specific protocol type buffer queue. Thus, with a larger number of specific protocol type buffer queues, the redundancy coefficient allows the regular protocol type buffer queue to start discarding data packets only after a larger number of data packets have been added.
[0099] In this embodiment of the application, when network congestion occurs, ordinary protocol type data packets are discarded, while more important specific protocol type data packets are given priority to be preserved, thereby improving the transmission quality of specific protocol type data packets and ensuring their integrity.
[0100] The following describes the data packet processing method provided in the embodiments of this application in conjunction with practical applications. See also: Figure 3 As shown, the data packet processing method may include:
[0101] S301: Determined that there are no resources available for sending.
[0102] When a network node does not have enough sending resources, it cannot send data packets and needs to add the received data packets to the corresponding buffer queue.
[0103] S302: Determine the protocol type of the data packet.
[0104] S303: When the protocol type of the data packet is a specific protocol type, add the data packet to the specific protocol type cache queue.
[0105] S304: Determine the first load factor of a specific protocol type cache queue.
[0106] Specifically, the first load factor of a specific protocol type cache queue is determined based on the maximum number of packets that can be accommodated in the specific protocol type cache queue and the number of packets that have been added to the specific protocol type cache queue.
[0107] S305: Determine whether the first load level is greater than the first threshold. If yes, execute S306; otherwise, execute S310.
[0108] S306: Determine the first redundancy based on the first load factor.
[0109] When the first load level is greater than the first threshold, network congestion is considered to have occurred. The first redundancy is determined based on the first load level, and the first redundancy is positively correlated with the first load level.
[0110] S307: Determine whether it is possible to send data packets in the buffer queue of a specific protocol type. If yes, execute S308; otherwise, return to S304.
[0111] S308: Generate redundant data packets based on the first redundancy level.
[0112] S309: Send data packets and redundant data packets from the buffer queue of a specific protocol type.
[0113] When there are sending resources capable of sending data packets in a specific protocol type buffer queue, redundant data packets are generated using the target number of added data packets that are ranked first in the specific protocol type buffer queue. The target number of added data packets and redundant data packets that are ranked first in the specific protocol type buffer queue are then sent, wherein the target number is determined based on a first redundancy.
[0114] S310: Determine whether it is possible to send data packets in the buffer queue of a specific protocol type. If yes, execute S311; otherwise, return to S304.
[0115] S311: Send data packets from the buffer queue of a specific protocol type.
[0116] When the first load is less than or equal to the first threshold, the network is considered to be in good condition. When there are transmission resources, the data packets in the specific protocol type cache queue can be sent according to the order of the data packets in the specific protocol type cache queue.
[0117] S312: When the protocol type of the data packet is a normal protocol type, add the data packet to the normal protocol type cache queue.
[0118] S313: Determine the second load factor of the normal protocol type buffer queue.
[0119] Specifically, the second load factor of the normal protocol type cache queue is determined based on the maximum number of data packets that the normal protocol type cache queue can hold and the number of data packets that have been added to the normal protocol type cache queue.
[0120] S314: Determine whether the second load level is greater than the second threshold. If yes, execute S315; otherwise, execute S316.
[0121] S315: Discard packets that are about to enter the normal protocol type buffer queue.
[0122] When the second load factor exceeds the second threshold, network congestion is considered to have occurred, and packets that continue to be added to the normal protocol type cache queue are dropped.
[0123] S316: Determine whether the data packet in the normal protocol type buffer queue can be sent. If yes, execute S317; otherwise, return to S313.
[0124] S317: Send data packets from the normal protocol type buffer queue.
[0125] When the second load factor is less than or equal to the second threshold, the network is considered to be in good condition. When there are transmission resources, the data packets in the ordinary protocol type buffer queue can be sent in the order of the data packets in the ordinary protocol type buffer queue.
[0126] The embodiments of this application can ensure that data packets in the cache queue of a specific protocol type are sent first. At the same time, when a specific protocol type data packet is lost, redundant data packets can be used to recover the lost specific protocol type data packet, thereby improving the transmission quality of the specific protocol type data packet and effectively reducing the impact of the loss of the specific protocol type data packet.
[0127] Based on the data packet processing method provided in the above embodiments, this application also provides a data packet processing apparatus, which will be described below with reference to the accompanying drawings.
[0128] See Figure 4 As shown, this figure is a schematic diagram of the structure of a data packet processing device provided in an embodiment of this application. Figure 4 As shown, the data packet processing device includes:
[0129] The first determining unit 401 is used to determine the first load factor of the specific protocol type cache queue when the received data packet is added to the specific protocol type cache queue, based on the maximum number of data packets that the specific protocol type cache queue can hold and the number of data packets that have been added to the specific protocol type cache queue.
[0130] The second determining unit 402 is used to determine a first redundancy based on the first load degree when the first load degree is greater than the first threshold degree, wherein the first redundancy degree is positively correlated with the first load degree.
[0131] The generation unit 403 is used to generate redundant data packets using the target number of added data packets that are arranged at the front of the specific protocol type cache queue, wherein the target number is determined according to the first redundancy.
[0132] The sending unit 404 is used to send the target number of added data packets and the redundant data packets that are ranked first in the specific protocol type cache queue.
[0133] In one possible implementation, the device further includes:
[0134] The third determining unit is used to determine the second load factor of the ordinary protocol type cache queue when the received data packet is added to the ordinary protocol type cache queue, based on the maximum number of data packets that the ordinary protocol type cache queue can hold and the number of data packets that have been added to the ordinary protocol type cache queue.
[0135] The discard unit is used to discard packets that continue to be added to the normal protocol type cache queue when the second load factor is greater than the second threshold.
[0136] In one possible implementation, the first determining unit is specifically used for:
[0137] The first load factor of the specific protocol type cache queue is obtained by dividing the number of data packets already added in the specific protocol type cache queue by the maximum number of data packets that the specific protocol type cache queue can hold.
[0138] The third determining unit is specifically used for:
[0139] The second load factor of the ordinary protocol type cache queue is obtained by dividing the number of data packets added in the ordinary protocol type cache queue by the maximum number of data packets that the ordinary protocol type cache queue can hold, and then multiplying by the redundancy factor, where the redundancy factor is less than 1.
[0140] In one possible implementation, the redundancy coefficient is negatively correlated with the number of cache queues for the specific protocol type.
[0141] In one possible implementation, the generation unit is specifically used for:
[0142] Perform an XOR operation on the target number of added data packets that are ranked first in the cache queue of the specific protocol type to generate redundant data packets.
[0143] In one possible implementation, the number of redundant data packets generated is determined based on the current network packet loss rate.
[0144] In one possible implementation, the device further includes:
[0145] The judgment unit is used to determine whether the data packet can be sent at the current time after receiving the data packet;
[0146] The fourth determining unit is used to determine the protocol type of the data packet by means of the target field of the data packet when the data packet cannot be sent.
[0147] The first adding unit is used to add the data packet to the specific protocol type cache queue when the protocol type of the data packet is a specific protocol type;
[0148] The second adding unit is used to add the data packet to the normal protocol type cache queue when the protocol type of the data packet is a normal protocol type.
[0149] In addition, this application embodiment also provides a data packet processing device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the data packet processing method as described in any of the above claims.
[0150] In addition, embodiments of this application also provide a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform the data packet processing method as described in any of the preceding claims.
[0151] In this embodiment, a specific protocol type cache queue is used to cache important specific protocol type data packets that have not yet been sent. When a received data packet is added to the specific protocol type cache queue, the first load level of the cache queue is determined. When the first load level is greater than a first threshold, it indicates that the specific protocol type cache queue has reached a certain level of congestion. Then, redundant data packets with a corresponding first redundancy level need to be generated based on the first load level. The added data packets and redundant data packets at the top of the specific protocol type cache queue are then sent. This ensures that data packets in the specific protocol type cache queue are sent first, and when specific protocol type data packets are lost, redundant data packets can be used to recover the lost packets, improving the transmission quality of specific protocol type data packets and effectively reducing the impact of lost specific protocol type data packets.
[0152] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems or apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.
[0153] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0154] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0155] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0156] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data packet processing method, characterized in that, The method includes: When a received data packet is added to a specific protocol type cache queue, the first load factor of the specific protocol type cache queue is determined based on the maximum number of data packets that the specific protocol type cache queue can hold and the number of data packets that have been added to the specific protocol type cache queue. When the first load is greater than the first threshold, the first redundancy is determined based on the first load, and the first redundancy is positively correlated with the first load. Redundant data packets are generated by using the target number of added data packets that are ranked first in the cache queue of the specific protocol type, wherein the target number is determined according to the first redundancy. Send the target number of added data packets and the redundant data packets that are at the top of the cache queue for the specific protocol type.
2. The method according to claim 1, characterized in that, The method further includes: When a received data packet is added to the normal protocol type cache queue, the second load factor of the normal protocol type cache queue is determined based on the maximum number of data packets that the normal protocol type cache queue can hold and the number of data packets that have been added to the normal protocol type cache queue. When the second load factor exceeds the second threshold, packets that continue to be added to the normal protocol type cache queue are dropped.
3. The method according to claim 2, characterized in that, The step of determining the first load factor of the specific protocol type cache queue based on the maximum number of data packets that the specific protocol type cache queue can hold and the number of data packets that have been added to the specific protocol type cache queue includes: The first load factor of the specific protocol type cache queue is obtained by dividing the number of data packets already added in the specific protocol type cache queue by the maximum number of data packets that the specific protocol type cache queue can hold. The step of determining the second load factor of the common protocol type cache queue based on the maximum number of data packets that the common protocol type cache queue can hold and the number of data packets that have been added to the common protocol type cache queue includes: The second load factor of the ordinary protocol type cache queue is obtained by dividing the number of added data packets in the ordinary protocol type cache queue by the maximum number of data packets that the ordinary protocol type cache queue can hold, and then multiplying by the redundancy factor, where the redundancy factor is less than 1.
4. The method according to claim 3, characterized in that, The redundancy coefficient is negatively correlated with the number of cache queues for the specific protocol type.
5. The method according to claim 1, characterized in that, The step of generating redundant data packets by utilizing the target number of added data packets ranked first in the cache queue of the specific protocol type includes: Perform an XOR operation on the target number of added data packets that are ranked first in the cache queue of the specific protocol type to generate redundant data packets.
6. The method according to claim 1 or 5, characterized in that, The number of redundant data packets generated is determined based on the current network packet loss rate.
7. The method according to claim 1, characterized in that, The method further includes: Upon receiving a data packet, if there are no resources available for transmission, the protocol type of the data packet is determined through the target field of the data packet. When the protocol type of the data packet is a specific protocol type, the data packet is added to the specific protocol type cache queue; When the protocol type of the data packet is a normal protocol type, the data packet is added to the normal protocol type cache queue.
8. A data packet processing apparatus, characterized in that, The device includes: The first determining unit is configured to, when a received data packet is added to a specific protocol type cache queue, determine the first load factor of the specific protocol type cache queue based on the maximum number of data packets that the specific protocol type cache queue can hold and the number of data packets that have been added to the specific protocol type cache queue. The second determining unit is used to determine a first redundancy based on the first load degree when the first load degree is greater than the first threshold degree, wherein the first redundancy degree is positively correlated with the first load degree. A generation unit is used to generate redundant data packets using the target number of added data packets that are arranged at the front of the cache queue of the specific protocol type, wherein the target number is determined according to the first redundancy. The sending unit is used to send the target number of added data packets and the redundant data packets that are ranked first in the cache queue of the specific protocol type.
9. A data packet processing device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the data packet processing method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the data packet processing method as described in any one of claims 1-7.
Citation Information
Patent Citations
MPQUIC data packet rapid transmission method and system based on priority level queue
CN113783942A
Data processing method and related equipment
CN114513418A