Routing device, routing management method and computer readable storage medium

By dividing the TCAM storage space into multiple storage partitions and adjusting according to the flow table occupancy rate, combining the result register, decoder and priority selector, the complex problem of delay and update during TCAM routing table lookup is solved, and efficient routing management is achieved.

CN120499094APending Publication Date: 2025-08-15THE 54TH RESEARCH INSTITUTE OF CHINA ELECTRONICS TECHNOLOGY GROUP CORPORATION +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510832678.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-20
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

In the prior art, the TCAM-based routing table lookup delay is long, the route update is complex and inefficient, especially when multiple matching results are required, the flow table update is large and the operation is complicated.

Method used

Divide the TCAM storage space into multiple memory partitions, each partition corresponds to a different mask length, and adjust the partition size according to the flow table occupancy rate, route search through the result register, decoder and priority selector, and priority selection is given to the longest prefix matching.

Benefits of technology

It reduces the delay in routing search, improves table lookup efficiency, reduces the time complexity of flow table updates, supports multi-port parallel table lookup, and reduces the risk of flow table overflow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120499094A_ABST
    Figure CN120499094A_ABST
Patent Text Reader

Abstract

The invention discloses a routing device, a routing management method and a computer readable storage medium, and relates to the technical field of routing. The device comprises at least one processor, a ternary content addressable memory (TCAM), a result register, a decoder and a priority selector, the TCAM is divided into at least two storage partitions, and the sizes of the at least two storage partitions are adjusted according to the flow table occupancy rates of the at least two storage partitions, so that the difference value between the flow table occupancy rates of any two storage partitions is lower than a first threshold value. And after the destination IP address of the data packet is obtained, querying the plurality of storage partitions for matching, and outputting a matched flow table item through the result register, the decoder and the priority selector. Besides, the computer readable storage medium is used for storing a computer program and executing the route management method, the updating of the flow table item in the TCAM can ensure the longest prefix matching, and the route updating time delay is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of routing technology, and in particular to a routing device, a routing management method, and a computer-readable storage medium. Background Art

[0002] Routing management is crucial in data forwarding. It involves route lookups, such as those performed using ternary content addressable memory (TCAM). TCAM stores keyword entries of arbitrary length using a keyword mask. Each entry consists of an Internet Protocol (IP) address and a mask.

[0003] However, due to the mask nature of IPv4 protocol routing addresses, TCAM-based route lookups require additional clock cycles to determine the final flow entry when multiple matches occur. Furthermore, when routes are updated, all entries may need to be moved, which is complex, inefficient, and leads to poor lookup performance. Summary of the Invention

[0004] In view of this, the present invention provides a routing device, a routing management method, and a computer-readable storage medium. The method can reduce the lookup delay and the routing update delay.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0006] A routing device, comprising at least one processor, a ternary content addressable memory (TCAM), a result register, a decoder, and a priority selector;

[0007] The ternary content addressable memory TCAM includes at least two storage partitions, each of the storage partitions is used to store multiple flow table entries, and each flow table entry corresponds to a piece of routing information;

[0008] The at least one processor is configured to obtain a flow table occupancy rate of each storage partition and adjust the size of each storage partition according to the flow table occupancy rate, wherein the flow table occupancy rate is the ratio of the number of flow table entries stored in the storage partition to the size of the storage partition; wherein the adjustment rule of the at least one processor is as follows: a portion of the storage space with a small flow table occupancy rate is allocated to the storage space with a large flow table occupancy rate, so that the difference in the flow table occupancy rates of any two storage partitions is less than a preset threshold;

[0009] Each storage partition is connected to a separate result register, and each bit of the result register outputs 0 or the address of a flow table entry in the currently connected storage partition. When the size of the storage partition is adjusted, part of the depth of the result register connected to the storage partition is allocated to the corresponding storage partition, so that the depth of each result register corresponds to the size of the currently connected storage partition.

[0010] Each result register is connected to a respective decoder, which includes a cascade of multiple logic gates or gates. The input of the decoder is each bit output of the result register, and the output of the decoder is 0 or the address of one of the flow table entries in the corresponding storage partition;

[0011] The input of the priority selector is the output of each decoder, and the output of the priority selector is the address of one of the flow table entries in one of the storage partitions.

[0012] Furthermore, each of the storage partitions corresponds to a different mask length, and all flow table entries stored in each storage partition have the same mask length; the flow table entry in each storage partition stores the AND result of the Internet Protocol IP address and the mask.

[0013] Furthermore, the flow table entries of each storage partition include a first part and a second part, the first part stores the AND result of the Internet Protocol IP address and the mask, and the second part is a reserved space used to adapt to changes in different mask lengths when the storage partition size is adjusted.

[0014] Furthermore, the storage partitions are sorted from low to high according to the address, and the routing information is filled in order from low to high according to the address, and the location corresponding to address 0 in each storage partition does not store routing information and is fixed to a default value of 0.

[0015] Furthermore, all first-level logic gates or gates of the decoder have reserved input ports for corresponding to the size adjustment of the storage partition.

[0016] A routing management method, implemented based on a routing device as described in any one of the above, specifically comprises the following steps:

[0017] Step 1: The routing device obtains the destination IP address from the received data packet and broadcasts it to each storage partition;

[0018] Step 2: For each storage partition, the destination IP address is ANDed with the mask corresponding to the current storage partition, and the calculation result is matched with each flow table entry. If the match is successful, the corresponding position in the result register of the corresponding connection is written to the address of the currently matched flow table entry; otherwise, the corresponding position in the result register of the corresponding connection is written to 0;

[0019] Step 3: Use each bit of data in the result register as input and output it to the corresponding decoder. After calculations through cascaded multi-level logic gates or gates, the decoder finally outputs 0 or the address of one of the flow table entries in the corresponding storage partition. If there is a matching flow table entry in the storage partition corresponding to the decoder, the decoder outputs the address of the corresponding flow table entry; otherwise, the decoder outputs 0.

[0020] Step 4: Outputs of all decoders are used as input values and output to the priority selector. The priority selector makes decisions based on the mask lengths corresponding to the storage partitions, in the order from the storage partition corresponding to the longest mask length to the storage partition corresponding to the shortest mask length:

[0021] If the decoder output result of the current storage partition is the address of a flow table entry, the address of the flow table entry is output. If the decoder output result of the current storage partition is 0, the next storage partition is selected for judgment until the address of a flow table entry is output.

[0022] Step 5: Finally, according to the flow table entry address output by the priority selector, the routing information contained therein is used as the routing information required by the current data packet to complete the routing management.

[0023] A computer-readable storage medium is used to store a computer program. When the computer program is run on a computer, the above-mentioned routing management method is executed.

[0024] Due to the adoption of the above technical solution, the present invention has the following beneficial effects compared with the prior art:

[0025] 1. The present invention solves the problem of slow latency in traditional TCAM table lookup algorithms by combining them with a pipeline implementation, making the table lookup time complexity O(1); it also solves the problem of long latency in traditional TCAM flow table updates, and partitions homogeneous flow table entries for storage, making the time complexity of flow table updates O(6).

[0026] 2. When multiple ports submit table lookup queries simultaneously, the present invention solves the problem that the table lookup algorithm has a low throughput and cannot meet the rate requirement of simultaneous table lookup of multiple ports.

[0027] 3. The present invention divides the dynamic storage area to better deal with the situation of a large number of sudden flow table entries and reduce the overflow of the flow table BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A flowchart of the routing management method provided in an embodiment of the present application.

[0029] Figure 2A schematic diagram of the TCAM partitioning provided in an embodiment of the present application.

[0030] Figure 3 A schematic diagram of a TCAM-based table lookup provided in an embodiment of the present application.

[0031] Figure 4 A schematic diagram of the principle of the decoding circuit provided in an embodiment of the present application.

[0032] Figure 5 A schematic diagram of the principle of a priority decoder provided in an embodiment of the present application.

[0033] Figure 6 A timing diagram of flow table entry updates provided in an embodiment of the present application.

[0034] Figure 7 A structural diagram provided for an embodiment of the present application. DETAILED DESCRIPTION

[0035] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0036] A routing device, a routing management method, and a computer-readable storage medium;

[0037] Among them, routing management is crucial in the data forwarding process. Routing management includes routing lookup, such as looking up routing information (such as IP addresses). Routing information can be stored in a routing table. When forwarding a message, a network device such as a router or switch can obtain the destination IP address carried in the message, and search the routing information corresponding to the destination IP address from the routing table, so as to forward the message according to the found routing information. The routing table is a table that records routing prefixes and routing information, and is pre-stored in the network device. The routing prefix is used to determine the routing information that matches the destination IP address. For example, it can be the first n bits of the IP address, where n is the length of the routing prefix. Routing information can be the identifier of a network interface, indicating which network interface the network device needs to forward the message through.

[0038] When searching the routing table, determine whether the destination IP address matches the routing prefix. For example, if the length of a routing prefix is m, and the first m bits of the destination IP address are consistent with the routing prefix, the destination IP address can be considered to match the routing prefix, and the corresponding routing information is the routing information corresponding to the routing prefix. When the destination IP address matches two or more routing prefixes simultaneously, the routing prefix can be determined based on the longest prefix match principle. That is, the routing information of the longest routing prefix among the multiple routing prefixes that match the destination IP address can be used as the routing information corresponding to the destination IP address.

[0039] Since searching the routing table requires comparing the route prefix with the destination IP address to see if it matches, the network device needs to search the routing table. Obviously, the faster the routing table is called, the faster the network device can forward packets. Currently, to increase the speed at which network devices can call the routing table, the routing table can be stored in a cache. For example, the routing table is stored in a content addressable memory (CAM) or TCAM, which allows for rapid lookup of routing information. Each storage bit in the CAM stores either a 0 or a 1. TCAM adds a level of masking functionality to the CAM.

[0040] The TCAM stores keyword entries of arbitrary length by storing keyword masks. Each entry consists of an IP address and a mask. Assuming the address keyword length ranges from 1 to N, the corresponding address and mask each occupy N bits. For an entry with a keyword length of Y (1≤Y≤N), the last WY bits of the corresponding address can be either 0 or 1, where W is the table width. The first Y bits of the mask are 1, and the remaining NY bits are 0. Because multiple entries may match the input keyword, the TCAM specifies that the entry with the lowest address among all matching entries is selected as the final result. To comply with the longest prefix routing lookup, keywords with longer prefixes are stored at lower addresses in the TCAM, while keywords with shorter prefixes are stored at higher addresses. Furthermore, to reduce power consumption, TCAM table lookups are implemented based on a logic algorithm.

[0041] However, due to the mask nature of IPv4 protocol routing addresses, TCAM-based route lookups require additional clock cycles to determine the final flow entry when multiple matches occur. Furthermore, when routes are updated, all entries may need to be moved, which is complex, inefficient, and leads to poor lookup performance.

[0042] In view of this, a solution is provided in an embodiment of the present application. In this embodiment, the TCAM is partitioned, and different zones correspond to different mask lengths. Implementing TCAM route lookup based on SDN can reduce route lookup latency and route update latency.

[0043] The solution provided by the embodiments of the present application is described below with reference to the accompanying drawings.

[0044] See Figure 1 , which is a flow chart of a routing management method provided in an embodiment of the present application. The method may be performed by a routing device. The routing device may be, for example, a router or a chip within a router, or a switch or a chip within a switch. The routing device includes a TCAM for storing routing information.

[0045] S101: Divide the storage space of the TCAM into at least two storage partitions.

[0046] In an embodiment of the present application, the storage space of the TCAM can be divided into at least two storage partitions, so that when performing a table lookup, multiple storage partitions can be queried in parallel, thereby improving query efficiency and reducing query latency.

[0047] There are no restrictions on how the TCAM storage partitions are divided. For example, if the IP addresses included in the routing information support the IPv4 protocol, the TCAM storage space can be divided into at least two storage partitions based on the mask length, with different mask lengths for different storage partitions. Initially, the at least two storage partitions are of the same size.

[0048] Optionally, at least two storage partitions are sorted by address from low to high, and masks within at least two storage partitions are sorted by address from large to small. For example, see Figure 2 , shows a way to divide TCAM. Figure 2 For example, consider the case where the TCAM storage space is divided into partitions (i.e., partitions 1 through 4). The addresses of partitions 1 through 4 are sorted from low to high, and the mask lengths corresponding to partitions 1 through 4 are sorted from large to small. In other words, the masks are sorted from large to small according to the addresses. For example, the mask length of partition 1 is 32, the mask length of partition 2 is 24, the mask length of partition 3 is 16, and the mask length of partition 4 is 8.

[0049] Each storage partition is used to store routing information, which includes, for example, an IP address and a mask. Each storage partition includes a first part and a second part, where the first part is used to store routing information and the second part is reserved as space for performing corresponding operations. For example, the storage partition can be adjusted in conjunction with the second part to adapt to different mask lengths. The first part can specifically be used to store the result of the AND operation of the IP address and the mask. It can also be understood that the first part is used to store an address, which includes the IP address and the mask, or the address includes the result of the AND operation of the IP address and the mask.

[0050] For example, see Figure 3 , shows an example of caching based on TCAM. Figure 3As shown, address 0 and address 1, and so on, are stored. For example, address 0 corresponds to IP address 10.0.0.0, and the mask is 255.0.0.0. For another example, address 1 corresponds to IP address 11.0.0.0, and the mask is 255.0.0.0, and so on. When storing, the result of the AND of the IP address and the mask is stored. For example, taking the IP address 10.0.0.1 and the mask 255.0.0.0 as an example, the address 0 bit stored in the partition stores 10.0.0.0. In this way, each storage partition in the TCAM stores corresponding routing information. The routing information stored in each storage partition or TCAM can also be called a flow table entry, and a storage partition can store at least one flow table entry.

[0051] S102: Perform table lookup based on TCAM.

[0052] The process of table lookup based on TCAM may include: detecting or obtaining a keyword (such as an IP address) from a received data packet, matching the keyword with the flow table entries in each storage partition in the TCAM, and if there are multiple flow table entries that match the keyword, then the flow table entry with the longest mask length is used as the matching result.

[0053] Specifically, the keyword can be broadcast to each storage partition in the TCAM. For each storage partition, the keyword and the mask are bitwise ANDed and then compared with the IP address of the flow table entry to obtain the result and store it in the result register. When storing in the result register, if the match fails, the default value 0 of the current result register is assigned to the corresponding bit of the current result register. If the match succeeds, the address value of the current result register is assigned to the corresponding bit of the current result register, such as Figure 3 shown.

[0054] There may be multiple flow table entries that match the keyword (for example, IP addresses in multiple flow table entries match the keyword), and the flow table entry with the longest mask length may be further taken as the matching result.

[0055] Specifically, each storage partition is connected to a decoder, and the output of each decoder is connected to a priority selector, and the flow table entry with the longest mask length can be used as a matching result through the priority selector.

[0056] It should be understood that for each storage partition, only one address value is valid in the result register, and the other registers have the default value 0. Figure 4As shown, taking the flow table depth of 16 and the IPV4 protocol as an example, the address mapping rule results found are stored in 16 result registers. Since there will only be one matching item for the same type of mask in the flow table of the IPV4 protocol type, the values of other registers are the default value 0. Therefore, these 16 result registers can be divided into 4 parts, and the first-level address is obtained through the logic OR gate, and the first-level address is then obtained through the logic gate OR gate. When the flow table depth increases, multiple levels of logic gates or gates are cascaded to match more flow table items. Each mask partition is connected to the same decoding circuit. Among them, all the first-level logic gates or gates of the decoder have reserved input ports for corresponding to the size adjustment of the storage partition.

[0057] When multiple memory partitions have corresponding address results, the decoded address must be selected based on the LPM. For example, the match with the longest mask length is prioritized. This function is implemented using a priority selector, which sequentially determines the decoding results of each mask segment to output the final table lookup result.

[0058] like Figure 5 As shown, the decoded address is output to the priority selector, which determines the most recent match result by comparing the length of the address prefix (mask length). For example, the priority selector matches the long prefix mask block; if a match is successful, the address is output; if a match fails, the priority selector matches the medium-long prefix mask block. If a match is successful, the address is output; if a match fails, the priority selector matches the short prefix mask block; if a match is successful, the address is output.

[0059] S103: Obtain flow table occupancy rates in at least two storage partitions in the TCAM.

[0060] The flow table occupancy rate of a storage partition is the ratio of the number of flow table entries stored in the storage partition to the size of the storage partition. Because different storage partitions correspond to different mask lengths, flow table entries must be moved to ensure the longest prefix match when the flow table is updated. For example, when the address corresponding to the number of mask bits needs to be updated, the corresponding operation can be performed in the reserved space in the storage partition. When the number of flow table entries is large, it is inevitable that the number of flow tables in partitions with specific mask lengths will increase sharply, causing the reserved space of a storage partition to overflow.

[0061] To this end, in an embodiment of the present application, the flow table occupancy rates in at least two storage partitions in the TCAM can be obtained, so that the sizes of each storage partition can be adjusted according to the obtained flow table occupancy rates, so that the flow table occupancy rates of each storage partition are similar or the same.

[0062] S104: Adjust the sizes of at least two storage partitions according to the flow table occupancy rates of the at least two storage partitions, so that the difference between the flow table occupancy rates of any two storage partitions is lower than a first threshold.

[0063] If the difference between the flow table occupancy rates of any two storage partitions is below the first threshold, the flow table occupancy rates of the two storage partitions are considered to be similar or the same. This ensures that the occupancy rates of crowded and sparse partitions are roughly the same, avoiding the need to move a large number of entries during updates, thereby reducing the time complexity and latency of updating flow table entries.

[0064] In an embodiment of the present application, the storage space of the TCAM can be divided into multiple storage partitions, so that multiple storage partitions can be queried in parallel, making the time complexity of flow table query O(1), reducing the latency of looking up routing information. Furthermore, the size of each storage partition can be adjusted based on the flow table occupancy of each storage partition, so that the flow table occupancy of multiple storage partitions is similar or the same.

[0065] This method can ensure that the longest prefix match is guaranteed when updating the flow table entries in the TCAM, making the time complexity of the flow table update O(6) and reducing the delay of the routing update. Figure 6 As shown in the figure, when the flow table update flag (UPDATE_EN) and data (DATA) are input, the address mapping rules are initially obtained. Then, decoding is performed to obtain the first-layer decoding address, the second-layer decoding address, and the third-layer decoding address. The priority selector then selects the most appropriate address from the third-layer decoding address (the result address of the priority selector). Finally, the data is written to the memory at the corresponding address for storage.

[0066] The following describes the device used to implement the above method in the embodiment of the present application in conjunction with the accompanying drawings. Therefore, the above content can be used in subsequent embodiments, and repeated content will not be repeated.

[0067] See Figure 7 , shows a structure of a routing device that implements the functions of the above-mentioned method embodiments. The routing device may include a TCAM, at least two decoders, and a priority selector. The TCAM is divided into at least two storage partitions, each storage partition is connected to a decoder, and the output of each decoder is connected to the input of a priority selector. Figure 7 Take the example of a TCAM including four storage partitions.

[0068] The routing device also includes at least one processor, which can be used to obtain the flow table occupancy rate of at least two storage partitions in the TCAM; adjust the size of the at least two storage partitions according to the flow table occupancy rate of the at least two storage partitions so that the difference between the flow table occupancy rates of any two storage partitions is lower than the first threshold.

[0069] Optionally, before obtaining the flow table occupancy in at least two storage partitions in the TCAM, at least one processor is further used to: divide the storage space of the TCAM into at least two storage partitions, wherein at least two storage partitions have the same size and different storage partitions correspond to different mask lengths.

[0070] Optionally, at least two storage partitions are sorted from low to high according to the address, and the masks in at least two storage partitions are sorted from large to small.

[0071] Optionally, at least one processor is further used to: detect a keyword from a received data packet; match the keyword with the flow table entries in each storage partition in the TCAM, each storage partition being used for the AND result of the IP address and the mask; if there are multiple flow table entries that match the keyword, the flow table entry with the longest mask length is used as the matching result.

[0072] Optionally, the priority selector is configured to: if there are multiple flow table entries matching the keyword, select a flow table entry with the longest mask length from the multiple flow table entries based on the LPM.

[0073] In an embodiment of the present application, a computer-readable storage medium is also provided, including instructions, which, when executed on a computer, enable the computer to execute the method in the above method example. For details, please refer to the detailed description in the method example, which will not be repeated here.

[0074] To implement the various functions of the methods provided in the embodiments of the present application, the routing device may include hardware structures and / or software modules, and implement the aforementioned functions in the form of hardware structures, software modules, or a combination of hardware structures and software modules. Whether a particular one of the aforementioned functions is implemented in the form of hardware structures, software modules, or a combination of hardware structures and software modules depends on the specific application and design constraints of the technical solution.

[0075] Those skilled in the art will clearly understand that for the sake of convenience and brevity, the division of the above-mentioned functional modules is only used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working processes of the above-mentioned systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0076] In addition, the functional units in the embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0077] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: Universal Serial Bus flash disk (USB), mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, and other media that can store program code.

[0078] The various illustrative logic units and circuits described in the embodiments of the present application can be implemented or operated by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or the design of any combination thereof. The general-purpose processor can be a microprocessor, alternatively, the general-purpose processor can also be any traditional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration to implement.

[0079] The steps of the methods or algorithms described in the embodiments of the present application can be directly embedded in hardware, software units executed by a processor, or a combination of the two. The software units can be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM, or other storage media in any form known in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and write information to the storage medium. Alternatively, the storage medium can also be integrated into the processor. The processor and storage medium can be arranged in an ASIC.

[0080] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0081] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.

Claims

1. A routing device, characterized in that: The routing device includes at least one processor, a ternary content addressable memory TCAM, a result register, a decoder and a priority selector; The ternary content addressable memory TCAM includes at least two storage partitions, each of the storage partitions is used to store multiple flow table entries, and each flow table entry corresponds to a piece of routing information; The at least one processor is configured to obtain a flow table occupancy rate of each storage partition and adjust the size of each storage partition according to the flow table occupancy rate, wherein the flow table occupancy rate is the ratio of the number of flow table entries stored in the storage partition to the size of the storage partition; wherein the adjustment rule of the at least one processor is as follows: a portion of the storage space with a small flow table occupancy rate is allocated to the storage space with a large flow table occupancy rate, so that the difference in the flow table occupancy rates of any two storage partitions is less than a preset threshold; Each storage partition is connected to a separate result register, and each bit of the result register outputs 0 or the address of a flow table entry in the currently connected storage partition. When the size of the storage partition is adjusted, part of the depth of the result register connected to the storage partition is allocated to the corresponding storage partition, so that the depth of each result register corresponds to the size of the currently connected storage partition. Each result register is connected to a respective decoder, which includes a cascade of multiple logic gates or gates. The input of the decoder is each bit output of the result register, and the output of the decoder is 0 or the address of one of the flow table entries in the corresponding storage partition; The input of the priority selector is the output of each decoder, and the output of the priority selector is the address of one of the flow table entries in one of the storage partitions.

2. A routing device according to claim 1, characterized in that: Each of the storage partitions corresponds to a different mask length, and all flow table entries stored in each storage partition have the same mask length; the flow table entry in each storage partition stores the AND result of the Internet Protocol IP address and the mask.

3. A routing device according to claim 2, characterized in that: The flow table entries of each storage partition include a first part and a second part. The first part stores the AND result of the Internet Protocol IP address and the mask, and the second part is a reserved space used to adapt to changes in different mask lengths when the storage partition size is adjusted.

4. A routing device according to claim 2, characterized in that: The storage partitions are sorted from low to high according to the addresses, and the routing information is filled in order from low to high according to the addresses. The location corresponding to address 0 in each storage partition does not store routing information and is fixed to the default value 0.

5. The routing device according to claim 1, wherein: All first-level logic gates or gates of the decoder have reserved input ports for corresponding to the size adjustment of the storage partition.

6. A routing management method, characterized in that: A routing device according to any one of claims 1 to 5 is implemented, specifically comprising the following steps: Step 1: The routing device obtains the destination IP address from the received data packet and broadcasts it to each storage partition; Step 2: For each storage partition, the destination IP address is ANDed with the mask corresponding to the current storage partition, and the calculation result is matched with each flow table entry. If the match is successful, the corresponding position in the result register of the corresponding connection is written to the address of the currently matched flow table entry; otherwise, the corresponding position in the result register of the corresponding connection is written to 0; Step 3: Use each bit of data in the result register as input and output it to the corresponding decoder. After calculations through cascaded multi-level logic gates or gates, the decoder finally outputs 0 or the address of one of the flow table entries in the corresponding storage partition. If there is a matching flow table entry in the storage partition corresponding to the decoder, the decoder outputs the address of the corresponding flow table entry; otherwise, the decoder outputs 0. Step 4: Outputs of all decoders are used as input values and output to the priority selector. The priority selector makes decisions based on the mask lengths corresponding to the storage partitions, in the order from the storage partition corresponding to the longest mask length to the storage partition corresponding to the shortest mask length: If the decoder output result of the current storage partition is the address of a flow table entry, the address of the flow table entry is output. If the decoder output result of the current storage partition is 0, the next storage partition is selected for judgment until the address of a flow table entry is output. Step 5: Finally, according to the flow table entry address output by the priority selector, the routing information contained therein is used as the routing information required by the current data packet to complete the routing management.

7. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and when the computer program is run on a computer, the routing management method described in claim 6 is executed.