Packet Processing Method and Apparatus, Storage Medium, and Processor
By building a target packet queue with a longer length and no less than the number of processors and locking it, the packet loss problem when there are fewer packet queues is solved, and the full utilization of processors and the improvement of packet processing effect is achieved.
Patent Information
- Application Number
- CN202211373714.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-03
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-11-03
AI Technical Summary
In the prior art, packet loss is prone to occur when processing data packets using a data plane development kit, and when the number of data packets is smaller than that of processors, it is difficult to fully utilize the performance of the processor, resulting in poorer results in processing data packets.
By acquiring multiple packet queues that have not been locked, a target queue set is constructed, where the length of each queue is greater than the initial queue, the number is not less than the number of processors, and each queue is locked, and then packet processing is performed through multiple processors.
Avoid packet loss, make full use of the processor's performance, and improve the effectiveness of packet processing.
Smart Images

Figure CN115834505B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and in particular, to a method and apparatus for processing data packets, a storage medium, and a processor. Background Art
[0002] DPDK, the full name of which is Intel Data Plane Development Kit, is called the data plane development kit in Chinese. It is a data platform development toolset provided by Intel Corporation, providing library functions and driver support for efficient data packet processing in the user space under the Intel Architecture (IA) processor architecture. Generally speaking, it is a software library for accelerating data packet processing.
[0003] In addition, different from the Linux system (an operating system) which is designed for generality, DPDK focuses on the high-performance processing of data packets in network applications. Specifically, DPDK application programs run in the user space and use the data plane library provided by themselves to receive and send data packets, bypassing the Linux kernel protocol stack for the data packet processing process, thereby greatly improving the data packet forwarding performance of the Data Plane.
[0004] Moreover, in the related art, when using the data plane development kit, traffic is processed at high speed by binding the Data Plane core (processor) to the DPDK rx queue (a data packet queue provided by the data plane development kit, and all data packets in this data packet queue are data packets to be processed) one by one. Specifically, network intermediate devices such as firewalls bind the network card DPDK rx queue to the Data Plane forwarding core (processor) for the sake of maintaining the order. And Figure 1 is a schematic diagram of processing data packets provided according to the prior art. As Figure 1 shown, a many-to-one relationship is formed between the queue and the core, and then the Data Plane core traverses all rx queues and polls to fetch packets from the DPDK rx queue for processing, ensuring that a single flow will only be processed by a single core, thereby maintaining the order of data packets logically in software.
[0005] However, when a forwarding core takes a long time to process application-layer traffic, it may cause the corresponding DPDK rx queue to not be scheduled for a long time, resulting in the rx queue being full and packet loss, thus causing network fluctuations. Of course, we can also alleviate this problem by increasing the length of the rx queue. Since the mbufs required by the DPDK rx queue (resources allocated to data packets) need to be pre-allocated, the cost of this is consuming a large amount of mbufs, which is the common method of trading space for time. When there are many network device interfaces, it will occupy a large amount of memory, resulting in a sharp reduction in the available memory of the device.
[0006] Moreover, when the core and the queue do not correspond or the rx queue traffic is uneven, it will cause uneven utilization of the CPU (central processing unit). For example, Figure 2 is a schematic diagram showing uneven CPU utilization when the core and the queue do not correspond or the rx queue traffic is uneven in the prior art. As Figure 2 shown, the network card has only two queues, but there are 3 forwarding cores, which will cause 1 core to be idle all the time, thus wasting the processor performance.
[0007] In addition, in the related art, when using the Data Plane Development Kit, by locking the DPDK rx queue, it can be ensured that all rx queues can be processed by all Data Plane forwarding cores. For example, Figure 3 is another schematic diagram of processing data packets according to the prior art. As Figure 3 shown, by locking the DPDK rx queue, all Data Plane forwarding cores can poll and process all DPDK rx queues, which can solve the problem of uneven CPU utilization.
[0008] However, the method of locking the DPDK rx queue still cannot solve the problem that the single core has a long processing time, resulting in the rx queue being full and causing network card packet loss; and if the number of queues is less than the number of cores, then there will always be cores in an idle state and the CPU performance cannot be fully utilized.
[0009] Regarding the problem that packet loss easily occurs when using the Data Plane Development Kit to process data packets in the related art, and when the number of data packet queues is less than the number of processors, it is difficult to fully utilize the performance of the processors, thus resulting in a poor effect of processing data packets, no effective solution has been proposed yet. Summary of the Invention
[0010] The main objective of the present application is to provide a method and apparatus for processing data packets, a storage medium, and a processor, so as to solve the problem that packet loss easily occurs when processing data packets using a data plane development kit in the related art, and when the number of data packet queues is less than the number of processors, it is difficult to fully utilize the performance of the processors, thereby resulting in poor effects in processing data packets.
[0011] To achieve the above objective, according to one aspect of the present application, a method for processing data packets is provided. The method includes: obtaining a plurality of first data packet queues, where each first data packet queue at least includes a plurality of data packets to be processed in a data plane development kit, the length of each first data packet queue is a first preset length, the number of the first data packet queues is less than the number of processors, the processors are used to process the data packets, and each first data packet queue is an unlocked data packet queue; obtaining a target queue set based on the plurality of first data packet queues, where the target queue set at least includes a plurality of target data packet queues, the length of each target data packet queue is a second preset length, the second preset length is greater than the first preset length, the number of the target data packet queues is not less than the number of processors, and each target data packet queue is an unlocked data packet queue; performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues; and processing each target data packet queue through the plurality of processors based on the plurality of locked target data packet queues to obtain processed data packets.
[0012] Further, obtaining a target queue set based on the plurality of first data packet queues includes: moving the data packets in the plurality of first data packet queues to a plurality of second data packet queues, where the length of the second data packet queues is greater than the length of the first data packet queues; performing a hashing process on the data packets in each second data packet queue to obtain a plurality of target data packet queues; and performing a summarization process on the plurality of target data packet queues to obtain the target queue set.
[0013] Further, after obtaining the plurality of first data packet queues, the method further includes: performing a locking process on each first data packet queue to obtain a plurality of locked first data packet queues; performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues includes: releasing the locking process on each locked first data packet queue; traversing the plurality of target data packet queues to obtain a traversal result; and performing a locking process on each target data packet queue based on the traversal result to obtain a plurality of locked target data packet queues.
[0014] Further, based on multiple locked target data packet queues, each target data packet queue is processed by multiple said processors to obtain processed data packets, including: obtaining data packets to be processed from each target data packet queue based on multiple locked target data packet queues; determining a target processor from multiple said processors, wherein the utilization rate of the target processor is less than a preset utilization rate; and processing the obtained data packets to be processed by the target processor to obtain processed data packets.
[0015] Further, before moving the data packets in multiple first data packet queues to multiple second data packet queues, the method further includes: determining the second preset length; and constructing multiple second data packet queues based on the data packets in multiple first data packet queues in combination with the second preset length.
[0016] Further, performing hashing processing on the data packets in each second data packet queue to obtain multiple target data packet queues, including: obtaining five-tuple information of each data packet in each second data packet queue; and performing hashing processing on the data packets in each second data packet queue according to the five-tuple information to obtain multiple target data packet queues.
[0017] Further, obtaining multiple first data packet queues includes: obtaining multiple target traffic flows; obtaining a data packet set according to the multiple target traffic flows, wherein the data packet set at least includes multiple data packets to be processed; determining resources pre-allocated to each data packet to be processed; determining the first preset length according to the resources pre-allocated to each data packet to be processed; and obtaining multiple first data packet queues based on the data packet set in combination with the first preset length.
[0018] To achieve the above object, according to another aspect of the present application, there is provided a device for processing data packets. The device includes: a first acquisition unit configured to acquire a plurality of first data packet queues, wherein each first data packet queue includes at least a plurality of data packets to be processed in the data plane development kit, the length of each first data packet queue is a first preset length, the number of the first data packet queues is less than the number of processors for processing the data packets, and each first data packet queue is an unlocked data packet queue; a first determination unit configured to obtain a target queue set based on the plurality of first data packet queues, wherein the target queue set includes at least a plurality of target data packet queues, the length of each target data packet queue is a second preset length, the second preset length is greater than the first preset length, the number of the target data packet queues is not less than the number of processors, and each target data packet queue is an unlocked data packet queue; a first processing unit configured to perform a locking process on each target data packet queue to obtain a plurality of locked target data packet queues; and a second processing unit configured to process each target data packet queue through the plurality of processors based on the plurality of locked target data packet queues to obtain processed data packets.
[0019] Further, the first determination unit includes: a first moving module configured to move the data packets in the plurality of first data packet queues to a plurality of second data packet queues, wherein the length of the second data packet queue is greater than the length of the first data packet queue; a first processing module configured to perform a hashing process on the data packets in each second data packet queue to obtain a plurality of target data packet queues; and a second processing module configured to perform a summarization process on the plurality of target data packet queues to obtain the target queue set.
[0020] Further, the device further includes: a third processing unit configured to perform a locking process on each first data packet queue after acquiring the plurality of first data packet queues to obtain a plurality of locked first data packet queues; the first processing unit includes: a third processing module configured to perform a release process on each locked first data packet queue; a first traversal module configured to traverse the plurality of target data packet queues to obtain a traversal result; and a fourth processing module configured to perform a locking process on each target data packet queue based on the traversal result to obtain a plurality of locked target data packet queues.
[0021] Further, the second processing unit includes: a first obtaining module, configured to obtain, based on a plurality of locked target data packet queues, data packets to be processed from each target data packet queue; a first determining module, configured to determine a target processor from the plurality of processors, where the utilization rate of the target processor is less than a preset utilization rate; and a fifth processing module, configured to process the obtained data packets to be processed through the target processor to obtain processed data packets.
[0022] Further, the apparatus further includes: a second determining unit, configured to determine the second preset length before moving the data packets in the plurality of first data packet queues to the plurality of second data packet queues; and a first constructing unit, configured to construct the plurality of second data packet queues based on the data packets in the plurality of first data packet queues in combination with the second preset length.
[0023] Further, the first processing module includes: a first obtaining sub-module, configured to obtain quintuple information of each data packet in each second data packet queue; and a first processing sub-module, configured to perform hashing processing on the data packets in each second data packet queue according to the quintuple information to obtain a plurality of target data packet queues.
[0024] Further, the first obtaining unit includes: a second obtaining module, configured to obtain a plurality of target traffic flows; a second determining module, configured to obtain a data packet set according to the plurality of target traffic flows, where the data packet set at least includes a plurality of data packets to be processed; a third determining module, configured to determine resources pre-allocated to each data packet to be processed; a fourth determining module, configured to determine the first preset length according to the resources pre-allocated to each data packet to be processed; and a fifth determining module, configured to obtain a plurality of first data packet queues based on the data packet set in combination with the first preset length.
[0025] To achieve the above object, according to another aspect of the present application, there is provided a computer-readable storage medium storing a program, where the program executes the data packet processing method described in any one of the above.
[0026] To achieve the above object, according to another aspect of the present application, there is provided a processor for running a program, where the program executes the data packet processing method described in any one of the above when running.
[0027] Through this application, the following steps are adopted: obtaining a plurality of first data packet queues, where each first data packet queue includes at least a plurality of data packets to be processed in the data plane development kit, the length of each first data packet queue is a first preset length, the number of first data packet queues is less than the number of processors, and the processors are used to process data packets, and each first data packet queue is an unlocked data packet queue; obtaining a target queue set based on the plurality of first data packet queues, where the target queue set includes at least a plurality of target data packet queues, the length of each target data packet queue is a second preset length, the second preset length is greater than the first preset length, the number of target data packet queues is not less than the number of processors, and each target data packet queue is an unlocked data packet queue; performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues; and processing each target data packet queue through a plurality of processors based on the plurality of locked target data packet queues to obtain processed data packets, which solves the problem of easy packet loss when processing data packets using the data plane development kit in the related art, and when the number of data packet queues is less than the number of processors, it is difficult to fully utilize the performance of the processors, resulting in a poor effect of processing data packets. By obtaining a target queue set based on the obtained plurality of first data packet queues, and the length of each target data packet queue in the target queue set is greater than the length of the first data packet queue, packet loss is avoided when processing data packets using the data plane development kit, and the number of target data packet queues is not less than the number of processors used to process data packets, and a locking process is performed on each target data packet queue to obtain a plurality of locked target data packet queues, and then each target data packet queue is processed through a plurality of processors, so as to fully utilize the performance of the processors, thereby improving the effect of processing data packets. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings, which form a part of this application, are used to provide a further understanding of this application. The schematic embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation to this application. In the accompanying drawings:
[0029] Figure 1 is a schematic diagram of processing data packets provided according to the prior art;
[0030] Figure 2 is a schematic diagram of uneven CPU utilization caused by non-corresponding cores and queues or uneven rx queue traffic in the prior art;
[0031] Figure 3 is another schematic diagram of processing data packets provided according to the prior art;
[0032] Figure 4It is a flowchart of a method for processing data packets provided by an embodiment of the present application;
[0033] Figure 5 It is the process of a method for processing data packets provided by an embodiment of the present application Figure 1 ;
[0034] Figure 6 It is a schematic diagram of transferring a data packet to be processed from the DPDK rx queue to the localqueue queue in an embodiment of the present application;
[0035] Figure 7 It is a schematic diagram of locking the local queue in an embodiment of the present application;
[0036] Figure 8 It is a flowchart of an optional method for processing data packets provided by an embodiment of the present application;
[0037] Figure 9 It is a schematic diagram of a data packet processing device provided by an embodiment of the present application. Detailed implementation manners
[0038] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the drawings and in combination with the embodiments.
[0039] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances for the embodiments of the present application described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0041] Example 1
[0042] The present invention will be described below in conjunction with preferred implementation steps. Figure 4 is a flowchart of a method for processing data packets provided by an embodiment of the present application. As Figure 4 shown, the method includes the following steps:
[0043] Step S401: Obtain a plurality of first data packet queues. Each first data packet queue includes at least a plurality of data packets to be processed in the data plane development kit. The length of each first data packet queue is a first preset length. The number of first data packet queues is less than the number of processors. The processors are used to process data packets. Each first data packet queue is an unlocked data packet queue.
[0044] For example, when the number of DPDK rx queue queues is less than the number of Data Plane cores (processors), obtain a plurality of DPDK rx queue queues (the above-mentioned first data packet queues) provided by the data plane development kit. Moreover, there are a plurality of data packets to be processed in the DPDKrx queue queue. The DPDK rx queue queue is an unlocked data packet queue, and the resources allocated to the data packets in the DPDK rx queue queue are pre-allocated.
[0045] Step S402: Obtain a target queue set based on the plurality of first data packet queues. The target queue set includes at least a plurality of target data packet queues. The length of each target data packet queue is a second preset length. The second preset length is greater than the first preset length. The number of target data packet queues is not less than the number of processors. Each target data packet queue is an unlocked data packet queue.
[0046] For example, the mbuf address (data packet to be processed) is moved from the DPDK rx queue to a new data packet queue by the Data Plane core, and the obtained new data packet queue is processed to obtain a final data packet queue (the above-mentioned target data packet queue). And the above-mentioned target queue set can be composed of a plurality of final data packet queues. Moreover, the above-mentioned target data packet queue does not require pre-allocation of mbuf resources, so the length of the above-mentioned target data packet queue can be set relatively long, that is, it can be set longer than the length of the DPDK rx queue queue (the above-mentioned first data packet queue). In addition, the number of the above-mentioned target data packet queues is also more than the number of DPDK rx queue queues (the above-mentioned first data packet queues), and more than the number of Data Plane cores (processors). The above-mentioned target data packet queue is also an unlocked data packet queue.
[0047] Step S403: Lock each target data packet queue to obtain multiple locked target data packet queues.
[0048] For example, lock each of the above-mentioned target data packet queues to obtain the data packet queues after the locking process.
[0049] Step S404: Based on the multiple locked target data packet queues, process each target data packet queue through multiple processors to obtain the processed data packets.
[0050] For example, retrieve the mbuf (data packet to be processed) from the data packet queue after the locking process, and process the retrieved data packet to be processed through the processor to obtain the processed data packet.
[0051] Through the above steps S401 to S404, by obtaining a plurality of first data packet queues, a target queue set is obtained. The length of each target data packet queue in the target queue set is greater than the length of the first data packet queue. Therefore, when processing data packets using the data plane development kit, the problem of packet loss is avoided, and the number of target data packet queues is not less than the number of processors for processing data packets. Each target data packet queue is locked to obtain multiple locked target data packet queues, and then each target data packet queue is processed through multiple processors, thereby making full use of the performance of the processors, and further improving the effect of processing data packets.
[0052] In order to construct multiple second data packet queues quickly and accurately, in the data packet processing method provided in the embodiment of the present application, multiple second data packet queues can also be constructed through the following steps: determine the second preset length; based on the data packets in the multiple first data packet queues, construct multiple second data packet queues in combination with the second preset length.
[0053] For example, since the data packet queues to be newly constructed do not need to pre-allocate resources, first determine the length of the data packet queues to be newly constructed, and set the length of the data packet queues to be newly constructed to be longer. The length of the newly constructed data packet queues needs to be set longer than the length of the DPDK rx queue (the above-mentioned first data packet queue). Subsequently, the data packets to be processed are transported from the DPDK rx queue to the newly constructed data packet queues with a longer set length (the above-mentioned second data packet queues) through the Data Plane forwarding core.
[0054] In summary, by increasing the length setting of the data packet queues, the tolerance of the device to bursty network traffic is greatly increased, and the phenomenon of packet loss can be avoided.
[0055] Figure 5It is the flow of the data packet processing method provided by the embodiments of the present application Figure 1 , as Figure 5 shown, in the data packet processing method provided by the embodiments of the present application, obtaining a target queue set based on multiple first data packet queues includes:
[0056] Step S501, moving the data packets in multiple first data packet queues to multiple second data packet queues, where the length of the second data packet queue is greater than the length of the first data packet queue;
[0057] Step S502, performing hash processing on the data packets in each second data packet queue to obtain multiple target data packet queues;
[0058] Step S503, performing summarization processing on multiple target data packet queues to obtain a target queue set.
[0059] For example, Figure 6 is a schematic diagram of moving the data packets to be processed from the DPDK rx queue to the local queue in the embodiments of the present application. As Figure 6 shown, first obtain the DPDK queue lock (indicating the queue after locking the DPDK rx queue), and then use the data plane forwarding core to move the mbuf address from the DPDK rx queue to the local queue (the above-mentioned second data packet queue) (note: the local queue is a lock-free queue similar to the rx queue), and then perform hash processing to obtain multiple local queue queues (the above-mentioned target data packet queues), and then summarize multiple local queue queues to obtain the above-mentioned target queue set.
[0060] In summary, the data packets to be processed can be quickly and accurately moved to the data packet queue with a longer length.
[0061] In order to quickly and accurately obtain multiple target data packet queues, in the data packet processing method provided by the embodiments of the present application, multiple target data packet queues can also be obtained through the following steps: obtaining the five-tuple information of each data packet in each second data packet queue; and performing hash processing on the data packets in each second data packet queue according to the five-tuple information to obtain multiple target data packet queues.
[0062] For example, after the Data Plane forwarding core moves the mbuf address from the DPDK rx queue to the local queue (note: the local queue is a lock-free queue similar to the rx queue), hashing processing can be performed based on the five-tuple of the packet (source IP information, destination IP information, source port information, destination port information, and protocol) or other methods.
[0063] In summary, by performing hashing processing on the queues, it can be ensured that the same flow is hashed into the same localqueue queue.
[0064] In order to quickly and accurately obtain multiple locked target packet queues, in the packet processing method provided in the embodiment of the present application, multiple locked target packet queues can also be obtained through the following steps: perform locking processing on each first packet queue to obtain multiple locked first packet queues; performing locking processing on each target packet queue to obtain multiple locked target packet queues includes: releasing the processing of each locked first packet queue; traversing multiple target packet queues to obtain a traversal result; based on the traversal result, performing locking processing on each target packet queue to obtain multiple locked target packet queues.
[0065] For example, Figure 7 is a schematic diagram of locking the local queue queue in the embodiment of the present application. As Figure 7 shown, release the DPDK queue lock, traverse all local queues, and attempt to obtain the local queue lock (indicating the queue after locking the local queue queue). After obtaining the corresponding local queue lock, then take out the mbuf (the packet to be processed) from the localqueue for processing.
[0066] Through the above solution, when a certain Data Plane forwarding core is relatively busy, other cores (processors) can process the DPDK rx queue, avoiding packet loss caused by the queue being full due to long-term lack of processing. In addition, all DPDKrx queues and local queues are equal to the Data Plane forwarding core, and it can make full use of the processing performance of the core (processor).
[0067] In order to obtain multiple first data packet queues quickly and accurately, in the data packet processing method provided in the embodiments of the present application, multiple first data packet queues can also be obtained through the following steps: Obtain multiple target traffic flows; Based on the multiple target traffic flows, obtain a data packet set, where the data packet set at least includes multiple data packets to be processed; Determine the resources pre-allocated to each data packet to be processed; Based on the resources pre-allocated to each data packet to be processed, determine a first preset length; Combine the first preset length, and based on the data packet set, obtain multiple first data packet queues.
[0068] For example, traffic information is obtained, and based on the obtained traffic information, multiple data packets to be processed are formed. Then, the resource information pre-allocated to each data packet is obtained, and based on the resource information pre-allocated to each data packet, the length information of the DPDK rx queue (the above-mentioned first data packet queue) is determined. Then, based on the length information of the DPDK rx queue (the above-mentioned first data packet queue) and the multiple data packets to be processed, multiple DPDK rx queues (the above-mentioned first data packet queues) are formed.
[0069] Through the above solution, multiple DPDK rx queues (the above-mentioned first data packet queues) provided by the data plane development kit can be obtained quickly and accurately.
[0070] In order to obtain the processed data packets quickly and accurately, in the data packet processing method provided in the embodiments of the present application, the processed data packets can also be obtained through the following steps: Based on multiple locked target data packet queues, obtain the data packets to be processed from each target data packet queue; Determine a target processor from multiple processors, where the utilization rate of the target processor is less than a preset utilization rate; Process the obtained data packets to be processed through the target processor to obtain the processed data packets.
[0071] For example, in a scenario where the traffic is uneven, a processor that is not in a busy state or a blocked state can be determined from multiple processors, and the data packets to be processed are processed through the determined processor that is not in a busy state or a blocked state.
[0072] Through the above solution, for a scenario where the traffic is uneven, the device CPU can process evenly, and for individual cores (processors) that are in a busy or blocked state, other cores (processors) can also normally forward and process network traffic.
[0073] For example, Figure 8 is a flowchart of an optional data packet processing method provided in the embodiments of the present application, as Figure 8As shown, when the number of DPDK rx queue queues is less than the number of Data Plane cores (processors), and when the traffic is uneven (i.e., the traffic is 1Mbps and 10Gbps respectively), multiple DPDK rx queue queues (the above-mentioned first data packet queues) provided by the data plane development kit are obtained. Subsequently, the data packets to be processed are transferred from the DPDK rx queue queue to the local queue queue by the Data Plane forwarding core (note: local queue is a lock-free queue similar to rx queue), and then hash processing can be performed according to the five-tuple of the packet (source IP information, destination IP information, source port information, destination port information, and protocol) or other methods. Then release the DPDK queue lock (the queue after locking the DPDK rx queue queue), and then traverse all local queue queues, try to obtain the local queue lock (the queue after locking the local queue queue). When the corresponding local queue lock is obtained, the data packets to be processed are taken out from the local queue for processing. And when processing the data packets, when a certain Data Plane forwarding core (processor) is relatively busy, the data packets are processed by other cores (processors). In addition, Figure 8 "Same core" in Figure 8 means the same processor. And, through the above solution, the packet loss problem caused by the accumulation of DPDK rx queue queues due to the excessive time-consuming of application layer security detection in the case of large throughput can be greatly reduced, and the problem of uneven CPU utilization can be completely solved.
[0074] In summary, for the method for processing data packets provided in the embodiments of the present application, by obtaining a plurality of first data packet queues, where each first data packet queue at least includes a plurality of data packets to be processed in the data plane development kit, the length of each first data packet queue is a first preset length, the number of first data packet queues is less than the number of processors, and the processors are used to process data packets, and each first data packet queue is an unlocked data packet queue; according to the plurality of first data packet queues, a target queue set is obtained, where the target queue set at least includes a plurality of target data packet queues, the length of each target data packet queue is a second preset length, the second preset length is greater than the first preset length, the number of target data packet queues is not less than the number of processors, and each target data packet queue is an unlocked data packet queue; for each target data packet queue, it solves the problem that packet loss easily occurs when processing data packets using the data plane development kit in the related art, and when the number of data packet queues is less than the number of processors, it is difficult to fully utilize the performance of the processors, thereby resulting in a poor effect of processing data packets. By obtaining a target queue set based on the obtained plurality of first data packet queues, the length of each target data packet queue in the target queue set is greater than the length of the first data packet queue, so as to avoid packet loss when processing data packets using the data plane development kit, and the number of target data packet queues is not less than the number of processors used to process data packets, and each target data packet queue is locked to obtain a plurality of locked target data packet queues, and then each target data packet queue is processed by a plurality of processors, thereby fully utilizing the performance of the processors, and further improving the effect of processing data packets.
[0075] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0076] Example 2
[0077] The embodiments of the present application further provide a data packet processing device. It should be noted that the data packet processing device of the embodiments of the present application can be used to execute the method for processing data packets provided in the embodiments of the present application. The following introduces the data packet processing device provided in the embodiments of the present application.
[0078] Figure 9 is a schematic diagram of the data packet processing device according to the embodiments of the present application. As Figure 9 shown, the device includes: a first obtaining unit 901, a first determining unit 902, a first processing unit 903, and a second processing unit 904.
[0079] Specifically, the first acquisition unit 901 is configured to acquire a plurality of first data packet queues, where each first data packet queue at least includes a plurality of data packets to be processed in the data plane development kit. The length of each first data packet queue is a first preset length, and the number of first data packet queues is less than the number of processors. The processors are used to process data packets, and each first data packet queue is an unlocked data packet queue;
[0080] The first determination unit 902 is configured to obtain a target queue set based on the plurality of first data packet queues, where the target queue set at least includes a plurality of target data packet queues. The length of each target data packet queue is a second preset length, and the second preset length is greater than the first preset length. The number of target data packet queues is not less than the number of processors, and each target data packet queue is an unlocked data packet queue;
[0081] The first processing unit 903 is configured to perform a locking process on each target data packet queue to obtain a plurality of locked target data packet queues;
[0082] The second processing unit 904 is configured to process each target data packet queue through a plurality of processors based on the plurality of locked target data packet queues to obtain processed data packets.
[0083] In summary, the packet processing device provided in the embodiments of the present application obtains a plurality of first packet queues through the first acquisition unit 901. Among them, each first packet queue includes at least a plurality of packets to be processed in the data plane development kit. The length of each first packet queue is a first preset length, and the number of first packet queues is less than the number of processors. The processors are used to process packets, and each first packet queue is an unlocked packet queue; the first determination unit 902 obtains a target queue set based on the plurality of first packet queues. Among them, the target queue set includes at least a plurality of target packet queues. The length of each target packet queue is a second preset length, and the second preset length is greater than the first preset length. The number of target packet queues is not less than the number of processors. Each target packet queue is an unlocked packet queue; the first processing unit 903 performs a locking process on each target packet queue to obtain a plurality of locked target packet queues; the second processing unit 904 processes each target packet queue through a plurality of processors based on the plurality of locked target packet queues to obtain processed packets, which solves the problem of easy packet loss when using the data plane development kit to process packets in the related art. Moreover, when the number of packet queues is less than the number of processors, it is difficult to fully utilize the performance of the processors, resulting in a poor effect of processing packets. By obtaining a target queue set based on the plurality of first packet queues obtained, the length of each target packet queue in the target queue set is greater than the length of the first packet queue, so as to avoid packet loss when using the data plane development kit to process packets. And the number of target packet queues is not less than the number of processors used to process packets, and a locking process is performed on each target packet queue to obtain a plurality of locked target packet queues, and then each target packet queue is processed through a plurality of processors, so as to fully utilize the performance of the processors, thereby improving the effect of processing packets.
[0084] Optionally, in the packet processing device provided in the embodiments of the present application, the device further includes: a second determination unit, configured to determine the second preset length before moving the packets in the plurality of first packet queues to the plurality of second packet queues; a first construction unit, configured to construct a plurality of second packet queues based on the packets in the plurality of first packet queues in combination with the second preset length.
[0085] For example, since the newly constructed data packet queue does not require pre-allocation of resources, the determining unit first determines the length of the data packet queue that needs to be newly constructed, and sets the length of the data packet queue that needs to be newly constructed to be longer. The length of the newly constructed data packet queue needs to be set longer than the length of the DPDK rx queue (the first data packet queue mentioned above). Subsequently, the constructing unit uses the Data Plane forwarding core to move the data packets to be processed from the DPDK rx queue to the newly constructed data packet queue with a longer set length (the second data packet queue mentioned above).
[0086] In summary, by increasing the length setting of the data packet queue, the tolerance of the device to bursty network traffic is greatly increased, and the phenomenon of packet loss can be avoided.
[0087] Optionally, in the data packet processing device provided in the embodiment of the present application, the first determining unit includes: a first moving module for moving the data packets in a plurality of first data packet queues to a plurality of second data packet queues, where the length of the second data packet queue is greater than the length of the first data packet queue; a first processing module for performing a hashing process on the data packets in each second data packet queue to obtain a plurality of target data packet queues; and a second processing module for performing a summarization process on the plurality of target data packet queues to obtain a target queue set.
[0088] For example, the moving module first obtains the DPDK queue lock (the queue after locking the DPDK rx queue), and then uses the Data Plane forwarding core to move the mbuf address from the DPDK rx queue to the local queue (the second data packet queue mentioned above) (note: the local queue is a lock-free queue similar to the rx queue), and then performs a hashing process through the processing module to obtain a plurality of local queues (the target data packet queues mentioned above), and then uses another processing module to summarize the plurality of local queues to obtain the target queue set mentioned above.
[0089] In summary, the data packets to be processed can be quickly and accurately moved to the data packet queue with a longer length.
[0090] Optionally, in the data packet processing device provided in the embodiment of the present application, the first processing module includes: a first obtaining sub-module for obtaining the five-tuple information of each data packet in each second data packet queue; and a first processing sub-module for performing a hashing process on the data packets in each second data packet queue according to the five-tuple information to obtain a plurality of target data packet queues.
[0091] For example, after the Data Plane forwarding core transfers the mbuf address from the DPDK rx queue to the local queue (note: the local queue is a lock-free queue similar to the rx queue), the processing sub-module can perform hash processing based on the five-tuple of the packet (source IP information, destination IP information, source port information, destination port information, and protocol) or other methods.
[0092] In summary, by performing hash processing on the queues, it can be ensured that the same flow is hashed into the same localqueue queue.
[0093] Optionally, in the packet processing device provided in the embodiment of the present application, the device further includes: a third processing unit, configured to perform a locking process on each first packet queue after obtaining a plurality of first packet queues, to obtain a plurality of locked first packet queues; the first processing unit includes: a third processing module, configured to perform a release process on each locked first packet queue; a first traversal module, configured to traverse a plurality of target packet queues to obtain a traversal result; a fourth processing module, configured to perform a locking process on each target packet queue based on the traversal result, to obtain a plurality of locked target packet queues.
[0094] For example, the processing module releases the DPDK queue lock, then the traversal module traverses all localqueues, and the processing module attempts to obtain the local queue lock (indicating the queue after the locking process on the local queue). After obtaining the corresponding local queue lock, the mbuf (the packet to be processed) is taken out from the local queue for processing.
[0095] In summary, when a certain Data Plane forwarding core is relatively busy, other cores (processors) can process the DPDK rx queue to avoid packet loss caused by the queue being full due to long-term lack of processing. In addition, all DPDK rxqueues and local queues are equal for the Data Plane forwarding core, and it can make full use of the processing performance of the core (processor).
[0096] Optionally, in the data packet processing device provided in the embodiments of the present application, the first acquisition unit includes: a second acquisition module, configured to acquire a plurality of target traffic flows; a second determination module, configured to obtain a data packet set according to the plurality of target traffic flows, where the data packet set at least includes a plurality of data packets to be processed; a third determination module, configured to determine the resources pre-allocated to each data packet to be processed; a fourth determination module, configured to determine a first preset length according to the resources pre-allocated to each data packet to be processed; and a fifth determination module, configured to obtain a plurality of first data packet queues based on the data packet set in combination with the first preset length.
[0097] For example, the traffic information is acquired by the acquisition module, and a plurality of data packets to be processed are formed by the determination module according to the acquired traffic information. Then, the resource information pre-allocated to each data packet is obtained, and the length information of the DPDK rx queue (the above-mentioned first data packet queue) is determined by another determination module according to the resource information pre-allocated to each data packet. Then, a plurality of DPDK rx queues (the above-mentioned first data packet queues) are formed according to the length information of the DPDK rx queue (the above-mentioned first data packet queue) and the plurality of data packets to be processed.
[0098] In summary, a plurality of DPDK rx queues (the above-mentioned first data packet queues) provided by the data plane development kit can be obtained quickly and accurately.
[0099] Optionally, in the data packet processing device provided in the embodiments of the present application, the second processing unit includes: a first acquisition module, configured to acquire the data packets to be processed from each target data packet queue based on a plurality of locked target data packet queues; a first determination module, configured to determine a target processor from a plurality of processors, where the utilization rate of the target processor is less than a preset utilization rate; and a fifth processing module, configured to process the acquired data packets to be processed through the target processor to obtain processed data packets.
[0100] For example, in a scenario where the traffic is uneven, the determination module can determine a processor that is not in a busy state or a blocked state from a plurality of processors, and then the processing module processes the data packets to be processed through the determined processor that is not in a busy state or a blocked state.
[0101] In summary, for a scenario where the traffic is uneven, the device CPU can process evenly, and for individual cores (processors) that are busy or blocked, other cores (processors) can also normally forward and process network traffic.
[0102] The processing device for the data packet includes a processor and a memory. The above-mentioned first acquisition unit 901, first determination unit 902, first processing unit 903, second processing unit 904, etc. are all stored in the memory as program units, and the processor executes the above program units stored in the memory to implement corresponding functions.
[0103] The processor contains a kernel, and the kernel retrieves the corresponding program units from the memory. One or more kernels can be set, and the effect of processing data packets can be improved by adjusting the kernel parameters.
[0104] The memory may include non-permanent memory in a computer-readable medium, forms such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory includes at least one storage chip.
[0105] An embodiment of the present invention provides a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the data packet processing method is implemented.
[0106] An embodiment of the present invention provides a processor, and the processor is used to run a program. When the program runs, the data packet processing method is executed.
[0107] An embodiment of the present invention provides an electronic device. The device includes a processor, a memory, and a program stored on the memory and executable on the processor. When the processor executes the program, the following steps are implemented: acquiring a plurality of first data packet queues, where each first data packet queue includes at least a plurality of data packets to be processed in the data plane development kit, the length of each first data packet queue is a first preset length, the number of the first data packet queues is less than the number of processors, the processor is used to process the data packets, and each first data packet queue is an unlocked data packet queue; obtaining a target queue set according to the plurality of first data packet queues, where the target queue set includes at least a plurality of target data packet queues, the length of each target data packet queue is a second preset length, the second preset length is greater than the first preset length, the number of the target data packet queues is not less than the number of processors, and each target data packet queue is an unlocked data packet queue; performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues; and based on the plurality of locked target data packet queues, processing each target data packet queue through the plurality of processors to obtain processed data packets.
[0108] When the processor executes the program, the following steps are also implemented: Based on multiple first data packet queues, obtaining a target queue set includes: moving the data packets in the multiple first data packet queues to multiple second data packet queues, where the length of the second data packet queue is greater than the length of the first data packet queue; performing hashing processing on the data packets in each second data packet queue to obtain multiple target data packet queues; performing summarization processing on the multiple target data packet queues to obtain the target queue set.
[0109] When the processor executes the program, the following steps are also implemented: After obtaining multiple first data packet queues, the method further includes: performing locking processing on each first data packet queue to obtain multiple locked first data packet queues; performing locking processing on each target data packet queue to obtain multiple locked target data packet queues includes: performing release processing on each locked first data packet queue; traversing the multiple target data packet queues to obtain a traversal result; based on the traversal result, performing locking processing on each target data packet queue to obtain multiple locked target data packet queues.
[0110] When the processor executes the program, the following steps are also implemented: Based on multiple locked target data packet queues, each target data packet queue is processed by multiple of the processors to obtain processed data packets includes: based on multiple locked target data packet queues, obtaining the data packets to be processed from each target data packet queue; determining a target processor from multiple of the processors, where the utilization rate of the target processor is less than a preset utilization rate; processing the obtained data packets to be processed by the target processor to obtain processed data packets.
[0111] When the processor executes the program, the following steps are also implemented: Before moving the data packets in the multiple first data packet queues to the multiple second data packet queues, the method further includes: determining the second preset length; based on the data packets in the multiple first data packet queues in combination with the second preset length, constructing multiple second data packet queues.
[0112] Performing hashing processing on the data packets in each second data packet queue to obtain multiple target data packet queues includes: obtaining the five-tuple information of each data packet in each second data packet queue; based on the five-tuple information, performing hashing processing on the data packets in each second data packet queue to obtain multiple target data packet queues.
[0113] When the processor executes the program, the following steps are also implemented: Obtaining a plurality of first data packet queues includes: obtaining a plurality of target traffic flows; based on the plurality of target traffic flows, obtaining a data packet set, where the data packet set at least includes a plurality of data packets to be processed; determining the resources pre-allocated to each data packet to be processed; based on the resources pre-allocated to each data packet to be processed, determining the first preset length; combining the first preset length, and based on the data packet set, obtaining a plurality of first data packet queues.
[0114] The device in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0115] This application also provides a computer program product, which when executed on a data processing device, is adapted to execute a program initialized with the following method steps: obtaining a plurality of first data packet queues, where each first data packet queue at least includes a plurality of data packets to be processed in the data plane development kit, the length of each first data packet queue is a first preset length, the number of the first data packet queues is less than the number of processors, the processors are used to process the data packets, and each first data packet queue is an unlocked data packet queue; based on the plurality of first data packet queues, obtaining a target queue set, where the target queue set at least includes a plurality of target data packet queues, the length of each target data packet queue is a second preset length, the second preset length is greater than the first preset length, the number of the target data packet queues is not less than the number of processors, and each target data packet queue is an unlocked data packet queue; performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues; based on the plurality of locked target data packet queues, processing each target data packet queue by the plurality of processors to obtain processed data packets.
[0116] When executed on a data processing device, it is also adapted to execute a program initialized with the following method steps: obtaining a target queue set based on the plurality of first data packet queues includes: moving the data packets in the plurality of first data packet queues to a plurality of second data packet queues, where the length of the second data packet queue is greater than the length of the first data packet queue; performing a hashing process on the data packets in each second data packet queue to obtain a plurality of target data packet queues; performing a summarization process on the plurality of target data packet queues to obtain the target queue set.
[0117] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: After obtaining a plurality of first data packet queues, the method further includes: performing a locking process on each first data packet queue to obtain a plurality of locked first data packet queues; performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues includes: performing a release process on each locked first data packet queue; traversing the plurality of target data packet queues to obtain a traversal result; based on the traversal result, performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues.
[0118] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: Based on a plurality of locked target data packet queues, each target data packet queue is processed by a plurality of the processors to obtain processed data packets, including: based on a plurality of locked target data packet queues, obtaining the data packets to be processed from each target data packet queue; determining a target processor from the plurality of processors, wherein the utilization rate of the target processor is less than a preset utilization rate; processing the obtained data packets to be processed by the target processor to obtain processed data packets.
[0119] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: Before moving the data packets in a plurality of first data packet queues to a plurality of second data packet queues, the method further includes: determining the second preset length; combining the second preset length, and based on the data packets in the plurality of first data packet queues, constructing a plurality of second data packet queues.
[0120] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: Performing a hashing process on the data packets in each second data packet queue to obtain a plurality of target data packet queues, including: obtaining the five-tuple information of each data packet in each second data packet queue; based on the five-tuple information, performing a hashing process on the data packets in each second data packet queue to obtain a plurality of target data packet queues.
[0121] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: Obtaining a plurality of first data packet queues includes: obtaining a plurality of target traffic flows; based on the plurality of target traffic flows, obtaining a data packet set, wherein the data packet set at least includes a plurality of data packets to be processed; determining the resources pre-allocated to each data packet to be processed; based on the resources pre-allocated to each data packet to be processed, determining the first preset length; combining the first preset length, and based on the data packet set, obtaining a plurality of first data packet queues.
[0122] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0123] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0124] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0126] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and a memory.
[0127] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.
[0128] A computer-readable medium includes permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0129] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0130] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0131] The above are only embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A method for processing data packets, characterized in that, Including: Obtain a plurality of first data packet queues, where each first data packet queue includes at least a plurality of data packets to be processed in a data plane development kit. The length of each first data packet queue is a first preset length. The number of the first data packet queues is less than the number of processors for processing the data packets. Each first data packet queue is an unlocked data packet queue. Based on the plurality of first data packet queues, obtain a target queue set, where the target queue set includes at least a plurality of target data packet queues. The length of each target data packet queue is a second preset length, and the second preset length is greater than the first preset length. The number of the target data packet queues is not less than the number of processors. Each target data packet queue is an unlocked data packet queue. Perform a locking process on each target data packet queue to obtain a plurality of locked target data packet queues. Based on the plurality of locked target data packet queues, use the plurality of processors to process each target data packet queue to obtain processed data packets. Among them, obtaining the target queue set based on the plurality of first data packet queues includes: moving the data packets in the plurality of first data packet queues to a plurality of second data packet queues, where the length of the second data packet queue is greater than the length of the first data packet queue; performing a hashing process on the data packets in each second data packet queue to obtain a plurality of target data packet queues; and performing a summarization process on the plurality of target data packet queues to obtain the target queue set.
2. The method according to claim 1, wherein After obtaining the plurality of first data packet queues, the method further includes: performing a locking process on each first data packet queue to obtain a plurality of locked first data packet queues. Performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues includes: releasing each locked first data packet queue; traversing the plurality of target data packet queues to obtain a traversal result; and based on the traversal result, performing a locking process on each target data packet queue to obtain a plurality of locked target data packet queues.
3. The method according to claim 1, characterized in that Based on the plurality of locked target data packet queues, using the plurality of processors to process each target data packet queue to obtain processed data packets includes: Based on the plurality of locked target data packet queues, obtain the data packets to be processed from each target data packet queue. Determine a target processor from the plurality of processors, where the utilization rate of the target processor is less than a preset utilization rate. Process the obtained data packets to be processed through the target processor to obtain processed data packets.
4. The method according to claim 1, wherein Before moving the data packets in the plurality of first data packet queues to the plurality of second data packet queues, the method further includes: Determine the second preset length. Combined with the second preset length, based on the data packets in the plurality of first data packet queues, construct a plurality of second data packet queues.
5. The method according to claim 1, wherein Performing a hashing process on the data packets in each second data packet queue to obtain a plurality of target data packet queues includes: Obtain the five-tuple information of each packet in each second packet queue; According to the five-tuple information, perform hashing on the packets in each second packet queue to obtain a plurality of target packet queues.
6. The method according to claim 1, characterized in that, Obtaining a plurality of first packet queues includes: Obtain a plurality of target traffic flows; According to the plurality of target traffic flows, obtain a packet set, where the packet set at least includes a plurality of packets to be processed; Determine the resources pre-allocated to each packet to be processed; According to the resources pre-allocated to each packet to be processed, determine the first preset length; Combined with the first preset length, based on the packet set, obtain a plurality of first packet queues.
7. A processing device for data packets, characterized in that, Includes: A first acquisition unit, configured to acquire a plurality of first packet queues, where each first packet queue at least includes a plurality of packets to be processed in the data plane development kit, the length of each first packet queue is the first preset length, the number of the first packet queues is less than the number of processors for processing the packets, and each first packet queue is an unlocked packet queue; A first determination unit, configured to obtain a target queue set according to the plurality of first packet queues, where the target queue set at least includes a plurality of target packet queues, the length of each target packet queue is the second preset length, the second preset length is greater than the first preset length, the number of the target packet queues is not less than the number of processors, and each target packet queue is an unlocked packet queue; A first processing unit, configured to perform a locking process on each target packet queue to obtain a plurality of locked target packet queues; A second processing unit, configured to process each target packet queue through the plurality of processors based on the plurality of locked target packet queues to obtain processed packets; Wherein, the first determination unit includes: a first moving module, configured to move the packets in the plurality of first packet queues to a plurality of second packet queues, where the length of the second packet queue is greater than the length of the first packet queue; a first processing module, configured to perform hashing on the packets in each second packet queue to obtain a plurality of target packet queues; a second processing module, configured to perform a summarization process on the plurality of target packet queues to obtain the target queue set.
Citation Information
Patent Citations
Data packet processing method and device based on DPDK
CN110719234A
Data transmission method, device and equipment and storage medium
CN111447155A