Flow table management method and circuit

By building a count search tree, the problem of quickly finding the minimum activity parameter of OVS flow table entries in a busy network environment is solved, reducing the number of memory fetches, and improving the flow table management efficiency and update speed.

CN120499092APending Publication Date: 2025-08-15T HEAD (CHENGDU) SEMICONDUCTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510449980.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

In a busy network environment, it is a challenge to quickly and efficiently find the flow table entry with the smallest activity parameters of the OVS flow table entry for replacement, with traditional methods leading to frequent memory access, increasing time complexity and degrading system performance.

Method used

Build a count search tree, by reading the current count search table in sequence with a predetermined read width, obtaining multiple sets of data to be compressed, determining the minimum activity parameter and its position information in the current count search table, and constructing the next level count search table until the construction end condition is met, and obtaining the count search tree.

Benefits of technology

It significantly reduces the number of memory accesses during flow table management, and improves the efficiency and update speed of flow table management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120499092A_ABST
    Figure CN120499092A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a flow table management method and circuit. According to the method, a current counting search table is sequentially read according to a preset reading width, multiple sets of data to be compressed are obtained, the data to be compressed comprise multiple data entries, the data entries comprise aging counter parameters or comprise activeness parameters and corresponding index information, the aging counter parameters comprise the activeness parameters, and the activeness parameters comprise the activeness parameters and the corresponding index information. The index information represents the position of the activeness parameter in the previous-level counting search table, obtaining the minimum activeness parameter in each group of to-be-compressed data, and determining data items of the next-level counting search table based on the minimum activeness parameter and the position information of the minimum activeness parameter in the current counting search table so as to construct the next-level counting search table, in response to the fact that the next-level counting search table meets the construction ending condition, a counting search tree is obtained, and the counting search tree comprises all levels of counting search tables. The counting search tree constructed on the basis of the method can greatly reduce the memory access times during flow table management, and the flow table management efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and more particularly, to a flow table management method and circuit. Background Art

[0002] In modern computing networks, Open vSwitch (OVS) is widely used in cloud computing and data center environments to manage network traffic and implement virtual network architectures. The performance of the OVS flow table directly affects the speed and efficiency of network packet processing. In the OVS flow table, each flow entry is typically configured with a corresponding aging counter to record and manage the lifecycle of the corresponding flow entry. When a new flow entry needs to be inserted into the OVS flow table and the flow table is full, an appropriate flow entry must be found to replace it. By comparing the activity parameters of the flow entries, those flow entries that are no longer used or are about to age can be found for replacement. However, in a busy network environment, quickly and efficiently finding the flow entry with the lowest activity parameter to replace is a challenging task. The traditional method is to read and compare all the aging counters corresponding to the flow table in sequence. This method will result in frequent memory access in large-capacity flow tables, thereby increasing time complexity and reducing system performance, especially during peak traffic periods or when the flow table is frequently updated.

[0003] Therefore, how to manage flow tables more efficiently is an urgent problem that needs to be solved. Summary of the Invention

[0004] In view of this, an embodiment of the present invention provides a flow table management method and circuit to construct a counting search tree, thereby greatly reducing the number of memory accesses during flow table management and accelerating the flow table update speed.

[0005] In a first aspect, a flow table management method is provided, the method comprising:

[0006] Sequentially reading the current counting search table with a predetermined reading width to obtain multiple groups of to-be-compressed data, the to-be-compressed data including multiple data entries, the data entries including aging counter parameters, or the data entries including activity parameters and corresponding index information, the aging counter parameters including the activity parameters, the index information representing position information of the corresponding activity parameters in the previous level counting search table;

[0007] Obtaining a minimum activity parameter in each group of the data to be compressed;

[0008] Determining data entries of a next-level counting search table based on the minimum activity parameter and position information of the minimum activity parameter in the current counting search table to construct the next-level counting search table;

[0009] In response to the next-level counting search table satisfying a construction end condition, a counting search tree is obtained, where the counting search tree includes counting search tables at each level.

[0010] In a second aspect, a flow table management circuit is provided, the circuit comprising:

[0011] a data loading unit, configured to sequentially read the current counting search table with a predetermined reading width to obtain multiple sets of data to be compressed, wherein the data to be compressed includes multiple data entries, the data entries include aging counter parameters, or the data entries include activity parameters and corresponding index information, the aging counter parameters include the activity parameters, and the index information represents position information of the corresponding activity parameters in the previous level counting search table;

[0012] A calculation unit, used to determine the minimum activity parameter in the data flow table;

[0013] a processing unit, configured to determine a data entry of a next-level counting search table based on the minimum activity parameter and position information of the minimum activity parameter in the current counting search table, so as to construct the next-level counting search table;

[0014] The storage unit is configured to obtain a counting search tree in response to the next level counting search table satisfying a construction end condition, wherein the counting search tree includes counting search tables at each level.

[0015] In a third aspect, a flow table management device is provided, the device comprising:

[0016] a reading module, configured to sequentially read the current counting search table with a predetermined reading width to obtain multiple groups of data to be compressed, wherein the data to be compressed includes multiple data entries, the data entries include aging counter parameters, or the data entries include activity parameters and corresponding index information, the aging counter parameters include the activity parameters, and the index information represents position information of the corresponding activity parameters in the previous level counting search table;

[0017] A first acquisition module is used to obtain the minimum activity parameter in each group of the data to be compressed;

[0018] a determining module, configured to determine a data entry of a next-level counting search table based on the minimum activity parameter and position information of the minimum activity parameter in the current counting search table, so as to construct the next-level counting search table;

[0019] The second acquisition module is configured to acquire a counting search tree in response to the next level counting search table satisfying a construction end condition, where the counting search tree includes counting search tables at various levels.

[0020] In a fourth aspect, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect above.

[0021] In a fifth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.

[0022] In a sixth aspect, a computer program product is provided, comprising a computer program / instruction, which, when executed by a processor, implements the method described in the first aspect above.

[0023] The technical solution of this embodiment is to read the current counting search table in sequence with a predetermined reading width to obtain multiple groups of data to be compressed, the data to be compressed includes multiple data entries, the data entries include aging counter parameters, or the data entries include activity parameters and corresponding index information, the aging counter parameters include activity parameters, the index information represents the position information of the corresponding activity parameters in the previous level counting search table, obtain the minimum activity parameter in each group of data to be compressed, based on the minimum activity parameter and the position information of the minimum activity parameter in the current counting search table, determine the data entry of the next level counting search table to construct the next level counting search table, in response to the next level counting search table meeting the construction end condition, obtain a counting search tree, the counting search tree includes counting search tables at all levels. The counting search tree constructed based on the above technical solution can greatly reduce the number of memory accesses during flow table management, and speed up flow table management efficiency and update speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0025] Figure 1 A flowchart of a conventional method for reading an aging counter;

[0026] Figure 2 A schematic diagram of a search table corresponding to a traditional method;

[0027] Figure 3 Flow chart of a flow table management method according to an embodiment of the present invention;

[0028] Figure 4 A schematic diagram of a counting search tree according to an embodiment of the present invention;

[0029] Figure 5 Flowchart of a method for constructing a next-level counting search table according to an embodiment of the present invention;

[0030] Figure 6 This is a flowchart of a method for inserting a new flow table entry according to an embodiment of the present invention;

[0031] Figure 7 Flowchart of a method for determining a target flow entry location according to an embodiment of the present invention;

[0032] Figure 8 Schematic diagram of a flow table management circuit according to an embodiment of the present invention;

[0033] Figure 9 Schematic diagram of a flow table management device according to an embodiment of the present invention;

[0034] Figure 10 FIG. 4 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0035] The present application is described below based on the following embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without the description of these details. To avoid obscuring the essence of the present application, well-known methods, processes, procedures, components, and circuits are not described in detail.

[0036] Furthermore, persons of ordinary skill in the art will appreciate that the figures provided herein are for illustration purposes only and are not necessarily drawn to scale.

[0037] Unless the context clearly requires otherwise, words like “include”, “comprising” and the like throughout this application should be interpreted as including rather than exclusive or exhaustive; that is, as meaning “including but not limited to”.

[0038] In the description of this application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood to indicate or imply relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.

[0039] Where the solutions described in this specification and in the examples involve the processing of personal information, such processing will be conducted with a legitimate basis (e.g., with the consent of the personal information subject or as necessary for the performance of a contract) and only within the prescribed or agreed scope. A user's refusal to process personal information other than that required for basic functions will not affect the user's use of these basic functions.

[0040] In modern computing networks, Open vSwitch (OVS) is widely used in cloud computing and data center environments to manage network traffic and implement virtual network architectures. The performance of the OVS flow table directly affects the processing speed and efficiency of network packets. In the OVS flow table, each flow entry is usually configured with a corresponding aging counter to record and manage the life cycle of the corresponding flow entry. When a new flow entry needs to be inserted into the OVS flow table and the flow table is full, an appropriate flow entry must be found to replace it. At this time, by comparing the activity parameters of the flow entries, those flow entries that are no longer used or are about to age can be found and replaced.

[0041] However, in busy network environments, quickly and efficiently finding the flow table entry with the smallest activity parameter for replacement is a challenging task. Traditional methods sequentially read and compare all aging counters corresponding to the flow table. This approach results in frequent memory accesses for large flow tables, increasing time complexity and degrading system performance, especially during peak traffic periods or when flow tables are frequently updated.

[0042] Figure 1 Flowchart of the traditional method for reading the aging counter. Figure 1 As shown, the conventional method for reading the aging counter includes the following steps:

[0043] Step S101: Obtain a flow table update instruction.

[0044] Among them, the flow table update instruction is used to instruct the insertion of a new flow table entry into the flow table. The flow table update instruction includes the new flow table entry and the corresponding aging counter parameters. The flow table is a data structure that stores forwarding rules in OVS and defines how data packets are processed. It is based on the standard of the OpenFlow protocol and supports multi-level flow tables (Pipeline) to implement complex logic. Each flow table contains multiple flow table entries. Data packets match the flow table in sequence until a matching rule is found or the default action is performed, such as discarding or forwarding to the controller. The flow table entry is a specific rule in the flow table that defines the conditions for matching data packets and the corresponding actions. The flow table entry contains information such as matching fields, actions, and priorities. The matching field is used to match data packets. The action represents the action performed on the matched data packet, such as forwarding to a specified port, modifying the data packet, sending to the controller, discarding, etc. Flow table entries are sorted by priority, and high-priority entries are matched first. Flow aging is a resource management mechanism used to automatically clean up flow entries that have not been used for a long time, preventing the flow table from being filled with invalid rules and improving performance. This mechanism can be triggered by conditions such as manual deletion by an administrator, deletion instructions issued by the controller, or the activity level of a flow entry falling below a predetermined level within a set time. The activity level of a flow entry is based on the corresponding aging counter, which tracks the activity level of the flow entry. When a flow entry is created, the counter begins recording its activity level. The activity level of a flow entry is reflected by the activity parameter, which is inversely proportional to the creation time and directly proportional to the frequency of use of the corresponding flow entry. For example, when a flow entry is created, its corresponding count has a predetermined initial value (e.g., 100), which decreases over time. When it is matched and used, the count increases by a predetermined value (e.g., 1). The lower the count, the lower the activity level.

[0045] It should be noted that the counting principles of different aging counters are different. In the above example, the count of the aging counter decreases over time. In addition, there are also aging counters whose counts increase over time. The higher the count, the lower its activity level. For these two different aging counters, the creation duration and the frequency with which the corresponding flow table entry is used have opposite effects on the activity parameter. In this embodiment, the activity parameter characterizes the activity level of the corresponding flow table entry. For aging counters whose counts decrease over time, the activity parameter is proportional to the count. For aging counters whose counts increase over time, the activity parameter is inversely proportional to the count.

[0046] In one possible implementation, after receiving a flow table update instruction, it is necessary to first determine whether the flow table is full. If not, the new flow entry is directly inserted into the flow table. If it is full, an appropriate flow entry is found and then replaced with the new flow entry. The appropriate flow entry is typically the least active flow entry in the flow table. The following explanation assumes that the flow table is full when the flow table update instruction is received.

[0047] The following steps S102 to S107 are a process of searching for the flow entry with the lowest activity level.

[0048] Step S102 : reading a set of aging counter parameters with a predetermined reading width.

[0049] Among them, the predetermined read width is the memory access width (MAW). Specifically, the predetermined read width is the read width of the cache interface, that is, the data width that can be read at one time through the cache interface. The aging counter parameters are parameters related to the corresponding aging counter, including at least the activity parameter. A set of aging counter parameters refers to the aging counter parameters read at one time with the predetermined read width. For example, if the predetermined read width is 64B and the data width of an aging counter parameter is 1B, then a set of aging counter parameters includes 64 aging counter parameters.

[0050] Step S103: determining the minimum activity parameter in the set of aging counter parameters.

[0051] Step S104: Determine whether the minimum activity parameter of the group is less than the candidate activity parameter.

[0052] The candidate activity parameter is the minimum activity parameter currently recorded.

[0053] If yes, go to step S105; if no, go to step S106.

[0054] Step S105: Update the candidate activity parameter to the minimum activity parameter of the group.

[0055] Step S106: Determine whether the aging counter parameters have been read.

[0056] If yes, go to step S107; if no, go to step S102.

[0057] Step S107: determining the candidate activity parameter as the target activity parameter.

[0058] The processing of the above steps S102 to S107 is specifically as follows: when reading the first group of aging counter parameters, the candidate activity parameter is empty. After determining the minimum activity parameter in the first group of aging counter parameters, it is determined as the candidate activity parameter. Next, when reading the aging counter parameters of the non-first group (that is, the second group, the third group, ..., the Nth group), the minimum activity parameter in the group of aging counter parameters is compared with the candidate activity parameter, and the smaller value of the two is determined as the candidate activity parameter, that is, if the minimum activity parameter in the group of aging counter parameters is less than the candidate activity parameter, the candidate activity parameter is updated to the minimum activity parameter in the group of aging counter parameters. If the minimum activity parameter in the group of aging counter parameters is not less than the candidate activity parameter, the candidate activity parameter is not updated. Repeat the above process until all aging counter parameters corresponding to the flow table are read, and the final candidate activity parameter is determined as the target activity parameter.

[0059] Step S108: Update the new flow table entry to the target flow table entry position corresponding to the target activity parameter.

[0060] Specifically, the location information corresponding to the target activity parameter is determined, and then the original flow table entry in the location information is overwritten with the new flow table entry.

[0061] Figure 2 Schematic diagram of the search table corresponding to the traditional method. Figure 2 The search table shown is Figure 1 The basis of the method for reading the aging counter parameters shown is Figure 1 When inserting a new flow table entry, the data that needs to be read is the entire Figure 2 The width of the search table is the predetermined reading width. Each time a flow table entry can be read, and each set of aging counter parameters read is written into the search table in turn to obtain Figure 2 Search table shown.

[0062] The calculation formula of a is as follows:

[0063]

[0064] Here, MAW represents the predetermined read width, and counter_size represents the data width of the aging counter parameter.

[0065] The depth d of the search table is calculated as follows:

[0066]

[0067] Among them, table_size represents the total number of flow table entries in the flow table.

[0068] for Figure 1 and Figure 2 For the traditional method shown, inserting a new flow table entry requires traversing all corresponding aging counter parameters in the flow table. For large flow tables, whose capacity can reach tens of megabytes, traversing all aging counter parameters takes a very long time. For example, if a flow table with 16 aging counters has a 64-byte memory access capability and the aging counter data width is 1 byte, and if only 64 aging counters can be read in one memory access, traversing the entire flow table requires approximately 256,000 memory accesses. This high-cost operation not only affects system responsiveness but can also hinder concurrent computing tasks.

[0069] Therefore, the embodiment of the present invention proposes a more efficient flow table management method and circuit.

[0070] Figure 3 FIG. 1 is a flow chart of a flow table management method according to an embodiment of the present invention. Figure 3 As shown, the flow table management method includes the following steps:

[0071] Step S301 : sequentially reading the current count search table with a predetermined reading width to obtain multiple groups of data to be compressed.

[0072] The data read at one time with the predetermined reading width is a group of data to be compressed. Each group of data to be compressed includes multiple data entries. The predetermined reading width is an integer multiple of the data entry width. Therefore, the data read at one time with the predetermined reading width is exactly an integer number of data entries.

[0073] The data entry includes an aging counter parameter, or the data entry includes an activity parameter and corresponding index information, the aging counter parameter includes the activity parameter, and the index information represents position information of the corresponding activity parameter in the upper-level counting search table.

[0074] The predetermined read width, aging counter parameter, and activity parameter are explained in detail in the above-mentioned traditional method.

[0075] The current count search table can be an initial count search table or other level count search tables except the initial count search table. Figure 2 The data entries in the initial count search table include aging counter parameters. The other level count search tables are compressed search tables based on the corresponding previous level count search table. The data entries in the other level count search tables include activity parameters and corresponding index information.

[0076] Because data entries contain different data contents, the data widths of the data entries may vary, resulting in an uncertain number of data entries read at a time using the predetermined read width. Even if the data widths of the data entries are the same, the predetermined read width may not be an integer multiple of the data entries. Therefore, before reading the count search table, it is necessary to adjust the data widths of all data entries to the predetermined data width so that the number of data entries read at a time using the predetermined read width is the same, and the predetermined read width is an integer multiple of the predetermined data width.

[0077] Step S302: Obtain the minimum activity parameter in each group of the data to be compressed.

[0078] Specifically, an intra-group comparison is performed on each group of data to be compressed to determine the minimum activity parameter corresponding to each group of data to be compressed.

[0079] Step S303: Based on the minimum activity parameter and the position information of the minimum activity parameter in the current counting search table, determine the data entry of the next level counting search table to construct the next level counting search table.

[0080] Specifically, a group of data to be compressed in the current counting search table contains multiple data entries. After determining the minimum activity parameter of the group of data to be compressed, a data entry containing the minimum activity parameter and the position information of the minimum activity parameter in the current counting search table is generated. This process is a compression process, that is, compressing a group of data to be compressed in the current counting search table into a data entry in the next-level counting search table.

[0081] Figure 4 Schematic diagram of a counting search tree according to an embodiment of the present invention. Figure 4 As shown, the counting search tree includes multiple levels of counting search tables, namely a primary counting search table, a secondary counting search table, ..., an N-level counting search table, where N is a positive integer. The width of each level of the counting search table is equal. For ease of explanation, the width of each level of the counting search table is the predetermined reading width.

[0082] Figure 5 Flowchart of the method for constructing the next level counting search table according to an embodiment of the present invention. Figure 5 As shown, the method for constructing the next-level counting search table includes the following steps:

[0083] Step S501 : sequentially reading data entries in the next-level counting search table with the predetermined reading width.

[0084] Step S502 : writing the read data entry into the next-level counting search table, where the width of the next-level counting search table is the predetermined reading width.

[0085] Combine Figure 4 For example, assume that the primary counting search table contains 500 data entries, and a row of data (i.e., a group of data to be compressed) contains 5 data entries. Therefore, the number of table rows (i.e., the depth of the table) is 500 / 5 = 100. After each row of data is compressed into one data entry, the primary counting search table is compressed into 100 data entries. When constructing the secondary counting search table, the 100 data entries corresponding to the primary counting search table are read sequentially at a predetermined read width to generate a secondary counting search table with 5 data entries per row, for a total of 100 / 5 = 20 rows. Using the same method to construct the tertiary counting search table, the secondary counting search table has 5 data entries per row, for a total of 20 / 5 = 4 rows.

[0086] Based on the above compression rules, the calculation formula for the depth of the N-th level counting search table is as follows:

[0087]

[0088] Among them, D N Indicates the depth of the N-th level counting search table, counter_size indicates the data width of the data entries in the initial counting search table, and comp_size indicates the data width of the data entries in the other levels of counting search tables. When the data widths of the data entries in the initial counting search table and the other levels of counting search tables are the same, the above formula can be simplified to:

[0089]

[0090] In simple terms, for every two adjacent counting search tables, a set of data to be compressed in the current counting search table is compressed into a data entry in the next level counting search table. The above counting search table construction process is repeated until the next level counting search table meets the construction end condition.

[0091] Step S304 : in response to the next level counting search table satisfying the construction end condition, obtaining a counting search tree, wherein the counting search tree includes counting search tables at each level.

[0092] Specifically, for large-scale flow tables, due to their large table capacity and large number of flow table entries, multiple levels of compression are required to compress the data to a manageable level. Specifically, the number of compression levels can be determined and adjusted based on the size of the flow table and the size of the aging counter parameter.

[0093] In one possible implementation, the construction termination condition is that the number of levels in the next-level counting search table reaches a predetermined number. In other words, the number of levels in the counting search tree can be pre-set. When the predetermined number is reached, compression stops, and a counting search tree containing the predetermined number of levels is obtained. This method is more suitable for non-expandable flow tables, that is, the number of flow table entries in the flow table remains unchanged. Once the predetermined number of levels is determined, the capacity of each level of the counting search table also remains unchanged.

[0094] In one possible implementation, the construction termination condition is that the number of data entries in the next-level counting search table is less than a predetermined number of entries. In other words, the capacity of the counting search table at the last level of the counting search tree is determined. This method is applicable to scalable flow tables, where the number of flow tables can vary. While maintaining the capacity of the last-level counting search table constant, the computational resources used in determining the minimum activity parameter remain constant.

[0095] pass Figure 3 After the counting search tree is constructed by the method shown, a new flow table entry can be inserted into a flow table that is full of flow table entries based on the constructed counting search tree.

[0096] Figure 6 Flowchart of the method for inserting a new flow table entry according to an embodiment of the present invention. Figure 6 As shown, the new flow table entry insertion method includes the following steps:

[0097] Step S601: Obtain a flow table update instruction.

[0098] The flow table update instruction includes the new flow table entry and the corresponding aging counter parameter. Figure 1 The relevant contents of step S101 are not repeated here.

[0099] Step S602 : Based on the corresponding index information, the target activity parameter and the target flow table entry position corresponding to the target activity parameter are read upward in sequence from the last level counting search table of the counting search tree.

[0100] The target activity parameter is the minimum activity parameter in the counting search tree.

[0101] Specifically, after obtaining the flow table update instruction, the data entries of the last level counting search table of the counting search tree are read, the minimum activity parameter in each of the data entries is determined as the target activity parameter, and the target flow table entry position corresponding to the target activity parameter is determined according to the index information of the target activity parameter in the counting search tables at each level.

[0102] That is, in the process of determining the location of the target flow table entry, the processing methods for the last level counting search table and the other level counting search tables except the last level counting search table are different.

[0103] The processing method for the last level counting search table is to scan all data entries in the last level counting search table to determine the minimum activity parameter in the last level counting search table and determine it as the target flow table entry position.

[0104] The processing method for other levels of counting search tables is to determine the position of the target activity parameter in the next level counting search table according to the index information of the target activity parameter in the counting search table at each level, step by step according to the index information of the target activity parameter in the current counting search table, until the position of the target activity parameter in the initial level counting search table is determined, thereby reading the target flow table item position recorded in this position.

[0105] Figure 7 FIG. 1 is a flow chart of a method for determining the location of a target flow entry according to an embodiment of the present invention. Figure 7 As shown, the method for determining the location of the target flow table entry includes the following steps:

[0106] Step S701 : determining the target data to be compressed where the target activity parameter is located in the previous level counting search table according to the index information in the data entry where the target activity parameter is located in the current counting search table.

[0107] The index information of the flow table entry includes a row index and a column index.

[0108] Specifically, first, the data to be compressed to which the target activity parameter in the previous level counting search table belongs is determined according to the index information in the data entry where the target activity parameter in the current counting search table is located.

[0109] Combine Figure 4 As can be seen from the counting search tree, there is a position mapping between counting search tables. Taking the adjacent counting search tables as an example, the entry number of a data entry in the current counting search table is equal to the row number of the data entry in the previous counting search table. For example, the index information of the data entry in the current counting search table is (5, 2), which indicates that the data entry is in the 5th row and 2nd column of the current counting search table. If each row of data has 5 columns, the entry number of the data entry in the current counting search table is 5*5+2=27. Based on the position mapping relationship between adjacent counting search tables, it can be seen that the row number of the data entry in the previous counting search table is 27.

[0110] Specifically, the counting formula for the number of rows i that need to be read in the previous level counting search tree is:

[0111]

[0112] Among them, h_index represents the row index of the data entry corresponding to the target activity parameter in the current counting search tree, and l_index represents the column index of the data entry corresponding to the target activity parameter in the current counting search tree.

[0113] Likewise, when the data widths of the data entries of the initial counter search table and the other-stage counter search tables are the same, comp_size in the above formula may be replaced by counter_size.

[0114] Step S702: Determine the data entry of the target activity parameter in the previous level counting search table from the target data to be compressed.

[0115] Continuing with the previous example, after determining that the row number of the data entry in the previous level counting search table is 27, the data entry to which the target activity parameter belongs is searched from the 27th row of data.

[0116] In one possible implementation, after determining the number of rows in the previous level counting search table for the data entry to which the target activity parameter belongs, the activity parameters of each data entry in the row of data to be compressed can be compared, and the data entry containing the minimum activity parameter is the data entry to which the target activity parameter belongs.

[0117] In one possible implementation, after determining the number of rows in the previous level counting search table for the data entry to which the target activity parameter belongs, the data entry with the activity parameter being the target activity parameter is searched from the row of data to be compressed, that is, the data entry to which the target activity parameter belongs.

[0118] Step S703 : In response to the upper-level counting search table being an initial counting search table in the counting search tree, determining the data entry as a target data entry.

[0119] Specifically, step S701 to step S702 are repeatedly executed until a data entry corresponding to the target activity parameter in the initial count search table is found.

[0120] Step S704: Determine the target flow entry location based on the target data entry.

[0121] In a possible implementation, the aging counter parameter includes, in addition to the activity parameter, a flow entry identifier of the corresponding flow entry, and the position of the corresponding target flow entry in the flow table is determined according to the flow entry identifier.

[0122] In a possible implementation, a mapping relationship between each data entry and the corresponding flow table entry in the initial count search table is pre-stored. After the target data entry is determined, the position of the target flow table entry can be determined according to the mapping relationship.

[0123] Step S603: Update the new flow entry to the target flow entry location.

[0124] pass Figure 6After inserting a new flow table entry, the method needs to re-update the compressed search tree to prepare for the next insertion. Specifically, in response to the target flow table update, the data entry of the location of the new flow table entry in the counting search table at each level of the counting search tree is updated.

[0125] It is worth noting that when updating the counting search tables at all levels, only the data entries to which the aging counter parameters corresponding to the new flow table entries belong are updated.

[0126] Specifically, after a data entry in the current counting search table is updated, the to-be-compressed data to which the updated data entry belongs in the current counting search table is re-read using a predetermined read width. A minimum activity parameter in the set of to-be-compressed data is then re-determined. Based on the minimum activity parameter and the position of the minimum activity parameter in the current counting search table, the to-be-updated data entry in the next-level counting search table is determined to update the next-level counting search table. The above steps are repeated until the counting search table at the last level of the counting search tree is updated.

[0127] The number of memory accesses required to find the minimum activity parameter by traversing using the traditional method is The number of memory accesses required for finding the minimum activity parameter using the counting search tree of this embodiment is The original traversal operation with O(n) complexity is reduced to multiple O(log m n), the target search can usually be achieved with a few memory accesses, which significantly improves the efficiency of flow table management.

[0128] The method of this embodiment is to read the current counting search table in sequence with a predetermined reading width to obtain multiple groups of data to be compressed, the data to be compressed including multiple data entries, the data entries including aging counter parameters, or the data entries including activity parameters and corresponding index information, the aging counter parameters including activity parameters, the index information representing the position information of the corresponding activity parameters in the previous level counting search table, obtain the minimum activity parameter in each group of data to be compressed, based on the minimum activity parameter and the position information of the minimum activity parameter in the current counting search table, determine the data entry of the next level counting search table to construct the next level counting search table, in response to the next level counting search table meeting the construction end condition, obtain a counting search tree, the counting search tree including counting search tables at all levels. The counting search tree constructed based on the above method can greatly reduce the number of memory accesses during flow table management, and speed up flow table management efficiency and update speed.

[0129] Figure 8 FIG. 1 is a schematic diagram of a flow table management circuit according to an embodiment of the present invention. Figure 8 As shown, the flow table management circuit includes:

[0130] The data loading unit 801 is used to read the current counting search table in sequence with a predetermined reading width to obtain multiple groups of data to be compressed, wherein the data to be compressed includes multiple data entries, and the data entries include aging counter parameters, or the data entries include activity parameters and corresponding index information, and the aging counter parameters include the activity parameters, and the index information represents the position information of the corresponding activity parameters in the previous level counting search table.

[0131] The calculation unit 802 is configured to determine a minimum activity parameter in the data flow table.

[0132] The processing unit 803 is configured to determine a data entry of a next-level counting search table based on the minimum activity parameter and position information of the minimum activity parameter in the current counting search table, so as to construct the next-level counting search table.

[0133] The storage unit 804 is configured to obtain a counting search tree in response to the next level counting search table satisfying a construction end condition, where the counting search tree includes counting search tables at each level.

[0134] In one possible embodiment, the data loading unit is also used to obtain a flow table update instruction, which includes a new flow table entry and a corresponding aging counter parameter, and based on the corresponding index information, reads upward in sequence from the last level counting search table of the counting search tree and determines the target activity parameter and the target flow table entry position corresponding to the target activity parameter, where the target activity parameter is the minimum activity parameter in the counting search tree.

[0135] The circuit further includes an updating unit 805 configured to update the new flow entry to the target flow entry location.

[0136] In a possible implementation, the updating unit 805 is further configured to update, in response to the target flow table being updated, data entries of the positions of the new flow table entries in the counting search tables at all levels of the counting search tree.

[0137] The above-mentioned flow table management circuit is used to implement the flow table management method of the above-mentioned embodiment. The specific purpose of each unit in the circuit is detailed in the corresponding method and will not be repeated here.

[0138] The circuit of this embodiment is used to sequentially read the current counting search table with a predetermined read width to obtain multiple groups of data to be compressed, wherein the data to be compressed includes multiple data entries, the data entries include aging counter parameters, or the data entries include activity parameters and corresponding index information, the aging counter parameters include activity parameters, and the index information represents the position information of the corresponding activity parameters in the previous level counting search table, obtain the minimum activity parameter in each group of data to be compressed, and determine the data entry of the next level counting search table based on the minimum activity parameter and the position information of the minimum activity parameter in the current counting search table to construct the next level counting search table. In response to the next level counting search table meeting the construction end condition, a counting search tree is obtained, and the counting search tree includes counting search tables at all levels. Based on the constructed counting search tree, the number of memory accesses during flow table management can be greatly reduced, thereby accelerating the flow table management efficiency and update speed.

[0139] Figure 9 Schematic diagram of a flow table management device according to an embodiment of the present invention. Figure 9 As shown, the flow table management device includes:

[0140] The reading module 901 is used to read the current counting search table in sequence with a predetermined reading width to obtain multiple groups of data to be compressed, wherein the data to be compressed includes multiple data entries, and the data entries include aging counter parameters, or the data entries include activity parameters and corresponding index information, and the aging counter parameters include the activity parameters, and the index information represents the position information of the corresponding activity parameters in the previous level counting search table.

[0141] The first acquisition module 902 is configured to acquire a minimum activity parameter in each group of the data to be compressed.

[0142] The determination module 903 is configured to determine data entries of a next-level counting search table based on the minimum activity parameter and position information of the minimum activity parameter in the current counting search table, so as to construct the next-level counting search table.

[0143] The second acquisition module 904 is configured to acquire a counting search tree in response to the next level counting search table satisfying a construction end condition, where the counting search tree includes counting search tables at each level.

[0144] The device of this embodiment is used to read the current counting search table in sequence with a predetermined reading width to obtain multiple groups of data to be compressed, the data to be compressed including multiple data entries, the data entries including aging counter parameters, or the data entries including activity parameters and corresponding index information, the aging counter parameters including activity parameters, the index information representing the position information of the corresponding activity parameters in the previous level counting search table, obtain the minimum activity parameter in each group of data to be compressed, and determine the data entry of the next level counting search table based on the minimum activity parameter and the position information of the minimum activity parameter in the current counting search table to construct the next level counting search table, and in response to the next level counting search table meeting the construction end condition, obtain a counting search tree, the counting search tree including counting search tables at all levels. The counting search tree constructed by the device based on this embodiment can greatly reduce the number of memory accesses during flow table management, thereby accelerating the flow table management efficiency and update speed.

[0145] Figure 10 FIG is a schematic diagram of an electronic device according to an embodiment of the present invention. In this embodiment, the electronic device 1000 includes a server, a terminal, etc. Figure 10 As shown, the electronic device 1000: includes at least one processor 1001; and a memory 1002 communicatively connected to the at least one processor 1001; and a communication component 1003 communicatively connected to the scanning device, and the communication component 1003 receives and sends data under the control of the processor 1001; wherein the memory 1002 stores instructions that can be executed by at least one processor 1001, and the instructions are executed by at least one processor 1001 to implement the above-mentioned flow table management method.

[0146] Specifically, the electronic device includes: one or more processors 1001 and a memory 1002, Figure 10 A processor 1001 is taken as an example. The processor 1001 and the memory 1002 may be connected via a bus or other means. Figure 10 In the example above, a bus connection is used. Memory 1002, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs, and modules. Processor 1001 executes the non-volatile software programs, instructions, and modules stored in memory 1002 to execute various functional applications and data processing of the device, thereby implementing the above-mentioned flow table management method.

[0147] The memory 1002 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store a list of options, etc. In addition, the memory 1002 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 1002 may optionally include a memory remotely located relative to the processor 1001, and these remote memories may be connected to an external device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0148] One or more modules are stored in the memory 1002 , and when executed by one or more processors 1001 , the flow table management method in any of the above method embodiments is executed.

[0149] The above-mentioned product can execute the method provided in the embodiment of this application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of this application.

[0150] This embodiment obtains multiple groups of data to be compressed by sequentially reading the current counting search table with a predetermined read width. The data to be compressed includes multiple data entries, and the data entries include aging counter parameters, or the data entries include activity parameters and corresponding index information. The aging counter parameters include activity parameters, and the index information represents the position information of the corresponding activity parameters in the previous level counting search table. The minimum activity parameter in each group of data to be compressed is obtained. Based on the minimum activity parameter and the position information of the minimum activity parameter in the current counting search table, the data entry of the next level counting search table is determined to construct the next level counting search table. In response to the next level counting search table meeting the construction end condition, a counting search tree is obtained, and the counting search tree includes counting search tables at all levels. The counting search tree constructed by this embodiment can greatly reduce the number of memory accesses during flow table management, thereby accelerating the flow table management efficiency and update speed.

[0151] Another embodiment of the present invention relates to a computer-readable storage medium having a computer program stored therein. When the computer program is executed by a processor, the computer program implements part or all of the above method embodiments.

[0152] Another embodiment of the present invention relates to a computer program product, comprising a computer program / instruction, which implements part or all of the above method embodiments when executed by a processor.

[0153] That is, those skilled in the art will understand that all or part of the steps in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a program, which is stored in a storage medium and includes a number of instructions for causing a device (which may be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., various media that can store program code.

[0154] The foregoing is merely a preferred embodiment of the present application and is not intended to limit the present application. Persons skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application are intended to be within the scope of protection of the present application.

Claims

1. A flow table management method, characterized in that: The method comprises: Sequentially reading the current counting search table with a predetermined reading width to obtain multiple groups of to-be-compressed data, the to-be-compressed data including multiple data entries, the data entries including aging counter parameters, or the data entries including activity parameters and corresponding index information, the aging counter parameters including the activity parameters, the index information representing position information of the corresponding activity parameters in the previous level counting search table; Obtaining a minimum activity parameter in each group of the data to be compressed; Determining data entries of a next-level counting search table based on the minimum activity parameter and position information of the minimum activity parameter in the current counting search table to construct the next-level counting search table; In response to the next-level counting search table satisfying a construction end condition, a counting search tree is obtained, where the counting search tree includes counting search tables at each level.

2. The method according to claim 1, characterized in that The constructing of the next level counting search table comprises: sequentially reading the data entries in the next-level counting search table with the predetermined reading width; The read data entry is written into the next-level counting search table, and the width of the next-level counting search table is the predetermined reading width.

3. The method according to claim 1, characterized in that The construction end condition is that the number of levels of the next-level counting search table reaches a predetermined number of levels, or the number of data entries in the next-level counting search table is less than a predetermined number of entries.

4. The method according to claim 1, wherein The method further comprises: Obtaining a flow table update instruction, wherein the flow table update instruction includes a new flow table entry and a corresponding aging counter parameter; Based on the corresponding index information, the target activity parameter and the target flow table entry position corresponding to the target activity parameter are read upward from the last level counting search table of the counting search tree in sequence and determined, wherein the target activity parameter is the minimum activity parameter in the counting search tree; Update the new flow table entry to the target flow table entry location.

5. The method according to claim 4, characterized in that The step of sequentially reading upward from the last level counting search table of the counting search tree based on the corresponding index information and determining the target activity parameter and the target flow table entry position corresponding to the target activity parameter includes: Reading data entries of the last level counting search table of the counting search tree; determining the minimum activity parameter in each of the data entries as the target activity parameter; According to the index information of the target activity parameter in the counting search table at each level, the target flow table entry position corresponding to the target activity parameter is determined.

6. The method according to claim 5, characterized in that The determining, according to index information of the target activity parameter in the counting search table at each level, a target flow table entry position corresponding to the target activity parameter includes: Determining the target data to be compressed where the target activity parameter is located in the previous level counting search table according to index information in the data entry where the target activity parameter is located in the current counting search table; Determine, from the target data to be compressed, a data entry of the target activity parameter in the previous level counting search table; In response to the upper-level counting search table being an initial counting search table in the counting search tree, determining the data entry as a target data entry; The target flow table entry location is determined based on the target data entry.

7. The method according to claim 6, characterized in that The method further comprises: In response to the target flow table being updated, the data entry of the position where the new flow table entry is located in the counting search table at each level of the counting search tree is updated.

8. The method according to claim 1, characterized in that The method further comprises: The data width of the data entry is adjusted to a predetermined data width, so that the predetermined read width is an integer multiple of the predetermined data width.

9. A flow table management circuit, characterized in that: The circuit comprises: a data loading unit, configured to sequentially read the current counting search table with a predetermined reading width to obtain multiple sets of data to be compressed, wherein the data to be compressed includes multiple data entries, the data entries include aging counter parameters, or the data entries include activity parameters and corresponding index information, the aging counter parameters include the activity parameters, and the index information represents position information of the corresponding activity parameters in the previous level counting search table; A calculation unit, used to determine the minimum activity parameter in the data flow table; a processing unit, configured to determine a data entry of a next-level counting search table based on the minimum activity parameter and position information of the minimum activity parameter in the current counting search table, so as to construct the next-level counting search table; The storage unit is configured to obtain a counting search tree in response to the next level counting search table satisfying a construction end condition, wherein the counting search tree includes counting search tables at each level.

10. The circuit according to claim 9, characterized in that The data loading unit is further configured to obtain a flow table update instruction, the flow table update instruction including a new flow table entry and a corresponding aging counter parameter, and to sequentially read upward from the last level counting search table of the counting search tree based on the corresponding index information and determine a target activity parameter and a target flow table entry position corresponding to the target activity parameter, wherein the target activity parameter is the minimum activity parameter in the counting search tree; The circuit further includes an updating unit; The updating unit is configured to update the new flow entry to the target flow entry location.

11. The circuit according to claim 10, characterized in that The updating unit is further configured to update the data entry of the position of the new flow table entry in the counting search tables at each level of the counting search tree in response to the target flow table being updated.

12. An electronic device comprising a memory and a processor, characterized in that: The memory is configured to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 8.

13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.