A data packet forwarding system

By implementing bidirectional interaction between user space and kernel space in the eBPF packet forwarding system, the problem of poor performance in traditional systems is solved, packet forwarding efficiency and system resource utilization are improved, and high-performance, low-power and easily scalable packet forwarding is achieved.

CN116319308BActive Publication Date: 2026-01-27SHENZHEN LINKING INNOVATIVE NEBULA COMM TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310377890.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2026-01-27
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

Traditional eBPF-based packet forwarding systems are not fully functional and have poor performance. Furthermore, the packet processing involves context switching from kernel mode to user mode and multiple copies, resulting in low forwarding efficiency and high resource consumption.

Method used

In traditional eBPF-based packet forwarding systems, packet processing code is placed inside the kernel for processing. This enables bidirectional interaction between user space and kernel space, allowing the kernel space to control the user space to update forwarding behavior rules. Information exchange is achieved through shared memory space, including the first mapped memory area, the second mapped memory area, and the circular buffer, resulting in high performance, low power consumption, low hardware threshold, and easy scalability.

Benefits of technology

It achieves a balance between performance and full utilization of kernel functions, improving the performance of the packet forwarding system, reducing power consumption, and possessing high adaptability and scalability, thus perfecting the packet forwarding function of the user plane.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116319308B_ABST
    Figure CN116319308B_ABST
Patent Text Reader

Abstract

The application discloses a data packet forwarding system, comprising: a user state and a kernel state; the user state comprises: a control layer, a data layer and an extended Berkeley packet filter (eBPF) based software development kit; the kernel state comprises: a network card device interface, a quick data path (XDP) based data packet processing module and a memory space; the user state and the kernel state interact information through the shared memory space; wherein the information interaction comprises: the user state writes information control data packet processing module forwarding behavior to the memory space through the software development kit, reads information of the memory space to obtain data generated by the data packet processing module in runtime to update information written in the memory space, realizes bidirectional interaction between the user state and the kernel state, makes the kernel state control the user state to update the forwarding behavior rule reversely, takes into account the performance while fully utilizing the kernel function, and further improves the data packet forwarding function of the user plane function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network communication technology, and in particular to a data packet forwarding system. Background Technology

[0002] With the development of fifth-generation mobile communication technology (5G), users have increasingly higher requirements for bandwidth and need higher performance data packet processing capabilities.

[0003] Traditional User Plane Function (UPF) packet processing methods are based on establishing sockets for sending and receiving packets using the traditional TCP / IP protocol stack. However, this method requires copying packets from kernel space to user space. During this process, packets pass through the entire kernel protocol stack, undergoing context switching from kernel space to user space and multiple packet copies, which severely impacts packet forwarding efficiency. At the same time, it consumes a huge amount of system resources, resulting in enormous costs and making it difficult to support high-performance packet forwarding in UPF.

[0004] Currently, achieving efficient packet forwarding in user plane functions mainly involves two paths. One is to store packets directly in user space, completely bypassing the kernel. The Data Plane Development Kit (DPDK) is a typical example of this, but DPDK still suffers from high development difficulty, resource waste, and poor flexibility. The other approach is to run packet processing code within the kernel. eBPF provides a complete and comprehensive system that allows custom code to be executed within the kernel. However, packet forwarding systems based on the extended Berkeley Packet Filter (eBPF) are currently incomplete and have poor performance. Summary of the Invention

[0005] This invention provides a packet forwarding system. Compared with the mainstream DPDK solution, the packet forwarding system for user plane functions based on eBPF XDP balances performance and makes full use of kernel functions. It has the characteristics of high performance, low power consumption, low hardware threshold, high adaptability and easy expansion, and further improves the packet forwarding function of user plane functions.

[0006] According to one aspect of the present invention, a packet forwarding system is provided, integrated into the user plane function of a 5G core network, the packet forwarding system comprising: user mode and kernel mode;

[0007] The user space includes: a control layer, a data layer, and a software development kit based on the Extended Berkeley Packet Filter; the kernel space includes: a network interface card (NIC) device interface, a packet processing module based on the Fast Data Path (XDP), and memory space;

[0008] The user mode and the kernel mode interact with each other through the shared memory space; wherein, the information interaction includes: the user mode writing information to the memory space through a software development kit to control the forwarding behavior of the data packet processing module, and obtaining information written to the memory space by data generated by the data packet processing module during runtime by reading information from the memory space.

[0009] Furthermore, the memory space includes: a first mapped storage area, a second mapped storage area, and a circular buffer;

[0010] The first mapping storage area is used to store the network card configuration information and forwarding behavior rules written in user mode;

[0011] The second mapped storage area is used to store statistical data generated by the kernel-mode data packet processing module during runtime;

[0012] The circular buffer is used to store event messages generated by the kernel-mode data packet processing module during runtime.

[0013] Furthermore, the annular buffer includes:

[0014] Forwarding behavior rule request channel, address resolution protocol update channel, log channel and packet capture channel.

[0015] Furthermore, the control layer includes: a protocol access module, a session management module, and a packet detection rule management module;

[0016] The protocol access module is used to receive packet forwarding control protocol;

[0017] The session management module is used to manage the session context based on the packet forwarding control protocol and trigger the data layer to update the network card configuration information and forwarding behavior rules in the first mapping storage area;

[0018] The packet detection rule management module is used to manage packet detection rules based on the packet forwarding control protocol.

[0019] Furthermore, the data layer includes: a controller, a message parser, a data packet parser, a rule matching module, and a rule update module;

[0020] The message parser is used to obtain the event messages stored in the circular buffer through the software development kit, and to parse the event messages to obtain data packets;

[0021] The packet parser is used to parse the packet to obtain the packet 5-tuple and the packet identifier field;

[0022] The rule matching module is used to obtain the session context corresponding to the data packet identifier field from the session management module, and match the target packet detection rule of the data packet five-tuple from the packet detection rule management unit;

[0023] The rule update module is used to encapsulate the target packet detection rule and the session context into an update notification, and send the update notification to the controller;

[0024] The controller is used to update the forwarding behavior rules in the first mapping storage area based on the update notification.

[0025] Furthermore, the packet parser includes:

[0026] The uplink packet parser is used to parse the packets in the uplink event message to obtain the packet 5-tuple and tunnel endpoint identifier;

[0027] The downlink packet parser is used to parse downlink event message packets to obtain the packet 5-tuple and the user terminal identifier.

[0028] Furthermore, the data layer also includes: an address resolution protocol data packet processing module, a log printing module, and a packet capture management module;

[0029] The Address Resolution Protocol (ARP) data packet processing module is used to process ARP data packets;

[0030] The log printing module is used to print log records read from the log channel of the circular buffer;

[0031] The packet capture management module is used to parse the packet capture messages obtained by the message parser and send them to the controller.

[0032] Furthermore, the controller is also configured to: read statistical data from the second mapped storage area based on the parsed packet capture message;

[0033] Configure forwarding behavior rules in the first mapping storage area based on the parsed packet capture messages and the statistical data.

[0034] Furthermore, the network interface card (NIC) configuration information includes:

[0035] The list of local IP addresses configured on the network card, packet capture enable flag, and maximum transmission unit.

[0036] Furthermore, the data packet processing module is used to obtain the network card configuration information and the forwarding behavior rules from the first mapping storage area, and to perform forwarding processing on the data packets received by the network card based on the network card configuration information and the forwarding behavior rules.

[0037] The technical solution of this invention, by building upon the traditional eBPF-based packet forwarding system's unidirectional control where packet processing code is processed within the kernel, achieves bidirectional interaction between user space and kernel space. This allows the kernel space to control the user space to update forwarding behavior rules, solving the problems of insufficient functionality and poor performance in traditional eBPF-based packet forwarding systems. It achieves a balance between performance and full utilization of kernel functionality, possessing characteristics such as high performance, low power consumption, low hardware threshold, high adaptability, and easy scalability, further improving the packet forwarding function of the user plane.

[0038] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a schematic diagram of the structure of a data packet forwarding system provided in Embodiment 1 of the present invention;

[0041] Figure 2 This is a schematic diagram of another data packet forwarding system provided in Embodiment 2 of the present invention;

[0042] Figure 3 This is a schematic diagram of the user-space structure in a data packet forwarding system provided in Embodiment 3 of the present invention. Detailed Implementation

[0043] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0044] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0045] Example 1

[0046] Figure 1 This is a schematic diagram of a data packet forwarding system provided in Embodiment 1 of the present invention. This embodiment is applicable to user plane functions integrated into the 5G core network for forwarding data packets. Figure 1 As shown, the packet forwarding system includes: user space 10 and kernel space 20;

[0047] User space 10 includes: control layer 11, data layer 12, and software development kit 13 based on extended Berkeley packet filter; kernel space 20 includes: network interface card 21, packet processing module 22 based on fast data path XDP, and memory space 23;

[0048] User mode and kernel mode 20 interact with each other through shared memory space 23. The interaction includes: user mode 10 writing information to memory space 23 through software development kit to control the forwarding behavior of packet processing module 22, and reading information from memory space 23 to obtain data generated by packet processing module 22 during runtime to update the information written in memory space.

[0049] Among these is the software development kit based on the Extended Berkeley Packet Filter, namely the eBPF SDK. The eBPF SDK can be understood as a software development kit based on eBPF technology, providing a platform for programmable implementation of packet processing.

[0050] Extended Berkeley Packet Filter (eBPF) is a technology that allows sandboxed programs to run within the kernel. It provides a mechanism for secure code injection during kernel and user program events, enabling non-kernel developers to control the kernel. With kernel development, eBPF has expanded from its initial packet filtering capabilities to include networking, kernel, security, and tracing, and its features are rapidly evolving. Early versions of BPF were called classic BPF, or cBPF for short. Due to these functional extensions, the current BPF is known as extended BPF, or eBPF for short. The significance of eBPF for UPF lies in providing a complete and easy-to-use programming interface and toolkit, allowing some of the UPF's packet processing logic to be executed within kernel hooks. This results in shorter execution paths for processed packets, forming the foundation for high-performance UPF.

[0051] A Software Development Kit (SDK) is generally a collection of development tools used by software engineers to build application software for specific software packages, software frameworks, hardware platforms, operating systems, etc. An SDK can simply be a collection of files providing application programming interfaces for a programming language, but it may also include complex hardware capable of communicating with embedded systems.

[0052] The eXpress Data Path (XDP) is a specific hook point in the eBPF kernel. It processes network packets as early as possible when they arrive at the network interface card (NIC) driver layer, resulting in excellent data plane processing performance. Therefore, in the UPF design, XDP is chosen as the insertion point for packet processing logic to achieve optimal forwarding performance.

[0053] Specifically, the packet forwarding system includes user mode 10 and kernel mode 20. User mode 10 is mainly responsible for acquiring and updating forwarding behavior rules, as well as handling complex signaling processes and other tasks, while kernel mode 20 is mainly responsible for the specific processes of receiving and forwarding packets.

[0054] User space 10 can specifically include the following three parts: control layer 11, data layer 12, and software development kit 13 (i.e., eBPF SDK) based on extended Berkeley packet filter. Control layer 11 is responsible for managing session and packet detection rules (PDR) based on received signaling. Data layer 12 is used to write forwarding behavior rules into the kernel's memory space or update the forwarding behavior rules stored in the memory space through the eBPF SDK.

[0055] Kernel mode 20 includes: a network interface card (NIC) 21, a packet processing module 22 based on the Fast Data Path (XDP), and memory space 23. NIC 21 receives packets that need to be forwarded or forwarded packets. The packet processing module 22 forwards the packets received by NIC 21 to another NIC. Memory space 23 can be shared by kernel mode and user mode, enabling information exchange between the two.

[0056] After receiving a data packet through the network card device 21, the packet processing module 22 in kernel mode 20 needs to read the forwarding behavior rules written by user mode 10 from memory space 23 and forward the data packet according to the forwarding behavior rules. At the same time, information is generated during the forwarding of the data packet. This information is written to memory space 23 so that user mode 10 can read the information in memory space 23, process it, and then update the forwarding behavior rules in memory space 23 so that packet processing module 22 can use the updated forwarding behavior rules to forward the data packet.

[0057] The packet forwarding system provided in this invention includes a user space and a kernel space. The user space includes a control layer, a data layer, and a software development kit (SDK) based on the Extended Berkeley Packet Filter (eBPF). The kernel space includes a network interface card (NIC) interface, a packet processing module based on the Fast Data Path (XDP), and memory space. The user space and kernel space interact through a shared memory space. This interaction includes the user space writing information to the memory space using the SSD to control the forwarding behavior of the packet processing module, and reading information from the memory space to update the information written to the memory space by the data generated by the packet processing module during runtime. In traditional eBPF-based packet forwarding systems, which rely on unidirectional control where packet processing code is processed within the kernel, this invention achieves bidirectional interaction between the user space and kernel space. This allows the kernel space to control the user space to update forwarding rules, balancing performance with full utilization of kernel functionality. It features high performance, low power consumption, low hardware requirements, high adaptability, and easy scalability, further improving the packet forwarding functionality of the user plane.

[0058] Example 2

[0059] Figure 2 This is a schematic diagram of another packet forwarding system provided in Embodiment 2 of the present invention. The kernel-mode memory space in this embodiment is further limited compared to the packet forwarding systems of the above embodiments. For example... Figure 2 As shown, the memory space 23 shared by kernel mode and user mode includes: a first mapped storage area 231, a second mapped storage area 232, and a circular buffer 233;

[0060] The first mapping storage area 231 is used to store the network card configuration information and forwarding behavior rules written by user mode 10;

[0061] The second mapped storage area 232 is used to store statistical data generated by the data packet processing module collected by kernel mode 20 during runtime.

[0062] The circular buffer 233 is used to store event messages generated by the data packet processing module collected by kernel mode 20 during runtime.

[0063] Specifically, the shared memory space 23 between user mode 10 and kernel mode 20 can be divided into three parts based on the different stored information: a first mapped storage area 231, a second mapped storage area 232, and a circular buffer 233. The first mapped storage area stores the network interface card configuration information and forwarding behavior rules written by user mode 10. The second mapped storage area stores the statistical data generated by the packet processing module during runtime, collected by kernel mode 20. In this embodiment, the data flow in each storage area or buffer within the kernel mode memory space is always unidirectional, avoiding data consistency issues caused by simultaneous writes.

[0064] The first and second mapping storage areas can use a Map data structure to store information. A Map is a data structure implemented in eBPF, a key-value data storage container. In UPF design, three types of Maps can be used: BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_PERCPU_ARRAY, and BPF_MAP_TYPE_ARRAY. Access performance is a crucial factor when choosing a Map type. BPF_MAP_TYPE_ARRAY performs better than BPF_MAP_TYPE_HASH. Therefore, the second mapping storage area for storing statistical data can use an array table and employ a read-write separation design to ensure unidirectional data flow between user-space programs and the XDP program, avoiding data consistency issues caused by simultaneous writes. Furthermore, to avoid lock contention, the second mapping storage area for storing statistical data tables uses the PERCPU variable allocator, allocating memory separately for each CPU. When multiple CPUs execute the XDP program concurrently, there are no write conflicts, ensuring the accuracy of the statistical data.

[0065] A ring buffer (RINGBUF) is also a type of map (MAP), and in UPF it is encapsulated as a message queue. In the XDP-based packet processing module, data is encapsulated into a message according to a certain format and sent to the RINGBUF message channel. This informs the user space of events generated in the XDP program. After receiving the message and interpreting its content, the user space can perform the corresponding processing.

[0066] Optionally, the circular buffer includes:

[0067] Forwarding behavior rule request channel, address resolution protocol update channel, log channel and packet capture channel.

[0068] Specifically, the messages stored in the ring buffer can include: Forwarding Behavior Rule Request (PDR) messages generated by the XDP-based packet processing module, Address Resolution Protocol (APR) messages, log messages, and packet capture messages. Therefore, the ring buffer (RINGBUF) can be further divided into four channels: the Forwarding Behavior Rule Request channel, the Address Resolution Protocol Update channel, the log channel, and the packet capture channel, each used to store the aforementioned four types of information, ensuring that the storage and retrieval of each type do not interfere with each other.

[0069] Optionally, the packet processing module is used to obtain the network card configuration information and the forwarding behavior rules from the first mapping storage area, and to perform forwarding processing on the packets received by the network card based on the network card configuration information and the forwarding behavior rules.

[0070] Specifically, the packet processing module based on the Fast Data Path (XDP) uses XDP technology to forward packets received by the network interface card (NIC). The forwarding process can include: upon receiving a packet, parsing the packet, retrieving NIC configuration information and forwarding rules from the first mapping storage area based on the information contained in the parsed packet, and then forwarding the packet according to the NIC configuration information and forwarding rules.

[0071] One advantage of using XDP's packet processing module for data forwarding is that it can fully utilize the kernel's network protocol stack. In the DPDK implementation, because the kernel is completely bypassed, a separate protocol stack needs to be implemented, including ARP, ICMP, and other protocols, as well as a complete implementation of routing protocols for flexible routing and forwarding. This not only relies on specific kernel modules but also requires complex format conversions. In contrast, in XDP programs, using these functions only requires executing a PASS action to allow packets to enter the kernel protocol stack for processing, with virtually zero cost.

[0072] Optionally, the network interface card (NIC) configuration information includes:

[0073] The list of local IP addresses configured on the network card, packet capture enable flag, and maximum transmission unit.

[0074] Specifically, the local IP address list contains the local IP addresses of the network interface card (NIC). The packet capture start flag indicates whether the NIC has started capturing data packets. The maximum transmission unit (MTBF) indicates the maximum size of data packets that the NIC can handle.

[0075] Example 3

[0076] Figure 3 This is a schematic diagram of the user-space structure in a packet forwarding system according to Embodiment 3 of the present invention. This embodiment further defines the user-space structure compared to the packet forwarding systems of the above embodiments. For example... Figure 3 As shown, user space 10 includes a control layer 11, a data layer 12, and a software development kit 13 based on the extended Berkeley packet filter, and user space and kernel space 20 interact with each other through memory space 23.

[0077] To ensure kernel security, XDP-based packet processing modules employ various strict boundary checks and restrictions, significantly complicating XDP programming. This means that complex functionalities cannot be implemented within XDP; complex tasks such as rule retrieval and updates can be handled in user space. For GTP non-T-PDU packets, processing is more complex but requires fewer executions, and can also be performed in the user background.

[0078] The control layer 11 includes: a protocol access module, a session management module, and a packet detection rule management module;

[0079] The protocol access module is used to receive packet forwarding control protocol;

[0080] The session management module is used to manage the session context based on the packet forwarding control protocol and trigger the data layer to update the network card configuration information and forwarding behavior rules in the first mapping storage area;

[0081] The packet detection rule management module is used to manage packet detection rules based on the packet forwarding control protocol.

[0082] Specifically, such as Figure 3As shown, the control layer of user mode 10 completes the initialization process before the network interface card (NIC) device receives data packets. During initialization, it receives signaling information from network elements through the protocol access module, obtains the Packet Forwarding Control Protocol (PFCP) from it, and sends the PFCP to the session management module and the packet detection rule management module respectively. The session management module creates, updates, and deletes session contexts according to the PFCP. When a session context is updated, it triggers the data layer to update the NIC configuration information and forwarding behavior rules in the first mapping storage area through the software development kit. The packet detection rule management module creates, updates, and deletes packet detection rules (PDR) based on the PFCP.

[0083] The data layer 12 includes: a controller, a message parser, a data packet parser, a rule matching module, and a rule update module;

[0084] The message parser is used to obtain the event messages stored in the circular buffer through the software development kit, and to parse the event messages to obtain data packets;

[0085] The packet parser is used to parse the packet to obtain the packet 5-tuple and the packet identifier field;

[0086] The rule matching module is used to obtain the session context corresponding to the packet identifier field from the session management module, match the target packet detection rule of the packet five-tuple from the packet detection rule management unit, encapsulate the target packet detection rule and the session context into an update notification and send it to the controller;

[0087] The controller is used to update the forwarding behavior rules in the first mapping storage area based on the update notification.

[0088] Specifically, such as Figure 3As shown, during the process of capturing data packets at the network interface card, the kernel generates time messages and writes them into a circular buffer shared by the kernel and user spaces to store event messages. This allows the user-space data layer to access the event messages stored in the circular buffer via a software development kit (SDK). The message parser then parses the event messages to obtain data packets, which are then sent to the packet parser. The packet parser processes and parses the data packets, extracting the packet 5-tuple and identifier field, and sends these to the rule matching module. The rule matching module retrieves the session context corresponding to the data packet from the session management module using the identifier field, and obtains the matching target packet detection rule from the packet detection rule management unit based on the packet 5-tuple. If a match is successful, the target packet detection rule and session context are encapsulated into an update notification and sent to the controller. Upon receiving the update notification, the controller updates the forwarding behavior rules stored in the first mapping storage area based on the target packet detection rule and session context contained in the update notification. This achieves reverse control of user space forwarding behavior rule updates based on kernel space, fully utilizing the kernel's functionality.

[0089] This invention provides a packet forwarding system based on eBPF and XDP using a UPF architecture. The user plane functions based on eBPF and XDP achieve high-performance packet forwarding, sufficient for most scenario requirements. It has low hardware requirements, operating well even with a single-core CPU, and strong network card adaptability, compatible with all types of network cards. The XDP-based packet processing module acts as a high-speed packet forwarding channel, while the user-space forwarding capabilities (based on socket transmission and reception) can be used to acquire and update rules, as well as handle complex signaling processes and other transactions, providing technical support for implementing advanced forwarding features such as NAT and routing functions.

[0090] Optionally, the packet parser includes:

[0091] The uplink packet parser is used to parse the packets in the uplink event message to obtain the packet 5-tuple and tunnel endpoint identifier;

[0092] The downlink packet parser is used to parse downlink event message packets to obtain the packet 5-tuple and the user terminal identifier.

[0093] Specifically, the message parser processes messages to obtain uplink and downlink messages. Uplink messages are parsed to obtain uplink data packets, which are then parsed using an uplink data packet parser. Similarly, downlink messages are parsed to obtain downlink data packets, which are then parsed using a downlink data packet parser. Uplink data packets refer to the data packets contained in messages uploaded from the user equipment to the network equipment, while downlink data packets refer to the data packets contained in messages sent from the network equipment to the user equipment.

[0094] Specifically, the identification field extracted from uplink data packets is the Tunnel Endpoint Identifier (TEID); the identification field extracted from downlink data packets is the User Equipment Internet Protocol Address (UEIP). The packet 5-tuple includes: source IP, destination IP, protocol, source port, and destination port.

[0095] Optionally, the data layer 12 further includes: an address resolution protocol data packet processing module, a log printing module, and a packet capture management module;

[0096] The Address Resolution Protocol (ARP) data packet processing module is used to process ARP data packets;

[0097] The log printing module is used to print log records read from the log channel of the circular buffer;

[0098] The packet capture management module is used to parse the packet capture messages obtained by the message parser and send them to the controller.

[0099] Specifically, the user-space data layer 12 can process Address Resolution Protocol (ARP) packets (TCP / IP packets that retrieve physical addresses from IP addresses) through the Address Resolution Protocol packet processing module. ARP packets require forwarding by a packet processing module, so they can be directly processed and sent through this module, updating the ARP table. The user-space data layer 12 can also print log information generated by the kernel during runtime. Furthermore, when the kernel captures packets, it can write packet capture messages to memory to notify the user-space to update rules. Therefore, the user-space data layer 12 can also include a packet capture management module to parse packet capture messages and notify the controller to update the forwarding behavior rules in memory.

[0100] This invention reduces the energy consumption of the data forwarding system through a packet capture management module, and hardly occupies system resources when no data packets are captured.

[0101] Optionally, the controller is further configured to: read statistical data from the second mapped storage area based on the parsed packet capture message;

[0102] Configure forwarding behavior rules in the first mapping storage area based on the parsed packet capture messages and the statistical data.

[0103] Specifically, after receiving the parsed packet capture message sent by the packet capture management module, the controller can read the statistical data stored in the second mapping storage area, configure the forwarding behavior rules in the first mapping storage area according to the statistical data and the packet capture message, and realize the update of the forwarding behavior rules.

[0104] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0105] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A data packet forwarding system, characterized in that, The user plane functions integrated into the 5G core network include a data packet forwarding system comprising user space and kernel space. The user space includes: a control layer, a data layer, and a software development kit based on the Extended Berkeley Packet Filter; the kernel space includes: a network interface card (NIC) device interface, a packet processing module based on the Fast Data Path (XDP), and memory space; The user space and the kernel space interact with each other through the shared memory space; wherein, the information interaction includes: the user space writing information to the memory space through the software development kit to control the forwarding behavior of the data packet processing module, and obtaining the information written to the memory space by the data generated by the data packet processing module at runtime by reading the information in the memory space; the control layer includes: a protocol access module, a session management module, and a packet detection rule management module; The protocol access module is used to receive packet forwarding control protocol; The session management module is used to manage the session context based on the packet forwarding control protocol, and to trigger the data layer to update the network card configuration information and forwarding behavior rules in the first mapped storage area of ​​the memory space when the session context is updated. The packet detection rule management module is used to manage packet detection rules based on the packet forwarding control protocol; The data layer includes: a controller, a message parser, a data packet parser, a rule matching module, and a rule update module; The message parser is used to obtain event messages stored in the circular buffer of the memory space through the software development kit, and to parse the event messages to obtain data packets; The packet parser is used to parse the packet to obtain the packet 5-tuple and the packet identifier field; The rule matching module is used to obtain the session context corresponding to the data packet identifier field from the session management module, and match the target packet detection rule of the data packet five-tuple from the packet detection rule management module; The rule update module is used to encapsulate the target packet detection rule and the session context into an update notification, and send the update notification to the controller; The controller is configured to update the forwarding behavior rules in the first mapped storage area of ​​the memory space based on the update notification.

2. The system according to claim 1, characterized in that, The annular buffer includes: Forwarding behavior rule request channel, address resolution protocol update channel, log channel and packet capture channel.

3. The system according to claim 1, characterized in that, The packet parser includes: The uplink packet parser is used to parse the packets in the uplink event message to obtain the packet 5-tuple and tunnel endpoint identifier; The downlink packet parser is used to parse downlink event message packets to obtain the packet 5-tuple and the user terminal identifier.

4. The system according to claim 1, characterized in that, The data layer also includes: an address resolution protocol data packet processing module, a log printing module, and a packet capture management module; The Address Resolution Protocol (ARP) data packet processing module is used to process ARP data packets; The log printing module is used to print log records read from the log channel of the circular buffer; The packet capture management module is used to parse the packet capture messages obtained by the message parser and send them to the controller.

5. The system according to claim 4, characterized in that, The controller is also configured to: read statistical data from the second mapped storage area of ​​the memory space based on the parsed data packet capture message; Configure forwarding behavior rules in the first mapped storage area of ​​the memory space based on the parsed packet capture messages and the statistical data.

6. The system according to claim 1, characterized in that, The network interface card (NIC) configuration information includes: The list of local IP addresses configured on the network card, packet capture enable flag, and maximum transmission unit.

7. The system according to claim 1, characterized in that, The packet processing module is used to obtain the network card configuration information and the forwarding behavior rules from the first mapping storage area, and to perform forwarding processing on the packets received by the network card based on the network card configuration information and the forwarding behavior rules.

Citation Information

Patent Citations

  • Traffic data processing method and device, storage medium and electronic equipment

    CN114726633A

  • Host side lightweight container flow monitoring system and method based on eBPF

    CN115834448A