A method, system, device and readable storage medium for flow table aging control

A flow linkage table on Smart NICs efficiently manages OVS operations by ordering data flow access and aging out inactive entries, addressing CPU and bandwidth bottlenecks in high-virtualization environments.

CN116016313BActive Publication Date: 2025-07-15SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211712121.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2025-07-15
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

When offloading OVS to smart network cards, the traditional flow table aging method causes SOC CPU performance bottlenecks and DDR/PCIe bandwidth usage by periodically polling the flow tracking table, especially inefficient in large-scale flow table entries, affecting the processing of normal data flows.

Method used

Build a stream link table, sort it in the order of the data flow generated through the bidirectional linked list structure, automatically aging the timeout stream table entries, reducing the frequent read and write of SOC CPU polling and CT tables.

Benefits of technology

It significantly improves the flow table aging efficiency, reduces SOC CPU consumption and DDR/PCIe bandwidth usage, supports automatic hardware aging, and provides better real-time and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016313B_ABST
    Figure CN116016313B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of computer network transmission, and particularly relates to a flow table aging control method, system, device and readable storage medium. The method includes: constructing a flow link table according to the sequence of data flow generation, and establishing a corresponding connection between the flow link table and the corresponding elements in the corresponding record table; starting from the head of the flow link table, judging whether the generation time of the data flow in the flow link table is greater than a predetermined time; in response to the generation time of the corresponding data flow being greater than the predetermined time, clearing the data flow from the corresponding record table and the flow link table. Through the flow table aging control method proposed by the present invention, the access order of the flow table is sorted by the created flow link table, so that the aging detection is targeted, avoiding a large number of invalid polling operations of the CPU on the SOC, significantly reducing the CPU consumption, without frequent reading and writing of the CT table, and at the same time releasing the bandwidth occupation of PCIe and DDR, supporting automatic aging and software aging of the hardware, being flexible and friendly, and allowing users to choose by themselves.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer network transmission, and particularly relates to a flow table aging control method, system, device and readable storage medium. Background Art

[0002] In a highly virtualized environment, the traditional host CPU needs to run tasks related to OVS (Open Virtual Switch, the official website is www.openswitch.org), and at the same time, the CPU also needs to process operations such as storage, encryption and decryption of data packets, in-depth inspection of data packets, firewalls, and complex routing. These operations not only consume a large amount of CPU resources, but also due to the competition for CPU resources between different services, the performance of the services cannot be optimized to the best. As a hub connecting various services, the network card has become the most ideal place to accelerate the above services. The emergence of the Smart NIC provides a new idea to solve this problem. We can unload the OVS operations from the CPU through the Smart NIC and complete various functions such as storage acceleration, data encryption, deep packet detection, and complex routing, returning a large number of CPU cycles spent on processing these workloads to the host, ensuring that the server CPU can provide the maximum processing capacity for applications, or provide more virtual machine (VM, Virtual Machine) services.

[0003] If the OVS is unloaded to the hardware, whether it can be accelerated through the Fast path (the path where the processing and forwarding of data packets do not require the participation of the Host (referring to the CPU of the host, that is, the CPU on the server) or the SOC (System on chip, that is, the on-chip system, in this article, referring to the on-board processor of the Smart NIC) software) depends crucially on whether it can match and hit the FT (Flow Table). However, the DDR storage space is limited, so only recently active flow table entries can be saved, and the idle and old data flow table entries need to be aged in a timely manner. The general method is that the SOC software periodically polls the CT (Conntrack table, flow tracking table) table through registers to check the activity status of the data flow, perform timestamp detection, and determine whether this flow has exceeded the set time threshold in the idle state. If so, perform aging processing, delete the corresponding flow table entry (FT), and the flow tracking table entry.

[0004] However, in practical applications, for flow table entries with a scale exceeding one million, since the SOC needs to periodically poll the entire CT table through the inband CSR interface, this repeated polling method, although simple in process, is very inefficient, causing a large amount of waste of SOC CPU time. The performance of the SOC CPU will become a bottleneck. At the same time, the frequent read and write of the CT table will also occupy additional DDR bandwidth and PCIe bandwidth, and even cause blockage of normal data streams.

[0005] Therefore, an effective solution is urgently needed. Summary of the Invention

[0006] To solve the above problems, the present invention proposes a flow table aging control method, including:

[0007] Construct a flow link table according to the order of generation of data streams, and establish a corresponding connection between the flow link table and the corresponding elements in the corresponding record table;

[0008] Starting from the head of the flow link table, judge whether the generation time of the data stream in the flow link table is greater than a predetermined time;

[0009] In response to the generation time of the corresponding data stream being greater than the predetermined time, clear the data stream from the corresponding record table and the flow link table.

[0010] In some embodiments of the present invention, the method further includes:

[0011] In response to the generation of a data stream, judge whether the data stream exists in the record table;

[0012] In response to the data stream existing in the record table, update the position of the data stream in the flow link table to the end of the table.

[0013] In some embodiments of the present invention, the method further includes:

[0014] In response to the flow table in the record table not recording the data stream, append the data stream to the end of the flow link table.

[0015] In some embodiments of the present invention, constructing a flow link table according to the order of generation of data streams and establishing a corresponding connection between the flow link table and the corresponding elements in the corresponding record table includes:

[0016] Construct the flow link table according to the order of data streams recorded in the flow tracking table in the record table and the time stamps of the data streams, and add the index of the corresponding data stream in the flow link table to the information of the corresponding data stream in the flow tracking table.

[0017] In some embodiments of the present invention, the method further includes:

[0018] Construct the flow link table according to the data flow in the flow trace table and the order of timestamps of the data flow, and use the index of the flow trace table and the flow table as the index of the flow link table and the flow table.

[0019] In some embodiments of the present invention, constructing the flow link table according to the order of generation of the data flow and establishing a corresponding connection between the corresponding elements in the flow link table and the corresponding record table includes:

[0020] Construct the flow link table according to the order of the data flow in the flow table, and add the generation time of the data flow in the flow table to the flow link table.

[0021] In some embodiments of the present invention, the method further includes:

[0022] Construct a bidirectional flow trace linked list according to the order of the data flow in the flow table;

[0023] Starting from the head of the bidirectional flow trace linked list, obtain the timestamp of the corresponding data flow in the bidirectional flow trace linked list, and determine whether the difference between the timestamp and the current time is greater than a predetermined time;

[0024] In response to the difference being greater than the predetermined time, delete the corresponding data flow from the bidirectional flow trace linked list.

[0025] Another aspect of the present invention also proposes a flow table aging control system, including:

[0026] A flow link table management module configured to construct a flow link table according to the order of generation of the data flow and establish a corresponding connection between the corresponding elements in the flow link table and the corresponding record table;

[0027] A flow link table control module configured to determine whether the generation time of the data flow in the flow link table is greater than a predetermined time starting from the head of the flow link table;

[0028] A flow link table clearing module configured to, in response to the generation time of the corresponding data flow being greater than the predetermined time, clear the data flow from the corresponding record table and the flow link table.

[0029] Yet another aspect of the present invention also proposes a computer device, including:

[0030] At least one processor; and

[0031] A memory that stores computer instructions executable on the processor, and when the instructions are executed by the processor, the steps of the method according to any one of the above embodiments are implemented.

[0032] Another aspect of the present invention further provides a computer-readable storage medium that stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of the above embodiments are implemented.

[0033] Through a flow table aging control method, system, device, and readable storage medium proposed by the present invention, the access order of the flow table is sorted by the created flow link table, so that the aging detection is targeted, avoiding a large number of invalid polling operations of the CPU on the SOC, significantly reducing the CPU consumption, without frequently reading and writing the CT table, and at the same time releasing the bandwidth occupation of PCIe and DDR, supporting automatic aging of the hardware, having better real-time performance, and also supporting traditional software aging, being flexible and user-friendly, and the user can choose by himself. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0035] Figure 1 It is a schematic flowchart of a method for a flow table aging control method provided by an embodiment of the present invention;

[0036] Figure 2 It is a schematic structural diagram of a flow table aging control system provided by an embodiment of the present invention;

[0037] Figure 3 It is a schematic structural diagram of a computer device provided by an embodiment of the present invention;

[0038] Figure 4 It is a schematic structural diagram of a computer-readable storage medium provided by an embodiment of the present invention.

[0039] Figure 5 It is a relationship diagram of the prior art OVS in a network data processing system provided by an embodiment of the present invention;

[0040] Figure 6 It is a schematic flowchart of the packet processing of OVS provided by an embodiment of the present invention;

[0041] Figure 7Schematic diagram of the relationship among three record tables for a flow table aging control method provided by an embodiment of the present invention;

[0042] Figure 8 Schematic diagram of adding a new element and index to the tail of a flow link table provided by an embodiment of the present invention;

[0043] Figure 9 Schematic diagram of adding a new element to a flow link table provided by an embodiment of the present invention;

[0044] Figure 10 Schematic diagram of the linked list change when elements in a flow link table provided by an embodiment of the present invention are updated to the table tail;

[0045] Figure 11 Schematic diagram of elements in a flow link table provided by an embodiment of the present invention being updated to the table tail;

[0046] Figure 12 Schematic diagram of the linked list change when elements in a flow link table provided by an embodiment of the present invention are aged and deleted;

[0047] Figure 13 Schematic diagram of the process when elements in a flow link table provided by an embodiment of the present invention are aged and deleted;

[0048] Figure 14 Schematic diagram of the overall hardware design for flow table aging control provided by an embodiment of the present invention. Detailed implementation manners

[0049] To make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the following further elaborates on the embodiments of the present invention in detail with reference to specific embodiments and the accompanying drawings.

[0050] It should be noted that all the expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two entities or parameters with the same name but different identities. It can be seen that "first" and "second" are only for the convenience of expression and should not be construed as limitations on the embodiments of the present invention. This will not be elaborated one by one in the subsequent embodiments.

[0051] The present invention aims to solve the problem of excessive dependence on querying the flow tracking table in the traditional implementation method during the flow table forwarding process of the OVS system, resulting in a large waste of data bandwidth and CPU resources in the SOC.

[0052] Traditional OVS in scenarios such as SmartNIC (which, in addition to being able to perform the network transmission functions of a standard network card, also provides a built-in programmable and configurable hardware acceleration engine to improve the performance of applications), DPU, etc. Figure 5As shown in the figure, OVS is implemented in FPGA / ASIC in a hardware manner. The OVS subsystem is a multi-layer virtual switch that follows the Open vSwitch specification and is responsible for parsing, processing, and forwarding data packets between each Interface of the smart network card. The Host PCIe interface is used to communicate with the server host CPU, and the SoC PCIe interface is used to communicate with the SoC processor on the SmartNIC board. The SoC processes all storage accesses, low-speed channel accesses of OVS, in-band network management, and board-level management. MAC0 and MAC1 are external network ports. In addition, OVS has two DDR interfaces externally, which are used to store the flow table (Flowtable) and the connection tracking table (CT table) of OVS respectively.

[0053] The OVS subsystem processes all known flows according to the preset flow table forwarding rules to perform network service switching, and this switching is completed between the Ethernet port and the virtio-net device directly connected to the host. The OVS subsystem will first parse and classify the packets, extract the flow ID, and then search for it in the flow table according to the flow ID. If the corresponding entry is not found in the flow table, the packet will be forwarded to the SoC processor for processing. If the corresponding entry is found in the flow table, the OVS system will perform corresponding processing according to the specified actions in the entry. The supported processing operations include: packet modification, packet forwarding, and packet discarding. In short, if the received packet is known, OVS directly performs hardware processing, that is, the fast path; otherwise, it is Unknown (such as the first packet of a data stream, in-band management packet), and it will be forwarded to the SoC for software processing, that is, the slow path.

[0054] Secondly, the OVS subsystem will also forward storage-type packets and in-band packets to the SoC processor for processing. The definitions of the Fast path and slow Path supported by OVS are as described in the previous text.

[0055] In addition, for newly established TCP connections or newly initiated UDP data streams, there is no completely matching OVS flow table in OVS. At this time, when the SmartNIC receives a TCP or UDP packet, it will default to forwarding the packet to the SOC for software processing, that is, the Slow path. The SOC generates corresponding entries according to the routing rules that the network card needs to follow for this connection and data stream and downloads them to OVS, that is, establishes the FT and CT tables. Then the SOC sends the received packet to OVS for routing again. Because the flow table has been established, OVS will correctly process and forward the packet according to the rules and take the Fast path.

[0056] Specifically, such as Figure 6As shown below, the processing flow of OVS data packets is as follows:

[0057] 1) The data packet enters from MAC or PCIe and is sent to the Parser module of OVS for parsing the data packet header. Meanwhile, the original data packet is sent to the Package buffer for buffering.

[0058] 2) The Lookup module receives the data packet header information, selects the processing action of the packet according to the lookup result in the flow table in the DDR, and sends the data packet sending request containing the packet header information and the processing action to the Flow_tracker module.

[0059] 3) The Flow_tracker module is responsible for the maintenance of CT and updates the records of the corresponding data flow in the DDR. For example, the number of data packets, the total amount of transmitted data, timestamp information, etc.

[0060] 4) The TxQ Scheduler sorts and arranges the data packet sending requests and sends them to the PackageBuffer module in sequence.

[0061] 5) The Modify module, that is, the packet modifier, receives the data packet sending request and the original data packet from the Package Buffer. And it performs corresponding processing according to the processing action in the request to generate a new data packet. The new data packet is sent to the virtio device of MAC or PCIe for sending.

[0062] 6) The Inband CSR, that is, the in-band management module, can update the flow table (FT) and the connection tracking table (CT) using the in-band path.

[0063] The Flow tracker module is responsible for tracking the state of the flow. When a data packet flows through OVS, the Flow Tracker retrieves a certain Flow Tracker entry on the DDR according to the Index obtained by the exact match of the previous-level flow table query, and queries, updates and writes back the FlowTracker entry. The SOC software can access the records of the flows in the FlowTracker table through the inband CSR register interface to know the state of the flows. The CT table supports recording the state of the data packet flow (flowtracking), including the number of data packets flowing through, the total length of the data packets, and the timestamp of the most recent data packet flowing through.

[0064] In summary, when offloading OVS to hardware in the traditional implementation method, whether it can be accelerated through the Fast path depends on whether it can match and hit the FT table. However, the DDR storage space is limited, so only the recently active flow table entries can be saved, and the idle and old data flow table entries need to be aged in a timely manner. The general method is that the SOC software periodically polls the CT table through registers to check the activity status of the data flow, detect the timestamp, and determine whether this flow has exceeded the set time threshold in the idle state. If it has, perform aging processing to delete the corresponding flow table entry (FT) and the flow tracking table entry (CT).

[0065] However, in practical applications, for more than one million flow table entries, since the SOC needs to periodically poll the entire CT table through the inband CSR interface, this repeated polling method, although simple in process, is very inefficient, will cause a large amount of CPU time waste, the performance of the SOC CPU will become a bottleneck, and the frequent reading and writing of the CT table will also occupy additional DDR bandwidth and PCIe bandwidth, and even cause the blocking of normal data flows.

[0066] As Figure 1 shown, to solve the above problems, the present invention proposes a flow table aging control method, including:

[0067] Step S1, construct a flow link table according to the sequence of generation of the data flow, and establish a corresponding connection between the flow link table and the corresponding elements in the corresponding record table;

[0068] Step S2, starting from the head of the flow link table, judge whether the generation time of the data flow in the flow link table is greater than a predetermined time;

[0069] Step S3, in response to the generation time of the corresponding data flow being greater than the predetermined time, clear the data flow from the corresponding record table and the flow link table.

[0070] In an embodiment of the present invention, in step S1, the record table refers to the flow table (Flow Table) and the flow tracking table in the traditional OVS system implementation. The structures of the flow table (Flow Table) and the flow tracking table can refer to Figure 7 .

[0071] The flow table, that is, the Flow Table, each of its flow table entries includes: a configuration field (key, composed of the packet header information (network five-tuple) of the flow); an action field (Result, indicating the operation taken, such as discarding, editing, forwarding, etc.) to complete the basic OVS function; and also includes a flow status table index (statsIdx, pointing to the entry of the CT table) to establish the corresponding relationship between the flow table and the flow tracking table.

[0072] The flow tracking table, i.e., the CT Table, each entry of which contains the corresponding flow status information (Status, such as the packet flow statistics and byte flow statistics of this flow), and the timestamp information (timestamp, indicating the time of the latest flow activity). In the traditional implementation, the SOC software performs the aging operation by querying this timestamp. For example, if the set aging time is set to 10 seconds, and the software queries the timestamp as 778888 at the moment of 778899 seconds, it indicates that this flow has not been active in the last 11 seconds, so the aging process should be performed; if the timestamp queried at this time is 778890, it indicates that this flow has been accessed in the last 9 seconds, so it continues to be maintained.

[0073] The flow link table is a doubly linked list structure, created according to the order of the data flows in the flow table. Each item includes the flow table information and flow tracking table information of the corresponding data flow, and the time information sent to the OVS of the corresponding data flow is the same as the timestamp information in the flow tracking table.

[0074] In some embodiments of the present invention, the index of the flow link table corresponds to the CT Table, as Figure 7 shown, idx_k0 is fixedly corresponding to link_k0. Each entry in the table contains two pointers, pre and next, which are used to point to its previous and next index entries respectively. In this way, a doubly linked list is formed, and its head pointer head always points to the oldest flow, while the tail pointer tail always points to the latest flow. In this way, whether it is hardware or software, only the flow pointed to by head needs to be queried, and the idle FT and CT table entries can be aged from old to new step by step, without polling all the table entries, significantly improving the efficiency. The LinkTable linked list maintains the validity of the linked list through addition, update, and aging deletion operations.

[0075] Therefore, in step S1, the OVS system implemented by the present invention needs to create a corresponding flow link table outside the flow table and the flow tracking table. The flow link table is a doubly linked list, and the header element represents the oldest, i.e., the earliest time, data flow. The flow link table is established according to the order of the data flows. At the same time, the information of the corresponding data flow in the flow table and the flow tracking table, such as the corresponding index information, is recorded in each element of the flow link table, or the position or index information of the corresponding data flow in the flow link table is added to the information of the flow table and the flow tracking table, so that the position of the corresponding data flow in the flow link table can be found through the information of the flow table and the flow tracking table, and the relevant information of the corresponding data flow in the flow table and the flow tracking table can be found through the data flow information in the flow link table.

[0076] In step S2, based on the flow connection table constructed in step S1, the time information sent to the OVS of each data flow in the table is sequentially queried from the head of the table, and the difference operation is performed with the current time to determine whether the difference exceeds the predetermined time.

[0077] In step S3, if the predetermined time is exceeded, it indicates that the corresponding data stream has not been refreshed for a long time and is occupying memory, and the corresponding data stream should be aged, that is, deleted from the flow table and the flow trace table.

[0078] In some embodiments of the present invention, the method further includes:

[0079] In response to the generation of a data stream, determine whether the data stream exists in the record table;

[0080] In response to the data stream existing in the record table, update the position of the data stream in the flow link table to the end of the table.

[0081] In some embodiments of the present invention, when the OVS system receives a data stream, it looks up whether the data stream already exists in the flow table according to information such as the five-tuple of the data stream (source IP address, source port, destination IP address, destination port, and transport layer protocol). If it exists, it forwards according to the flow table, and at the same time updates relevant information such as the timestamp information of the data stream in the flow trace table. At the same time, in the flow link table, the element corresponding to the data stream is migrated from the doubly linked list to the end of the flow link table.

[0082] In some embodiments of the present invention, the method further includes:

[0083] In response to the flow table in the record table not recording the data stream, append the data stream to the end of the flow link table.

[0084] In this embodiment, for a data stream not recorded in the flow table and the flow trace table, after the data stream is sent to the OVS system, its time information and information in the flow table and the flow trace table are directly appended as elements of the flow link table to the end of the flow link table.

[0085] In some embodiments of the present invention, constructing a flow link table according to the order of generation of data streams and establishing a corresponding connection between the flow link table and corresponding elements in the corresponding record table includes:

[0086] Construct the flow link table according to the order of the data streams recorded in the flow trace table in the record table and the timestamps of the data streams, and add the index of the corresponding data stream in the flow link table to the information of the corresponding data stream in the flow trace table.

[0087] In this embodiment, when creating the flow link table, it is created according to the order of the timestamp information of the corresponding data streams recorded in the flow trace. At the same time, the index information of the elements in the created flow link table in the flow link table is added to the record item corresponding to the data stream in the flow trace table. It is convenient to query the position of the data stream in the flow link table through the flow trace table.

[0088] In some embodiments of the present invention, the method further includes:

[0089] Construct the flow link table according to the data flow in the flow tracking table and the order of the timestamps of the data flows, and use the index of the flow tracking table and the flow table as the index of the flow link table and the flow table.

[0090] In this embodiment, when constructing the flow link table, the index of the flow tracking table (CT table) and the flow table (FT table) is directly used as the index of the flow link table. In this way, a set of index relationships can be used for mutual query between the three tables. When updating the flow link table through the change of the FT table, the index of the corresponding data flow can be directly applied to the flow tracking table. That is, the index of the flow link table and the flow tracking table correspond to each other. As Figure 7 shown, idx_k0 is fixedly corresponding to link_k0 (k0 represents the index corresponding to the data flow). Each entry in the table contains two pointers, pre and next, which are used to point to its previous and next index entries respectively. In this way, a doubly linked list is formed, and its head pointer head always points to the oldest flow, while the tail pointer tail always points to the latest flow. In this way, whether it is hardware or software, only the flow pointed to by head needs to be queried, and the idle FT and CT table entries can be aged from old to new step by step, without polling all the table entries, significantly improving the efficiency. The Link Table linked list maintains the validity of the linked list through add, update, and aging delete operations.

[0091] In some embodiments of the present invention, the flow table constructs the flow link table according to the order of generation of the data flows, and establishing a corresponding connection between the flow link table and the corresponding elements in the corresponding flow table includes:

[0092] Construct the flow link table according to the order of the data flows in the flow table, and add the generation time of the data flows in the flow table to the flow link table.

[0093] In this embodiment, the flow link table is constructed according to the order of the data flows in the flow table, and at the same time, the time when the data flow is sent to OVS is used as the sorting basis, without relying on the flow tracking table, and the flow tracking table remains unchanged.

[0094] In some embodiments of the present invention, the method further includes:

[0095] Construct a bidirectional flow tracking linked list according to the order of the data flows in the flow table;

[0096] Starting from the head of the bidirectional flow tracking linked list, obtain the timestamp of the corresponding data flow in the bidirectional flow tracking linked list, and determine whether the difference between the timestamp and the current time is greater than a predetermined time;

[0097] If the difference is greater than a predetermined time, delete the corresponding data stream from the two-way flow tracking linked list.

[0098] In this embodiment, the flow tracking table in the traditional implementation manner is constructed into a two-way linked list according to the chronological order of the timestamp information of the corresponding data stream recorded therein. The data at the head of the list is the data stream with the smallest timestamp, that is, the oldest data stream. In this way, when aging the data streams in the flow table, the timestamp information of the corresponding data streams can be directly read sequentially from the head of the two-way flow tracking table for subtraction from the current time. If it exceeds the predetermined time, the data streams are directly deleted sequentially from the head of the two-way flow tracking linked list. At the same time, clear the data stream information in the corresponding flow table.

[0099] It should be noted that in the methods of creating the flow link table and the two-way flow tracking linked list mentioned above in the present invention, creating the flow link table is a relatively high-development-efficiency implementation method. Only adding a flow link table does not change the structure and processing flow of other functional modules of OVS. The cost is that a relatively small storage space is required to store the flow link table. While the method of the two-way flow tracking linked list requires adapting the functions of other modules in OVS that use the flow tracking table, and the development cycle required is relatively long. Therefore, a flexible method can be selected for adaptation according to different implementation conditions.

[0100] Embodiment:

[0101] As Figure 5 shown, the technical solution adopted by the present invention includes three tables, namely the flow table (Flow Table), the flow tracking table (CT Table), and the flow link table (Link Table).

[0102] Flow Table, each flow table entry of which includes: a configuration field (key, composed of the header information of the flow); an action field (action, indicating the operations to be taken, such as discarding, editing, forwarding, etc.), which completes the basic OVS functions; and also includes a flow status table index (statsIdx, pointing to the entry of the CT table), establishing the correspondence between the flow table and the flow tracking table.

[0103] CT Table, each entry of which includes the corresponding flow status information (Status, such as the packet flow statistics and byte flow statistics of this flow), and timestamp information (timestamp, indicating the latest flow activity time). The software performs aging operations by querying this timestamp. For example, if the aging time is set to 10 seconds, and the software queries the timestamp as 778888 at the moment of 778899 seconds, it indicates that this flow has not been active in the last 11 seconds, so aging processing should be performed; if the timestamp is queried as 778890 at this time, it indicates that this flow has been accessed in the last 9 seconds, so it continues to be maintained.

[0104] The Link Table has a doubly-linked list structure. Its indexes correspond to those of the CT Table. For example, idx_k0 always corresponds to link_k0. Each entry in the table contains two pointers, pre and next, which are used to point to the entry of its previous and next indexes respectively. In this way, a doubly-linked list is formed. Its head pointer head always points to the oldest flow, and the tail pointer tail always points to the latest flow. In this way, whether it is hardware or software, only the flow pointed to by head needs to be queried, and the FT and CT table entries in the idle state can be aged from old to new step by step, without polling all the table entries, significantly improving the efficiency. The Link Table linked list maintains the validity of the linked list through operations such as adding, updating, and aging and deleting.

[0105] As Figures 8-9 shown, when adding data flow information to the flow link table, a new index is added to the tail of the linked list, and the tail pointer is adjusted.

[0106] As Figures 10-11 shown, when updating data flow information in the flow link table, as shown in the figure, the corresponding index is adjusted to the tail of the linked list, and the tail pointer is adjusted.

[0107] Furthermore, as Figures 12-13 shown, when aging and deleting data flow information from the flow link table, as shown in the figure, the head pointer is adjusted.

[0108] Furthermore, the schematic structural diagram of the OVS system based on the method of the present invention is as Figure 14 shown. In the figure, for the Link_table module, if flow_table_hit is valid, it means that the flow table is hit, and the node corresponding to stats_idx in the linked list is updated. The control method of the linked list refers to the description above; Flow_add and Flow_age are used for adding and aging and deleting the linked list respectively, and the operation methods are as described above.

[0109] The CT_check module reads the timestamp information of the flow corresponding to the CT table through the Flow_traker module according to the index (head index) pointed to by the head pointer of the Link_table module, and compares it with the current time to determine whether the aging time has been reached. There are two ways in the implementation process: (1) Read the CT table periodically (since only the entry corresponding to head needs to be read, the occupancy of the DRR bandwidth can be basically ignored), until it is detected that the aging time has been reached, and send an aging request; (2) Read the timestamp in the CT table, calculate the time difference until the aging threshold is reached, set a local timer, and send an aging request when the timing reaches. It should be noted that when the head pointer changes, the corresponding timestamp needs to be read again and timed.

[0110] The Age_auto module deletes the FT and CT entries, as well as the Link_table linked list when the aging request signal Age_req is valid. In particular, to maintain flexibility, the software can enable or disable this module through the Age_enable signal. The software queries information such as the Head_index, Age_time, and Age_req of the CT_check module, and performs the aging operation through the inband_CSR module after judgment.

[0111] In addition, the usage scenarios of the present invention are as follows:

[0112] The present invention is applicable to OVS hardware acceleration scenarios such as SmartNIC and DPU. Especially when the flow table scale is very large, it can significantly release the occupancy of the SOC CPU, as well as the occupancy of the PCIe and DDR interface bandwidths.

[0113] The complete steps of the method of the present invention during operation are exemplified as follows:

[0114] 1. At the initial stage, all data packets are unknown. OVS forwards the data stream to the SOC.

[0115] 2. The SOC detects and analyzes the received data stream, and through the inband_CSR interface, controls the lookup and Flow_tracker to establish a flow table (FT) and a flow tracking table (CT) respectively. The Age_control module establishes a corresponding flow link table (Link Table) according to the Flow_add signal.

[0116] 3. If a known data stream is received and a hit is found by looking up the table through the lookup, OVS directly forwards this flow, the flow_table_hit is valid, the flow_tracker module updates the CT entry corresponding to the stats_idx (status statistics information and access timestamp), and at the same time, the Link_table module updates the flow link table to keep the head pointing to the oldest flow and the tail pointing to the latest flow.

[0117] 5. The CT_check module in the Age Control detects the flow tracking table pointed to by the head, queries the timestamp, and judges whether the aging condition is met.

[0118] 6. If the aging condition is met, the aging operation can be automatically performed through the Age_auto module, or this module can be disabled, and the software completes the aging operation after querying and judging.

[0119] 7. Perform the aging operation, the Flow_age is valid, the Link table adjusts the head pointer, and repeat the above operations.

[0120] As Figure 2 shown, another aspect of the present invention further provides a flow table aging control system, including:

[0121] A flow link table management module 1, configured to construct a flow link table according to the sequence of data flow generation, and establish a corresponding connection between the flow link table and corresponding elements in a corresponding record table;

[0122] A flow link table control module 2, configured to determine whether the generation time of the data flow in the flow link table is greater than a predetermined time starting from the head of the flow link table;

[0123] A flow link table clearing module 3, configured to, in response to the generation time of a corresponding data flow being greater than the predetermined time, clear the data flow from the corresponding record table and the flow link table.

[0124] Through a flow table aging control method, system, device and readable storage medium provided by the present invention, the access order of the flow table is sorted by the created flow link table, so that the aging detection is targeted, avoiding a large number of invalid polling operations of the CPU on the SOC, significantly reducing the CPU consumption, without frequently reading and writing the CT table, and at the same time releasing the bandwidth occupation of PCIe and DDR, supporting automatic aging of the hardware, having better real-time performance, and also supporting traditional software aging, being flexible and friendly, and allowing users to choose by themselves.

[0125] As Figure 3 shown, yet another aspect of the present invention further provides a computer device, including:

[0126] At least one processor 21; and

[0127] A memory 22, storing computer instructions 23 that can run on the processor 21, and when the instructions 23 are executed by the processor 21, implementing the steps of the method according to any one of the above embodiments.

[0128] As Figure 4 shown, still another aspect of the present invention further provides a computer-readable storage medium 401, storing a computer program 402, and when the computer program 402 is executed by a processor, implementing the steps of the method according to any one of the above embodiments.

Claims

1. A flow table aging control method, characterized in that Including: Construct a flow link table according to the order of data flow generation, and establish a corresponding connection between the flow link table and corresponding elements in the corresponding record table; The record table refers to a flow table and a flow trace table; Start from the head of the flow link table to determine whether the generation time of the data flow in the flow link table is greater than a predetermined time; In response to the generation time of the corresponding data flow being greater than the predetermined time, clear the data flow from the corresponding record table and the flow link table; The constructing a flow link table according to the order of data flow generation and establishing a corresponding connection between the flow link table and corresponding elements in the corresponding record table includes: Construct the flow link table according to the order of the data flow recorded in the flow trace table in the record table and the time stamps of the data flows, and add the index of the corresponding data flow in the flow link table to the information of the corresponding data flow in the flow trace table; Or, Construct the flow link table according to the order of the data flow in the flow trace table and the time stamps of the data flows, and use the index of the flow trace table and the flow table as the index of the flow link table; or, Construct the flow link table according to the order of the data flows in the flow table, and add the generation time of the data flows in the flow table to the flow link table.

2. The method according to claim 1, characterized in that Also including: In response to generating a data flow, determine whether the data flow exists in the record table; In response to the data flow existing in the record table, update the position of the data flow in the flow link table to the end of the table.

3. The method according to claim 2, characterized in that Also including: In response to the flow table in the record table not recording the data flow, append the data flow to the end of the flow link table.

4. The method according to claim 1, wherein Also including: Construct a bidirectional flow trace linked list according to the order of the data flows in the flow table; Starting from the head of the bidirectional flow trace linked list, obtain the time stamp of the corresponding data flow in the bidirectional flow trace linked list, and determine whether the difference between the time stamp and the current time is greater than a predetermined time; In response to the difference being greater than the predetermined time, delete the corresponding data flow from the bidirectional flow trace linked list.

5. A flow table aging control system, characterized in that, Including: A flow link table management module configured to construct a flow link table according to the order of data flow generation and establish a corresponding connection between the flow link table and corresponding elements in the corresponding record table; The constructing a flow link table according to the order of data flow generation and establishing a corresponding connection between the flow link table and corresponding elements in the corresponding record table includes: constructing the flow link table according to the order of the data flow recorded in the flow trace table in the record table and the time stamps of the data flows, and adding the index of the corresponding data flow in the flow link table to the information of the corresponding data flow in the flow trace table; or, constructing the flow link table according to the order of the data flow in the flow trace table and the time stamps of the data flows, and using the index of the flow trace table and the flow table as the index of the flow link table; Or, constructing the flow link table according to the order of the data flows in the flow table, and adding the generation time of the data flows in the flow table to the flow link table; the record table refers to a flow table and a flow trace table; A flow link table control module, configured to determine whether the generation time of the data flow in the flow link table is greater than a predetermined time starting from the header of the flow link table; A flow link table clearing module, configured to, in response to the generation time of the corresponding data flow being greater than the predetermined time, clear the data flow from the corresponding record table and the flow link table.

6. A computer device, characterized in that, Comprising: At least one processor; And A memory storing computer instructions executable on the processor, and when the instructions are executed by the processor, implementing the steps of the method according to any one of claims 1-4.

7. A computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, implementing the steps of the method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Network equipment and aging update method of ARP (Address Resolution Protocol) table in same

    CN101909065A

  • Data packet forwarding method and device

    WO2015032333A1