DPDK composition structure

        In Figure 1-1, DPDK has two modules in the bottom kernel state (Linux Kernel): KNI and IGB_UIO. Among them, KNI provides users with a protocol stack using the Linux kernel state and traditional Linux network tools (such as ethool, ifconfig). IGB_UIO (igb_uio.ko and kni.ko.IGB_UIO) uses UIO technology to map the network card hardware registers to user mode during initialization.

        As shown in Figure 1-1, the upper user mode of DPDK is composed of many libraries, mainly including core components library (core Libraries), platform-related modules (platform), network card polling mode driver module (PMD-natives & virtual), Qos Library, message forwarding classification algorithm (classify algorithm), etc., user applications can use these libraries for secondary development, and a brief introduction is given below.

Figure 1-1 DPDK composition structure

(1) Core component library

        The running environment composed of this module is built on Linux and initialized through the running environment of the environment abstraction layer (EAL) , including huge page memory allocation, memory/buffer/queue allocation and lock-free operation, CPU affinity binding, etc.; Secondly, EAL realizes the shielding of I/O operations between the operating system kernel and the underlying network card (I/O bypasses the kernel and its protocol stack) , provides a set of call interfaces for DPDK applications, and uses UIO or VFIO technology to connect PCI The device address is mapped to the user space, which facilitates the calling of the application program and avoids the processing delay caused by the switching of the network protocol stack and the kernel. In addition, the core components also include creating a memory pool suitable for message processing, buffer allocation management, memory copying, and timers. Ring buffer management , etc.

(2) Platform related modules

        Its internal modules mainly include KNI, energy management and IVSHMEM interface . Among them, the KNI module mainly passes the data message from the user state to the kernel state protocol stack through the kni.ko module, so that the user can use the traditional Socket interface to process the relevant message; the energy management provides some APIs, application programs It can dynamically adjust the processor frequency or enter different sleep states of the processor according to the packet receiving rate; in addition, the IVSHEME module provides a zero-copy shared memory mechanism between virtual machines, or between virtual machines and hosts, when the DPDK program When running, the IVSHMEM module will call the core component library API, map several huge pages into an IVSHMEM device pool, and pass parameters to QEMU, thus realizing zero-copy memory sharing between virtual machines.

(3) Polling mode driver module

        PMD-related APIs realize the sending and receiving of network card messages in polling mode, avoiding the response delay caused by the interrupt mode in conventional message processing methods, and greatly improving the performance of network card sending and receiving. In addition, the module also supports both physical and virtual network interfaces, from only supporting Intel network cards to supporting the entire industry ecosystem such as Cisco, Broadcom, Mellanox, Chelsio, and virtualized network interfaces based on KVM, VMware, and XEN.

        DPDK also defines a large number of APIs to abstract data plane forwarding applications, such as ACL, QoS, traffic classification, and load balancing. And, in addition to the Ethernet interface, DPDK also defines software and hardware acceleration interfaces (extension) for encryption/decryption.

        In general, DPDK technology has the following characteristics:

        1. DPDK supports two message processing modes: run to completion and pipeline. Users can choose flexibly according to their needs, or use them in combination. Run to completion is a horizontal scheduling method that uses the multi-queues of the network card to distribute packets to multiple CPU cores for processing. Each core independently processes the packets arriving in the queue. The resource allocation is relatively fixed, reducing the number of packets in the queue. The transmission overhead between cores can flexibly expand the processing capacity with the number of cores; the pipeline mode transmits data packets or messages between cores through the shared ring, decomposes the system processing tasks to different CPU cores for processing, and distributes tasks to Reduce processing latency.

        2. DPDK library functions and sample programs are very rich, including L2/L3 forwarding, hashing, ACL, QoS, ring queue and many other examples for user reference.

 

Guess you like

Origin blog.csdn.net/weixin_45337873/article/details/127221878