CN116016313A - Flow table aging control method, system, equipment and readable storage medium - Google Patents

Flow table aging control method, system, equipment and readable storage medium Download PDF

Info

Publication number
CN116016313A
CN116016313A CN202211712121.XA CN202211712121A CN116016313A CN 116016313 A CN116016313 A CN 116016313A CN 202211712121 A CN202211712121 A CN 202211712121A CN 116016313 A CN116016313 A CN 116016313A
Authority
CN
China
Prior art keywords
stream
flow
link table
data
data stream
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211712121.XA
Other languages
Chinese (zh)
Inventor
石俊斌
崔健
孙华锦
李树青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Original Assignee
Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd filed Critical Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Priority to CN202211712121.XA priority Critical patent/CN116016313A/en
Publication of CN116016313A publication Critical patent/CN116016313A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention belongs to the field of computer network transmission, and particularly relates to a method, a system, equipment and a readable storage medium for controlling ageing of a flow table. The method comprises the following steps: constructing a stream link table according to the sequence of data stream generation, and establishing a corresponding relation between the stream link table and corresponding elements in a corresponding record table; judging whether the generation time of the data stream in the stream link table is greater than a preset time from the head of the stream link table; and in response to the presence of the corresponding data stream having a generation time greater than the predetermined time, purging the data stream from the corresponding record table and stream link table. The flow table aging control method provided by the invention sorts the access sequence of the flow table by the created flow link table, so that the aging detection is in a vector state, a large number of invalid polling operations of the CPU on the SOC are avoided, the CPU consumption is obviously reduced, the frequent reading and writing of the CT table are not needed, meanwhile, the occupation of the bandwidths of PCIe and DDR is also released, the automatic aging of hardware and the software aging are supported, the method is flexible and friendly, and the user can select by himself.

Description

Flow table aging control method, system, equipment and readable storage medium
Technical Field
The invention belongs to the field of computer network transmission, and particularly relates to a method, a system, equipment and a readable storage medium for controlling ageing of a flow table.
Background
In a highly virtualized environment, a traditional host CPU needs to run OVS (Open Virtual Switch, open virtual switching standard, official network www.openswitch.org) related tasks, and at the same time, the CPU needs to process operations of storage, encryption and decryption of data packets, deep inspection of data packets, firewall, complex routing, and the like, which consume a great deal of CPU resources, and meanwhile, the performance of the service cannot be exerted to the best due to CPU resource contention among different services. The network card is used as a hub for connecting various services, and the services are accelerated on the network card to become the optimal place. The advent of intelligent network cards (Smart NICs) provides a new idea for solving this problem, and we can offload OVS operations from the CPU through the intelligent network card, and perform various functions such as storage acceleration, data encryption, deep packet inspection, and complex routing, and return a large number of CPU cycles spent on processing these workloads to the host, so as to ensure that the server CPU can provide maximum processing capability for the application, or provide more Virtual Machine (VM) services.
If the OVS is offloaded to hardware, it is accelerated by Fast path (the processing and forwarding of the data packet do not need Host (refer to CPU on the Host, i.e. CPU on the server) or SOC (System on chip, i.e. System on chip, refer to the on-board processor of the intelligent network card herein) software, where the path involved is called Fast path), and it is critical whether it can match with FT (Flow Table, i.e. Flow Table) Table for hit, but the DDR storage space is limited, so only recently active Flow Table entries can be saved, and the aging process needs to be performed in time for idle old data Flow Table entries. The general method is that the SOC software periodically polls a CT (flow trace table) table through a register, checks the active state of a data flow, detects a time stamp, judges whether the flow exceeds a set time threshold in an idle state, if so, performs aging processing, and deletes a corresponding flow table entry (FT) and a flow trace table entry.
However, in practical application, for more than million scale flow entries, because the SOC needs to periodically poll the whole CT table through the inband CSR interface, the repeated polling mode, although simple in process, has low efficiency, can cause a great amount of SOC CPU time waste, SOC CPU performance can become a bottleneck, and at the same time, frequent reading and writing of the CT table can occupy additional DDR bandwidth and PCIe bandwidth, and even cause blocking of normal data flow.
Thus, an effective solution is needed.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method for controlling aging of a flow table, comprising:
constructing a stream link table according to the sequence of data stream generation, and establishing a corresponding relation between the stream link table and corresponding elements in a corresponding record table;
judging whether the generation time of the data stream in the stream link table is greater than a preset time from the head of the stream link table;
and in response to the generation time of the corresponding data stream being greater than a predetermined time, purging the data stream from the corresponding record table and the stream link table.
In some embodiments of the invention, the method further comprises:
in response to generating a data stream, determining whether the data stream is present in the record table;
and in response to the data stream existing in the record table, updating the position of the data stream in the stream link table to the tail of the table.
In some embodiments of the invention, the method further comprises:
and in response to the stream table in the record table not recording the data stream, appending the data stream to the table tail of the stream link table.
In some embodiments of the present invention, constructing a stream link table according to the sequence of data stream generation, and establishing a corresponding relationship between the stream link table and a corresponding element in a corresponding record table includes:
and constructing the stream link table according to the sequence of the data streams recorded by the stream tracking table in the record table and the time stamps of the data streams, and adding the index of the corresponding data stream in the stream link table into the information of the corresponding data stream in the stream tracking table.
In some embodiments of the invention, the method further comprises:
and constructing the stream link table according to the sequence of the data stream in the stream tracking table and the time stamp of the data stream, and taking the index of the stream tracking table and the stream table as the index of the stream link table and the stream table.
In some embodiments of the present invention, constructing a stream link table according to the sequence of data stream generation, and establishing a corresponding relationship between the stream link table and a corresponding element in a corresponding record table includes:
and constructing the stream link table according to the sequence of the data streams in the stream table, and adding the generation time of the data streams in the stream table into the stream link table.
In some embodiments of the invention, the method further comprises:
constructing a bidirectional flow tracking linked list according to the sequence of data flows in the flow table;
starting from the header of the bidirectional flow tracking linked list, acquiring a time stamp of a corresponding data flow in the bidirectional flow tracking linked list, and judging whether the difference value between the time stamp and the current time is larger than a preset time;
and deleting the corresponding data stream from the bidirectional stream tracking linked list in response to the difference being greater than a predetermined time.
Another aspect of the present invention also provides a flow table aging control system, including:
the system comprises a stream link table management module, a data stream generation module and a data stream generation module, wherein the stream link table management module is configured to construct a stream link table according to the sequence of the data stream generation and establish corresponding connection between the stream link table and corresponding elements in a corresponding record table;
a flow link table control module configured to determine, from a header of the flow link table, whether a generation time of a data flow in the flow link table is greater than a predetermined time;
and a stream link table purging module configured to purge the data stream from the corresponding record table and the stream link table in response to the presence of the corresponding data stream having a generation time greater than a predetermined time.
Yet another aspect of the present invention is directed to a computer device comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method of any of the above embodiments.
Yet another aspect of the invention also proposes a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method of any of the above embodiments.
The method, the system, the equipment and the readable storage medium for controlling the aging of the flow table provided by the invention have the advantages that the access sequence of the flow table is ordered by the created flow link table, so that the aging detection has a vector, a large number of invalid polling operations of a CPU on the SOC are avoided, the consumption of the CPU is obviously reduced, frequent reading and writing of the CT table are not needed, meanwhile, the occupation of the bandwidths of PCIe and DDR is also released, the automatic aging of hardware is supported, the better instantaneity is also supported, the traditional software aging is also supported, the flexibility and the friendliness are realized, and the user can select by himself.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a method for controlling aging of a flow chart according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a flow table aging control system according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer readable storage medium according to an embodiment of the present invention.
Fig. 5 is a relationship diagram of an OVS of the prior art in a network data processing system provided in an embodiment of the present invention;
fig. 6 is a schematic flow chart of packet processing of OVS according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a relationship between three record tables in a method for controlling aging of a flow table according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of adding new elements and indexes at the tail of a stream link table according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of adding new elements to a stream link table according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of a change in a linked list when elements in a stream link table provided in an embodiment of the present invention are updated to the end of the table;
FIG. 11 is a schematic diagram showing updating of elements in a stream link table to a table tail according to an embodiment of the present invention;
FIG. 12 is a schematic diagram illustrating a change of a linked list when elements in a stream link table are aged and deleted according to an embodiment of the present invention;
FIG. 13 is a schematic diagram of a process of aging and deleting elements in a stream link table according to an embodiment of the present invention;
fig. 14 is a schematic diagram of an overall hardware design of flow table aging control according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention will be described in further detail with reference to the accompanying drawings.
It should be noted that, in the embodiments of the present invention, all the expressions "first" and "second" are used to distinguish two entities with the same name but different entities or different parameters, and it is noted that the "first" and "second" are only used for convenience of expression, and should not be construed as limiting the embodiments of the present invention, and the following embodiments are not described one by one.
The invention aims to solve the problem that the traditional implementation mode excessively depends on the inquiry of a flow tracking table in the forwarding process of the flow table of the OVS system and wastes a large amount of data bandwidth and CPU resources in the SOC.
In a traditional OVS, in an intelligent network card (SmartNIC), besides completing a network transmission function of a standard network card, a built-in programmable and configurable hardware acceleration engine is provided, so that the performance of an application is improved), OVS hardware acceleration scenes such as a DPU and the like are shown in fig. 5, the OVS is realized in an FPGA/ASIC by means of hardware, and an OVS subsystem is a multi-layer virtual switch conforming to the Open vSwitch specification and is responsible for analyzing, processing and forwarding data packets among interfaces of the intelligent network card. The Host PCIe interface is used for communicating with the server Host CPU, and the SoC PCIe interface is used for communicating with the SoC processor on the SmartNIC board, where the SoC handles all memory accesses, low-speed channel access of OVSs, in-band network management, and board level management. MAC0 and MAC1 are external network ports. In addition, the OVS has two DDR interfaces for storing a Flow table (Flow table) and a Flow tracking table (CT table) of the OVS, respectively.
The OVS subsystem processes all known (known) flows according to preset flow table forwarding rules to perform network service switching, and the switching is completed between an Ethernet port and a virtual-net device directly connected with a host. The OVS subsystem will firstly parse and classify the message, take out the flow ID, then search in the flow table according to the flow ID, if no corresponding entry is found in the flow table, the message will be forwarded to the SoC processor for processing. If the corresponding table item is found in the flow table, the OVS system carries out corresponding processing according to the specified action in the table item. The supported processing operations include: message modification, message forwarding and message discarding. In short, if the received packet is a known, OVS is directly hardware processed, i.e., fast path; otherwise, the packet is a Unknown (e.g., a data stream header packet, an in-band management packet), and is forwarded to the SoC for processing by software, i.e., a slow path.
And secondly, the OVS subsystem forwards the stored type message and the in-band message to the SoC processor for processing. Fast Path and slow Path definitions supported by OVS see the description above.
In addition, for a newly established TCP link, or a newly initiated UDP data stream, there is no fully matched OVS stream table in the OVS. At this time, when the SmartNIC receives the TCP or UDP packet, the packet is forwarded to the SOC by default for software processing, i.e., a low path. And the SOC generates corresponding table items for the link and the data stream according to the routing rule required to be followed by the network card and sends the table items to the OVS, namely, the FT and CT tables are established. And then the SOC sends the received data packet to the OVS for routing, and the OVS can correctly process and forward the data packet according to rules and walk Fast path because the flow table is established.
Specifically, as shown in fig. 6, the OVS packet processing flow is as follows:
1) The data packet is input from MAC or PCIe, enters a Parser module of OVS to analyze the data packet header, and simultaneously sends the original data packet into a Package buffer for buffering.
2) The Lookup module receives the packet header information from the data packet, selects the processing action of the packet according to the table Lookup result of the Flow table in the DDR, and transmits the data packet sending request containing the packet header information and the processing action to the flow_tracker module.
3) The flow_tracker module is responsible for CT maintenance and updates the record of the corresponding data Flow in the DDR. Such as the number of packets, the total amount of data transmitted, time stamp information, etc.
4) The TxQ Scheduler sorts and orders the data packet sending requests and sends the data packet sending requests to the Package Buffer module in sequence.
5) The modification module, i.e. the packet modifier, receives the packet sending request and the original packet from the Package Buffer. And corresponding processing is carried out according to the processing action in the request, so as to generate a new data packet. The new packet is sent to the virtual device, either MAC or PCIe.
6) The Inband CSR, i.e., the in-band management module, may update the Flow Table (FT) and the link tracking table (CT) using in-band paths.
The Flow Tracker module is responsible for tracking the state of the Flow, and when a data packet flows through the OVS, the Flow Tracker searches a Flow Tracker entry on the DDR according to Index obtained by inquiring a pre-stage accurate matching Flow table, and inquires, updates and writes back Flow Tracker entry. The SOC software can then access the records of the Flow in the Flow Tracker table through the inband CSR register interface to learn the state of the Flow. The CT table supports state recording (flow tracking) of the packet flow, including the number of packets flowing through, the total length of the packets, and the time stamp of the most recent packet flow.
In summary, in the conventional implementation, whether the OVS is offloaded to the hardware can be accelerated through Fast path, and whether the OVS can be matched with the FT table hits or not is critical, but the DDR memory space is limited, so only recently active flow entries can be saved, and the idle and old data flow entries need to be aged in time. The general mode is that the SOC software periodically polls a CT table through a register, checks the active state of a data stream, detects a time stamp, judges whether the stream exceeds a set time threshold in an idle state, if so, performs aging processing, deletes a corresponding stream table entry (FT) and a stream tracking table entry (CT).
However, in practical application, for more than million scale flow entries, because SOC needs to periodically poll the whole CT table through the inband CSR interface, this repeated polling mode, although the process is simple, the efficiency is very low, which may cause a great amount of CPU time waste, the performance of SOC CPU may become a bottleneck, and at the same time, frequent reading and writing of CT table may occupy additional DDR bandwidth and PCIe bandwidth, and may even cause blocking of normal data flow.
As shown in fig. 1, in order to solve the above-mentioned problems, the present invention provides a flow table aging control method, which includes:
step S1, a stream link table is constructed according to the sequence of data stream generation, and a corresponding relation is established between the stream link table and corresponding elements in a corresponding record table;
s2, judging whether the generation time of the data stream in the stream link table is greater than a preset time from the head of the stream link table;
and step S3, in response to the fact that the generation time of the corresponding data stream is greater than the preset time, the data stream is cleared from the corresponding record table and the stream link table.
In the embodiment of the present invention, in step S1, the record Table refers to a Flow Table (Flow Table) and a Flow tracking Table in the conventional OVS system implementation. The structures of the Flow Table (Flow Table) and the Flow trace Table can be referred to fig. 7.
The Flow Table, namely the Flow Table, each Flow entry of which contains: a configuration field (key) composed of header information (network five-tuple) of the stream; an action field (Result, indicating the action to be taken, such as discard, edit, forward, etc.), completing the basic OVS function; and meanwhile, the method also comprises a flow state table index (statsIdx, points to an inlet of the CT table) and establishes a corresponding relation between the flow table and the flow tracking table.
The flow tracking Table, i.e., CT Table, has each entry containing corresponding flow state information (Status, such as packet traffic statistics, byte traffic statistics, etc. of the present flow), and timestamp information (timestamp, indicating the latest flow activity time), and SOC software performs the aging operation by querying the timestamp in the conventional implementation. For example, if the aging time is set to 10 seconds, if the software queries 778888 at the time 778899 seconds, indicating that the stream was not active for the last 11 seconds, then the aging process should be performed; if the query time stamp is 778890 at this point, indicating that the last 9 seconds of the stream has been accessed, then the hold is continued.
The stream link table is a double-linked list structure and is created according to the sequence of the data streams in the stream table, and each item comprises stream table information and stream tracking table information of the corresponding data stream, and the time information of the corresponding data stream sent to the OVS is the same as the time stamp information in the stream tracking table.
In some implementations of the invention, the index of the stream link Table and the CT Table are mutually corresponding, as shown in FIG. 7, idx_k0 fixes the corresponding link_k0. Each entry in the table contains two pointers, pre and next, for pointing to its preceding and succeeding index entries, respectively. In this way a doubly linked list is formed with the head pointer head always pointing to the oldest stream and the tail pointer tail always pointing to the newest stream. Therefore, whether hardware or software is adopted, the idle FT and CT table entries can be gradually changed from old to new without polling all the table entries only by inquiring the flow pointed by the head, and the efficiency is obviously improved. The Link Table linked list keeps the validity of the linked list through the operations of adding, updating, aging and deleting.
Therefore, in step S1, the OVS system implemented by the present invention needs to create a corresponding flow link table in addition to the flow table and the flow tracking table. The flow link table is a bidirectional link table, the table head element represents the oldest and earliest data flow, the flow link table is built according to the sequence of the data flows, and meanwhile, 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 the index information of the corresponding data flow in the flow link table is added into 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 related information of the corresponding data flow of the flow table and the flow tracking table can be found through the data flow information in the flow link table.
In step S2, based on the stream connection table constructed in step S1, time information of each data stream transmitted to the OVS in the table is sequentially searched from the header, and a difference operation is performed with the current time to determine whether the difference exceeds a predetermined time.
In step S3, if the predetermined time is exceeded, it is indicated that the corresponding data stream is not refreshed for a long time, and the corresponding data stream should be aged, i.e. deleted from the stream table and the stream tracking table.
In some embodiments of the invention, the method further comprises:
in response to generating a data stream, determining whether the data stream is present in the record table;
and in response to the data stream existing in the record table, updating the position of the data stream in the stream link table to the tail of the table.
In some embodiments of the present invention, when the OVS system receives a data stream, it searches in the flow table whether the data stream already exists according to information such as a data stream five-tuple (source IP address, source port, destination IP address, destination port and transport layer protocol), if so, it forwards according to the flow table, and updates information such as timestamp information of the data stream in the flow tracking table. And simultaneously, the element corresponding to the data stream is migrated from the doubly linked list to the end of the stream link table in the stream link table.
In some embodiments of the invention, the method further comprises:
and in response to the stream table in the record table not recording the data stream, appending the data stream to the table tail of the stream link table.
In this embodiment, for a data stream that is not recorded by the stream table and the stream tracking table, the data stream directly adds its time information and information in the stream table and the stream tracking table to the end of the stream link table as elements of the stream link table after being transmitted to the OVS system.
In some embodiments of the present invention, constructing a stream link table according to the sequence of data stream generation, and establishing a corresponding relationship between the stream link table and a corresponding element in a corresponding record table includes:
and constructing the stream link table according to the sequence of the data streams recorded by the stream tracking table in the record table and the time stamps of the data streams, and adding the index of the corresponding data stream in the stream link table into the information of the corresponding data stream in the stream tracking table.
In this embodiment, when the stream link table is created, the creation is performed according to the sequence of the timestamp information of the corresponding data stream recorded in the stream tracking, and meanwhile, the index information of the element in the created stream link table in the stream link table is added to the record item corresponding to the data stream in the stream tracking table. The location of the data stream in the stream link table is conveniently queried through the stream tracking table.
In some embodiments of the invention, the method further comprises:
and constructing the stream link table according to the sequence of the data stream in the stream tracking table and the time stamp of the data stream, and taking the index of the stream tracking table and the stream table as the index of the stream link table and the stream table.
In this embodiment, when the flow link table is constructed, the index of the flow tracking table (CT table) to the flow table (FT table) is directly used as the index of the flow link table, so that the mutual query between the three tables can use a set of index relationships, and when the flow link table is updated 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 stream link table and the stream trace table correspond to each other, and idx_k0 fixes the corresponding link_k0 (k 0 represents the index corresponding to the data stream) as shown in fig. 7. Each entry in the table contains two pointers, pre and next, for pointing to its preceding and succeeding index entries, respectively. In this way a doubly linked list is formed with the head pointer head always pointing to the oldest stream and the tail pointer tail always pointing to the newest stream. Therefore, whether hardware or software is adopted, the idle FT and CT table entries can be gradually changed from old to new without polling all the table entries only by inquiring the flow pointed by the head, and the efficiency is obviously improved. The Link Table linked list keeps the validity of the linked list through the operations of adding, updating, aging and deleting.
In some embodiments of the present invention, the stream table constructs a stream link table according to the sequence of data stream generation, and establishing a corresponding relation between the stream link table and a corresponding element in the corresponding stream table includes:
and constructing the stream link table according to the sequence of the data streams in the stream table, and adding the generation time of the data streams in the stream table into the stream link table.
In this embodiment, the flow link table is constructed according to the sequence of the data flows in the flow table, and the time for sending the data flows to the OVS is used as the sequencing basis, so that the flow tracking table is kept motionless without depending on the flow tracking table.
In some embodiments of the invention, the method further comprises:
constructing a bidirectional flow tracking linked list according to the sequence of data flows in the flow table;
starting from the header of the bidirectional flow tracking linked list, acquiring a time stamp of a corresponding data flow in the bidirectional flow tracking linked list, and judging whether the difference value between the time stamp and the current time is larger than a preset time;
and deleting the corresponding data stream from the bidirectional stream tracking linked list in response to the difference being greater than a predetermined time.
In this embodiment, the flow tracking table in the conventional implementation is constructed into a bidirectional linked list according to the time stamp information sequence of the corresponding data flows recorded by the flow tracking table, and the data in the header is the data flow with the minimum time stamp, i.e. the oldest data flow. When the data flow in the flow table is aged, the time stamp information of the corresponding data flow can be read from the head of the bidirectional flow tracking table in sequence for subtraction with the current time, and if the preset time is exceeded, the bidirectional flow tracking linked list is deleted from the head of the bidirectional flow tracking table in sequence. While the data flow information in the corresponding flow table is clear.
When it needs to be described, in the above-mentioned method for creating the flow link table and the bidirectional flow tracking linked list, the creation of the flow link table belongs to an implementation mode with higher development efficiency, and only one flow link table is added, so that the structure and the processing flow of other functional modules of the OVS are not changed. At the cost of requiring less memory space for maintaining the stream link table. The bidirectional flow tracking linked list mode needs to adapt the functions of other modules using the flow tracking table in the OVS, and the required development period is long. The adaptation can thus be carried out in a flexible manner according to different implementation conditions.
Examples:
as shown in fig. 5, the technical solution adopted in the present invention includes three tables, namely, a Flow Table (Flow Table), a Flow tracking Table (CT Table), and a Flow Link Table (Link Table).
The Flow Table contains per Flow entry: a configuration field (key, composed of header information of the stream); an action field (action, indicating the action to be taken, such as discard, edit, forward, etc.), completing the basic OVS function; and meanwhile, the method also comprises a flow state table index (statsIdx, points to an inlet of the CT table) and establishes a corresponding relation between the flow table and the flow tracking table.
CT tables, each of which contains corresponding stream state information (Status, such as packet traffic statistics, byte traffic statistics, etc. for the present stream), and timestamp information (timestamp, representing the latest stream activity time), are aged by the software by querying this timestamp. For example, if the aging time is set to 10 seconds, if the software queries 778888 at the time 778899 seconds, indicating that the stream was not active for the last 11 seconds, then the aging process should be performed; if the query time stamp is 778890 at this point, indicating that the last 9 seconds of the stream has been accessed, then the hold is continued.
Link Table is a two-way chain Table structure, and indexes of the Link Table and CT Table correspond to each other, for example, idx_k0 fixes corresponding link_k0. Each entry in the table contains two pointers, pre and next, for pointing to its preceding and succeeding index entries, respectively. In this way a doubly linked list is formed with the head pointer head always pointing to the oldest stream and the tail pointer tail always pointing to the newest stream. Therefore, whether hardware or software is adopted, the idle FT and CT table entries can be gradually changed from old to new without polling all the table entries only by inquiring the flow pointed by the head, and the efficiency is obviously improved. The Link Table linked list keeps the validity of the linked list through the operations of adding, updating, aging and deleting.
As shown in fig. 8-9, when data flow information is newly added to the flow link table, a new index is added at the end of the linked list and the tail pointer is adjusted.
When updating the data flow information to the flow link table, as shown in fig. 10-11, the corresponding index is adjusted to the end of the linked list and the tail pointer is adjusted.
Further, as shown in FIGS. 12-13, the head pointer is adjusted as shown when the delete data stream information is aged to the stream link table.
Further, the structure diagram of the OVS system based on the method of the present invention is shown in fig. 14, in which, if the link_table module is valid, it indicates that the flow table hits, the node corresponding to stats_idx in the linked list is updated, and the control method of the linked list is described above; the flow_add and the flow_age are respectively used for the new addition and the aging deletion of the linked list, and the operation modes are described above.
And the CT_check module reads the time stamp information of the Flow corresponding to the CT table through the flow_traker module according to the index (head index) pointed by the link_table module head pointer, compares the time stamp information with the current time and judges whether the aging time is reached. There are two ways in the implementation: (1) Sending an aging request by periodically reading the CT table (only the head corresponding table entry needs to be read, so that occupation of DRR bandwidth is basically negligible) until the aging time is detected; (2) And reading a time stamp in the CT table, calculating a time difference when the distance reaches an aging threshold, setting a local timer, and sending an aging request when the time is up. It should be noted that when the head pointer changes, the corresponding timestamp needs to be read again and clocked.
The age_auto module deletes the FT, CT table entry, and Link_table linked list when the aging request signal age_req is valid. In particular, in order to keep flexibility, the software can enable or mask the module through an age_enable signal, and the software queries information such as head_index, age_time, age_req and the like of the CT_check module, and then performs aging operation through the inband_CSR module after judging.
In addition, the use of the invention is as follows:
the invention is suitable for SmartNIC, DPU and other OVS hardware acceleration scenes, and particularly can obviously release the occupation of SOC CPU and the occupation of PCIe and DDR interface bandwidth under the condition of large flow table scale.
The method of the invention comprises the following complete steps in operation:
1. in the initial stage, all data packets are Unknown (Unknown), and the OVS forwards the data stream to the SOC;
SOC detection analysis of received data Flow, respectively establishing a Flow Table (FT) and a Flow tracking Table (CT) by controlling a logo_CSR interface and a flow_tracker, and establishing a corresponding Flow Link Table (Link Table) by an age_control module according to a flow_add signal;
3. if a known (know) data stream is received and hit is found through a lookup table, the OVS directly forwards the stream, the flow_table_hit is valid, the flow_tracker module updates CT table entries (state statistics information and access time stamps) corresponding to stats_idx, meanwhile, the Link_table module updates a stream Link table, the head is kept pointing to the oldest stream, and the tail is pointed to the newest stream;
and 5, a CT_check module in the age Control detects a head-directed flow tracking table, inquires a time stamp and judges whether an aging condition is met.
6. If the aging condition is satisfied, the aging operation can be automatically executed through the age_auto module, or the aging operation is completed after the software judges through inquiry by shielding the module.
7. And executing aging operation, wherein flow_age is effective, link table adjusts head pointer, and repeatedly executes the operation.
As shown in fig. 2, another aspect of the present invention further proposes a flow table aging control system, including:
the system comprises a stream link table management module 1, wherein the stream link table management module 1 is configured to construct a stream link table according to the sequence of data stream generation, and establish a corresponding connection between the stream link table and a corresponding element in a corresponding record table;
a flow link table control module 2, the flow link table control module 2 being configured to determine, from a header of the flow link table, whether a generation time of a data flow in the flow link table is greater than a predetermined time;
and a stream link table clearing module 3, wherein the stream link table clearing module 3 is configured to clear the data stream from the corresponding record table and the stream link table in response to the generation time of the corresponding data stream being greater than a predetermined time.
The method, the system, the equipment and the readable storage medium for controlling the aging of the flow table provided by the invention have the advantages that the access sequence of the flow table is ordered by the created flow link table, so that the aging detection has a vector, a large number of invalid polling operations of a CPU on the SOC are avoided, the consumption of the CPU is obviously reduced, frequent reading and writing of the CT table are not needed, meanwhile, the occupation of the bandwidths of PCIe and DDR is also released, the automatic aging of hardware is supported, the better instantaneity is also supported, the traditional software aging is also supported, the flexibility and the friendliness are realized, and the user can select by himself.
As shown in fig. 3, a further aspect of the present invention further proposes a computer device, including:
at least one processor 21; and
a memory 22, said memory 22 storing computer instructions 23 executable on said processor 21, said instructions 23 when executed by said processor 21 implementing the steps of any of the methods of the above embodiments.
As shown in fig. 4, a further aspect of the present invention further proposes a computer readable storage medium 401, said computer readable storage medium 401 storing a computer program 402, said computer program 402 implementing the steps of the method according to any of the above embodiments when being executed by a processor.

Claims (10)

1. A flow table aging control method, comprising:
constructing a stream link table according to the sequence of data stream generation, and establishing a corresponding relation between the stream link table and corresponding elements in a corresponding record table;
judging whether the generation time of the data stream in the stream link table is greater than a preset time from the head of the stream link table;
and in response to the generation time of the corresponding data stream being greater than a predetermined time, purging the data stream from the corresponding record table and the stream link table.
2. The method as recited in claim 1, further comprising:
in response to generating a data stream, determining whether the data stream is present in the record table;
and in response to the data stream existing in the record table, updating the position of the data stream in the stream link table to the tail of the table.
3. The method as recited in claim 2, further comprising:
and in response to the stream table in the record table not recording the data stream, appending the data stream to the table tail of the stream link table.
4. The method of claim 1, wherein constructing a stream link table according to the sequence of data stream generation and associating the stream link table with a corresponding element in a corresponding record table comprises:
and constructing the stream link table according to the sequence of the data streams recorded by the stream tracking table in the record table and the time stamps of the data streams, and adding the index of the corresponding data stream in the stream link table into the information of the corresponding data stream in the stream tracking table.
5. The method of claim 1, wherein constructing a stream link table according to the sequence of data stream generation and associating the stream link table with corresponding elements in the corresponding record comprises:
and constructing the stream link table according to the sequence of the data stream in the stream tracking table and the time stamp of the data stream, and taking the index of the stream tracking table and the stream table as the index of the stream link table and the stream table.
6. The method of claim 1, wherein constructing a stream link table according to the sequence of data stream generation and associating the stream link table with a corresponding element in a corresponding record table comprises:
and constructing the stream link table according to the sequence of the data streams in the stream table, and adding the generation time of the data streams in the stream table into the stream link table.
7. The method as recited in claim 1, further comprising:
constructing a bidirectional flow tracking linked list according to the sequence of data flows in the flow table;
starting from the header of the bidirectional flow tracking linked list, acquiring a time stamp of a corresponding data flow in the bidirectional flow tracking linked list, and judging whether the difference value between the time stamp and the current time is larger than a preset time;
and deleting the corresponding data stream from the bidirectional stream tracking linked list in response to the difference being greater than a predetermined time.
8. A flow table aging control method, comprising:
the system comprises a stream link table management module, a data stream generation module and a data stream generation module, wherein the stream link table management module is configured to construct a stream link table according to the sequence of the data stream generation and establish corresponding connection between the stream link table and corresponding elements in a corresponding record table;
a flow link table control module configured to determine, from a header of the flow link table, whether a generation time of a data flow in the flow link table is greater than a predetermined time;
and a stream link table purging module configured to purge the data stream from the corresponding record table and the stream link table in response to the presence of the corresponding data stream having a generation time greater than a predetermined time.
9. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method of any one of claims 1-7.
10. A computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method of any one of claims 1-7.
CN202211712121.XA 2022-12-29 2022-12-29 Flow table aging control method, system, equipment and readable storage medium Pending CN116016313A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211712121.XA CN116016313A (en) 2022-12-29 2022-12-29 Flow table aging control method, system, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211712121.XA CN116016313A (en) 2022-12-29 2022-12-29 Flow table aging control method, system, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN116016313A true CN116016313A (en) 2023-04-25

Family

ID=86029388

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211712121.XA Pending CN116016313A (en) 2022-12-29 2022-12-29 Flow table aging control method, system, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN116016313A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117240811A (en) * 2023-08-30 2023-12-15 中科驭数(北京)科技有限公司 Data message processing method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117240811A (en) * 2023-08-30 2023-12-15 中科驭数(北京)科技有限公司 Data message processing method and system

Similar Documents

Publication Publication Date Title
Feldmeier Improving gateway performance with a routing-table cache
US7787442B2 (en) Communication statistic information collection apparatus
CN108667853B (en) Malicious attack detection method and device
KR101018575B1 (en) System and method for processing rx packets in high speed network applications using an rx fifo buffer
US7664112B2 (en) Packet processing apparatus and method
US11637787B2 (en) Preventing duplication of packets in a network
US20100085891A1 (en) Apparatus and method for analysing a network
WO2018107681A1 (en) Processing method, device, and computer storage medium for queue operation
US20030172169A1 (en) Method and apparatus for caching protocol processing data
WO2019185051A1 (en) Integrated flow table-based packet forwarding method and device
CN108600053B (en) Wireless network data packet capturing method based on zero copy technology
JP2010041471A (en) Communication data statistical apparatus, communication data statistical method and program
US7032073B2 (en) Cache system for network and multi-tasking applications
US7293158B2 (en) Systems and methods for implementing counters in a network processor with cost effective memory
CN110808854B (en) Message scheduling method and device and switch
US20210029052A1 (en) Methods and apparatuses for packet scheduling for software- defined networking in edge computing environment
CN116016313A (en) Flow table aging control method, system, equipment and readable storage medium
CN114640716A (en) Cloud network cache acceleration system and method based on fast network path
WO2020181820A1 (en) Data cache method and apparatus, computer device and storage medium
CN113259264B (en) Data transmission method and device, computer equipment and storage medium
US9137158B2 (en) Communication apparatus and communication method
Song et al. HCMonitor: An accurate measurement system for high concurrent network services
CN117061394A (en) eBPF-based container network TCP connection time delay monitoring method and device
US8559430B2 (en) Network connection device, switching circuit device, and method for learning address
JP6266445B2 (en) Packet relay apparatus and packet relay method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination