Flow table information recovery method and device, intelligent network card and storage medium
By using hardware forwarding table entries to forward pending service messages when the software control plane is suspended or restarted, and after the software control plane restarts, virtual service messages are constructed based on the hardware flow table, and the software flow table is regenerated, the service traffic interruption problem caused by the software control plane restart is solved, and the continuity of service traffic and the consistency of flow table information is achieved.
Patent Information
- Application Number
- CN202311872461.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2025-07-01
AI Technical Summary
During the software control plane hang or restart recovery process, the hardware flow table is cleared, resulting in interruption of service traffic and the operational service message cannot be forwarded normally.
When the software control plane is suspended or restarted, the pending service message is forwarded through the hardware forwarding table entry, and after the software control plane is restarted, a virtual service message is built based on the hardware flow table, the software flow table is regenerated, and associated with the hardware flow table to ensure the consistency of the flow table information.
By retaining the hardware flow table and building virtual service messages, the service traffic interruption during the software control plane restart is avoided, and the service messages that have been run before the software control plane hangs can be forwarded normally, ensuring the continuity of service traffic.
Smart Images

Figure CN120238424A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technologies, and in particular, to a method and apparatus for restoring flow table information, an intelligent network card, and a storage medium. Background Art
[0002] With the development of data centers, the computing power of servers has gradually become a bottleneck for business deployment. Therefore, intelligent network cards are introduced to release the computing power of servers. Software is usually deployed on intelligent network cards (such as software supporting OpenFlow, including high-quality OVS (Open VSwitch, virtual switch) for multi-layer data forwarding) as the control plane for network service traffic, and the DPDK (Data Plane Development Kit) is used in combination to accelerate forwarding. Rteflow (i.e., the standard interface in DPDK) is used to send the calculation results of the software control plane to the hardware, enabling service traffic to be forwarded through the hardware. Rteflow can provide a general way to configure the hardware to match specific incoming or outgoing traffic, and operate on it or query relevant counters according to any configuration rules of users.
[0003] During the operation of the software control plane process, the process may be suspended for various reasons. The software control plane can use the existing software ports and flow table configuration information to perform the process restart and recovery actions. For services that have been running before the OVS is suspended, during the recovery process of the software control plane process, since the hardware flow table still exists and will not be aged, packets can continue to be forwarded through the hardware flow table. After the software control plane is restarted, in order to ensure that the software table entries in the software control plane are consistent with the hardware table entries in the hardware, the software control plane will initiate an action to clear the hardware flow table, causing all service traffic to re-enter the software control plane to trigger the generation of the hardware flow table again. At this time, if the software control plane initialization is completed, the packets will trigger the generation of the hardware flow table through the software; if the software control plane has not been initialized yet, the packets will be directly discarded. Both of these situations will cause traffic interruption for services that have been forwarded through the hardware flow table before the software control plane is suspended. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a method and apparatus for restoring flow table information, an intelligent network card, and a storage medium.
[0005] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0006] In a first aspect, the present invention provides a flow table information recovery method, which is applied to an intelligent network card. The intelligent network card is deployed with a software control plane for controlling packet forwarding, and the intelligent network card further includes a hardware forwarding module for forwarding packets. The flow table information recovery method includes:
[0007] When the software control plane is currently in a suspended or restarting and recovering state, and there are hardware forwarding entries corresponding to the service packets to be processed in the hardware flow table of the hardware forwarding module, forward the service packets to be processed through the hardware forwarding entries;
[0008] When the software control plane completes restarting, the software control plane constructs virtual service packets according to the hardware flow table, regenerates a software flow table according to the virtual service packets, and associates the regenerated software flow table with the hardware flow table.
[0009] In an optional embodiment, each hardware forwarding entry in the hardware flow table has a hardware entry identifier, and the storage space corresponding to the hardware entry identifier stores matching information and action information;
[0010] The step of the software control plane constructing virtual service packets according to the hardware flow table, regenerating a software flow table according to the virtual service packets, and associating the regenerated software flow table with the hardware flow table includes:
[0011] For the hardware entry identifier of each hardware forwarding entry in the hardware flow table, the software control plane reads the matching information from the storage space corresponding to the hardware entry identifier, constructs a corresponding virtual service packet according to the matching information, regenerates a corresponding software forwarding entry based on the virtual service packet to obtain the regenerated software flow table, and associates the regenerated software flow table with the hardware flow table.
[0012] In an optional embodiment, the flow table information recovery method further includes:
[0013] The software control plane sets the aging period of each hardware forwarding entry in the hardware flow table;
[0014] For each hardware forwarding entry, if the hardware forwarding module does not use the hardware forwarding entry to forward packets within the aging period of the hardware forwarding entry, delete the hardware forwarding entry in the hardware flow table.
[0015] In an optional embodiment, the step of associating the regenerated software flow table with the hardware flow table includes:
[0016] For each software forwarding table entry in the regenerated software flow table, if there is a hardware forwarding table entry in the hardware flow table that includes the matching information of the software forwarding table entry, associate the hardware forwarding table entry with the software forwarding table entry;
[0017] If there are multiple hardware forwarding table entries in the hardware flow table that include the matching information of the software forwarding table entry, associate the multiple hardware forwarding table entries with the software forwarding table entry.
[0018] In a second aspect, the present invention provides a flow table information recovery device, which is applied to an intelligent network card. The intelligent network card is deployed with a software control plane for controlling packet forwarding, and the intelligent network card further includes a hardware forwarding module for forwarding packets. The flow table information recovery device includes:
[0019] A forwarding module, configured to forward the to-be-processed service packet through the hardware forwarding table entry when the software control plane is currently in a suspended or restart recovery state and there is a hardware forwarding table entry corresponding to the to-be-processed service packet in the hardware flow table of the hardware forwarding module;
[0020] A recovery module, configured to, when the software control plane completes restarting, construct a virtual service packet according to the hardware flow table through the software control plane, regenerate a software flow table according to the virtual service packet, and associate the regenerated software flow table with the hardware flow table.
[0021] In an optional implementation manner, each hardware forwarding table entry in the hardware flow table has a hardware table entry identifier, and the storage space corresponding to the hardware table entry identifier stores matching information and action information. The recovery module is further configured to:
[0022] For the hardware table entry identifier of each hardware forwarding table entry in the hardware flow table, read the matching information from the storage space corresponding to the hardware table entry identifier through the software control plane, construct a corresponding virtual service packet according to the matching information, and regenerate a corresponding software forwarding table entry based on the virtual service packet to obtain a regenerated software flow table, and associate the regenerated software flow table with the hardware flow table.
[0023] In an optional implementation manner, the recovery module is further configured to:
[0024] Set the aging period of each hardware forwarding table entry in the hardware flow table through the software control plane;
[0025] For each hardware forwarding table entry, if the hardware forwarding module does not use the hardware forwarding table entry to forward packets within the aging period of the hardware forwarding table entry, delete the hardware forwarding table entry in the hardware flow table.
[0026] In an alternative embodiment, the recovery module is further configured to:
[0027] For each software forwarding entry in the regenerated software flow table, if there is a hardware forwarding entry in the hardware flow table that includes the matching information of the software forwarding entry, then associate the hardware forwarding entry with the software forwarding entry;
[0028] If there are multiple hardware forwarding entries in the hardware flow table that include the matching information of the software forwarding entry, then associate the multiple hardware forwarding entries with the software forwarding entry.
[0029] In a third aspect, the present invention provides an intelligent network card, including a processor and a memory. The memory stores a computer program. When the processor executes the computer program, the flow table information recovery method according to any one of the foregoing embodiments is implemented.
[0030] In a fourth aspect, the present invention provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the flow table information recovery method according to any one of the foregoing embodiments is implemented.
[0031] The flow table information recovery method, apparatus, intelligent network card, and storage medium provided by the present invention. The intelligent network card is deployed with a software control plane for controlling packet forwarding and a hardware forwarding module for forwarding packets. When the software control plane is currently in a suspended or restart recovery state and there is a hardware forwarding entry corresponding to a service packet to be processed in the hardware flow table of the hardware forwarding module, the service packet to be processed is forwarded through the hardware forwarding entry; when the software control plane completes the restart, a virtual service packet is constructed according to the hardware flow table by the software control plane, a software flow table is regenerated according to the virtual service packet, and the regenerated software flow table is associated with the hardware flow table. Since the hardware flow table is not cleared during the flow table information recovery after the software control plane is suspended, that is, the hardware flow table always exists, the packets of the services that have been running before the software control plane is suspended can be normally forwarded through the hardware forwarding module, thereby ensuring that the service traffic is not interrupted and providing a guarantee for the normal operation of the service.
[0032] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following specific preferred embodiments are given in conjunction with the accompanying drawings and are described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings required for the embodiments. It should be understood that the following drawings only show certain embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0034] Figure 1 It shows a block diagram of the intelligent network card provided by the embodiment of the present invention;
[0035] Figure 2 It shows a flowchart of the existing flow table information recovery method;
[0036] Figure 3 It shows a flowchart of the flow table information recovery method provided by the embodiment of the present invention;
[0037] Figure 4 It shows a functional module diagram of the flow table information recovery device provided by the embodiment of the present invention.
[0038] Icon: 110 - Processor; 120 - Memory; 130 - Hardware forwarding module; 300 - Flow table information recovery device; 310 - Creation module; 330 - Forwarding module; 350 - Recovery module. Detailed implementation manners
[0039] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Usually, the components of the embodiments of the present invention described and shown in the accompanying drawings here can be arranged and designed in various different configurations.
[0040] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed present invention, but only represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0041] It should be noted that relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.
[0042] Please refer to Figure 1 , which is a block diagram of the intelligent network card provided by an embodiment of the present invention. The intelligent network card includes a processor 110, a memory 120, and a hardware forwarding module 130. Each element is electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines.
[0043] The processor 110 is used to read / write data or programs stored in the memory 120 and execute corresponding functions. It can be a general-purpose processor, including a CPU (Central Processing Unit), an NP (Network Processor), etc.; it can also be a DSP digital signal processor, an ASIC application-specific integrated circuit, an FPGA field-programmable gate array, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. And the processor 110 is deployed with a software control plane for controlling packet forwarding. Optionally, the software control plane can be OVS, or other software that can implement the function of controlling packet forwarding (such as for matching packets, executing packet processing actions, generating software table entries, and issuing hardware table entries).
[0044] The memory 120 is used to store programs or data. The memory 120 can be a RAM (Random Access Memory), a ROM (Read Only Memory), a PROM (Programmable Read-Only Memory), an EPROM (Erasable Programmable Read-Only Memory), an EEPROM (Electric Erasable Programmable Read-Only Memory), etc.
[0045] The hardware forwarding module 130 is used to forward packets to other devices according to the hardware flow table.
[0046] It can be understood that Figure 1 the structure shown is only a schematic diagram of the structure of the smart network card, and the smart network card may also include more or fewer components than those shown Figure 1 shown, or have a different configuration from that shown Figure 1 shown. Figure 1 Each component shown can be implemented by hardware, software, or a combination thereof.
[0047] It should be noted that the smart network card in the embodiment of the present invention adopts an architecture with a software control plane as the control plane of service traffic and a hardware forwarding module as the forwarding plane of service traffic.
[0048] Before introducing the flow table information recovery method provided by the embodiment of the present invention, in order to facilitate a better understanding of the improvement points of the present invention, the existing flow table information recovery methods will be introduced first. Please refer to Figure 2 , which is a schematic flow diagram of the existing flow table information recovery method.
[0049] The software control plane on the smart network card is suspended due to various reasons, which causes the information in the software flow table of the software control plane, that is, the saved software forwarding entries, to be lost. Then the software control plane enters the restart process and clears the hardware flow table of the hardware forwarding module after the restart is completed. Then the software control plane restores the information in the software flow table and reissues the hardware flow table to the hardware forwarding module.
[0050] From the process of the existing flow table information recovery method, it can be seen that since the hardware flow table used to guide the hardware forwarding module to forward packets will be cleared, and the hardware flow table needs to be redownloaded to the hardware forwarding module by the software control plane, there may be a situation where when the intelligent network card receives packets of services that have been running before the software control plane is suspended, there is no hardware flow table in the hardware forwarding module or there is no corresponding hardware forwarding entry for the packet in the hardware flow table. In this case, the intelligent network card will discard the received packets, which will cause the service traffic to be interrupted, thus affecting the operation of the service and resulting in abnormal service operation.
[0051] Therefore, the embodiment of the present invention provides a flow table information recovery method, which can ensure that the service traffic is not interrupted during the process of recovering the flow table information after the software control plane is suspended, so as to ensure the normal operation of the service. The following will introduce each step and the corresponding technical effects in the flow table information recovery method provided by the embodiment of the present invention.
[0052] Please refer to Figure 3 , which is a schematic flowchart of the flow table information recovery method provided by the embodiment of the present invention.
[0053] Step S210, when the software control plane is currently in a suspended or restart recovery state and there is a corresponding hardware forwarding entry for the service packet to be processed in the hardware flow table of the hardware forwarding module, forward the service packet to be processed through the hardware forwarding entry;
[0054] Step S212, when the software control plane completes the restart, construct a virtual service packet according to the hardware flow table through the software control plane, regenerate a software flow table according to the virtual service packet, and associate the regenerated software flow table with the hardware flow table.
[0055] For the convenience of understanding, the embodiment of the present invention provides an example, and the following will describe steps S210 and S212 in combination with this example.
[0056] For example, assume that the service packet to be processed is "Packet 1". When the intelligent network card receives "Packet 1", if the software control plane on the intelligent network card is in a suspended state at this time, it means that the software control plane has just been suspended, or if the software control plane is in a restart recovery state at this time, it means that the software control plane is in the restart process. In both cases, there is still a hardware flow table in the hardware forwarding module. If there is a corresponding hardware forwarding entry for "Packet 1" in the hardware flow table, it means that "Packet 1" is a packet of a service that has been running before the software control plane is suspended, then "Packet 1" can be forwarded through the hardware forwarding module according to the corresponding hardware forwarding entry of "Packet 1".
[0057] When the software control plane completes the restart process, the embodiments of the present invention do not clear the hardware flow table according to the existing implementation method but retain the hardware flow table. Then, the software control plane constructs virtual service packets based on the hardware flow table, regenerates the software flow table according to the virtual service packets, and associates the regenerated software flow table with the hardware flow table.
[0058] It can be understood that during the process of restoring the flow table information after the software control plane is suspended, the embodiments of the present invention do not clear the hardware flow table in the hardware forwarding module but retain it, and construct virtual service packets through the hardware flow table to regenerate the software flow table to restore the software flow table information. Since the hardware flow table in the hardware forwarding module always exists during this period, the packets of the services that have been running before the software control plane is suspended can be normally forwarded through the hardware forwarding module, thus ensuring that the service traffic will not be interrupted and providing guarantee for the normal operation of the services.
[0059] It can be seen that based on the above steps, the intelligent network card is deployed with a software control plane for controlling packet forwarding and a hardware forwarding module for forwarding packets. When the software control plane is currently in a suspended or restart - recovered state and there are hardware forwarding entries corresponding to the service packets to be processed in the hardware flow table of the hardware forwarding module, the service packets to be processed are forwarded through the hardware forwarding entries; when the software control plane completes the restart, the software control plane constructs virtual service packets according to the hardware flow table, regenerates the software flow table according to the virtual service packets, and associates the regenerated software flow table with the hardware flow table. Since the hardware flow table is not emptied during the period of restoring the flow table information after the software control plane is suspended, that is, the hardware flow table always exists, the packets of the services that have been running before the software control plane is suspended can be normally forwarded through the hardware forwarding module, thus ensuring that the service traffic will not be interrupted and providing guarantee for the normal operation of the services.
[0060] Optionally, before step S210, the embodiments of the present invention provide a possible implementation method.
[0061] Step S202, when receiving the service packet to be processed for the first time, if the software control plane is currently in a normal running state, the software control plane generates a software forwarding entry corresponding to the service packet to be processed according to the matching information and action information corresponding to the service packet to be processed, and forwards the service packet to be processed according to the software forwarding entry corresponding to the service packet to be processed;
[0062] Step S204, the software control plane generates a hardware forwarding entry corresponding to the service packet to be processed according to the matching information and action information corresponding to the service packet to be processed, and sends the hardware forwarding entry corresponding to the service packet to be processed to the hardware forwarding module to be saved in the hardware flow table.
[0063] It can be understood that since the service message to be processed is the message of a service that has already been running before the software control plane is suspended, then before step S210, there are respectively software forwarding entry items and hardware forwarding entry items corresponding to the service message to be processed in the software flow table of the software control plane and the hardware flow table of the hardware forwarding module. The process of creating the software forwarding entry item and the hardware forwarding entry item corresponding to the service message to be processed will be introduced below.
[0064] In this embodiment, the software control plane is provided with configuration items corresponding to multiple service messages. The configuration item includes matching information, i.e., Match information, and action information, i.e., Action information. The matching information is used to identify a specific message, and the action information is used to indicate performing corresponding operations such as forwarding and discarding on the identified specific message. It should be understood that the matching information and the action information can be set according to the actual situation, and the embodiments of the present invention do not limit them.
[0065] For the convenience of understanding, the above example is continued for illustration. For example, through the way of manual configuration or the way of being issued by the cloud management platform, the configuration item corresponding to the service message to be processed, i.e., "message 1", such as "configuration item 1", can be set in the software control plane of the intelligent network card. It includes the matching information corresponding to "message 1", such as the matching incoming port is port A and the source IP address is 192.168.1.1, and the action information corresponding to "message 1" is to be forwarded through port B.
[0066] When "message 1" is received for the first time, since there is no hardware forwarding entry item corresponding to "message 1" in the hardware flow table, it cannot be forwarded through the hardware forwarding module.
[0067] If the software control plane is in a normal running state at this time, then the software control plane can generate a software forwarding entry item corresponding to "message 1", such as "software forwarding entry item 1", according to the matching information and action information of "configuration item 1" corresponding to "message 1", and set the software table item identifier of "software forwarding entry item 1" to 0x7771. Then, the software control plane forwards "message 1" through port B according to "software forwarding entry item 1".
[0068] Next, the software control plane generates a hardware forwarding entry item corresponding to "message 1", such as "hardware forwarding entry item 1", according to the matching information and action information corresponding to "message 1" and the characteristic information of "message 1" itself, and sets the hardware table item identifier of "hardware forwarding entry item 1" to 0xffffff01, and associates "software forwarding entry item 1" with "hardware forwarding entry item 1", and then issues "hardware forwarding entry item 1" to the hardware flow table of the hardware forwarding module, so that subsequent service messages with the same characteristic information as "message 1" are forwarded through port B using "hardware forwarding entry item 1".
[0069] It should be specifically noted that for the software forwarding table entries and hardware forwarding table entries established in association, in addition to including the matching information in the software forwarding table entries, the matching information in the hardware forwarding table entries generally has more matching information than that in the software forwarding table entries, and their action information is the same. For example, if the matching information in the configuration item is the source IP address range, the matching information in the software forwarding table entry is a specific source IP address. When establishing the associated hardware forwarding table entry, in addition to including the matching information of a specific source IP address in the software forwarding table entry, the hardware forwarding table entry also includes other packet characteristics information required for chip forwarding (such as layer 2 port information, layer 3 destination IP address, layer 4 protocol port number, etc.). Therefore, the present invention takes advantage of this point. In the case where the software control plane is suspended and the software flow table information is lost, the virtual service packets can be constructed using the hardware forwarding table entries in the hardware flow table, thereby triggering the regeneration of the software forwarding table entries to restore the software flow table information.
[0070] Optionally, after step S204, an embodiment of the present invention provides a possible implementation manner.
[0071] Step S206, set the aging period of the hardware forwarding table entry corresponding to the service packet to be processed through the software control plane;
[0072] Step S208, if the hardware forwarding module does not use the hardware forwarding table entry corresponding to the service packet to be processed to forward packets within the aging period, delete the hardware forwarding table entry corresponding to the service packet to be processed in the hardware flow table.
[0073] It can be understood that since the hardware forwarding table entries in the hardware flow table are stored in the hardware forwarding module, and the available resources of the hardware forwarding module will affect the forwarding performance of the smart network card. To save the resources of the hardware forwarding module and ensure the forwarding performance of the smart network card, the embodiment of the present invention also sets an aging mechanism for the hardware flow table.
[0074] For the sake of easy understanding, continue to illustrate with the above example. After the software control plane generates the hardware forwarding table entry corresponding to "Packet 1", that is, "Hardware Forwarding Table Entry 1", it will also set the aging period for it by setting a timer. Then for the subsequent received "Packet 1", since there is "Hardware Forwarding Table Entry 1" in the hardware flow table, "Packet 1" can be directly forwarded to port B through the hardware forwarding module.
[0075] The software control plane can read the hit situation of "Hardware Forwarding Table Entry 1" within its aging period to determine whether to age "Hardware Forwarding Table Entry 1". If "Hardware Forwarding Table Entry 1" is not hit within its aging period, it means that the hardware forwarding module did not use "Hardware Forwarding Table Entry 1" to forward packets within the aging period of "Hardware Forwarding Table Entry 1", then "Hardware Forwarding Table Entry 1" is deleted to leave more available resources for the hardware forwarding module.
[0076] If "Hardware Forwarding Table Entry 1" is hit within its aging period, it means that the hardware forwarding module used "Hardware Forwarding Table Entry 1" to forward packets within the aging period of "Hardware Forwarding Table Entry 1", then "Hardware Forwarding Table Entry 1" is retained, and its aging period is set again to re-determine whether it needs to be deleted.
[0077] It should be noted that the aging mechanism of the hardware flow table can be set according to the actual situation. The above aging mechanism is only an example and does not limit the present invention.
[0078] Optionally, for step S212, an embodiment of the present invention provides a possible implementation manner, that is: for the hardware table entry identifier of each hardware forwarding table entry in the hardware flow table, the software control plane reads the matching information from the storage space corresponding to the hardware table entry identifier, constructs a corresponding virtual service packet according to the matching information, and regenerates the corresponding software forwarding table entry based on the virtual service packet to obtain the regenerated software flow table, and associates the regenerated software flow table with the hardware flow table.
[0079] In this embodiment, each hardware forwarding table entry in the hardware flow table has a hardware table entry identifier, and the storage space corresponding to the hardware table entry identifier stores matching information and action information. As mentioned above, since the matching information in the hardware forwarding table entry of the same packet includes not only the matching information of the corresponding software forwarding table entry but also other characteristic information of the packet, then the software forwarding table entry corresponding to the packet of the service that was running before being suspended in the software control plane can be regenerated according to the matching information in the hardware forwarding table entry to restore the software flow table information.
[0080] For the convenience of understanding, the above example is continued for description. The software control plane re-obtains the configuration item corresponding to each service packet through the self-recovery process. When the software control plane re-obtains the configuration item corresponding to each service packet, the restart is completed. Then the software control plane can read out the content from the storage space corresponding to each hardware table entry identifier in sequence according to the range of the hardware table entry identifiers of all hardware forwarding table entries in the hardware flow table, such as 0xffffff01 - 0xffffffff, to regenerate the software flow table.
[0081] It can be understood that, for the processing method of each hardware table entry identifier, for the sake of brevity, hereinafter, the hardware table entry identifier of the hardware forwarding table entry corresponding to "Message 1", i.e., "Hardware Forwarding Table Entry 1", which is 0xffffff01, will be used as an example for illustration.
[0082] The software control plane determines the storage space corresponding to the hardware table entry identifier 0xffffff01, such as "Storage Space 1", in the hardware forwarding module, then reads out the matching information of "Hardware Forwarding Table Entry 1" from "Storage Space 1", and constructs a corresponding virtual service message, such as "Virtual Message 1", according to the matching information.
[0083] Then, "Virtual Message 1" is used as the first received service message and the corresponding process is executed to regenerate the software forwarding table entry corresponding to "Virtual Message 1", that is, to restore the software forwarding table entry corresponding to "Message 1", i.e., "Software Forwarding Table Entry 1", and then by triggering the regeneration of the hardware forwarding table entry corresponding to "Virtual Message 1", to associate "Hardware Forwarding Table Entry 1" with the restored "Software Forwarding Table Entry 1".
[0084] Processing each hardware table entry identifier in a similar manner can regenerate the software forwarding table entry corresponding to each message of the service that was running before being suspended in the software control plane, that is, obtain the regenerated software flow table and associate the regenerated software flow table with the hardware flow table.
[0085] Optionally, after step S212, an embodiment of the present invention provides a possible implementation manner.
[0086] Step S214, set the aging period of each hardware forwarding table entry in the hardware flow table through the software control plane;
[0087] Step S216, for each hardware forwarding table entry, if the hardware forwarding module does not use the hardware forwarding table entry to forward messages within the aging period of the hardware forwarding table entry, delete the hardware forwarding table entry in the hardware flow table.
[0088] It can be understood that after the software control plane regenerates the software flow table and associates the regenerated software flow table with the hardware flow table, it will also reset the aging mechanism for the hardware flow table to update the status of the hardware forwarding table entries in the hardware flow table. Based on the deletion mechanism adopted in the above steps S206 and S208, an embodiment of the present invention provides a corresponding way to reset the aging mechanism.
[0089] In this embodiment, the software control plane can reset the aging period of each hardware forwarding entry by resetting the aging timer for each hardware forwarding entry. For each hardware forwarding entry, the software control plane can determine whether to delete the hardware forwarding entry by reading the hit situation of the hardware forwarding entry during its aging period.
[0090] For ease of understanding, the following continues to use "hardware forwarding entry 1" as an example for illustration. The software control plane resets the aging period of "hardware forwarding entry 1" to 10 seconds, and the software control plane reads whether "hardware forwarding entry 1" is hit once per second.
[0091] If "hardware forwarding entry 1" is not hit within its aging period of 10 seconds, it means that the hardware forwarding module has not used "hardware forwarding entry 1" to forward packets within these 10 seconds. Then, "hardware forwarding entry 1" is deleted to leave more available resources for the hardware forwarding module.
[0092] If "hardware forwarding entry 1" is hit within its aging period of 10 seconds, it means that the hardware forwarding module has used "hardware forwarding entry 1" to forward packets within these 10 seconds. Then, "hardware forwarding entry 1" is retained, and its aging period is set again to re-determine whether it needs to be deleted.
[0093] Optionally, for the process of associating the newly generated software flow table with the hardware flow table in step S212, the embodiment of the present invention provides a possible implementation manner, that is: for each software forwarding entry in the newly generated software flow table, if there is a hardware forwarding entry in the hardware flow table that includes the matching information of the software forwarding entry, then the hardware forwarding entry is associated with the software forwarding entry; if there are multiple hardware forwarding entries in the hardware flow table that include the matching information of the software forwarding entry, then the multiple hardware forwarding entries are associated with the software forwarding entry.
[0094] It can be understood that for each software forwarding entry in the newly generated software flow table, it may have a mapping relationship with one hardware forwarding entry or may have a mapping relationship with multiple hardware forwarding entries.
[0095] For the sake of easy understanding, the following continues to take the above-mentioned "software forwarding entry 1" as an example for illustration. For the "software forwarding entry 1" in the newly generated software flow table, if there is only one hardware forwarding entry in the hardware flow table, such as "hardware forwarding entry 1" including the matching information of "software forwarding entry 1", then "hardware forwarding entry 1" is associated with "software forwarding entry 1". If there are multiple hardware forwarding entries in the hardware flow table, such as both "hardware forwarding entry 1" and "hardware forwarding entry 2" including the matching information of "software forwarding entry 1", then "hardware forwarding entry 1" and "hardware forwarding entry 2" are associated with "software forwarding entry 1".
[0096] Process each software forwarding entry in the newly generated software flow table in a similar manner, and then the newly generated software flow table can be associated with the hardware flow table.
[0097] It should be noted that the "configuration item 1", "message 1", "software forwarding entry 1", "hardware forwarding entry 1" and "hardware forwarding entry 2", hardware entry identifier, software entry identifier, etc. in the embodiments of the present invention are only for illustrative purposes and do not limit the present invention. To execute the corresponding steps in the above embodiments and various possible manners, the following gives an implementation manner of a flow table information recovery device. Please refer to Figure 4 , Figure 4 which is a functional module diagram of a flow table information recovery device 300 provided by an embodiment of the present invention. It should be noted that the basic principle and the technical effects generated by the flow table information recovery device 300 provided in this embodiment are the same as those in the above embodiments. For the sake of brief description, for the parts not mentioned in this embodiment, reference can be made to the corresponding content in the above embodiments. The flow table information recovery device 300 includes:
[0098] A forwarding module 330, configured to, when receiving a service message to be processed, if the software control plane is currently in a suspended or self-recovering state and there is a hardware forwarding entry corresponding to the service message to be processed in the hardware flow table of the hardware forwarding module, forward the service message to be processed through the hardware forwarding module according to the hardware forwarding entry corresponding to the service message to be processed;
[0099] A recovery module 350, configured to, when the software control plane completes self-recovery, construct a virtual service message according to the hardware flow table through the software control plane, regenerate a software flow table according to the virtual service message, and associate the regenerated software flow table with the hardware flow table.
[0100] Optionally, the flow table information recovery device 300 further includes a creation module 310. The creation module 310 is configured to: when receiving a service message to be processed for the first time, if the software control plane is currently in a normal operating state, generate a software forwarding entry corresponding to the service message to be processed through the software control plane according to the matching information and action information corresponding to the service message to be processed, and forward the service message to be processed according to the software forwarding entry corresponding to the service message to be processed; generate a hardware forwarding entry corresponding to the service message to be processed through the software control plane according to the matching information and action information corresponding to the service message to be processed, and send the hardware forwarding entry corresponding to the service message to be processed to the hardware forwarding module to be saved in the hardware flow table.
[0101] Optionally, the creation module 310 is further configured to: set the aging period of the hardware forwarding entry corresponding to the service message to be processed through the software control plane; if the hardware forwarding module does not use the hardware forwarding entry corresponding to the service message to be processed to forward a message within the aging period, delete the hardware forwarding entry corresponding to the service message to be processed from the hardware flow table.
[0102] Optionally, the recovery module 350 is further configured to: for the hardware entry identifier of each hardware forwarding entry in the hardware flow table, read the matching information from the storage space corresponding to the hardware entry identifier through the software control plane, construct a corresponding virtual service message according to the matching information, and regenerate the corresponding software forwarding entry and the corresponding hardware forwarding entry based on the virtual service message, so as to regenerate the software flow table and associate the regenerated software flow table with the hardware flow table.
[0103] Optionally, the recovery module 350 is further configured to: set the aging period of each hardware forwarding entry in the hardware flow table through the software control plane; for each hardware forwarding entry, if the hardware forwarding module does not use the hardware forwarding entry to forward a message within the aging period of the hardware forwarding entry, delete the hardware forwarding entry from the hardware flow table.
[0104] Optionally, the recovery module 350 is further configured to: for each software forwarding entry in the regenerated software flow table, if there is a hardware forwarding entry in the hardware flow table that includes the matching information of the software forwarding entry, associate the hardware forwarding entry with the software forwarding entry; if there are multiple hardware forwarding entries in the hardware flow table that include the matching information of the software forwarding entry, associate the multiple hardware forwarding entries with the software forwarding entry.
[0105] An embodiment of the present invention further provides an intelligent network card, including a processor and a memory. The memory stores a computer program. When the processor executes the computer program, the flow table information recovery method disclosed in the embodiment of the present invention is implemented.
[0106] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the flow table information recovery method disclosed in the embodiment of the present invention is implemented.
[0107] In summary, the flow table information recovery method, device, intelligent network card, and storage medium provided by the present invention have the following beneficial effects: (1) During the process of recovering flow table information in the software control plane of the present invention, it can ensure that the traffic of services that have already been running before the software control plane is suspended is not interrupted; (2) The present invention can be compatible with the original normal service traffic forwarding process, and only controls abnormal situations where the software control plane is suspended, which can ensure the stable operation of services; (3) The main overhead of the present invention is on the software, that is, the software control plane side, which can ensure that service traffic can be normally forwarded by the hardware, that is, the hardware forwarding module; (4) The present invention is not aware of the service traffic state and is applicable to service traffic in the second, third, and fourth layers of TCP / IP (Transmission Control Protocol / Internet Protocol).
[0108] In several embodiments provided by the present invention, it should be understood that the disclosed device and method can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0109] In addition, each functional module in each embodiment of the present invention can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.
[0110] When the above-mentioned functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0111] The foregoing are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for restoring flow table information, characterized in that, Applied to a smart network card, the smart network card is deployed with a software control plane for controlling packet forwarding, and the smart network card further includes a hardware forwarding module for forwarding packets. The flow table information recovery method includes: When the software control plane is currently in a suspended or restart recovery state and there are hardware forwarding entries corresponding to the service packets to be processed in the hardware flow table of the hardware forwarding module, forward the service packets to be processed through the hardware forwarding entries; When the software control plane completes restarting, construct virtual service packets according to the hardware flow table through the software control plane, regenerate software flow tables according to the virtual service packets, and associate the regenerated software flow tables with the hardware flow tables.
2. The method for restoring flow table information according to claim 1, wherein Each hardware forwarding entry in the hardware flow table has a hardware entry identifier, and the storage space corresponding to the hardware entry identifier stores matching information and action information; The step of constructing virtual service packets according to the hardware flow table through the software control plane, regenerating software flow tables according to the virtual service packets, and associating the regenerated software flow tables with the hardware flow tables includes: For the hardware entry identifier of each hardware forwarding entry in the hardware flow table, read the matching information from the storage space corresponding to the hardware entry identifier through the software control plane, construct the corresponding virtual service packet according to the matching information, and regenerate the corresponding software forwarding entry based on the virtual service packet to obtain the regenerated software flow table, and associate the regenerated software flow table with the hardware flow table.
3. The flow table information recovery method according to claim 2, wherein The flow table information recovery method further includes: Set the aging period of each hardware forwarding entry in the hardware flow table through the software control plane; For each hardware forwarding entry, if the hardware forwarding module does not use the hardware forwarding entry to forward packets within the aging period of the hardware forwarding entry, delete the hardware forwarding entry in the hardware flow table.
4. The method for restoring flow table information according to claim 2, wherein The step of associating the regenerated software flow table with the hardware flow table includes: For each software forwarding entry in the regenerated software flow table, if there is a hardware forwarding entry in the hardware flow table that includes the matching information of the software forwarding entry, associate the hardware forwarding entry with the software forwarding entry; If there are multiple hardware forwarding entries in the hardware flow table that include the matching information of the software forwarding entry, associate the multiple hardware forwarding entries with the software forwarding entry.
5. A flow table information recovery device, characterized in that, Applied to a smart network card, the smart network card is deployed with a software control plane for controlling packet forwarding, and the smart network card further includes a hardware forwarding module for forwarding packets. The flow table information recovery device includes: A forwarding module, configured to forward the service packets to be processed through the hardware forwarding entries when the software control plane is currently in a suspended or restart recovery state and there are hardware forwarding entries corresponding to the service packets to be processed in the hardware flow table of the hardware forwarding module; A recovery module, configured to, when the software control plane completes restarting, construct virtual service packets through the software control plane according to the hardware flow table, regenerate a software flow table based on the virtual service packets, and associate the regenerated software flow table with the hardware flow table.
6. The flow table information restoration device according to claim 5, characterized in that, Each hardware forwarding entry in the hardware flow table has a hardware entry identifier, and the storage space corresponding to the hardware entry identifier stores matching information and action information. The recovery module is further configured to: For the hardware entry identifier of each hardware forwarding entry in the hardware flow table, read the matching information from the storage space corresponding to the hardware entry identifier through the software control plane, construct a corresponding virtual service packet according to the matching information, regenerate a corresponding software forwarding entry based on the virtual service packet to obtain a regenerated software flow table, and associate the regenerated software flow table with the hardware flow table.
7. The flow table information recovery device according to claim 6, characterized in that The recovery module is further configured to: Set the aging period of each hardware forwarding entry in the hardware flow table through the software control plane; For each hardware forwarding entry, if the hardware forwarding module does not use the hardware forwarding entry to forward packets within the aging period of the hardware forwarding entry, delete the hardware forwarding entry from the hardware flow table.
8. The flow table information restoration device according to claim 6, characterized in that The recovery module is further configured to: For each software forwarding entry in the regenerated software flow table, if there is a hardware forwarding entry in the hardware flow table that includes the matching information of the software forwarding entry, associate the hardware forwarding entry with the software forwarding entry; If there are multiple hardware forwarding entries in the hardware flow table that include the matching information of the software forwarding entry, associate the multiple hardware forwarding entries with the software forwarding entry.
9. An intelligent network card, characterized in that, It includes a processor and a memory. The memory stores a computer program. When the processor executes the computer program, it implements the flow table information recovery method according to any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, it implements the flow table information recovery method according to any one of claims 1 to 4.