A flow table rule compression optimization and data packet processing method and device for multi-protocol network scenarios
Through the two-dimensional matching domain reduction and merging algorithm and the protocol identifier elimination ambiguity method, redundant matching domains are pruned and a multi-level flow table structure is constructed, which solves the problem of flow table scale expansion in multi-protocol network scenarios and realizes flow table storage sharing and efficient forwarding.
Patent Information
- Application Number
- CN202411833666.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-12-12
AI Technical Summary
In multi-protocol network scenarios, TCAM resources are limited, flow table scale expansion is serious, storage consumption is high and implementation is complex, which cannot effectively solve the problem of flow table scale expansion in multi-protocol scenarios.
By designing a two-dimensional matching domain reduction and merging algorithm, cutting redundant matching domains, introducing protocol identifiers to eliminate semantic ambiguity, building a multi-level flow table structure, realizing storage sharing of different protocol fields, and adopting an efficient flow table recompression algorithm to maintain storage efficiency.
It effectively reduces the flow table size and storage consumption, solves the problem of flow table scale expansion in multi-protocol network scenarios, realizes flow table storage sharing, and improves network forwarding performance.
Smart Images

Figure CN119766723B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer network technology, and in particular to a flow table rule compression optimization and data packet processing method and device for multi-protocol network scenarios. Background Art
[0002] Since network forwarding devices map input packets to forwarding results through flow table matching, the efficiency of flow table matching directly impacts network forwarding performance. Ternary Content Addressable Memory (TCAM) can output lookup results within a single clock cycle, offering excellent performance for flow table lookups. Therefore, TCAM is widely used in programmable switches for flow table storage and lookup processing. However, TCAM resources are expensive, energy-intensive, and consume significant backplane space, limiting their size within switches. Due to these TCAM resource limitations, the size of the table entry match field is fixed and uniform.
[0003] Various network protocols or technologies are added to adapt to diverse and uncertain network services. The advancement of programmable switches allows network administrators to develop new network protocols, such as Named-Data Networking (NDN) and MobilityFirst (MF). However, the number of matching domains for multi-protocol packet forwarding increases and the flow table structures vary, which is reflected in the different number and length of matching domains and action types defined. The increase in matching domains directly increases the storage width of flow table rules, puts pressure on TCAM resource capabilities, and has high implementation complexity. At the same time, multi-protocol forwarding will lead to serious flow table scale expansion problems, and due to semantic ambiguity between different protocol fields, fields of different protocols cannot achieve flow table storage sharing. Existing flow table compression algorithms mainly target storage compression requirements in single-protocol scenarios and cannot solve the serious storage consumption caused by the expansion of flow table scale in multi-protocol scenarios. Summary of the Invention
[0004] In order to improve the flow table storage efficiency in a multi-protocol network scenario, the present invention provides a flow table rule compression optimization and data packet processing method and device for a multi-protocol network scenario.
[0005] In a first aspect, the present invention provides a flow table rule compression optimization method for a multi-protocol network scenario, comprising:
[0006] Step 1: Receive the original flow tables of multiple protocols sent by the controller; one protocol corresponds to one original flow table;
[0007] Step 2: For the original flow table of each protocol, trim the redundant matching domain fields in the original flow table to obtain the optimal matching rule flow table for each protocol;
[0008] Step 3: Combine the optimal matching rule flow tables of all protocols in pairs, and continuously merge two flow tables that meet the preset conditions into the same flow table until the final number of flow tables meets the level constraint, thereby obtaining a multi-level multi-protocol flow table that supports the coexistence of multiple protocols; wherein, when the flow tables are merged, the protocol identifier is introduced, and the protocol identifier of the same protocol is associated with all corresponding matching domains; the preset conditions include: all matching domains of the flow tables to be merged can coexist in the same flow table, and the storage overhead of the merged flow table is less than the sum of the storage overheads of the two flow tables before the merger.
[0009] Furthermore, the redundant matching domain fields in the original flow table are trimmed to obtain the optimal matching rule flow table for each protocol, specifically including:
[0010] Traversing the rule set in the original flow table to obtain an independent rule set; the independent rule set is a set of independent rules; wherein, for any rule, if it does not intersect with other rules in the rule set, the rule is independent;
[0011] Traversing all matching domains in the independent rule set, selecting a matching domain combination, and if the current matching domain combination meets the discrimination threshold requirement, adding the current matching domain combination to the candidate combination scheme; if not, selecting the next matching domain combination until all matching domain combinations are traversed; wherein the discrimination threshold is set to the ratio of the number of rules covered by the matching domain combination to the total number of rules;
[0012] Among the candidate combination schemes, the matching domain combination with the smallest rule bit width is selected as the optimal matching rule flow table.
[0013] Furthermore, it also includes: pre-building a matching domain relationship matrix of the two protocols, and using the matching domain relationship matrix to determine whether all matching domains of the flow table to be merged can coexist in the same flow table; wherein, if the element m in the matching domain relationship matrix xy =1, indicating that the xth matching domain and the yth matching domain can coexist in the same flow table. xy =0, it means they cannot coexist.
[0014] Furthermore, the storage overhead of a single flow table is calculated using the following formula:
[0015]
[0016] Among them, δ is the normalization coefficient, H and W represent the minimum storage width and depth respectively, f′(R i ,F i,j ) represents the sampling result of the flow table entry, p represents the bit width of PID, R irepresents the rule set of the i-th protocol, Fi ,j Indicates the field storage of the i-th protocol in the j-th flow table, b i represents the bit width vector of the matching field in the i-th protocol, and M represents the number of protocol types.
[0017] Furthermore, it also includes: when the number of table item updates reaches a preset threshold, the multi-level multi-protocol flow table is re-compressed, specifically including: combining the multi-protocol flow tables at each level in pairs, calculating the storage compression effect corresponding to each combination, selecting the combination with the worst storage compression effect, using the rules in the combination as the original rule set, executing steps 2 and 3, outputting the updated multi-level multi-protocol flow table, and clearing the number of table item updates.
[0018] Furthermore, the calculation of the storage compression effect corresponding to each combination specifically includes:
[0019] Calculate the ratio of the sum of the storage overhead of the two flow tables before merging for each combination to the storage overhead when the rules of the two flow tables are merged and stored in a single table. The larger the ratio, the worse the storage compression effect corresponding to the combination.
[0020] In the second aspect, the present invention also provides a data packet processing method, which is applied to a multi-protocol network scenario, including: receiving a data packet, extracting the to-be-matched domains in the data packet, and using a flow table rule compression optimization method for a multi-protocol network scenario as described in the first aspect to crop and merge all the extracted to-be-matched domains, and performing action matching based on the merged matching domains to execute corresponding actions on the data packet.
[0021] In a third aspect, the present invention provides a flow table rule compression and optimization device for a multi-protocol network scenario, comprising:
[0022] A flow table receiving module is used to receive original flow tables of multiple protocols sent by the controller; wherein one protocol corresponds to one original flow table;
[0023] A horizontal matching domain trimming module is used to trim redundant matching domain fields in the original flow table of each protocol to obtain the optimal matching rule flow table of each protocol;
[0024] The vertical matching domain merging module is used to combine the optimal matching rule flow tables of all protocols in pairs, and continuously merge two flow tables that meet the preset conditions into the same flow table until the final number of flow tables meets the level constraint, thereby obtaining a multi-level multi-protocol flow table that supports the coexistence of multiple protocols; wherein, when the flow tables are merged, the protocol identifier is introduced to associate the protocol identifier of the same protocol with all corresponding matching domains; the preset conditions include: all matching domains of the flow tables to be merged can coexist in the same flow table, and the storage overhead of the merged flow table is less than the sum of the storage overheads of the two flow tables before the merger.
[0025] In a fourth aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect and / or the second aspect when executing the program.
[0026] In a fifth aspect, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect and / or the second aspect.
[0027] Beneficial effects of the present invention:
[0028] (1) The present invention effectively reduces the flow table size and storage consumption in multi-protocol scenarios by designing a two-dimensional matching domain reduction and merging algorithm to support "horizontal" splitting within a single protocol field and optimize the "vertical" merging between different protocol fields. At the same time, by introducing protocol identifiers to eliminate semantic ambiguity between multiple network protocol fields, a multi-level flow table storage structure for the coexistence of multiple network protocols is constructed, avoiding multi-protocol flow table conflicts. Ultimately, flow table storage sharing of different network protocol fields is achieved, solving the serious storage consumption problem caused by the expansion of flow table size in multi-protocol network scenarios.
[0029] (2) By analyzing the storage compression effect, the present invention further proposes a simple and fast multi-protocol flow table recompression algorithm. The controller runs the flow table recompression algorithm during the flow table update process to maintain a high flow table storage efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A flow chart of a method for compressing and optimizing flow table rules in a multi-protocol network scenario provided by an embodiment of the present invention;
[0031] Figure 2 The code of a horizontal matching domain reduction algorithm provided by an embodiment of the present invention;
[0032] Figure 3 The code of a vertical matching domain merging algorithm provided by an embodiment of the present invention;
[0033] Figure 4 The code of a flow table recompression algorithm in the flow table update phase provided by an embodiment of the present invention;
[0034] Figure 5 A block diagram illustrating a method for processing a data packet according to an embodiment of the present invention;
[0035] Figure 6 A schematic structural diagram of a data packet processing device provided by an embodiment of the present invention;
[0036] Figure 7 A diagram of the multi-protocol pipeline matching structure provided by an embodiment of the present invention;
[0037] Figure 8 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0038] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0039] like Figure 1 As shown, an embodiment of the present invention provides a flow table rule compression optimization method for a multi-protocol network scenario, comprising the following steps:
[0040] S101: Receive original flow tables of multiple protocols sent by a controller, wherein one protocol corresponds to one original flow table;
[0041] S102: For each protocol's original flow table, trim the redundant matching domain fields in the original flow table to obtain an optimal matching rule flow table for each protocol;
[0042] S103: The optimal matching rule flow tables of all protocols are combined in pairs, and two flow tables that meet the preset conditions are continuously merged into the same flow table until the final number of flow tables meets the level constraint, thereby obtaining a multi-level multi-protocol flow table that supports the coexistence of multiple protocols; wherein, when the flow tables are merged, the protocol identifier is introduced, and the protocol identifier of the same protocol is associated with all corresponding matching domains; the preset conditions include: all matching domains of the flow tables to be merged can coexist in the same flow table, and the storage overhead of the merged flow table is less than the sum of the storage overheads of the two flow tables before the merger.
[0043] Specifically, the present invention constructs a new flow table structure (ie, multi-protocol flow table) that supports the coexistence of multiple protocols by introducing protocol identifiers. Figure 7 As shown in the figure, in each level of multi-protocol flow table, PID is used as an identifier to distinguish different protocols. Define PID i Represents the identifier of the i-th protocol, V i j The matching domain value of the jth field of the i-th protocol is added to each flow table by combining the PID with the field matching domain. This eliminates the semantic ambiguity between the field matching domains of different protocols, so that the matching domains of different protocols can be merged and stored in the same flow table.
[0044] The present invention provides a flow table rule compression and optimization method for multi-protocol network scenarios. By designing a two-dimensional matching domain reduction and merging algorithm (two-dimensional field-trimming and merging, 2D-FTM), it supports "horizontal" trimming within a single network protocol field and optimizes the "vertical" merging between different network protocol fields, effectively reducing the flow table size and storage consumption in multi-protocol scenarios. At the same time, by introducing protocol identifiers to eliminate semantic ambiguity between multiple network protocol fields, a multi-level flow table storage structure in which multiple network protocols coexist is constructed to avoid multi-protocol flow table conflicts. Ultimately, flow table storage sharing of different network protocol fields is achieved, solving the serious storage consumption problem caused by the expansion of flow table size in multi-protocol network scenarios.
[0045] Based on the above embodiments, the present invention addresses the issue of horizontal field pruning within a single protocol by establishing a matching domain pruning algorithm. This algorithm achieves matching domain merging and fusion, reducing redundant matching domain information during the matching process. This algorithm reduces matching domain usage without affecting matching results, further reducing TCAM resource consumption. The matching domain pruning algorithm specifically includes the following steps:
[0046] Traversing the rule set in the original flow table to obtain an independent rule set; the independent rule set is a set of independent rules; wherein, for any rule, if it does not intersect with other rules in the rule set, the rule is independent;
[0047] Specifically, matching domain pruning requires that the executed rule set be independent so that the pruned rule set can cover all rules. Therefore, it is necessary to first traverse all rules and extract independent rule sets based on rule independence.
[0048] Traversing all matching domains in the independent rule set, selecting a matching domain combination, and if the current matching domain combination meets the discrimination threshold requirement, adding the current matching domain combination to the candidate combination scheme; if not, selecting the next matching domain combination until all matching domain combinations are traversed; wherein the discrimination threshold is set to the ratio of the number of rules covered by the matching domain combination to the total number of rules;
[0049] Among the candidate combination schemes, the matching domain combination with the smallest rule bit width is selected as the optimal matching rule flow table.
[0050] Based on the above algorithm concept, the embodiment of the present invention also provides a corresponding matching domain clipping algorithm code, such as Figure 2As shown. In the initial state, the rule set contains all matching domains (lines 1-2). First, traverse the matching domains to select the number of matching domains to be retained; second, select the matching domain combination (lines 3-4); finally, traverse all matching domain combinations. For any two rules, if the independence requirement is not met, the reduction is terminated (lines 5-11); otherwise, if the current combination meets the discrimination threshold requirement, the matching domain clipping result is output; finally, the combination with the smallest rule bit width is selected from the combinations that meet the discrimination threshold, and the combination is updated (lines 12-17). Figure 2 In the example, IR, n, and α represent the independent rule set, the number of matching domains, and the discrimination threshold, respectively; X(γ) represents all matching domains included in the rule set γ, and X wid Represents the matching domain set, L wid Represents the matching domain mark vector. When the value of an element in the vector is 1, it means that the corresponding matching domain is retained. If the value is 0, it means that the corresponding matching domain is cropped.
[0051] On the basis of the above embodiments, in an embodiment of the present invention, according to the optimal matching rule flow table after trimming for each protocol, this embodiment proposes an efficient search and merging solution, executes a "vertical" merging algorithm between multi-protocol fields, and reduces the size of the flow table in a multi-protocol scenario.
[0052] In this “vertical” merging algorithm, it is necessary to pre-build the matching domain relationship matrix of the two protocols, and use the matching domain relationship matrix to determine whether all matching domains of the flow table to be merged can coexist in the same flow table; wherein, if the element m in the matching domain relationship matrix xy =1, indicating that the xth matching domain and the yth matching domain can coexist in the same flow table. xy = 0, it means they cannot coexist. Assuming that each field match is stored separately in each flow table, each time the two flow tables with the smallest increase in storage redundancy after merging are selected to merge the field match domains until the final number of flow tables meets the level constraint.
[0053] The code for the "vertical" merging algorithm is as follows Figure 3 First, the flow table needs to be merged according to the flow table stage number T.Stage (lines 1-3); if it does not need to be merged, the multi-level flow table T is directly output. Otherwise, the initialization operation is performed (lines 5-6), including the storage overhead difference ΔC before and after the merger, the number of flow table combinations l, and the flow table content T temp Then, the N-level flow tables are combined in pairs and the i-th flow table T is selected. i and the jth flow table T j Merge (lines 7-9). If the merged flow table fields can coexist, query or calculate the flow table storage overhead C before and after the merge m 、C i and C j(Lines 10-15). If the storage cost of the merged flow table is C m If the total storage overhead of the two flow tables is less than the sum of the original flow table's storage overhead, the merged flow table is output (lines 16-18). If the fields of the merged flow tables cannot coexist, a new flow table combination is selected for merging (lines 19-22). Finally, the flow table contents are updated and the two merged flow tables are removed (lines 23-25).
[0054] In the above algorithm, for the i-th protocol, let the rule set be R i , containing N i Matching fields, each field width is determined by vector b i =(b1,b2,…,b Ni ) means, where b k Indicates the bit width of the kth field, k∈(1,N i ). The field storage of the i-th protocol in the j-th flow table is represented as a column vector F i,j =(f1,f2,…f Ni ), where f i =1 means the i-th field is stored in the table, f i =0 means it does not exist. Based on the above settings, the storage overhead calculation formula for the jth flow table is as follows:
[0055]
[0056] δ is the normalization coefficient, H and W represent the minimum storage width and depth respectively, f′(R i ,F i,j ) represents the sampling result of the flow table entry, p represents the bit width of PID, R i represents the rule set of the i-th protocol, F i,j Indicates the field storage of the i-th protocol in the j-th flow table, b i represents the bit width vector of the matching field in the i-th protocol, and M represents the number of protocol types.
[0057] Based on the above embodiments, during the forwarding device's operational phase, entries in each level of the flow table are constantly being updated. The controller must immediately run a compression algorithm to maintain high flow table storage efficiency within the forwarding device. The flow table compression algorithm used during the entry update phase should be simple and fast to ensure fast entry updates. Therefore, to improve flow table storage efficiency during the entry update phase, embodiments of the present invention also provide a flow table recompression algorithm during the entry update process. When the number of entry updates reaches a preset threshold, the multi-level, multi-protocol flow table is recompressed. The algorithm is conceived as follows: multi-protocol flow tables at each level are combined in pairs, and the ratio of the sum of the current storage overhead of each combination to the storage overhead when the rules of the two tables are combined and stored in a single table is calculated. The larger the ratio, the worse the storage compression effect of the two tables. Each time the compression is recompressed, the combination with the largest current storage overhead ratio (i.e., the combination with the worst compression effect) is selected for field reorganization. That is, Algorithms 1 and 2 in the above embodiment are run using the rules in the two tables as the original rule set. Finally, the updated multi-level multi-protocol flow table is output and the number of table entry updates is cleared so that the number of table entry updates can be recorded in real time again in preparation for the next recompression.
[0058] Based on the above algorithm concept, the embodiment of the present invention also provides corresponding algorithm code, such as Figure 4 As shown. First, calculate the storage overhead of each level of flow table and perform initialization operations (lines 1-2), including flow table content, storage efficiency (γ), and flow table combination (l). Then, select the current i-th and j-th flow tables to merge, and calculate the storage overhead of the merged flow table (lines 3-6). If the ratio of the sum of the storage overhead of the current two flow tables to the storage overhead when the rules of the two tables are merged and stored in a single table is greater than γ, then set the γ value to the storage consumption ratio (lines 7-9). If the storage consumption ratio is less than γ, reselect the flow table combination (lines 10-12). Afterwards, use the two flow tables as the original flow tables, execute Algorithm 1 to reduce the horizontal matching domain fields, and execute Algorithm 2 to merge the flow tables (lines 13-15). Finally, update the flow table rules and return the recompressed multi-level flow table (lines 16-19).
[0059] Corresponding to the above-mentioned flow table rule compression optimization method for multi-protocol network scenarios, an embodiment of the present invention provides a flow table rule compression optimization device for multi-protocol network scenarios, which can be integrated in Figure 6 In the middle layer shown in FIG. , the device mainly includes: a flow table receiving module, a horizontal matching domain cropping module, and a vertical matching domain merging module.
[0060] Among them, the flow table receiving module is used to receive the original flow tables of multiple protocols issued by the controller; wherein, one protocol corresponds to one original flow table; the horizontal matching domain clipping module is used to clip the redundant matching domain fields in the original flow table of each protocol to obtain the optimal matching rule flow table for each protocol; the vertical matching domain merging module is used to combine the optimal matching rule flow tables of all protocols in pairs, and continuously merge two flow tables that meet the preset conditions into the same flow table until the final number of flow tables meets the level constraint, and obtain a multi-level multi-protocol flow table that supports the coexistence of multiple protocols; wherein, when the flow tables are merged, the protocol identifier is introduced, and the protocol identifier of the same protocol is associated with all corresponding matching domains; the preset conditions include: all matching domains of the flow tables to be merged can coexist in the same flow table, and the storage overhead of the merged flow table is less than the sum of the storage overheads of the two flow tables before the merger.
[0061] It should be noted that the flow table rule compression optimization device provided in the embodiment of the present invention is for the purpose of implementing the above method. Its specific functions can be referred to the above method embodiments and will not be described in detail here.
[0062] Combine Figure 5 、 Figure 6 and Figure 7 As shown, an embodiment of the present invention also provides a data packet processing method, which is applied to a multi-protocol network scenario, including: receiving a data packet, extracting a to-be-matched domain in the data packet, using a flow table rule compression optimization method for a multi-protocol network scenario provided by the above embodiments to crop and merge all the extracted to-be-matched domains, and performing action matching based on the merged matching domains to execute corresponding actions on the data packet.
[0063] Specifically, different protocols are distinguished by parsing the input data packets. For data packets of different protocols, their corresponding PIDs (carried on metadata) are obtained, and then the extracted packet header fields and PIDs are combined to form a search word to participate in the matching of flow tables at all levels and perform corresponding actions.
[0064] In the 2D-FTM algorithm implementation, each flow table level consists of a connected TCAM and RAM. The TCAM in each flow table level stores the merged and compressed flow table match fields, while the RAM stores intermediate variables used to search for match fields, such as flow table jump relationships and clipping sets. Each flow table level passes the clipping results of the match fields within a single protocol to a centralized computing unit for vertical merging across multiple protocols. After the match fields are merged, the packet header fields are sent to the TCAM for search and matching operations. This information is used to determine the final match result.
[0065] Correspondingly, if Figure 6As shown, an embodiment of the present invention further provides a data packet processing device, which is applied to a multi-protocol network scenario, including a packet processor and a multi-protocol pipeline; a matching domain preprocessing circuit and a RAM are provided in the packet processor.
[0066] Among them, the matching domain preprocessing circuit analyzes the matching domain logical relationship, which can be implemented by hardware such as FPGA and network processor, and needs to be combined with the corresponding RAM storage information to extract the logical relationship and status information required for the merging of specific matching domains; based on the matching domain logical relationship and status information, a two-dimensional matching domain reduction and merging algorithm is executed, that is: a horizontal matching domain clipping algorithm is executed to achieve "horizontal" splitting of each field in a single protocol, reducing redundant matching domain information during the matching process; at the same time, the clipping information stored in the RAM is queried for false positive verification, and the optimal matching rules of each protocol are extracted, so as to execute the vertical merging algorithm based on the extracted optimal matching rules of each protocol.
[0067] In this embodiment of the present invention, the match field preprocessing circuit performs the corresponding match field operations according to the match field reduction and merging scheme configured in the middle layer, thereby changing the width of the packet header field and reducing the number of actual match fields in the packet header field. After the packet header field undergoes the above match field operations, it is then sent to the multi-protocol pipeline for search and matching operations.
[0068] Figure 8 An example of a physical structure diagram of an electronic device is shown below. Figure 8 As shown, the electronic device may include: a processor 801, a communication interface 802, a memory 803, and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other via the communication bus 804. The processor 801 may call the logic instructions in the memory 803 to execute the flow table rule compression optimization method or the data packet processing method in the above-mentioned embodiments.
[0069] In addition, when the logic instructions in the above-mentioned memory 803 are implemented in the form of a software functional unit and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program code, such as 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.
[0070] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the flow table rule compression optimization method or data packet processing method provided in the above-mentioned method embodiments.
[0071] An embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the flow table rule compression optimization method or data packet processing method provided by the above-mentioned method embodiments is implemented.
[0072] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A flow table rule compression optimization method for multi-protocol network scenarios, characterized in that: include: Step 1: Receive the original flow tables of multiple protocols sent by the controller; one protocol corresponds to one original flow table; Step 2: For each protocol's original flow table, trim the redundant matching domain fields in the original flow table to obtain the optimal matching rule flow table for each protocol, specifically including: Traversing the rule set in the original flow table to obtain an independent rule set; the independent rule set is a set of independent rules; wherein, for any rule, if it does not intersect with other rules in the rule set, the rule is independent; Traversing all matching domains in the independent rule set, selecting a matching domain combination, and if the current matching domain combination meets the discrimination threshold requirement, adding the current matching domain combination to the candidate combination scheme; if not, selecting the next matching domain combination until all matching domain combinations are traversed; wherein the discrimination threshold is set to the ratio of the number of rules covered by the matching domain combination to the total number of rules; Among the candidate combination schemes, the matching domain combination with the smallest rule bit width is selected as the optimal matching rule flow table; Step 3: Combine the optimal matching rule flow tables of all protocols in pairs, and continuously merge two flow tables that meet the preset conditions into the same flow table until the final number of flow tables meets the level constraint, thereby obtaining a multi-level multi-protocol flow table that supports the coexistence of multiple protocols; wherein, when the flow tables are merged, the protocol identifier is introduced, and the protocol identifier of the same protocol is associated with all corresponding matching domains; the preset conditions include: all matching domains of the flow tables to be merged can coexist in the same flow table, and the storage overhead of the merged flow table is less than the sum of the storage overheads of the two flow tables before the merger.
2. A flow table rule compression optimization method for multi-protocol network scenarios according to claim 1, characterized in that: Also includes: Pre-build the matching domain relationship matrix of the two protocols, and use the matching domain relationship matrix to determine whether all matching domains of the flow table to be merged can coexist in the same flow table; wherein, if the elements in the matching domain relationship matrix m xy =1, indicating the x Matching domains with y Matching domains can coexist in the same flow table if m xy =0, it means they cannot coexist.
3. The method for compressing and optimizing flow table rules for multi-protocol network scenarios according to claim 1, characterized in that: It also includes the calculation of the storage overhead of a single flow table using the following formula: in, δ is the normalization coefficient, H and W Respectively represent the minimum storage width and depth, Indicates the sampling result of the flow table entry. p Indicates the bit width of PID, R i Indicates the i A set of rules for a protocol, F i,j Indicates the i The agreement in j The field storage situation in each flow table, Indicates the i A vector of the bit widths of matching fields in the protocol, M Respectively represent the number of protocol types.
4. A flow table rule compression optimization method for multi-protocol network scenarios according to any one of claims 1 to 3, characterized in that: It also includes: when the number of table entry updates reaches a preset threshold, the multi-level multi-protocol flow table is re-compressed, specifically including: combining the multi-protocol flow tables at each level in pairs, calculating the storage compression effect corresponding to each combination, selecting the combination with the worst storage compression effect, using the rules in the combination as the original rule set, executing steps 2 and 3, outputting the updated multi-level multi-protocol flow table, and clearing the number of table entry updates.
5. The method for compressing and optimizing flow table rules for multi-protocol network scenarios according to claim 4 is characterized in that: The calculation of the storage compression effect corresponding to each combination specifically includes: Calculate the ratio of the sum of the storage overhead of the two flow tables before merging for each combination to the storage overhead when the rules of the two flow tables are merged and stored in a single table. The larger the ratio, the worse the storage compression effect corresponding to the combination.
6. A data packet processing method, characterized in that: The invention is applied to a multi-protocol network scenario, comprising: receiving a data packet, extracting a to-be-matched domain in the data packet, cutting and merging all the extracted to-be-matched domains using a flow table rule compression optimization method for a multi-protocol network scenario as described in any one of claims 1 to 5, and performing action matching based on the merged matching domains to execute corresponding actions on the data packet.
7. A flow table rule compression and optimization device for multi-protocol network scenarios, characterized in that: include: A flow table receiving module is used to receive original flow tables of multiple protocols sent by the controller; wherein one protocol corresponds to one original flow table; A horizontal matching domain pruning module is configured to prune redundant matching domain fields in the original flow table for each protocol to obtain an optimal matching rule flow table for each protocol. The module is specifically configured to traverse the rule set in the original flow table to obtain an independent rule set. An independent rule set is a set of independent rules. A rule is considered independent if it does not intersect with any other rule in the rule set. Traversing all matching domains in the independent rule set, selecting a matching domain combination, and if the current matching domain combination meets the discrimination threshold requirement, adding the current matching domain combination to the candidate combination scheme; if not, selecting the next matching domain combination until all matching domain combinations are traversed; wherein the discrimination threshold is set to the ratio of the number of rules covered by the matching domain combination to the total number of rules; Among the candidate combination schemes, the matching domain combination with the smallest rule bit width is selected as the optimal matching rule flow table; The vertical matching domain merging module is used to combine the optimal matching rule flow tables of all protocols in pairs, and continuously merge two flow tables that meet the preset conditions into the same flow table until the final number of flow tables meets the level constraint, thereby obtaining a multi-level multi-protocol flow table that supports the coexistence of multiple protocols; wherein, when the flow tables are merged, the protocol identifier is introduced to associate the protocol identifier of the same protocol with all corresponding matching domains; the preset conditions include: all matching domains of the flow tables to be merged can coexist in the same flow table, and the storage overhead of the merged flow table is less than the sum of the storage overheads of the two flow tables before the merger.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Multi-level flow table design method based on repetition rate of matching field specific value
CN108259353A
Multi-level flow table design method based on logical relationship between matching fields
CN108259354A