Method, electronic device and medium for network card packet receiving and sending and flow table management

By determining the virtual function set of physical functions in the network card and selecting the representative port with the maximum queue depth as a shared physical function, the sending and receiving packet queues and flow tables are unifiedly managed, the problems of complex resource management and poor data forwarding performance in the existing technology are solved, and more efficient resource utilization and data forwarding performance are achieved.

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

Patent Information

Application Number
CN202510019360.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-03-25
Estimated Expiration
2045-01-07

AI Technical Summary

Technical Problem

In the prior art, network card sending and receiving packets and flow table management are limited by system processor process resources and storage resources, and there are problems such as multi-process competition and complex resource management, resulting in low packet efficiency and poor data forwarding performance under hardware offloading.

Method used

By determining the virtual function set of physical functions of the network card and selecting the representative port with the maximum queue depth as the representative port of shared physical functions, the package queue, packet queue and flow table are uniformly managed, multi-process competition and lock-up unlocking overhead, and resource utilization efficiency is improved.

Benefits of technology

It effectively reduces multi-process competition and lock-up unlocking overhead, improves the utilization efficiency of processor process resources and storage resources, simplifies the process and improves data forwarding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119420697B_ABST
    Figure CN119420697B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer technology and provides a method, electronic device and medium for network card packet reception and flow table management. In the face of the difficulties in packet reception and flow table management, the method selects a representative port with the maximum queue depth as the representative port corresponding to the common physical function of the first physical function virtual function set, then performs the packet reception operation of the first physical function virtual function set through the packet reception queue corresponding to the common physical function, performs the packet transmission operation of the first physical function virtual function set through the packet transmission queue corresponding to the common physical function, and uniformly generates and manages the first flow table set through the flow table corresponding to the common physical function, which not only effectively reduces the overhead of multi-process competition and locking and unlocking, but also improves the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance.
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 method, electronic device and medium for network card packet reception and transmission and flow table management. Background Art

[0002] In the application fields of cloud computing, artificial intelligence, big data, etc., with the increase of data traffic and the growth of data centers, high-performance data forwarding performance is required. The existing network card packet receiving and sending and flow table management are limited by the system processor process resources and storage resources, and there are problems such as multi-process competition and complex resource management, which is not conducive to improving the efficiency of packet receiving and sending and data forwarding performance under hardware offload.

[0003] To this end, the present application provides a method, electronic device and medium for network card packet receiving and sending and flow table management, which not only effectively reduces the overhead of multi-process competition and locking and unlocking, but also improves the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance. Summary of the invention

[0004] In a first aspect, the present application provides a method for managing packet reception and sending and flow tables of a network card. The method comprises: determining a first physical function-virtual function set of the network card, wherein the first physical function-virtual function set comprises at least one physical function and a virtual function associated with each of the at least one physical function, the first physical function-virtual function set is respectively associated with a first packet receiving queue set, a first packet sending queue set and a first flow table set, the first function is any physical function or any virtual function in the first physical function-virtual function set, the packet receiving queue corresponding to the first function in the first packet receiving queue set is used to perform the packet receiving operation of the first function, the packet sending queue corresponding to the first function in the first packet sending queue set is used to perform the packet sending operation of the first function, and the first packet receiving queue is used to perform the packet sending operation of the first function. A flow table corresponding to the first function in a flow table set is used for flow table management and flow table unloading of the first function; determining at least one representative port on the virtual switch associated with the network card that corresponds one-to-one to the at least one physical function, selecting a representative port with a maximum queue depth among the at least one representative port as the representative port corresponding to the common physical function of the first physical function virtual function set, and then, performing packet receiving operations of the first physical function virtual function set through the packet receiving queue corresponding to the common physical function, performing packet sending operations of the first physical function virtual function set through the packet sending queue corresponding to the common physical function, and, uniformly generating and managing the first flow table set through the flow table corresponding to the common physical function.

[0005] Through the first aspect of the present application, in the face of the difficulties in packet reception and sending and flow table management, the representative port with the largest queue depth is selected as the representative port corresponding to the common physical function of the first physical function virtual function set, and then, the packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the common physical function, the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the common physical function, and the first flow table set is uniformly generated and managed through the flow table corresponding to the common physical function, which not only effectively reduces the overhead of multi-process competition and locking and unlocking, but also improves the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance.

[0006] In a possible implementation of the first aspect of the present application, the number of queues of the packet receiving queue corresponding to the shared physical function is less than the number of queues of the first packet receiving queue set, and the number of queues of the packet sending queue corresponding to the shared physical function is less than the number of queues of the first packet sending queue set.

[0007] In a possible implementation of the first aspect of the present application, the kernel of the network card polls the packet receiving queue corresponding to the shared physical function to implement the packet receiving operation of the first physical function virtual function set, and the kernel polls the packet sending queue corresponding to the shared physical function to implement the packet sending operation of the first physical function virtual function set.

[0008] In a possible implementation of the first aspect of the present application, the number of processor processes used by the kernel to poll the packet receiving queue corresponding to the shared physical function is the queue number of the packet receiving queue corresponding to the shared physical function, and the number of processor processes used by the kernel to poll the packet sending queue corresponding to the shared physical function is the queue number of the packet sending queue corresponding to the shared physical function.

[0009] In a possible implementation manner of the first aspect of the present application, the first flow table set uniformly generated by the flow table corresponding to the common physical function is unloaded to the hardware of the network card through a unified flow table delivery channel.

[0010] In a possible implementation of the first aspect of the present application, the method further includes: respectively allocating independent processing cores to the at least one representative port, and then performing flow control through a mask field to specify the processing core assigned to the representative port corresponding to the common physical function to process the first flow table set.

[0011] In a possible implementation of the first aspect of the present application, a packet receiving operation of the first physical function virtual function set is performed through a packet receiving queue corresponding to the common physical function, and a packet sending operation of the first physical function virtual function set is performed through a packet sending queue corresponding to the common physical function, including: in response to the second virtual function in the first physical function virtual function set forwarding a first message to a third virtual function in the first physical function virtual function set, generating a first extension header including input port information and output port information, adding the first extension header to the first message to obtain an extended first message, and then generating a forwarding flow table for forwarding the first message by parsing the first extension header in the extended first message, wherein the input port information indicates the input port name and the input port queue identifier associated with the second virtual function, and the output port information indicates the output port name and the output port queue identifier associated with the third virtual function.

[0012] In a possible implementation of the first aspect of the present application, the ingress port name associated with the second virtual function is the second virtual function, and the ingress port queue identifier associated with the second virtual function is determined based on the queue number of the packet receiving queue corresponding to the shared physical function and the packet receiving queue corresponding to the second virtual function in the first packet receiving queue set.

[0013] In a possible implementation of the first aspect of the present application, the name of the egress port associated with the third virtual function is the third virtual function, and the egress port queue identifier associated with the third virtual function is determined based on the queue number of the packet receiving queue corresponding to the shared physical function and the packet receiving queue corresponding to the third virtual function in the first packet receiving queue set.

[0014] In a possible implementation of the first aspect of the present application, the first flow table set is uniformly generated and managed through the flow table corresponding to the common physical function, including: uniformly addressing the first flow table set, and configuring the flow table specification of the flow table corresponding to the common physical function to be the sum of the flow table specifications of all flow tables in the first flow table set.

[0015] In a possible implementation of the first aspect of the present application, the number of queues of the packet receiving queue corresponding to the shared physical function is 16, the number of queues of the first packet receiving queue set is 1088, the number of queues of the packet sending queue corresponding to the shared physical function is 16, and the number of queues of the first packet sending queue set is 1088.

[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 method for network card packet receiving and sending and flow table management provided in an embodiment of the present application;

[0021] Figure 2 A reference provided for the embodiments of this application Figure 1 A schematic diagram of a virtual switch for a method of network card packet reception and transmission and flow table management is shown;

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

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

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

[0025] Figure 1A flowchart of a method for network card packet receiving and sending and flow table management provided in an embodiment of the present application. Figure 1 As shown, the method includes the following steps.

[0026] Step S101: Determine the first physical function virtual function set of the network card, wherein the first physical function virtual function set includes at least one physical function and a virtual function associated with each physical function of the at least one physical function, the first physical function virtual function set is respectively associated with a first packet receiving queue set, a first packet sending queue set and a first flow table set, the first function is any physical function or any virtual function in the first physical function virtual function set, the packet receiving queue corresponding to the first function in the first packet receiving queue set is used to perform the packet receiving operation of the first function, the packet sending queue corresponding to the first function in the first packet sending queue set is used to perform the packet sending operation of the first function, and the flow table corresponding to the first function in the first flow table set is used for flow table management and flow table unloading of the first function.

[0027] Step S103: Determine at least one representative port on the virtual switch associated with the network card that corresponds one-to-one to the at least one physical function, select the representative port with the largest queue depth among the at least one representative port as the representative port corresponding to the common physical function of the first physical function virtual function set, then, perform packet receiving operations of the first physical function virtual function set through the packet receiving queue corresponding to the common physical function, perform packet sending operations of the first physical function virtual function set through the packet sending queue corresponding to the common physical function, and uniformly generate and manage the first flow table set through the flow table corresponding to the common physical function.

[0028] Figure 1The method for managing the packet transmission and reception and flow table of a network card shown can be applied to application fields such as cloud computing, artificial intelligence, and big data. In these application fields, with the increase of data traffic and the growth of data centers, high-performance data forwarding performance is required. The network card implements data forwarding through a virtual switch (Open vSwitch, OVS) and a kernel, and needs to consider the network transmission requirements of various different devices. For example, some devices use the single root input and output virtualization (Single Root I / O Virtualization, SRIOV) technology to divide a physical function into multiple virtual functions, such as dividing a physical hard disk into multiple virtual hard disks. For another example, some devices have their own packet transmission and reception and flow table management requirements. Therefore, if the packet transmission and reception of the network card is based on the physical function or virtual function of the device, and each unit has its own packet transmission and reception and flow table management, it may cause additional overhead of hardware resource competition. For example, assume that there are 4 physical functions, and each physical function has 16 pairs of queues for transmitting and receiving packets, that is, 16 packet receiving queues and 16 packet sending queues. Each physical function has 256 associated virtual functions, and each virtual function has a pair of queues for sending and receiving packets, that is, one packet receiving queue and one packet sending queue. Therefore, the four physical functions and all the associated virtual functions require a total of 1088 pairs of queues for sending and receiving packets. With the increase in device scale, the increase in device virtualization features, and user customization requirements, network cards need to consider the limitations of system processor process resources and storage resources in terms of packet sending and receiving and flow table management, such as multi-process competition and complex resource management. Moreover, if the kernel needs to poll 1088 pairs of queues to respond to packet sending and receiving needs in a timely manner, it will take up a large amount of processor process resources, and it will also need to solve the competition problem between a large number of processes through locking and unlocking. It is also necessary to consider the allocation of flow table specifications and the low utilization of flow tables, which is not conducive to improving the efficiency of packet sending and receiving and the data forwarding performance under hardware offloading. To this end, Figure 1 The method for network card packet receiving and sending and flow table management shown in the figure uses shared physical functions to not only effectively reduce the overhead of multi-process competition and locking and unlocking, but also improve the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance. The following is a detailed description.

[0029] refer to Figure 1In step S101, the first physical function virtual function set of the network card is determined. The first physical function virtual function set includes at least one physical function and a virtual function associated with each of the at least one physical function. The first physical function virtual function set is respectively associated with a first packet receiving queue set, a first packet sending queue set and a first flow table set. The first function is any physical function or any virtual function in the first physical function virtual function set. The packet receiving queue corresponding to the first function in the first packet receiving queue set is used to perform the packet receiving operation of the first function. The packet sending queue corresponding to the first function in the first packet sending queue set is used to perform the packet sending operation of the first function. The flow table corresponding to the first function in the first flow table set is used for flow table management and flow table unloading of the first function. Taking the above-mentioned 4 physical functions as an example, it is assumed that each physical function has 16 pairs of queues for receiving and sending packets, that is, 16 packet receiving queues and 16 packet sending queues. Each physical function has 256 associated virtual functions, and each virtual function has 1 pair of queues for receiving and sending packets, that is, 1 packet receiving queue and 1 packet sending queue. Then the four physical functions and all associated virtual functions require a total of 1088 pairs of queues for sending and receiving packets. Therefore, for the case of four physical functions and each physical function having 256 associated virtual functions, the associated packet receiving queue set of such a physical function virtual function set has 1088 packet receiving queues, the associated packet sending queue set has 1088 packet sending queues, and the associated flow table set is the entirety of the flow tables of these physical functions and virtual functions. Therefore, on the basis of determining the first physical function virtual function set of the network card, it is necessary to consider how to implement the packet receiving operation, packet sending operation and flow table management of the first physical function virtual function set through optimized design, and it is necessary to consider how to solve the problem of limited processor process resources that can be used for polling queues, which is explained in detail below.

[0030] refer to Figure 1In step S103, at least one representative port corresponding to the at least one physical function on the virtual switch associated with the network card is determined, and a representative port with the largest queue depth among the at least one representative port is selected as the representative port corresponding to the common physical function of the first physical function virtual function set, and then, the packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the common physical function, and the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the common physical function, and the first flow table set is uniformly generated and managed through the flow table corresponding to the common physical function. In this way, by selecting the representative port with the largest queue depth as the representative port corresponding to the common physical function of the first physical function virtual function set, and then, the packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the selected common physical function, and the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the common physical function, in this way, by using the queue index and the flow table specification index, a certain number of packet receiving and sending queue resources can be reused when sending and receiving messages, thereby meeting the needs of a combination of a larger number of physical functions and virtual functions. Here, for the scenario of multiple representative ports, selecting the representative port with the largest queue depth to achieve unified management of the packet sending and receiving queues and flow tables can improve resource utilization and help improve data forwarding performance. For example, assuming that the queue depths of the three representative ports are 3000, 1000 and 500 respectively, the representative port with a queue depth of 3000 is used as the representative port corresponding to the representative shared physical function, so that the flow tables generated by the selected representative port itself can be directly processed, while the flow tables generated by other representative ports are sent to the shared physical function for unified processing.

[0031] Continue to refer Figure 1, by uniformly managing all the issued flow tables and flow table issuing channels, a representative port on the virtual switch is used as the message receiving and sending port of the representative physical function, thereby meeting the needs of a large number of physical functions and virtual functions. For the virtual switch and the driver, it is only necessary to poll a certain number of packet receiving and sending queues under the representative port to realize the packet receiving operation, packet sending operation and flow table management of the first physical function virtual function set. Taking the above-mentioned 4 physical functions as an example, it is assumed that each physical function has 16 pairs of queues for receiving and sending packets, that is, 16 packet receiving queues and 16 packet sending queues. Each physical function has 256 associated virtual functions, and each virtual function has 1 pair of queues for receiving and sending packets, that is, 1 packet receiving queue and 1 packet sending queue. Then the 4 physical functions and all associated virtual functions need a total of 1088 pairs of queues for receiving and sending packets. By selecting one of the four physical functions as a shared physical function, only the 16 packet receiving queues and 16 packet sending queues of the shared physical function need to be polled, thus equivalently achieving the management of receiving and sending packets that originally required polling 1088 packet receiving queues and 1088 packet sending queues. Therefore, the number of queues that need to be polled for sending and receiving packets is reduced from 1088 pairs of receiving and sending queues to 16 pairs of receiving and sending queues, which greatly reduces the processor process resources used for polling. In addition, because a representative shared physical function is selected to uniformly process the packet receiving operation, packet sending operation, and flow table generation and management of the first physical function virtual function set, a unified channel can be used to effectively avoid multi-process competition and save the overhead of locking and unlocking, that is, it naturally has the advantage of being lock-free. In addition, the first flow table set is uniformly generated and managed through the flow table corresponding to the shared physical function, so that the memory space can be managed as a whole, instead of each physical function or virtual function managing a fixed allocated flow table. This can make full use of limited memory resources, avoid resource waste, and help improve flow table unloading efficiency and resource utilization.

[0032] In conclusion, Figure 1 The method for managing packet reception and sending and flow tables of a network card shown in the figure, in the face of the difficulties in packet reception and sending and flow table management, selects a representative port with the maximum queue depth as the representative port corresponding to the common physical function of the first physical function virtual function set, and then performs packet receiving operations of the first physical function virtual function set through the packet receiving queue corresponding to the common physical function, performs packet sending operations of the first physical function virtual function set through the packet sending queue corresponding to the common physical function, and uniformly generates and manages the first flow table set through the flow table corresponding to the common physical function, which not only effectively reduces the overhead of multi-process competition and locking and unlocking, but also improves the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance.

[0033] Figure 2 A reference provided for the embodiments of this application Figure 1 Schematic diagram of a virtual switch for a method of network card packet receiving and sending and flow table management. Figure 2 As shown, there are multiple representative ports on the virtual switch 201, namely, representative port A230, representative port B232 and representative port C234. Among them, representative port A230 is the selected representative port with the largest queue depth and the representative port corresponding to the common physical function of the first physical function virtual function set, that is, the representative port A230 corresponding to the physical function A210. Figure 2 It is also exemplified that physical function A210 is a representative physical function. After physical function A210 is determined as a common physical function of the first physical function virtual function set, virtual function A212 associated with physical function A210 and virtual functions associated with other physical functions, such as virtual function B222 associated with physical function B220, all send and receive packets of these virtual functions are uniformly performed through physical function A210. Therefore, the packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the common physical function, the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the common physical function, and the first flow table set is uniformly generated and managed through the flow table corresponding to the common physical function.

[0034] Figure 2 The virtual switch shown in the figure, facing the difficulties in packet reception and sending and flow table management, selects the representative port with the maximum queue depth as the representative port corresponding to the common physical function of the first physical function virtual function set, and then performs packet receiving operations of the first physical function virtual function set through the packet receiving queue corresponding to the common physical function, performs packet sending operations of the first physical function virtual function set through the packet sending queue corresponding to the common physical function, and uniformly generates and manages the first flow table set through the flow table corresponding to the common physical function, which not only effectively reduces the overhead of multi-process competition and locking and unlocking, but also improves the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance.

[0035] refer to Figure 1 and Figure 2In a possible implementation, the number of queues of the packet receiving queue corresponding to the shared physical function is less than the number of queues of the first packet receiving queue set, and the number of queues of the packet sending queue corresponding to the shared physical function is less than the number of queues of the first packet sending queue set. By uniformly managing all the issued flow tables and flow table issuing channels, a representative port on the virtual switch is used as the message receiving and sending port of the representative physical function, thereby meeting the needs of a combination of a large number of physical functions and virtual functions. For the virtual switch and the driver, it is only necessary to poll a certain number of packet receiving and sending queues under the representative port to implement the packet receiving operation, packet sending operation and flow table management of the first physical function virtual function set. Taking the above-mentioned 4 physical functions as an example, it is assumed that each physical function has 16 pairs of queues for receiving and sending packets, that is, 16 packet receiving queues and 16 packet sending queues. Each physical function has 256 associated virtual functions, and each virtual function has 1 pair of queues for receiving and sending packets, that is, 1 packet receiving queue and 1 packet sending queue. The four physical functions and all associated virtual functions require a total of 1088 pairs of queues for packet transmission and reception. By selecting one of the four physical functions as a shared physical function, only the 16 packet receiving queues and 16 packet sending queues of the shared physical function need to be polled, thus equivalently achieving the packet transmission and reception management that originally required polling of 1088 packet receiving queues and 1088 packet sending queues. Therefore, the number of queues that need to be polled for packet transmission and reception is reduced from 1088 pairs of packet transmission and reception queues to 16 pairs of packet transmission and reception queues, which greatly reduces the processor process resources used for polling. In this way, faced with the difficulties in packet reception and sending and flow table management, the representative port with the largest queue depth is selected as the representative port corresponding to the common physical function of the first physical function virtual function set, and then, the packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the common physical function, the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the common physical function, and the first flow table set is uniformly generated and managed through the flow table corresponding to the common physical function. This not only effectively reduces the overhead of multi-process competition and locking and unlocking, but also improves the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance.

[0036] In some embodiments, the kernel of the network card polls the packet receiving queue corresponding to the shared physical function to implement the packet receiving operation of the first physical function virtual function set, and the kernel polls the packet sending queue corresponding to the shared physical function to implement the packet sending operation of the first physical function virtual function set. In this way, in the face of the difficulties in packet sending and receiving and flow table management, the representative port with the largest queue depth is selected as the representative port corresponding to the shared physical function of the first physical function virtual function set, and then the packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the shared physical function, and the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the shared physical function, and the first flow table set is uniformly generated and managed through the flow table corresponding to the shared physical function, which not only effectively reduces the overhead of multi-process competition and locking and unlocking, but also improves the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance.

[0037] In some embodiments, the number of processor processes used by the kernel to poll the packet receiving queue corresponding to the shared physical function is the number of queues of the packet receiving queue corresponding to the shared physical function, and the number of processor processes used by the kernel to poll the packet sending queue corresponding to the shared physical function is the number of queues of the packet sending queue corresponding to the shared physical function. In this way, the processor process resources used for polling are greatly reduced. In the face of the difficulties in packet sending and receiving and flow table management, a representative port with the maximum queue depth is selected as the representative port corresponding to the shared physical function of the first physical function virtual function set, and then, the packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the shared physical function, and the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the shared physical function, and the first flow table set is uniformly generated and managed through the flow table corresponding to the shared physical function, which not only effectively reduces the overhead of multi-process competition and locking and unlocking, but also improves the utilization efficiency of processor process resources and storage resources, which is conducive to simplifying the process and improving data forwarding performance.

[0038] In a possible implementation, the first set of flow tables uniformly generated by the flow table corresponding to the shared physical function is unloaded to the hardware of the network card through a unified flow table delivery channel. In this way, the first set of flow tables is uniformly generated and managed by the flow table corresponding to the shared physical function, so that the memory space can be managed as a whole, rather than each physical function or virtual function managing a fixed allocated flow table, so that limited memory resources can be fully utilized, resource waste can be avoided, and the efficiency of flow table unloading and resource utilization can be improved.

[0039] In a possible implementation, the method further includes: assigning independent processing cores to the at least one representative port, and then, performing flow control through a mask field, thereby specifying the processing core assigned to the representative port corresponding to the common physical function to process the first set of flow tables. By isolating the processing core, queue competition can be reduced, and different representative ports can be divided on different processing cores, so that there is no competition for computing resources between different representative ports, but each runs on the divided processing core. In addition, within the representative port, flow control is performed through a mask field, and the configured masked field can be assigned to a fixed queue, for example, setting the source machine address, the destination machine address, the source network protocol address, the destination network protocol address, the source port, and the destination port with mask fields. In this way, by performing flow control through a mask field, it is possible to specify the processing core assigned to the representative port corresponding to the common physical function to process the first set of flow tables, that is, each queue within the representative port only processes the specified flow table, further reducing queue competition, and helping to improve the overall data transmission performance.

[0040] In a possible implementation, the packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the common physical function, and the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the common physical function, including: in response to the second virtual function in the first physical function virtual function set forwarding the first message to the third virtual function in the first physical function virtual function set, generating a first extension header including ingress port information and egress port information, adding the first extension header to the first message to obtain an extended first message, and then, by parsing the first extension header in the extended first message, generating a forwarding flow table for forwarding the first message, wherein the ingress port information indicates the ingress port name and ingress port queue identifier associated with the second virtual function, and the egress port information indicates the egress port name and egress port queue identifier associated with the third virtual function. By using the queue index and the flow table specification index, a certain number of packet receiving and sending queue resources can be reused when sending and receiving messages, thereby meeting the needs of a combination of a larger number of physical functions and virtual functions. Correspondingly, all the flow tables and flow table delivery channels that are sent down are also managed in a unified manner, so that a representative port on the switch is used as the message receiving and sending port of the representative physical function, thereby meeting the needs of a combination of a large number of physical functions and virtual functions. For the switch and the driver, it is only necessary to poll a certain number of receiving and sending packet queues under the representative port. Here, by adding an extension header to the message, the extension header carries the inport information (inport info) and the outport information (outport info). In this way, by parsing the extension header to obtain the inport information and the outport information, the corresponding flow table can be generated to guide forwarding, and then the above-mentioned receiving and sending packet operation process optimized based on the shared physical function can be combined, so that the virtual switch and the hardware only need to poll a certain number of receiving and sending packet queues to support the receiving and sending operations of the first physical function virtual function set that originally required more number of receiving and sending packet queues to achieve. Here, the inport queue identifier and the outport queue identifier can be the corresponding queue number, which is used to guide message forwarding. For example, it is assumed that a shared physical function (physical function, pf) network port performs a receiving and sending packet process, where pf1 is a shared physical function. pf1 creates a virtual function (VF) port pf1vf1 and a corresponding representative port pf1vf1_0, where the network address of pf1vf1 is 1.1.1.1. pf2 creates a VF port pf2vf1 and a corresponding representative port pf2vf1_0, where the network address of pf2vf1 is 1.1.1.2. The virtual switch adds the corresponding port.Then, for packet forwarding from pf1vf1 to pf2vf1, the corresponding inbound port queue identifier can be 16 queues of pf1 plus 1 queue of pf1vf1, so the number is 17; the corresponding outbound port queue identifier can be 16 queues of pf1 plus 512 queues of pf1's vf, plus 16 queues of pf2 and 1 queue of pf2vf1, so the number is 545. It can be seen that by obtaining the corresponding inbound port information and outbound port information through the extended header, the packet receiving and sending queues of the shared physical function are used to uniformly implement the packet receiving and sending operations of the first physical function virtual function set. In this way, the burden of kernel polling is reduced and the forwarding performance of the network card is improved.

[0041] In some embodiments, the ingress port name associated with the second virtual function is the second virtual function, and the ingress port queue identifier associated with the second virtual function is determined based on the number of queues of the packet receiving queue corresponding to the shared physical function and the packet receiving queue corresponding to the second virtual function in the first packet receiving queue set. In this way, the corresponding ingress port information and egress port information are obtained through the extended header, so that the packet receiving and sending queues of the shared physical function are used to uniformly implement the packet receiving and sending operations of the first physical function virtual function set. In this way, the burden of kernel polling is reduced and the forwarding performance of the network card is improved.

[0042] In some embodiments, the name of the egress port associated with the third virtual function is the third virtual function, and the egress port queue identifier associated with the third virtual function is determined based on the number of queues of the packet receiving queues corresponding to the shared physical function and the packet receiving queues corresponding to the third virtual function in the first packet receiving queue set. In this way, the corresponding ingress port information and egress port information are obtained through the extended header, and the packet receiving and sending queues of the shared physical function are used to uniformly implement the packet receiving and sending operations of the first physical function virtual function set. In this way, the burden of kernel polling is reduced and the forwarding performance of the network card is improved.

[0043] In a possible implementation, the first flow table set is uniformly generated and managed through the flow table corresponding to the common physical function, including: performing unified flow table addressing on the first flow table set, and configuring the flow table specification of the flow table corresponding to the common physical function to be the sum of the flow table specifications of all flow tables in the first flow table set. In this way, through unified flow table addressing, memory resources can be fully utilized to improve the utilization rate of memory resources, and it is also helpful to uniformly allocate flow table indexes and improve flow table unloading efficiency.

[0044] In a possible implementation, the number of queues of the packet receiving queue corresponding to the shared physical function is 16, and the number of queues of the first packet receiving queue set is 1088. The number of queues of the packet sending queue corresponding to the shared physical function is 16, and the number of queues of the first packet sending queue set is 1088. In this way, the corresponding inbound port information and outbound port information are obtained through the extended header, and the packet sending and receiving queues of the shared physical function are used to uniformly implement the packet sending and receiving operations of the first physical function virtual function set. In this way, the burden of kernel polling is reduced and the forwarding performance of the network card is improved.

[0045] Figure 3 3 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application, and the computing device 300 includes: one or more processors 310, a communication interface 320 and a memory 330. The processor 310, the communication interface 320 and the memory 330 are interconnected via a bus 340. Optionally, the computing device 300 may also include an input / output interface 350, and the input / output interface 350 is connected to an input / output device for receiving parameters set by a user, etc. The computing device 300 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 310 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 various operations performed by the computing device 300 can refer to the specific details in the above-mentioned embodiments, such as the processor 310 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 300 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 320 may be specifically used to perform the communication functions necessary to implement the functions of these apparatuses and components, and the processor 310 may be specifically used to perform the processing functions necessary to implement the functions of these apparatuses and components.

[0046] It should be understood that Figure 3 The computing device 300 may include one or more processors 310, and the multiple processors 310 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 310 may form a processor sequence or a processor array, or the multiple processors 310 may be divided into a main processor and an auxiliary processor, or the multiple processors 310 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 3 The computing device 300 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 300 may include Figure 3More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.

[0047] The processor 310 may have a variety of specific implementation forms. For example, the processor 310 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 310 may also be a single-core processor or a multi-core processor. The processor 310 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 310 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 320 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.

[0048] The memory 330 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 330 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 synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM). The memory 330 may also be used to store program codes and data, so that the processor 310 calls the program codes stored in the memory 330 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 3 Show more or fewer components, or have different component configurations.

[0049] The bus 340 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 340 may be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 340 may also include a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, Figure 3 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.

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

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

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

[0053] 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 A step that specifies a function in one or more boxes.

[0054] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. The steps in the method of the embodiment of the present application can be adjusted in order, merged or deleted according to actual needs; the modules in the system of the embodiment of the present application can be divided, merged or deleted according to actual needs. If these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. A method for network card packet receiving and sending and flow table management, characterized in that: The method comprises: Determine a first physical function virtual function set of the network card, wherein the first physical function virtual function set includes at least one physical function and a virtual function associated with each of the at least one physical function, the first physical function virtual function set is respectively associated with a first packet receiving queue set, a first packet sending queue set and a first flow table set, the first function is any physical function or any virtual function in the first physical function virtual function set, the packet receiving queue corresponding to the first function in the first packet receiving queue set is used to perform a packet receiving operation of the first function, the packet sending queue corresponding to the first function in the first packet sending queue set is used to perform a packet sending operation of the first function, and the flow table corresponding to the first function in the first flow table set is used for flow table management and flow table unloading of the first function; Determine at least one representative port on the virtual switch associated with the network card that corresponds one-to-one to the at least one physical function, select the representative port with the largest queue depth among the at least one representative port as the representative port corresponding to the common physical function of the first physical function virtual function set, then, perform packet receiving operations of the first physical function virtual function set through the packet receiving queue corresponding to the common physical function, perform packet sending operations of the first physical function virtual function set through the packet sending queue corresponding to the common physical function, and uniformly generate and manage the first flow table set through the flow table corresponding to the common physical function.

2. The method according to claim 1, characterized in that The number of packet receiving queues corresponding to the shared physical function is less than the number of queues in the first packet receiving queue set, and the number of packet sending queues corresponding to the shared physical function is less than the number of queues in the first packet sending queue set.

3. The method according to claim 2, characterized in that The kernel of the network card polls the packet receiving queue corresponding to the shared physical function to implement the packet receiving operation of the first physical function virtual function set, and the kernel polls the packet sending queue corresponding to the shared physical function to implement the packet sending operation of the first physical function virtual function set.

4. The method according to claim 3, characterized in that The number of processor processes used by the kernel to poll the packet receiving queue corresponding to the shared physical function is the queue number of the packet receiving queue corresponding to the shared physical function, and the number of processor processes used by the kernel to poll the packet sending queue corresponding to the shared physical function is the queue number of the packet sending queue corresponding to the shared physical function.

5. The method according to claim 1, characterized in that The first flow table set generated uniformly by the flow table corresponding to the common physical function is unloaded to the hardware of the network card through a unified flow table delivery channel.

6. The method according to claim 1, characterized in that The method further comprises: Independent processing cores are allocated to the at least one representative port, respectively, and then flow control is performed through a mask field, thereby specifying the processing core allocated to the representative port corresponding to the common physical function to process the first flow table set.

7. The method according to claim 1, characterized in that The packet receiving operation of the first physical function virtual function set is performed through the packet receiving queue corresponding to the common physical function, and the packet sending operation of the first physical function virtual function set is performed through the packet sending queue corresponding to the common physical function, including: in response to the second virtual function in the first physical function virtual function set forwarding the first message to the third virtual function in the first physical function virtual function set, generating a first extension header including input port information and output port information, adding the first extension header to the first message to obtain the extended first message, and then, generating a forwarding flow table for forwarding the first message by parsing the first extension header in the extended first message, wherein the input port information indicates the input port name and the input port queue identifier associated with the second virtual function, and the output port information indicates the output port name and the output port queue identifier associated with the third virtual function.

8. The method according to claim 7, characterized in that The ingress port name associated with the second virtual function is the second virtual function, and the ingress port queue identifier associated with the second virtual function is determined based on the queue quantity of the packet receiving queue corresponding to the shared physical function and the packet receiving queue corresponding to the second virtual function in the first packet receiving queue set.

9. The method according to claim 8, characterized in that The egress port name associated with the third virtual function is the third virtual function, and the egress port queue identifier associated with the third virtual function is determined based on the number of packet receiving queues corresponding to the shared physical function and the packet receiving queues corresponding to the third virtual function in the first packet receiving queue set.

10. The method according to claim 1, characterized in that The first flow table set is uniformly generated and managed through the flow table corresponding to the common physical function, including: uniformly addressing the first flow table set, and configuring the flow table specification of the flow table corresponding to the common physical function to be the sum of the flow table specifications of all flow tables in the first flow table set.

11. The method according to claim 1, characterized in that: The number of queues of the packet receiving queue corresponding to the shared physical function is 16, the number of queues of the first packet receiving queue set is 1088, the number of queues of the packet sending queue corresponding to the shared physical function is 16, and the number of queues of the first packet sending queue set is 1088.

12. 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 11 when executing the computer program.

13. 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 11.

Citation Information

Patent Citations

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

    CN113821310A

  • Flow table unloading system, equipment and cluster

    CN119211121A