Network packet processing method and device, electronic equipment and storage medium
By receiving packet network packets of different quality of service Qos levels and locking resources of CPU and operating system threads based on linear mapping relationships, the packet network packets of real-time services are solved, and the problem of not supporting real-time service QoS stream classification and service scheduling in the prior art is solved, real-time service processing with high throughput, low latency and low jitter is realized.
Patent Information
- Application Number
- CN202311156720.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-07
- Publication Date
- 2025-03-07
Smart Images

Figure CN119576514A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a network packet processing method, device, electronic device and storage medium. Background Art
[0002] QoS (Quality of Service) is defined as a set of quality requirements on the collective behavior of one or more objects. Under limited network resources, QoS reasonably allocates bandwidth and resource priority for various services, thereby ensuring that the transmission bandwidth, transmission delay, data packet loss rate, network jitter and other indicators of various services meet the standards; conversely, common parameters such as throughput, transmission delay and error rate can describe the network service quality such as the rate and reliability of network transmission. Therefore, QoS is the most basic and important function and measurement point of the network. Because network resources are always limited, in the case of resource conflicts, QoS services can provide different service performance according to different service types. With the assistance of network QoS capabilities, it can effectively reduce the redundant construction of the network, delay the investment in capacity upgrades, and promote the effectiveness and pertinence of network construction.
[0003] However, the existing solutions do not support QoS flow classification and service scheduling for real-time services. In actual networks, a large number of real-time services cannot be processed by the existing QoS framework. If you want to support QoS flow classification and service scheduling for real-time services, you need to subvert the current framework design and fundamentally solve and support better quality real-time service QoS. Therefore, how to support QoS flow classification and service scheduling for real-time services without subverting the current framework design is an important issue that needs to be solved urgently. Summary of the invention
[0004] In view of the problems existing in the prior art, the present invention provides a network packet processing method, comprising:
[0005] Receive packet network packets with different service quality QoS levels, and send the packet network packets of real-time services to the corresponding target network card queue;
[0006] Based on a pre-established linear mapping relationship, the resources of the general processor CPU (Central Processing Unit) core and the operating system thread corresponding to the target network card queue are locked to process the packet network packets of the real-time service; wherein the linear mapping relationship is a linear mapping relationship between the general CPU core, the operating system thread and the network card multiple queues.
[0007] According to a network packet processing method provided by the present invention, the linear mapping relationship between the general processor CPU core, the operating system thread and the network card multi-queue is established in the following manner:
[0008] For each CPU core, the CPU core and the operating system thread are coupled separately, and the private cache area of the CPU core is reused;
[0009] The private cache area of the CPU core is connected to the direct memory access controller of the corresponding queue of the network card through a descriptor ring queue.
[0010] According to a network packet processing method provided by the present invention, the hardware offloading processing priority is the highest priority, and before sending the grouped network packet of the real-time service to the corresponding target network card queue, it also includes:
[0011] If the packet network packet matches the hardware offloading rule, hardware offloading processing is preferentially performed on the packet network packet;
[0012] If the packet network packet does not match the hardware offloading rule, the step of sending the packet network packet of the real-time service to the corresponding target network card queue is performed.
[0013] According to a network packet processing method provided by the present invention, the real-time service processing priority is higher than the non-real-time service processing priority, and the real-time service grouping network packet is sent to the corresponding target network card queue, comprising:
[0014] In the case where it is determined that the packet network packet matches the flow redirection rule, setting the packet network packet as a packet network packet for a real-time service;
[0015] The packet network packet flow of the real-time service is directed to the target network card queue corresponding to the real-time service through the flow redirection of the network card, so as to give priority to processing the packet network packet of the real-time service.
[0016] According to a network packet processing method provided by the present invention, after sending the grouped network packet of the real-time service to the corresponding network card queue, the method further includes:
[0017] If the grouped network packet does not match the flow redirection rule, determining whether the grouped network packet matches the flow balancing rule;
[0018] If the packet network packet matches the traffic balancing rule, the packet network packet is set as a packet network packet of a non-real-time service, and the packet network packet of the non-real-time service is sent to the network card queue corresponding to the non-real-time service through traffic load balancing.
[0019] According to a network packet processing method provided by the present invention, if the grouping network packet matches the flow redirection rule, it includes:
[0020] At each network layer, identifying the grouped network packets;
[0021] If it is identified that the grouped network packet matches the identification content corresponding to each network layer, it is determined that the grouped network packet matches the flow redirection rule.
[0022] According to a network packet processing method provided by the present invention, the operating system thread corresponding to the target network card queue is set as a real-time class thread through an operating system interface; the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue are locked to process the grouped network packets of the real-time service, including:
[0023] The resources of the general-purpose processor CPU core and the real-time class thread corresponding to the target network card queue are locked, and the grouped network packets of the real-time service are processed within a specified time range.
[0024] The present invention also provides a network packet processing device, comprising:
[0025] The sending module is used to receive the packet network packets of different service quality QoS levels and send the packet network packets of real-time services to the corresponding target network card queue;
[0026] A processing module is used to lock the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue to process the grouped network packets of the real-time service based on a pre-established linear mapping relationship; wherein the linear mapping relationship is a linear mapping relationship between the general CPU core, the operating system thread and the network card multiple queues.
[0027] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the network packet processing method as described in any one of the above items are implemented.
[0028] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the network packet processing method as described in any one of the above items are implemented.
[0029] The embodiment of the present invention receives packet network packets of different service quality (Qos) levels, sends the packet network packets of real-time services to the corresponding target network card queue, and based on the pre-established linear mapping relationship between the general-purpose processor CPU core, the operating system thread and the network card multi-queue, locks the resources of the general-purpose CPU core and the operating system thread corresponding to the target network card queue to process the packet network packets of real-time services. The real-time service Qos flow classification and service scheduling close to the bottom layer can be directly constructed from the interface layer of the network card and the general-purpose CPU, thereby solving the Qos resource conflict problem of real-time services and non-real-time services from the bottom layer of hardware resources such as the network card and the CPU, solving the resource entanglement and resource competition risks of real-time services and non-real-time services from the framework level, and combining software and hardware to better support high throughput, low latency and low jitter for real-time services. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 It is a flowchart of a network packet processing method provided by an embodiment of the present invention;
[0032] Figure 2 It is a schematic diagram of a high-performance packet network data packet receiving and sending framework on a general-purpose CPU provided by an embodiment of the present invention;
[0033] Figure 3 It is a schematic diagram of a high-performance multi-threaded multi-queue packet network packet receiving and sending framework on a general-purpose CPU provided by an embodiment of the present invention;
[0034] Figure 4 It is a schematic diagram of a resource mapping framework corresponding to a single CPU core provided by an embodiment of the present invention;
[0035] Figure 5 is a schematic diagram of a real-time service and non-real-time service resource isolation and mapping framework provided by an embodiment of the present invention;
[0036] Figure 6 is a schematic diagram of a real-time service and non-real-time service classification policy framework provided by an embodiment of the present invention;
[0037] Figure 7 It is a schematic diagram of the real-time service flow logic of all paths of all network elements in the entire network provided by an embodiment of the present invention;
[0038] Figure 8is a schematic diagram of the structure of a network packet processing device provided by an embodiment of the present invention;
[0039] Fig. 9 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] Figure 1 Schematic diagram of the flow of the network packet processing method provided by the embodiment of the present invention. Figure 1 The embodiment of the present invention provides a network packet processing method, which may specifically include the following steps:
[0042] Step 101: receiving packet network packets of different service quality QoS levels, and sending the packet network packets of real-time services to the corresponding target network card queue.
[0043] QoS is a hierarchical network quality service, and multiple queues are a requirement of QoS. By placing network packets of different QoS levels into different queues, we can isolate network packets of different QoS levels and then start independent processing based on the corresponding queues.
[0044] Network services can be divided into real-time services and non-real-time services. Real-time services can be services in ultra-low latency scenarios such as live broadcast and video interaction, and non-real-time services can be services that occupy a large amount of network traffic such as large-scale file transfer and information synchronization. Specifically, after receiving packet network packets of different QoS levels, it is possible to preferentially identify whether the packet network packets are packet network packets of real-time services, so as to send the packet network packets of real-time services to the corresponding network card queue for priority processing.
[0045] Step 102, based on a pre-established linear mapping relationship, lock the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue to process the packet network packets of the real-time service; wherein the linear mapping relationship is a linear mapping relationship between the general CPU core, the operating system thread and the network card multiple queues.
[0046] The embodiment of the present invention can use a general-purpose CPU as the hardware processing basis, and realize high-performance network processing capabilities through software design and CPU instruction support. Under the integration of computing and network, a large number of traditional CT (Communication Technology) equipment are replaced by IT (Information Technology) equipment, and general-purpose CPU servers can be more conveniently deployed, networked and expanded in capacity, so that the function replacement of each network element device in the traditional network can be realized based on the software capabilities on the general-purpose CPU server.
[0047] The embodiment of the present invention pre-establishes a linear mapping relationship between a general-purpose processor CPU core, an operating system thread, and multiple queues of a network card, and processes the received packet network packets based on the mapping relationship, thereby supporting network data to be sent and received by a general-purpose CPU server through a network card. Specifically, the PPS indicator (Packets Per Second, the number of packet data sent and received per second) can be used to measure the network throughput of the system. The software processing capacity on a single physical CPU core can reach millions or even tens of millions of packet network packets per second. The general-purpose CPU has evolved into a multi-core system, so that a single server can be linearly expanded based on the single-core processing capacity, thereby supporting TGB (terabyte level) level network processing capacity, so that the server software packet network packets based on the general-purpose CPU can support IT equipment to replace CT equipment.
[0048] The embodiment of the present invention pre-establishes a linear mapping relationship between a general-purpose processor CPU core, an operating system thread, and multiple queues of a network card, and processes received packet network packets based on the mapping relationship, thereby combining software and hardware to better support the compatibility of real-time services with high throughput, low latency, and low jitter.
[0049] Figure 2 Schematic diagram of a high-performance packet network data packet receiving and sending framework on a general-purpose CPU provided by an embodiment of the present invention. Figure 2 ,based on Figure 2 The framework can map the DMA (Direct Memory Access) of the network card to the user state through the user state IO (Input / Output) kernel driver, thereby solving the problem that the user state cannot access the memory of the network packet.
[0050] User-mode programs cannot access physical memory addresses, and user-mode address access needs to be solved by mapping virtual memory addresses to physical memory addresses. In this process, a large number of virtual and physical memory mapping switches are faced. Under the general CPU framework, cache miss problems will be faced, resulting in frequent memory switching between cache and memory, thereby reducing the processing performance of the system. In an embodiment of the present invention, the mapping problem of virtual and physical memory can be solved specifically by large page memory technology. When the size of the unit physical memory becomes larger, a smaller address mapping table can be used under the same 4G virtual memory address to complete the mapping management of virtual and physical addresses. The processing power of general-purpose CPUs is guided by Moore's Law and doubles every 18 months. Under the current process technology, the processing power of general-purpose CPUs can reach an instruction processing power of more than 2GHz per second. The data gap directly related to processing 20Gbps data packets needs to be solved by a more optimized general-purpose CPU instruction framework. In the case where the general CPU main frequency does not double, the parallel processing capability of a single instruction can be increased. For example, if a data packet of 256 bytes can be converted into multiple executable units to send and receive 128 bytes or 256 bytes of data in parallel, it can be observed from the time dimension that only 2 CPU instruction cycles or 1 CPU instruction cycle are needed to complete the sending and receiving of the data packet. By switching the above three key technologies, the software framework on the general CPU can achieve high-performance network packet sending and receiving, supporting ultra-high network throughput processing capabilities such as 20Gbps, 40Gbps and even 100Gbps.
[0051] Reference Figure 2 It is a framework for general-purpose CPUs to process packet network packets. Through the above explanation, the current general-purpose CPU platform can support high-performance and high-throughput network data packet transmission and reception. Based on this framework, the embodiment of the present invention can meet the QoS capability of supporting real-time services by pre-establishing a linear mapping relationship between the general-purpose processor CPU core, the operating system thread and the network card multiple queues.
[0052] Figure 3 Schematic diagram of a high-performance multi-threaded multi-queue network packet receiving and sending framework on a general-purpose CPU provided by an embodiment of the present invention. Figure 3 , we can clearly see the direct linear mapping relationship between general CPU physical cores, operating system threads, and network card multi-queues. Under this model framework, computing resources and network resources can be matched one to one.
[0053] After pre-establishing the linear mapping relationship between the general processor CPU core, operating system thread and network card multiple queues, the network card queue and the processor CPU core and operating system thread are mapped one by one. When the network card queue corresponding to the real-time business is determined, the CPU, software and other resources corresponding to the network card queue can be locked.
[0054] Specifically, the packet network packets of real-time services can be preferentially identified and sent to the corresponding network card queue. The packet network data packets that meet the characteristics of real-time services can be redirected to the corresponding network card queue through the FDIR (Flow Director) of the network card NIC (Network interface controller), thereby giving priority to the network data packets of real-time services.
[0055] The embodiment of the present invention receives packet network packets of different service quality (Qos) levels, sends the packet network packets of real-time services to the corresponding target network card queue, and based on the pre-established linear mapping relationship between the general-purpose processor CPU core, the operating system thread and the network card multi-queue, locks the resources of the general-purpose CPU core and the operating system thread corresponding to the target network card queue to process the packet network packets of real-time services. The real-time service Qos flow classification and service scheduling close to the bottom layer can be directly constructed from the interface layer of the network card and the general-purpose CPU, thereby solving the Qos resource conflict problem of real-time services and non-real-time services from the bottom layer of hardware resources such as the network card and the CPU, solving the resource entanglement and resource competition risks of real-time services and non-real-time services from the framework level, and combining software and hardware to better support high throughput, low latency and low jitter for real-time services.
[0056] In an optional embodiment, the linear mapping relationship between the general processor CPU core, the operating system thread and the network card multiple queues is established in the following manner: for each CPU core, the CPU core and the operating system thread are coupled separately, and the private cache area of the CPU core is reused; the private cache area of the CPU core is connected to the direct memory access controller of the corresponding queue of the network card through a descriptor ring queue.
[0057] A general-purpose CPU core can have up to 64 physical cores or logical cores. Physical cores and logical cores are equivalent in computing resources and can correspond to different general-purpose CPU design frameworks. In the embodiment of the present invention, the advantages of general-purpose CPU multi-cores can be brought into play, and linear expansion of multi-cores can be supported in software, so that the corresponding computing resources and memory resources on each thread can be isolated from each other and there is no mutual lock mutual exclusion between threads.
[0058] Figure 4 Schematic diagram of a resource mapping framework corresponding to a single CPU core provided by an embodiment of the present invention. Figure 4 By establishing a linear mapping relationship between a single CPU core, operating system thread, and network card queue, the intercommunication and competition between cores and threads can be avoided, thereby ensuring high-performance linear concurrency capabilities.
[0059] In the embodiment of the present invention, the CPU core and the pthread thread are coupled separately, and the memory of the CPU is reused and is a private cache area. The DMA controller of the network card corresponding to this queue is connected through the descriptor ring queue, so as to ensure that the whole process of packet network data packets from the network card to the CPU is resource-exclusive. Under this model, the synchronous linear expansion of multiple CPU cores will not interfere with or compete with each other, thus fundamentally ensuring high performance of concurrency.
[0060] In an optional embodiment, the operating system thread corresponding to the target network card queue is set as a real-time class thread through the operating system interface; the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue are locked to process the packet network packets of the real-time service, including: locking the resources of the general processor CPU core and the real-time class thread corresponding to the target network card queue, and processing the packet network packets of the real-time service within a specified time range.
[0061] Based on the strong coupling of resources, real-time and non-real-time services can be distinguished through strict isolation of resources. Specifically, the real-time class flow can be directed to the target network card queue corresponding to the reserved or specified real-time service through the flow redirection technology. This queue can be Figure 4 The resource mapping framework shown is mapped to a set of exclusive resources. Such resources include hardware and software resources such as CPU / Cache / pthread and are exclusive. The operating system thread pthread corresponding to the target network card can be set to real-time type through the operating system interface, and the resources of the general processor CPU core and real-time class thread corresponding to the target network card queue can be locked to process the grouped network packets of the real-time business within the specified time range, thereby ensuring that this scheduling is a real-time task and that its data or logic execution unit is completed within the specified time range.
[0062] Figure 5 Schematic diagram of a real-time service and non-real-time service resource isolation and mapping framework provided by an embodiment of the present invention. Figure 5 Real-time and non-real-time services can coexist in the same software framework, including two key ideas: the first is to redirect data that meets the characteristics of real-time services to the specified network card queue through the FDIR (flow redirection) of the network card NIC. Since the network card queue and Cache / CPU (physical core or logical core) / thread are mapped one to one, when the target network card queue is determined, the corresponding CPU and software resources are locked; the second is to set the corresponding thread pthread as a real-time thread through the scheduling mechanism and corresponding interface of the operating system. The scheduling strategy based on the real-time time slice ensures that even when the system is completely overloaded, it can still enjoy faster and better CPU resources.
[0063] In an optional embodiment, the hardware offloading processing priority is the highest priority. Before sending the packet network packet of the real-time service to the corresponding target network card queue, it also includes: if the packet network packet matches the hardware offloading rule, the hardware offloading processing is preferentially performed on the packet network packet; if the packet network packet does not match the hardware offloading rule, the step of sending the packet network packet of the real-time service to the corresponding target network card queue is executed.
[0064] Figure 6 Schematic diagram of a real-time service and non-real-time service classification policy framework provided by an embodiment of the present invention. Figure 6 , the hierarchical strategy based on FDIR is explained. For packet network packets, they can be generally divided into software processing and hardware processing, among which hardware offloading processing has the highest priority. After receiving the packet network packet, it can be determined whether the packet network packet matches the hardware offloading rule. If it matches, hardware processing is performed on the packet network packet first. If it does not match, software processing is performed on the packet network packet.
[0065] Specifically, when traffic is processed in hardware, it can be considered as hardware offload. Hardware offload can support various traffic processing such as real-time and non-real-time. Hardware traffic offload can be achieved through hardware units such as smart network cards and DPU (Data Processing Unit), thereby achieving lower latency and higher throughput than software.
[0066] In an optional embodiment, the real-time service processing priority is higher than the non-real-time service processing priority, and the sending of the real-time service packet network packet to the corresponding target network card queue includes: when it is determined that the packet network packet matches the flow redirection rule, setting the packet network packet as the real-time service packet network packet; directing the real-time service packet network packet flow to the target network card queue corresponding to the real-time service through the network card flow redirection, so as to give priority to the real-time service packet network packet.
[0067] Please continue to refer to Figure 6 In terms of software processing strategy, FDIR has a higher priority, and real-time services can be identified and processed based on higher-priority flow redirection rules. Specifically, if the packet network packet does not match the hardware offload rule, it can be first determined whether the packet network packet matches the flow redirection rule. If it is determined that the packet network packet matches the flow redirection rule, the packet network packet can be set as a packet network packet of the real-time service. The packet network packet flow of the real-time service can be directed to the network card queue corresponding to the real-time service through the flow redirection of the network card, so as to give priority to the packet network packet of the real-time service.
[0068] In the embodiment of the present invention, in terms of software processing strategy, FDIR has a higher priority, so that a low-latency QoS strategy for real-time services can be implemented based on a general CPU framework.
[0069] In an optional embodiment, if the packet network packet matches the flow redirection rule, it includes: identifying the packet network packet at each network layer; if it is identified that the packet network packet matches the identification content corresponding to each network layer, then determining that the packet network packet matches the flow redirection rule.
[0070] Table 1 is a table of FDIR's identification and matching capabilities for packet network packets, as shown below:
[0071]
[0072]
[0073] Table 1
[0074] As shown in Table 1, the identification capability of the packet network packet supported by the FDIR policy is described, covering all network layer levels of the ISO (International Organization for Standardization) model of all current Ethernet network data packets. At each network layer, the packet network packet can be identified, and when it is identified that the packet network packet matches the identification content corresponding to each network layer, it can be determined that the packet network packet matches the flow redirection rule.
[0075] In the embodiment of the present invention, unified real-time service labels and scheduling tests are defined on the basis of each layer of the universal network ISO model, without distinguishing between single real-time service differences, thereby defining the most basic underlying QoS model for the upper layer network, thereby achieving the characteristics of a unified packet network package that complies with standards for the identification of real-time services.
[0076] In an optional embodiment, after sending the packet network packet of the real-time service to the corresponding target network card queue, it also includes: if the packet network packet does not match the flow redirection rule, determining whether the packet network packet matches the traffic balancing rule; if the packet network packet matches the traffic balancing rule, setting the packet network packet to a packet network packet of a non-real-time service, and sending the packet network packet of the non-real-time service to the network card queue corresponding to the non-real-time service through traffic load balancing.
[0077] Please continue to refer to Figure 6At the software processing level, since non-real-time traffic occupies most of the network, more resources can be allocated from the CPU, cache, memory and other resource allocations. The RSS (Receive Side Scaling, traffic balancing) strategy can be used to solve the problem of how to balance the load on multiple resources.
[0078] After determining in order according to the priority that the packet network packet does not match the hardware offloading rule and the flow redirection rule, it can finally be determined whether the packet network packet matches the traffic balancing rule. If it matches, the packet network packet can be set as a packet network packet for non-real-time services. The packet network packet for non-real-time services can be sent to the network card queue corresponding to the non-real-time service through traffic load balancing to process the packet network packet for non-real-time services.
[0079] After the packet network packet receiving of real-time services is solved through the above framework, we can continue to solve how to better reflect the low latency and low jitter of real-time services in the sending direction. Network jitter lies in the congestion of multiple network element systems in transmitting packet network data, which affects the end-to-end transmission delay of the entire network, especially the transmission of packet network packets between multiple network elements into different queues, resulting in delayed processing on local network elements, thus causing global fluctuating transmission.
[0080] Based on the packet processing mechanism of the QoS real-time service basic framework on the general CPU as mentioned above, it can ensure that the processing of specific real-time packet network packets can be realized in a single network element, thereby being extended to the full-link network and end-to-end network. In the entire network transmission process, a consistent packet strategy can be pre-defined to ensure unified high-priority processing of the entire network.
[0081] Figure 7 Schematic diagram of the real-time service flow logic of all network elements in the entire network provided by the embodiment of the present invention. Figure 7 , specifically describes a full-network real-time framework between multiple network elements in a network dedicated line or a virtualized network dedicated line. It can be assumed that a full-network virtual network is based on the above-mentioned general CPU platform, and its four peer virtual network elements are all based on the high-performance packet network packet real-time service framework provided by the embodiment of the present invention. In each network element, high-priority processing of real-time services can be achieved within the network element.
[0082] based on Figure 7 The labeled IPv4 and IPv6 can be uniformly identified as a class of real-time services based on the characteristics of their networks, such as Figure 7The marked TOS / Traffic-Class or IP address or UDP (User Datagram Protocol) / TCP (Transmission Control Protocol) four-layer port is uniformly classified. From the end-to-end perspective of the network, it is a real-time priority processing network for the entire network. Through the unified basic forwarding framework of each network element, and the unified network tags defined for each layer of each type of network, the real-time priority strategy of the entire network is realized.
[0083] In the embodiment of the present invention, an end-to-end real-time networking model and service labels based on a general CPU framework for the entire network are defined to solve the jitter problem of the overall real-time services of the network, thereby supporting an end-to-end real-time label channel for the entire network and achieving low latency and low jitter for real-time services in the entire network.
[0084] In the era of NFV (Network Functions Virtualization), more and more traditional CT services need to be deployed on general-purpose computing platforms (general-purpose CPUs), and the ultimate integration of computing and network (CT and IT integration) is achieved through software and hardware decoupling. In computing and network integration products, the network relies heavily on the basic processing capabilities of the general-purpose computing platform, which includes the core components such as the reception and transmission of network data packets. The embodiment of the present invention is based on the general-purpose computing platform (general-purpose CPU) for the reception and transmission of network data packets, and supports QoS to distinguish between real-time and non-real-time services through relevant key designs, which can meet the transition of network architecture from traditional CT equipment to real-time services after computing and network integration. The real-time services can be smoothly migrated. The software entity corresponding to the embodiment of the present invention is between the network card and the general-purpose CPU, and can provide a network packet processing framework with QoS real-time services and non-real-time services isolation for all services above the link layer and the network card below the physical layer, so as to meet the comprehensive network transmission QoS quality indicators such as high throughput of non-real-time services and low latency of real-time services.
[0085] QoS is a basic function of the network. Traditional routers or Linux operating systems support network QoS, and its implementation principle can be attributed to the queue scheduling algorithm of the hardware or the queue scheduling of the network protocol stack layer. The embodiment of the present invention is based on the NFV era. The Kernel Bypass strategy can realize the transceiver drive of the network card in the user state, and realize the QoS strategy of combining software and hardware under the user state driver framework. The embodiment of the present invention mainly serves the general computing platform (general CPU) and does not require additional dedicated router ASIC (Application Specific Integrated Circuit) chips. Since the Kernel Bypass strategy is not affected by the switching between the kernel state and the user state of the operating system, it runs between the network card and the protocol stack, and is between the physical layer and the link layer (more inclined to the link layer) from the network level, it can achieve high performance and high precision and support virtualized QoS policy goals through a better strategy, so that it can carry various user state protocol stacks and various application scenarios.
[0086] The network packet processing device provided by the present invention is described below. The network packet processing device described below and the network packet processing method described above can be referenced to each other.
[0087] Figure 8 Schematic diagram of the structure of the network packet processing device provided by the embodiment of the present invention. Figure 8 The embodiment of the present invention provides a network packet processing device, which may specifically include the following modules:
[0088] The sending module 801 is used to receive the packet network packets of different service quality QoS levels, and send the packet network packets of the real-time service to the corresponding target network card queue;
[0089] The processing module 802 is used to lock the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue to process the grouped network packets of the real-time service based on a pre-established linear mapping relationship; wherein the linear mapping relationship is a linear mapping relationship between the general CPU core, the operating system thread and the network card multiple queues.
[0090] In an optional embodiment, the device is further used for:
[0091] For each CPU core, the CPU core and the operating system thread are coupled separately, and the private cache area of the CPU core is reused;
[0092] The private cache area of the CPU core is connected to the direct memory access controller of the corresponding queue of the network card through a descriptor ring queue.
[0093] In an optional embodiment, the hardware offloading processing priority is the highest priority, and before sending the packet network packet of the real-time service to the corresponding target network card queue, the sending module is further used to:
[0094] If the packet network packet matches the hardware offloading rule, hardware offloading processing is preferentially performed on the packet network packet;
[0095] If the packet network packet does not match the hardware offloading rule, the step of sending the packet network packet of the real-time service to the corresponding target network card queue is performed.
[0096] In an optional embodiment, the real-time service processing priority is higher than the non-real-time service processing priority, and the sending module is specifically used to:
[0097] In the case where it is determined that the packet network packet matches the flow redirection rule, setting the packet network packet as a packet network packet for a real-time service;
[0098] The packet network packet flow of the real-time service is directed to the target network card queue corresponding to the real-time service through the flow redirection of the network card, so as to give priority to processing the packet network packet of the real-time service.
[0099] In an optional embodiment, after sending the packet network packet of the real-time service to the corresponding network card queue, the sending module is further configured to:
[0100] If the grouped network packet does not match the flow redirection rule, determining whether the grouped network packet matches the flow balancing rule;
[0101] If the packet network packet matches the traffic balancing rule, the packet network packet is set as a packet network packet of a non-real-time service, and the packet network packet of the non-real-time service is sent to the network card queue corresponding to the non-real-time service through traffic load balancing.
[0102] In an optional embodiment, the sending module is specifically used to:
[0103] At each network layer, identifying the grouped network packets;
[0104] If it is identified that the grouped network packet matches the identification content corresponding to each network layer, it is determined that the grouped network packet matches the flow redirection rule.
[0105] In an optional embodiment, the operating system thread corresponding to the target network card queue is set as a real-time thread through an operating system interface; and the processing module is specifically used to:
[0106] The resources of the general-purpose processor CPU core and the real-time class thread corresponding to the target network card queue are locked, and the grouped network packets of the real-time service are processed within a specified time range.
[0107] The embodiment of the present invention receives packet network packets of different service quality (Qos) levels, sends the packet network packets of real-time services to the corresponding target network card queue, and based on the pre-established linear mapping relationship between the general-purpose processor CPU core, the operating system thread and the network card multi-queue, locks the resources of the general-purpose CPU core and the operating system thread corresponding to the target network card queue to process the packet network packets of real-time services. The real-time service Qos flow classification and service scheduling close to the bottom layer can be directly constructed from the interface layer of the network card and the general-purpose CPU, thereby solving the Qos resource conflict problem of real-time services and non-real-time services from the bottom layer of hardware resources such as the network card and the CPU, solving the resource entanglement and resource competition risks of real-time services and non-real-time services from the framework level, and combining software and hardware to better support high throughput, low latency and low jitter for real-time services.
[0108] Fig. 9 An example of a physical structure diagram of an electronic device is shown in FIG. Fig. 9 As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communication interface 920 and the memory 930 communicate with each other through the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the network packet processing method, and the method includes:
[0109] Receive packet network packets with different service quality QoS levels, and send the packet network packets of real-time services to the corresponding target network card queue;
[0110] Based on a pre-established linear mapping relationship, the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue are locked to process the packet network packets of the real-time service; wherein the linear mapping relationship is a linear mapping relationship between the general CPU core, the operating system thread and the network card multiple queues.
[0111] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0112] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the network packet processing method provided by the above methods, the method comprising:
[0113] Receive packet network packets with different service quality QoS levels, and send the packet network packets of real-time services to the corresponding target network card queue;
[0114] Based on a pre-established linear mapping relationship, the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue are locked to process the packet network packets of the real-time service; wherein the linear mapping relationship is a linear mapping relationship between the general CPU core, the operating system thread and the network card multiple queues.
[0115] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A network packet processing method, characterized in that: include: Receive packet network packets with different service quality QoS levels, and send the packet network packets of real-time services to the corresponding target network card queue; Based on a pre-established linear mapping relationship, the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue are locked to process the packet network packets of the real-time service; wherein the linear mapping relationship is a linear mapping relationship between the general CPU core, the operating system thread and the network card multiple queues.
2. The method according to claim 1, characterized in that The linear mapping relationship between the general-purpose processor CPU core, the operating system thread and the network card multi-queue is established in the following manner: For each CPU core, the CPU core and the operating system thread are coupled separately, and the private cache area of the CPU core is reused; The private cache area of the CPU core is connected to the direct memory access controller of the corresponding queue of the network card through a descriptor ring queue.
3. The method according to claim 1 or 2, characterized in that: The hardware unloading processing priority is the highest priority, and before sending the packet network packet of the real-time service to the corresponding target network card queue, it also includes: If the packet network packet matches the hardware offloading rule, hardware offloading processing is preferentially performed on the packet network packet; If the packet network packet does not match the hardware offloading rule, the step of sending the packet network packet of the real-time service to the corresponding target network card queue is performed.
4. The method according to claim 3, characterized in that The real-time service processing priority is higher than the non-real-time service processing priority, and the real-time service packet network packet is sent to the corresponding target network card queue, including: In the case where it is determined that the packet network packet matches the flow redirection rule, setting the packet network packet as a packet network packet for a real-time service; The packet network packet flow of the real-time service is directed to the target network card queue corresponding to the real-time service through the flow redirection of the network card, so as to give priority to processing the packet network packet of the real-time service.
5. The method according to claim 4, characterized in that After sending the grouped network packet of the real-time service to the corresponding target network card queue, the method further includes: If the grouped network packet does not match the flow redirection rule, determining whether the grouped network packet matches the flow balancing rule; If the packet network packet matches the traffic balancing rule, the packet network packet is set as a packet network packet of a non-real-time service, and the packet network packet of the non-real-time service is sent to the network card queue corresponding to the non-real-time service through traffic load balancing.
6. The method according to claim 4, characterized in that If the grouping network packet matches the flow redirection rule, it includes: At each network layer, identifying the grouped network packets; If it is identified that the grouped network packet matches the identification content corresponding to each network layer, it is determined that the grouped network packet matches the flow redirection rule.
7. The method according to claim 1, characterized in that The operating system thread corresponding to the target network card queue is set as a real-time class thread through an operating system interface; the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue are locked to process the grouped network packets of the real-time service, including: The resources of the general-purpose processor CPU core and the real-time class thread corresponding to the target network card queue are locked, and the grouped network packets of the real-time service are processed within a specified time range.
8. A network packet processing device, characterized in that: include: The sending module is used to receive the packet network packets of different service quality QoS levels and send the packet network packets of real-time services to the corresponding target network card queue; A processing module is used to lock the resources of the general processor CPU core and the operating system thread corresponding to the target network card queue to process the grouped network packets of the real-time service based on a pre-established linear mapping relationship; wherein the linear mapping relationship is a linear mapping relationship between the general CPU core, the operating system thread and the network card multiple queues.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the network packet processing method according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the network packet processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for realizing direct memory access
CN101650698A
Business management method, device and equipment
CN102375761A
Processing method and device for network data packet and electronic equipment
CN110022330A
Four-layer load balancing data processing method and related device
CN115766729A
NIC priority queue steering and processor unit frequency tuning based on packet flow analytics
US20210320881A1
Cited By
Data transmission method based on cooperation of power grid and charging facility party and related equipment
CN120583115A