ACL hardware fixed template domain segment matching method, system and device
By introducing a multiple priority mechanism to sort and match ACL matching items and bit segments, the problem of non-unique template selection and low resource utilization in ACL hardware fixed template matching is solved, achieving stable installation of ACL rules and efficient resource utilization. .
Patent Information
- Application Number
- CN202410889735.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-07-04
AI Technical Summary
In the existing technology, ACL hardware fixed template matching has problems such as non-unique template selection and low resource utilization. Especially when the order of users adding matching items is different, the template selection during the installation process is not unique, and some matching items are not used as valid data. Used, resources are underutilized.
Using a multiple priority mechanism, the ACL matching items are sorted through the organization stage to form a matching chain list, and matching is performed based on the priority of the bit segment chain list in the matching stage to ensure the uniqueness of template selection and efficient use of resources, including matching based on The commonness and bit width of the item determine the priority. The smaller the bit width and the fewer matching items provided by the template, the higher the priority.
In the process of installing ACL rules, the uniqueness of template selection is ensured, the utilization of hardware resources is improved, and the problem of the same matching item being unable to be installed is avoided. At the same time, it is transparent to users and does not increase the cost of use.
Smart Images

Figure CN118433143B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology and network data processing, and in particular to a method, system and device for matching ACL hardware fixed template domain segments. Background Art
[0002] Access Control List (ACL) is a technology used to filter network packets and perform specified actions. Initially, ACL was mainly implemented at the software level, and the switch CPU was responsible for processing ACL rules. The main advantages of this method are high flexibility and easy updating, but the processing speed is slow, especially when the network traffic is large, which may cause network performance bottlenecks. To solve this problem, ACL began to be implemented at the hardware level. ACL can process packets directly on the switch hardware without going through the CPU, thereby greatly improving the processing speed and reducing latency, allowing ACL to work more effectively in high-speed network environments.
[0003] One way to implement ACL at the hardware level is to provide several groups of bit segments with fixed bit widths, and provide several groups of fixed matching item templates in each group of bit segments, and combine them into an ACL rule by selecting templates. When the message enters the switch chip, the keywords in the message will be extracted according to the selected template and compared with the matching items in the issued ACL rules. If they meet the rules, the corresponding actions will be executed. In the specific use process, the software will maintain the matching items added by the user in the control plane, and match them with the templates provided by the chip when issuing the ACL to meet the user's needs.
[0004] Considering that the matching items of different templates provided by the hardware may overlap, and the order in which users add matching items may be different, the template selected during the installation process is not unique and cannot be installed. At the same time, some matching items in the template selected by the software are not used as valid data, resulting in low template resource utilization. Summary of the invention
[0005] In view of this, in order to solve at least part of the technical problems existing in the above-mentioned prior art, the present invention provides an ACL hardware fixed template domain segment matching method, the method comprising:
[0006] S1, organization stage, adding ACL matching items for users, sorting the ACL matching items, and forming a matching necklace table;
[0007] S2, matching stage, based on the order of the matching necklace list, extract the items to be matched one by one, match them with the bit segments, and form a matching scheme; the bit segment refers to the bit segment with a fixed bit width provided by the hardware, which is maintained by the bit segment linked list, and the bit segment linked list contains the bit width of the bit segment, the template, the remaining bit width, the template locking flag and the locked template number;
[0008] S3, assembly phase: Based on the matching scheme formed in S2, the specific data of the matching items are assembled and transferred to the chip to complete domain segment matching and data transfer.
[0009] Preferably, in S1, the ACL matching items are sorted as follows:
[0010] The priority is set based on the commonness of the matching items. The higher the commonness, the higher the priority. If the priorities are the same, the priority is determined by the bit width of the matching items.
[0011] When a new ACL match item is inserted into the match chain table, it is inserted into the match chain table based on the priority of the new ACL match item.
[0012] Preferably, the priority setting method in the bit segment linked list is:
[0013] The smaller the bit width of the bit segment, the higher the priority; in the bit segment, the fewer matching items provided by the template, the higher the template priority.
[0014] Preferably, in S1, the matching necklace table is used to maintain ACL matching items and store matching item types, data and masks.
[0015] Preferably, in the bit segment linked list, the template of the bit segment includes the number of templates provided by the bit segment and the matching items of each template;
[0016] The bit segment linked list is fixed and associated with a specific chip.
[0017] Preferably, in S2, the method for matching a single item to be matched with a bit segment is:
[0018] S21, select the current bit segment in the bit segment chain list, and determine whether the current bit segment is locked; if locked, execute S22; if not locked, and there is a next bit segment in the bit segment chain list, select the next bit segment to determine whether it is locked; if the current bit segment is the last bit segment in the bit segment chain list, execute S23;
[0019] S22, if the bit width of the item to be matched is smaller than the remaining bit width of the current bit segment, execute S24, otherwise select the next bit segment and return to S21 to execute the locking determination;
[0020] S23, starting from the first bit segment in the bit segment chain list, determine whether the bit segment is locked. If the bit segment is not locked, execute S25; otherwise, if there is a next bit segment, select the next bit segment for determination. If the current bit segment is the last bit segment in the bit segment chain list, return a match failure.
[0021] S24, select the template locked by the current bit segment, compare the item to be matched with the matching item in the template, if the matching item in all the templates locked by the current bit segment is consistent with the type of the item to be matched, fill the content of the item to be matched into the corresponding template, complete the matching, and update the remaining bit width of the current bit segment; enter the matching of the next item to be matched; otherwise, the matching of the current bit segment fails, select the next bit segment, and return to S21;
[0022] S25, when the current bit segment is not locked, if the bit width of the item to be matched is smaller than the remaining bit width of the current bit segment, execute S26, otherwise select the next bit segment in the bit segment linked list, and return to S23 for locking judgment;
[0023] S26, select the first template provided by the current bit segment, if there is a matching item of the same type as the item to be matched in the first template, fill the content of the item to be matched into the corresponding template, complete the matching, lock the template, update the template lock flag of the current bit segment to locked, fill the current template sequence number into the locked template number, update the remaining bit width of the current bit segment, and enter the matching of the next item to be matched;
[0024] Otherwise, if the current bit segment also provides the next template, the next template is selected to perform matching; if the current template is already the last template, the next bit segment is selected and returns to S23 to perform locking judgment.
[0025] Preferably, in S21, when matching with a bit segment in the bit segment chain list for the first time, the current bit segment defaults to the first bit segment in the bit segment chain list.
[0026] Preferably, the manner of forming the matching scheme in S2 is: after completing the matching of all items to be matched, a matching scheme is formed based on all the bit segments filled with the contents of the items to be matched and all the templates.
[0027] Preferably, one bit segment provides one or more templates; when the bit segment is locked, one bit segment locks one template.
[0028] On the other hand, the present invention also provides an ACL hardware fixed template domain segment matching system, the system comprising:
[0029] The organization module adds ACL matching items for users, sorts the ACL matching items, and forms a matching necklace table;
[0030] The matching module extracts the items to be matched one by one based on the order of the matching necklace list, matches them with the bit segments, and forms a matching scheme; the bit segments refer to the bit segments with fixed bit widths provided by the hardware and maintained by the bit segment linked list, which includes the bit width of the bit segment, the template, the remaining bit width, the template locking flag, and the locked template number;
[0031] The assembly module assembles the specific data of the matching items based on the matching scheme and transfers it to the chip to complete domain segment matching and data transfer.
[0032] In another aspect, the present invention further provides an ACL hardware fixed template domain segment matching device, the device comprising an input device, a processor and a memory;
[0033] The input device is used to input ACL matching items; the processor calls the computer instructions in the memory, and executes the ACL hardware fixed template domain segment matching method as described above based on the input ACL matching items.
[0034] Compared with the existing technology, this solution is based on practical use. With the help of a reasonable priority order, when there are differences in the order in which users add matching items, it ensures that the template selected during the installation of ACL rules is unique, and can also avoid the problem that the same matching item content cannot be installed. On the other hand, this solution abstracts the fixed template provided by the hardware into bit segments and templates, and during the installation process, it gives priority to bit segments with smaller bit widths and templates that provide fewer matching items, thereby improving the utilization of hardware resources. In addition, from an application perspective, the matching process proposed in this solution is completely transparent to users and will not increase user usage costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A schematic diagram of a process of adding matching items according to an embodiment of the present invention;
[0037] Figure 2 A schematic diagram of a matching item matching process according to an embodiment of the present invention;
[0038] Figure 3 Schematic diagram of the system architecture of an embodiment of the present invention. DETAILED DESCRIPTION
[0039] The embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. It should be clear that 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 creative work are within the scope of protection of the present invention.
[0040] Those skilled in the art should know that the following specific embodiments or specific implementations are a series of optimized settings listed by the present invention to further explain the specific content of the invention, and these settings can be combined or used in association with each other, unless the present invention clearly states that some or a specific embodiment or implementation cannot be associated or used together with other embodiments or implementations. At the same time, the following specific embodiments or implementations are only used as the most optimized settings, and are not to be understood as limiting the scope of protection of the present invention.
[0041] In view of the problems existing in the prior art, this solution proposes a detailed domain segment matching method, which can effectively solve the problems of non-unique template selection and low template resource utilization.
[0042] In response to the above technical problems, this solution introduces a multiple priority mechanism to ensure that the installation process is not affected by the order in which the user adds matching items, and can make full use of the resources in the template as much as possible during the installation process.
[0043] Specifically, this solution divides the entire process of adding ACL rules into three stages, namely, the organization stage, the matching stage, and the assembly stage. The specific implementation of this solution is described in detail below in conjunction with the accompanying drawings.
[0044] The organization phase is controlled by the user. The user is responsible for adding ACL matching items, and the software maintains the order of matching items. In this process, the software maintains the matching necklace table through the priority mechanism introduced in the organization phase. When the user inserts an ACL matching item, the insertion position is determined according to the priority of the ACL matching item to be inserted. Generally speaking, the higher the priority, the earlier the insertion position. In the matching phase, the software is responsible for matching the ACL matching items added by the user with the abstract underlying bit segments, selecting the best solution, and fixing the solution to the chip level. Here, the specific methods of underlying bit segment matching and optimal solution selection will be described later. In the assembly phase, the software assembles the specific values of the ACL matching items according to the selected solution and transfers them to the chip. After completing the organization phase and the matching phase, the specific ACL addition solution can be determined. At this time, the template selected in the bit segment has been determined. In the assembly phase, the matching items are filled into the corresponding positions in the template according to the determined template to complete the assembly. At this time, the assembled data can be transferred to the chip. In this solution, priority mechanisms are introduced in the organization phase and the matching phase respectively to ensure the effect to be achieved by the solution.
[0045] In a more specific embodiment, the priority mechanism introduced in the organization stage and the matching stage can be set as follows.
[0046] 1. The priority mechanism introduced in the organization stage in this embodiment mainly includes:
[0047] Priority setting is completed based on the frequency of use of matching items. By default, the priorities of various matching items are consistent. Depending on the specific scenario, different priorities can be set for matching items, such as the frequency of use and importance of matching items.
[0048] In the case of the same priority, the priority is determined according to the bit width of the matching item. For example, we can set the wider the bit width, the higher the priority.
[0049] 2. The priority mechanism introduced in the matching stage in this embodiment mainly includes:
[0050] The smaller the bit width of the bit segment provided by the hardware, the higher the priority; here, the bit segment refers to the bit segment of fixed bit width abstracted from the hardware and provided by the hardware;
[0051] The fewer the number of matches provided by the template in the bit segment, the higher the priority of the template;
[0052] In this embodiment, in combination with the above-mentioned priority setting method, the ACL matching item matching method mainly includes:
[0053] A match chain table is used to maintain the matching items added by the user for an ACL rule. The match chain table stores the matching item type, value, and mask. Figure 1 As shown, when a user adds a new match, the match to be added will be compared with the match in the matching necklace list. The match with a high priority will be inserted into the front position of the list, and the match will be added to the matching necklace list according to the priority rule introduced in the organization stage. In a more preferred embodiment, the matching necklace list can be added by the user, or selected to be added by other means such as templates. The matching necklace table needs to be organized into a template provided in the chip bit segment, matched with the bit segment linked list, and then installed.
[0054] A bit segment linked list can be maintained at the software level, abstracting the bit segments and templates provided by the hardware. The bit segment linked list stores the bit width of the current bit segment, the template provided by the bit segment, the remaining bit width of the bit segment, whether the bit segment is locked to the template (i.e., the template lock flag), and the template serial number locked to the bit segment. Among them, the template content provided by the bit segment includes the number of templates and the matching items provided by each template. In a more preferred embodiment, the bit segment linked list is fixed and associated with a specific chip. Exemplarily, the bit segment linked list can be abstracted from the template provided by the specific chip that needs to be written, and the template that the chip can provide is fixed and generally cannot be changed. Therefore, the bit segment linked list is set to be fixed.
[0055] Bit segment matching method: When the user has added the required matching items (the specific matching items can be determined by the user based on usage requirements, or a part of the default matching items can be set, etc.), and the ACL rules need to be sent to the chip, this matching method will be used.
[0056] The specific operation is as follows: First, in the matching necklace list of the ACL rule, the matching items are sorted according to priority; then, the matching items are taken out from the matching necklace list in turn to match with the bit segment chain list, and then the matching items are matched with the bit segment chain list. Figure 2 As shown in the figure, the specific matching steps for a single matching item and a bit segment are as follows:
[0057] Step 1: Select the current bit segment in the bit segment chain table, and determine whether the bit segment is locked. If the bit segment is locked, execute step 2. If the bit segment is not locked and there is a next bit segment in the bit segment chain table, select the next bit segment to determine whether it is locked. If the bit segment currently being determined is already the last bit segment, execute step 3. It should be noted that the current bit segment can be the first bit segment in the bit segment chain table, or it can be the next bit segment to be determined after multiple bit segments are determined. When the first match with the bit segment in the bit segment chain table is executed, the current bit segment generally defaults to the first bit segment in the bit segment chain table.
[0058] Step 2: If the bit width of the item to be matched is smaller than the remaining bit width of the current bit segment, execute step 4, otherwise return to step 1 to determine whether the next bit segment is locked;
[0059] Step 3: Starting from the first bit segment in the bit segment list, determine whether the bit segment is locked. If the bit segment is not locked, execute step 5; otherwise, if there is a next bit segment, select the next bit segment for determination. If it is the last bit segment, return a match failure. For example, after returning a match failure, it is considered that there is no matching item, so we can terminate the matching program.
[0060] Step 4: The current bit segment is locked, select the template that locks the bit segment (for example, after the bit segment is locked, only one template can be locked), compare the matching items provided by the template with the items to be matched one by one, if there is a matching item type that is consistent with the type of the item to be matched, then the match is completed, and the data and mask content of the item to be matched are filled into the corresponding position of the matching item in the template. At this time, the remaining bit width of the bit segment is calculated and updated, the matching of the current item to be matched is completed, and the matching of the next item to be matched is carried out. If the current matching item is already the last item to be matched, the entire matching stage is completed, and the ACL rules can be sent to the chip; if there is no matching item type that is consistent with the type of the item to be matched in the template in the bit segment, the matching of the locked template fails, then the next bit segment is selected, and step 1 is returned to make a locking judgment on the bit segment; until all matching items to be matched are completed or all bit segments are judged; for example, when all matching items to be matched are completed, the ACL rule sending stage can be entered, and the entire matching process is terminated;
[0061] Step 5: The bit segment is not locked. If the bit width of the item to be matched is smaller than the remaining bit width of the current bit segment, execute step 6. Otherwise, return to step 3 and start judging from the next bit segment.
[0062] Step 6: Select the first template provided by the bit segment, and compare the matching items provided by the template with the items to be matched one by one. If there is a matching item type that is consistent with the type of the item to be matched, the match is completed, and the data and mask content of the item to be matched are filled into the corresponding position of the matching item in the template. The current bit segment is locked, and the template locked by the bit segment is recorded. The remaining bit width of the bit segment is calculated and updated, and the matching of the current item to be matched is completed, and the matching of the next item to be matched is carried out. Otherwise, if there is a next template provided, the next template provided is selected for matching. If it is the last template provided, return to step 3 and start judging from the next bit segment. (The relationship between the bit segment and the template is locked or unlocked. Locked—the bit segment and the template are fixedly locked; unlocked—the bit segment does not have a fixed template, and a template can be selected and locked)
[0063] In order to highlight the implementation process of this solution, the matching method is further explained through a specific scenario. The abstracted hardware fixed template is shown in Table 1. The priority of the bit segment is reflected by the bit segment number. The smaller the bit width, the higher the priority. At the same time, the bit segment also records whether the bit segment is locked, the bit segment locking template, and the remaining bit width of the bit segment; the software-defined matching item priority is: IP address = protocol type > MAC address > VLAN > transport layer port > physical port. For the same priority matching items, the larger the bit width, the higher the priority; the ACL matching items added by the user are: source IP address 192.168.0.1; protocol type: UDP (17); UDP destination port: 0; the action added by the user is to send to the CPU.
[0064] Table 1
[0065]
[0066] The specific implementation process of this plan is as follows:
[0067] 1) When users add ACL matching items, the order is random. Suppose the user first adds the UDP destination port number. At this time, the matching necklace table is empty, so it is directly inserted into the matching necklace table; then the user adds the protocol type. Since the protocol type has a higher priority than the UDP destination port number, it is inserted before the UDP destination port number; finally, the user adds the source IP address, which has the same priority as the protocol type, but the source IP address has a wider bit width, so it has a higher priority, so the source IP address is inserted before the UDP port number. The added matching items are sorted at the software level in the order of IP address, protocol type, and UDP destination port number. The above sorting order is the result of sorting according to the priority sorting method in this embodiment. By setting the sorting method of this solution, it can be ensured that the installation order of the matching items during the installation of the ACL is not affected by the order in which the users add them, and the stability of the matching stage is guaranteed;
[0068] 2) The user installs the ACL rules, and the software traverses the matching necklace table and the bit segment for matching;
[0069] 3) Match the source IP address. If there is no locked bit segment in the bit segment, select bit segment 0 for matching. The remaining bit width of bit segment 0 is less than the IP address bit width and is not selected. Continue to select bit segment 1 for matching. If the remaining bit width of bit segment 1 is greater than or equal to the IP address bit width, traverse the template provided by bit segment 1. If the source IP address matches template 2, fill in the source IP address value 192.168.0.1 in the template 2 field, lock bit segment 1, record its selection of template 2, and calculate the remaining bit width of bit segment 1 as 96 (at this time, update the remaining bit width data). In this embodiment, locking bit segment 1 can be achieved by setting a flag mark to record the template serial number and facilitate the judgment of locking.
[0070] 4) Matching the protocol type, there is a locked bit segment in the bit segment, that is, bit segment 1, bit segment 1 is selected for matching, the remaining bit width of bit segment 1 is greater than or equal to the protocol type bit width, and the locked template is template 2, the protocol type matches template 2, and the protocol value 17 is filled in the field; here, further, when the remaining bit width is less than the protocol type bit width, the unlocked bit segment is queried, and a series of subsequent judgments are performed; if template 2 cannot be matched, the unlocked bit segment is queried, and a series of subsequent judgments are performed; if no match is found, the match fails, and a matching failure prompt is returned;
[0071] 5) Match the UDP destination port. There is a locked bit segment in the bit segment, namely, bit segment 1. Bit segment 1 is selected for matching. The remaining bit width of bit segment 1 is greater than or equal to the port bit width, and the locked template is template 2. The UDP destination port does not match template 2. If there is no locked bit segment in the bit segment, then the unlocked bit segments are traversed and bit segment 0 is selected for matching. The remaining bit width of bit segment 0 can meet the destination port bit width. The templates provided by bit segment 0 are traversed. The destination port matches template 3. Then fill in the UDP destination port value 0 in this field, and execute the locking of bit segment 0 to lock bit segment 0 to template 3.
[0072] 6) The matching items are matched, the content of bit segment 0 is: {transport layer destination port: 0}, the content of bit segment 1 is: {destination MAC address: 0, source IP address: 192.168.0.1, destination IP address: 0, protocol: 17, destination physical port number: 0}, and the contents in bit segment 0 and bit segment 1 are sent to the chip to complete the entire installation process.
[0073] Furthermore, after the installation is completed, the matching necklace table and the specific ACL related rules will not be cleared. If the data filled in the bit segment has been sent to the chip, the data in the bit segment will be cleared, and the lock status of all bit segments will be released, and the remaining bit width of the bit segment will be restored for use when other ACL rules are sent.
[0074] Furthermore, after the matching items are matched, the data content delivery process can be set as follows:
[0075] After the match is completed, the bit segment 0 is fixed to template 3, and the transport layer destination port number is filled in: 0. The bit segment 1 is fixed to template 2, and the source IP address: 192.168.0.1 and protocol type: UDP (17) are filled in. The bit segments are simply combined to obtain data that conforms to the chip rules and the data is sent to the chip. Exemplarily, the order of combination from high to low is: {bit segment 0: {transport layer destination port}, bit segment 1: {destination MAC address, source IPv4 address, destination IPv4 address, protocol, destination physical port}}, where the transport layer destination port value is UDP destination port number 0, the destination MAC address value is 0, the source IPv4 address value is 192.168.0.1, the protocol value is 17, and the destination physical port value is 0. The final data combination is 144 bits of data sent to the chip.
[0076] In another embodiment of the present invention, the solution of the present invention can also be implemented in a system manner, such as Figure 3 As shown, the system includes:
[0077] The organization module adds ACL matching items for users, sorts the ACL matching items, and forms a matching necklace table;
[0078] The matching module extracts the items to be matched one by one based on the order of the matching necklace list, matches them with the bit segments, and forms a matching scheme; the bit segments are bit segments with fixed bit widths provided by hardware and maintained by a bit segment linked list, which includes the bit width of the bit segment, the template, the remaining bit width, the template locking flag, and the locked template number;
[0079] The assembly module assembles the specific data of the matching items based on the matching scheme and transfers it to the chip to complete domain segment matching and data transfer.
[0080] In addition, the system may further include an input module for inputting data related to the ACL matching item to be added.
[0081] The present scheme can be implemented in another embodiment by means of a device, which may include a corresponding module for performing each or several steps in each of the above-mentioned embodiments. Therefore, each step or several steps of each of the above-mentioned embodiments may be performed by a corresponding module, and the device may include one or more modules in these modules. A module may be one or more hardware modules specifically configured to perform the corresponding steps, or implemented by a processor configured to perform the corresponding steps, or stored in a computer-readable medium for implementation by a processor, or implemented by some combination. The device may be implemented using a bus architecture. The bus architecture may include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware.
[0082] Any process or method description in the flow chart or otherwise described herein can be understood as a module, fragment or portion of a code representing one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiment of the present scheme includes other implementations, wherein the functions may not be performed in the order shown or discussed, including performing the functions in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by a technician in the technical field of the embodiment of the present scheme. The processor performs the various methods and processes described above. In some embodiments, part or all of the software program can be loaded and / or installed via a memory and / or a communication interface. When the software program is loaded into the memory and executed by the processor, one or more steps in the method described above can be performed. Alternatively, in other embodiments, the processor can be configured to perform one of the above methods by any other appropriate means (e.g., by means of firmware).
[0083] The logic and / or steps represented in the flowchart or otherwise described herein may be embodied in any readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions from and execute instructions on an instruction execution system, apparatus, or device), or in combination with such instruction execution systems, apparatuses, or devices.
[0084] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. An ACL hardware fixed template domain segment matching method, characterized in that: The method comprises: S1, organization stage, adding ACL matching items for users, sorting the ACL matching items, and forming a matching necklace table; S2, matching stage, based on the order of the matching necklace list, extract the items to be matched one by one, match them with the bit segments, and form a matching scheme; the bit segment refers to a bit segment with a fixed bit width provided by hardware, which is maintained by a bit segment linked list, and the bit segment linked list contains the bit width of the bit segment, template, remaining bit width, template locking flag and locked template number; S3, assembly stage: based on the matching scheme formed in S2, the specific data of the matching items are assembled and transferred to the chip to complete domain segment matching and data transfer; In S1, ACL matching items are sorted as follows: The priority is set based on the commonness of the matching items. The higher the commonness, the higher the priority. If the priorities are the same, the priority is determined by the bit width of the matching items. When a new ACL match item is inserted into the match chain table, it is inserted into the match chain table based on the priority of the new ACL match item; The priority setting method in the bit segment linked list is: The smaller the bit width of the bit segment, the higher the priority; in the bit segment, the fewer matching items provided by the template, the higher the template priority.
2. The method according to claim 1, characterized in that In S1, the matching necklace table is used to maintain ACL matching items and store matching item types, data, and masks.
3. The method according to claim 1, characterized in that In the bit segment linked list, the template of the bit segment includes the number of templates provided by the bit segment and the matching items of each template; The bit segment linked list is fixed and associated with a specific chip.
4. The method according to claim 1, characterized in that: In S2, the method for matching a single item to be matched with a bit segment is: S21, select the current bit segment in the bit segment chain list, and determine whether the current bit segment is locked; if locked, execute S22; if not locked, and there is a next bit segment in the bit segment chain list, select the next bit segment to determine whether it is locked; if the current bit segment is the last bit segment in the bit segment chain list, execute S23; S22, if the bit width of the item to be matched is smaller than the remaining bit width of the current bit segment, execute S24, otherwise select the next bit segment and return to S21 to execute the locking determination; S23, starting from the first bit segment in the bit segment chain list, determine whether the bit segment is locked. If the bit segment is not locked, execute S25; otherwise, if there is a next bit segment, select the next bit segment for determination. If the current bit segment is the last bit segment in the bit segment chain list, return a match failure. S24, selecting the template locked by the current bit segment, comparing the item to be matched with the matching item in the template, if the matching items in all the templates locked by the current bit segment are consistent with the type of the item to be matched, then filling the content of the item to be matched into the corresponding template, completing the matching, and updating the remaining bit width of the current bit segment; Enter the matching of the next item to be matched; otherwise, the matching of the current bit segment fails, the next bit segment is selected, and return to S21; S25, when the current bit segment is not locked, if the bit width of the item to be matched is smaller than the remaining bit width of the current bit segment, execute S26, otherwise select the next bit segment in the bit segment linked list, and return to S23 for locking judgment; S26, select the first template provided by the current bit segment, if there is a matching item of the same type as the item to be matched in the first template, fill the content of the item to be matched into the corresponding template, complete the matching, lock the template, update the template lock flag of the current bit segment to locked, fill the current template sequence number into the locked template number, update the remaining bit width of the current bit segment, and enter the matching of the next item to be matched; Otherwise, if the current bit segment also provides the next template, the next template is selected to perform matching; if the current template is already the last template, the next bit segment is selected and returns to S23 to perform locking judgment.
5. The method according to claim 4, characterized in that In S21, when matching with a bit segment in the bit segment chain list for the first time, the current bit segment defaults to the first bit segment in the bit segment chain list.
6. The method according to claim 1, characterized in that A bit segment provides one or more templates; when the bit segment is locked, one bit segment locks one template.
7. An ACL hardware fixed template domain segment matching system, characterized in that: The system comprises: The organization module adds ACL matching items for users, sorts the ACL matching items, and forms a matching necklace table; The matching module extracts the items to be matched one by one based on the order of the matching necklace list, matches them with the bit segments, and forms a matching scheme; the bit segments are bit segments with fixed bit widths provided by hardware and maintained by a bit segment linked list, which includes the bit width of the bit segment, the template, the remaining bit width, the template locking flag, and the locked template number; The assembly module assembles the specific data of the matching items based on the matching scheme and transfers it to the chip to complete domain segment matching and data transfer; In the organization module, ACL matches are sorted as follows: The priority is set based on the commonness of the matching items. The higher the commonness, the higher the priority. If the priorities are the same, the priority is determined by the bit width of the matching items. When a new ACL match item is inserted into the match chain table, it is inserted into the match chain table based on the priority of the new ACL match item; In the bit segment linked list, the priority setting method is: The smaller the bit width of the bit segment, the higher the priority; in the bit segment, the fewer matching items provided by the template, the higher the template priority.
8. An ACL hardware fixed template domain segment matching device, characterized in that: The device includes an input device, a processor and a memory; The input device is used to input ACL matching items; the processor calls the computer instructions in the memory, and executes the ACL hardware fixed template domain segment matching method according to any one of claims 1-6 based on the input ACL matching items.
Citation Information
Patent Citations
Method, device, equipment and medium for extracting texts
CN108268623A
Method and device for improving large-specification ACL matching efficiency
CN113452615A
