A driving method, computer device and medium
By providing kernel drivers and polling mode drivers in kernel space and user space, and using shunt drivers and mediation devices to optimize direct memory access remapping, the problems of address conflicts and unified management in PCIe device driver mode are solved, and the kernel is realized Coexistence and efficient traffic management of driver and data plane development kits.
Patent Information
- Application Number
- CN202410870444.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-01
AI Technical Summary
In the existing technology, the driver mode of PCIe devices has problems in operation and maintenance development and the unity of management interface and deployment mode. Especially when the kernel driver and data plane development kit coexist, it is difficult to avoid address conflicts and effectively manage traffic.
Provide a driver method that provides kernel drivers and polling mode drivers in kernel space and user space respectively, uses the offload driver to forward traffic based on rules, and optimizes direct memory access remapping through mediation devices to avoid address conflicts and support the kernel The driver and data plane development kits share the Express Peripheral Interconnect device.
It realizes the coexistence of the kernel driver and the data plane development kit, avoids address conflicts, retains the management capabilities and input and output processing capabilities of the kernel driver, improves device utilization, and meets high performance and low latency requirements.
Smart Images

Figure CN118394420B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a driving method, a computer device and a medium. Background Art
[0002] With the development of technologies such as cloud computing and data centers, higher requirements have been put forward for data transmission, message processing and scheduling. Therefore, technologies such as direct memory access (DMA) and data plane pass-through are widely used to improve data processing performance and throughput, and high-speed digital transmission is regulated by standards such as peripheral component interconnect express (PCIe). Devices that meet the PCIe standard, i.e. PCIe devices, face operation and maintenance development issues in terms of driver mode, and the uniformity of management interface and deployment mode.
[0003] To this end, the present application provides a driving method, a computer device and a medium for addressing the technical difficulties in the prior art. Summary of the invention
[0004] In a first aspect, the present application provides a driving method. The driving method includes: providing a kernel driver located in kernel space, wherein the kernel driver is used for a first control plane between a data plane development kit located in user space and a peripheral component interconnect express device; providing a polling mode driver in the data plane development kit located in the user space, wherein the polling mode driver is used for a second control plane between the data plane development kit and the peripheral component interconnect express device, and the data plane development kit is used to enable an input-output memory management unit to implement direct memory access remapping; forwarding traffic to the kernel driver or the polling mode driver based on a shunt rule through a shunt driver located in the kernel space, wherein the polling mode driver is also used to create a mediation device when the input-output memory management unit is enabled, the mediation device is connected to the shunt driver, and the direct memory access remapping includes: applying for physical memory for a first mapping from a host virtual address to a host physical address through the polling mode driver, and notifying the kernel driver through the mediation device so that the kernel driver reserves an input-output virtual address for a second mapping from an input-output virtual address to a host physical address of the polling mode driver.
[0005] Through the first aspect of the present application, by optimizing the direct memory access remapping mechanism, on the basis of the input and output memory management unit being enabled, a mediating device is created through a polling mode driver and the created mediating device is used to notify the kernel driver so that the kernel driver reserves the input and output virtual addresses for the polling mode driver's second mapping from the input and output virtual addresses to the host physical addresses. In this way, the address conflict between the data plane development kit and the kernel driver is avoided. While loading the kernel driver and retaining the kernel driver's management interface and enriching the protocol stack, the data plane development kit and the kernel driver are also supported to use the same quick peripheral component interconnect device, which is conducive to forwarding traffic on demand to the user-mode driver or kernel driver in the data plane development kit according to business planning and other requirements, retaining the management capability of the kernel network port network device, facilitating the unification of the network interface management interface, retaining the input and output processing capability of the kernel driver, and being able to use various mature protocol stacks and management interface commands. While ensuring the high performance and low latency requirements of the data plane development kit, the equipment utilization rate is also improved.
[0006] In a possible implementation of the first aspect of the present application, a network interface is connected to the shunt driver, and the network interface, when the input / output memory management unit is enabled, accesses the host machine memory using the input / output virtual address in the second mapping.
[0007] In a possible implementation of the first aspect of the present application, the polling mode driver synchronizes the physical address and the network protocol address with the kernel driver through the network interface so that the polling mode driver and the kernel driver share the network protocol address.
[0008] In a possible implementation of the first aspect of the present application, the diversion rules include: based on the matching of the source network protocol address, destination network protocol address and protocol number of the network protocol layer of the traffic to be forwarded, and the matching of the source port and destination port of the transmission control protocol layer of the traffic to be forwarded, selecting to forward the traffic to be forwarded to the kernel driver or the polling mode driver.
[0009] In a possible implementation of the first aspect of the present application, the diversion rules also include: when the traffic to be forwarded is non-tunnel traffic, forwarding the traffic to be forwarded to the kernel driver; when the traffic to be forwarded is tunnel traffic, forwarding the traffic to be forwarded to the polling mode driver.
[0010] In a possible implementation manner of the first aspect of the present application, the diversion rule is determined based on a business scenario associated with the peripheral component interconnect express device, an application enabled by the kernel driver, and a flow table offloading operation of the data plane development kit.
[0011] In a possible implementation of the first aspect of the present application, the traffic is forwarded to the kernel driver or the polling mode driver based on the diversion rule through the diversion driver located in the kernel space, including: when the express peripheral component interconnect device is an intelligent network interface card and the traffic to be forwarded is used for unloading the operating environment flow table of the data plane development kit, the traffic to be forwarded is forwarded to the polling mode driver through the diversion driver; when the express peripheral component interconnect device is an embedded central processor of a data processor and the traffic to be forwarded is used for unloading the operating environment flow table of the data plane development kit, the traffic to be forwarded is forwarded to the polling mode driver through the diversion driver; when the express peripheral component interconnect device is the embedded central processor of the data processor and the traffic to be forwarded is used for remote access based on the data plane development kit, the traffic to be forwarded is forwarded to the polling mode driver through the diversion driver.
[0012] In a possible implementation of the first aspect of the present application, the diversion driver located in the kernel space forwards the traffic to the kernel driver or the polling mode driver based on the diversion rule, and also includes: when the kernel driver enables the binding port of the link aggregation control protocol mode and turns on the link aggregation port of the Ethernet port associated with the fast peripheral component interconnect device, forwarding the to-be-forwarded traffic to the kernel driver through the diversion driver; when the kernel driver enables the link layer discovery protocol application and the to-be-forwarded traffic is used to check the link layer discovery protocol neighbors in order to synchronize the switch configuration, forwarding the to-be-forwarded traffic to the kernel driver through the diversion driver.
[0013] In a possible implementation manner of the first aspect of the present application, the first mapping and the second mapping are used to implement the direct memory access remapping, and the direct memory access remapping is used to drive the processing of input and output requirements through the polling mode.
[0014] In a possible implementation manner of the first aspect of the present application, the kernel driver is not unloaded during the period when the data plane development kit uses the peripheral component interconnect express device through the polling mode driver.
[0015] In a possible implementation manner of the first aspect of the present application, the kernel driver includes a network interface management interface and a kernel protocol stack.
[0016] In a possible implementation of the first aspect of the present application, the network interface management interface provides a variety of commands for network interface operation and maintenance, the multiple commands include network interface viewing commands, network interface configuration commands and network device driver hardware setting commands, and the kernel protocol stack includes a link layer discovery protocol stack for port direct connection and a link aggregation control protocol stack for binding configuration.
[0017] In a possible implementation manner of the first aspect of the present application, the kernel driver is a kernel vendor driver of the peripheral component interconnect express device.
[0018] In a possible implementation manner of the first aspect of the present application, the kernel space and the user space belong to the same server.
[0019] In a possible implementation manner of the first aspect of the present application, the first control plane or the second control plane is used for data plane direct communication between the data plane development kit and the peripheral component interconnect express device.
[0020] In a possible implementation of the first aspect of the present application, the peripheral component interconnect express device belongs to a first input / output memory management unit group, a first part of a first input / output virtual address space associated with the first input / output memory management unit group is reserved for the input / output virtual address in the second mapping of the polling mode driver, a second part of the first input / output virtual address space is reserved for the kernel driver, and the first part is independent of the second part.
[0021] In a second aspect, an embodiment of the present application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method according to any one of the implementation modes of any of the above aspects when executing the computer program.
[0022] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects.
[0023] In a fourth aspect, an embodiment of the present application further provides a computer program product, which includes instructions stored on a computer-readable storage medium, and when the instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 A schematic diagram of a driving method provided in an embodiment of the present application;
[0026] Figure 2 A method according to the embodiment of the present application is provided Figure 1 The driving method shown is a schematic diagram of driving a peripheral component interconnect express device;
[0027] Figure 3 A flow chart of a traffic forwarding method provided in an embodiment of the present application;
[0028] Figure 4 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0030] It should be understood that, in the description of this application, "at least one" means one or more, and "a plurality of" means two or more. In addition, unless otherwise specified, the words "first", "second", etc. are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.
[0031] Figure 1 A schematic diagram of a driving method provided in an embodiment of the present application. Figure 1 As shown, the driving method includes the following steps.
[0032] Step S110: providing a kernel driver located in the kernel space, wherein the kernel driver is used for a first control plane between a data plane development kit located in the user space and a peripheral component interconnect express device.
[0033] Step S120: providing a polling mode driver in the data plane development kit in the user space, wherein the polling mode driver is used for a second control plane between the data plane development kit and the peripheral component interconnect express device, and the data plane development kit is used to enable an input-output memory management unit to implement direct memory access remapping.
[0034] Step S130: forwarding traffic to the kernel driver or the polling mode driver based on the diversion rule through the diversion driver located in the kernel space.
[0035] See also Figure 1 In each step, the polling mode driver is also used to create a mediation device when the input / output memory management unit is enabled, and the mediation device is connected to the shunt driver. The direct memory access remapping includes: applying for physical memory for a first mapping from a host virtual address to a host physical address through the polling mode driver, notifying the kernel driver through the mediation device so that the kernel driver reserves an input / output virtual address for a second mapping from an input / output virtual address to a host physical address of the polling mode driver.
[0036] Continue reading Figure 1 , Figure 1The driving method shown is used to drive a device that complies with the peripheral component interconnect express (PCIe) standard, namely, a peripheral component interconnect express device, which can be referred to as a PCIe device. In order to meet the needs of high-speed data growth and high-speed data transmission in the network communication industry, the Data Plane Development Kit (DPDK) technology is applied to improve data processing performance and throughput, and direct memory access (DMA) and data plane pass-through technology are also combined. There are two ways to drive a peripheral component interconnect express device: one is a kernel driver in kernel state, such as a kernel manufacturer driver provided by a manufacturer. The kernel driver provides rich and complete operation and maintenance means, such as providing various commands for various protocol stacks and network port management interfaces. A peripheral component interconnect express device can only be used by one kernel driver; the other is to use the virtual function input and output (Virtual Function I / O, VFIO) kernel component or the user space input and output (Userspace I / O, UIO) component to complete direct memory access remapping to achieve input and output bypassing the kernel state and passing through the user state. The virtual function input and output kernel component provides an access interface to the user state, and the device can be directly connected to the virtual machine through the virtual function input and output kernel component, so that the device driver can be implemented using the user state driver. Kernel drivers, such as kernel vendor drivers, provide rich and complete operation and maintenance means, but require that a quick peripheral component interconnect device can only be used by one kernel driver. Therefore, when there are device driver solutions based on kernel drivers and device driver solutions based on data plane development kits at the same time, it is necessary to consider the challenges when the two coexist and use the same quick peripheral component interconnect device. For example, if the kernel driver is not loaded, the rich and complete operation and maintenance means provided by the kernel driver cannot be used, which requires the development of a set of operation and maintenance software based on the data plane development kit, including the development of multiple protocol stacks, which brings a large workload, operation and maintenance development problems, and the problem of uniformity between the management interface and the deployment method.If the kernel driver is loaded and the management interface and rich protocol stack of the kernel driver are retained, and the data plane development kit and the kernel driver are supported to use the same quick peripheral component interconnect device, then the address conflict problem needs to be considered, and it involves the application of the direct memory access technology remapping mechanism and the input / output memory management unit (IOMMU). The driving method provided in the specific embodiment of the present application is described in detail below, how to achieve the coexistence of the device driver solution based on the kernel driver and the device driver solution based on the data plane development kit, and support the data plane development kit and the kernel driver to use the same quick peripheral component interconnect device.
[0037] Continue reading Figure 1 In step S110, a kernel driver located in kernel space is provided. The kernel driver is used for a first control plane between a data plane development kit located in user space and a peripheral component interconnect express device. In step S120, a polling mode driver (Poll Mode Driver, PMD) in the data plane development kit located in the user space is provided. The polling mode driver is used for a second control plane between the data plane development kit and the peripheral component interconnect express device, and the data plane development kit is used to enable an input-output memory management unit to implement direct memory access remapping. It should be understood that there is no necessary execution order between step S110 and step S120. Step S110 may be executed first, that is, providing a kernel driver located in the kernel space, and then step S120 may be executed, that is, providing a polling mode driver in the data plane development kit located in the user space; or, step S120 may be executed first, that is, providing a polling mode driver in the data plane development kit located in the user space, and then step S110 may be executed, that is, providing a kernel driver located in the kernel space; or, both may be executed at the same time, or both may start at the same time, or both may end at the same time. Step S110 and step S120 may be understood as a whole, that is, providing a device driver solution based on a kernel driver and a device driver solution based on a data plane development kit, that is, a whole device driver solution in which the two coexist. Then, on the basis of the coexistence of the device driver solution based on the kernel driver and the device driver solution based on the data plane development kit, in step S130, through the diversion driver located in the kernel space, traffic is forwarded to the kernel driver or the polling mode driver based on the diversion rule. In this way, service planning is facilitated on the basis of supporting the data plane development kit and the kernel driver to use the same quick peripheral component interconnect device.
[0038] Continue reading Figure 1As mentioned above, there are two types of driving modes for the express peripheral component interconnect device: kernel driver in kernel state and data plane development kit based on user state. Among them, the driving mode of the data plane development kit based on user state means that the data plane development kit completes direct memory access remapping through the virtual function input and output kernel component to realize input and output bypassing the kernel state and passing through the user state. If the data plane development kit and the kernel driver are supported to use the same express peripheral component interconnect device while loading the kernel driver and retaining the management interface and rich protocol stack of the kernel driver, then the address conflict problem needs to be considered, and it involves the application of the direct memory access technology remapping mechanism and the input and output memory management unit. To this end, the polling mode driver is also used to create a mediated device when the input and output memory management unit is enabled, and the mediated device is connected to the shunt driver. Here, considering that a express peripheral component interconnect device can only be used by one kernel driver, when the input and output memory management unit is not enabled, that is, not turned on, the network port peripheral device uses the direct memory access technology to access the host machine directly to access the physical memory of the host machine. Therefore, under the premise that the input and output memory management unit is not turned on, there is no address conflict between the data plane development kit and the kernel driver. The data plane development kit can directly use the large page memory in the physical memory, and direct memory access remapping does not require additional processing. However, for security reasons, it is necessary to restrict specific devices from performing direct memory access operations on specific memory areas, that is, any hardware cannot be allowed to access the entire system and perform direct memory access operations on any area. Therefore, it is necessary to enable the input and output memory management unit, that is, to turn on the input and output memory management unit, so as to provide direct memory access address conversion and device isolation functions. However, when the input and output memory management unit is enabled, the hardware uses not the real physical address, but the input and output virtual address (IO Virtual Address, IOVA) allocated by the input and output memory management unit, so the input and output memory management unit is relied on to achieve the remapping of the physical address to the input and output virtual address. Therefore, when the input and output memory management unit is enabled, the network port peripheral device uses the input and output virtual address to access the physical memory of the host machine. In order to avoid address conflicts between the data plane development kit and the kernel driver, the polling mode driver is also used to create a mediation device when the input and output memory management unit is enabled, and the mediation device is connected to the shunt driver. Here, the mediation device created by the polling mode driver corresponds to the mapping of the input and output virtual addresses to the host physical addresses (HPA) used by the polling mode driver. Therefore, when the input and output memory management unit is enabled, the mechanism of direct memory access remapping can be optimized by creating the mediation device.Specifically, the direct memory access remapping includes: applying for physical memory for a first mapping from a host virtual address (HostVirtual Address, HVA) to a host physical address through the polling mode driver, and notifying the kernel driver through the mediation device so that the kernel driver reserves an input and output virtual address for the second mapping from the input and output virtual address to the host physical address of the polling mode driver. This means that the mediation device created by the polling mode driver can be used to replace the device in the input and output memory management unit group. The user state driver of the data plane development kit, that is, the polling mode driver, applies for physical memory for the first mapping from the host virtual address to the host physical address. For example, the user state driver, that is, the polling mode driver, can use the container and group of the virtual function input and output kernel component to identify (PIN) the first mapping from the host virtual address to the host physical address. In addition, for the second mapping from the input and output virtual addresses to the host machine physical addresses, the polling mode driver notifies the kernel driver, such as the kernel manufacturer driver, through the previously created mediation device. In this way, in order to avoid conflicts between the input and output virtual addresses used by the kernel mode driver and the user mode driver, the kernel mode driver reserves a section of the input and output virtual addresses for the user mode driver, so that the two drivers use different address ranges. Therefore, the kernel driver is notified through the mediation device so that the kernel driver reserves the input and output virtual addresses for the second mapping from the input and output virtual addresses to the host machine physical addresses of the polling mode driver.
[0039] In conclusion, Figure 1 The driving method shown optimizes the direct memory access remapping mechanism. On the basis of the input and output memory management unit being enabled, a mediating device is created through a polling mode driver and the created mediating device is used to notify the kernel driver so that the kernel driver reserves the input and output virtual addresses for the second mapping from the input and output virtual addresses to the host physical addresses of the polling mode driver. In this way, the address conflict between the data plane development kit and the kernel driver is avoided. While loading the kernel driver and retaining the management interface and rich protocol stack of the kernel driver, the data plane development kit and the kernel driver are also supported to use the same quick peripheral component interconnect device, which is conducive to forwarding traffic to the user-mode driver or kernel driver in the data plane development kit on demand according to business planning and other requirements, retaining the management capability of the kernel network port network device, facilitating the unification of the network interface management interface, retaining the input and output processing capability of the kernel driver, and being able to use various mature protocol stacks and various commands of the management interface, thereby ensuring the high performance and low latency requirements of the data plane development kit while also improving the equipment utilization rate.
[0040] Figure 2 A method according to the embodiment of the present application is provided Figure 1 The driving method shown is a schematic diagram of driving a peripheral component interconnect express device. Figure 2 As shown, the data plane development kit 210 is in the user space 200, and the data plane development kit 210 includes a polling mode driver 212. In the kernel space 202, there are a kernel driver 230, a shunt driver 240, a mediation device 244, and a network interface 246. The hardware 204 includes a peripheral component interconnect express device 260, and the peripheral component interconnect express device 260 has a corresponding interface in the kernel space 202. Figure 2 The driving method of the peripheral component interconnect device 260 shown is based on Figure 1 The driving method shown, therefore, the device driving solution based on the kernel driver 230 and the device driving solution based on the data plane development kit 210 coexist, and support the data plane development kit 210 and the kernel driver 230 to use the same peripheral component interconnect express device 260. Specifically, the driving method for the peripheral component interconnect express device 260 includes: providing a kernel driver 230 located in the kernel space 202, wherein the kernel driver 230 is used for a first control plane 232 between a data plane development kit 210 located in the user space 200 and the peripheral component interconnect express device 260; providing a polling mode driver 212 in the data plane development kit 210 located in the user space 200, wherein the polling mode driver 212 is used for a second control plane 242 between the data plane development kit 210 and the peripheral component interconnect express device 260, and the data plane development kit 210 is used to enable an input output memory management unit to implement direct memory access remapping; forwarding traffic to the kernel driver 230 or the polling mode driver 212 based on a diversion rule through a diversion driver 240 located in the kernel space 202. The polling mode driver 212 is also used to create a mediation device 244 when the input output memory management unit is enabled, and the mediation device 244 is connected to the diversion driver 240. The direct memory access remapping includes: applying for physical memory for a first mapping from a host virtual address to a host physical address through the polling mode driver 212, and notifying the kernel driver 230 through the mediation device 244 so that the kernel driver 230 reserves input and output virtual addresses for the second mapping from input and output virtual addresses to host physical addresses of the polling mode driver 212.
[0041] See also Figure 2, the kernel driver 230 is used for the first control plane 232 between the data plane development kit 210 and the express peripheral component interconnect device 260 in the user space 200, and the polling mode driver 212 is used for the second control plane 242 between the data plane development kit 210 and the express peripheral component interconnect device 260. It can be seen that the first control plane 232 is associated with the kernel driver 230, and therefore corresponds to the kernel state driver. Conversely, the second control plane 242 is associated with the polling mode driver 212, and therefore corresponds to the user state driver. Through the coexistence of the kernel state driver and the user state driver, the first control plane 232 and the second control plane 242 are respectively used for corresponding control plane protocol processing. For example, the first control plane 232 corresponds to the kernel state driver, and the kernel driver 230 can provide various protocol stacks and various commands of the management interface, for example, the kernel driver 230 can provide the Link Aggregation Control Protocol (LACP) and the Link Layer Discovery Protocol (LLDP). Among them, the link aggregation control protocol can be used to regulate the interaction between member ports that have enabled the link aggregation control protocol by sending corresponding messages. When a link fails, the link in the aggregation group can be automatically adjusted to improve network reliability. The link layer discovery protocol is used to discover link connection relationships, so that a device connected to the network can encapsulate relevant information such as addresses and identifiers and send them to other devices connected to the same local area network. The kernel driver 230 can provide more mature and complete protocol stacks, which helps to reduce the overall operation and maintenance costs. For example, it can save the loss of developing duplicate protocol stacks and operation and maintenance software based on the data plane development kit 210, and also help to unify the management interface and kernel deployment methods. Figure 2 Also shown is a data plane 250 between the data plane development kit 210 and the peripheral component interconnect express device 260. In this way, the device is directly connected to the virtual machine, for example, the data plane development kit 210 completes direct memory access remapping through the virtual function input and output kernel component to achieve input and output bypassing the kernel state and directly connecting to the user state, which is conducive to improving data processing performance and throughput.
[0042] In conclusion, Figure 2 The Peripheral Component Interconnect Express device shown can be used in accordance with Figure 1The driving method shown is driven by optimizing the direct memory access remapping mechanism. On the basis of the input and output memory management unit being enabled, the polling mode driver 212 creates a mediating device 244 and uses the created mediating device 244 to notify the kernel driver 230 so that the kernel driver 230 reserves the input and output virtual addresses for the second mapping of the polling mode driver 212 from the input and output virtual addresses to the host machine physical addresses. In this way, the address conflict between the data plane development kit 210 and the kernel driver 230 is avoided, and the management interface and While enriching the protocol stack, it also supports the data plane development kit 210 and the kernel driver 230 to use the same quick peripheral component interconnect device 260, which is conducive to forwarding traffic to the user-mode driver or kernel driver 230 in the data plane development kit 210 on demand according to business planning and other requirements, retains the management capability of the kernel network port network device, is conducive to unifying the network interface management interface, retains the input and output processing capability of the kernel driver 230, and can use various complete and mature protocol stacks and management interface commands, while ensuring the high performance and low latency requirements of the data plane development kit 210 while also improving equipment utilization.
[0043] Figure 3 A flow chart of a traffic forwarding method provided in an embodiment of the present application. Figure 3 As shown, the traffic forwarding method includes the following steps.
[0044] Step S310: Setting the traffic diversion rules by hardware.
[0045] Step S320: Through the diversion driver, based on the diversion rule, it is determined whether to forward the traffic to the kernel driver or the polling mode driver.
[0046] Step S330: forwarding traffic to a kernel driver or a polling mode driver.
[0047] See also Figure 3 On the basis of the coexistence of the device driver solution based on the kernel driver and the device driver solution based on the data plane development kit, the traffic is forwarded to the kernel driver or the polling mode driver based on the diversion rule through the diversion driver located in the kernel space. In this way, on the basis of supporting the data plane development kit and the kernel driver to use the same quick peripheral component interconnect device, it is beneficial to business planning.
[0048] See also Figures 1 to 3In a possible implementation, a network interface is connected to the diversion driver, and the network interface, when the input and output memory management unit is enabled, uses the input and output virtual addresses in the second mapping to access the host memory. In this way, the management capability of the kernel network port network device is retained, which is conducive to the unification of the network interface management interface, the input and output processing capability of the kernel driver is retained, and various mature protocol stacks and management interface commands can be used, while ensuring the high performance and low latency requirements of the data plane development kit, the utilization rate of the device is also improved. In some embodiments, the polling mode driver synchronizes the physical address and the Internet Protocol (IP) address with the kernel driver through the network interface so that the polling mode driver and the kernel driver share the network protocol address. In this way, it is conducive to the user's business planning, and the traffic can be forwarded to the polling mode driver or the kernel driver according to the usage scenario.
[0049] In some embodiments, the diversion rule includes: based on the matching of the source network protocol address, the destination network protocol address and the protocol number of the network protocol layer of the traffic to be forwarded, and the matching of the source port and the destination port of the transmission control protocol (TCP) layer of the traffic to be forwarded, the traffic to be forwarded is selected to be forwarded to the kernel driver or the polling mode driver. In this way, on the basis that the polling mode driver and the kernel driver share the network protocol address, the source network protocol address, the destination network protocol address and the protocol number of the network protocol layer can be used as matching fields, and the three matching fields of the network protocol layer are required to hit as matching items, thereby achieving the matching of the source network protocol address, the destination network protocol address and the protocol number of the network protocol layer based on the traffic to be forwarded. In addition, the source port and the destination port of the transmission control protocol layer can also be used as matching fields, and the two matching fields of the transmission control protocol layer are required to hit as matching items, thereby achieving the matching of the source port and the destination port of the transmission control protocol layer. For example, for storage applications, TCP connections are used to transmit data for read and write operations, so the matching items and matching fields of the TCP layer can be used. In this way, the traffic is forwarded according to the diversion rule, which is conducive to adapting business planning and usage scenario requirements.
[0050] In some embodiments, the diversion rule further includes: when the traffic to be forwarded is non-tunnel traffic, forwarding the traffic to be forwarded to the kernel driver, and when the traffic to be forwarded is tunnel traffic, forwarding the traffic to be forwarded to the polling mode driver. In this way, traffic is forwarded according to the diversion rule, which is conducive to adapting business planning and usage scenario requirements.
[0051] In one possible implementation, the diversion rules are determined based on the business scenarios associated with the quick peripheral component interconnect device, the applications enabled by the kernel driver, and the flow table unloading operation of the data plane development kit. In this way, traffic is forwarded according to the diversion rules, which is conducive to adapting business planning and usage scenario requirements. For example, for storage applications, TCP connections are used to transmit data for read and write operations, so the matching items and matching fields of the TCP layer can be used. For another example, for runtime environment (RTE) unloading applications, the traffic of the underlay network, that is, the non-tunnel traffic, can be diverted to the kernel state driver, and the traffic of the overlay network, that is, the tunnel traffic, can be diverted to the user state driver.
[0052] In some embodiments, the shunt driver located in the kernel space forwards traffic to the kernel driver or the polling mode driver based on the shunt rule, including: when the fast peripheral component interconnect device is a smart network interface card (Smart NIC, SNIC) and the traffic to be forwarded is used for the runtime environment (runtime environment, RTE) flow table unloading of the data plane development kit, the shunt driver forwards the traffic to be forwarded to the polling mode driver, when the fast peripheral component interconnect device is an embedded central processing unit (Embedded CPU, ECPU) of a data processing unit (data processing unit, DPU) and the traffic to be forwarded is used for the runtime environment flow table unloading of the data plane development kit, the shunt driver forwards the traffic to be forwarded to the polling mode driver, when the fast peripheral component interconnect device is the embedded central processing unit of the data processor and the traffic to be forwarded is used for remote access based on the data plane development kit, the shunt driver forwards the traffic to be forwarded to the polling mode driver. In this way, forwarding traffic according to the shunt rule is achieved, which is conducive to adapting business planning and usage scenario requirements. For these usage scenarios suitable for polling mode drivers, that is, user-mode drivers based on data plane development kits, for example, deploying an open switch (OpenvSwitch, OVS) and DPDK's RTE flow table unloading on a host machine deployed with SNIC, and deploying OVS and DPDK's RTE flow table unloading on the ECPU of a DPU product, and for example, the storage client of the ECPU of the DPU product accesses the remote hard disk through the network port interface of DPDK, forwarding the to-be-forwarded traffic to the polling mode driver through the diversion driver helps to improve data transmission efficiency and processing performance.
[0053] In some embodiments, the shunt driver located in the kernel space forwards traffic to the kernel driver or the polling mode driver based on the shunt rule, and further includes: when the kernel driver enables the binding port of the link aggregation control protocol mode and opens the link aggregation port of the Ethernet port associated with the quick peripheral component interconnect device, forwarding the traffic to be forwarded to the kernel driver through the shunt driver, and when the kernel driver enables the link layer discovery protocol application and the traffic to be forwarded is used to check the link layer discovery protocol neighbor in order to synchronize the switch configuration, forwarding the traffic to be forwarded to the kernel driver through the shunt driver. In this way, forwarding traffic according to the shunt rule is achieved, which is conducive to adapting business planning and usage scenario requirements. For these usage scenarios suitable for the kernel driver, the complete and rich protocol stack and management interface commands provided by the kernel driver can be used, such as the kernel enables the binding port of the LACP mode and opens the link aggregation group (Link Aggregation Group, LAG) of the hardware Ethernet port, so that the hardware LAG capability can be used. For another example, when the kernel enables the LLDP application, the operating system can view LLDP neighbors and synchronize the Data Center Bridging (DCB) configuration obtained by the switch to achieve a lossless network.
[0054] In a possible implementation, the first mapping and the second mapping are used to implement the direct memory access remapping, and the direct memory access remapping is used to process input and output requirements through the polling mode driver. In this way, by optimizing the mechanism of direct memory access remapping, on the basis of the input and output memory management unit being enabled, a mediating device is created through the polling mode driver and the created mediating device is used to notify the kernel driver so that the kernel driver reserves the input and output virtual addresses for the polling mode driver. The second mapping from the input and output virtual addresses to the host machine physical addresses is achieved, thereby avoiding address conflicts between the data plane development kit and the kernel driver, supporting the data plane development kit and the kernel driver to use the same quick peripheral component interconnect device, and providing an overall device driver solution that includes both a kernel driver-based device driver solution and a data plane development kit-based device driver solution, that is, the coexistence of the two, which is conducive to better adapting to customers' needs for input and output customization.
[0055] In a possible implementation, the kernel driver is not unloaded during the period when the data plane development kit uses the quick peripheral component interconnect device through the polling mode driver. In this way, while loading the kernel driver and retaining the kernel driver's management interface and rich protocol stack, the data plane development kit and the kernel driver are also supported to use the same quick peripheral component interconnect device, which is conducive to forwarding traffic to the user-mode driver or kernel driver in the data plane development kit on demand according to business planning and other requirements, retaining the management capability of the kernel network port network device, facilitating the unification of the network interface management interface, retaining the input and output processing capability of the kernel driver, and being able to use various mature protocol stacks and management interface commands, while ensuring the high performance and low latency requirements of the data plane development kit and also improving the equipment utilization.
[0056] In a possible implementation, the kernel driver includes a network interface management interface and a kernel protocol stack, which is conducive to using various mature protocol stacks and management interface commands of the kernel driver.
[0057] In some embodiments, the network interface management interface provides a variety of commands for network interface operation and maintenance, including network interface viewing commands, network interface configuration commands, and network device driver hardware setting commands, and the kernel protocol stack includes a link layer discovery protocol stack for port direct connection and a link aggregation control protocol stack for binding configuration. In this way, it is conducive to using the various mature protocol stacks and management interface commands of the kernel driver, retaining the management capabilities of the kernel network port network devices, facilitating the unification of the network interface management interface, and retaining the input and output processing capabilities of the kernel driver.
[0058] In a possible implementation, the kernel driver is a kernel vendor driver of the Express Peripheral Component Interconnect device. This is conducive to using various mature protocol stacks and management interface commands of the kernel driver, retaining the management capability of the kernel network port network device, facilitating the unification of the network interface management interface, and retaining the input and output processing capability of the kernel driver.
[0059] In a possible implementation manner, the kernel space and the user space belong to the same server. In this way, the high performance and low latency requirements of the data plane development kit are guaranteed while also improving the utilization rate of the equipment.
[0060] In a possible implementation, the first control plane or the second control plane is used for data plane direct communication between the data plane development kit and the express peripheral component interconnect device. In this way, direct communication from the device to the virtual machine is achieved, for example, the data plane development kit completes direct memory access remapping through the virtual function input and output kernel component to achieve input and output bypassing the kernel state and directly passing through the user state, which is conducive to improving data processing performance and throughput.
[0061] In a possible implementation, the peripheral component interconnect express device belongs to a first input / output memory management unit group, a first part of a first input / output virtual address space associated with the first input / output memory management unit group is reserved for the input / output virtual address in the second mapping driven by the polling mode, a second part of the first input / output virtual address space is reserved for the kernel driver, and the first part is independent of the second part. Considering that each peripheral component interconnect express device belongs to an input / output memory management unit group, for example, the peripheral component interconnect express device belongs to the first input / output memory management unit group, the input / output virtual address of each input / output memory management unit group is independent. Therefore, address conflicts can be avoided by various reservation schemes. Here, a first part of a first input / output virtual address space associated with the first input / output memory management unit group (for example, the first to the 47th bit of the address space) is reserved for the input / output virtual address in the second mapping driven by the polling mode, a second part of the first input / output virtual address space (for example, the 47th bit or more of the address space) is reserved for the kernel driver, and the first part is independent of the second part. In this way, when the two driver modes coexist, the same peripheral component interconnect device is used to retain the protocol stack and input and output processing capabilities of the kernel driver, and the normal use of the kernel driver is ensured by reserving the input and output virtual addresses. The specific reservation scheme can be agreed upon in advance by the kernel driver and the data plane development kit.
[0062] Figure 44 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application, and the computing device 400 includes: one or more processors 410, a communication interface 420 and a memory 430. The processor 410, the communication interface 420 and the memory 430 are interconnected via a bus 440. Optionally, the computing device 400 may also include an input / output interface 450, and the input / output interface 450 is connected to an input / output device for receiving parameters set by a user, etc. The computing device 400 can be used to implement some or all of the functions of the device embodiment or system embodiment in the above-mentioned embodiment of the present application; the processor 410 can also be used to implement some or all of the operating steps of the method embodiment in the above-mentioned embodiment of the present application. For example, the specific implementation of the computing device 400 performing various operations can refer to the specific details in the above-mentioned embodiments, such as the processor 410 is used to perform some or all of the steps in the above-mentioned method embodiment or some or all of the operations in the above-mentioned method embodiment. For another example, in an embodiment of the present application, the computing device 400 may be used to implement part or all of the functions of one or more components in the above-mentioned apparatus embodiment. In addition, the communication interface 420 may be specifically used to perform the communication functions necessary to implement the functions of these apparatuses and components, and the processor 410 may be specifically used to perform the processing functions necessary to implement the functions of these apparatuses and components.
[0063] It should be understood that Figure 4 The computing device 400 may include one or more processors 410, and the multiple processors 410 may provide processing capabilities in a parallel connection mode, a serial connection mode, a serial-parallel connection mode, or any connection mode, or the multiple processors 410 may form a processor sequence or a processor array, or the multiple processors 410 may be divided into a main processor and an auxiliary processor, or the multiple processors 410 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 4 The computing device 400 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 400 may include Figure 4 More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.
[0064] The processor 410 may have a variety of specific implementation forms. For example, the processor 410 may include a central processing unit (CPU), a graphic processing unit (GPU), a neural-network processing unit (NPU), a tensor processing unit (TPU) or a data processing unit (DPU), etc., and the embodiment of the present application does not specifically limit it. The processor 410 may also be a single-core processor or a multi-core processor. The processor 410 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The processor 410 may also be implemented using a logic device with built-in processing logic alone, such as an FPGA or a digital signal processor (DSP). The communication interface 420 may be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface may be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface may be a cellular network interface or a wireless local area network interface, etc.
[0065] The memory 430 may be a non-volatile memory, such as a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The memory 430 may also be a volatile memory, which may be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM). The memory 430 may also be used to store program codes and data, so that the processor 410 calls the program codes stored in the memory 430 to execute some or all of the operation steps in the above method embodiment, or to execute the corresponding functions in the above device embodiment. Figure 4 Show more or fewer components, or have different component configurations.
[0066] The bus 440 may be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 440 may be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 440 may also include a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0067] The method and device provided in the embodiments of the present application are based on the same inventive concept. Since the principles of solving the problems in the methods and devices are similar, the embodiments, implementation methods, examples or implementation methods of the methods and devices can refer to each other, and the repeated parts will not be repeated. The embodiments of the present application also provide a system, which includes multiple computing devices, and the structure of each computing device can refer to the structure of the computing device described above. The functions or operations that can be implemented by the system can refer to the specific implementation steps in the above method embodiments and / or the specific functions described in the above device embodiments, which will not be repeated here.
[0068] The present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer device (such as one or more processors), the method steps in the above method embodiment can be implemented. The specific implementation of the processor of the computer-readable storage medium in executing the above method steps can refer to the specific operations described in the above method embodiment and / or the specific functions described in the above device embodiment, which will not be repeated here.
[0069] It should be understood by those skilled in the art that the embodiments of the present application may be provided as methods, systems, or computer program products. The present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. The embodiments of the present application may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media. Available media can be magnetic media (such as floppy disks, hard disks, tapes), optical media, or semiconductor media. Semiconductor media can be solid-state hard disks, random access memory, flash memory, read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, or any other form of suitable storage media.
[0070] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. Each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0071] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. The steps in the method of the embodiment of the present application can be adjusted in order, merged or deleted according to actual needs; the modules in the system of the embodiment of the present application can be divided, merged or deleted according to actual needs. If these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. A driving method, It is characterized in that The driving method comprises: Providing a kernel driver located in the kernel space, wherein the kernel driver is used for a first control plane between a data plane development kit located in the user space and a peripheral component interconnect express device; providing a polling mode driver in the data plane development kit in the user space, wherein the polling mode driver is used for a second control plane between the data plane development kit and the peripheral component interconnect express device, and the data plane development kit is used to enable an input output memory management unit to implement direct memory access remapping; By means of a shunt driver located in the kernel space, traffic is forwarded to the kernel driver or the polling mode driver based on a shunt rule, The polling mode driver is further used to create a mediation device when the input / output memory management unit is enabled, and the mediation device is connected to the shunt driver. The direct memory access remapping includes: applying for physical memory for a first mapping from a host virtual address to a host physical address through the polling mode driver, and notifying the kernel driver through the mediation device so that the kernel driver reserves input and output virtual addresses for the second mapping from the input and output virtual addresses to the host physical addresses of the polling mode driver.
2. The driving method according to claim 1, It is characterized in that A network interface is connected to the shunt driver, and when the input / output memory management unit is enabled, the network interface uses the input / output virtual address in the second mapping to access the host machine memory.
3. The driving method according to claim 2, It is characterized in that The polling mode driver synchronizes a physical address and a network protocol address with the kernel driver through the network interface so that the polling mode driver shares the network protocol address with the kernel driver.
4. The driving method according to claim 3, It is characterized in that The diversion rules include: Based on the matching of the source network protocol address, destination network protocol address and protocol number of the network protocol layer of the traffic to be forwarded, as well as the matching of the source port and destination port of the transmission control protocol layer of the traffic to be forwarded, the traffic to be forwarded is selected to be forwarded to the kernel driver or the polling mode driver.
5. The driving method according to claim 4, It is characterized in that The diversion rules also include: When the traffic to be forwarded is non-tunnel traffic, forwarding the traffic to be forwarded to the kernel driver, When the traffic to be forwarded is tunnel traffic, the traffic to be forwarded is forwarded to the polling mode driver.
6. The driving method according to claim 1, It is characterized in that The traffic diversion rule is determined based on a business scenario associated with the peripheral component interconnect express device, an application enabled by the kernel driver, and a flow table offloading operation of the data plane development kit.
7. The driving method according to claim 6, It is characterized in that Forwarding traffic to the kernel driver or the polling mode driver based on the diversion rule by the diversion driver located in the kernel space includes: When the peripheral component interconnect express device is an intelligent network interface card and the traffic to be forwarded is used for unloading the flow table of the operating environment of the data plane development kit, the traffic to be forwarded is forwarded to the polling mode driver through the shunt driver, When the peripheral component interconnect express device is an embedded central processing unit of a data processor and the traffic to be forwarded is used for unloading the flow table of the operating environment of the data plane development kit, the traffic to be forwarded is forwarded to the polling mode driver through the shunt driver, When the peripheral component interconnect express device is the embedded central processing unit of the data processor and the traffic to be forwarded is used for remote access based on the data plane development kit, the traffic to be forwarded is forwarded to the polling mode driver through the shunt driver.
8. The driving method according to claim 7, It is characterized in that Forwarding traffic to the kernel driver or the polling mode driver based on the diversion rule through the diversion driver located in the kernel space, further comprising: When the kernel driver enables the binding port of the link aggregation control protocol mode and opens the link aggregation port of the Ethernet port associated with the peripheral component interconnect device, forwarding the to-be-forwarded traffic to the kernel driver through the diversion driver, When the kernel driver enables the link layer discovery protocol application and the traffic to be forwarded is used to check the link layer discovery protocol neighbors to synchronize the switch configuration, the traffic to be forwarded is forwarded to the kernel driver through the diversion driver.
9. The driving method according to claim 1, It is characterized in that The first mapping and the second mapping are used to implement the direct memory access remapping, and the direct memory access remapping is used to drive processing input and output requirements through the polling mode.
10. The driving method according to claim 1, It is characterized in that The kernel driver is not unloaded during the period when the data plane development kit uses the peripheral component interconnect express device through the polling mode driver.
11. The driving method according to claim 1, It is characterized in that The kernel driver includes a network interface management interface and a kernel protocol stack.
12. The driving method according to claim 11, It is characterized in that The network interface management interface provides a variety of commands for network interface operation and maintenance, including network interface viewing commands, network interface configuration commands and network device driver hardware setting commands. The kernel protocol stack includes a link layer discovery protocol stack for port direct connection and a link aggregation control protocol stack for binding configuration.
13. The driving method according to claim 1, It is characterized in that The kernel driver is a kernel vendor driver of the PCI Express device.
14. The driving method according to claim 1, It is characterized in that The kernel space and the user space belong to the same server.
15. The driving method according to claim 1, It is characterized in that The first control plane or the second control plane is used for data plane direct communication between the data plane development kit and the peripheral component interconnect express device.
16. The driving method according to claim 1, It is characterized in that The peripheral component interconnect express device belongs to a first input / output memory management unit group, a first part of a first input / output virtual address space associated with the first input / output memory management unit group is reserved for input / output virtual addresses in the second mapping of the polling mode driver, a second part of the first input / output virtual address space is reserved for the kernel driver, and the first part is independent of the second part.
17. A computer device, It is characterized in that The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method according to any one of claims 1 to 16 when executing the computer program.
18. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, which, when executed on a computer device, cause the computer device to execute the method according to any one of claims 1 to 16.
