Hardware uninstallation method, electronic device and medium for multi-virtual function device

By adding an extended header and parsing mechanism to the hardware offload solution, combined with the polling mechanism of the virtual switch, the problem of low packet forwarding efficiency after hardware offloading in the existing technology is solved, and efficient packet forwarding and resource savings are achieved.

CN119342016BActive Publication Date: 2025-03-11ZHUHAI XINGYUN ZHILIAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411864162.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-03-11
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

In the prior art, the hardware offloading scheme requires polling all device queues representing the port device, resulting in a large amount of hardware scheduling losses and software performance losses, and it is difficult to improve the packet forwarding efficiency after hardware offloading.

Method used

By determining the multiple virtual function devices associated with the first physical function device, sending hardware flow tables to the message sending and receiving hardware, adding an extension header to indicate the message source, using user-state software to parse the extension header and replace the device identity, polling the queue of the physical function device through a virtual switch to realize traffic redirection.

Benefits of technology

It realizes timely response to the sending and receiving requests of virtual function devices, saves the number of polling mode driver threads, hardware scheduling resources and software processor resources, and adapts to any number of virtual function devices and representative port devices, improving the packet forwarding efficiency after hardware offloading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119342016B_ABST
    Figure CN119342016B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer technology and provides a method for hardware unloading of multiple virtual function devices, an electronic device and a medium. Through software and hardware collaboration and the message extension header also having a device identifier, it not only realizes timely response to the message receiving and sending requests of each virtual function device, but also saves the number of polling mode driving threads, hardware scheduling resources, and software processor resources, and can flexibly adapt to any number of virtual function devices and any number of representative port devices, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a hardware uninstallation method, electronic device and medium for a multi-virtual function device. Background Art

[0002] In the technical fields of cloud computing, data centers, artificial intelligence, etc., network virtualization technologies, such as software defined networks (SDN), are used to provide traffic forwarding between multiple virtual machines and between virtual machines and external devices. Users send forwarding rules through the management platform and then the software implements traffic forwarding by matching the rules. The representative port device corresponding to the virtual function device is mounted on the bridge of the virtual switch (Openvswitch, OVS), and the traffic forwarding between the representative port devices is realized by forwarding traffic between the representative port devices. In the hardware unloading solution in the prior art, each representative port device is an independent hardware, and in order to ensure that the message receiving and sending requests of each virtual function device are responded to in a timely manner, the software needs to poll the respective device queues of all representative port devices, which occupies a large number of polling mode driver (PollMode Driver, PMD) threads, resulting in a large amount of hardware scheduling loss and software performance loss, and as the number of virtual function devices increases, it is not conducive to improving the message forwarding efficiency after hardware unloading.

[0003] To this end, the present application provides a hardware unloading method, electronic device and medium for multiple virtual function devices, which not only realizes timely response to the message receiving and sending requests of each virtual function device, but also saves the number of polling mode driving threads, saves hardware scheduling resources, and saves software processor resources. It can flexibly adapt to any number of virtual function devices and any number of representative port devices, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading. Summary of the invention

[0004] In a first aspect, the present application provides a hardware unloading method for multiple virtual function devices. The hardware unloading method comprises: determining multiple virtual function devices associated with a first physical function device, wherein the first physical function device and the multiple virtual function devices are each assigned a different device identifier; when the first physical function device turns on the hardware unloading function and the first physical function device enables at least one virtual function device among the multiple virtual function devices, sending the hardware flow table of the first physical function device to the message transceiver hardware; through the message transceiver hardware, in response to receiving a first message, adding a first extension header to the first message and then sending it to the packet receiving queue of the first physical function device, wherein the first extension header indicates that the first message comes from the first virtual function device among the multiple virtual function devices, then, through user-mode software, driving the first physical function device to parse the first extension header to determine the first virtual function device, and replacing the device identifier of the first physical function device with the representative port device corresponding to the first virtual function device, and then, through a virtual switch, polling the packet receiving queue of the first physical function device, thereby updating the device information based on the device identifier of the first physical function device to achieve traffic redirection of the message receiving process.

[0005] Through the first aspect of the present application, not only is it possible to respond to the message receiving and sending requests of each virtual function device in a timely manner, but it also saves the number of polling mode driving threads, saves hardware scheduling resources, and saves software processor resources. It can flexibly adapt to any number of virtual function devices and any number of representative port devices, and can be conveniently applied to various user-mode software and virtualization services, which is beneficial to improving the message forwarding efficiency after hardware unloading.

[0006] In a possible implementation of the first aspect of the present application, the packet receiving queue of the first physical function device is polled through the virtual switch, so as to update the device information based on the device identifier of the first physical function device to realize traffic redirection of the message receiving process, including: through the virtual switch, based on the device identifier of the first physical function device, replacing the input port with the representative port device corresponding to the first virtual function device, and then matching the flow table based on the input port.

[0007] In a possible implementation manner of the first aspect of the present application, the hardware unloading method further includes: after replacing the device identifier of the first physical function device with the representative port device corresponding to the first virtual function device, deleting the first extension header.

[0008] In a possible implementation of the first aspect of the present application, the hardware unloading method also includes: polling the packet sending queue of the first physical function device through the virtual switch, determining the representative port device corresponding to the second message and the device identifier stored in the representative port device corresponding to the second message, and then calling the packet sending function of the representative port device corresponding to the second message, so that the user-state software implements traffic redirection of the message sending process based on the device identifier stored in the representative port device corresponding to the second message.

[0009] In a possible implementation of the first aspect of the present application, the user-state software implements traffic redirection of the message sending process based on the device identifier stored in the representative port device corresponding to the second message, including: through the user-state software, based on the device identifier stored in the representative port device corresponding to the second message, adding a second extended header to the second message and then sending it to the packet sending queue of the first physical function device, wherein the second extended header indicates that the second message is forwarded to the second virtual function device among the multiple virtual function devices, and then, through the message sending and receiving hardware, parsing the second extended header to determine the second virtual function device, thereby forwarding the second message to the second virtual function device.

[0010] In a possible implementation manner of the first aspect of the present application, the multiple virtual function devices associated with the first physical function device share a packet receiving queue of the first physical function device and a packet sending queue of the first physical function device.

[0011] In a possible implementation manner of the first aspect of the present application, the packet receiving queue of the first physical function device and the packet sending queue of the first physical function device both belong to the device queue of the first physical function device.

[0012] In a possible implementation manner of the first aspect of the present application, the multiple virtual function devices include two or more virtual function devices.

[0013] In a possible implementation manner of the first aspect of the present application, the user-mode software is a data plane development tool set.

[0014] In a possible implementation manner of the first aspect of the present application, the virtual switch polls the packet receiving queue of the first physical function device through a single polling mode driving thread.

[0015] In a possible implementation of the first aspect of the present application, the hardware unloading method further includes: when the total delay caused by the virtual switch polling the multiple virtual function devices one by one through the single polling mode driving thread does not exceed a first threshold, adding another polling mode driving thread independent of the single polling mode driving thread to be used for sending and receiving messages of the multiple virtual function devices.

[0016] 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.

[0017] 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.

[0018] 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

[0019] 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.

[0020] Figure 1 A flowchart of a hardware uninstallation method for a multi-virtual function device provided in an embodiment of the present application;

[0021] Figure 2 A schematic diagram showing a correspondence between a representative port device and a virtual function device provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of a multi-virtual function device after hardware unloading provided by an embodiment of the present application;

[0023] Figure 4 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0025] 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.

[0026] Figure 1 A flowchart of a method for hardware uninstallation of a multi-virtual function device provided in an embodiment of the present application. Figure 1 As shown, the hardware uninstallation method includes the following steps.

[0027] Step S101: determining a plurality of virtual function devices associated with a first physical function device, wherein the first physical function device and the plurality of virtual function devices are respectively assigned different device identifiers.

[0028] Step S103: When the first physical function device turns on the hardware offloading function and the first physical function device enables at least one virtual function device among the multiple virtual function devices, the hardware flow table of the first physical function device is sent to the message transceiver hardware.

[0029] Step S105: In response to receiving a first message, a first extension header is added to the first message through the message receiving and sending hardware, and then the message is sent to the packet receiving queue of the first physical function device, wherein the first extension header indicates that the first message comes from the first virtual function device among the multiple virtual function devices. Then, through the user-state software, the first physical function device is driven to parse the first extension header to determine the first virtual function device, and the device identifier of the first physical function device is replaced with the representative port device corresponding to the first virtual function device. Then, through the virtual switch, the packet receiving queue of the first physical function device is polled, thereby updating the device information based on the device identifier of the first physical function device to realize traffic redirection of the message receiving process.

[0030] Figure 1The hardware unloading method of multiple virtual function devices shown can be applied to technical fields such as cloud computing, data centers, and artificial intelligence. In these technical fields, network virtualization technology, such as software defined network (SDN), is used to provide traffic forwarding between multiple virtual machines and between virtual machines and external devices. Users send forwarding rules through the management platform and then the software implements traffic forwarding by matching the rules. The representative port device corresponding to the virtual function device is mounted on the bridge of the virtual switch (Openvswitch, OVS), and the traffic forwarding between the representative port devices is realized by traffic forwarding between the representative port devices. With the increase of network devices, as well as the increase in the number of virtual function devices and the increase in the number of representative port devices, it is necessary to provide timely responses for traffic forwarding and message sending and receiving requests between these virtual function devices. However, the timing of these devices initiating requests and the hardware receiving messages is difficult to predict in advance, so a mechanism is needed to detect requests in a timely manner and respond in a timely manner. The computer processor thread is used to check whether each device has pending requests or pending messages on the hardware. For example, the polling mode driver (PMD) thread is used to poll the message receiving and sending queue. This requires the use of valuable thread resources. If multiple threads are used for polling, it may cause the use of hardware scheduling resources and software processor resources. For this reason, Figure 1 The hardware unloading method for multiple virtual function devices shown not only realizes timely response to the message receiving and sending requests of each virtual function device, but also saves the number of polling mode driver threads, hardware scheduling resources, and software processor resources, and can flexibly adapt to any number of virtual function devices and any number of representative port devices, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading. The following is further described in detail.

[0031] refer to Figure 1 In step S101, a plurality of virtual function devices associated with a first physical function device are determined, wherein the first physical function device and the plurality of virtual function devices are each assigned a different device identifier. In step S103, when the first physical function device turns on the hardware offloading function and the first physical function device enables at least one of the plurality of virtual function devices, the hardware flow table of the first physical function device is sent to the message transceiver hardware. Here, if the first physical function device turns on the hardware offloading function, and the first physical function device turns on the associated virtual function device, then the default flow table, i.e., the hardware flow table of the first physical function device, is sent, so that it can be judged later based on the sent hardware flow table whether there is a virtual function device associated with the first physical function device that hits the sent hardware flow table.

[0032] Continue to refer Figure 1 In step S105, in response to receiving the first message, the first extension header is added to the first message by the message receiving and sending hardware, and then the message is sent to the packet receiving queue of the first physical function device, wherein the first extension header indicates that the first message comes from the first virtual function device among the multiple virtual function devices. Then, the first physical function device is driven by the user state software to parse the first extension header to determine the first virtual function device, and the device identifier of the first physical function device is replaced with the representative port device corresponding to the first virtual function device. Then, the packet receiving queue of the first physical function device is polled by the virtual switch, so as to update the device information based on the device identifier of the first physical function device to realize the traffic redirection of the message receiving process. In this way, in the case of the message receiving and sending requests and traffic forwarding of multiple virtual function devices mentioned above, in order to avoid occupying multiple polling mode driving threads to poll multiple devices, and at the same time to ensure that the message receiving and sending requests are responded to in a timely manner, here, the traffic of each of the multiple virtual function devices is uniformly forwarded to the first physical function device, and the traffic redirection of the message receiving process is realized by polling the packet receiving queue of the first physical function device and building a mapping relationship using the device identifier. Traffic forwarding between multiple virtual function devices is achieved by traffic forwarding between representative port devices mounted on the virtual switch. Considering that each representative port device is generally processed as hardware independent of each other, and each representative port device has an independent hardware queue under hardware unloading, using multiple representative port devices as a polling port will cause thread resource occupation and software performance loss. To this end, through the virtual switch, only one polling port is polled, that is, the packet receiving queue of the first physical function device is polled, and by replacing the device identifier of the first physical function device with the representative port device corresponding to the first virtual function device, when polling the packet receiving queue of the first physical function device, the device information can be updated based on the device identifier of the first physical function device to realize traffic redirection of the message receiving process. In this way, the representative port device can have no actual physical queue, and the software does not need to poll the representative port device to realize the message receiving process, thereby saving hardware resources and relieving software pressure.

[0033] Continue to refer Figure 1No matter how many representative port devices there are, the occupied hardware resources can remain unchanged, so it helps to save hardware resources, and no matter how many representative port devices there are, the software only needs to poll one physical function device instead of all representative port devices, which helps to save software resources. Through the coordination of software and hardware and the improvement of the message receiving process, the message receiving requests of any number of representative port devices and any number of virtual function devices can be met. After receiving the first message, the corresponding representative port device is found in the mapping table according to the device identifier, that is, after determining that the first message comes from the first virtual function device among the multiple virtual function devices, the representative port device corresponding to the first virtual function device is determined. This means that by adding the first extension header and parsing the first extension header, the hardware unloading of the message receiving process and the traffic redirection of the message receiving process can be realized, so that timely response can be achieved by polling the packet receiving queue of the first physical function device, which greatly reduces the number of threads polled by the software and saves software processor resources. The improved message receiving process generally requires the user to configure the flow table in the hardware first. If a physical function device turns on the offloading function and the physical function device turns on the virtual function device, a default flow table is issued, that is, if the virtual function device corresponding to the physical function device does not hit any hardware flow table, then the traffic is sent to the packet receiving queue of the physical function device; when the hardware sends the traffic, it needs to add an extended header to the original message, which header will identify which virtual function device the message comes from; the user-mode software drives the physical function device to receive the message, parses the message extended header, and knows which virtual function device the message comes from, then the driver replaces the device identifier of the physical function device with the corresponding representative port device, and clears the extended header of the message added by the hardware; after the virtual switch receives the message through the polling mode driver, it updates the device information according to the device identifier, that is, replaces the inbound port with the corresponding representative port device; when the virtual switch matches the flow table later, the inbound port is the representative port device. In this way, all virtual function devices share the device queue of the corresponding physical function device, complete the traffic redirection of the virtual function device through the hardware flow table, and complete the actual traffic forwarding through the extended header parsing. In addition, the virtual switch on the software side and the user-mode software driver maintain the mapping relationship between the representative port device and the virtual function device through the device identifier. In this way, the flow tables of all virtual function devices are sent to a physical function device. After the driver physical function device receives it, it updates the device identifier, and then the virtual switch updates the corresponding representative port device according to the device identifier.

[0034] In conclusion, Figure 1The hardware unloading method for multiple virtual function devices shown saves hardware resource overhead through software adaptation. In large-scale scenarios, such as hundreds of representative port devices, hardware queue resources and hardware cost overhead are saved through software collaboration. Through the collaboration between software and hardware, for example, a default flow table is issued to the virtual function device corresponding to the physical function device, so that the traffic of the virtual function device that does not hit the flow table is redirected to the device queue of the corresponding physical function device, and further processed by the physical function device. Then the software and hardware can complete the forwarding through the message extension header information, that is, the forwarding and other processing information is carried by the message extension header. The collaboration between software and hardware stores the information related to the representative port device and assigns the device identifier through the virtual switch, so that the correspondence between the representative port device and the driver device can be quickly found through the mapping relationship. No matter which corresponding device the traffic is sent or received from, it can be determined to which device the traffic actually belongs, thereby completing the flow table forwarding. In this way, not only can timely response to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driving threads, hardware scheduling resources, and software processor resources are saved. It can flexibly adapt to any number of virtual function devices and any number of representative port devices, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0035] Figure 2 A schematic diagram of a correspondence between a representative port device and a virtual function device provided in an embodiment of the present application. Figure 2 As shown, virtual machine A201 includes virtual function device A203, and virtual function device A203 corresponds to representative port device A251 of virtual switch A250. Virtual machine B211 includes virtual function device B213, and virtual function device B213 corresponds to representative port device B252 of virtual switch A250. Here, representative port devices, such as Figure 2 The representative port device A251 and the representative port device B252 of the virtual switch A250 shown in the figure are mounted on the bridge of the virtual switch A250, and the forwarding between the representative port devices is realized by forwarding between the virtual function devices, thereby realizing hardware offloading. Among them, the virtual function device can be deployed on a virtual machine for user use, for example Figure 2 The virtual function device A203 is deployed on the virtual machine A201, and the representative port device A251 corresponding to the virtual function device A203 is mounted on the virtual switch A250 to perform flow control, thereby realizing forwarding and unloading. It can be seen that one representative port device corresponds to one virtual function device, such as Figure 2 As shown, the virtual function device A203 corresponds to the representative port device A251 of the virtual switch A250, and the virtual function device B213 corresponds to the representative port device B252 of the virtual switch A250.

[0036] Figure 3 A schematic diagram of a multi-virtual function device after hardware unloading provided by an embodiment of the present application. Figure 3 As shown, the virtual switch B301 includes a polling mode driver 303. The user-state software 311 includes a first physical function device 313 and a device queue 315 of the first physical function device 313. The message sending and receiving hardware 321 includes a virtual function device C323, a virtual function device D325, a virtual function device E327, and a virtual function device F329. Here, the user-state software, such as the Data Plane Development Kit (DPDK), wherein the user-state driver can abstract each virtual function device into a representative port device, and the software can map the operations performed on the representative port device to the corresponding virtual function device. Therefore, if each representative port device is assigned its own independent hardware queue, then when the number of representative port devices increases, a large amount of hardware resources will be occupied, and a large number of polling mode driver threads may be required to poll, thereby consuming software processor resources. As shown in FIG. Figure 3 As shown, by sending all the traffic of each virtual function device to the queue of the corresponding physical function device, that is, sending all the traffic of virtual function device C323, virtual function device D325, virtual function device E327, and virtual function device F329 to the device queue 315 of the first physical function device 313, the polling mode driver 303 of the virtual switch B301 only needs to poll the device queue 315 of the first physical function device 313 to realize the traffic redirection of the message receiving process. In this way, the representative port device can have no actual physical queue, and the software does not need to poll the representative port device to realize the message receiving process, thereby saving hardware resources and relieving software pressure.

[0037] refer to Figure 1 , Figure 2 , Figure 3In a possible implementation, the virtual switch polls the packet receiving queue of the first physical function device, thereby updating the device information based on the device identification of the first physical function device to realize the traffic redirection of the message receiving process, including: replacing the ingress port with the representative port device corresponding to the first virtual function device based on the device identification of the first physical function device through the virtual switch, and then matching the flow table based on the ingress port. In this way, through the collaboration of software and hardware, the mapping relationship is constructed by using the device identification, the traffic redirection of the virtual function device is completed through the hardware flow table, and the actual forwarding of the traffic is completed through the extended header analysis; the virtual switch on the software side and the user-mode software driver maintain the mapping relationship between the representative port device and the virtual function device through the device identification, so that the flow tables of all virtual function devices are sent to a physical function device, and the driver of the physical function device updates the device identification after receiving it, and then the virtual switch updates the corresponding representative port device according to the device identification. The representative port device may not have an actual physical queue, and the software does not need to poll the representative port device to realize the message receiving process, thereby saving hardware resources and relieving software pressure. In this way, not only can timely response to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driving threads, hardware scheduling resources, and software processor resources are saved. It can flexibly adapt to any number of virtual function devices and any number of representative port devices, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0038] In some embodiments, the hardware unloading method further includes: after replacing the device identifier of the first physical function device with the representative port device corresponding to the first virtual function device, deleting the first extension header. In this way, not only can timely respond to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driver threads, hardware scheduling resources, and software processor resources are saved, and any number of virtual function devices and any number of representative port devices can be flexibly adapted, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0039] In a possible implementation, the hardware unloading method further includes: polling the packet sending queue of the first physical function device through the virtual switch to determine the representative port device corresponding to the second message and the device identifier stored in the representative port device corresponding to the second message, and then calling the packet sending function of the representative port device corresponding to the second message, so that the user-mode software implements the traffic redirection of the message sending process based on the device identifier stored in the representative port device corresponding to the second message. In this way, a mapping relationship is constructed using device identifiers to implement hardware unloading of the message sending process and traffic redirection of the message sending process. Through the virtual switch, polling the packet sending queue of the first physical function device can achieve timely response, greatly reducing the number of threads for software polling and saving software processor resources. On the basis of the above-mentioned improvement of the message receiving process, through the collaboration of software and hardware and the improvement of the message sending process, the message sending requests of any number of representative port devices and any number of virtual function devices can be met. In the improved message sending process, first, the virtual switch knows the corresponding representative port device when sending the message through the polling mode driver, and the representative port device will store the corresponding device identifier; after calling the packet sending function of the representative port device, it will go to the driver of the user-state software. At this time, the driver of the user-state software fills in an extended header according to the device identifier, and the extended header will identify which device the message needs to be forwarded to; after the extended header is filled, the message is sent to the packet sending queue of the physical functional device; after the hardware receives the message, it will parse the extended header of the received message, know the destination virtual functional device of the message, and then forward it to the corresponding device. The collaboration between software and hardware uses the virtual switch to store information related to the representative port device and assign device identifiers, so that the corresponding relationship between the representative port device and the driver device can be quickly found through the mapping relationship. No matter which corresponding device the traffic is sent or received from, it can also determine which device the traffic actually belongs to, thereby completing the flow table forwarding. In this way, not only can timely response to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driving threads, hardware scheduling resources, and software processor resources are saved. It can flexibly adapt to any number of virtual function devices and any number of representative port devices, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0040] In some embodiments, the user-state software implements traffic redirection of the message sending process based on the device identifier stored in the representative port device corresponding to the second message, including: by the user-state software, based on the device identifier stored in the representative port device corresponding to the second message, adding a second extension header to the second message and then sending it to the packet sending queue of the first physical function device, wherein the second extension header indicates that the second message is forwarded to the second virtual function device among the multiple virtual function devices, and then, by the message transceiver hardware, parsing the second extension header to determine the second virtual function device, thereby forwarding the second message to the second virtual function device. In this way, not only can timely respond to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driving threads, hardware scheduling resources, and software processor resources are saved, and any number of virtual function devices and any number of representative port devices can be flexibly adapted, and various user-state software and virtualization services can be conveniently applied, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0041] In some embodiments, the multiple virtual function devices associated with the first physical function device share the packet receiving queue of the first physical function device and the packet sending queue of the first physical function device. In this way, not only can timely respond to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driving threads, hardware scheduling resources, and software processor resources are saved, and any number of virtual function devices and any number of representative port devices can be flexibly adapted, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0042] In some embodiments, the packet receiving queue of the first physical function device and the packet sending queue of the first physical function device both belong to the device queue of the first physical function device. In this way, not only can timely respond to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driver threads, hardware scheduling resources, and software processor resources are saved, and any number of virtual function devices and any number of representative port devices can be flexibly adapted, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0043] In a possible implementation, the multiple virtual function devices include two or more virtual function devices. In this way, not only can timely respond to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driver threads, hardware scheduling resources, and software processor resources are saved, and any number of virtual function devices and any number of representative port devices can be flexibly adapted, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0044] In a possible implementation, the user-mode software is a data plane development tool set. In this way, not only can timely respond to the message receiving and sending requests of each virtual function device be achieved, but also the number of polling mode driver threads, hardware scheduling resources, and software processor resources are saved, and any number of virtual function devices and any number of representative port devices can be flexibly adapted, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0045] In a possible implementation, the virtual switch polls the packet receiving queue of the first physical function device through a single polling mode driving thread. In this way, in the face of the message receiving and sending requests and traffic forwarding of multiple virtual function devices, in order to avoid occupying multiple polling mode driving threads to poll multiple devices, and at the same time to ensure that the message receiving and sending requests are responded to in a timely manner, here, the traffic of multiple virtual function devices is uniformly forwarded to the first physical function device, and by polling the packet receiving queue of the first physical function device and using the device identifier to build a mapping relationship, the traffic redirection of the message receiving process is realized. Not only can the message receiving and sending requests of each virtual function device be responded to in a timely manner, but also the number of polling mode driving threads, hardware scheduling resources, and software processor resources are saved. It can flexibly adapt to any number of virtual function devices and any number of representative port devices, and can be conveniently applied to various user-mode software and virtualization services, which is conducive to improving the message forwarding efficiency after hardware unloading.

[0046] In some embodiments, the hardware unloading method further includes: when the total delay caused by the virtual switch polling the multiple virtual function devices one by one through the single polling mode driving thread does not exceed the first threshold, adding another polling mode driving thread independent of the single polling mode driving thread for sending and receiving messages of the multiple virtual function devices. In this way, considering that some application scenarios have higher requirements for performance latency, the total delay caused by the virtual switch polling the multiple virtual function devices one by one through the single polling mode driving thread can be calculated, and the total delay can be compared with the first threshold. In this way, when the total delay does not exceed the first threshold, the message sending and receiving requests of multiple virtual function devices can be met by adding more polling mode driving threads. In this way, not only can the performance latency requirements be met, but also the polling mode driving thread resources can be saved as much as possible.

[0047] Figure 4 4 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.

[0048] It should be understood that Figure 4The 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.

[0049] 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.

[0050] 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.

[0051] 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.

[0052] 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.

[0053] 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.

[0054] 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.

[0055] 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.

[0056] 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 sequence, 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 method for hardware uninstallation of a multi-virtual function device, characterized in that: The hardware uninstallation method comprises: Determine a plurality of virtual function devices associated with a first physical function device, wherein the first physical function device and the plurality of virtual function devices are respectively assigned different device identifiers, and the representative port devices corresponding to the plurality of virtual function devices are respectively mounted on the bridge of the virtual switch, and traffic forwarding between the plurality of virtual function devices is achieved by traffic forwarding between the representative port devices corresponding to the plurality of virtual function devices, and the traffic of the plurality of virtual function devices is uniformly forwarded to the first physical function device; When the first physical function device turns on the hardware offloading function and the first physical function device enables at least one virtual function device among the multiple virtual function devices, sending the hardware flow table of the first physical function device to the message transceiver hardware; In response to receiving a first message, the message transceiver hardware adds a first extension header to the first message and then sends it to a packet receiving queue of the first physical function device, wherein the first extension header indicates that the first message comes from a first virtual function device among the multiple virtual function devices. Then, through user-mode software, the first physical function device is driven to parse the first extension header to determine the first virtual function device, and the device identifier of the first physical function device is replaced with a representative port device corresponding to the first virtual function device. Then, through the virtual switch, the packet receiving queue of the first physical function device is polled, thereby updating the device information based on the device identifier of the first physical function device to achieve traffic redirection of the message receiving process. Among them, through the virtual switch, the packet receiving queue of the first physical function device is polled, so as to update the device information based on the device identification of the first physical function device to realize the traffic redirection of the message receiving process, including: through the virtual switch, based on the device identification of the first physical function device, the input port is replaced with the representative port device corresponding to the first virtual function device, and then, the hardware flow table is matched based on the input port.

2. The hardware uninstallation method according to claim 1, characterized in that: The hardware uninstallation method further includes: After replacing the device identifier of the first physical function device with the representative port device corresponding to the first virtual function device, the first extended header is deleted.

3. The hardware uninstallation method according to claim 1, characterized in that: The hardware uninstallation method further includes: Through the virtual switch, the packet sending queue of the first physical functional device is polled to determine the representative port device corresponding to the second message and the device identifier stored in the representative port device corresponding to the second message, and then, the packet sending function of the representative port device corresponding to the second message is called, so that the user-state software can realize traffic redirection of the message sending process based on the device identifier stored in the representative port device corresponding to the second message.

4. The hardware uninstallation method according to claim 3, characterized in that: The user-mode software implements traffic redirection of a message sending process based on a device identifier stored in a representative port device corresponding to the second message, including: Through the user-state software, based on the device identifier stored in the representative port device corresponding to the second message, a second extended header is added to the second message and then sent to the packet sending queue of the first physical function device, wherein the second extended header indicates that the second message is forwarded to a second virtual function device among the multiple virtual function devices, and then, through the message sending and receiving hardware, the second extended header is parsed to determine the second virtual function device, thereby forwarding the second message to the second virtual function device.

5. The hardware uninstallation method according to claim 3, characterized in that: The multiple virtual function devices associated with the first physical function device share a packet receiving queue of the first physical function device and a packet sending queue of the first physical function device.

6. The hardware uninstallation method according to claim 3, characterized in that: The packet receiving queue of the first physical function device and the packet sending queue of the first physical function device both belong to the device queue of the first physical function device.

7. The hardware uninstallation method according to claim 1, characterized in that: The plurality of virtual function devices include two or more virtual function devices.

8. The hardware uninstallation method according to claim 1, characterized in that: The user-mode software is a data plane development tool set.

9. The hardware uninstallation method according to claim 1, characterized in that: The virtual switch drives a thread in a single polling mode to poll the packet receiving queue of the first physical function device.

10. The hardware uninstallation method according to claim 9, characterized in that: The hardware uninstallation method further includes: When the total delay caused by the virtual switch polling the multiple virtual function devices one by one through the single polling mode driving thread does not exceed a first threshold, another polling mode driving thread independent of the single polling mode driving thread is added for sending and receiving messages of the multiple virtual function devices.

11. An electronic device, characterized in that: The electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 10 when executing the computer program.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Data processing method, programmable network card equipment, physical server and storage medium

    CN113821310A

  • Method and device for traffic offload forwarding in multi-binding mode, and medium

    CN116055426A