VF splitting method and device for single-PF multi-physical-port network card, storage medium and terminal
By isolating and binding VF to multiple physical ports in sequence, the problem of VF traffic concentration in a single PF multi-physical port network card is solved, traffic sharing and load balancing are realized, configuration process is simplified, and network performance and stability are improved.
Patent Information
- Application Number
- CN202411176927.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2025-01-10
AI Technical Summary
The VF traffic of a single PF multi-physical port network card is reflected in one physical port, resulting in traffic congestion. The existing VF parameter configuration requires reloading the driver, which is cumbersome and inconvenient.
By obtaining the number of VFs of each physical port of the network card to be split, creating VF instructions, and isolating and binding VF to each physical port in sequence, realizing the traffic sharing of VF and avoiding reloading the driver to take effect.
Improve network performance, realize load balancing of VF traffic, expand bandwidth, simplify user operations, and improve environmental deployment efficiency.
Smart Images

Figure CN119299121A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network virtualization, and in particular to a VF splitting method and device, a storage medium and a terminal for a single-PF multi-physical port network card. Background Art
[0002] SR-IOV (Single Root I / O Virtualization) is a common network I / O virtualization model, which introduces two new types of functions, namely PF (Physical Function) and VF (Virtual Function). PF is a full-featured PCIE function. On the basis of the basic functional structure of SR-IOV, it can perform complete resource configuration, similar to other PCIE devices. VF, as a lightweight PCIE function, only supports the configuration of its own behavior, but can share physical resources with other VFs (associated with the same PF) and the PFs to which they are associated. The configuration space of VF can be accessed through the bus and device of PF, function number and other information. After multiple VFs are directly connected to multiple virtual machines, a single physical PCIE device can simultaneously support the communication needs of multiple virtual machines.
[0003] In order to achieve traffic load balancing and improve the throughput of the network card and the stability of the network, multiple network ports (multiple network ports can come from the same network card or from different network cards) are often bound to a bond port to form a logical network card. The current Linux kernel supports seven bond modes, including: balanced polling mode, active-standby mode, balanced mode, etc., to achieve load balancing of communication between virtual machines.
[0004] For a single-PF multi-physical-port network card, since VF is associated with PF and there is only one PF, the traffic of all VFs will only be reflected on one of the physical ports, which will cause the problem of insufficient bandwidth. At the same time, in the existing VF parameter configuration process, users need to write the configuration information into the configuration file of the driver module in the form of module parameters, and the driver needs to be reloaded each time the configuration takes effect. Especially when using the kernel's own driver, it is likely that the server needs to be restarted for the configuration to take effect. Therefore, this configuration method is relatively cumbersome and brings many inconveniences to users. Summary of the invention
[0005] The purpose of the present application is to provide a VF splitting method and device, storage medium and terminal for a single-PF multi-physical port network card, which is used to solve the problem that the traffic of all VFs in the existing single-PF multi-physical port network card is reflected on one of the physical ports, causing traffic congestion, and the existing VF parameter configuration needs to be reloaded after the driver is configured to take effect.
[0006] In a first aspect, the present application provides a VF splitting method for a single-PF multi-physical port network card, comprising:
[0007] Get the VF number information of each physical port of the network card to be split and the VF creation instruction;
[0008] The VF number information of each physical port is sent to the control register in sequence, so that after the network card firmware to be split reads and executes, the VF is isolated and bound to each physical port in sequence;
[0009] Create a preset number of VFs in sequence based on the Create VF instruction;
[0010] The network card to be split is a single-PF multi-physical port network card.
[0011] In one embodiment of the present application, the steps of obtaining the VF number information of each physical port of the network card to be split and creating a VF instruction and sending the VF number information of each physical port to the control register in sequence, so that after the network card firmware to be split reads and executes, the VF is isolated and bound to each physical port in sequence, and the steps also include:
[0012] Determine whether the sum of the VF number information of each physical port exceeds the upper limit of the VF number that can be allocated to the network card to be split. If so, it means that the verification has failed, and the VF number information of each physical port of the network card to be split and the VF creation instruction are re-obtained. Otherwise
[0013] Determine whether the sum of the VF number information of each physical port is equal to the preset number. If so, it indicates that the verification is successful, and the VF number information of each physical port of the network card to be split is stored in the array in sequence. Otherwise, it indicates that the verification fails, and the VF number information of each physical port of the network card to be split and the VF creation instruction are re-obtained.
[0014] In one embodiment of the present application, the VF number information of each physical port is sent to the control register in sequence, so that after the network card firmware to be split reads and executes, the steps of isolating and binding the VFs to each physical port in sequence include:
[0015] Acquire the VF number information of the Nth physical port from the array, send the VF number information of the Nth physical port to the VF public configuration register, and set the VF split function information update flag in the VF public configuration register;
[0016] The VF information update flag is set in the private control register of the Nth physical port, so that after the network card firmware to be split detects the VF information update flag in the private control register of the Nth physical port, the VF number information of the Nth physical port is read from the VF public configuration register based on the VF splitting function information update flag and executed, so as to realize the VF number information of the Nth physical port being isolated and bound to the Nth physical port in sequence;
[0017] Determine whether N is equal to the total number of physical ports in the network card to be split. If so, end the configuration information delivery process. Otherwise, add N+1 and re-obtain the VF number information of the Nth physical port from the array to isolate and bind the corresponding number of VFs to the Nth physical port.
[0018] Each VF is isolated and bound to only one physical port.
[0019] In one embodiment of the present application, the VF splitting method of a single-PF multi-physical port network card further includes:
[0020] When changing the VF parameter configuration information:
[0021] Traverse all physical ports of the network card to be split to obtain the VF number interval of the VF to which each physical port belongs;
[0022] Obtain the configuration command of the VF to be modified from any physical port of the network card to be split, compare the VF number of the VF to be modified with the VF number interval of each physical port to filter out the physical port bound to the VF to be modified, and use the physical port bound to the VF to be modified as the target physical port;
[0023] Based on the configuration command of the VF to be modified, the VF to be modified is configured through the private control register of the target physical port.
[0024] In one embodiment of the present application, when displaying the VF status, all VFs will appear under each physical port of the network card to be split, but each physical port will only update the status information of the VF bound to it.
[0025] In one embodiment of the present application, VFs to which at least two physical ports belong are bound to one bond port through a virtual machine.
[0026] In one embodiment of the present application, the firmware of the network card to be split sets the link state change of each physical port to be the same as that of the VF to which it is bound, and the behavior of the bound VF needs to be constructed based on the control word of the physical port.
[0027] In a second aspect, the present application provides a VF splitting device for a single-PF multi-physical port network card, including a configuration information acquisition module, an information delivery module, and a VF creation module;
[0028] The configuration information acquisition module is used to obtain the VF number information of each physical port of the network card to be split and create a VF instruction;
[0029] The information sending module is used to send the VF number information of each physical port to the control register in sequence, so that after the network card firmware to be split is read and executed, the VF is isolated and bound to each physical port in sequence;
[0030] The VF creation module is used to sequentially create a preset number of VFs based on a VF creation instruction;
[0031] The network card to be split is a single-PF multi-physical port network card.
[0032] In a third aspect, the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the VF splitting method for a single-PF multi-physical port network card.
[0033] In a fourth aspect, the present application provides a terminal, comprising: a processor and a memory, wherein the memory is communicatively connected to the processor;
[0034] The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the VF splitting method of the single-PF multi-physical port network card.
[0035] Compared with the prior art, one or more embodiments of the above scheme may have the following advantages or beneficial effects:
[0036] The VF splitting method of the single-PF multi-physical port network card provided by the embodiment of the present invention is applied. By isolating and binding the created multiple VFs to each physical port in sequence, the VFs can be split on different physical ports, ensuring that the traffic of the VF can be distributed to multiple physical ports to increase the actual bandwidth, thereby improving the network performance. The present invention proposes a solution for a single-PF multi-physical port network card that does not require reloading the driver and only requires regenerating the VF. The solution is simple to use for users and can freely and flexibly allocate VFs to different physical ports. At the same time, the solution uses a common interface in the kernel for users to issue configurations and does not require additional software installation. When applied to customer scenarios, it can greatly improve the efficiency of environmental deployment. The present invention allocates VFs to each physical port without reloading the driver, and the operation is simple. At the same time, combined with the bond characteristics, the traffic load balancing of the VF can be achieved, the bandwidth can be expanded, and the network stability can be improved.
[0037] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0039] Figure 1 A schematic diagram of the process of a VF splitting method for a single-PF multi-physical port network card according to an embodiment of the present invention is shown;
[0040] Figure 2 A schematic diagram showing the process of a VF splitting method for a single-PF multi-physical port network card according to an embodiment of the present invention is shown;
[0041] Figure 3 A schematic diagram showing the method of sending VF number information of each physical port to a public configuration register in sequence and updating a flag bit in a private control register of the corresponding physical port in the first embodiment of the present invention;
[0042] Figure 4 A schematic diagram of a process for changing VF parameter configuration information in Embodiment 1 of the present invention is shown;
[0043] Figure 5 A schematic diagram showing the structure of a VF splitting device for a single-PF multi-physical port network card according to a second embodiment of the present invention is shown;
[0044] Figure 6 A schematic diagram of the structure of a terminal according to a fourth embodiment of the present invention is shown. DETAILED DESCRIPTION
[0045] The following will describe the implementation methods of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.
[0046] With the rapid development of cloud computing, related business deployments rely on virtual machines or containers. Network virtualization technology plays an important role in improving network performance. Common network I / O virtualization models include: full virtualization, paravirtualization, pass-through, and SR-IOV (Single Root I / O Virtualization).
[0047] The performance of full virtualization and paravirtualization is relatively poor. The pass-through method allows the virtual machine to bypass the virtual machine monitor (Hypervisor) and directly assign PCIE devices to the virtual machine. The virtual machine can directly interact with the PCIE device, thus bringing a higher performance improvement. However, due to the limited number of physical devices, allocating a physical device to each virtual machine will bring a high cost of use. On the basis of inheriting the high performance advantage brought by the pass-through method, SR-IOV supports virtualizing a physical PCIE device into multiple lightweight virtual PCIE devices, and further assigning the virtualized PCIE devices to virtual machines, thereby solving the cost problem caused by the monopoly of a single physical device.
[0048] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0049] The following embodiments of the present application provide a VF splitting method and device, a storage medium and a terminal for a single-PF multi-physical port network card, which are used to solve the problem that the traffic of all VFs is reflected on one of the physical ports of the existing single-PF multi-physical port network card to be split, causing traffic congestion, and the existing VF parameter configuration needs to be reloaded after the driver to take effect.
[0050] like Figure 1-Figure 2 As shown, an embodiment of the present invention provides a VF splitting method for a single-PF multi-physical port network card. The VF splitting method for a single-PF multi-physical port network card in an embodiment of the present invention is mainly applicable to the implementation on the driver side of the network card to be split, so as to cooperate with the implementation on the firmware side of the network card to be split to realize the VF splitting of the single-PF multi-physical port network card. The VF splitting method for a single-PF multi-physical port network card in an embodiment of the present invention specifically includes the following steps.
[0051] Step S101, obtaining VF number information of each physical port of the network card to be split and a VF creation instruction.
[0052] Specifically, a single PF network card with multiple physical ports is set as the network card to be split for VF splitting. Then, on the driver side of the network card to be split, the VF number information of each physical port of the network card to be split is configured, and a VF creation instruction is generated at the same time. The VF creation instruction includes the total number of VFs to be created (i.e., the preset number).
[0053] Furthermore, before obtaining the configuration information, the driver side of the network card to be split can initiate relevant resource registration to the kernel based on the number of physical ports it has, so as to obtain the parent resource and the child resource (the number of VFs in the child resource is unknown at this time). After obtaining the VF number information of each physical port of the network card to be split and the VF creation instruction, the values stored in the parent resource and the child resource are updated. The process is specifically as follows: Since the devlink resource API provided by the kernel can perform resource management for users more intuitively, the present embodiment can adopt the devlink resource API to initiate registration with the kernel with the number of VFs allocated to each physical port as a resource. During the resource configuration process, the parent resource can be registered first, and then the child resources of each physical port can be applied for under the parent resource, wherein the parent resource is used to configure and manage the total number of VFs generated by the current network card, and the child resource is used to configure and manage the number of VFs of the corresponding physical port. And during the resource configuration process, it is required that the sum of the sizes of the child resources must be equal to the size of the parent resource.
[0054] It should be noted that the current network card firmware binds all VFs to physical port 0 by default during initialization. Therefore, when the VF number information of each physical port of the network card to be split is not all 0, the above registration process needs to be performed. If the user needs to disable this function, just set the size of the parent resource and all child resources to 0. When the driver receives the all-0 information, it will think that the VF splitting function has been disabled. At this time, the maximum value of VF will be configured to physical port 0, and the number of VFs allocated to other physical ports will be cleared to zero.
[0055] After obtaining the VF number information of each physical port of the network card to be split and the VF creation instruction, it is also necessary to determine the validity of the configuration information. The specific determination process is: first determine whether the sum of the VF number information of each physical port exceeds the upper limit of the number of VFs that can be allocated to the network card to be split. If so, it means that the verification has failed, and it is necessary to re-obtain the VF number information of each physical port of the network card to be split and the VF creation instruction. Otherwise, it is necessary to further determine whether the sum of the VF number information of each physical port is equal to the preset number. If so, it means that the verification is successful, and the VF number information of each physical port of the network card to be split is stored in the array in sequence. Otherwise, it means that the verification has failed, and the VF number information of each physical port of the network card to be split and the VF creation instruction are re-obtained until the VF number information of each physical port and the VF creation instruction with validity are configured.
[0056] Before determining the validity of the configuration information, it is also necessary to determine whether the network card to be split has the VF allocation function and whether the VF allocation function is enabled. If the above determination is successful, the VF number information can be sent in sequence. Otherwise, all VFs need to be directly allocated to the first physical block port, which means that the VF splitting function cannot be realized. When determining whether the network card to be split has the VF allocation function, it can be determined directly based on whether the relevant functions of the network card firmware are supported. When determining whether the VF allocation function is enabled, it is determined whether the sum of the VF number information of each physical port is 0. If so, it means that the VF allocation function of the network card to be split is not enabled, otherwise it means that the VF allocation function of the network card to be split is enabled.
[0057] Step S102, sending the VF number information of each physical port to the control register in order, so that after the network card firmware to be split reads and executes, the VFs are isolated and bound to each physical port in order;
[0058] Specifically, refer to Figure 3 As shown, this embodiment can sequentially send the VF number information of each physical port to the VF public configuration register, and set the VF information update flag in the corresponding physical port private control register, so that the VFs are isolated and bound to each physical port in sequence after the network card firmware to be split is executed.
[0059] Further sending the VF number information of each physical port in sequence includes: setting N as an integer, and setting the initial value of N to 0, obtaining the VF number information of the Nth physical port from the array in sequence, and sending the VF number information of the Nth physical port to the VF public configuration register, and setting the VF split function information update flag in the VF public configuration register; this operation is actually sending the VF number information configured this time as a public resource. Then, the VF information update flag is set in the private control register of the Nth physical port, so that after the firmware of the network card to be split detects the VF information update flag in the private control register of the Nth physical port, the specific function flag is updated and retrieved for the VF public register, and then the VF number information of the Nth physical port is read from the VF public configuration register based on the VF split function information update flag and executed, so as to realize the VF of the VF number information of the Nth physical port being isolated and bound to the Nth physical port in sequence. Then determine whether N is the total number of physical ports in the network card to be split, that is, determine whether the VF number information of each physical port has been sent down in sequence. If so, the configuration information sending process can be ended. Otherwise, N+1 is required, and the above-mentioned Nth physical port configuration information sending process is repeated until the configuration information is sent down.
[0060] The VF number information delivery method of this embodiment does not need to occupy additional space for storing the number of VFs in the private control register space of each physical port, saving resources, and also clearly conveying to the firmware: the VF split configuration delivery, the number of allocated VFs, and the allocated physical ports. The VF allocation information of each physical port is independent of each other, ensuring the flexibility of configuration.
[0061] It should be noted that in the above process of isolating and binding VFs to physical ports, the bound VFs are performed in sequence. For example, the number of VFs required for isolation and binding of physical port 0 is 3, and the number of VFs required for isolation and binding of physical port 1 is 2. Then the VFs isolated and bound to physical port 0 are VF0-VF2, and the VFs isolated and bound to physical port 0 are VF3-VF4. That is, VFs are isolated and bound to each physical port in sequence, and each VF is isolated and bound to only one physical port. It should also be noted that the total number of VFs configured for each physical port of the network card to be split must be equal to the number of VFs actually created.
[0062] In addition to completing the above isolation and binding process, the network card firmware to be split must also ensure that each VF adapts to the link status changes of the corresponding physical port, and constructs the behavior of the VF according to the control word of the corresponding physical port. At the same time, it also needs to make corresponding processing for unicast, multicast and broadcast situations.
[0063] Step 103: Create a preset number of VFs in sequence based on the create VF instruction.
[0064] After the firmware of the network card to be split is configured successfully, a preset number of VFs can be created in sequence on the host side based on the VF creation command configured by the user. Sequential means that the created VFs are named in sequence starting from VF0, that is, VF0, VF1, VF2, VF3, etc. are created.
[0065] It should be noted that the total number of VF number information of each physical port of the network card to be split must be equal to the actual number of VFs generated in this step, that is, the total number of VF number information of each physical port of the network card to be split is the preset number.
[0066] refer to Figure 4As shown, in the actual use of VF, other configurations may need to be changed, such as modifying the mac address of VF, link status mode, etc. However, due to the splitting action of VF, the storage and management of relevant information in the firmware have been isolated. Therefore, the driver side also needs to handle the isolation of the configuration of VF, that is, when changing the VF parameter configuration information, it is necessary to traverse all physical ports of the network card to be split to obtain the VF number interval of the VF to which each physical port belongs; for example, the isolated and bound VF of physical port 0 includes VF0 and VF1, then the VF number interval of the VF to which physical port 0 belongs is 0-1. Then obtain the configuration command of the VF to be modified from any physical port of the network card to be split, for example, modify the parameter configuration of VF0, and the VF number of the VF to be modified is 0. Then compare the VF number of the VF to be modified with the VF number interval of the VF to which each physical port belongs, so as to select the physical port to which the VF to be modified is bound, and use the physical port to which the VF to be modified is bound as the target physical port. For example, VF number 0 of the VF to be modified is within the VF number interval of the VF to which physical port 0 belongs, so physical port 0 needs to be used as the target physical port. Finally, the configuration command of the VF to be modified is configured based on the private control register of the target physical port.
[0067] Based on the above configuration, when the user implements VF configuration changes, he can issue VF configuration commands through any physical port of the network card, and then the driver will automatically adjust according to the subordination of VF and physical port, thereby realizing the modification of the corresponding VF.
[0068] In the process of displaying the VF status, all VFs will appear under each physical port of the network card to be split, but each physical port will update the status information of the VF bound to it. For example, all VFs will appear under each physical port, but the status information of the VF that does not belong to the physical port will always be displayed as a given value and will not change with the configuration.
[0069] After the split, the VF still belongs to one PF on the host side. However, it is isolated and bound to different physical ports during configuration delivery and traffic forwarding at the firmware level. VFs under different physical ports cannot communicate with each other. Therefore, after multiple VFs bound to different physical ports are directly connected to the virtual machine, and some or all VFs belonging to the physical ports are bound to one bond port in the virtual machine, load balancing of some or all VFs belonging to the physical ports can be achieved.
[0070] In order to explain the VF splitting method of the single-PF multi-physical port network card of the present invention in more detail, an actual example is used to illustrate it below.
[0071] In order to make the VF splitting method of the single PF multi-physical port network card of the present invention easier to understand, a specific embodiment of the VF splitting method of the single PF multi-physical port network card of the present invention is now given. The embodiment of the present invention can support a single PF eight-physical port network card at most. For the convenience of explanation, a single PF two-physical port network card is used as an example for explanation.
[0072] like Figure 2 As shown in the figure, the user configures the number of VFs for each physical port of the network card to be split and creates VF instructions through the devlink resource API. Figure 4 The parent resource named "vf_split" is used to configure and manage the total number of VFs generated by the current network card, and two child resources named "port0" and "port1" are applied for under "vf_split", which are used to configure and manage the number of VFs of physical port 0 and physical port 1 respectively.
[0073] When the information configured by the user is not all 0, the driver will be triggered to obtain the size of all parent / child resources from the devlink resource in turn, and determine the validity of the obtained information according to the requirements. If the information is valid, the number of VFs of each physical port will be stored in the array. At the same time, the driver will apply to the kernel for the same number of VFs as the parent resource size, and Figure 3 The method shown sends the VF number information of each physical port to the firmware in the order of the ports, and each port is configured once.
[0074] After the configuration is complete, multiple VFs are assigned to different physical ports, achieving isolation on both the control plane and the data plane. Figure 5 As shown, take the example of assigning two VFs to each of the two physical ports. On the control plane, when the user needs to change the configuration of VF0 through physical port 0, the configuration can be sent normally, and the VF information update flag in the private control register of physical port 0 is set. When the user wants to change the configuration of VF0 through physical port 1, the command can still take effect normally, but the driver needs to do additional processing, that is, calculate the physical port to which the current VF belongs, and send the configuration from the physical port to which it belongs. On the data plane, traffic between VFs under the same physical port is interoperable, but VFs on different physical ports cannot communicate.
[0075] When you use the command to view the status of all network ports, all VFs are still displayed under each physical port, but the MAC address of the VF that does not belong to this physical port will always be displayed as all f, and the rest of the configuration will remain in the default state.
[0076] The VF splitting method of the single-PF multi-physical port network card provided by the embodiment of the present invention is to separate and bind the created multiple VFs to each physical port in sequence, so as to split the VFs on different physical ports, ensure that the traffic of the VFs can be distributed to multiple physical ports to increase the actual bandwidth, and thus improve the network performance. The present invention proposes a solution for the single-PF multi-physical port network card that does not require reloading the driver and only requires regenerating the VF. The solution is simple to use for users and can freely and flexibly allocate VFs to different physical ports. At the same time, the solution uses a common interface in the kernel for users to issue configurations and does not require additional software installation. When applied to customer scenarios, it can greatly improve the efficiency of environmental deployment. The present invention allocates VFs to each physical port without reloading the driver, and is easy to operate. At the same time, combined with the bond characteristics, it can achieve traffic load balancing of VFs, expand bandwidth, and improve network stability.
[0077] like Figure 5 As shown, an embodiment of the present invention provides a VF splitting device for a single-PF multi-physical port network card, including a configuration information acquisition module, an information delivery module and a VF creation module;
[0078] The configuration information acquisition module is used to obtain the VF number information of each physical port of the network card to be split and to create a VF instruction.
[0079] The information sending module is used to send the VF number information of each physical port to the control register in sequence, so that after the network card firmware to be split is read and executed, the VF is isolated and bound to each physical port in sequence.
[0080] The VF creation module is used to sequentially create a preset number of VFs based on a VF creation instruction.
[0081] The network card to be split is a single-PF multi-physical port network card.
[0082] The VF splitting device of the single-PF multi-physical port network card provided by the embodiment of the present invention separates and binds the created multiple VFs to each physical port in sequence, so as to split the VFs on different physical ports, ensure that the traffic of the VFs can be distributed to multiple physical ports to increase the actual bandwidth, and thus improve the network performance. The present invention proposes a solution for the single-PF multi-physical port network card that does not require reloading the driver and only requires regenerating the VF. The solution is simple to use for users and can freely and flexibly allocate VFs to different physical ports. At the same time, the solution adopts a common interface in the kernel for users to issue configurations and use, without the need for additional software installation. When applied to customer scenarios, it can greatly improve the efficiency of environmental deployment. The present invention allocates VFs to each physical port without reloading the driver, and the operation is simple. At the same time, combined with the bond characteristics, the traffic load balancing of the VF can be achieved, the bandwidth can be expanded, and the network stability can be improved.
[0083] The present application embodiment also provides a computer-readable storage medium. A person of ordinary skill in the art can understand that all or part of the steps in the method for implementing the above embodiment can be completed by instructing the processor through a program, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state disk (SSD)), etc.
[0084] like Figure 6 As shown, an embodiment of the present application provides a terminal.
[0085] The terminal of this embodiment includes a processor and a memory connected to each other; the memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory, so that all or part of the steps can be implemented when the terminal executes them.
[0086] The specific steps of all or part of the steps and the beneficial effects obtained by applying the terminal provided by the embodiment of the present invention are the same as those in the first embodiment, and will not be described in detail here.
[0087] It should be noted that the memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage. Similarly, the processor may also be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0088] Although the embodiments disclosed in the present invention are as above, the contents described are only embodiments adopted for facilitating the understanding of the present invention and are not intended to limit the present invention. Any technician in the technical field to which the present invention belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present invention, but the protection scope of the present invention shall still be subject to the scope defined in the attached claims.
Claims
1. A VF splitting method for a single-PF multi-physical port network card, comprising: Get the VF number information of each physical port of the network card to be split and the VF creation instruction; The VF number information of each physical port is sent to the control register in sequence, so that after the network card firmware to be split reads and executes, the VF is isolated and bound to each physical port in sequence; Create a preset number of VFs in sequence based on the Create VF instruction; The network card to be split is a single-PF multi-physical port network card.
2. The splitting method according to claim 1, characterized in that: The steps of obtaining the VF number information of each physical port of the network card to be split and creating a VF instruction step and sending the VF number information of each physical port to the control register in sequence, so that after the network card firmware to be split reads and executes, the VF is isolated and bound to each physical port in sequence, and the steps also include: Determine whether the sum of the VF number information of each physical port exceeds the upper limit of the VF number that can be allocated to the network card to be split. If so, it means that the verification has failed, and the VF number information of each physical port of the network card to be split and the VF creation instruction are re-obtained. Otherwise Determine whether the sum of the VF number information of each physical port is equal to the preset number. If so, it indicates that the verification is successful, and the VF number information of each physical port of the network card to be split is stored in the array in sequence. Otherwise, it indicates that the verification fails, and the VF number information of each physical port of the network card to be split and the VF creation instruction are re-obtained.
3. The splitting method according to claim 2, characterized in that: The VF number information of each physical port is sent to the control register in order, so that after the network card firmware to be split reads and executes, the VF is isolated and bound to each physical port in order. The steps include: Acquire the VF number information of the Nth physical port from the array, send the VF number information of the Nth physical port to the VF public configuration register, and set the VF split function information update flag in the VF public configuration register; The VF information update flag is set in the private control register of the Nth physical port, so that after the network card firmware to be split detects the VF information update flag in the private control register of the Nth physical port, the VF number information of the Nth physical port is read from the VF public configuration register based on the VF splitting function information update flag and executed, so as to realize the VF number information of the Nth physical port being isolated and bound to the Nth physical port in sequence; Determine whether N is equal to the total number of physical ports in the network card to be split. If so, end the configuration information delivery process. Otherwise, add N+1 and re-obtain the VF number information of the Nth physical port from the array to isolate and bind the corresponding number of VFs to the Nth physical port. Each VF is isolated and bound to only one physical port.
4. The splitting method according to claim 1, characterized in that: Also includes: When changing the VF parameter configuration information: Traverse all physical ports of the network card to be split to obtain the VF number interval of the VF to which each physical port belongs; Obtain the configuration command of the VF to be modified from any physical port of the network card to be split, compare the VF number of the VF to be modified with the VF number interval of each physical port to filter out the physical port bound to the VF to be modified, and use the physical port bound to the VF to be modified as the target physical port; Based on the configuration command of the VF to be modified, the VF to be modified is configured through the private control register of the target physical port.
5. The splitting method according to claim 1, characterized in that: When displaying the VF status, all VFs will appear under each physical port of the network card to be split, but each physical port will only update the status information of the VF bound to it.
6. The splitting method according to claim 1, characterized in that: Use the virtual machine to bind the VFs of at least two physical ports to one bond port.
7. The splitting method according to claim 1, characterized in that: In the firmware of the network card to be split, the link state change of each physical port is set to be the same as that of the VF to which it is bound, and the behavior of the bound VF needs to be constructed based on the control word of the physical port.
8. A VF splitting device for a single-PF multi-physical port network card, characterized in that: Includes configuration information acquisition module, information delivery module and VF creation module; The configuration information acquisition module is used to obtain the VF number information of each physical port of the network card to be split and create a VF instruction; The information sending module is used to send the VF number information of each physical port to the control register in sequence, so that after the network card firmware to be split is read and executed, the VF is isolated and bound to each physical port in sequence; The VF creation module is used to sequentially create a preset number of VFs based on a VF creation instruction; The network card to be split is a single-PF multi-physical port network card.
9. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the VF splitting method of the single-PF multi-physical port network card according to any one of claims 1 to 7 is implemented.
10. A terminal, characterized in that: include: A processor and a memory, wherein the memory is communicatively connected to the processor; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the VF splitting method for a single-PF multi-physical port network card according to any one of claims 1 to 7.