eBPF unloading method for smart network card, programmable RSS method and device based on eBPF unloading

By mapping and translating eBPF programs on smart network interface cards (NICs) and combining this with hardware optimization, the complexity and cost issues of eBPF offloading methods have been resolved. This has enabled efficient network data plane programming and programmable RSS, improving the availability and flexibility of smart NICs.

CN118312243BActive Publication Date: 2024-09-27CORE YUNSHENG (HANGZHOU) ELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410733319.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-09-27
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

Existing eBPF offloading methods for smart network interface cards (NICs) are complex, inflexible, and costly to implement, while the availability of RSS technology based on smart NICs is low.

Method used

The system uses the general-purpose registers and local memory of the smart network interface card (NIC) to map eBPF programs, provides a high-speed cache and memory read/write instructions, translates eBPF program instructions into stream processing engine instructions, and optimizes the eBPF map index by combining content-addressable memory and a dedicated TLV message queue, thereby enabling the offloading of eBPF programs on the smart NIC.

Benefits of technology

It improves network data plane programming capabilities, reduces user adoption costs, enhances the availability of eBPF offloading and the flexibility of programmable RSS, and improves the usability of RSS technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118312243B
    Figure CN118312243B
Patent Text Reader

Abstract

The present invention discloses an eBPF unloading method of a smart network card, a programmable RSS method and device based on eBPF unloading, wherein the unloading method includes using the general register of the smart network card to map the general register and stack frame base address register of the eBPF program to be unloaded, using the local memory of the smart network card to provide memory support for the runtime stack of the unloaded eBPF program, using the transfer register of the smart network card as an ultra-high-speed cache memory when the unloaded eBPF program processes messages, and providing displayed ultra-high-speed cache memory read and write instructions, and the smart network card provides the unloaded eBPF program with a maximum preset number of memory read and write instructions; based on the model mapping of the eBPF program to be unloaded, the instructions in the instruction set of the eBPF program to be unloaded are translated into stream processing engine instructions. The present invention greatly enhances the user's programming ability for the network data plane with the help of the programmable ability of the multi-core network card, and shields the user from the complex details of the network card processor programming through jit compilation, thereby improving the usability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of smart network cards, and in particular to an eBPF unloading method for a smart network card, and an RSS method and device based on eBPF unloading. Background Art

[0002] Smart NIC is a programmable network solution for data centers in the future. It can help the CPU reduce network load and improve system processing speed, and can support virtual network functions and network security functions to build efficient and flexible data center infrastructure. EBPF is a technology based on eBPF virtual machine and eBPF verifier, which allows users to execute secure restricted code in the kernel. It has a wide range of applications and is used in kernel tracing, performance analysis, security and storage. At present, the eBPF unloading method of Smart NIC has high program complexity, low flexibility and high introduction cost.

[0003] RSS technology is an essential capability of network cards. It uses multi-queue technology and hash hashing to calculate the hash value based on the five-tuple of the message, and hashes different five-tuple messages to different network card queues according to different hash values, so that the host side can realize CPU load sharing by binding the CPU and the network card queue. However, the availability of RSS technology based on smart network cards is low. Summary of the invention

[0004] The purpose of this application is to provide an eBPF offloading method for a smart network card, a programmable RSS method and device based on eBPF offloading, so as to solve the problems that the current eBPF offloading method for smart network cards has high program complexity, low flexibility, high introduction cost, and low availability of RSS technology based on smart network cards.

[0005] In a first aspect, the present application provides an eBPF unloading method for a smart network card, comprising:

[0006] The general registers of the smart network card are used to map the general registers and stack frame base address registers of the eBPF program to be unloaded, the local memory of the smart network card is used to provide memory support for the runtime stack of the unloaded eBPF program, the transfer register of the smart network card is used as an ultra-high-speed cache memory when the unloaded eBPF program processes messages, and a displayed ultra-high-speed cache memory read and write instruction is provided, and the smart network card provides the unloaded eBPF program with a maximum preset number of memory read and write instructions, so as to realize the model mapping of the eBPF program to be unloaded on the smart network card;

[0007] Based on the model mapping of the eBPF program to be uninstalled, the instructions in the instruction set of the eBPF program to be uninstalled are translated into stream processing engine instructions supported by the uninstalled eBPF program;

[0008] The uninstalled eBPF program is an eBPF program that is uninstalled from the eBPF program to be uninstalled to the smart network card.

[0009] In one embodiment of the present application, based on the model mapping of the eBPF program to be uninstalled, the step of translating instructions in the instruction set of the eBPF program to be uninstalled into stream processing engine instructions supported by the uninstalled eBPF program includes:

[0010] Scanning the instruction set of the eBPF program to be uninstalled, and based on the model mapping of the eBPF program to be uninstalled, directly translating the instructions in the instruction set of the eBPF program to be uninstalled into the original instruction set supported by the smart network card processor;

[0011] The original instruction set is scanned to relink the code segments in the original instruction set based on the code segment linking mode in the instruction set of the eBPF program to be uninstalled.

[0012] In one embodiment of the present application, during the process of directly translating the instructions in the instruction set of the eBPF program to be uninstalled into the original instruction set supported by the smart network card processor:

[0013] When a call instruction is scanned, all instructions of the corresponding callee sub-procedure need to be scanned to determine whether the callee sub-procedure modifies the R6 register to the R9 register. If so, the R6 register to the R9 register are written into the stack, and the return address of the callee sub-procedure is saved in the preset register, the callee sub-procedure is executed, and after the callee sub-procedure ends, an instruction is inserted to transfer to the saved return address;

[0014] Among them, registers R6 to R9 are protected by the callee as specified in the eBPF calling specification.

[0015] In one embodiment of the present application, based on the model mapping of the eBPF program to be uninstalled, the instructions in the instruction set of the eBPF program to be uninstalled are directly translated into the original instruction set supported by the smart network card processor, including:

[0016] The general register instruction bit width of the eBPF program to be uninstalled is reflected based on the general register instruction bit width of the intelligent network card, and the maximum memory read and write instruction of the eBPF program to be uninstalled is replaced with the maximum preset number of memory read and write instructions of the intelligent network card;

[0017] When the instruction sequence data type recognized by the eBPF verifier in the unloaded eBPF program is a message type, the corresponding instruction sequence data must first be read from the low-level memory into the transfer register corresponding to the unloaded eBPF program, and then the corresponding instruction sequence data must be loaded into the general register corresponding to the unloaded eBPF program.

[0018] In one embodiment of the present application, performing model mapping of the eBPF program to be uninstalled on the smart network card further includes:

[0019] The smart network card uses a content-addressable memory to assist the unloaded eBPF program in performing eBPF map indexing, and the eBPF map type is array or hash.

[0020] In one embodiment of the present application, performing model mapping of the eBPF program to be uninstalled on the smart network card further includes:

[0021] The smart network card provides an eBPF-specific TLV message queue based on a pcie engine and a dma engine. The eBPF-specific TLV message queue is used as an eBPF map of a perf event array type.

[0022] In one embodiment of the present application, the smart network card is a Corigine smart network card.

[0023] In a second aspect, the present application provides a programmable RSS method based on eBPF offloading, comprising:

[0024] Obtain the configured queue map and ctrl map, both of which are implemented using the ebpfmap structure, the queue map is used to store queue information participating in the hashing, and the ctrl map is used to store the hashing algorithm type and tunnel penetration information;

[0025] Based on the tunnel penetration information in the ctrl map, the input message is parsed by the hash algorithm type in the ctrl map to obtain a five-tuple hash value of the input message;

[0026] Obtain a queue index of the input message hash queue based on the five-tuple hash value, and assign the queue index to rx_queue_ind in the eBPF context;

[0027] The adopted eBPF program is an unloaded eBPF program that is unloaded to the smart network card through the eBPF unloading method of the smart network card.

[0028] In one embodiment of the present application, obtaining a queue index of an input message hash queue based on the five-tuple hash value includes:

[0029] The queue index of the message hash queue is obtained based on a hash method of a hash algorithm or a Symmetric RSS method.

[0030] The third aspect is a programmable RSS device based on eBPF offloading, including a configuration file acquisition module, a five-tuple hash value acquisition module and a queue index assignment module;

[0031] The configuration file acquisition module is used to acquire the configured queue map and ctrl map, wherein the queue map and the ctrl map are both implemented using the ebpf map structure, the queue map is used to store the queue information involved in the hashing, and the ctrl map is used to store the hashing algorithm type and the tunnel penetration information;

[0032] The five-tuple hash value acquisition module is used to parse the input message based on the tunnel penetration information in the ctrl map through the hash algorithm type in the ctrl map to obtain the five-tuple hash value of the input message;

[0033] The queue index assignment module is used to obtain the queue index of the input message hash queue based on the five-tuple hash value, and assign the queue index to rx_queue_ind in the eBPF context;

[0034] The adopted eBPF program is an unloaded eBPF program that is unloaded onto the smart network card through the eBPF unloading method of the smart network card.

[0035] Compared with the prior art, one or more embodiments of the above scheme may have the following advantages or beneficial effects:

[0036] The eBPF offloading method for the smart NIC provided in the embodiment of the present invention greatly enhances the user's ability to program the network data plane by leveraging the programmable capability of the multi-core NIC and combining it with the kernel eBPF basic framework. It also shields the user from the complex details of NIC processor programming through jit compilation, thereby improving usability. The programmable RSS method based on eBPF offloading implements programmable RSS technology, provides users with a programmable data plane, and has extremely high usability based on the eBPF ecosystem, thereby reducing the user's introduction cost.

[0037] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0039] Figure 1 Shown is a flow chart of the eBPF offloading method for the smart network card described in an embodiment of the present application.

[0040] Figure 2 Shown is a flowchart of a programmable RSS method based on eBPF offloading described in an embodiment of the present application.

[0041] Figure 3 Shown is a schematic diagram of the structure of a programmable RSS device based on eBPF offloading as described in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The following will describe the implementation methods of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.

[0043] eBPF stands for extended Berkeley Packet Filter. Generally speaking, to add new features to the kernel, you need to modify the kernel source code or write kernel modules to implement them. eBPF allows programs to run without modifying the kernel source code or adding additional kernel modules. eBPF is developed from BPF (also known as cBPF: classic Berkeley Packet Filter), which was created specifically for filtering network packets. However, as eBPF continues to improve and strengthen, the existing eBPF is no longer limited to filtering network packets.

[0044] eBPF has led the development of a new generation of tools in the fields of networking, security, user program tracing, and performance troubleshooting. These tools no longer rely solely on existing kernel functions, but are programmable at runtime without affecting execution efficiency and security. In most cases in the past, users needed to modify the kernel code to add new load balancing logic and configuration. The load balancing program was often too highly coupled with the kernel, and the program needed to be reloaded, resulting in business interruption.

[0045] The following embodiments of the present application provide an eBPF offloading method for a smart network card, a programmable RSS method and device based on eBPF offloading, which solve the problems of high program complexity, low flexibility, high introduction cost, and low availability of RSS technology based on smart network cards in the current eBPF offloading method for smart network cards.

[0046] The following will describe in detail the principles and implementation methods of an eBPF offloading method for a smart network card, a programmable RSS method and device based on eBPF offloading of the present embodiment in conjunction with the accompanying drawings, so that those skilled in the art can understand the eBPF offloading method for a smart network card, a programmable RSS method and device based on eBPF offloading of the present embodiment without creative work.

[0047] like Figure 1 As shown, this embodiment provides an eBPF unloading method for a smart network card, comprising the following steps.

[0048] Step S101, mapping the eBPF program model to be uninstalled onto the smart network card.

[0049] Specifically, the eBPF program to be unloaded to the smart network card is used as the eBPF program to be unloaded, and the eBPF program that has been unloaded to the smart network card is used as the unloaded eBPF program. The eBPF program usually has 10 32 / 64-bit general registers, a read-only 32 / 64-bit stack frame base register, supports procedure call instructions and maximum 32 / 64-bit mem read and write instructions. The eBPF instruction set is a typical general 64-bit RISC instruction set.

[0050] In the process of model mapping the eBPF program to be offloaded to the smart network card, the general registers of the smart network card are used to map the general registers and stack frame base address registers of the eBPF program to be offloaded, the local memory of the smart network card is used to provide memory support for the runtime stack of the offloaded eBPF program, the transfer register of the smart network card is used as an ultra-high-speed cache memory when the offloaded eBPF program processes messages, and explicit ultra-high-speed cache memory read and write instructions are provided, and the smart network card provides memory read and write instructions with a maximum preset number of bits for the offloaded eBPF program.

[0051] For example, for Corigine's smart network card, Corigine flow process core, as a domain-specific network flow processing engine, has an engine architecture that is more suitable for data packet processing. Each flow processing core supports 256 general-purpose 32-bit registers (divided into AB banks), 512 32-bit transfer registers (ultra-high-speed cache), 4*1K local mem. (SRAM), and supports bulk mem read / write instructions of up to 128 bytes based on the on-chip bus. In addition, Corigine network card provides cluster target mem that supports sharing of flow processor groups for storing shared data such as messages.

[0052] When the eBPF program to be unloaded is model-mapped to Corigine's smart network card, in order to give full play to the field advantages of the stream processing engine, two 32-bit general registers are used to map a 64-bit general register of the eBPF to be unloaded, and two 32-bit general registers are used to map a read-only 64-bit stack frame base register. 4*1Klocal mem memory is used to provide support for the runtime stack of the unloaded eBPF program, and transfer registers are used as ultra-high-speed cache memory for messages. Explicit ultra-high-speed cache memory read and write instructions are provided, and bulk mem read and write instructions of up to 128 bytes are provided for the unloaded eBPF program.

[0053] In addition to the above contents, for practical and economic considerations, the eBPF offloading method of the smart network card in the embodiment of the present invention will also optimize the eBPF map offloading during the process of model mapping the eBPF program to be offloaded to the smart network card.

[0054] Specific array and hash type maps can provide data storage and query requirements in most network application scenarios, so their query efficiency is critical to the overall performance of the eBPF program. The map index of eBPF is based on mapid and element key. When the unloaded eBPF program contains more maps and the size of the elements in the map is large, the query and reading and writing of the map will significantly reduce the performance of the eBPF program. Therefore, the embodiment of the present invention introduces CAM (Content Addressable Memory) in the smart network card, that is, CAM hardware-assisted map indexing is used. The specific smart network card uses map id and element key as CAM key, and uses the data address on the map as the value stored in the CAM to help the network card perform hardware indexing on the map. The above settings greatly improve the query performance of the eBPF program.

[0055] Further, a perf event array is provided for the eBPF program to output the internal state to the host, thereby improving the debuggability of the uninstalled program. The perf event array map is used to output some required data to the user. It does not have the data storage and query function itself, and does not need to occupy special storage on the device. However, in the uninstallation scenario, when the user uses the bpf_perf_event_output() interface to access the perf event array map, the network card firmware needs to cooperate with the network card driver to report the data required by the user to the user state. To achieve this function, the smart network card in the embodiment of the present invention provides an eBPF-specific TLV message queue based on the pcie engine and the dma engine. The network card firmware encapsulates the message according to the structure defined by the perf_event_map, and sends the message content to the memory prepared by the host-side driver through the dma engine. The network card driver parses the message according to the perf_event_map and reports it to the uninstalled eBPF program. This function greatly facilitates users to observe and debug the uninstalled eBPF program and improves the availability of eBPF.

[0056] Step S102: based on the model mapping of the eBPF program to be uninstalled, the instructions in the instruction set of the eBPF program to be uninstalled are translated into stream processing engine instructions supported by the uninstalled eBPF program.

[0057] Specifically, after the smart network card completes the model mapping of the eBPF program to be offloaded, it is also necessary to translate the instructions in the eBPF instruction set corresponding to the eBPF program to be offloaded into stream processing engine instructions. The stream processing engine instructions are the processing instructions supported by the eBPF program mapped by the smart network card. Specifically, the translation of the instructions in the instruction set of the eBPF program to be offloaded includes: the entire translation process requires two instruction sequence scans, the first scan of the eBPF program instruction set to be offloaded, and then based on the mapping relationship of the eBPF program model to be offloaded, the instructions in the instruction set of the eBPF program to be offloaded are directly translated into the original instruction set supported by the smart network card processor (i.e., the fpc instruction set and the generated jit image). Since the translation of instructions is not a simple one-to-one mapping, it is necessary to relink the generated jit image to realize the relocation of the jump instruction, the call of the built-in help function of the network card in the eBPF program, and the reading and writing of the offloaded map. Therefore, it is also necessary to scan the original instruction set to relink the code segment in the original instruction set based on the code segment linking method of the instruction set of the eBPF program to be offloaded.

[0058] Furthermore, the instructions in the instruction set of the eBPF program to be uninstalled are directly translated into the original instruction set supported by the smart network card processor, including: embodying the general register instruction form of the eBPF program to be uninstalled based on the general register instruction form of the smart network card, and replacing the maximum memory read and write instructions of the eBPF program to be uninstalled with the maximum preset bit memory read and write instructions of the smart network card; when the instruction sequence data type recognized by the eBPF verifier in the uninstalled eBPF program is a message type, the corresponding instruction sequence data must first be read from the low-level memory into the transfer register corresponding to the uninstalled eBPF program, and then the corresponding instruction sequence data must be loaded into the general register corresponding to the uninstalled eBPF program.

[0059] The process call instruction of a normal eBPF program can be divided into three parts: first, save the registers of the caller to the stack space, and save the return address of the callee sub-process to the stack space; second, jump to the starting address of the callee sub-process and execute instructions. Third, after the sub-process is executed, restore the caller's registers, restore the stack base registers, and jump the execution flow according to the return address in the stack space.

[0060] Since the Smart NIC does not natively support procedure call instructions, in order to implement the procedure call instruction process of the above-mentioned eBPF program, in the process of directly translating the instructions in the instruction set of the eBPF program to be unloaded into the original instruction set supported by the Smart NIC processor: when Jit scans the call instruction, it is necessary to further scan all instructions of the corresponding callee sub-process, and determine whether the callee sub-process has modified the R6 register-R9 register. If so, write the R6 register-R9 register into the stack (the eBPF calling specification stipulates that the R6 register-R9 register is protected by the callee), and save the return address of the callee sub-process to the preset register (in this embodiment, Jit uses two fixed-numbered gpr registers to save it), then execute the callee sub-process, and insert a jump instruction after the callee sub-process ends to transfer to the saved return address.

[0061] More specifically, when the eBPF program model to be unloaded is mapped to the Corigine's smart network card, the instructions in the eBPF program instruction set to be unloaded are directly translated into the original instruction set supported by the smart network card processor, which specifically includes: the 64-bit ALU instructions of eBPF are assembled using two 32-bit ALUs; based on the data flow analysis of the eBPF verifier, the continuous memory read and write instruction sequences are identified and replaced with bulk mem read and write of the stream processing engine; and if the ptr type given by the eBPF verifier is a pointer of the message type PTR_TO_PACKET, the message must first be read from the low-level memory CTM into the transfer register as a cache, and then the data is loaded from the transfer register into the destination general register (mapped by two 32-bit general registers), and finally the cache is written back to the low-level memory when the eBPF program ends or the cache content needs to be refreshed.

[0062] The purpose of offloading the eBPF program to the smart network card is to accelerate the data packet processing capability of the protocol stack. Therefore, the eBPF offloading referred to in the present invention only considers the application of eBPF in the network module, including but not limited to eBPF XDP, eBPF CLS, etc. In addition, the offloaded eBPF program to the smart network card balances flexibility and security, allowing the eBPF program to perform restricted memory access in the kernel, but the pointers in the eBPF program are more strictly checked in the offload scenario, and the program is only allowed to access the eBPF context, eBPF runtime stack, eBPF map, and the memory of the network message. These restrictions reduce the complexity of the program in the offload scenario without excessively restricting the flexibility of the eBPF program.

[0063] The eBPF unloading method for the smart network card provided in the embodiment of the present invention, by means of the programmable capability of the many-core network card and in combination with the kernel eBPF basic framework, greatly enhances the user's programming capability for the network data plane, and shields the user from the complex details of the network card processor programming through jit compilation, thereby improving the usability.

[0064] like Figure 2 As shown, this embodiment provides a programmable RSS method based on eBPF offloading, including the following steps.

[0065] Step S201, obtaining the configured queue map and ctrl map.

[0066] Specifically, queue map and ctrl map are configured based on user needs. Both queue map and ctrl map are implemented using the ebpf map structure. Queue map is used to store queue information involved in hashing, and ctrl map is used to store hash algorithm types and tunnel penetration information. It should be noted that ctrl map can store multiple supported hash algorithm types. When using, select a suitable hash algorithm type for use.

[0067] Step S202: Based on the tunnel penetration information in the ctrl map, the input message is parsed by the hash algorithm type in the ctrl map to obtain a five-tuple hash value of the input message.

[0068] Specifically, based on the tunnel penetration information in the ctrl map, it is determined whether the input message supports tunnel penetration, and a suitable hash type is selected from the saved hash types. Based on the tunnel penetration information, the input message is analyzed by the selected hash type to obtain the five-tuple hash value corresponding to the input message.

[0069] Step S203: Obtain the queue index of the input message hash queue based on the five-tuple hash value, and assign the queue index to rx_queue_ind in the eBPF context.

[0070] Specifically, the queue index of the input message hash queue can be obtained based on the hash method of the hash algorithm, so that the input message is randomly hashed into different queues. The queue index of the message hash queue can also be obtained based on the hash method of the Symmetric RSS method, so that the input message is hashed into different queues. After obtaining the queue index of the input message hash queue, the queue index of the input message hash queue can be assigned to rx_queue_ind in the eBPF context.

[0071] It should be noted that the smart network card of the above method runs on the smart network card, and the eBPF program on the smart network card is unloaded to the smart network card based on the eBPF unloading method of the smart network card.

[0072] The programmable RSS method based on eBPF offloading in the embodiment of the present invention implements programmable RSS technology, provides users with a programmable data plane, and has extremely high availability based on the eBPF ecosystem, reducing the user's introduction cost. Users can implement the allocation logic they want to use in their own RSS programs. For example, network traffic can be distributed to different CPU cores for concurrent processing based on different IP addresses, protocols and other characteristics. Programmable RSS technology further enhances the capabilities of RSS. The programmable RSS method based on eBPF offloading in the embodiment of the present invention can direct messages of a specified five-tuple to a user-specified queue for processing, and supports tunnel penetration, and performs programmable RSS with the five-tuple of messages inside the tunnel.

[0073] like Figure 3 As shown, this embodiment provides a programmable RSS device based on eBPF offloading, including a configuration file acquisition module, a five-tuple hash value acquisition module and a queue index assignment module.

[0074] The configuration file acquisition module is used to obtain the configured queue map and ctrl map. Both the queue map and ctrl map are implemented using the ebpf map structure. The queue map is used to save the queue information involved in the hashing, and the ctrl map is used to save the hashing algorithm and tunnel penetration information.

[0075] The five-tuple hash value acquisition module is used to parse the input message through the hash algorithm in the ctrl map based on the tunnel penetration information in the ctrl map to obtain the five-tuple hash value of the input message.

[0076] The queue index assignment module is used to obtain the queue index of the input message hash queue based on the five-tuple hash value, and assign the queue index to rx_queue_ind in the eBPF context.

[0077] The adopted eBPF program is unloaded to the smart network card through the eBPF unloading method of the smart network card mentioned above.

[0078] The programmable RSS device based on eBPF unloading in the embodiment of the present invention implements programmable RSS technology, provides users with a programmable data plane, and has extremely high availability based on the eBPF ecosystem, reducing the user's introduction cost. Users can implement the allocation logic they want to use in their own RSS programs. For example, network traffic can be distributed to different CPU cores for concurrent processing based on different IP addresses, protocols and other characteristics. Programmable RSS technology further enhances the capabilities of RSS. The programmable RSS device based on eBPF unloading in the embodiment of the present invention can direct messages of a specified five-tuple to a user-specified queue for processing, and supports tunnel penetration, and performs programmable RSS with the five-tuple of messages inside the tunnel.

[0079] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0080] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. An eBPF unloading method for a smart network card, comprising: The general registers of the smart network card are used to map the general registers and stack frame base address registers of the eBPF program to be unloaded, the local memory of the smart network card is used to provide memory support for the runtime stack of the unloaded eBPF program, the transfer register of the smart network card is used as an ultra-high-speed cache memory when the unloaded eBPF program processes messages, and a displayed ultra-high-speed cache memory read and write instruction is provided, and the smart network card provides the unloaded eBPF program with a maximum preset number of memory read and write instructions, so as to realize the model mapping of the eBPF program to be unloaded on the smart network card; Based on the model mapping of the eBPF program to be uninstalled, the instructions in the instruction set of the eBPF program to be uninstalled are translated into stream processing engine instructions supported by the uninstalled eBPF program; The unloaded eBPF program is an eBPF program that is unloaded from the eBPF program to be unloaded to the smart network card; based on the model mapping of the eBPF program to be unloaded, the step of translating the instructions in the instruction set of the eBPF program to be unloaded into the stream processing engine instructions supported by the unloaded eBPF program includes: Scanning the instruction set of the eBPF program to be uninstalled, and based on the model mapping of the eBPF program to be uninstalled, directly translating the instructions in the instruction set of the eBPF program to be uninstalled into the original instruction set supported by the smart network card processor; Scanning the original instruction set to relink the code segments in the original instruction set based on the code segment linking method in the instruction set of the eBPF program to be uninstalled; In the process of directly translating the instructions in the instruction set of the eBPF program to be uninstalled into the original instruction set supported by the smart network card processor: When a call instruction is scanned, all instructions of the corresponding callee sub-procedure need to be scanned to determine whether the callee sub-procedure modifies the R6 register to the R9 register. If so, the R6 register to the R9 register are written into the stack, and the return address of the callee sub-procedure is saved in the preset register, the callee sub-procedure is executed, and after the callee sub-procedure ends, an instruction is inserted to transfer to the saved return address; Among them, registers R6 to R9 are protected by the callee as specified in the eBPF calling specification.

2. The eBPF offloading method according to claim 1, characterized in that: Based on the model mapping of the eBPF program to be uninstalled, the instructions in the instruction set of the eBPF program to be uninstalled are directly translated into the original instruction set supported by the smart network card processor, including: The general register instruction bit width of the eBPF program to be uninstalled is reflected based on the general register instruction bit width of the intelligent network card, and the maximum memory read and write instruction of the eBPF program to be uninstalled is replaced with the maximum preset number of memory read and write instructions of the intelligent network card; When the instruction sequence data type recognized by the eBPF verifier in the unloaded eBPF program is a message type, the corresponding instruction sequence data must first be read from the low-level memory into the transfer register corresponding to the unloaded eBPF program, and then the corresponding instruction sequence data must be loaded into the general register corresponding to the unloaded eBPF program.

3. The eBPF offloading method according to claim 1, characterized in that: Performing model mapping of the eBPF program to be uninstalled on the smart network card further includes: The smart network card uses a content-addressable memory to assist the unloaded eBPF program in performing eBPF map indexing, and the eBPF map type is array or hash.

4. The eBPF offloading method according to claim 1, characterized in that: Performing model mapping of the eBPF program to be uninstalled on the smart network card further includes: The smart network card provides an eBPF-specific TLV message queue based on a pcie engine and a dma engine, and the eBPF-specific TLV message queue is used as an eBPF map of a perf event array type.

5. The eBPF unloading method according to any one of claims 1 to 4, characterized in that: The smart network card is a Corigine smart network card.

6. A programmable RSS method based on eBPF offloading, comprising: Obtain the configured queue map and ctrl map, where both the queue map and the ctrl map are implemented using the ebpf map structure, the queue map is used to store queue information participating in the hashing, and the ctrl map is used to store the hashing algorithm type and tunnel penetration information; Based on the tunnel penetration information in the ctrl map, the input message is parsed by the hash algorithm type in the ctrl map to obtain a five-tuple hash value of the input message; Obtain a queue index of the input message hash queue based on the five-tuple hash value, and assign the queue index to rx_queue_ind in the eBPF context; The adopted eBPF program is an unloaded eBPF program that is unloaded onto the smart network card by the eBPF unloading method for the smart network card described in any one of claims 1 to 5.

7. The RSS method according to claim 6, characterized in that: Acquiring a queue index of the input message hash queue based on the five-tuple hash value includes: The queue index of the message hash queue is obtained based on a hash method of a hash algorithm or a Symmetric RSS method.

8. A programmable RSS device based on eBPF offloading, characterized in that: It includes a configuration file acquisition module, a five-tuple hash value acquisition module and a queue index assignment module; The configuration file acquisition module is used to acquire the configured queue map and ctrl map, wherein the queue map and the ctrl map are both implemented using the ebpf map structure, the queue map is used to store the queue information involved in the hashing, and the ctrl map is used to store the hashing algorithm type and the tunnel penetration information; The five-tuple hash value acquisition module is used to parse the input message based on the tunnel penetration information in the ctrl map through the hash algorithm type in the ctrl map to obtain the five-tuple hash value of the input message; The queue index assignment module is used to obtain the queue index of the input message hash queue based on the five-tuple hash value, and assign the queue index to rx_queue_ind in the eBPF context; The adopted eBPF program is an unloaded eBPF program that is unloaded onto the smart network card by the eBPF unloading method for the smart network card described in any one of claims 1 to 5.