Network card adding method, device, computing device and machine-readable storage medium

By creating preset interfaces, virtual switches and bridges on the DPDK virtualization platform, monitoring and binding of new network cards, the network interruption problem caused by dynamic addition of network cards is solved, and stable and efficient dynamic addition and communication of network cards is achieved.

CN117793034BActive Publication Date: 2024-11-22BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311825870.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-27
Publication Date
2024-11-22
Estimated Expiration
2043-12-27

AI Technical Summary

Technical Problem

The existing dynamic addition method of network card will cause network interruption when restarting the DPDK interface and affect network communication.

Method used

By creating a DPDK preset interface, a virtual switch vSwitch interface and a bridge bound to the vSwitch interface, monitor the kernel network card events and bind them to the corresponding bridge in order when adding a network card event to avoid direct binding to DPDK driver, thus realizing dynamic network card addition and communication.

Benefits of technology

It realizes dynamic addition of network cards without restarting DPDK network services, avoids network interruptions, improves the stability of network communication, and can dynamically monitor kernel network card events, reducing manual operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117793034B_ABST
    Figure CN117793034B_ABST
Patent Text Reader

Abstract

The present application relates to the field of network communication technology, and discloses a network card adding method, device, computing device and machine-readable storage medium. The network card adding method includes: creating a DPDK preset interface, a virtual switch vSwitch interface and a bridge bound to the vSwitch interface; binding the DPDK preset interface to the vSwitch interface one by one; monitoring kernel network card events; and in the case where the kernel network card event is a newly added network card event, binding the newly added network card to the bridge in the corresponding order according to the order of the newly added network cards in the kernel. The network card adding method disclosed in the present application utilizes the vSwitch interface and the bridge to bind the dynamically added network card to the bridge, and does not need to directly bind the newly added network card to the DPDK, so that the dynamic addition and communication of the network card can be realized without restarting the network service of the DPDK or restarting the entire DPDK, and the present application can dynamically monitor the kernel network card events, and respond in time after monitoring the newly added network card events, and does not need to manually add the network card.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to a network card adding method, device, computing equipment and machine-readable storage medium. Background Art

[0002] In recent years, with the rapid development of computer technology and the continuous improvement of hardware performance, virtualization technology has attracted more and more attention and application due to its full utilization of computer resources and high flexibility and scalability, and has become a key component of modern data centers and cloud computing.

[0003] In many cases, when a network system needs to expand its network functions, it may be necessary to add new dynamic network cards, such as increasing the number of network connections of a server, achieving load balancing and redundancy, implementing virtual LANs or other network isolation technologies, etc. Dynamically adding network cards can be used to increase network capacity, improve performance, implement specific network topologies, or meet security requirements to adapt to different network environments and use cases.

[0004] In virtualization technology, when processing high-density network data packets, in order to adapt to the frequent context switching between user space and kernel space, DPDK (Data Plane Development Kit) is usually used to process and forward data packets, so it is necessary to support dynamic addition of network cards. The current method of dynamically adding network cards is to bind the newly added network card to the DPDK driver, and then restart the DPDK network service or restart the entire DPDK. This method will cause the existing DPDK interface to be disconnected during the restart process, affecting network communication. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a network card adding method, apparatus, computing device and machine-readable storage medium to solve the technical problem that the existing network card dynamic adding method causes the network interruption of the existing DPDK interface during the restart process.

[0006] In order to achieve the above-mentioned object, the first aspect of the present application provides a method for adding a network card, which is applied to a virtualized platform computing device including a data plane development kit DPDK, and the method for adding a network card includes:

[0007] Create a data plane development kit DPDK preset interface, a virtual switch vSwitch interface, and a bridge bound to the vSwitch interface;

[0008] Bind the DPDK preset interface to the vSwitch interface one by one;

[0009] Monitor kernel network card events;

[0010] When the kernel network card event is a newly added network card event, the newly added network cards are bound to the bridges in the corresponding order according to the order in which the kernel added the network cards.

[0011] In an embodiment of the present application, creating a DPDK preset interface, a vSwitch interface, and a bridge bound to the vSwitch interface includes:

[0012] Creating a first number of DPDK preset interfaces;

[0013] Creating a first number of vSwitch interfaces according to the first number of DPDK preset interfaces;

[0014] Create a first number of namespaces corresponding to the first number of vSwitch interfaces in sequence;

[0015] Move the first number of vSwitch interfaces into the corresponding first number of namespaces respectively;

[0016] Create a bridge in each namespace.

[0017] Bind the vSwitch interface in each namespace to the bridge.

[0018] In an embodiment of the present application, DPDK includes a hotplug module. When the kernel network card event is a newly added network card event, the newly added network card is bound to the corresponding order of bridges according to the order in which the kernel newly added the network card, including:

[0019] Control hotplug module registration callback function;

[0020] When the kernel network card event is a newly added network card event, the callback function is used to modify the physical address of the newly added network card according to the preset rules, and the original physical address of the newly added network card is saved;

[0021] Use the callback function to move the newly added network cards into the namespace of the corresponding order according to the order in which the kernel added the network cards;

[0022] Bind the newly added network card to the bridge in the corresponding namespace, and change the physical address of the DPDK preset interface bound to the vSwitch interface in the namespace to the original physical address of the newly added network card.

[0023] In an embodiment of the present application, DPDK includes a hotplug module to monitor kernel network card events, including:

[0024] Control the hotplug module to create a monitoring process;

[0025] Monitor kernel network card events according to the monitoring process of the hotplug module.

[0026] In an embodiment of the present application, the network card adding method further includes:

[0027] By adding a new network card, control DPDK to receive the first message or send the second message.

[0028] In the embodiment of the present application, by adding a network card, controlling the DPDK to receive the first message or send the second message includes:

[0029] receiving the first message through the newly added network card, and sending the first message to the network bridge bound to the newly added network card;

[0030] Send the first message to the vSwitch interface bound to the newly added network card through the network bridge;

[0031] Sending the first message to the DPDK preset interface bound to the vSwitch interface through the vSwitch interface;

[0032] The first message is transmitted to the DPDK through a DPDK preset interface, so that the DPDK receives and processes the first message.

[0033] In the embodiment of the present application, by adding a network card, controlling the DPDK to receive the first message or send the second message includes:

[0034] Processing the second message through the DPDK, and sending the second message to the corresponding DPDK preset interface;

[0035] Sending the second message to the vSwitch interface bound to the DPDK preset interface through the DPDK preset interface;

[0036] Sending the second message to the bridge bound to the vSwitch interface through the vSwitch interface;

[0037] Sending the second message to the newly added network card bound to the bridge through the bridge;

[0038] The second message is sent through the newly added network card.

[0039] A second aspect of the present application provides a network card adding device, which is applied to a virtualized platform computing device including a data plane development kit DPDK, and the network card adding device includes:

[0040] Create a module for creating a data plane development kit DPDK preset interface, a virtual switch vSwitch interface, and a bridge bound to the vSwitch interface;

[0041] The first binding module is used to bind the DPDK preset interface to the vSwitch interface one by one;

[0042] Monitoring module, used to monitor kernel network card events;

[0043] The second binding module is used to bind the newly added network card with the corresponding order of bridges according to the order in which the kernel newly added network cards when the kernel network card event is a newly added network card event.

[0044] A third aspect of the present application provides a computing device, including a processor and a memory, wherein the memory stores programs or instructions, and when the programs or instructions are executed by the processor, the steps of the network card adding method described in the first aspect are implemented.

[0045] The fourth aspect of the present application provides a machine-readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the network card adding method described in the first aspect are implemented.

[0046] Through the above technical solution, the DPDK preset interface, the vSwitch interface and the bridge bound to the vSwitch interface are utilized to bind the DPDK preset interface to the vSwitch interface, and the dynamically added network card is bound to the bridge. There is no need to bind the newly added network card directly to the DPDK driver, so there is no need to restart the DPDK network service or restart the entire DPDK to achieve dynamic addition and communication of the network card. In addition, the present application can dynamically monitor kernel network card events and respond in time after monitoring the newly added network card events, without the need to manually add network cards.

[0047] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0049] Figure 1 A schematic diagram of a process of adding a network card according to an embodiment of the present application is shown;

[0050] Figure 2 The structural block diagram of a network card adding device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0052] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0053] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0054] Figure 1 A schematic diagram of a process flow of a method for adding a network card according to an embodiment of the present application is shown as follows: Figure 1 As shown, in an embodiment of the present application, a method for adding a network card is provided, which is applied to a virtualized platform computing device including a data plane development kit DPDK, and the method for adding a network card includes the following steps:

[0055] Step S110: Create a data plane development kit DPDK preset interface, a virtual switch vSwitch interface, and a bridge bound to the vSwitch interface.

[0056] vSwitch (Virtual Switch, virtual switch or virtual network switch) works at the data link layer and implements the network functions of the data link layer (and part of the network layer) of the physical switch through software. Compared with traditional physical switches, virtual switches have the advantages of flexible configuration and strong scalability. An ordinary server can be configured with dozens or even hundreds of virtual switches, and the number of ports can be flexibly selected.

[0057] A bridge is an early two-port data link layer network device. A bridge is also called a bridge. It is a storage / forwarding device that connects two local area networks. It can divide a large LAN (Local Area Network) into multiple segments, or interconnect more than two LANs into a logical LAN, so that all users on the LAN can access the server. The most common way to expand a local area network is to use a bridge. The simplest bridge has two ports, and more complex bridges can have more ports. Each port of the bridge is connected to a network segment.

[0058] In the embodiment of the present application, the DPDK preset interface is bound to the vSwitch interface, the vSwitch interface is bound to the bridge, and the dynamically added network card is bound to the bridge, thereby indirectly adding the network card to the DPDK. Therefore, it is necessary to first create the interrelated DPDK preset interface, the vSwitch interface, and the bridge bound to the vSwitch interface.

[0059] Specifically, step S110 includes:

[0060] Step S111: creating a first number of DPDK preset interfaces;

[0061] Step S112: creating a first number of vSwitch interfaces according to a first number of DPDK preset interfaces;

[0062] Step S113: sequentially creating a first number of namespaces corresponding to the first number of vSwitch interfaces one by one;

[0063] Step S114: moving the first number of vSwitch interfaces into the corresponding first number of namespaces respectively;

[0064] Step S115: Create a bridge in each namespace;

[0065] Step S116: Bind the vSwitch interface in each namespace to the bridge.

[0066] In an embodiment of the present application, when DPDK initializes the interface, it pre-creates additional interface resources according to actual needs, that is, a first number of DPDK preset interfaces; based on the created first number of DPDK preset interfaces, it creates an equal number of vSwitch interfaces, that is, a first number of vSwitch interfaces; then, it creates a first number of namespaces corresponding to the first number of vSwitch interfaces in sequence, and then moves each vSwitch interface into the corresponding namespace; finally, it creates a bridge under each namespace, and binds the vSwitch interface under each namespace to one end of the bridge.

[0067] At this point, the basic steps of the network card adding method of the embodiment of the present application are completed, and resources such as the vSwitch interface, bridge, namespace, etc. are created and associated with each other.

[0068] Step S120: Bind the DPDK preset interface to the vSwitch interface one by one.

[0069] After creating the vSwitch interface, bridge, and namespace, bind the DPDK preset interface to the vSwitch interface one by one, that is, bind the vSwitch interface to the interface resources pre-created by DPDK.

[0070] Step S120 is a key step in the embodiment of the present application, which ensures that the newly added network card in the subsequent steps can be associated with the DPDK through the bridge and vSwitch interface.

[0071] Step S130: monitor kernel network card events.

[0072] In order to ensure the timeliness of adding network cards and avoid affecting the normal communication of the network system, it is necessary to monitor kernel network card events in real time.

[0073] Specifically, DPDK includes a hotplug module, and step S130 includes:

[0074] Step S131: controlling the hotplug module to create a monitoring process;

[0075] Step S132: monitoring kernel network card events according to the monitoring process of the hotplug module.

[0076] Generally speaking, the hotplug module is a set of hardware and software technical standards involving the electrical characteristics of the motherboard hardware, firmware, operating system kernel, devices and other components that support each other. It allows users to plug in the device and use it directly when the system is powered on; they can also unplug the device after using it without turning off the system power, and the whole process does not affect the work and load of the system. The hotplug module can be used in DPDK to implement dynamic device management. In terms of hardware, the hotplug module needs to support the detection and processing of plug-in and unplug events, as well as the management of power and signals; in terms of software, the hotplug module needs to support the identification and configuration of the device, as well as the loading and unloading of drivers.

[0077] In an embodiment of the present application, after DPDK is started, the hotplug module is turned on, and the hotplug module is controlled to create a monitoring process. The kernel network card events are dynamically monitored through the monitoring process of the hotplug module. Timely response can be made after the kernel dynamically adds the network card, without the need to manually add the network card.

[0078] Step S140: when the kernel network card event is a newly added network card event, the newly added network card is bound to the network bridges in the corresponding order according to the order in which the kernel adds the network cards.

[0079] When the kernel network card event is monitored as a newly added network card, the newly added network card is bound to DPDK through the bridge and vSwitch interface in real time.

[0080] Specifically, DPDK includes a hotplug module, and step S140 includes:

[0081] Step S141: Control the hotplug module to register the callback function.

[0082] In the embodiment of the present application, in addition to monitoring kernel network card events, the hotplug module can also register a callback function. A callback function is a special function that is passed as a parameter to another function and is called after the called function is executed. It is understandable that DPDK mainly runs on the Linux system. In the Linux environment, the callback function is an important programming mechanism that can be used to process various events and operation results.

[0083] Step S142: when the kernel network card event is a newly added network card event, modify the physical address of the newly added network card according to a preset rule using a callback function, and save the original physical address of the newly added network card.

[0084] When a new network card is added to the kernel, that is, when the monitoring process of the hotplug module monitors the event of a new network card being added to the kernel, the registered callback function will be called. The callback function will modify the physical address of the new network card according to the preset rules and save the original physical address of the new network card. This application does not limit the preset rules for modifying the physical address of the new network card.

[0085] Step S143: using the callback function, the newly added network cards are moved into the namespace of the corresponding order according to the order in which the kernel adds the network cards.

[0086] In addition to modifying the physical address of the newly added network card, the callback function will call the Linux system command to move the newly added network card into the namespace of the corresponding order according to the order in which the kernel added the network card. That is to say, if the hotplug module monitors that the kernel has added a second network card, the callback function will move the newly added second network card into the second namespace accordingly. The order of the namespaces can be determined according to the creation time of the namespaces, or in other ways, as long as different namespaces can be distinguished. This application does not limit this.

[0087] Step S144: Bind the newly added network card to the network bridge under the corresponding namespace, and modify the physical address of the DPDK preset interface bound to the vSwitch interface under the namespace to the original physical address of the newly added network card.

[0088] Each namespace has a corresponding bridge and vSwitch interface. The newly added network card has been moved into the namespace. The newly added network card is bound to the bridge under the corresponding namespace. At the same time, the callback function is used to modify the physical address of the DPDK preset interface bound to the vSwitch interface under the namespace to the original physical address of the newly added network card.

[0089] It can be understood that one end of the bridge under each namespace is bound to the vSwitch interface, and the vSwitch interface is bound one by one to the DPDK preset interface. Then binding the newly added network card to the other end of the bridge under the corresponding namespace is actually indirectly binding the newly added network card to DPDK. In this case, the dynamic addition function of the DPDK network card can be implemented without affecting the communication of the existing DPDK interfaces. At the same time, the newly added network card does not need to be directly bound to the DPDK driver, so the dynamic communication of the network card can be realized without restarting DPDK.

[0090] On the other hand, the physical address of the DPDK preset interface bound to the vSwitch interface in the namespace corresponding to the newly added network card is changed to the original physical address of the newly added network card, ensuring the consistency of the interface resources pre-applied by DPDK and the status of the newly added network card. To the outside world, the newly added network card is equivalent to being taken over by DPDK.

[0091] At this point, the dynamic addition of the DPDK network card is completed.

[0092] In an embodiment of the present application, the network card adding method further includes:

[0093] By adding a new network card, control DPDK to receive the first message or send the second message.

[0094] After adding a new network card, you can use it to transmit and receive data.

[0095] Specifically, by adding a new network card, controlling DPDK to receive the first message or send the second message includes:

[0096] receiving the first message through the newly added network card, and sending the first message to the network bridge bound to the newly added network card;

[0097] Send the first message to the vSwitch interface bound to the newly added network card through the network bridge;

[0098] Sending the first message to the DPDK preset interface bound to the vSwitch interface through the vSwitch interface;

[0099] The first message is transmitted to the DPDK through a DPDK preset interface, so that the DPDK receives and processes the first message.

[0100] When DPDK receives a data packet, the data packet first enters the actual newly added network card under the namespace, and then the data packet is sent to the vSwitch interface through the bridge. The vSwitch interface then sends the data packet to the corresponding DPDK preset interface, and the data packet is handed over to DPDK for processing through the DPDK preset interface.

[0101] Specifically, by adding a new network card, controlling DPDK to receive the first message or send the second message includes:

[0102] Processing the second message through the DPDK, and sending the second message to the corresponding DPDK preset interface;

[0103] Sending the second message to the vSwitch interface bound to the DPDK preset interface through the DPDK preset interface;

[0104] Sending the second message to the bridge bound to the vSwitch interface through the vSwitch interface;

[0105] Sending the second message to the newly added network card bound to the bridge through the bridge;

[0106] The second message is sent through the newly added network card.

[0107] When DPDK sends a data packet, DPDK finds through modules such as routing that the data packet needs to be sent from the DPDK preset interface, and then sends the data packet to the corresponding DPDK preset interface. The data packet is sent to the vSwitch interface, and then the vSwitch interface transmits the data packet to the actual newly added network card through the corresponding bridge and sends it to other places.

[0108] The network card adding method provided in the embodiment of the present application utilizes the DPDK preset interface, the vSwitch interface and the bridge bound to the vSwitch interface to bind the DPDK preset interface to the vSwitch interface, and to bind the dynamically added network card to the bridge. There is no need to directly bind the newly added network card to the DPDK driver, so there is no need to restart the DPDK network service or restart the entire DPDK to achieve dynamic addition and communication of the network card. In addition, the present application can dynamically monitor kernel network card events and respond in a timely manner after monitoring the newly added network card events, without the need for manual addition of network cards.

[0109] Corresponding to the above method embodiment, see Figure 2 , Figure 2 The structure block diagram of a network card adding device according to an embodiment of the present application is schematically shown. Figure 2 As shown, in an embodiment of the present application, a network card adding device 200 is provided, which is applied to a virtualization platform computing device including a data plane development kit DPDK, and the network card adding device 200 includes:

[0110] A creation module 210 is used to create a data plane development kit DPDK preset interface, a virtual switch vSwitch interface, and a bridge bound to the vSwitch interface;

[0111] A first binding module 220, used to bind the DPDK preset interface to the vSwitch interface one by one;

[0112] Monitoring module 230, used to monitor kernel network card events;

[0113] The second binding module 240 is used to bind the newly added network card with the corresponding bridge sequence according to the sequence of newly added network cards in the kernel when the kernel network card event is a newly added network card event.

[0114] The network card adding device provided in the embodiment of the present application can implement each process of the network card adding method in the method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.

[0115] An embodiment of the present application also provides a computing device, including a processor and a memory, wherein the memory stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the above-mentioned network card adding method are implemented.

[0116] An embodiment of the present application also provides a machine-readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the above-mentioned network card adding method are implemented.

[0117] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0118] 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. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 A device that provides the functions specified in a block or multiple blocks.

[0119] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0120] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing 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.

[0121] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0122] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0123] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0124] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0125] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for adding a network card, characterized in that: Applied to a virtualized platform computing device including a data plane development kit DPDK, the method includes: Create a data plane development kit DPDK preset interface, a virtual switch vSwitch interface, and a bridge bound to the vSwitch interface; Bind the DPDK preset interface to the vSwitch interface one by one; Monitor kernel network card events; In the case where the kernel network card event is a newly added network card event, binding the newly added network card to the network bridges in the corresponding order according to the order in which the kernel newly added the network cards; The step of creating a DPDK preset interface, a vSwitch interface, and a bridge bound to the vSwitch interface includes: Creating a first number of DPDK preset interfaces; Creating a first number of vSwitch interfaces according to the first number of DPDK preset interfaces; Sequentially create a first number of namespaces corresponding one-to-one to the first number of vSwitch interfaces; Moving the first number of vSwitch interfaces into the corresponding first number of namespaces respectively; Create a bridge under each of the namespaces. Binding the vSwitch interface under each namespace to the network bridge; The DPDK includes a hotplug module, and the monitoring kernel network card events include: Control the hotplug module to create a monitoring process; According to the monitoring process of the hotplug module, kernel network card events are monitored.

2. The method for adding a network card according to claim 1, characterized in that: The DPDK includes a hotplug module, and when the kernel network card event is a newly added network card event, the newly added network card is bound to the network bridges in the corresponding order according to the order in which the kernel newly added network cards are added, including: Controlling the hotplug module to register a callback function; In the case where the kernel network card event is a newly added network card event, using the callback function to modify the physical address of the newly added network card according to a preset rule, and saving the original physical address of the newly added network card; Using the callback function, the newly added network cards are moved into the namespaces of the corresponding order according to the order in which the newly added network cards are added by the kernel; The newly added network card is bound to the network bridge under the corresponding namespace, and the physical address of the DPDK preset interface bound to the vSwitch interface under the namespace is modified to the original physical address of the newly added network card.

3. The method for adding a network card according to claim 1, characterized in that: Also includes: Through the newly added network card, the DPDK is controlled to receive the first message or send the second message.

4. The method for adding a network card according to claim 3, characterized in that: The controlling the DPDK to receive the first message or send the second message through the newly added network card includes: receiving a first message through the newly added network card, and sending the first message to the network bridge bound to the newly added network card; Sending the first message to the vSwitch interface bound to the newly added network card through the network bridge; Sending the first message to the DPDK preset interface bound to the vSwitch interface through the vSwitch interface; The first message is transmitted to the DPDK through the DPDK preset interface, so that the DPDK receives and processes the first message.

5. The method for adding a network card according to claim 4, characterized in that: The controlling the DPDK to receive the first message or send the second message through the newly added network card includes: Processing the second message through the DPDK, and sending the second message to the corresponding DPDK preset interface; Sending the second message to the vSwitch interface bound to the DPDK preset interface through the DPDK preset interface; Sending the second message to the bridge bound to the vSwitch interface through the vSwitch interface; Sending the second message to the newly added network card bound to the bridge through the bridge; The second message is sent through the newly added network card.

6. A network card adding device, characterized in that: Applied to a virtualized platform computing device including a data plane development kit DPDK, the device includes: A creation module is used to create a data plane development kit DPDK preset interface, a virtual switch vSwitch interface, and a bridge bound to the vSwitch interface; A first binding module, used to bind the DPDK preset interface to the vSwitch interface one by one; Monitoring module, used to monitor kernel network card events; A second binding module is used for binding the newly added network card with the network bridges in a corresponding order according to the order of the newly added network cards in the kernel when the kernel network card event is a newly added network card event; The step of creating a DPDK preset interface, a vSwitch interface, and a bridge bound to the vSwitch interface includes: Creating a first number of DPDK preset interfaces; Creating a first number of vSwitch interfaces according to the first number of DPDK preset interfaces; Sequentially create a first number of namespaces corresponding one-to-one to the first number of vSwitch interfaces; Moving the first number of vSwitch interfaces into the corresponding first number of namespaces respectively; Create a bridge under each of the namespaces. Binding the vSwitch interface under each namespace to the network bridge; The DPDK includes a hotplug module, and the monitoring kernel network card events include: Control the hotplug module to create a monitoring process; According to the monitoring process of the hotplug module, kernel network card events are monitored.

7. A computing device, characterized in that The method comprises a processor and a memory, wherein the memory stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the network card adding method according to any one of claims 1 to 5 are implemented.

8. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the network card adding method according to any one of claims 1 to 5 are implemented.