Flow table processing method, flow table processing system and network card
By introducing the target state table corresponding to the target flow table in the flow table processing system and filtering based on the target state table, the problem of low flow table processing efficiency in the existing technology is solved, and fast scanning and efficient aging operations are realized.
Patent Information
- Application Number
- CN202411874059.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-18
AI Technical Summary
In the prior art, the hardware aging engine performs query and aging of flow tables through scan-by-scan, resulting in a large number of idle or invalid flow table entries occupying valuable access bandwidth, affecting the flow table processing efficiency.
The target state table corresponding to the target flow table is introduced, and filtered based on the target state table in the aging engine, and only queries are made for entries whose status information is valid, thereby avoiding the waste of bandwidth due to reading a large number of invalid entries.
Through this method, valuable bandwidth resources are saved, fast scanning of target flow tables is achieved, and the efficiency of flow table processing is improved. At the same time, more frequent aging operations are supported, which improves the aging accuracy of the entire system.
Smart Images

Figure CN119363642B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of computer technology, and in particular to a flow table processing method, a flow table processing system, and a network card. Background Art
[0002] In network communication devices, such as switches and routers, flow tables are used to aggregate and store information about multiple flows in memory. In order to maintain the efficient operation of these flow tables, there is usually a hardware aging engine responsible for regularly checking and removing flow table entries that have not been used for a long time to ensure that the flow table only contains currently active data flow information.
[0003] At present, hardware aging engines usually perform flow table query and aging processing in the form of scanning one by one. However, in the process of scanning one by one, since it is only when the corresponding entry of the flow table is processed that it can be determined whether the entry stores a valid flow table entry, a large number of idle or invalid flow table entries occupy precious access bandwidth, which in turn affects the efficiency of flow table processing. Therefore, an efficient flow table processing solution is urgently needed. Summary of the invention
[0004] In view of this, the embodiments of this specification provide a flow table processing method. One or more embodiments of this specification also relate to a flow table processing device, a flow table processing system, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, a flow table processing method is provided, which is applied to an aging engine in a flow table processing system. The flow table processing method includes:
[0006] Determine a target storage unit from a target state table corresponding to the target flow table, wherein the target flow table includes a plurality of entries, each entry is used to store a timestamp of a data flow, the target state table includes a plurality of storage units corresponding to the entries one by one, each storage unit is used to store state information of the corresponding entry, and the target storage unit is at least one storage unit in the target state table;
[0007] Reading target state information from the target storage unit, and obtaining a target timestamp stored in the target entry when determining that the target entry is valid based on the target state information, wherein the target entry is an entry corresponding to the target storage unit;
[0008] The flow table is aged according to the target timestamp and the preset lifetime to obtain the flow table aging result.
[0009] According to a second aspect of an embodiment of this specification, a flow table processing method is provided, which is applied to a control unit in a flow table processing system. The flow table processing method includes:
[0010] Obtaining a data stream to be stored, wherein the data stream to be stored carries data stream attribute information and a timestamp;
[0011] According to the data flow attribute information, filter out the entry to be stored from the multiple entries included in the target flow table, and store the data flow to be stored and the timestamp to the entry to be stored, so as to obtain the target storage entry;
[0012] Determine, from a plurality of storage units included in the target state table, a storage unit to be updated corresponding to the target storage entry, wherein the plurality of storage units correspond to the plurality of entries one-to-one, and the storage unit is used to store state information of the corresponding entry;
[0013] The state information stored in the storage unit to be updated is updated to obtain an updated target state table, wherein the updated state information indicates that the target storage entry is valid.
[0014] According to a third aspect of an embodiment of this specification, a flow table processing device is provided, which is applied to an aging engine in a flow table processing system. The flow table processing device includes:
[0015] A first determination module is configured to determine a target storage unit from a target state table corresponding to the target flow table, wherein the target flow table includes a plurality of entries, the entries are used to store timestamps of data flows, the target state table includes a plurality of storage units corresponding to the entries one by one, the storage units are used to store state information of the corresponding entries, and the target storage unit is at least one storage unit in the target state table;
[0016] A first acquisition module is configured to read target state information from a target storage unit, and if it is determined based on the target state information that the target entry is valid, acquire a target timestamp stored in the target entry, wherein the target entry is an entry corresponding to the target storage unit;
[0017] The aging module is configured to perform flow table aging according to a target timestamp and a preset lifetime to obtain a flow table aging result.
[0018] According to a fourth aspect of an embodiment of this specification, a flow table processing device is provided, which is applied to a control unit in a flow table processing system, and the flow table processing device includes:
[0019] A second acquisition module is configured to acquire a data stream to be stored, wherein the data stream to be stored carries data stream attribute information and a timestamp;
[0020] The storage module is configured to filter out the to-be-stored entry from the multiple entries included in the target flow table according to the data flow attribute information, and store the to-be-stored data flow and the timestamp into the to-be-stored entry to obtain the target storage entry;
[0021] A second determination module is configured to determine a storage unit to be updated corresponding to a target storage entry from a plurality of storage units included in the target state table, wherein the plurality of storage units correspond to the plurality of entries one by one, and the storage unit is used to store state information of the corresponding entry;
[0022] The first updating module is configured to update the state information stored in the storage unit to be updated, and obtain an updated target state table, wherein the updated state information indicates that the target storage entry is valid.
[0023] According to a fifth aspect of an embodiment of this specification, a flow table processing system is provided, including an aging engine and a control unit, wherein the aging engine is deployed on a terminal-side device, and the control unit is deployed on a cloud-side device;
[0024] A control unit is used to obtain a data stream to be stored, wherein the data stream to be stored carries data stream attribute information and a timestamp; according to the data stream attribute information, filter out the entry to be stored from a plurality of entries included in a target stream table, and store the data stream to be stored and the timestamp in the entry to be stored, so as to obtain a target storage entry; determine a storage unit to be updated corresponding to the target storage entry from a plurality of storage units included in a target state table, wherein the plurality of storage units correspond to the plurality of entries one-to-one, and the storage unit is used to store the state information of the corresponding entry; update the state information stored in the storage unit to be updated, so as to obtain an updated target state table, wherein the updated state information indicates that the target storage entry is valid;
[0025] An aging engine is used to determine a target storage unit from a target state table corresponding to a target flow table, wherein the target storage unit is at least one storage unit in the target state table; read target state information from the target storage unit, and when determining that a target entry is valid based on the target state information, obtain a target timestamp stored in the target entry, wherein the target entry is an entry corresponding to the target storage unit; perform flow table aging according to the target timestamp and a preset lifetime to obtain a flow table aging result.
[0026] According to a sixth aspect of an embodiment of this specification, a computing device is provided, including:
[0027] Memory and processor;
[0028] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method provided in the first aspect or the second aspect are implemented.
[0029] According to the seventh aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the method provided in the first aspect or the second aspect are implemented.
[0030] According to an eighth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of the method provided in the first aspect or the second aspect above.
[0031] A flow table processing method provided in an embodiment of the present specification is applied to an aging engine in a flow table processing system, including: determining a target storage unit from a target state table corresponding to a target flow table, wherein the target flow table includes multiple entries, the entries are used to store the timestamps of data flows, the target state table includes multiple storage units corresponding to the entries one by one, the storage units are used to store the state information of the corresponding entries, and the target storage unit is at least one storage unit in the target state table; reading the target state information from the target storage unit, and obtaining the target timestamp stored in the target entry when the target entry is determined to be valid based on the target state information, wherein the target entry is the entry corresponding to the target storage unit; aging the flow table according to the target timestamp and the preset survival time to obtain the flow table aging result. By introducing the target state table corresponding to the target flow table, filtering is performed based on the target state table in the aging engine, and only queries are performed for entries with valid state information, thereby avoiding the waste of bandwidth caused by reading a large number of invalid entries, saving precious bandwidth resources, and realizing fast scanning of the target flow table, improving the flow table processing efficiency, and supporting more frequent aging operations, thereby improving the aging accuracy of the entire system. In addition, through the target status table, the status information of the target flow table is more intuitive and easy to manage. For developers, it is easier to understand and track which entries are active and which have been aged and deleted, simplifying troubleshooting and performance tuning. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is an architectural diagram of a flow table processing system;
[0033] Figure 2 It is an architecture diagram of a first flow table processing system provided by an embodiment of this specification;
[0034] Figure 3 is a flow chart of a flow table processing method provided by an embodiment of this specification;
[0035] Figure 4 It is a processing flow chart of a flow table processing method provided by an embodiment of this specification;
[0036] Figure 5is a flowchart of another flow table processing method provided by an embodiment of this specification;
[0037] Figure 6 is an architecture diagram of a second flow table processing system provided by an embodiment of this specification;
[0038] Figure 7 is an architecture diagram of a third flow table processing system provided by an embodiment of this specification;
[0039] Figure 8 is a processing flow chart of another flow table processing method provided by an embodiment of this specification;
[0040] Fig. 9 It is a structural diagram of a network card provided by an embodiment of this specification;
[0041] Fig.10 It is a structural schematic diagram of a flow table processing device provided by an embodiment of this specification;
[0042] Fig.11 is a structural schematic diagram of another flow table processing device provided by an embodiment of this specification;
[0043] Fig.12 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0044] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0045] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0046] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0047] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0048] First, the terms involved in one or more embodiments of this specification are explained.
[0049] IP Packet: refers to the basic unit used to encapsulate and transmit data in the Internet Protocol (IP). It is the data transmission unit of the network layer, responsible for transmitting data from one network node to another. IP packets consist of two parts: Header and Payload.
[0050] Transmission Control Protocol (TCP): is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. It provides a full-duplex communication channel and ensures that data packets are transmitted from the source to the destination in order and without error. TCP establishes a connection through a three-way handshake and uses technologies such as confirmation mechanism, timeout retransmission, flow control, and congestion control to ensure the reliability of data transmission.
[0051] User Datagram Protocol (UDP): is a connectionless, unreliable transport layer communication protocol. It does not guarantee the order or reliability of data packets, nor does it perform error checking and recovery, but provides faster data transmission speeds. UDP is suitable for application scenarios that have high requirements for real-time performance but low requirements for reliability, such as video streaming, online games, etc.
[0052] Personal Identification Number (PIN): A short numeric password used to verify a user's identity, widely used in various security systems and financial services.
[0053] Flow: In the network, the five-tuple of IP packets (source IP address, destination IP address, source port number in TCP / UDP packets, destination port number in TCP / UDP packets, and protocol type) is usually used to classify packets, and packets with the same five-tuple information are called a flow. In the embodiments of this specification, on the basis of the five-tuple, other fields such as the PIN field can also be combined to define a flow.
[0054] Entry: refers to an entry or record stored in the flow table. Each entry represents a specific network flow and contains information used to identify and process the flow.
[0055] Flow table: A data structure in a network device (such as a router, switch, or firewall) that aggregates and stores information about multiple flows in memory.
[0056] Aging: After a flow is created in a switch, it has a life cycle (lifetime / survival time). When the life cycle is reached, the flow information will become invalid, which is called aging.
[0057] Aging engine: A mechanism in a network device or software-defined network controller that manages and maintains entries in the flow table. Its main purpose is to identify and remove flow table entries that have been inactive or no longer needed for a long time to ensure that the flow table only contains currently valid flow information. This not only helps optimize resource utilization, but also improves the performance and efficiency of the device.
[0058] Network Interface Card (NIC): refers to the hardware component used by a computer to connect to a network, enabling the computer to communicate with other devices via wired or wireless means and participate in network environments such as a local area network, wide area network or the Internet.
[0059] Cloud Infrastructure Processor (CIPU): is a new type of cloud computing dedicated processor designed to optimize and accelerate various tasks in cloud computing environments, providing higher performance, lower latency and more flexible resource management.
[0060] Double Data Rate (DDR) is a data transmission technology that allows data to be transmitted once on the rising edge and once on the falling edge of each cycle of the clock signal. This mechanism effectively doubles the data transmission rate. Compared with Single Data Rate (SDR), DDR can provide twice the data bandwidth at the same clock frequency. DDR is usually used in conjunction with Synchronous Dynamic Random Access Memory (SDRAM), i.e. DDR memory.
[0061] PCI (Peripheral Component Interconnect): is a standard bus architecture used to connect components inside a computer, designed to provide higher data transfer rates and simpler configuration.
[0062] PCIe (Peripheral Component Interconnect Express): is a high-speed serial computer expansion bus standard, widely used to connect the processor on the motherboard with peripheral devices. It provides higher bandwidth, lower latency and better scalability than traditional parallel buses (such as PCI). PCIe uses a point-to-point topology, and each device is directly connected to the root complex through a dedicated link, which ensures high efficiency and reliability of data transmission.
[0063] Network Data Plane: Responsible for the actual packet forwarding task. It decides how to forward a received packet from one interface to another, or whether the packet should be discarded. Data plane decisions are usually based on flow tables, routing tables, or other forms of forwarding entries that guide how packets are processed.
[0064] Network Control Plane: responsible for managing and maintaining network behaviors, including establishing and updating forwarding table entries, monitoring network status, executing network policies, etc. In the embodiments of this specification, the network control plane can be called a control unit.
[0065] The CPU (Central Processing Unit) is the core component of a computer system, responsible for executing program instructions and controlling the operation of the entire system. The main tasks of the CPU include fetching instructions, decoding, executing, and writing back results.
[0066] In the CIPU and cloud gateway project scenarios, for connection-oriented application scenarios, the flow table space is often designed to accommodate tens of millions of connection flow information. When hardware unloading is performed, the flow table is often stored in the form of DDR. For the scenario of flow table aging, the project requirement is to achieve second-level accuracy. Figure 1 , Figure 1 The present invention shows an architecture diagram of a flow table processing system, which includes a network card and a CPU. The CPU includes a network data plane and a network control plane. The network card includes a DDR controller, a control plane logic unit, a project processing logic unit and an aging engine. The DDR controller is used to manage and control the read and write operations of the DDR memory. The DDR memory includes a flow table for storing data flows. The control plane logic unit is used to process data on the network control plane, such as control information such as routing and switching. The project processing logic unit is used to process data on the network data plane, such as forwarding and processing of data packets. Arrows indicate the flow direction of data or control information. The network data plane and the network control plane interact with the control plane logic unit, the project processing logic unit and the aging engine through the PCIe interface to transmit data. The control plane logic unit, the project processing logic unit and the aging engine perform read and write operations on the flow table in the DDR memory in the form of scanning one by one through the DDR controller.
[0067] exist Figure 1 In the scheme shown, the flow table storage is stored by using a hash function to store the key information of the flow, and the storage location is often relatively scattered. Therefore, when the aging engine performs query and aging processing of the flow table in the form of scanning one by one, there are the following problems: DDR bandwidth competition and waste: The aging engine must check each entry one by one to determine whether there is a valid flow table entry. In most cases, many entries may be idle (i.e., no valid flow table entry is stored), which leads to a large number of read operations that do not actually bring useful information, resulting in a waste of DDR bandwidth. Low aging accuracy: Since the aging engine scans the flow table in full, and in order to give priority to the access requirements of the project processing logic unit to DDR, it is limited by the DDR bandwidth bottleneck. A full scan of the aging engine often takes nearly ten seconds. In the traditional scheme, the aging mechanism can also be implemented by the CPU actively querying the flow table located in the hardware at a fixed time. However, each query requires the CPU to take time out of its main task to execute these queries, and may require data to be transferred between the CPU and the hardware, resulting in additional consumption of CPU resources.
[0068] In order to solve the problem that the bandwidth waste caused by aging scanning affects the bandwidth demand of the project and the aging accuracy is low and the efficiency is extremely low under large-scale capacity conditions, the embodiment of this specification proposes an efficient network card flow table processing aging solution based on the target state table corresponding to the target flow table. By introducing the target state table corresponding to the target flow table, filtering is performed based on the target state table in the aging engine, and only queries are performed for entries with valid status information, thereby avoiding the waste of bandwidth caused by reading a large number of invalid entries, saving precious bandwidth resources, and realizing rapid scanning of the target flow table, improving the flow table processing efficiency, while supporting more frequent aging operations and improving the aging accuracy of the entire system. In addition, through the target state table, the status information of the target flow table is more intuitive and easy to manage. For developers, it is easier to understand and track which entries are active and which have been deleted by aging, simplifying troubleshooting and performance tuning.
[0069] In this specification, a flow table processing method is provided. This specification also relates to a flow table processing device, a flow table processing system, a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0070] See also Figure 2 , Figure 2 The architecture diagram of the first flow table processing system provided by an embodiment of the present specification is shown. The flow table processing system may include an aging engine 202 and a control unit 204. The aging engine 202 is deployed on a terminal device, and the control unit 204 is deployed on a cloud device.
[0071] The control unit 204 is used to obtain a data stream to be stored, wherein the data stream to be stored carries data stream attribute information and a timestamp; according to the data stream attribute information, filter out the entry to be stored from the multiple entries included in the target stream table, and store the data stream to be stored and the timestamp in the entry to be stored, so as to obtain the target storage entry; determine the storage unit to be updated corresponding to the target storage entry from the multiple storage units included in the target state table, wherein the multiple storage units correspond to the multiple entries one by one, and the storage units are used to store the state information of the corresponding entries; update the state information stored in the storage unit to be updated, and obtain the updated target state table, wherein the updated state information indicates that the target storage entry is valid;
[0072] The aging engine 202 is used to determine a target storage unit from a target state table corresponding to a target flow table, wherein the target storage unit is at least one storage unit in the target state table; read target state information from the target storage unit, and when determining that a target entry is valid based on the target state information, obtain a target timestamp stored in the target entry, wherein the target entry is an entry corresponding to the target storage unit; perform flow table aging according to the target timestamp and a preset lifetime to obtain a flow table aging result.
[0073] It should be noted that cloud-side devices usually refer to servers, storage systems and other infrastructure components deployed in data centers or clouds, such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), cloud servers for basic cloud computing services such as big data and artificial intelligence platforms, or intelligent cloud computing servers or intelligent cloud hosts with artificial intelligence technology. Cloud-side devices communicate with users or end-side devices through the Internet and provide powerful computing power, large-scale data storage and service support. End-side devices refer to intelligent devices that are directly connected to the physical world and collect data, such as smartphones, tablets, sensor nodes, smart home devices, etc. They are located at the edge of the network and are responsible for collecting raw data and transmitting it to the cloud side for further analysis or decision-making. For example, the aging engine can be deployed in the board of the end-side device, and the control unit can be deployed in the CPU of the cloud-side device, where the board refers to an additional hardware component inserted into the expansion slot of the computer motherboard to increase or enhance the function of the computer. Common board types include discrete graphics cards, sound cards, network adapters (NICs), etc. In other embodiments of this specification, the control unit may also be deployed in a non-cloud server such as a local server or an edge server. The non-cloud server may be implemented as a distributed server cluster consisting of multiple servers, or as a single server.
[0074] See also Figure 3 , Figure 3 A flow chart of a flow table processing method provided by an embodiment of the present specification is shown, which is applied to an aging engine in a flow table processing system, and specifically includes the following steps:
[0075] Step 302: Determine a target storage unit from a target state table corresponding to a target flow table, wherein the target flow table includes a plurality of entries, each entry is used to store a timestamp of a data flow, the target state table includes a plurality of storage units corresponding one to one to the entries, each storage unit is used to store state information of the corresponding entry, and the target storage unit is at least one storage unit in the target state table.
[0076] It should be noted that the target state table (bitmap table) can be called a bitmap table, which is stored in an onboard memory or a memory. The target state table includes multiple storage units, each of which uses 1 bit to efficiently represent and manage the binary state information of the corresponding entry. For example, the state information "0" indicates that the state of the corresponding entry is "invalid", and the data stream stored in the entry is invalid or has been removed. The state information "1" indicates that the state of the corresponding entry is "valid", and the data stream stored in the entry is valid. Since bit is the smallest unit of data, using bitmap can significantly reduce the required memory space compared to directly storing the state information in a larger table. In addition, the operation of bitmap usually involves simple bit operations, which makes adding, deleting or updating entries very efficient. Bitmap can also very quickly check whether a specific entry exists in the flow table, which is more suitable for application scenarios that require frequent data flow existence queries.
[0077] When the system is powered on or reset, the state information stored in each storage unit in the target state table can be initialized to 0, which means that all entries are considered invalid in the initial state. As new data flows are added to the flow table, the corresponding bit values in the target state table will be set to 1, indicating that these entries are now valid. Whenever a new data flow is added or an existing data flow ages and is removed, the corresponding bit value in the target state table will be updated. For example, when a new data flow is added to the flow table, its corresponding bit value is set to 1; and when a data flow is removed due to aging or other reasons, its corresponding bit value is reset to 0.
[0078] It is worth noting that in the target state table, each stream only consumes 1 bit of storage space, and 32M streams only require 4MB of storage space. They are tightly arranged in DDR, and the aging engine can greatly utilize the bandwidth of DDR by sequentially accessing the target storage units in batches, with minimal overhead. Taking a single 4KB burst read as an example, the bandwidth overhead introduced by reading the bitmap for preliminary screening of 32M streams is only 1Kpps.
[0079] In practical applications, there are many ways to determine the target storage unit from the target state table corresponding to the target flow table, which are selected according to the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, at least one target storage unit can be randomly read from the target state table. If the number of target storage units is multiple, the multiple target storage units are continuous storage units in the target state table. For example, the target state table includes five storage units, and the five storage units are storage unit a, storage unit b, storage unit c, storage unit d, and storage unit e. The first time, 2 storage units are read from the target state table, and these two storage units can be storage unit d and storage unit e. The second time, 3 storage units are read from the target state table, and these three storage units can be storage unit a, storage unit b, and storage unit c. In another possible implementation of this specification, the target storage units can be read in sequence according to the arrangement order of each storage unit in the target state table. For example, the first time, 2 storage units are read from the target state table, and these two storage units can be storage unit a and storage unit b. The second time, three storage units are read from the target state table. These three storage units may be storage unit c, storage unit d, and storage unit e.
[0080] In an optional embodiment of the present specification, before determining the target storage unit from the target state table corresponding to the target flow table, the target state table corresponding to the target flow table may be obtained, taking the target state table stored in the onboard memory as an example; before determining the target storage unit from the target state table corresponding to the target flow table, the following steps may also be included:
[0081] The target state table corresponding to the target flow table is read from the onboard memory through the controller of the onboard memory.
[0082] It should be noted that onboard memory is memory directly installed on the circuit board, such as DDR memory, static random access memory (SRAM) or other types of random access memory (RAM). Onboard memory is usually used to store target flow tables and target state tables corresponding to target flow tables. The controller of the onboard memory is used to manage data transmission between the end-side device and the onboard memory. The controller can be a dedicated storage controller or a functional unit integrated in other processors.
[0083] In actual applications, when the target state table corresponding to the target flow table is read from the on-board memory through the on-board memory controller, the aging engine can send a read request to the controller. After receiving the read request, the controller finds the location of the target state table in the on-board memory according to the preset address mapping. Then, the controller uses direct memory access technology to efficiently read the target state table from the specified address and feeds the target state table back to the aging engine.
[0084] By applying the solution of the embodiments of the present specification, in addition to storing the target flow table, a separate storage space is allocated in the onboard memory for storing the target status table, so that the aging engine can filter based on the target status table and only query the entries with valid status information, thereby avoiding the waste of bandwidth caused by reading a large number of invalid entries, saving precious bandwidth resources, realizing rapid scanning of the target flow table, and improving the flow table processing efficiency.
[0085] In another optional embodiment of the present specification, taking the target state table stored in a memory storage as an example; before determining the target storage unit from the target state table corresponding to the target flow table, the following steps may also be included:
[0086] The target state table corresponding to the target flow table is read from the memory storage through the connection bus.
[0087] It should be noted that, since the capacity of the onboard memory may be limited, the target state table corresponding to the target flow table can be stored in the memory storage on the CPU side. In this case, the target flow table is stored in the onboard memory, separately from the target state table. Memory storage refers to a fast access storage device used in the CPU for temporary storage of data and instructions, such as memory DDR. The connection bus is used to connect the end-side device and the cloud-side device. Such as PCI, PCIe, etc.
[0088] By applying the solution of the embodiment of this specification, the target state table corresponding to the target flow table is read from the memory storage by connecting the bus, and multiple target storage units can be transmitted simultaneously through the bus to improve the overall throughput.
[0089] Step 304: Read target state information from the target storage unit, and if it is determined based on the target state information that the target entry is valid, obtain the target timestamp stored in the target entry, wherein the target entry is an entry corresponding to the target storage unit.
[0090] It should be noted that the target state information is used to indicate whether the target entry corresponding to the target storage unit is valid. If the target entry is valid, it means that the data stream stored in the target entry is valid; if the target entry is invalid, it means that the data stream stored in the target entry is invalid or has been removed.
[0091] In actual applications, after reading the target state information from the target storage unit, it can be determined whether to perform aging judgment on the target entry based on the target state information. If the target state information is "0", it means that the target entry is invalid, and the next target storage unit of the target storage unit is determined as the updated target storage unit, and the step of reading the target state information from the target storage unit is returned to execute until a valid target entry is determined or all target storage units are traversed. If the target state information is "1", it means that the target entry is valid, and the target timestamp stored in the target entry is directly obtained, and the flow table aging process is performed based on the target timestamp to obtain the flow table aging result.
[0092] Step 306: Perform flow table aging according to the target timestamp and the preset lifetime to obtain a flow table aging result.
[0093] It should be noted that the target timestamp refers to the timestamp when the data flow is stored in the target entry. The preset lifetime is used to define the maximum time an entry is still considered valid without further activity. The preset lifetime can be used to determine whether to perform flow table aging on the data flow stored in the target entry. Flow table aging refers to the process of identifying and removing flow table entries that have exceeded the preset lifetime. The flow table aging result refers to the state change of the target flow table after the flow table aging process, including information such as which entries have been removed and which entries are still valid.
[0094] In actual applications, flow table aging is performed according to the target timestamp and the preset lifetime. There are many ways to obtain the flow table aging results. The specific selection is based on the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the entries to be aged can be screened out from the target entries according to the target timestamp and the preset lifetime; the control unit is called to delete the data flow in the entries to be aged, and the flow table aging results are obtained. In another possible implementation of this specification, the target timestamp and the preset lifetime can be sent to the control unit, and the control unit is called to perform flow table aging according to the target timestamp and the preset lifetime, and the flow table aging results are obtained.
[0095] The solution of the embodiment of the present specification is applied, by introducing the target state table corresponding to the target flow table, filtering is performed in the aging engine based on the target state table, and only the entries with valid state information are queried, thereby avoiding the waste of bandwidth caused by reading a large number of invalid entries, saving precious bandwidth resources, realizing fast scanning of the target flow table, improving the flow table processing efficiency, and supporting more frequent aging operations, thereby improving the aging accuracy of the entire system. In addition, through the target state table, the state information of the target flow table is more intuitive and easy to manage. For developers, it is easier to understand and track which entries are active and which have been deleted by aging, simplifying troubleshooting and performance tuning.
[0096] In an optional embodiment of the present specification, in order to ensure the consistency between the target state table and the target flow table, after the target flow table is aged, the target state table can be updated according to the flow table aging result to obtain an updated target flow table consistent with the aged target flow table, that is, after the flow table is aged according to the target timestamp and the preset survival time and the flow table aging result is obtained, the following steps can also be included:
[0097] The state information stored in the storage unit to be aged is updated, wherein the storage unit to be aged is a storage unit corresponding to the entry to be aged in the target state table, and the updated state information indicates that the entry to be aged is invalid.
[0098] It should be noted that the entry to be aged refers to the entry whose data flow survival time is greater than the preset survival time. After the flow table aging process is completed and the flow table aging result is obtained, it means that the data flow in the entry to be aged has been deleted, but at this time the state information stored in the storage unit to be aged corresponding to the entry to be aged is still "1", indicating that the entry to be aged is valid. Therefore, the state information stored in the storage unit to be aged can be updated to "0", indicating that the entry to be aged is invalid.
[0099] In actual applications, there are many ways to update the status information stored in the storage unit to be aged, and the specific selection is based on the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the aging engine can directly update the status information stored in the storage unit to be aged. In another possible implementation of this specification, the aging engine can call the control unit to update the status information stored in the storage unit to be aged. In another possible implementation of this specification, the aging engine can call the state table management unit other than the aging engine and the control unit to update the status information stored in the storage unit to be aged.
[0100] By applying the solution of the embodiments of this specification, after the aging of the flow table is completed, the target status table is updated to ensure that the information in the target status table always reflects the latest entry status, avoiding the problem of the system making inappropriate decisions based on expired or erroneous information due to inconsistency between the target status table and the target flow table, thereby ensuring the overall performance and service quality of the system.
[0101] In an optional embodiment of the present specification, performing flow table aging according to the target timestamp and the preset lifetime to obtain the flow table aging result may include the following steps:
[0102] Filter out the entries to be aged from the target entries according to the target timestamp and the preset lifetime;
[0103] The control unit is called to delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result.
[0104] It should be noted that the entry identification information (flow id) is used to uniquely identify each entry in the target flow table. The entry identification information can be obtained based on the stored data flow attribute information of the data flow.
[0105] In actual applications, there are many ways to filter out entries to be aged from target entries based on the target timestamp and the preset lifetime. The specific selection is based on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the current timestamp can be obtained; the aging timestamp can be determined based on the preset lifetime and the current timestamp; when the target timestamp of the target entry is before the aging timestamp, the target entry is determined as the entry to be aged; when the target timestamp of the target entry is after the aging timestamp, the next storage unit of the target storage unit is determined as the updated target storage unit, and the step of reading the target status information from the target storage unit is returned to execute. In another possible implementation of this specification, entries to be aged can be filtered out from target entries based on the data stream lifetime and the preset lifetime, wherein the data stream lifetime is obtained based on the current timestamp and the target timestamp.
[0106] Furthermore, there are multiple ways to call the control unit to delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result. The specific selection is based on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the control unit can be directly called to delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result. In another possible implementation of this specification, according to the control unit calling condition, the control unit can be called to delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result.
[0107] By applying the solution of the embodiments of this specification, the entries to be aged are determined based on the target timestamp and the preset lifetime, so that the entries that need to be aged can be accurately determined, thereby improving the accuracy of flow table aging.
[0108] In an optional embodiment of the present specification, the above-mentioned filtering out the entries to be aged from the target entries according to the target timestamp and the preset survival time may include the following steps:
[0109] Get the current timestamp;
[0110] Determine the data flow survival time of the target entry based on the current timestamp and the target timestamp;
[0111] According to the data flow lifetime and the preset lifetime, the entries to be aged are filtered out from the target entries.
[0112] It should be noted that the current timestamp can be understood as a hardware timestamp, which refers to a time stamp directly generated by a hardware device (such as a network interface card, processor, or other dedicated hardware module). The data flow lifetime refers to the time difference between the target timestamp and the current timestamp, which indicates the time that has passed since the last activity of the flow table entry. Data flow lifetime = current timestamp - target timestamp.
[0113] In actual applications, after determining the data stream life span of the target entry based on the current timestamp and the target timestamp, if the data stream life span is greater than the preset life span, the target entry is determined as an entry to be aged. If the data stream life span is less than or equal to the preset life span, the target entry is not determined as an entry to be aged.
[0114] By applying the solution of the embodiments of this specification, by comparing the data flow survival time with the preset survival time, the entries to be aged are determined according to the comparison results, thereby improving the accuracy of the entries to be aged, thereby ensuring that after the flow table is aged, the target flow table only contains the currently active data flow information, avoiding expired entries from occupying resources.
[0115] In an optional embodiment of the present specification, if there are multiple target storage units, there are also multiple target entries. The process of selecting entries to be aged can be performed iteratively, that is, the above-mentioned selection of entries to be aged from the target entries according to the data flow survival time and the preset survival time can include the following steps:
[0116] When the data stream survival time is less than or equal to the preset survival time, the next storage unit of the target storage unit is determined as the updated target storage unit, and the step of reading the target status information from the target storage unit is returned to execute until the data stream survival time is greater than the preset survival time, and the target entry is determined as an entry to be aged.
[0117] Exemplarily, it is assumed that three target storage units are determined from the target state table corresponding to the target flow table, and the three target storage units are target storage unit 1, target storage unit 2, and target storage unit 3. When aging the target flow table, the target state information 1 can be read from the target storage unit 1. If the target entry 1 is determined to be invalid based on the target state information 1, the target state information 2 is read from the target storage unit 2. If the target entry 2 is determined to be valid based on the target state information 2, the target timestamp 2 stored in the target entry 2 is obtained, and the data flow survival time 2 of the target entry 2 is determined according to the current timestamp 1 and the target timestamp 2. If the data flow survival time 2 is less than or equal to the preset survival time, the target state information 3 is read from the target storage unit 3. If the target entry 3 is determined to be valid based on the target state information 3, the target timestamp 3 stored in the target entry 3 is obtained, and the data flow survival time 3 of the target entry 3 is determined according to the current timestamp 2 and the target timestamp 3. If the data flow survival time 3 is greater than the preset survival time, the target entry 3 is determined as an entry to be aged.
[0118] In practical applications, when the data flow survival time is less than or equal to the preset survival time, the next storage unit of the target storage unit is determined as the updated target storage unit, and the step of reading the target state information from the target storage unit is returned to execute. The iteration stop condition can be that there is a target entry whose data flow generation time is greater than the preset survival time, or there are no entries to be aged after traversing all target storage units. When there are no entries to be aged after traversing all target storage units, the flow table processing can be terminated to determine that there are no entries that can be aged in the target flow table, and the step of determining the target storage unit from the target state table corresponding to the target flow table can be returned to execute.
[0119] By applying the solution of the embodiments of this specification, it is possible to iteratively determine whether the target entry corresponding to each target storage unit is an entry to be aged, thereby implementing batch entry aging judgment and improving flow table processing efficiency.
[0120] In an optional embodiment of the present specification, the calling control unit may delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result, which may include the following steps:
[0121] According to the control unit calling condition, the control unit is called based on the entry identification information of the entry to be aged, and the data flow in the entry to be aged is deleted to obtain the flow table aging result.
[0122] It should be noted that the control unit calling condition refers to the condition that determines when and under what circumstances the aging engine can trigger the control unit to perform the flow table aging operation. The control unit calling condition includes but is not limited to the following: Time condition: For example, the aging process is triggered once every minute or every hour. State condition: The aging operation is triggered when there are sufficient resources such as CPU and memory. Entry quantity condition: The aging operation is triggered when the number of entries to be aged exceeds the preset entry value, where the preset entry value is set according to the actual situation, and the embodiments of this specification do not impose any restrictions on this.
[0123] In actual applications, the control unit calling conditions are obtained. If the aging engine meets the control unit calling conditions, the control unit is called, and based on the entry identification information of the entry to be aged, the data flow in the entry to be aged is deleted to obtain the flow table aging result. If the aging engine does not meet the control unit calling conditions, the control unit is not called until the aging engine meets the control unit calling conditions, the control unit is called, and based on the entry identification information of the entry to be aged, the data flow in the entry to be aged is deleted to obtain the flow table aging result.
[0124] By applying the solution of the embodiment of this specification, the control unit calling condition is used to determine whether the control unit can be called to perform flow table aging processing on the aged entries, ensuring that the control unit can perform flow table aging normally, thereby improving the stability of flow table processing.
[0125] In an optional embodiment of the present specification, taking the control unit calling condition including the entry quantity condition as an example, the above-mentioned calling the control unit based on the control unit calling condition, deleting the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtaining the flow table aging result may include the following steps:
[0126] When the number of entries to be aged meets the entry number condition, the control unit is called to delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result.
[0127] It should be noted that if the control unit call condition is an entry quantity condition, the aging engine can store the filtered entries to be aged after filtering out the entries to be aged from the target entries according to the data flow survival time and the preset survival time, until the stored entries to be aged exceed the preset entry value, and then send a flow deletion instruction (message uploading message) to the control unit. The flow deletion instruction carries the entry identification information of the entry to be aged, so that the control unit deletes the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtains the flow table aging result. The flow deletion instruction can also request the transmission processing of the interrupt / message message. In an optional embodiment of the present specification, in order to reduce the interactive transmission of the connection bus, the preset entry value is usually multiple. At this time, the entry identification information carried in the flow deletion instruction sent by the aging engine is multiple, that is, the aging engine uses the form of message aggregation to call the control unit, which can reduce the overhead caused by the CPU receiving messages and avoid the CPU frequently receiving information due to too many uploading messages, which affects the efficiency. Furthermore, the number of entry identification information in the flow deletion instruction can also be limited based on the processing capacity of the control unit.
[0128] In actual applications, when the control unit is called in the form of message aggregation, there may be multiple formats of the message sent to the control unit, which are selected according to the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the message sent may only include the item identification information of the item to be aged. In another possible implementation of this specification, on the basis of including the item identification information of the item to be aged, the message sent may also include the item identification information of items other than the item to be aged, and the item to be aged and the items other than the item to be aged are distinguished in the message by the number of aged items.
[0129] For example, Table 1 is a schematic table of a message transmission message format, the number of aged entries is used to indicate the number of entries to be aged in the message, and the entry identification information in the message transmission message is closely arranged in the order of entry identification information of the entries to be aged first and entry identification information of the entries other than the entries to be aged second. As shown in Table 1 below, assuming that the number of aged entries is 3, it means that the entries corresponding to entry identification information 0, entry identification information 1, and entry identification information 2 are entries to be aged, and the entries corresponding to the remaining entry identification information are not entries to be aged, and the control unit only clears the flow information of the entries corresponding to entry identification information 0, entry identification information 1, and entry identification information 2.
[0130] Table 1 Message sending diagram
[0131]
[0132] By applying the solution of the embodiment of this specification, the aging engine requests the control unit to perform aging processing on multiple items to be aged at one time by means of message aggregation, thereby reducing the CPU overhead caused by receiving messages and reducing the use of the connection bus bandwidth.
[0133] See also Figure 4 , Figure 4 A flow chart of a flow table processing method provided by an embodiment of the present specification is shown. The aging engine is responsible for executing the query and aging judgment of the flow table. The query of the flow table is performed at a configurable time interval. The execution process of the aging engine includes:
[0134] After starting the processing, multiple storage units are read out in batches from the target state table corresponding to the target flow table; it is determined whether the traversal of multiple storage units is complete: if so, it is determined whether the traversal of the target state table is complete; if not, it is determined whether the target state information stored in the target storage unit is 1, wherein the target storage unit is any one of the multiple storage units read out in batches. Determine whether the traversal of the target state table is complete: if so, end the execution process; if not, return to execute the step of batch reading out multiple storage units from the target state table corresponding to the target flow table. Determine whether the target state information stored in the target storage unit is 1: if not, determine the next storage unit of the target storage unit as the updated target storage unit; return to execute the step of determining whether the traversal of multiple storage units is complete; if so, read the target timestamp from the target entry corresponding to the target storage unit in the target flow table; determine the data flow survival time of the target entry based on the current timestamp and the target timestamp; determine whether the data flow survival time is greater than the preset survival time. Determine whether the data stream survival time is greater than the preset survival time: if not, determine the next storage unit of the target storage unit as the updated target storage unit; return to execute the step of determining whether the traversal of multiple storage units is completed; if so, send a stream deletion instruction carrying the entry identification information of the target entry to the control unit. After sending the stream deletion instruction carrying the entry identification information of the target entry to the control unit, determine the next storage unit of the target storage unit as the updated target storage unit; return to execute the step of determining whether the traversal of multiple storage units is completed.
[0135] By applying the solution of the embodiments of this specification, the aging engine can quickly identify valid entries in the target flow table with target state information of 1 through the target state table to perform targeted queries, thereby avoiding the waste of DDR bandwidth caused by invalid queries, and can quickly complete the scanning of the flow table and complete the second-level convergence of flow table aging, leaving sufficient bandwidth for subsequent project processing logic.
[0136] See also Figure 5 , Figure 5A flowchart of another flow table processing method provided by an embodiment of the present specification is shown, which is applied to a control unit in a flow table processing system, and specifically includes the following steps:
[0137] Step 502: Acquire the data stream to be stored, wherein the data stream to be stored carries data stream attribute information and a timestamp.
[0138] It should be noted that the data flow to be stored refers to a new data flow that needs to be recorded in the target flow table or a data flow that updates an existing entry in the target flow table. Each data flow to be stored carries data flow attribute information and a timestamp. The data flow attribute information is used to describe the attribute characteristics of the data flow to be stored. Data flow attribute information includes quintuples, priorities, etc. The timestamp refers to the timestamp of the data flow to be stored obtained from the network port.
[0139] Step 504: According to the data flow attribute information, select the entry to be stored from the multiple entries included in the target flow table, and store the data flow to be stored and the timestamp to the entry to be stored, so as to obtain the target storage entry.
[0140] It should be noted that the entry to be stored refers to the entry in the target flow table used to store the data flow to be stored, and is also the entry corresponding to the entry identification information of the data flow to be stored. If the data flow to be stored is a new data flow, the entry to be stored is empty at this time. If the entry to be stored is a data flow that updates an existing entry in the target flow table, the entry to be stored at this time stores the historical data flow and historical timestamp that are about to be overwritten. Storing timestamps in the entry to be stored is crucial to implementing the aging mechanism of the flow, because it allows the system to identify which flows are active and which flows have not had new data packets passing for a long time and can be considered for aging and removal.
[0141] In practical applications, there are multiple ways to filter out the entries to be stored from the multiple entries included in the target flow table according to the data flow attribute information, and the selection is made according to the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, an index can be established for each entry in the target flow table based on a common query field (such as an IP address, a port number, etc.), and the data flow attribute information and the index of each entry are matched, and the entries to be stored are filtered out from the multiple entries included in the target flow table according to the matching results.
[0142] In another possible implementation of the present specification, the above-mentioned filtering out the entry to be stored from the multiple entries included in the target flow table according to the data flow attribute information may include the following steps:
[0143] Determine entry identification information of the data flow to be stored according to the data flow attribute information, wherein the entry identification information is used to identify the entry corresponding to the data flow to be stored in the target flow table;
[0144] Based on the entry identification information, the entry to be stored is screened out from the multiple entries included in the target flow table.
[0145] In practical applications, a hash function can be used to map data stream attribute information to a fixed-size value, which is also the entry identification information. According to the data stream attribute information, the entry identification information of the data stream to be stored is determined, including but not limited to the following implementation methods: Direct hashing: All fields of the five-tuple are concatenated into a long string or byte array, and a hash function is used to quickly generate a fixed-length hash value as the entry identification information. Weighted combination: Different weights are assigned to each field in the five-tuple, and then hash calculations are performed to obtain the entry identification information. For example, IP addresses can be given a higher weight because they are usually more distinguishable than port numbers in network communications. Hierarchical hashing: First, a preliminary hash value is generated based on part of the five-tuple information (such as only the IP address), and then the hash value is further refined in combination with other information (such as port numbers and protocols) to obtain the entry identification information. The possibility of collision is reduced by gradually refining the hash result.
[0146] By applying the solution of the embodiments of this specification, based on the entry identification information, the entries to be stored are screened out from the multiple entries included in the target flow table, thereby improving the accuracy of the entries to be stored and further improving the accuracy of flow table processing.
[0147] Step 506: Determine the storage unit to be updated corresponding to the target storage entry from the multiple storage units included in the target state table, wherein the multiple storage units correspond to the multiple entries one-to-one, and the storage units are used to store the state information of the corresponding entries.
[0148] Step 508: Update the state information stored in the storage unit to be updated, and obtain an updated target state table, wherein the updated state information indicates that the target storage entry is valid.
[0149] It should be noted that in order to ensure the consistency between the target status table and the target flow table, the data flow and timestamp to be stored are stored in the entry to be stored. After obtaining the target storage entry, since the target flow table has changed, the target status table can be updated based on the changed target storage entry to obtain an updated target flow table consistent with the target flow table, and the updated target flow table can be written back to the target memory.
[0150] By applying the scheme of the embodiments of this specification, by screening out the entries to be stored according to the data flow attribute information, it is ensured that only the data flows that meet the specific conditions will be written into the flow table, avoiding unnecessary entry occupation, improving the space utilization of the flow table, and making the query operation faster. The timestamp carried by each data flow to be stored is accurately recorded in the corresponding entry, providing an important reference basis for subsequent aging processing. While storing the data flow and timestamp in the target flow table, the status information of the corresponding entry in the target status table is immediately updated, ensuring the consistency between the target flow table and the target status table, and enhancing the reliability of the system.
[0151] In an optional embodiment of the present specification, before determining the storage unit to be updated corresponding to the target storage entry from the multiple storage units included in the target state table, the following steps may also be included:
[0152] Creating an initial state table in a target memory, wherein the target memory includes at least one of an onboard memory and a memory, and the initial state table includes a plurality of initial storage units, and the plurality of initial storage units correspond one-to-one to the plurality of entries;
[0153] State information is configured for a plurality of initial storage units to obtain a plurality of storage units, and a target state table is constructed based on the plurality of storage units, wherein the state information stored in the plurality of storage units indicates that the corresponding entries are invalid.
[0154] Exemplarily, it is assumed that the target flow table includes three entries, which are entry 1, entry 2, and entry 3. An initial state table is created for the target flow table, and the initial state table includes three initial storage units, which are initial storage unit 1 corresponding to entry 1, initial storage unit 2 corresponding to entry 2, and initial storage unit 3 corresponding to entry 3. Since each entry in the target flow table does not include a data flow, it means that entry 1, entry 2, and entry 3 are all invalid. Therefore, the state information "0" can be stored in the initial storage unit 1, the state information "0" can be stored in the initial storage unit 2, and the state information "0" can be stored in the initial storage unit 3 to obtain the target state table corresponding to the target flow table.
[0155] By applying the solution of the embodiment of this specification, a target state table corresponding to the target flow table is stored in the target memory, which provides an important reference basis for the subsequent aging processing of the target flow table.
[0156] See also Figure 6 , Figure 6An architecture diagram of a second flow table processing system provided by an embodiment of the present specification is shown, and the flow table processing system includes a network card and a CPU. The CPU includes a network data plane and a network control plane. The network card includes a controller of an onboard memory, a control plane logic unit, a project processing logic unit, and an aging engine. The control plane logic unit can implement the insertion of flow tables and the maintenance of target status tables. The controller is used to manage and control the read and write operations of the onboard memory. In addition to storing the target flow table, the onboard memory separately allocates storage space for storing the target status table corresponding to the target flow table. The network data plane and the network control plane interact with the control plane logic unit, the project processing logic unit, and the aging engine through the PCIe interface for data transmission.
[0157] See also Figure 7 , Figure 7 An architecture diagram of a third flow table processing system provided by an embodiment of the present specification is shown, and the flow table processing system includes a network card and a CPU. The CPU includes a network data plane and a network control plane. The network card includes a controller of an onboard memory, a control plane logic unit, a project processing logic unit, and an aging engine. The controller is used to manage and control the read and write operations of the onboard memory. The onboard memory is used to store the target flow table. The network data plane and the network control plane interact with the control plane logic unit, the project processing logic unit, and the aging engine through the PCIe interface to transmit data. In actual applications, the capacity of the onboard memory on the network card may be limited. Therefore, the target state table corresponding to the target flow table can be stored in the memory storage on the CPU side, and the aging engine reads the target state table through the PCIe interface.
[0158] See also Figure 8 , Figure 8 A flowchart of another flow table processing method provided by an embodiment of the present specification is shown. The control unit processes the data flow to be processed from the network port in the following stages: entry screening stage, data flow storage stage and target state table update stage. These three stages are described in detail below.
[0159] Entry screening stage: determining the entry identification information of the data flow to be stored according to the data flow attribute information of the data flow to be processed; based on the entry identification information, screening the entry to be stored from the multiple entries included in the target flow table;
[0160] Data stream storage stage: the data stream to be stored is stored in the entry to be stored, and the historical timestamp stored in the entry to be stored is updated to the timestamp carried by the data stream to be processed, so as to obtain the target storage entry;
[0161] Target state table update phase: determining a storage unit to be updated corresponding to the target storage entry from a plurality of storage units included in the target state table, and updating the state information stored in the storage unit to be updated, wherein the updated state information indicates that the target storage entry is valid.
[0162] See also Fig. 9 , Fig. 9 A schematic diagram of the structure of a network card provided by an embodiment of the present specification is shown, and the network card includes a control plane logic unit 902 and an aging engine 904;
[0163] The control plane logic unit 902 is used to respond to the information storage instruction sent by the control unit, store the data flow to be stored and the timestamp of the data flow to be stored carried by the information storage instruction into the to-be-stored entry of the target flow table, and obtain the target storage entry, wherein the to-be-stored entry is obtained by the control unit from a plurality of entries included in the target flow table based on the data flow attribute information carried by the data flow to be stored;
[0164] The aging engine 904 is used to determine the target storage unit from the target state table corresponding to the target flow table, wherein the target storage unit is at least one storage unit in the target state table; read the target state information from the target storage unit, and when it is determined based on the target state information that the target entry is valid, obtain the target timestamp stored in the target entry, wherein the target entry is the entry corresponding to the target storage unit; perform flow table aging according to the target timestamp and the preset lifetime to obtain the flow table aging result.
[0165] The above is a schematic solution of a network card of this embodiment. It should be noted that the technical solution of the network card and the technical solution of the above flow table processing method belong to the same concept, and the details of the technical solution of the network card that are not described in detail can be referred to the description of the technical solution of the above flow table processing method.
[0166] Corresponding to the above flow table processing method embodiment, this specification also provides a flow table processing device embodiment, Fig.10 FIG. 1 shows a schematic diagram of the structure of a flow table processing device provided by an embodiment of the present specification. Fig.10 As shown, the device is applied to an aging engine in a flow table processing system, including:
[0167] The first determination module 1002 is configured to determine a target storage unit from a target state table corresponding to the target flow table, wherein the target flow table includes a plurality of entries, the entries are used to store timestamps of data flows, the target state table includes a plurality of storage units corresponding to the entries one by one, the storage units are used to store state information of the corresponding entries, and the target storage unit is at least one storage unit in the target state table;
[0168] The first acquisition module 1004 is configured to read target state information from the target storage unit, and if it is determined based on the target state information that the target entry is valid, acquire the target timestamp stored in the target entry, wherein the target entry is an entry corresponding to the target storage unit;
[0169] The aging module 1006 is configured to perform flow table aging according to the target timestamp and the preset lifetime to obtain a flow table aging result.
[0170] Optionally, the aging module 1006 is further configured to filter out entries to be aged from the target entries according to the target timestamp and the preset lifetime; call the control unit to delete the data flow in the entries to be aged based on the entry identification information of the entries to be aged, and obtain the flow table aging result.
[0171] Optionally, the aging module 1006 is further configured to obtain a current timestamp; determine the data flow lifetime of the target entry according to the current timestamp and the target timestamp; and filter out entries to be aged from the target entry according to the data flow lifetime and the preset lifetime.
[0172] Optionally, the aging module 1006 is further configured to, when the data stream survival time is less than or equal to the preset survival time, determine the next storage unit of the target storage unit as the updated target storage unit, and return to execute the step of reading the target status information from the target storage unit until the data stream survival time is greater than the preset survival time, and determine the target entry as an entry to be aged.
[0173] Optionally, the aging module 1006 is further configured to call the control unit according to the control unit calling condition, delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result.
[0174] Optionally, the control unit calling condition includes an entry quantity condition; the aging module 1006 is further configured to call the control unit when the number of entries to be aged meets the entry quantity condition, delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result.
[0175] Optionally, the device further includes: a second updating module configured to update the state information stored in the storage unit to be aged, wherein the storage unit to be aged is a storage unit corresponding to the entry to be aged in the target state table, and the updated state information indicates that the entry to be aged is invalid.
[0176] Optionally, the target state table is stored in an onboard memory; the device further includes: a first reading module, configured to read the target state table corresponding to the target flow table from the onboard memory through a controller of the onboard memory.
[0177] Optionally, the target state table is stored in a memory storage device; the device further includes: a second reading module configured to read the target state table corresponding to the target flow table from the memory storage device via a connection bus.
[0178] The solution of the embodiment of the present specification is applied, by introducing the target state table corresponding to the target flow table, filtering is performed in the aging engine based on the target state table, and only the entries with valid state information are queried, thereby avoiding the waste of bandwidth caused by reading a large number of invalid entries, saving precious bandwidth resources, realizing fast scanning of the target flow table, improving the flow table processing efficiency, and supporting more frequent aging operations, thereby improving the aging accuracy of the entire system. In addition, through the target state table, the state information of the target flow table is more intuitive and easy to manage. For developers, it is easier to understand and track which entries are active and which have been deleted by aging, simplifying troubleshooting and performance tuning.
[0179] The above is a schematic scheme of a flow table processing device of this embodiment. It should be noted that the technical scheme of the flow table processing device and the technical scheme of the flow table processing method of the aging engine applied to the flow table processing system belong to the same concept. For details not described in detail in the technical scheme of the flow table processing device, please refer to the description of the technical scheme of the flow table processing method.
[0180] Corresponding to the above flow table processing method embodiment, this specification also provides a flow table processing device embodiment, Fig.11 FIG. 2 shows a schematic diagram of the structure of another flow table processing device provided by an embodiment of the present specification. Fig.11 As shown, the device is applied to a control unit in a flow table processing system, including:
[0181] The second acquisition module 1102 is configured to acquire a data stream to be stored, wherein the data stream to be stored carries data stream attribute information and a timestamp;
[0182] The storage module 1104 is configured to filter out the entry to be stored from the multiple entries included in the target flow table according to the data flow attribute information, and store the data flow to be stored and the timestamp to the entry to be stored, so as to obtain the target storage entry;
[0183] The second determination module 1106 is configured to determine the storage unit to be updated corresponding to the target storage entry from the multiple storage units included in the target state table, wherein the multiple storage units correspond to the multiple entries one by one, and the storage units are used to store the state information of the corresponding entries;
[0184] The first updating module 1108 is configured to update the state information stored in the storage unit to be updated, and obtain an updated target state table, wherein the updated state information indicates that the target storage entry is valid.
[0185] Optionally, the storage module 1104 is further configured to determine entry identification information of the data flow to be stored based on the data flow attribute information, wherein the entry identification information is used to identify the entry corresponding to the data flow to be stored in the target flow table; based on the entry identification information, filter out the entry to be stored from the multiple entries included in the target flow table.
[0186] Optionally, the device also includes: a creation module, configured to create an initial state table in a target memory, wherein the target memory includes at least one of an onboard memory and a memory, and the initial state table includes multiple initial storage units, and the multiple initial storage units correspond one-to-one to the multiple entries; configuring state information for the multiple initial storage units, obtaining multiple storage units, and constructing a target state table based on the multiple storage units, wherein the state information stored in the multiple storage units indicates that the corresponding entries are invalid.
[0187] By applying the scheme of the embodiments of this specification, by screening out the entries to be stored according to the data flow attribute information, it is ensured that only the data flows that meet the specific conditions will be written into the flow table, avoiding unnecessary entry occupation, improving the space utilization of the flow table, and making the query operation faster. The timestamp carried by each data flow to be stored is accurately recorded in the corresponding entry, providing an important reference basis for subsequent aging processing. While storing the data flow and timestamp in the target flow table, the status information of the corresponding entry in the target status table is immediately updated, ensuring the consistency between the target flow table and the target status table, and enhancing the reliability of the system.
[0188] The above is a schematic scheme of a flow table processing device of this embodiment. It should be noted that the technical scheme of the flow table processing device and the technical scheme of the flow table processing method of the control unit applied to the flow table processing system belong to the same concept, and the details not described in detail in the technical scheme of the flow table processing device can be found in the description of the technical scheme of the flow table processing method.
[0189] Fig.12 The block diagram of a computing device provided by an embodiment of the present specification is shown. The components of the computing device 1200 include but are not limited to a memory 1210 and a processor 1220. The processor 1220 is connected to the memory 1210 via a bus 1230, and the database 1250 is used to store data.
[0190] The computing device 1200 also includes an access device 1240 that enables the computing device 1200 to communicate via one or more networks 1260. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1240 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world microwave interconnection access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0191] In one embodiment of the present specification, the above components of the computing device 1200 and Fig.12 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.12 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0192] The computing device 1200 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1200 may also be a mobile or stationary server.
[0193] The processor 1220 is used to execute a computer program / instruction, which implements the steps of the above-mentioned flow table processing method when executed by the processor.
[0194] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned flow table processing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned flow table processing method.
[0195] An embodiment of the present specification further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned flow table processing method when executed by a processor.
[0196] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the flow table processing method described above are of the same concept, and the details not described in detail in the technical scheme of the storage medium can be found in the description of the technical scheme of the flow table processing method described above.
[0197] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned flow table processing method when executed by a processor.
[0198] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the flow table processing method described above are of the same concept, and the details not described in detail in the technical scheme of the computer program product can be found in the description of the technical scheme of the flow table processing method described above.
[0199] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0200] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0201] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0202] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0203] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A flow table processing method, applied to an aging engine in a flow table processing system, the method comprising: Determine a target storage unit from a target state table corresponding to the target flow table, wherein the target flow table includes a plurality of entries, the entries are used to store timestamps of data flows, the target state table includes a plurality of storage units corresponding to the entries one by one, the storage units are used to store state information of the corresponding entries, and the target storage unit is at least one storage unit in the target state table; Reading target state information from the target storage unit, and obtaining a target timestamp stored in the target entry when determining that the target entry is valid based on the target state information, wherein the target entry is an entry corresponding to the target storage unit, and the validity of the target entry indicates that the data stream stored in the target entry is valid; The flow table is aged according to the target timestamp and the preset lifetime to obtain a flow table aging result.
2. According to the method of claim 1, the step of aging the flow table according to the target timestamp and the preset lifetime to obtain the flow table aging result comprises: Filtering the entries to be aged from the target entries according to the target timestamp and the preset survival time; The control unit is called to delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result.
3. The method according to claim 2, wherein the step of filtering out the entries to be aged from the target entries according to the target timestamp and the preset lifetime comprises: Get the current timestamp; Determine the data flow survival time of the target entry according to the current timestamp and the target timestamp; According to the data flow lifetime and the preset lifetime, the entries to be aged are screened out from the target entries.
4. The method according to claim 3, wherein the step of selecting the entry to be aged from the target entry according to the data flow lifetime and the preset lifetime comprises: When the data stream survival time is less than or equal to the preset survival time, the next storage unit of the target storage unit is determined as the updated target storage unit, and the step of reading the target status information from the target storage unit is returned to be executed until the data stream survival time is greater than the preset survival time, and the target entry is determined as an entry to be aged.
5. The method according to claim 2, wherein the calling control unit deletes the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtains the flow table aging result, comprising: According to the control unit calling condition, the control unit is called based on the entry identification information of the entry to be aged, the data flow in the entry to be aged is deleted, and the flow table aging result is obtained.
6. The method according to claim 5, wherein the control unit calling condition includes an entry quantity condition; The step of calling the control unit according to the control unit calling condition, deleting the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtaining the flow table aging result includes: When the number of the entries to be aged meets the entry number condition, the control unit is called to delete the data flow in the entry to be aged based on the entry identification information of the entry to be aged, and obtain the flow table aging result.
7. The method according to any one of claims 1 to 6, wherein after performing flow table aging according to the target timestamp and the preset lifetime and obtaining the flow table aging result, the method further comprises: The state information stored in the storage unit to be aged is updated, wherein the storage unit to be aged is a storage unit corresponding to the entry to be aged in the target state table, and the updated state information indicates that the entry to be aged is invalid.
8. The method according to any one of claims 1 to 6, wherein the target state table is stored in an onboard memory; Before determining the target storage unit from the target state table corresponding to the target flow table, the method further includes: The target state table corresponding to the target flow table is read from the onboard memory through the controller of the onboard memory.
9. The method according to any one of claims 1 to 6, wherein the target state table is stored in a memory storage; Before determining the target storage unit from the target state table corresponding to the target flow table, the method further includes: The target state table corresponding to the target flow table is read from the memory storage through the connection bus.
10. A flow table processing method, applied to a control unit in a flow table processing system, the method comprising: Acquire a data stream to be stored, wherein the data stream to be stored carries data stream attribute information and a timestamp; According to the data flow attribute information, filter out an entry to be stored from a plurality of entries included in the target flow table, and store the data flow to be stored and the timestamp into the entry to be stored, so as to obtain a target storage entry; Determine, from a plurality of storage units included in the target state table, a storage unit to be updated corresponding to the target storage entry, wherein the plurality of storage units correspond to the plurality of entries one by one, and the storage unit is used to store state information of the corresponding entry; Update the status information stored in the storage unit to be updated to obtain an updated target status table, wherein the updated status information indicates that the target storage entry is valid, and the target storage entry is valid, indicating that the data flow stored in the target storage entry is valid, and the updated target status table is used in the flow table processing of the aging engine.
11. The method according to claim 10, wherein the step of filtering out the entry to be stored from the plurality of entries included in the target flow table according to the data flow attribute information comprises: Determine, according to the data flow attribute information, entry identification information of the data flow to be stored, wherein the entry identification information is used to identify the entry corresponding to the data flow to be stored in the target flow table; Based on the entry identification information, the entry to be stored is screened out from the multiple entries included in the target flow table.
12. The method according to claim 10, before determining the storage unit to be updated corresponding to the target storage entry from the plurality of storage units included in the target state table, further comprising: Creating an initial state table in a target memory, wherein the target memory includes at least one of an onboard memory and a memory, and the initial state table includes a plurality of initial storage units, and the plurality of initial storage units correspond one-to-one to the plurality of entries; State information is configured for the multiple initial storage units to obtain multiple storage units, and a target state table is constructed based on the multiple storage units, wherein the state information stored in the multiple storage units indicates that the corresponding entries are invalid.
13. A flow table processing system, comprising an aging engine and a control unit, wherein the aging engine is deployed on a terminal device and the control unit is deployed on a cloud device; The control unit is used to obtain the data stream to be stored, wherein: The data stream to be stored carries data stream attribute information and a timestamp; based on the data stream attribute information, the entry to be stored is screened out from a plurality of entries included in the target flow table, and the data stream to be stored and the timestamp are stored in the entry to be stored to obtain a target storage entry; from a plurality of storage units included in a target status table, a storage unit to be updated corresponding to the target storage entry is determined, wherein the plurality of storage units correspond one-to-one to the plurality of entries, and the storage unit is used to store status information of the corresponding entry; the status information stored in the storage unit to be updated is updated to obtain an updated target status table, wherein the updated status information indicates that the target storage entry is valid, and the validity of the target storage entry indicates that the data stream stored in the target storage entry is valid, and the updated target status table is used in the flow table processing process of the aging engine; The aging engine is used to determine a target storage unit from a target state table corresponding to the target flow table, wherein the target storage unit is at least one storage unit in the target state table; read target state information from the target storage unit, and when it is determined that the target entry is valid based on the target state information, obtain the target timestamp stored in the target entry, wherein the target entry is the entry corresponding to the target storage unit; perform flow table aging according to the target timestamp and a preset lifetime to obtain a flow table aging result, wherein the valid target entry indicates that the data flow stored in the target entry is valid.
14. A network card comprising a control plane logic unit and an aging engine; The control plane logic unit is used to respond to the information storage instruction sent by the control unit, store the data flow to be stored and the timestamp of the data flow to be stored carried by the information storage instruction into the to-be-stored entry of the target flow table, and obtain the target storage entry, wherein: The entry to be stored is obtained by the control unit screening from a plurality of entries included in the target flow table based on the data flow attribute information carried by the data flow to be stored; The aging engine is used to determine a target storage unit from a target state table corresponding to the target flow table, wherein the target storage unit is at least one storage unit in the target state table; read target state information from the target storage unit, and when it is determined based on the target state information that the target entry is valid, obtain a target timestamp stored in the target entry, wherein the target entry is an entry corresponding to the target storage unit, and the validity of the target entry indicates that the data flow stored in the target entry is valid; perform flow table aging according to the target timestamp and a preset lifetime to obtain a flow table aging result.
15. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 12 are implemented.
16. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method according to any one of claims 1 to 12.
17. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
MAC address aging method and device and electronic equipment
CN108307001A