WO2025124178A1 - 一种基于DPDK的解决IPSec大象流的方法与装置 - Google Patents

一种基于DPDK的解决IPSec大象流的方法与装置 Download PDF

Info

Publication number
WO2025124178A1
WO2025124178A1 PCT/CN2024/135825 CN2024135825W WO2025124178A1 WO 2025124178 A1 WO2025124178 A1 WO 2025124178A1 CN 2024135825 W CN2024135825 W CN 2024135825W WO 2025124178 A1 WO2025124178 A1 WO 2025124178A1
Authority
WO
WIPO (PCT)
Prior art keywords
encryption
flow
messages
elephant
ipsec
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2024/135825
Other languages
English (en)
French (fr)
Inventor
刘邦运
傅旭明
周玉波
张义飞
吕玉超
韩国军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Cloud Technology Co Ltd
Original Assignee
China Telecom Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Cloud Technology Co Ltd filed Critical China Telecom Cloud Technology Co Ltd
Publication of WO2025124178A1 publication Critical patent/WO2025124178A1/zh
Anticipated expiration legal-status Critical
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/43Assembling or disassembling of packets, e.g. segmentation and reassembly [SAR]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/622Queue service order
    • H04L47/6225Fixed service order, e.g. Round Robin
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Definitions

  • the present application relates to the field of network communication technology, and in particular to a method and device for solving IPSec elephant flows based on DPDK.
  • domestic servers In terms of the current single-core processor performance comparison, the performance of domestic processors is still not comparable to Intel processors.
  • the common practice currently adopted by domestic servers is to improve their overall computing power by superimposing the number of CPU cores.
  • domestic servers Using the RTC model of DPDK, domestic servers will have bottleneck problems in the processing of elephant flows due to the decline in single-core performance.
  • the offload function is generally used to enhance the hardware capabilities.
  • Intel has launched a barefoot-based programmable switching chip to achieve higher throughput; it has also launched a CPU with DLB function, which can distribute the elephant flow to multiple CPUs by using DLB.
  • the new generation of CX7 series network cards launched by NVIDIA can use hardware encryption and decryption to process messages, and then use the RSS function of the inner layer message to send it to the various queues of the network card, thereby dividing an elephant flow into multiple flows.
  • the present application aims to solve at least one of the technical problems in the related art to a certain extent.
  • one purpose of the present application is to propose a method and device for solving IPSec elephant flow based on DPDK.
  • the present application is based on DPDK technology, software to implement IPSec elephant flow detection, and multi-core IPSec encryption and decryption of elephant flow to solve the performance bottleneck of this single-core processor, which can be applied in a wider range of scenarios.
  • the reassembling of the fragmented messages refers to: storing the received fragmented messages in a fragmented linked list, if the last fragmented message has not been received, storing the received fragmented messages in the fragmented linked list to wait for subsequent fragmented messages, and assembling the fragmented messages that arrive in sequence according to their position information in the original message to obtain a reassembled message;
  • the encryption and decryption sending module is used to encrypt and decrypt the messages in the encryption and decryption engine working core and send them to CPU1 for sorting, and then send them to the network card sending queue.
  • One aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor.
  • the processor executes the program, the steps in a method for resolving IPSec elephant flows based on DPDK are implemented.
  • One aspect of the present application provides a readable storage medium storing a computer program, wherein the computer program is suitable for being loaded by a processor to execute steps in a method for resolving IPSec elephant flows based on DPDK.
  • the DPDK-based method for solving IPSec elephant flows proposed in this application has the following advantages:
  • This application considers the bottleneck problem faced by this single-core processing of IPSec elephant flows.
  • a pipeline model is introduced to detect elephant flows and process them in parallel on multiple cores, thereby solving the packet loss problem caused by the single-core performance bottleneck, so that the throughput of a single IPSec elephant flow can increase linearly with the increase in the number of CPU cores.
  • the single-core processing performance is relatively low, but the total number of CPUs is relatively large. This application can better solve the overall performance problem at a low cost.
  • FIG1 is a flowchart of a method for solving IPSec elephant flow based on DPDK in the present application
  • FIG2 is a schematic diagram of a network card RSS and data flow
  • FIG3 is a functional module diagram of a device for solving IPSec elephant flow based on DPDK of the present application
  • FIG4 is a schematic diagram of the structure of an electronic device provided by the present application.
  • FIG. 5 is a schematic diagram of a readable storage medium structure provided by the present application.
  • a method flow chart of a method for solving IPSec elephant flow based on DPDK includes:
  • Step S100 According to the configuration file, CPU0 and CPU1 are initialized as PMD thread cores, CPU 2, CPU 3, and CPU 4 are initialized as encryption and decryption engine working cores, an unlocked loop is created for communication between the PMD thread cores and the encryption and decryption engine working cores, and a network card sending queue and a network card receiving queue are established;
  • Initializing CPU0 and CPU1 as PMD thread cores means that both CPU0 and CPU1 are implemented as PMD thread cores of DPDK, and perform polling tasks on the network card sending queue and the network card receiving queue;
  • Initializing CPU 2, CPU 3, and CPU 4 as encryption and decryption engine working cores means that CPU 2, CPU 3, and CPU 4 are implemented as encryption and decryption engine working cores to implement encryption and decryption processing of messages, wherein the first CPU core is CPU 2, which is used to perform message processing of ordinary flows, and CPU 3 and CPU 4 are used to perform encryption and decryption of messages of elephant flows in parallel;
  • the creation of a lockless loop for communication between the PMD thread core and the encryption and decryption engine working core refers to: using the lockless loop of DPDK, in the initialization phase, establishing a communication channel between the PMD thread cores, i.e., CPU0 and CPU1, and the encryption and decryption engine working core, to achieve message inter-core transmission;
  • This application is mainly used to solve the performance bottleneck problem faced by IPSec elephant flow.
  • it is necessary to achieve accurate elephant flow detection as much as possible, and to achieve efficient IPSec encryption and decryption without wasting CPU resources.
  • the best implementation example of this application is given:
  • the message when it needs to be fragmented, it can be implemented by encrypting it first and then fragmenting it.
  • a functional module diagram of a device for solving IPSec elephant flow based on DPDK includes:
  • Initialization creation module used to initialize CPU0 and CPU1 as PMD thread cores according to the configuration file, initialize CPU 2, CPU 3, and CPU 4 as encryption and decryption engine working cores, create an unlocked loop for communication between PMD thread cores and encryption and decryption engine working cores, and establish network card sending queues and network card receiving queues;
  • the elephant flow detection and distribution module is used for the PMD thread core to perform polling work regularly, obtain messages and detect elephant flows and ordinary flows, load balance the elephant flows, and distribute the messages to the encryption and decryption engine working core;
  • the encryption and decryption sending module is used to encrypt and decrypt the messages in the encryption and decryption engine working core and send them to CPU1 for sorting, and then send them to the network card sending queue.
  • FIG4 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. As shown in FIG4, an electronic device is also provided according to another aspect of the present application.
  • the electronic device may include one or more processors and one or more memories.
  • the memory stores a computer readable code, and when the computer readable code is run by one or more processors, it can execute a method for solving IPSec elephant flow based on DPDK as described above.
  • the electronic device may include a bus, one or more CPUs, a read-only memory (ROM), a random access memory (RAM), a communication port connected to a network, an input/output component, a hard disk, etc.
  • the storage device in the electronic device such as a ROM or a hard disk, can store a method for solving the IPSec elephant flow based on DPDK provided in the present application.
  • a method for solving the IPSec elephant flow based on DPDK may, for example, include: according to the configuration file, initialize CPU0 and CPU1 as PMD thread cores, initialize CPU 2, CPU 3, and CPU 4 as encryption and decryption engine working cores, create a lockless loop for communication between the PMD thread core and the encryption and decryption engine working core, and establish a network card sending queue and a network card receiving queue; the PMD thread core periodically performs polling work, obtains messages and detects elephant flows and ordinary flows, load balances the elephant flows, and distributes the messages to the encryption and decryption engine working cores; encrypts and decrypts the messages in the encryption and decryption engine working cores and sends them to CPU1 for sorting, and then sends them to the network card sending queue.
  • the electronic device may also include a user interface.
  • the architecture shown in FIG. 4 is merely exemplary, and when implementing different devices, one or more components in the electronic device shown in FIG. 4 may be omitted
  • FIG5 is a schematic diagram of the structure of a readable storage medium provided by an embodiment of the present application. As shown in FIG5 , it is a readable storage medium according to an embodiment of the present application.
  • Computer-readable instructions are stored on the computer-readable storage medium. When the computer-readable instructions are executed by the processor, a method for solving IPSec elephant flows based on DPDK according to an embodiment of the present application described with reference to the above figures can be executed.
  • the storage medium includes, but is not limited to, for example, volatile memory and/or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and cache memory (cache), etc.
  • Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc.
  • the process described above with reference to the flowchart can be implemented as a computer software program.
  • the present application provides a non-temporary machine-readable storage medium, the non-temporary machine-readable storage medium stores machine-readable instructions, the machine-readable instructions can be executed by a processor to execute instructions corresponding to the method steps provided in the present application, for example: according to the configuration file, CPU0 and CPU1 are initialized as PMD thread cores, CPU 2, CPU 3, and CPU 4 are initialized as encryption and decryption engine working cores, a lockless loop is created for communication between the PMD thread core and the encryption and decryption engine working core, and a network card sending queue and a network card receiving queue are established; the PMD thread core periodically performs polling work, obtains messages and detects elephant flows and ordinary flows, load balances the elephant flows, and distributes the messages to the encryption and decryption engine working core; the messages in the encryption and decryption engine working core are encrypted and decrypte
  • the methods, apparatuses, and devices of the present application may be implemented in many ways.
  • the methods, apparatuses, and devices of the present application may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware.
  • the above order of steps for the method is for illustration only, and the steps of the method of the present application are not limited to the order specifically described above unless otherwise specified.
  • the present application may also be implemented as programs recorded in a recording medium, which include machine-readable instructions for implementing the method according to the present application. Therefore, the present application also covers recording media storing programs for executing the method according to the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请的一种基于DPDK的解决IPSec大象流的方法与装置,通过根据配置文件,根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2~4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核间的通信,建立网卡发送队列和网卡接收队列,PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中,对加解密引擎工作核中的报文加解密后发送给CPU1进行排序,然后发送给网卡发送队列,实现了大象流的检测,以及多核IPSec加解密大象流来解决此单核处理器的性能瓶颈,可应用场景更加广泛。

Description

一种基于DPDK的解决IPSec大象流的方法与装置 技术领域
本申请涉及网络通信技术领域,特别涉及一种基于DPDK的解决IPSec大象流的方法与装置。
背景技术
随着SDWAN的发展,以及企业、政府部门对安全性需求的提高,使用IPSec加密传输路径中的数据变成了基本需求,越来越多的组织构建自己的虚拟专用网络,由IPSec协议提供隧道安全保障。
由于信息化的深入,越来越多的上云业务、AI训练使用的大量数据、视频会议或者影视作品的高品质传输,对于SDWAN IPSec接入带来了高吞吐的要求,即这些数据在IPSec链路中形成了大量、持续传递的大象流。大象流对于带宽形成了一定的要求,对于IPSec链路的加解密节点也带来了挑战,即由于加解密比较耗CPU资源,大象流的到来可能让一个CPU线程无力处理更多的数据,导致传输报文的丢弃。另外,随着国产化信创的发展,更多的企业或部门为了摆脱对因特尔处理器的依赖,选择国产处理器。但就目前的单核处理器性能对比来说,国产处理器的性能还无法比肩因特尔处理器。当前国产服务器采用的普遍做法,是通过叠加CPU核数来提升其整体计算能力。使用DPDK的RTC模型,国产服务器会因为单核性能下降而导致对大象流的处理出现瓶颈问题。
解决IPSec大象流的问题,普遍使用卸载功能,通过增强硬件的能力来解决。因特尔公司推出的基于barefoot可编程交换芯片,实现更高吞吐;还推出了带有DLB功能的CPU,通过使用DLB可以将大象流分发到多个CPU上。类似地,英伟达公司推出的新一代CX7系列网卡可以使用硬件加解密处理报文,然后使用内层报文的RSS功能再送到网卡的各个队列中,从而使得一条大象流分成多条流。这些新出现的硬件解决了大象流以及更高吞吐的问题,只是可能会因为价格成本问题、或者信创领域的特殊要求而无法使用。
发明内容
本申请旨在至少在一定程度上解决相关技术中的技术问题之一。为此,本申请的一个目的在于提出一种基于DPDK的解决IPSec大象流的方法与装置,本申请基于DPDK技术,软件实现IPSec大象流的检测,以及多核IPSec加解密大象流来解决此单核处理器的性能瓶颈,其可应用场景更加广泛。
本申请的一个方面提供了一种基于DPDK的解决IPSec大象流的方法,包括:
步骤S100:根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核之间的通信,建立网卡发送队列和网卡接收队列;
所述将CPU0和CPU1初始化为PMD线程核是指:CPU0和CPU1都实现为DPDK的PMD线程核,对网卡发送队列和网卡接收队列执行轮询任务;
所述将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核是指:CPU 2、CPU 3、CPU 4实现为加解密引擎工作核,实现对报文的加解密处理,其中第一个CPU核为CPU 2,用来执行普通流的报文处理,CPU 3、CPU 4用来并行执行大象流的报文加解密;
所述创建无锁环用于PMD线程核和加解密引擎工作核之间的通信是指:利用DPDK的无锁环,在初始化阶段,建立PMD线程核即CPU0和CPU1与加解密引擎工作核之间的通信通道,实现报文核间传递;
所述网卡发送队列用于存储将要被发送到网络的报文;
所述网卡接收队列用于存储从网络中接收到的报文;
步骤S200:PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中;
所述PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中的具体步骤为:
步骤S210:调用rte_eth_rx_burst()读取网卡接收队列中的报文,按照报文的大小分为分片报文和非分片报文;
所述分片报文是指当报文的大小超过网络链路的最大传输单元时,报文就会被分割成m个片段,每个片段就是一个分片报文;
所述非分片报文是指如果报文的大小小于等于网络链路的最大传输单元,整个报文可以在一个报文中传输,而不需要分割分片;
步骤S220:对分片报文进行重组得到重组报文;
所述对分片报文进行重组是指:将接收到的分片报文存入分片链表,如果尚未收到最后一片分片报文,将已收到的分片报文存入分片链表等待后续分片报文,将按顺序到达的分片报文按照其在原始的报文中的位置信息进行组装得到重组报文;
步骤S230:对收到的非分片报文进行sflow抽样,所述非分片报文包含重组报文和不需要进行分片的报文,统计前K个传输流的已知流量数据,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,并更新大象流的流表数组;
所述对收到的非分片报文进行sflow抽样,所述非分片报文包含重组报文和不需要进行分片的报文,统计前K个传输流的已知流量数据,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,并更新大象流的流表数组是指:对于每个非分片报文,执行sflow抽样的操作,统计前K个传输流的已知流量数据,对每个传输流,判断是否达到大象流的阈值,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,在流表数组中维护大象流数据,如果传输流是大象流,将其五元组信息添加到流表数组中;
所述大象流是指网络链路中持续进行的占用较大带宽传递数据的过程,也可指此过程中的数据;
步骤S240:依次用大象流的流表数组对比收到的非分片报文,如果非分片报文属于大象流,则将该非分片报文标记为大象流,并按顺序编号,将该非分片报文放入加解密引擎工作核CPU3、CPU 4的无锁环中;如果是普通流,则将该非分片报文放入加解密引擎工作核CPU2的无锁环中;
步骤S300:对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列;
所述对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列的具体方法为:
每个加解密引擎工作核不断轮询自己的无锁环,取出非分片报文;查询IPSec策略判断非分片报文为出方向IPSec报文或入方向IPSec报文;若为出方向IPSec报文,根据对该出方向IPSec报文进行加密;若为入方向IPSec报文,则查询SA,并进行报文抗重放检查,然后进行解密,更新抗重放窗口;若为普通流,则不进行加解密处理,经过路由查询后,送入负责发送的CPU1;按照该非分片报文的编号进行排序,然后调用rte_eth_tx_burst()发送给网卡发送队列。
本申请的一个方面提供了一种基于DPDK的解决IPSec大象流的装置,包括:
初始化创建模块,用于根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核之间的通信,建立网卡发送队列和网卡接收队列;
大象流检测分发模块,用于PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中;
加解密发送模块,用于对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列。
本申请的一个方面提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时,以实现一种基于DPDK的解决IPSec大象流的方法中的步骤。
本申请的一个方面提供了一种可读存储介质,所述可读存储介质存储有计算机程序,所述计算机程序适于处理器进行加载,以执行一种基于DPDK的解决IPSec大象流的方法中的步骤。
本申请提出的一种基于DPDK的解决IPSec大象流的方法相对于现有技术,具备以下优点:
当前随着信息数据的巨量增长,信息安全需求的增强,对于SDWAN IPSec接入带来了高吞吐的要求,即这些数据在IPSec链路中形成了大量、持续传递的大象流。由于加解密非常消耗CPU资源,一条IPSec大象流很容易达到单核CPU线程的性能瓶颈,从而导致报文的丢失。
本申请考虑了这种单核处理IPSec大象流面临的瓶颈问题,在DPDK RTC模型的基础上,引入流水线模型,通过检测大象流,对大象流进行多核并行处理,从而解决由单核性能瓶颈导致的丢包问题,使得单条IPSec大象流的吞吐可以随着CPU核数的增加而线性增加。在一些国产信创环境,单核处理性能比较低,但其CPU总数较多,本申请能较好地以低成本解决总体性能问题。
附图说明
图1为本申请的一种基于DPDK的解决IPSec大象流的方法的方法流程框图;
图2为网卡RSS和数据流的示意图;
图3为本申请的一种基于DPDK的解决IPSec大象流的装置的功能模块图;
图4为本申请提供的一种电子设备的结构示意图;
图5是本申请提供的一种可读存储介质结构示意图。
具体实施方式
为了更好地理解本申请,将参考附图对本申请的各个方面做出更详细的说明。应理解,这些详细说明只是对本申请的示例性实施方式的描述,而非以任何方式限制本申请的范围。在说明书全文中,相同的附图标号指代相同的元件。表述“和/或”包括相关联的所列项目中的一个或多个的任何和全部组合。
在附图中,为了便于说明,已稍微调整了元素的大小、尺寸和形状。附图仅为示例而并非严格按比例绘制。如在本文中使用的,用语“大致”、“大约”以及类似的用语用作表近似的用语,而不用作表程度的用语,并且旨在说明将由本领域普通技术人员认识到的、测量值或计算值中的固有偏差。另外,在本申请中,各步骤处理描述的先后顺序并不必然表示这些处理在实际操作中出现的顺序,除非有明确其它限定或者能够从上下文推导出的除外。
还应理解的是,诸如“包括”、“包括有”、“具有”、“包含”和/或“包含有”等表述在本说明书中是开放性而非封闭性的表述,其表示存在所陈述的特征、元件和/或部件,但不排除一个或多个其它特征、元件、部件和/或它们的组合的存在。此外,当诸如“...中的至少一个”的表述出现在所列特征的列表之后时,其修饰整列特征,而非仅仅修饰列表中的单独元件。此外,当描述本申请的实施方式时,使用“可”表示“本申请的一个或多个实施方式”。并且,用语“示例性的”旨在指代示例或举例说明。
除非另外限定,否则本文中使用的所有措辞(包括工程术语和科技术语)均具有与本申请所属领域普通技术人员的通常理解相同的含义。还应理解的是,除非本申请中有明确的说明,否则在常用词典中定义的词语应被解释为具有与它们在相关技术的上下文中的含义一致的含义,而不应以理想化或过于形式化的意义解释。
需要说明的是,在不冲突的情况下,本申请中的实施方式及实施方式中的特征可以相互组合。下面将参考附图并结合实施方式来详细说明本申请。
实施例1
如图1所示,为本申请提供的一种基于DPDK的解决IPSec大象流的方法的方法流程框图,包括:
步骤S100:根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核之间的通信,建立网卡发送队列和网卡接收队列;
所述将CPU0和CPU1初始化为PMD线程核是指:CPU0和CPU1都实现为DPDK的PMD线程核,对网卡发送队列和网卡接收队列执行轮询任务;
所述将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核是指:CPU 2、CPU 3、CPU 4实现为加解密引擎工作核,实现对报文的加解密处理,其中第一个CPU核为CPU 2,用来执行普通流的报文处理,CPU 3、CPU 4用来并行执行大象流的报文加解密;
所述创建无锁环用于PMD线程核和加解密引擎工作核之间的通信是指:利用DPDK的无锁环,在初始化阶段,建立PMD线程核即CPU0和CPU1与加解密引擎工作核之间的通信通道,实现报文核间传递;
所述网卡发送队列用于存储将要被发送到网络的报文;
所述网卡接收队列用于存储从网络中接收到的报文;
步骤S200:PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中;
所述PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中的具体步骤为:
步骤S210:调用rte_eth_rx_burst()读取网卡接收队列中的报文,按照报文的大小分为分片报文和非分片报文;
所述分片报文是指当报文的大小超过网络链路的最大传输单元时,报文就会被分割成m个片段,每个片段就是一个分片报文;
所述非分片报文是指如果报文的大小小于等于网络链路的最大传输单元,整个报文可以在一个报文中传输,而不需要分割分片;
步骤S220:对分片报文进行重组得到重组报文;
所述对分片报文进行重组是指:将接收到的分片报文存入分片链表,如果尚未收到最后一片分片报文,将已收到的分片报文存入分片链表等待后续分片报文,将按顺序到达的分片报文按照其在原始的报文中的位置信息进行组装得到重组报文;
步骤S230:对收到的非分片报文进行sflow抽样,所述非分片报文包含重组报文和不需要进行分片的报文,统计前K个传输流的已知流量数据,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,并更新大象流的流表数组;
所述非分片报文不需要进行重组,因此包含完整的报文数据;
所述对收到的非分片报文进行sflow抽样,所述非分片报文包含重组报文和不需要进行分片的报文,统计前K个传输流的已知流量数据,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,并更新大象流的流表数组是指:对于每个非分片报文,执行sflow抽样的操作,统计前K个传输流的已知流量数据,对每个传输流,判断是否达到大象流的阈值,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,在流表数组中维护大象流数据,如果传输流是大象流,将其五元组信息添加到流表数组中;
所述大象流是指网络链路中持续进行的占用较大带宽传递数据的过程,也可指此过程中的数据;
相对的,网络链路中进行的占用较小带宽、短时间的数据传输过程,则称为老鼠流或者普通流;
步骤S240:依次用大象流的流表数组对比收到的非分片报文,如果非分片报文属于大象流,则将该非分片报文标记为大象流,并按顺序编号,将该非分片报文放入加解密引擎工作核CPU3、CPU 4的无锁环中;如果是普通流,则将该非分片报文放入加解密引擎工作核CPU2的无锁环中;
所述大象流的流表数组使用连续内存,通过以空间换时间、连续内存比特位比较的方式实现高效快速的比对检查,减少执行的CPU循环,降低此处大象流与非分片报文比对检查带来的对网络吞吐性能的影响;
步骤S300:对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列;
所述对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列的具体方法为:
每个加解密引擎工作核不断轮询自己的无锁环,取出非分片报文;查询IPSec策略判断非分片报文为出方向IPSec报文或入方向IPSec报文;若为出方向IPSec报文,根据对该出方向IPSec报文进行加密;若为入方向IPSec报文,则查询SA,并进行报文抗重放检查,然后进行解密,更新抗重放窗口;若为普通流,则不进行加解密处理,经过路由查询后,送入负责发送的CPU1;按照该非分片报文的编号进行排序,然后调用rte_eth_tx_burst()发送给网卡发送队列。
实施例2
RSS是当前网卡普遍采用的网络驱动技术,用于缓解单个CPU过载而导致的网络吞吐瓶颈,但现在随着SDWAN IPSec接入数据的猛增,如图2的网卡RSS和数据流的示意图,IPSec大象流的存在再次使得单个CPU的处理能力成为瓶颈所在。由于单核CPU的处理能力已经因为处理此IPSec大象流而达到极限,从服务质量(QoS)的角度来看,大象流和并行到达的普通流量会因此相互影响,并可能均产生不同程度的丢包,进而导致更严重的传输质量的下降。英伟达和因特尔推出的网卡和处理器特定功能,在硬件上解决了这些问题。但在一些场景中,或者基于考虑硬件成本考虑,或者是信创环境要考虑自主可控,不能使用这种新的硬件方案。
本申请主要用于解决IPSec大象流面临的性能瓶颈问题,在实现上要尽量做到大象流检测的精准,又要实现IPSec加解密的高效,同时不浪费CPU资源,基于一般的SDWAN IPSec入网实践,给出本申请的最佳实施例:
对应一个队列的加解密工作核可以为2~4个,性能较差的低端处理器可以采用更多的工作核。核间ring的描述符深度可以为512或者1024,在轮询时,一次读取核间传递报文的最大个数为32。
在使用大象流进行抽样检测时,为了使得抽样更加灵活,可将抽样百分率设置为可配置模式。抽样率低,可节省CPU资源;抽样率越高,检测准确率越高。默认地,可将抽样率设置为2%。在实现Top K算法时,从实际应用以及效率上考虑,以哈希表+堆的方式,可最多支持20条大象流的匹配,一般地,可选择最多支持10条大象流进行匹配,以此来节省查找时间。一般地,选择源地址IP、目的地址IP、源端口、目的端口、传输层协议作为一条流的特征,为了灵活高效,可实现配置接口支持手工配置大象流规则,来减少抽样检测带来的资源消耗。
加解密引擎工作核在查找使用SA时,要考虑核间同步。SA数据结构的创建删除使用RCU机制进行更新。为了实现抗重放窗口检查和更新的高效,PMD线程核将大象流送入加解密引擎工作核的核间ring时,将N个连续的报文送入其中一个ring,再将另外N个连续的报文送入下一个ring。
为了在实现上降低难度,报文需要分片时,可采用先加密后分片的方式进行实现。
实施例3
如图3所示,为本申请提供的一种基于DPDK的解决IPSec大象流的装置的功能模块图,包括:
初始化创建模块,用于根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核之间的通信,建立网卡发送队列和网卡接收队列;
大象流检测分发模块,用于PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中;
加解密发送模块,用于对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列。
实施例4
图4是本申请一个实施例提供的电子设备结构示意图。如图4所示,根据本申请的又一方面还提供了一种电子设备。该电子设备可包括一个或多个处理器以及一个或多个存储器。其中,存储器中存储有计算机可读代码,计算机可读代码当由一个或多个处理器运行时,可以执行如上所述的一种基于DPDK的解决IPSec大象流的方法。
根据本申请实施方式的方法或系统也可以借助于图4所示的电子设备电子设备的架构来实现。如图4所示,电子设备可包括总线、一个或多个CPU、只读存储器(ROM)、随机存取存储器(RAM)、连接到网络的通信端口、输入/输出组件、硬盘等。电子设备中的存储设备,例如ROM或硬盘可存储本申请提供的一种基于DPDK的解决IPSec大象流的方法。一种基于DPDK的解决IPSec大象流的方法可例如包括:根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核之间的通信,建立网卡发送队列和网卡接收队列;PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中;对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列。进一步地,电子设备还可包括用户界面。当然,图4所示的架构只是示例性的,在实现不同的设备时,根据实际需要,可以省略图4示出的电子设备中的一个或多个组件。
实施例5
图5是本申请一个实施例提供的可读存储介质结构示意图。如图5所示,是根据本申请一个实施方式的可读存储介质。计算机可读存储介质上存储有计算机可读指令。当计算机可读指令由处理器运行时,可执行参照以上附图描述的根据本申请实施方式的一种基于DPDK的解决IPSec大象流的方法。存储介质包括但不限于例如易失性存储器和/或非易失性存储器。易失性存储器例如可包括随机存取存储器(RAM)和高速缓冲存储器(cache)等。非易失性存储器例如可包括只读存储器(ROM)、硬盘、闪存等。
另外,根据本申请的实施方式,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本申请提供了一种非暂时性机器可读存储介质,所述非暂时性机器可读存储介质存储有机器可读指令,所述机器可读指令能够由处理器运行以执行与本申请提供的方法步骤对应的指令,例如:根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核之间的通信,建立网卡发送队列和网卡接收队列;PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中;对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列。在该计算机程序被中央处理单元(CPU)执行时,执行本申请的方法中限定的上述功能。
可能以许多方式来实现本申请的方法和装置、设备。例如,可通过软件、硬件、固件或者软件、硬件、固件的任何组合来实现本申请的方法和装置、设备。用于方法的步骤的上述顺序仅是为了进行说明,本申请的方法的步骤不限于以上具体描述的顺序,除非以其它方式特别说明。此外,在一些实施例中,还可将本申请实施为记录在记录介质中的程序,这些程序包括用于实现根据本申请的方法的机器可读指令。因而,本申请还覆盖存储用于执行根据本申请的方法的程序的记录介质。
另外,本申请的实施方式中提供的上述技术方案中与现有技术中对应技术方案实现原理一致的部分并未详细说明,以免过多赘述。
如上所述的具体实施方式,对本申请的目的、技术方案和有益效果进行了进一步详细说明。应理解的是,以上所述仅为本申请的具体实施方式,并不用于限制本申请。凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等均应包含在本申请的保护范围之内。

Claims (10)

  1. 一种基于DPDK的解决IPSec大象流的方法,其特征在于,包括:根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核之间的通信,建立网卡发送队列和网卡接收队列;
    PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中;
    对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列。
  2. 如权利要求1所述的一种基于DPDK的解决IPSec大象流的方法,其特征在于,所述将CPU0和CPU1初始化为PMD线程核是指:CPU0和CPU1都实现为DPDK的PMD线程核,对网卡发送队列和网卡接收队列执行轮询任务。
  3. 如权利要求2所述的一种基于DPDK的解决IPSec大象流的方法,其特征在于,所述将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核是指:CPU 2、CPU 3、CPU 4实现为加解密引擎工作核,实现对报文的加解密处理,其中第一个CPU核为CPU 2,用来执行普通流的报文处理,CPU 3、CPU 4用来并行执行大象流的报文加解密。
  4. 如权利要求3所述的一种基于DPDK的解决IPSec大象流的方法,其特征在于,所述创建无锁环用于PMD线程核和加解密引擎工作核之间的通信是指:利用DPDK的无锁环,在初始化阶段,建立PMD线程核即CPU0和CPU1与加解密引擎工作核之间的通信通道,实现报文核间传递。
  5. 如权利要求4所述的一种基于DPDK的解决IPSec大象流的方法,其特征在于,所述PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中的具体步骤为:
    调用rte_eth_rx_burst()读取网卡接收队列中的报文,按照报文的大小分为分片报文和非分片报文;
    对分片报文进行重组得到重组报文;
    对收到的非分片报文进行sflow抽样,所述非分片报文包含重组报文和不需要进行分片的报文,统计前K个传输流的已知流量数据,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,并更新大象流的流表数组;
    依次用大象流的流表数组对比收到的非分片报文,如果非分片报文属于大象流,则将该非分片报文标记为大象流,并按顺序编号,将该非分片报文放入加解密引擎工作核CPU3、CPU 4的无锁环中;
    如果是普通流,则将该非分片报文放入加解密引擎工作核CPU2的无锁环中。
  6. 如权利要求5所述的一种基于DPDK的解决IPSec大象流的方法,其特征在于,所述对收到的非分片报文进行sflow抽样,所述非分片报文包含重组报文和不需要进行分配的报文,统计前K个传输流的已知流量数据,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,并更新大象流的流表数组是指:对于每个非分片报文,执行sflow抽样的操作,统计前K个传输流的已知流量数据,对每个传输流,判断是否达到大象流的阈值,如果某个传输流达到大象流的阈值,记录该传输流的五元组信息,在流表数组中维护大象流数据,如果传输流是大象流,将其五元组信息添加到流表数组中。
  7. 如权利要求6所述的一种基于DPDK的解决IPSec大象流的方法,其特征在于,所述对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列的具体方法为:
    每个加解密引擎工作核不断轮询自己的无锁环,取出非分片报文;
    查询IPSec策略判断非分片报文为出方向IPSec报文或入方向IPSec报文;
    若为出方向IPSec报文,根据对该出方向IPSec报文进行加密;
    若为入方向IPSec报文,则查询SA,并进行报文抗重放检查,然后进行解密,更新抗重放窗口;
    若为普通流,则不进行加解密处理,经过路由查询后,送入负责发送的CPU1;
    按照该非分片报文的编号进行排序,然后调用rte_eth_tx_burst()发送给网卡发送队列。
  8. 一种基于DPDK的解决IPSec大象流的装置,其特征在于,包括:
    初始化创建模块,用于根据配置文件,将CPU0和CPU1初始化为PMD线程核,将CPU 2、CPU 3、CPU 4初始化为加解密引擎工作核,创建无锁环用于PMD线程核和加解密引擎工作核之间的通信,建立网卡发送队列和网卡接收队列;
    大象流检测分发模块,用于PMD线程核定期执行轮询工作,获取报文并检测出大象流和普通流,对大象流进行负载均衡,将报文分发到加解密引擎工作核中;
    加解密发送模块,用于对加解密引擎工作核中的报文进行加解密后发送给CPU1进行排序,然后发送给网卡发送队列。
  9. 一种电子设备,其特征在于,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时,以实现如权利要求1-7任一所述的一种基于DPDK的解决IPSec大象流的方法中的步骤。
  10. 一种可读存储介质,其特征在于,所述可读存储介质存储有计算机程序,所述计算机程序适于处理器进行加载,以执行如权利要求1-7任一项所述的一种基于DPDK的解决IPSec大象流的方法中的步骤。
PCT/CN2024/135825 2023-12-12 2024-11-29 一种基于DPDK的解决IPSec大象流的方法与装置 Pending WO2025124178A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202311703070.9 2023-12-12
CN202311703070.9A CN117857459A (zh) 2023-12-12 2023-12-12 一种基于DPDK的解决IPSec大象流的方法与装置

Publications (1)

Publication Number Publication Date
WO2025124178A1 true WO2025124178A1 (zh) 2025-06-19

Family

ID=90531130

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/135825 Pending WO2025124178A1 (zh) 2023-12-12 2024-11-29 一种基于DPDK的解决IPSec大象流的方法与装置

Country Status (2)

Country Link
CN (1) CN117857459A (zh)
WO (1) WO2025124178A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117857459A (zh) * 2023-12-12 2024-04-09 天翼云科技有限公司 一种基于DPDK的解决IPSec大象流的方法与装置
CN119292773B (zh) * 2024-09-23 2025-07-25 海光云芯集成电路设计(上海)有限公司 数据处理方法、数据处理装置及其相关设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111669374A (zh) * 2020-05-25 2020-09-15 成都安恒信息技术有限公司 一种IPsec VPN单条隧道软件加解密性能扩展方法
US20210075730A1 (en) * 2019-09-11 2021-03-11 Intel Corporation Dynamic load balancing for multi-core computing environments
CN115967751A (zh) * 2022-12-29 2023-04-14 北京天融信网络安全技术有限公司 基于多核处理器的IPSec报文转发方法及装置
CN117177298A (zh) * 2023-08-21 2023-12-05 厦门市美亚柏科信息股份有限公司 一种基于流水线实现5g业务数据负载均衡的方法及系统
CN117857459A (zh) * 2023-12-12 2024-04-09 天翼云科技有限公司 一种基于DPDK的解决IPSec大象流的方法与装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102984064A (zh) * 2012-12-28 2013-03-20 盛科网络(苏州)有限公司 区分转发大象流的方法及系统
CN114095441A (zh) * 2021-11-15 2022-02-25 新华三大数据技术有限公司 一种实现ecmp流量负载均衡的方法及电子设备
CN116633726B (zh) * 2023-04-21 2026-02-24 阿里巴巴(中国)有限公司 云网关和用于网络适配器的方法及网络适配器
CN116915709B (zh) * 2023-09-13 2024-01-05 中移(苏州)软件技术有限公司 负载均衡的方法及装置、电子设备和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210075730A1 (en) * 2019-09-11 2021-03-11 Intel Corporation Dynamic load balancing for multi-core computing environments
CN111669374A (zh) * 2020-05-25 2020-09-15 成都安恒信息技术有限公司 一种IPsec VPN单条隧道软件加解密性能扩展方法
CN115967751A (zh) * 2022-12-29 2023-04-14 北京天融信网络安全技术有限公司 基于多核处理器的IPSec报文转发方法及装置
CN117177298A (zh) * 2023-08-21 2023-12-05 厦门市美亚柏科信息股份有限公司 一种基于流水线实现5g业务数据负载均衡的方法及系统
CN117857459A (zh) * 2023-12-12 2024-04-09 天翼云科技有限公司 一种基于DPDK的解决IPSec大象流的方法与装置

Also Published As

Publication number Publication date
CN117857459A (zh) 2024-04-09

Similar Documents

Publication Publication Date Title
US11405179B2 (en) Multimode cryptographic processor
Pismenny et al. Autonomous NIC offloads
EP1192782B1 (en) Classification engine in a cryptography acceleration chip
US8799507B2 (en) Longest prefix match searches with variable numbers of prefixes
US7685436B2 (en) System and method for a secure I/O interface
US11489773B2 (en) Network system including match processing unit for table-based actions
US20140157365A1 (en) Enhanced serialization mechanism
Narayanan et al. Macroflows and microflows: Enabling rapid network innovation through a split sdn data plane
EP3709562B1 (en) Link protection for trusted input/output devices
CA3169613C (en) Proxy service through hardware acceleration using an io device
CN115917520A (zh) 用于通过分布式算法为可编程数据平面提供lpm实现的系统
US20120036351A1 (en) Configurable memory encryption with constant pipeline delay in a multi-core processor
US11936635B2 (en) Method, electronic device, and program product implemented at an edge switch for data encryption
CN110336661A (zh) Aes-gcm数据处理方法、装置、电子设备及存储介质
CN117857459A (zh) 一种基于DPDK的解决IPSec大象流的方法与装置
WO2020000285A1 (en) Secure virtual machine migration using encrypted memory technologies
Liu et al. X-Plane: A high-throughput large-capacity 5G UPF
CN116232944B (zh) 用于传输层安全协议报文业务的方法、设备及介质
US9015438B2 (en) System and method for achieving enhanced performance with multiple networking central processing unit (CPU) cores
CN119402454B (zh) 一种高性能的ipsec缓存管理装置和管理方法
US11397627B2 (en) System call batching for network I/O
US20220278946A1 (en) Programmable packet processing pipeline with offload circuitry
WO2024016975A1 (zh) 报文转发方法、装置、设备及芯片系统
Donenfeld Wireguard linux kernel integration techniques
Liu et al. Rethink Phone-Wearable Collaboration From the Networking Perspective

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24902599

Country of ref document: EP

Kind code of ref document: A1