L2 forwarding table, L2 message forwarding method, computer equipment and medium

The L2 forwarding table with a two-level entry structure solves the problem of limited storage space in a multi-virtual device multi-tenant environment, achieves efficient data link layer forwarding, adapts to multi-tenant needs, and optimizes the use of hardware resources.

CN118282946BActive Publication Date: 2024-08-23ZHUHAI XINGYUN ZHILIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410706853.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-03
Publication Date
2024-08-23
Estimated Expiration
2044-06-03

AI Technical Summary

Technical Problem

In the existing technology, L2 forwarding tables are difficult to effectively support in multi-virtual device and multi-tenant application environments. They are limited by storage space and table entry specifications, and cannot meet the application requirements of multi-virtual devices and multi-tenants.

Method used

The L2 forwarding table adopts a two-level entry structure, including a non-linear table and a linear table, and uses the key value segment and action segment composed of physical addresses and virtual port addresses to utilize the consistency between the physical address of the virtual LAN sub-interface and the address of the parent interface. Compress the bit width and quantity of table entries to realize Layer 2 forwarding of the data link layer.

Benefits of technology

It effectively compresses the hardware storage space, maintains good search time, adapts to multi-tenant and multi-device scenarios, and supports virtual LAN sub-interfaces under a full range of physical and virtual function combinations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118282946B
    Figure CN118282946B
Patent Text Reader

Abstract

The present application relates to the field of computer technology and provides an L2 forwarding table, an L2 message forwarding method, a computer device and a medium. The method comprises: looking up a data message according to the nonlinear table to obtain a physical function virtual function combination associated with the data message; looking up a physical function virtual function combination associated with the data message according to the linear table to determine whether to forward the data message or discard the data message. In this way, the overall hardware storage space is compressed, the table lookup time is reduced, and it is conducive to supporting the application requirements of multiple virtual devices and multiple tenants.
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 an L2 forwarding table, an L2 message forwarding method, a computer device and a medium. Background Art

[0002] The hierarchical structure of computer networks can be divided into the physical layer, data link layer, network layer, transport layer, etc. from bottom to top. Among them, the physical layer includes physical media such as repeaters for transmitting data. The data link layer provides services for transmitting data to adjacent nodes based on the physical layer, such as combining data into data frames, controlling the transmission of data frames on the physical channel, and adjusting the transmission rate. The L2 forwarding table and L2 message generally refer to the second-layer forwarding and link layer message format applied to the data link layer. The L2 forwarding table is used for second-layer forwarding from the physical address, also called the Media Access Control (MAC) address, to the output port. The host uses the Network Interface Card (NIC) as a high-speed input and output peripheral. The NIC receives data packets from the network through the Ethernet interface and sends them to the server processor on the host, and receives data packets from the server processor and sends them to the network. With the development of virtualization technology and multi-tenant applications, NIC supports the use of technologies such as Single Root I / O Virtualization (SRIOV) to virtualize various virtual devices, and creates Virtual Local Area Network (VLAN) sub-interfaces for the network interfaces of these virtual devices to support network isolation and protect business privacy. In the prior art, in order to drive L2 hardware resources in an application environment with multiple virtual devices and multiple tenants, the entries of the L2 forwarding table need to occupy storage space to provide physical addresses, virtual LAN addresses, and virtual port addresses, and each physical function or virtual function needs to support multiple virtual LAN sub-interfaces. Therefore, as the scale of the device expands and the number of physical functions or virtual functions increases, a larger storage space for the L2 forwarding table is required, which is limited by the specifications of the L2 table entries, making it difficult to support the application requirements of multiple virtual devices and multiple tenants.

[0003] To this end, the present application provides an L2 forwarding table, an L2 message forwarding method, a computer device and a medium to address the technical difficulties in the prior art. Summary of the invention

[0004] In a first aspect, the present application provides an L2 forwarding table. The L2 forwarding table includes: a nonlinear table composed of a plurality of first-level table entries, wherein each of the plurality of first-level table entries includes a physical address as a key segment and a virtual port address as an action segment, and the result of looking up a data message according to the nonlinear table is a physical function virtual function combination associated with the data message; a linear table composed of a plurality of second-level table entries, wherein the plurality of second-level table entries correspond one-to-one to a plurality of elements in a bitmap composed of a first dimension and a second dimension, wherein the first dimension indicates whether the same virtual local area network sub-interface is set under a plurality of physical function virtual function combinations, and the second dimension indicates whether a plurality of virtual local area network sub-interfaces under the same physical function virtual function combination are set, wherein the result of looking up the physical function virtual function combination associated with the data message according to the linear table at least indicates forwarding the data message or discarding the data message.

[0005] Through the first aspect of the present application, through the two-level table entry structure of the nonlinear table and the linear table, the second-layer forwarding requirements from the physical address to the output port of the data link layer are met, and different physical addresses, different network interfaces, different virtual LAN sub-interfaces, and different physical function virtual function combinations can be adapted; by utilizing the characteristic that the physical address of the virtual LAN sub-interface is consistent with the physical address of the corresponding parent interface, the bit width of a single table entry is greatly compressed, thereby effectively compressing the overall hardware storage space; in addition, the number of multiple first-level table entries included in the nonlinear table is determined by the number of physical function virtual function combinations, and the number of multiple second-level table entries included in the linear table is determined by the product of the number of multiple physical function virtual function combinations and the number of multiple virtual LAN sub-interfaces. Therefore, while compressing the bit width of a single table entry, the nonlinear table and the linear table are also effectively reduced. The number of respective table entries further compresses the overall hardware storage space; in addition, the lookup operation on the linear table is equivalent to determining whether an element in the two-dimensional matrix is ​​set on the bit map, so the relevant table entry lookup time is a fixed value and is independent of the number of table entries, which means that in the case of large-scale table entries, a good lookup time can still be maintained, which is conducive to better coping with multi-tenant and multi-device application scenarios; in addition, the data message is looked up according to the nonlinear table separately to obtain the physical function virtual function combination associated with the data message, and the physical function virtual function combination associated with the data message is looked up according to the linear table to determine whether to forward the data message or discard the data message. In this way, the linear table can be conveniently optimized, for example, by allowing the second-level table entries to carry more reference information, so that it can cooperate with the manufacturer's verification to further increase the compression benefit.

[0006] In a possible implementation of the first aspect of the present application, the data length of each of the multiple first-level table entries is the sum of the data length of the physical address and the data length of the virtual port address, the number of the multiple first-level table entries is the number of the multiple physical function-virtual function combinations, and the storage space of the nonlinear table is the data length of each of the multiple first-level table entries multiplied by the number of the multiple physical function-virtual function combinations.

[0007] In a possible implementation of the first aspect of the present application, the multiple second-level table entries each include a set flag, the data length of each of the multiple second-level table entries is at least the data length of the set flag, the number of the multiple second-level table entries is the product of the number of the multiple physical function-virtual function combinations and the number of the multiple virtual LAN sub-interfaces, and the storage space of the linear table is the data length of each of the multiple second-level table entries multiplied by the number of the multiple second-level table entries.

[0008] In a possible implementation of the first aspect of the present application, a specific second-level table entry among the multiple second-level table entries corresponds to a specific element in the bit map, the specific element corresponds to a specific physical function-virtual function combination among the multiple physical function-virtual function combinations and a specific virtual LAN sub-interface among the multiple virtual LAN sub-interfaces, and the set flag included in the specific second-level table entry indicates whether the specific virtual LAN sub-interface under the specific physical function-virtual function combination is set.

[0009] In a possible implementation of the first aspect of the present application, the multiple second-level table entries each include a set flag and a label protocol flag, the data length of the set flag is 1 bit, the data length of the label protocol flag is 1 bit, the data length of each of the multiple second-level table entries is 2 bits, the number of the multiple second-level table entries is the product of the number of the multiple physical function-virtual function combinations and the number of the multiple virtual LAN sub-interfaces, and the storage space of the linear table is 2 bits multiplied by the number of the multiple second-level table entries.

[0010] In a possible implementation of the first aspect of the present application, a specific second-level table entry among the multiple second-level table entries corresponds to a specific element in the bit map, the specific element corresponds to a specific physical function-virtual function combination among the multiple physical function-virtual function combinations and a specific virtual LAN sub-interface among the multiple virtual LAN sub-interfaces, the set flag included in the specific second-level table entry indicates whether the specific virtual LAN sub-interface under the specific physical function-virtual function combination is set, and the label protocol flag included in the specific second-level table entry indicates that the specific virtual LAN sub-interface is a virtual LAN sub-interface supporting 0x8100 or a virtual LAN sub-interface supporting 0x88A8.

[0011] In a possible implementation manner of the first aspect of the present application, the number of the multiple physical function-virtual function combinations is 256, the number of the multiple virtual LAN sub-interfaces is 4096, and the storage space of the linear table is 2097152 bits.

[0012] In a possible implementation of the first aspect of the present application, the lookup time for looking up a data message according to the non-linear table is determined based on the number of the multiple physical function-virtual function combinations, and the lookup time for looking up the physical function-virtual function combination associated with the data message according to the linear table is a fixed value, and the fixed value is not associated with the number of the multiple second-level table entries of the linear table.

[0013] In a possible implementation manner of the first aspect of the present application, the L2 forwarding table is used for layer 2 forwarding on the data link layer and adapts the link layer message format.

[0014] In a second aspect, an embodiment of the present application further provides an L2 message forwarding method. The L2 message forwarding method is applied to an L2 forwarding table, the L2 forwarding table includes a nonlinear table composed of multiple first-level table entries and a linear table composed of multiple second-level table entries, the multiple first-level table entries each include a physical address as a key segment and a virtual port address as an action segment, the multiple second-level table entries correspond one-to-one to multiple elements in a bitmap composed of a first dimension and a second dimension, the first dimension indicates whether the same virtual LAN sub-interface is set under multiple physical function virtual function combinations, and the second dimension indicates whether multiple virtual LAN sub-interfaces under the same physical function virtual function combination are set, and the L2 message forwarding method includes: looking up a data message according to the nonlinear table to obtain a physical function virtual function combination associated with the data message; looking up a physical function virtual function combination associated with the data message according to the linear table to determine whether to forward the data message or discard the data message.

[0015] Through the second aspect of the present application, through the two-level table entry structure of the nonlinear table and the linear table, the second-layer forwarding requirements from the physical address to the output port of the data link layer are met, and different physical addresses, different network interfaces, different virtual LAN sub-interfaces, and different physical function virtual function combinations can be adapted; by utilizing the characteristic that the physical address of the virtual LAN sub-interface is consistent with the physical address of the corresponding parent interface, the bit width of a single table entry is greatly compressed, thereby effectively compressing the overall hardware storage space; in addition, the number of multiple first-level table entries included in the nonlinear table is determined by the number of physical function virtual function combinations, and the number of multiple second-level table entries included in the linear table is determined by the product of the number of multiple physical function virtual function combinations and the number of multiple virtual LAN sub-interfaces. Therefore, while compressing the bit width of a single table entry, the nonlinear table and the linear table are also effectively reduced. The number of respective table entries further compresses the overall hardware storage space; in addition, the lookup operation on the linear table is equivalent to determining whether an element in the two-dimensional matrix is ​​set on the bit map, so the relevant table entry lookup time is a fixed value and is independent of the number of table entries, which means that in the case of large-scale table entries, a good lookup time can still be maintained, which is conducive to better coping with multi-tenant and multi-device application scenarios; in addition, the data message is looked up according to the nonlinear table separately to obtain the physical function virtual function combination associated with the data message, and the physical function virtual function combination associated with the data message is looked up according to the linear table to determine whether to forward the data message or discard the data message. In this way, the linear table can be conveniently optimized, for example, by allowing the second-level table entries to carry more reference information, so that it can cooperate with the manufacturer's verification to further increase the compression benefit.

[0016] In a possible implementation of the second aspect of the present application, the data length of each of the multiple first-level table entries is the sum of the data length of the physical address and the data length of the virtual port address, the number of the multiple first-level table entries is the number of the multiple physical function-virtual function combinations, and the storage space of the nonlinear table is the data length of each of the multiple first-level table entries multiplied by the number of the multiple physical function-virtual function combinations.

[0017] In a possible implementation of the second aspect of the present application, the multiple second-level table entries each include a set flag, the data length of each of the multiple second-level table entries is at least the data length of the set flag, the number of the multiple second-level table entries is the product of the number of the multiple physical function-virtual function combinations and the number of the multiple virtual LAN sub-interfaces, and the storage space of the linear table is the data length of each of the multiple second-level table entries multiplied by the number of the multiple second-level table entries.

[0018] In a possible implementation of the second aspect of the present application, a specific second-level table entry among the multiple second-level table entries corresponds to a specific element in the bit map, the specific element corresponds to a specific physical function-virtual function combination among the multiple physical function-virtual function combinations and a specific virtual LAN sub-interface among the multiple virtual LAN sub-interfaces, and the set flag included in the specific second-level table entry indicates whether the specific virtual LAN sub-interface under the specific physical function-virtual function combination is set.

[0019] In a possible implementation of the second aspect of the present application, the lookup time for looking up a data message according to the non-linear table is determined based on the number of the multiple physical function-virtual function combinations, and the lookup time for looking up the physical function-virtual function combination associated with the data message according to the linear table is a fixed value, and the fixed value is not associated with the number of the multiple second-level table entries of the linear table.

[0020] In a third 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.

[0021] In a fourth 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.

[0022] In a fifth 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

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

[0024] Figure 1 A schematic diagram of a network interface card provided in an embodiment of the present application;

[0025] Figure 2 A schematic diagram of an L2 forwarding table provided in an embodiment of the present application;

[0026] Figure 3 A schematic diagram of a flow chart of an L2 message forwarding method provided in an embodiment of the present application;

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

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

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

[0030] Figure 1 A schematic diagram of a network interface card provided in an embodiment of the present application. Figure 1 The network interface card (NIC) 102 shown, as a high-speed input and output peripheral, receives data packets from the network through an Ethernet interface and sends them to the server processor on the host machine 100, and receives data packets from the server processor and sends them to the network. Figure 1 The network interface card 102 shown is applied to the application scenario of multi-device multi-tenant. There are multiple devices on the host machine 100. For example, the single root I / O virtualization (SRIOV) technology is used to virtualize various virtual devices including providing multiple virtual functions, and there are also multiple tenants' respective data services. Therefore, in order to meet the requirements of network isolation and business privacy between different data services, the network interface card 102 supports the host machine 100 to create multiple virtual local area network (VLAN) sub-interfaces for the network interfaces of these virtual devices, and provides communication functions for different physical function virtual function combinations. Figure 1 , the network interface card 102 supports the host machine 100 to provide the physical function 110, the virtual function A 112 of the physical function 110, and the virtual function B 114 of the physical function 110. A network device with a single-root input and output virtualization feature can obtain multiple virtual functions for the physical function virtualization, so there are, for example Figure 1The physical function 110, the virtual function A 112 of the physical function 110, and the virtual function B 114 of the physical function 110 are shown as different physical function virtual function combinations. Multiple virtual LAN sub-interfaces are created based on these different physical function virtual function combinations to achieve network isolation and support multi-service applications and multi-tenant requirements. Figure 1 It is also exemplarily shown that the multiple network interfaces include network interface A 120, network interface B 130 and network interface C 140. The network interface card 102 supports the host machine 100 to provide multiple virtual local area network sub-interfaces for the multiple network interfaces. Specifically, a virtual LAN sub-interface set A122 is created based on the network interface A120, and the virtual LAN sub-interface set A122 can be, for example, 4096 virtual LAN sub-interfaces created based on the network interface A120 (such as virtual LAN sub-interfaces 1 to 4094 numbered as network interface A120); a virtual LAN sub-interface set B132 is created based on the network interface B130, and the virtual LAN sub-interface set B132 can be, for example, 4096 virtual LAN sub-interfaces created based on the network interface B130 (such as virtual LAN sub-interfaces 1 to 4094 numbered as network interface B130); a virtual LAN sub-interface set C142 is created based on the network interface C140, and the virtual LAN sub-interface set C142 can be, for example, 4096 virtual LAN sub-interfaces created based on the network interface C140 (such as virtual LAN sub-interfaces 1 to 4094 numbered as network interface C140).

[0031] See also Figure 1 , Figure 1 The number of physical function-virtual function combinations, the number of network interfaces, and the number of virtual LAN sub-interfaces shown are only exemplary. As the scale of equipment expands and the number of physical functions or virtual functions increases, in multi-tenant and multi-device application scenarios, in order to meet the Layer 2 forwarding requirements from the physical address to the egress port of the data link layer, it is necessary to provide an L2 forwarding table and an L2 message forwarding method to achieve upstream and downstream transmission of data messages. Therefore, it is necessary to consider different physical addresses, also known as Media Access Control (MAC) addresses, different network interfaces, different virtual LAN sub-interfaces, and different physical function-virtual function combinations, so as to provide correct information to guide the hardware to forward data messages to the corresponding network interface. The following is combined with Figure 2 Further details are given.

[0032] Figure 2 A schematic diagram of an L2 forwarding table provided in an embodiment of the present application. Figure 2As shown, the L2 forwarding table 200 includes two parts, namely, a nonlinear table 210 composed of multiple first-level table entries and a linear table 220 composed of multiple second-level table entries. Specifically, each of the multiple first-level table entries includes a physical address as a key segment and a virtual port address as an action segment, and the result of looking up the data message according to the nonlinear table 210 is the physical function virtual function combination associated with the data message. The multiple second-level table entries correspond one-to-one to multiple elements in the bitmap composed of the first dimension and the second dimension. The first dimension indicates whether the same virtual LAN sub-interface is set under multiple physical function virtual function combinations, and the second dimension indicates whether multiple virtual LAN sub-interfaces under the same physical function virtual function combination are set. The result of looking up the physical function virtual function combination associated with the data message according to the linear table 220 at least indicates forwarding the data message or discarding the data message.

[0033] See also Figure 1 and Figure 2 In order to meet the Layer 2 forwarding requirements from the physical address to the egress port of the data link layer, it is necessary to consider different physical addresses, namely MAC addresses, different network interfaces, different virtual LAN sub-interfaces, and different physical function virtual function combinations. Assume that the data length of the physical address, namely MAC address, is 48 bits, the data length of the virtual port address is 8 bits, and the data length of the virtual LAN address is 12 bits; here, the virtual LAN address is used to distinguish different virtual LAN sub-interfaces, and can be, for example, the label field in the virtual LAN sub-interface data frame used to identify the virtual LAN to which the data frame belongs. Take the number of physical function virtual function combinations as an example, that is, assuming that there are 256 different physical function virtual function combinations (for example, multiple virtual functions are provided through SRIOV technology). It can be seen that if a single-level table entry is used to record this information, the data length required for each table entry is the data length of the physical address (48 bits) plus the data length of the virtual LAN address (12 bits) plus the data length of the virtual port address (8 bits), so that the data length of each table entry is 68 bits. Assuming that each physical function virtual function combination supports 4096 virtual LAN sub-interfaces, and the number of physical function virtual function combinations is 256, it can be calculated that the hardware storage space occupied by all single-level entries is 68 bits multiplied by 256 and then multiplied by 4096, which equals 71303168 bits. This means that if a single-level entry is used to record the necessary information to implement Layer 2 forwarding from the physical address to the egress port of the data link layer, a hardware storage space of at least 71303168 bits is required, and the storage space required will increase with the expansion of the equipment scale and the growth of multi-tenant services.

[0034] Continue reading Figure 2 , compared to recording these necessary information through a single-level table entry, Figure 2 The L2 forwarding table shown adopts a two-level structure. The L2 forwarding table 200 includes two parts, namely a non-linear table 210 composed of multiple first-level table entries and a linear table 220 composed of multiple second-level table entries. Among them, the non-linear table 210 is composed of multiple first-level table entries, and each of the multiple first-level table entries includes a physical address as a key segment and a virtual port address as an action segment. Therefore, assuming that the data length of the physical address, that is, the MAC address, is 48 bits, and the data length of the virtual port address is 8 bits, then the data length of each of the multiple first-level table entries is the data length of the physical address (48 bits) plus the data length of the virtual port address (8 bits), that is, 56 bits. The result of looking up the data message according to the non-linear table 210 is the physical function virtual function combination associated with the data message. Therefore, assuming that there are 256 different physical function virtual function combinations, this means that the number of multiple first-level table entries is 256. Figure 2 The hardware storage space of the first part of the L2 forwarding table, i.e., the nonlinear table 210, is 48 bits multiplied by 256, which is equal to 14336 bits. The physical function virtual function combination associated with the data message may be, for example, Figure 1 Shown are a physical function 110 , a virtual function A 112 of the physical function 110 , and a virtual function B 114 of the physical function 110 .

[0035] Continue reading Figure 2, the linear table 220 is composed of a plurality of second-level table entries, and the plurality of second-level table entries correspond one to one to a plurality of elements in a bitmap composed of a first dimension and a second dimension. The first dimension indicates whether the same virtual LAN sub-interface is set under a plurality of physical function virtual function combinations, and the second dimension indicates whether the plurality of virtual LAN sub-interfaces under the same physical function virtual function combination are set. Here, the bitmap is composed of a first dimension and a second dimension, and can also be understood as a two-dimensional array, or can be understood as a two-dimensional matrix. For example, the bitmap can be a two-dimensional matrix, and each row vector is used to indicate whether the same virtual LAN sub-interface is set under a plurality of physical function virtual function combinations, and each column vector is used to indicate whether the plurality of virtual LAN sub-interfaces under the same physical function virtual function combination are set. In this way, a two-dimensional matrix is ​​formed by row vectors and column vectors, and the elements on the two-dimensional matrix indicate whether a specific virtual LAN sub-interface under a specific physical function virtual function combination is set. Thus, by looking up the linear table 220, that is, looking up the physical function virtual function combination associated with the data message according to the linear table 220, it can be determined whether there is a matching table entry for the data message. For example, it can be pre-specified that the presence of a set bit means the presence of a matching table entry, so that the data message can be forwarded, or the data message can be discarded when there is no matching table entry. It can be seen that the linear table 220 is used as Figure 2 In the second part of the L2 forwarding table shown, the table lookup operation of the linear table 220 is equivalent to determining whether a certain element in the two-dimensional matrix is ​​set on the bit map, so the relevant table entry search time is a fixed value and is independent of the number of table entries. In this way, by looking up the first part of the L2 forwarding table, that is, the nonlinear table 210 composed of multiple first-level table entries, that is, looking up the data message according to the nonlinear table 210, the physical function virtual function combination associated with the data message is obtained, and then, by looking up the second part of the L2 forwarding table, that is, the linear table 220 composed of multiple second-level table entries, that is, looking up the physical function virtual function combination associated with the data message according to the linear table 220, it is determined to forward the data message or discard the data message.

[0036] Continue reading Figure 2As mentioned above, assuming that there are 256 different physical function virtual function combinations and each physical function virtual function combination supports 4096 virtual LAN sub-interfaces, if a single-level table entry is used to record this information, the data length required for each table entry is the data length of the physical address (48 bits) plus the data length of the virtual LAN address (12 bits) plus the data length of the virtual port address (8 bits), so the data length of each table entry is 68 bits, and the hardware storage space occupied by all single-level table entries is 68 bits multiplied by 256 and then multiplied by 4096, which is equal to 71303168 bits. Compared with recording these necessary information through a single-level table entry, Figure 2 The L2 forwarding table shown adopts a two-level structure, which can take advantage of the fact that the physical address of the virtual LAN sub-interface is consistent with the physical address of the corresponding parent interface, and greatly reduce the overall hardware storage space by reducing the bit width of a single entry in the L2 forwarding table, so as to support the virtual LAN sub-interface under the full-specification physical function virtual function combination. Among them, the data length of each of the multiple first-level table entries is the data length of the physical address (48 bits) plus the data length of the virtual port address (8 bits), that is, 56 bits; assuming that there are 256 different physical function virtual function combinations, this means that the number of multiple first-level table entries is 256, Figure 2 The hardware storage space of the first part of the L2 forwarding table shown, i.e., the nonlinear table 210, is 48 bits multiplied by 256, which equals 14336 bits. The multiple second-level table entries correspond one-to-one to multiple elements in the bit map composed of the first dimension and the second dimension. It is assumed here that the data length of each of the multiple second-level table entries is 2 bits, that is, the values ​​of "00", "01", "10" and "11". This can be used to indicate whether a specific virtual LAN sub-interface under a specific physical function virtual function combination is set, and more reference information can also be provided. The first dimension indicates whether the same virtual LAN sub-interface is set under multiple physical function virtual function combinations, and the second dimension indicates whether multiple virtual LAN sub-interfaces under the same physical function virtual function combination are set. Therefore, the number of the multiple second-level table entries is the number of multiple physical function virtual function combinations (256) multiplied by the number of multiple virtual LAN sub-interfaces (4096). In this way, Figure 2 The hardware storage space of the second part of the L2 forwarding table, i.e., the linear table 220, is 2 bits multiplied by 256 and then multiplied by 4096, which is equal to 2097152 bits. Figure 2The overall hardware storage space of the L2 forwarding table shown is the hardware storage space of the nonlinear table 210 (14336 bits) plus the hardware storage space of the linear table 220 (2097152 bits), which is equal to 2111488 bits; thus, compared with the case where such information is recorded through a single-level table entry, the hardware storage space occupied by all single-level table entries is 71303168 bits. It can be seen that Figure 2 The overall hardware storage space of the L2 forwarding table shown is approximately thirty-one third of that before compression. Therefore, by decomposing the L2 forwarding table and the corresponding L2 hardware resources into two-level table entries, the hardware storage space required is greatly compressed, thereby supporting the virtual LAN sub-interface under the full-specification physical function and virtual function combination.

[0037] In conclusion, Figure 2 The L2 forwarding table shown in the figure, through the two-level table entry structure of the non-linear table 210 and the linear table 220, realizes the second-layer forwarding requirements from the physical address to the output port of the data link layer, and can adapt to different physical addresses, different network interfaces, different virtual LAN sub-interfaces, and different physical function virtual function combinations; by utilizing the characteristic that the physical address of the virtual LAN sub-interface is consistent with the physical address of the corresponding parent interface, the bit width of a single table entry is greatly compressed, thereby effectively compressing the overall hardware storage space; in addition, the number of the multiple first-level table entries included in the non-linear table 210 is determined by the number of physical function virtual function combinations, and the number of the multiple second-level table entries included in the linear table 220 is determined by the product of the number of the multiple physical function virtual function combinations and the number of the multiple virtual LAN sub-interfaces, so while compressing the bit width of a single table entry, the non-linear table 210 and the linear table 220 are also effectively reduced. 20 respective table entries, further compressing the overall hardware storage space; in addition, the table lookup operation on the linear table 220 is equivalent to determining whether a certain element in the two-dimensional matrix is ​​set on the bit map, so the related table entry lookup time is a fixed value and is independent of the number of table entries, which means that in the case of large-scale table entries, a good lookup time can still be maintained, which is conducive to better coping with multi-tenant and multi-device application scenarios; in addition, the data message is looked up according to the nonlinear table 210 to obtain the physical function virtual function combination associated with the data message, and the physical function virtual function combination associated with the data message is looked up according to the linear table 220 to determine whether to forward the data message or discard the data message. In this way, the linear table 220 can be conveniently optimized, for example, by allowing the second-level table entries to carry more reference information, so that it can cooperate with the manufacturer's verification to further increase the compression benefit.

[0038] In one possible implementation, the data length of each of the multiple first-level table entries is the sum of the data length of the physical address and the data length of the virtual port address, the number of the multiple first-level table entries is the number of the multiple physical function virtual function combinations, and the storage space of the nonlinear table is the data length of each of the multiple first-level table entries multiplied by the number of the multiple physical function virtual function combinations. Referring to the above example, the data length of each of the multiple first-level table entries is the data length of the physical address (48 bits) plus the data length of the virtual port address (8 bits), that is, 56 bits; assuming that there are 256 different physical function virtual function combinations, this means that the number of multiple first-level table entries is 256, Figure 2 The hardware storage space of the first part of the L2 forwarding table, i.e., the nonlinear table 210, is 48 bits multiplied by 256, which is equal to 14336 bits. The number of the plurality of first-level table entries included in the nonlinear table 210 is determined by the number of physical function virtual function combinations, so while compressing the bit width of a single table entry, the number of table entries is also effectively reduced, which is conducive to compressing the overall hardware storage space.

[0039] In some embodiments, each of the plurality of second-level table entries includes a set flag, the data length of each of the plurality of second-level table entries is at least the data length of the set flag, the number of the plurality of second-level table entries is the product of the number of the plurality of physical function virtual function combinations and the number of the plurality of virtual LAN sub-interfaces, and the storage space of the linear table is the data length of each of the plurality of second-level table entries multiplied by the number of the plurality of second-level table entries. The plurality of second-level table entries correspond one-to-one to the plurality of elements in the bitmap composed of the first dimension and the second dimension. Here, it is assumed that the data length of each of the plurality of second-level table entries is 2 bits, that is, the values ​​of "00", "01", "10" and "11", which can be used to indicate whether a specific virtual LAN sub-interface under a specific physical function virtual function combination is set, and more reference information can also be provided. The first dimension indicates whether the same virtual LAN sub-interface is set under multiple physical function virtual function combinations, and the second dimension indicates whether multiple virtual LAN sub-interfaces under the same physical function virtual function combination are set. Therefore, the number of the multiple second-level table entries is the number of multiple physical function virtual function combinations (256) multiplied by the number of multiple virtual LAN sub-interfaces (4096). In this way, Figure 2 The hardware storage space of the second part of the L2 forwarding table, i.e., the linear table 220, is 2 bits multiplied by 256 and then multiplied by 4096, which equals 2097152 bits. Therefore, while compressing the bit width of a single entry, the number of entries is also effectively reduced, which is conducive to compressing the overall hardware storage space.

[0040] In some embodiments, a specific second-level entry among the multiple second-level entries corresponds to a specific element in the bitmap, and the specific element corresponds to a specific physical function virtual function combination among the multiple physical function virtual function combinations and a specific virtual LAN sub-interface among the multiple virtual LAN sub-interfaces. The set flag included in the specific second-level entry indicates whether the specific virtual LAN sub-interface under the specific physical function virtual function combination is set. In this way, by utilizing the characteristic that the physical address of the virtual LAN sub-interface is consistent with the physical address of the corresponding parent interface, the overall hardware storage space is greatly reduced by reducing the bit width of a single entry in the L2 forwarding table, thereby supporting virtual LAN sub-interfaces under full-specification physical function virtual function combinations. By looking up the linear table 220, that is, according to the result of looking up the physical function virtual function combination associated with the data message according to the linear table 220, it can be determined whether there is a matching table entry for the data message. For example, it can be pre-specified that the existence of a set means the existence of a matching table entry, so that the data message can be forwarded, or the data message can be discarded when there is no matching table entry. It can be seen that the linear table 220 is used as Figure 2 In the second part of the L2 forwarding table shown, the table lookup operation of the linear table 220 is equivalent to determining whether a certain element in the two-dimensional matrix is ​​set on the bit map, so the relevant table entry search time is a fixed value and is independent of the number of table entries. In this way, by looking up the first part of the L2 forwarding table, that is, the nonlinear table 210 composed of multiple first-level table entries, that is, looking up the data message according to the nonlinear table 210, the physical function virtual function combination associated with the data message is obtained, and then, by looking up the second part of the L2 forwarding table, that is, the linear table 220 composed of multiple second-level table entries, that is, looking up the physical function virtual function combination associated with the data message according to the linear table 220, it is determined to forward the data message or discard the data message.

[0041] In some embodiments, each of the multiple second-level table entries includes a set flag and a tag protocol flag, the data length of the set flag is 1 bit, the data length of the tag protocol flag is 1 bit, the data length of each of the multiple second-level table entries is 2 bits, the number of the multiple second-level table entries is the product of the number of the multiple physical function virtual function combinations and the number of the multiple virtual LAN sub-interfaces, and the storage space of the linear table is 2 bits multiplied by the number of the multiple second-level table entries. Here, the tag protocol identifier (TPID) is used to indicate which type of virtual LAN sub-interface is supported by the operating system. The operating system supports two types of virtual LAN sub-interfaces, 0x8100 and 0x88A8. If the TPID is to be verified, the second-level table entry with a data length of 2 bits can be used to determine whether there is a matching table entry for the data message while also realizing the verification of the TPID. For example, the second-level table entry with a 2-bit data length can be set to have the following definition: the value of "00" means that there is no corresponding virtual LAN sub-interface, that is, there is no matching table entry, which indicates that the data message is discarded; the value of "01" means that there is a corresponding virtual LAN sub-interface, that is, there is a matching table entry, which indicates that the data message is forwarded and also indicates that the corresponding virtual LAN sub-interface is a virtual LAN sub-interface that supports 0x8100; the value of "10" means that there is a corresponding virtual LAN sub-interface, that is, there is a matching table entry, which indicates that the data message is forwarded and also indicates that the corresponding virtual LAN sub-interface is a virtual LAN sub-interface that supports 0x88A8; the value of "11" can be reserved for other purposes. In this way, the setting flag with a data length of 1 bit is combined with the label protocol flag with a data length of 1 bit, so that the data length of each of the multiple second-level table items obtained is 2 bits. In this way, the linear table 220 can be conveniently optimized, for example, by allowing the second-level table items to carry more reference information, so as to cooperate with manufacturer verification and further increase compression benefits.

[0042] In some embodiments, a specific second-level table entry among the multiple second-level table entries corresponds to a specific element in the bit map, the specific element corresponds to a specific physical function-virtual function combination among the multiple physical function-virtual function combinations and a specific virtual LAN sub-interface among the multiple virtual LAN sub-interfaces, the set flag included in the specific second-level table entry indicates whether the specific virtual LAN sub-interface under the specific physical function-virtual function combination is set, and the label protocol flag included in the specific second-level table entry indicates that the specific virtual LAN sub-interface is a virtual LAN sub-interface supporting 0x8100 or a virtual LAN sub-interface supporting 0x88A8. The table lookup operation on the linear table 220 is equivalent to determining whether an element in a two-dimensional matrix is ​​set on a bit map. Therefore, the relevant table entry lookup time is a fixed value and is independent of the number of table entries. This means that a good lookup time can still be maintained in the case of large-scale table entries, which is conducive to better coping with multi-tenant and multi-device application scenarios; in addition, the data message is looked up according to the nonlinear table 210 to obtain the physical function-virtual function combination associated with the data message, and the physical function-virtual function combination associated with the data message is looked up according to the linear table 220 to determine whether to forward the data message or discard the data message. In this way, the linear table 220 can be conveniently optimized, for example, by allowing the second-level table entries to carry more reference information, so that it can cooperate with the manufacturer's verification to further increase the compression benefit.

[0043] In some embodiments, the number of the plurality of physical function virtual function combinations is 256, the number of the plurality of virtual LAN sub-interfaces is 4096, and the storage space of the linear table is 2097152 bits. In this way, by utilizing the characteristic that the physical address of the virtual LAN sub-interface is consistent with the physical address of the corresponding parent interface, the bit width of a single table entry is greatly compressed, thereby effectively compressing the overall hardware storage space.

[0044] In a possible implementation, the lookup time for looking up a data message according to the nonlinear table is determined based on the number of the multiple physical function virtual function combinations, and the lookup time for looking up a physical function virtual function combination associated with the data message according to the linear table is a fixed value, and the fixed value is not associated with the number of the multiple second-level table entries of the linear table. In this way, the lookup operation on the linear table 220 is equivalent to determining whether an element in a two-dimensional matrix is ​​set on a bit map, so the related table entry lookup time is a fixed value and is independent of the number of table entries, which means that in the case of large-scale table entries, a good lookup time can still be maintained, which is conducive to better coping with multi-tenant and multi-device application scenarios.

[0045] In a possible implementation, the L2 forwarding table is used for Layer 2 forwarding on the data link layer and adapts to the link layer message format. In this way, the Layer 2 forwarding requirements from the physical address to the egress port of the data link layer are met, and different physical addresses, different network interfaces, different virtual LAN sub-interfaces, and different physical function virtual function combinations can be adapted, which greatly compresses the hardware storage space that needs to be occupied, so that the virtual LAN sub-interface under the full-spec physical function virtual function combination can be supported.

[0046] Figure 3 A flow chart of an L2 message forwarding method provided for an embodiment of the present application. The L2 message forwarding method is applied to an L2 forwarding table. The L2 forwarding table includes a non-linear table consisting of multiple first-level table entries and a linear table consisting of multiple second-level table entries. The multiple first-level table entries each include a physical address as a key segment and a virtual port address as an action segment. The multiple second-level table entries correspond one-to-one to multiple elements in a bitmap consisting of a first dimension and a second dimension. The first dimension indicates whether the same virtual LAN sub-interface is set under multiple physical function virtual function combinations, and the second dimension indicates whether multiple virtual LAN sub-interfaces under the same physical function virtual function combination are set. Figure 3 As shown, the L2 message forwarding method includes the following steps.

[0047] Step S310: Look up the data message according to the nonlinear table to obtain the physical function virtual function combination associated with the data message.

[0048] Step S320: Look up the physical function virtual function combination associated with the data message according to the linear table, so as to determine whether to forward the data message or discard the data message.

[0049] In a possible implementation, the data length of each of the plurality of first-level table entries is the sum of the data length of the physical address and the data length of the virtual port address, the number of the plurality of first-level table entries is the number of the plurality of physical function virtual function combinations, and the storage space of the nonlinear table is the data length of each of the plurality of first-level table entries multiplied by the number of the plurality of physical function virtual function combinations. Referring to the above example, the data length of each of the plurality of first-level table entries is the data length of the physical address (48 bits) plus the data length of the virtual port address (8 bits), that is, 56 bits; assuming that there are 256 different physical function virtual function combinations, this means that the number of the plurality of first-level table entries is 256, and the hardware storage space of the first part of the L2 forwarding table, i.e., the nonlinear table, is 48 bits multiplied by 256, which is equal to 14336 bits. The number of the plurality of first-level table entries included in the nonlinear table is determined by the number of physical function virtual function combinations, so while compressing the bit width of a single table entry, the number of table entries is also effectively reduced, which is conducive to compressing the overall hardware storage space.

[0050] In some embodiments, each of the plurality of second-level table entries includes a set flag, the data length of each of the plurality of second-level table entries is at least the data length of the set flag, the number of the plurality of second-level table entries is the product of the number of the plurality of physical function virtual function combinations and the number of the plurality of virtual LAN sub-interfaces, and the storage space of the linear table is the data length of each of the plurality of second-level table entries multiplied by the number of the plurality of second-level table entries. The plurality of second-level table entries correspond one-to-one to the plurality of elements in the bitmap composed of the first dimension and the second dimension. Here, it is assumed that the data length of each of the plurality of second-level table entries is 2 bits, that is, the values ​​of "00", "01", "10" and "11", which can be used to indicate whether a specific virtual LAN sub-interface under a specific physical function virtual function combination is set, and more reference information can also be provided. The first dimension indicates whether the same virtual LAN sub-interface is set under multiple physical function virtual function combinations, and the second dimension indicates whether multiple virtual LAN sub-interfaces under the same physical function virtual function combination are set. Therefore, the number of the multiple second-level table entries is the number of multiple physical function virtual function combinations (256) multiplied by the number of multiple virtual LAN sub-interfaces (4096). In this way, the hardware storage space of the second part of the L2 forwarding table, that is, the linear table, is 2 bits multiplied by 256 and then multiplied by 4096, which is equal to 2097152 bits. Therefore, while compressing the bit width of a single table entry, it also effectively reduces the number of table entries, which is conducive to compressing the overall hardware storage space.

[0051] In some embodiments, a specific second-level entry in the plurality of second-level entries corresponds to a specific element in the bitmap, the specific element corresponds to a specific physical function virtual function combination in the plurality of physical function virtual function combinations and a specific virtual LAN sub-interface in the plurality of virtual LAN sub-interfaces, and the set flag included in the specific second-level entry indicates whether the specific virtual LAN sub-interface under the specific physical function virtual function combination is set. In this way, by utilizing the characteristic that the physical address of the virtual LAN sub-interface is consistent with the physical address of the corresponding parent interface, the overall hardware storage space is greatly reduced by reducing the bit width of a single entry in the L2 forwarding table, so that the virtual LAN sub-interface under the full specification physical function virtual function combination can be supported. By looking up the linear table, that is, according to the result of looking up the physical function virtual function combination associated with the data message according to the linear table, it can be determined whether there is a matching table entry for the data message, for example, it can be pre-specified that the presence of a set means the presence of a matching table entry, so that the data message can be forwarded, or, when there is no matching table entry, the data message is discarded. It can be seen that the linear table is the second part of the L2 forwarding table, and the table lookup operation on the linear table is equivalent to determining whether a certain element in the two-dimensional matrix is ​​set on the bit map, so the relevant table entry search time is a fixed value and has nothing to do with the number of table entries. In this way, by looking up the first part of the L2 forwarding table, that is, the nonlinear table composed of multiple first-level table entries, that is, looking up the data message according to the nonlinear table, the physical function virtual function combination associated with the data message is obtained, and then, by looking up the second part of the L2 forwarding table, that is, the linear table composed of multiple second-level table entries, that is, looking up the physical function virtual function combination associated with the data message according to the linear table, it is determined whether to forward the data message or discard the data message.

[0052] In a possible implementation, the lookup time for looking up a data message according to the nonlinear table is determined based on the number of the multiple physical function virtual function combinations, and the lookup time for looking up a physical function virtual function combination associated with the data message according to the linear table is a fixed value, and the fixed value is not associated with the number of the multiple second-level table entries of the linear table. In this way, the lookup operation on the linear table is equivalent to determining whether an element in a two-dimensional matrix is ​​set on a bit map, so the related table entry lookup time is a fixed value and is independent of the number of table entries, which means that in the case of large-scale table entries, a good lookup time can still be maintained, which is conducive to better coping with multi-tenant and multi-device application scenarios.

[0053] Figure 3The L2 message forwarding method shown, through the two-level table entry structure of non-linear table and linear table, realizes the second-layer forwarding requirements from physical address to output port of the data link layer, and can adapt to different physical addresses, different network interfaces, different virtual LAN sub-interfaces, and different physical function virtual function combinations; by utilizing the characteristic that the physical address of the virtual LAN sub-interface is consistent with the physical address of the corresponding parent interface, the bit width of a single table entry is greatly compressed, thereby effectively compressing the overall hardware storage space; in addition, the number of multiple first-level table entries included in the non-linear table is determined by the number of physical function virtual function combinations, and the number of multiple second-level table entries included in the linear table is determined by the product of the number of multiple physical function virtual function combinations and the number of multiple virtual LAN sub-interfaces, so while compressing the bit width of a single table entry, the non-linear table and the linear table are also effectively reduced. The number of respective table entries further compresses the overall hardware storage space; in addition, the lookup operation on the linear table is equivalent to determining whether an element in the two-dimensional matrix is ​​set on the bit map, so the relevant table entry lookup time is a fixed value and is independent of the number of table entries, which means that in the case of large-scale table entries, a good lookup time can still be maintained, which is conducive to better coping with multi-tenant and multi-device application scenarios; in addition, the data message is looked up according to the nonlinear table separately to obtain the physical function virtual function combination associated with the data message, and the physical function virtual function combination associated with the data message is looked up according to the linear table to determine whether to forward the data message or discard the data message. In this way, the linear table can be conveniently optimized, for example, by allowing the second-level table entries to carry more reference information, so that it can cooperate with the manufacturer's verification to further increase the compression benefit.

[0054] Figure 44 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application, and the computing device 400 includes: one or more processors 410, a communication interface 420 and a memory 430. The processor 410, the communication interface 420 and the memory 430 are interconnected via a bus 440. Optionally, the computing device 400 may also include an input / output interface 450, and the input / output interface 450 is connected to an input / output device for receiving parameters set by a user, etc. The computing device 400 can be used to implement some or all of the functions of the device embodiment or system embodiment in the above-mentioned embodiment of the present application; the processor 410 can also be used to implement some or all of the operating steps of the method embodiment in the above-mentioned embodiment of the present application. For example, the specific implementation of the computing device 400 performing various operations can refer to the specific details in the above-mentioned embodiments, such as the processor 410 is used to perform some or all of the steps in the above-mentioned method embodiment or some or all of the operations in the above-mentioned method embodiment. For another example, in an embodiment of the present application, the computing device 400 may be used to implement part or all of the functions of one or more components in the above-mentioned apparatus embodiment. In addition, the communication interface 420 may be specifically used to perform the communication functions necessary to implement the functions of these apparatuses and components, and the processor 410 may be specifically used to perform the processing functions necessary to implement the functions of these apparatuses and components.

[0055] It should be understood that Figure 4 The computing device 400 may include one or more processors 410, and the multiple processors 410 may provide processing capabilities in a parallel connection mode, a serial connection mode, a serial-parallel connection mode, or any connection mode, or the multiple processors 410 may form a processor sequence or a processor array, or the multiple processors 410 may be divided into a main processor and an auxiliary processor, or the multiple processors 410 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 4 The computing device 400 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 400 may include Figure 4 More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.

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

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

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

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

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

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

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

[0063] 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 L2 message forwarding method, characterized in that: The L2 message forwarding method is applied to an L2 forwarding table, the L2 forwarding table includes a nonlinear table composed of a plurality of first-level table entries and a linear table composed of a plurality of second-level table entries, the plurality of first-level table entries each include a physical address as a key segment and a virtual port address as an action segment, the plurality of second-level table entries correspond one-to-one to a plurality of elements in a bitmap composed of a first dimension and a second dimension, the first dimension indicates whether a same virtual local area network sub-interface is respectively set under a plurality of virtual function combinations of a physical function, the second dimension indicates whether a plurality of virtual local area network sub-interfaces under a same virtual function combination of a physical function are respectively set, the L2 message forwarding method includes: Look up the data message according to the nonlinear table, so as to obtain a virtual function combination of the physical function associated with the data message; The virtual function combination of the physical function associated with the data message is looked up in the linear table, so as to determine whether to forward the data message or discard the data message.

2. The L2 message forwarding method according to claim 1, characterized in that: The data length of each of the multiple first-level table entries is the sum of the data length of the physical address and the data length of the virtual port address, the number of the multiple first-level table entries is the number of multiple virtual function combinations of the physical function, and the storage space of the nonlinear table is the data length of each of the multiple first-level table entries multiplied by the number of multiple virtual function combinations of the physical function.

3. The L2 message forwarding method according to claim 2, characterized in that: Each of the multiple second-level table entries includes a set flag, the data length of each of the multiple second-level table entries is at least the data length of the set flag, the number of the multiple second-level table entries is the product of the number of multiple virtual function combinations of the physical function and the number of the multiple virtual LAN sub-interfaces, and the storage space of the linear table is the data length of each of the multiple second-level table entries multiplied by the number of the multiple second-level table entries.

4. The L2 message forwarding method according to claim 3, characterized in that: A specific second-level table entry among the multiple second-level table entries corresponds to a specific element in the bit map, and the specific element corresponds to a specific virtual function combination of the physical function among the multiple virtual function combinations of the physical function and a specific virtual LAN sub-interface among the multiple virtual LAN sub-interfaces. The set flag included in the specific second-level table entry indicates whether the specific virtual LAN sub-interface under the specific virtual function combination of the physical function is set.

5. The L2 message forwarding method according to claim 2, characterized in that: The multiple second-level table entries each include a set flag and a label protocol flag, the data length of the set flag is 1 bit, the data length of the label protocol flag is 1 bit, the data length of each of the multiple second-level table entries is 2 bits, the number of the multiple second-level table entries is the product of the number of multiple virtual function combinations of the physical function and the number of the multiple virtual LAN sub-interfaces, and the storage space of the linear table is 2 bits multiplied by the number of the multiple second-level table entries.

6. The L2 message forwarding method according to claim 5, characterized in that: A specific second-level table entry among the multiple second-level table entries corresponds to a specific element in the bit map, and the specific element corresponds to a specific virtual function combination of the physical function among the multiple virtual function combinations of the physical function and a specific virtual LAN sub-interface among the multiple virtual LAN sub-interfaces. The set flag included in the specific second-level table entry indicates whether the specific virtual LAN sub-interface under the specific virtual function combination of the physical function is set, and the label protocol flag included in the specific second-level table entry indicates that the specific virtual LAN sub-interface is a virtual LAN sub-interface supporting 0x8100 or a virtual LAN sub-interface supporting 0x88A8.

7. The L2 message forwarding method according to claim 5, characterized in that: The number of the multiple virtual function combinations of the physical function is 256, the number of the multiple virtual LAN sub-interfaces is 4096, and the storage space of the linear table is 2097152 bits.

8. The L2 message forwarding method according to claim 1, characterized in that: The lookup time for looking up the data message according to the non-linear table is determined based on the number of multiple virtual function combinations of the physical function, and the lookup time for looking up the virtual function combination of the physical function associated with the data message according to the linear table is a fixed value, and the fixed value is not associated with the number of the multiple second-level table entries of the linear table.

9. The L2 message forwarding method according to claim 1, characterized in that: The L2 forwarding table is used for layer 2 forwarding on the data link layer and adapts the link layer message format.

10. A computer device, characterized in that: The computer 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 9 when executing the computer program.

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