Processing method and device of forwarding table item and computing equipment
By compressing and decompressing the data of forwarded table items, the problem of insufficient storage resources of network devices is solved, the adaptability and performance of the device are improved, and a more efficient storage and decompression process is achieved.
Patent Information
- Application Number
- CN202310842263.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-10
- Publication Date
- 2025-01-10
AI Technical Summary
As the network scale expands, the amount of data in forwarded table entries increases, resulting in excessive storage resources occupied, limiting the expansion ability of network devices.
By compressing the data of the forwarded table entry, compressed table entry and decompression parameters are generated, decompression parameters are saved for subsequent decompression, reducing storage resource usage, and improving decompression efficiency and flexibility through microcode decompression instructions.
Reduces the limitation of storage resources, improves the entry specifications and forwarding performance of network devices, reduces the complexity and delay of understanding compression, and improves the adaptability and scalability of the device.
Smart Images

Figure CN119299527A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a method, apparatus and computing device for processing forwarding table entries. Background Art
[0002] As the network scale becomes larger and larger, the number of forwarding table entries required by network devices increases, and the amount of data in the forwarding table entries increases, resulting in excessive storage resources occupied by the forwarding table entries in the network devices. Due to the limitation of storage resources, the network devices cannot adapt well to the expansion of the network scale. Summary of the invention
[0003] The present application provides a method, apparatus and computing device for processing forwarding table entries, which can save storage resources occupied by forwarding table entries in network devices, thereby helping the devices adapt to the expansion of network scale.
[0004] In a first aspect, a method for processing a transfer table entry is provided, comprising: obtaining a first transfer table entry; compressing data in the first transfer table entry to obtain a first compression table entry and a decompression parameter, wherein the decompression parameter is used to indicate decompression of the first compression table entry; and saving the first compression table entry and the decompression parameter.
[0005] In the above method, since the data in the forwarding table entries is compressed, the data volume of the forwarding table entries is reduced, thereby saving storage resources occupied by the forwarding table entries, thereby reducing the limitation of storage resources to a certain extent, thereby helping the device to adapt to the expansion of network scale.
[0006] Furthermore, since the decompression parameters guiding the decompression are saved, the table items can be decompressed later with reference to the decompression parameters if necessary, thereby reducing the implementation complexity of the decompression and helping the decompression process to be more controllable and programmable.
[0007] In addition, since the data in the forwarding table entry is compressed, the data volume of the forwarding table entry is reduced, so more entries can be stored in the same storage space, thereby improving the table entry specifications.
[0008] In some embodiments, the decompression parameter includes a first microcode decompression instruction, the first microcode decompression instruction includes first metadata and an operation code, the first metadata indicates a characteristic of data in the first transfer table entry, and the operation code indicates a decompression operation.
[0009] Since the microcode decompression instructions are saved, decompression can be achieved by executing the microcode decompression instructions if necessary, without reading metadata from the memory or relying on the complete decompression algorithm code, thereby avoiding I / O operations caused by reading metadata and saving the overhead of accessing external memory, thereby reducing the impact of memory access IO on line-speed search capability, thereby improving line-speed search capability, and also saving the overhead of parsing and executing the complete decompression algorithm, thereby improving the decompression speed.
[0010] In addition, since the microcode decompression instructions are more controllable and programmable than pure hardware, they support dynamic updating of the microcode decompression instructions according to the characteristics of the data in the forwarding table, so that the decompression operation can be flexibly configured and controlled, so that the execution of the decompression operation is more closely matched with the characteristics of the data in the forwarding table, thereby improving flexibility. At the same time, instructionization also allows the decompression process to be adjusted and optimized as needed to adapt to different scenarios and data characteristics, improving flexibility and scalability.
[0011] In some embodiments, compressing the data in the first transfer table entry to obtain a first compression table entry and a decompression parameter includes: compressing the data in the first transfer table entry to obtain a first compression table entry and the first metadata; and obtaining the first microcode decompression instruction based on the first metadata.
[0012] By converting metadata into microcode decompression instructions, it is equivalent to converting complex decompression algorithms into simple microcode decompression instructions, making the decompression process more controllable and programmable. In this way, the forwarding plane can perform decompression operations based on microcode decompression instructions without relying on the complete decompression algorithm code, thereby improving the decompression speed and saving the overhead of parsing and executing the complete algorithm. At the same time, instructionization also allows the decompression process to be adjusted and optimized as needed to adapt to different scenarios and data characteristics, improving flexibility and scalability.
[0013] In some embodiments, the first metadata includes k segments, the first microcode decompression instructions include k instructions, k is a positive integer, and obtaining the first microcode decompression instructions based on the first metadata includes: in response to the i-th segment in the k segments of the metadata being a numerical value, filling the i-th segment in the metadata into the i-th instruction in the k instructions, where i is a positive integer less than or equal to k; or, in response to the i-th segment in the k segments of the metadata being a wildcard, determining the bit range corresponding to the i-th segment based on the position of the i-th segment in the metadata, and filling the bit range into the i-th instruction in the k instructions.
[0014] Since each segment in the metadata is filled into each instruction in turn, the decompression instruction and metadata are integrated into one, achieving the effect that the instruction is the data and the data is the instruction, or blurring the boundary between the instruction and the data. If necessary, the relevant metadata can be used immediately while executing the microcode decompression instruction, without the need to obtain the metadata from other places other than the microcode instruction, thereby reducing the memory access input / output (IO) caused by the additional acquisition of metadata, improving the efficiency of obtaining metadata, and thus improving the efficiency of decompression.
[0015] In some implementations, saving the first compression table entry and the decompression parameter includes: saving the first microcode decompression instruction to a microcode instruction space.
[0016] Since the first microcode decompression instruction is saved in the microcode instruction space, the microcode instruction space is usually located inside the processor, and the access time (or access time) of the microcode instruction space is very short, the microcode decompression instruction can be obtained from the microcode instruction space very quickly. Usually, the processor can obtain the microcode decompression instruction from the microcode instruction space within one clock cycle (cycle, also called one beat), thereby improving the decompression speed and minimizing the impact of the decompression characteristics on device performance.
[0017] In some implementations, in response to the first forwarding table entry being updated to a second forwarding table entry, the first microcode decompression instruction is updated based on second metadata, where the second metadata indicates characteristics of data in the second forwarding table entry.
[0018] Since the old microcode decompression instructions are updated based on the new metadata in the scenario of updating the forwarding table entries, the updated microcode decompression instructions match the new metadata, so that the decompression process can flexibly adapt to the metadata changes, reduce the probability of decompression failure due to metadata changes, and improve the accuracy and reliability of decompression. In addition, compared with redesigning the entire decompression algorithm or adding / deleting instructions, the implementation complexity of updating the old microcode decompression instructions is reduced, and there is no need to re-open storage space for the new microcode decompression instructions. Therefore, the process of updating the microcode decompression instructions is simplified as much as possible, and the overhead of updating the microcode decompression instructions is reduced.
[0019] In some implementations, the structure of the second metadata is the same as the structure of the first metadata.
[0020] Since the new metadata structure is consistent with the old metadata structure, it indicates that the number of microcode decompression instructions corresponding to the new metadata and the old metadata is the same, but the specific values or the positions of wildcards may be different. Therefore, when updating the decompression instructions, after modifying the corresponding microcode decompression instructions based on the new metadata, the same number of microcode instructions can be maintained without increasing or decreasing the number of instructions, thereby reducing the risk of expansion of the storage space occupied by microcode instructions due to the increase in the number of microcode instructions.
[0021] In some implementations, the method further includes: in response to the first transfer table entry being updated to a second transfer table entry, obtaining a second microcode decompression instruction based on second metadata, wherein the second metadata indicates characteristics of data in the second transfer table entry; and saving the second microcode decompression instruction.
[0022] Since the microcode decompression instructions are retrieved and saved based on the new metadata, the process of updating the microcode decompression instructions is basically independent of the old metadata and the old microcode decompression instructions, and it is not necessary to require the new metadata to be consistent with the old metadata structure. Therefore, it is applicable to a wider range of scenarios, and it also reduces the constraints of the metadata structure on the compression algorithm to a certain extent, and improves flexibility. In particular, considering that the data changes of the forwarding table items are uncertain in some business scenarios, this may cause the structure of the metadata corresponding to the forwarding table items to change after the data in the forwarding table items are changed. Updating the microcode decompression instructions by regenerating the microcode decompression instructions will help match the needs of more business scenarios.
[0023] In some implementations, a structure of the second metadata is different from a structure of the first metadata.
[0024] Since the new metadata structure is allowed to be different from the old metadata structure, the structure of the microcode decompression instruction can be optimized according to the latest metadata structure, thereby better adapting to the characteristics of the new data and helping to improve the compression ratio.
[0025] In some embodiments, the decompression parameters include first metadata indicating characteristics of data in the first forwarding table entry.
[0026] In this way, the table item specifications can be effectively improved in scenarios where specifications are prioritized.
[0027] In some implementations, the method further includes: in response to receiving a data packet corresponding to the first compression table entry, decompressing the first compression table entry based on the decompression parameter to obtain data in the first forwarding table entry; and forwarding the data packet based on the data in the first forwarding table entry.
[0028] Since the compressed table entry is decompressed when the data message corresponding to the compressed table entry is received, the storage resources occupied by the table entry are reduced as much as possible.
[0029] In some implementations, before compressing the data in the first forwarding table entry, the method further includes: determining that the number of stored forwarding table entries is greater than or equal to a threshold.
[0030] Since compression is performed when the number of forwarding table entries reaches a threshold, there is no need to compress and decompress the forwarding table entries in scenarios with a small number of forwarding table entries, thereby reducing the impact of compression and decompression on performance, saving performance overhead and forwarding delay caused by decompression, and better compatibility with scenarios with small-specification configurations.
[0031] In a second aspect, a data compression device for a forwarding table entry is provided, including: a control plane component, used to obtain a first forwarding table entry; compressing data in the first forwarding table entry to obtain a first compression table entry and a decompression parameter, wherein the decompression parameter is used to indicate decompression of the first compression table entry; and a forwarding plane component, used to save the first compression table entry and the decompression parameter.
[0032] In some implementations, the control plane component is used to compress the data in the first transfer table entry to obtain a first compression table entry and the first metadata; and obtain the first microcode decompression instruction based on the first metadata.
[0033] In some embodiments, the first metadata includes k segments, the first microcode decompression instructions include k instructions, k is a positive integer, and the control plane component is used to, in response to the i-th segment in the k segments of the metadata being a numerical value, fill the i-th segment in the metadata into the i-th instruction among the k instructions, where i is a positive integer less than or equal to k; or, in response to the i-th segment in the k segments of the metadata being a wildcard, determine the bit range corresponding to the i-th segment based on the position of the i-th segment in the metadata, and fill the bit range into the i-th instruction among the k instructions.
[0034] In some embodiments, the forwarding plane component includes a microcode instruction space, and the control plane component is used to save the first microcode decompression instruction to the microcode instruction space.
[0035] In some embodiments, the forwarding plane component is further configured to update the first microcode decompression instruction based on second metadata in response to the first forwarding table entry being updated to a second forwarding table entry, wherein the second metadata indicates characteristics of data in the second forwarding table entry.
[0036] In some embodiments, the forwarding plane component is further used to obtain a second microcode decompression instruction based on second metadata in response to the first forwarding table entry being updated to a second forwarding table entry, wherein the second metadata indicates characteristics of data in the second forwarding table entry; the forwarding plane component is further used to save the second microcode decompression instruction.
[0037] In some embodiments, the forwarding plane component is further used to, in response to receiving a data packet corresponding to the first compression table entry, decompress the first compression table entry based on the decompression parameter to obtain the data in the first forwarding table entry; and forward the data packet based on the data in the first forwarding table entry.
[0038] In some implementations, the control plane component is further configured to determine whether the number of stored forwarding table entries is greater than or equal to a threshold.
[0039] In a third aspect, a computing device is provided, comprising at least one processor, wherein the at least one processor is coupled to at least one memory, wherein at least one computer program instruction is stored in the at least one memory, and wherein the at least one computer program instruction is loaded and executed by the at least one processor so that the computing device implements the above-mentioned first aspect or any optional method of the first aspect.
[0040] Computing devices such as servers, terminals, routers, switches or firewalls.
[0041] In some embodiments, the at least one processor includes a first processor and a second processor, the first processor is used to compress data in a first transfer table entry to obtain a first compression table entry and the first metadata; obtain the first microcode decompression instruction based on the first metadata; save the first microcode decompression instruction to the microcode instruction space of the second processor, and save the first compression table entry.
[0042] Since the first processor saves the microcode decompression instructions to the microcode instruction space of the processor and supports the compression and decompression to be executed collaboratively by two different processors, the second processor can independently perform the decompression operation, thereby reducing the burden of the first processor, helping to more effectively utilize the overall resources of the device and improving the overall performance and efficiency of the device.
[0043] In some embodiments, an interface is also included, and the second processor is also used to execute the first microcode decompression instruction to decompress the first compression table entry in response to receiving the data packet corresponding to the first compression table entry to obtain the data in the first forwarding table entry; based on the data in the first forwarding table entry, instruct the interface to forward the data packet.
[0044] Since the second processor executes the microcode decompression instruction for decompression without reading metadata from the external memory, and decompression is performed based on the read metadata, the I / O operation caused by the second processor reading metadata from the external memory is avoided, and the overhead caused by the second processor accessing the external memory is saved. Since the overhead of memory access IO is saved, the influence of memory access IO on the line-speed search capability of the second processor is further avoided, thereby improving the line-speed search capability of the second processor.
[0045] In some implementations, the first processor is a central processing unit (CPU), and the second processor is a network processor.
[0046] Since the processing logic of the compression algorithm is relatively complex, and the CPU has a more flexible and powerful computing power, it can execute various types of instructions and algorithms. Compared with the dedicated hardware such as the network processor, the architecture and design of the CPU are more universal and can adapt to different computing needs. Therefore, when it comes to complex compression algorithm logic, it is often more advantageous to use the CPU to execute, so the CPU undertakes the task of data compression of the forwarding table items and generating decompression parameters, which helps to reduce the complexity of implementation. In addition, by decompressing the compression table items by the network processor, the speed is faster. For example, the network processor can improve the efficiency of decompression through a special instruction set or hardware accelerator, and these instructions or hardware accelerators can directly process the compression table items without the need for additional instruction parsing and processing like software decompression, so that the decompression operation can be performed faster. In addition, the network processor can decompress the compression table items when it is necessary to find the content of the forwarding table items in the process of forwarding data packets, thereby reducing the delay caused by the decompression step to forwarding.
[0047] In a fourth aspect, a computing device is provided, the computing device comprising: a main control board and an interface board. The main control board comprises: a first processor and a first memory. The interface board comprises: a second processor, a second memory and an interface. The main control board and the interface board are coupled.
[0048] The first memory can be used to store program code, and the first processor is used to call the program code in the first memory to perform the following operations: obtain a first transfer table entry; compress the data in the first transfer table entry to obtain a first compression table entry and a decompression parameter, wherein the decompression parameter is used to indicate decompression of the first compression table entry.
[0049] The second memory can be used to store the first compression table entry and the decompression parameters, and the second processor is used to, in response to receiving a data packet corresponding to the first compression table entry, decompress the first compression table entry based on the decompression parameters to obtain the data in the first forwarding table entry; and forward the data packet based on the data in the first forwarding table entry.
[0050] In a possible implementation, an inter-process communication (IPC) channel is established between the main control board and the interface board, and the main control board and the interface board communicate through the IPC channel.
[0051] In a fifth aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium. When the instruction is executed on a computer, the computer executes the method provided in the first aspect or any optional manner of the first aspect.
[0052] In a sixth aspect, a computer program product is provided, which includes one or more computer program instructions. When the computer program instructions are loaded and executed by a computer, the computer executes the method provided by the first aspect or any optional manner of the first aspect.
[0053] In a seventh aspect, a chip is provided, comprising a memory and a processor, wherein the processor is used to call and run the computer instructions from the memory to execute the method in the above-mentioned first aspect and any possible implementation of the first aspect.
[0054] In some embodiments, the computer instructions are stored in a memory located inside or outside the chip, which is coupled to the processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a structural schematic diagram of a transfer table data compression device provided in an embodiment of the present application;
[0056] Figure 2 It is a structural schematic diagram of a transfer table data compression device provided in an embodiment of the present application;
[0057] Figure 3 It is a structural schematic diagram of a transfer table data compression device provided in an embodiment of the present application;
[0058] Figure 4 It is a structural diagram of a network device provided in an embodiment of the present application;
[0059] Figure 5 It is a structural diagram of a network device provided in an embodiment of the present application;
[0060] Figure 6 It is a structural diagram of a network system provided by an embodiment of the present application;
[0061] Figure 7 It is a flowchart of a method for processing a forwarding table entry provided in an embodiment of the present application;
[0062] Figure 8 It is a schematic diagram of compressing and decompressing data included in a forwarding table entry provided by an embodiment of the present application;
[0063] Fig. 9 is a schematic diagram of an update microcode decompression instruction provided in an embodiment of the present application;
[0064] Fig.10 is a schematic diagram of an update microcode decompression instruction provided in an embodiment of the present application;
[0065] Fig.11 It is a flowchart of a method for processing a forwarding table entry provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0067] The following is an explanation of some terminology concepts involved in the embodiments of the present application.
[0068] (1) Forwarding table entries
[0069] A forwarding table item refers to a data structure that is searched and matched during the forwarding process of a data message. Some embodiments of the present application relate to a process of compressing and decompressing the content of a forwarding table item. The content of a forwarding table item is the input data of a compression process, and the content of a forwarding table item is also the output data of a decompression process. For example, the content of a forwarding table item is an original data to be compressed. The types of forwarding table items include many situations. For example, in a forwarding scenario of a second layer, the content of a forwarding table item includes a destination media access control (MAC) address and an outgoing interface. For another example, in a forwarding scenario of a third layer, a forwarding table item is, for example, an item in a forwarding information base (FIB), and the content of a forwarding table item includes a destination IP address, a next-hop IP address and an outgoing interface. For another example, a forwarding table item is a forwarding action table, and the forwarding action table is used to store forwarding action information related to routing, such as selecting a forwarding path and a next hop, etc. Exemplarily, a forwarding table item includes but is not limited to at least one of the following.
[0070] Routing engine table (Routbl): The routing engine table is a data structure used to store routing information in network devices. It contains entries that define the data forwarding path and next hop within the network.
[0071] Longest prefix match table. Longest prefix match is a mechanism in routing that determines the match for a given IP address based on the longest matching prefix. In the routing table, it is often used to select the appropriate destination address for network traffic forwarding.
[0072] Next-hop table (nst tbl) is a data structure used in network devices to store next-hop or next router information. It associates the destination IP address with the corresponding next-hop IP address or interface.
[0073] Next-hop port table (nhp tbl): The next-hop port table is a data structure used in network devices to store next-hop port information. It maps the destination IP address to the egress port or interface that it should pass through.
[0074] Next-hop label forwarding entry table (nhlfe tbl): The next-hop label forwarding entry table is a data structure used to store label forwarding information in an MPLS (Multi-Protocol Label Switching) network. It associates the input label with the output label and the next hop information and is used to forward labeled packets.
[0075] Multicast entry label table (MELETBL) is a data structure used to store multicast group members and related label allocation information in multicast routing. In MPLS networks, it is used to support efficient multicast packet forwarding.
[0076] Label entry IPv6 table per-platform (le v6 tblpp): The per-platform IPv6 label entry table is a data structure used in MPLS networks to store label forwarding information specific to IPv6 packets. It maps input labels to output labels and next-hop information for forwarding IPv6 labeled packets.
[0077] IPv4 egress label entry table (label entry IPv4 egress memory, le v4 emem): The IPv4 egress label entry table is a data structure used in MPLS networks to store label forwarding information specific to IPv4 packets. It contains entries that map input labels to output labels and next-hop information, and is used to forward IPv4 labeled packets.
[0078] Ingress action table, an ingress action refers to an action or a set of actions performed on incoming packets at the entry point of a network device. These actions may include packet filtering, routing, Quality of Service (QoS) marking, and other processing tasks.
[0079] Adjacency Information Base Table (AIB TBL) is a data structure used in network devices to store information related to adjacent devices or neighbors in the network. The AIB contains entries that define the relationship between the local interface and the adjacent device.
[0080] In some embodiments of the present application, the content of the forwarding table entry is illustrated using a binary sequence format, for example, 1100100101110001 is used to represent the content of a forwarding table entry. The binary sequence can be obtained by mapping the content in the forwarding table entry using a specific encoding method.
[0081] (2) Microcode decompression instructions
[0082] The microcode decompression instruction refers to a microcode instruction for instructing a decompression operation.
[0083] Microcode is a programmable instruction set used to instruct a specific hardware device (such as a network processor) to perform a specific operation or function, thereby allowing flexible control and configuration of the hardware device. Microcode instructions are also called microinstructions. The "micro" in microcode refers to the small unit or granularity of the operation indicated by the microcode. Specifically, a microcode instruction is the smallest unit of instruction executed by the processor, and each microcode instruction is usually used to perform a simple operation. A computer instruction can be a single microinstruction or it can be composed of several microinstructions.
[0084] Microcode instructions are applicable to processors based on reduced instruction set computers (RISC). For simple operations that are frequently used, RISC processors can execute instructions at a faster speed. For infrequently used operations, RISC processors often complete them by combining instructions. For example, in a network processor, microcode can contain instructions for processing data packets, routing forwarding, and other functions. By writing and loading microcode instructions, the behavior of the network processor can be configured to adapt to different network environments and requirements. Typically, a microcode instruction includes an opcode, an immediate, and operands.
[0085] An opcode is a parameter included in a microcode instruction. An opcode is used to indicate the type or function of a specific operation, such as arithmetic operations, logical operations, data transfers, etc. The opcode tells the processor what operation should be performed when executing a microcode instruction.
[0086] An immediate value is a parameter included in a microcode instruction. An immediate value is used to provide data that is needed immediately during the execution of a microcode instruction. An immediate value can be a constant or an immediate value. For example, an immediate value can be a constant value such as an integer, a floating point number, or a character. An immediate value can also be an address or other value that needs to be used directly. For example, a decompression instruction is put 110, Data. In this decompression instruction, 110 is an immediate value, indicating that the specific value to be spliced is 110.
[0087] An operand is a field in a microcode instruction that specifies the operands or parameters required by the instruction.
[0088] (3) Metadata (MData)
[0089] Metadata is a type of data that describes the characteristics or structure of data. Metadata, for example, contains information about the attributes, structure, format, meaning, source, or quality of the data in the forwarding table. In the scenario of data compression and decompression, the role of metadata is mainly to guide how to decompress the data. Metadata can also be called a compression template. For example, metadata is used to describe the structure of data before compression. Based on metadata, the structure of compressed data can be restored to the structure of the original data. For another example, metadata defines the patterns and rules in the compression algorithm to more effectively compress and represent data.
[0090] The following is an example of an application scenario of the embodiment of the present application.
[0091] The embodiment of the present application can be applied to the scenario where the network device compresses and decompresses the data in the forwarding table. As the network scale becomes larger and larger, the number of forwarding table items required to be used by the network device increases, and the amount of data in the forwarding table items increases. Due to the large amount of data in the forwarding table items, the following problems may occur.
[0092] First, the specifications of the forwarding table items are limited by the available storage resources. The specifications of the forwarding table items are used to indicate how many forwarding table items a network device can store at most, that is, the maximum number of forwarding table items that a network device can store. However, the storage space of a network device is limited, while the amount of data in the forwarding table items is huge, resulting in a low specification of the network device forwarding table items.
[0093] Second, the cache hit rate is low, which affects the forwarding performance of the network device. Specifically, under limited cache capacity, entries with larger data volume will occupy more cache entries, resulting in a reduction in the number of entries that can be stored in the cache. Since cache is a high-speed cache for storing the most commonly used data, when the forwarding table entries cannot be fully stored in the cache, the frequently accessed table entries may not hit the cache, and the network device needs to read the forwarding table entries from a memory whose access speed is slower than the cache, which will result in a slower speed of accessing the forwarding table entries, thereby affecting the forwarding performance of the network device.
[0094] Third, due to the large amount of data in the forwarding table entries, the network device may not be able to accommodate enough forwarding table entries, which in turn causes the network device to be unable to process or forward certain specific messages, limiting the function and performance of the network device.
[0095] In view of this, in some embodiments of the present application, the control plane compresses the data in the forwarding table entry, sends the forwarding table entry after data compression (hereinafter referred to as the compressed table entry) to the forwarding plane, and the forwarding plane saves the compressed table entry. For example, the control plane saves the compressed table entry to the cache of the forwarding plane, and for another example, the control plane saves the compressed table entry to the memory of the forwarding plane. By compressing the data in the forwarding table entry, there are advantages in at least the following three aspects.
[0096] First, improve the specification of the forwarding table item, thereby improve the forwarding performance of the network device. Specifically, because the data in the forwarding table item has been compressed, the data volume of the forwarding table item is reduced, so more items can be stored under the same storage space, thereby improving the item specifications. For example, by compressing the forwarding table item with a data volume of 2n bits, at least the data volume of the forwarding table item can be reduced to n bits, thereby the specification of the forwarding table item can be more than doubled.
[0097] Second, improve the cache hit rate and the number of forwarding table entries that the cache can accommodate, thereby improving the forwarding performance of network devices. For example, when the forwarding table entries are not compressed, the cache stores n entries. After the data in the forwarding table entries is compressed, under the same cache capacity, since the amount of data in the forwarding table entries is reduced by more than half, the cache can store 2n or even 3n entries, thereby significantly improving the number of forwarding table entries that the cache can accommodate. When the cache capacity becomes larger, the cache can store more entries, so the network device can read the entries from the cache without having to read the entries from the slow external memory, thereby increasing the speed of accessing the forwarding table entries, thereby improving the forwarding performance of the network device.
[0098] Third, by reducing the amount of data in the forwarding table, network devices are supported to store more forwarding table entries, thereby supporting network devices to process or forward certain specific messages based on more forwarding table entries, thereby improving the functions and performance of network devices.
[0099] If necessary, the embodiment of the present application may select a method of supporting software and hardware collaboration to perform data compression and decompression. Software is, for example, a program code based on a central processing unit (CPU), and the program code is used to implement the processing logic of the compression algorithm. Hardware refers to hardware that supports message forwarding, such as an interface board, and also a network processor, a forwarding table item memory, and a physical interface card. In a possible implementation, the role of the CPU is equivalent to the producer of compression table items and decompression parameters, and the CPU is responsible for executing the generation of forwarding table items, data compression of forwarding table items, and generating decompression parameters. The role of the network processor is equivalent to the executor of compression table items and decompression parameters, and the compression table items are decompressed according to the decompression parameters issued by the CPU, thereby restoring the form of the compression table items to the forwarding table items. The CPU is connected to the network processor via a bus, a switching network board, or a communication network. For example, the CPU runs the software, and the CPU compresses the data in the forwarding table items using a compression algorithm to obtain compression table items and decompression parameters, and the CPU issues decompression parameters to the network processor. The network processor decompresses the compression table items based on the decompression parameters to obtain the data in the forwarding table items.
[0100] Through the collaboration of software and hardware, there are advantages in at least the following aspects.
[0101] First, since the processing logic of the compression algorithm is relatively complex, and the CPU has more flexible and powerful computing capabilities, it can execute various types of instructions and algorithms. Compared with dedicated hardware such as network processors, the CPU's architecture and design are more universal and can adapt to different computing needs. Therefore, when it comes to complex compression algorithm logic, it is often more advantageous to use the CPU to execute it. Therefore, the CPU is responsible for the data compression of the forwarding table items and the generation of decompression parameters, which helps to reduce the complexity of implementation.
[0102] Second, by having the network processor decompress the compressed table entries, the speed is faster. For example, the network processor can improve the efficiency of decompression through a special instruction set or hardware accelerator. These instructions or hardware accelerators can directly process the compressed table entries without the need for additional instruction parsing and processing like software decompression, thereby being able to perform decompression operations faster. In addition, the network processor can decompress the compressed table entries when it needs to look up the content of the forwarding table entries during the process of forwarding data packets, thereby reducing the delay caused by the decompression step to forwarding.
[0103] Third, high flexibility. Specifically, the data in the forwarding table item may change dynamically. When the data in the forwarding table item changes, the CPU can regenerate the decompression parameters or adjust the historical decompression parameters based on the characteristics of the data in the new forwarding table item, so that the decompression parameters can be flexibly adjusted as the data characteristics in the forwarding table item change, so that the decompression parameters can be dynamically adapted to the new forwarding table item, thereby improving the flexibility of compression and decompression and achieving better compression effect.
[0104] Fourth, since the network processor can perform decompression operations independently, the burden on the CPU is reduced. The CPU can focus on other important tasks, such as processing routing algorithms for the control plane, managing and coordinating network devices, etc. Handing the decompression operation to the network processor can more effectively utilize system resources and improve the performance and efficiency of the overall system.
[0105] If necessary, the embodiment of the present application can selectively support generating a microcode decompression instruction based on metadata of the data in the forwarding table entry; the microcode decompression instruction is sent to the instruction storage unit of the forwarding plane. The forwarding plane decompresses the compressed table entry based on the microcode decompression instruction to obtain the data in the forwarding table entry.
[0106] Metadata (MData) is a type of data that describes the characteristics or structure of data. Metadata, for example, contains information about the attributes, structure, format, meaning, source or quality of the data in the forwarding table. In the scenario of data compression and decompression, the role of metadata is mainly to guide how to decompress the data. Metadata can also be called a compression template. For example, metadata is used to describe the structure of data before compression. Based on metadata, the structure of compressed data can be restored to the structure of the original data. For another example, metadata defines the patterns and rules in the compression algorithm in order to compress and represent data more efficiently.
[0107] In a possible implementation, metadata includes the common features extracted from the data of a group of forwarding table items. For example, metadata includes a repeated substring in the data of a group of forwarding table items. For example, a forwarding table includes three forwarding table items, and the three forwarding table items include the same IP address, which is equivalent to the common features of the three forwarding table items, and the metadata of the three forwarding table items includes the IP address.
[0108] In one possible implementation, metadata includes a literal segment and a wildcard segment. A literal segment is a portion of metadata that represents the original data. A literal segment may contain a fixed value or a fixed pattern, which is used to represent certain values in the compressed data. The purpose of the literal segment is to retain those portions of the original data that have not changed during the compression process. Wildcard segment: A wildcard segment is a portion of metadata that represents a variable value or a variable pattern. A wildcard segment uses a wildcard (such as "*") to represent a variable portion of the compressed data, where * represents matching any binary bit. The purpose of the wildcard segment is to identify portions of the compressed data that may change so that they can be properly restored during the decompression process. Optionally, metadata also includes control bits: Control bits are additional information in metadata that are used to indicate specific operations or behaviors of compression and decompression algorithms. Control bits may include flag bits, length encoding, etc., which are used to control the compression and decompression process of data.
[0109] For example, the data volume of each forwarding table entry in a forwarding table is 16 bits, and the metadata of the forwarding table includes 110**00***1*00**, which describes the data distribution of the forwarding table. The values of the first to third bits in the forwarding table entry are fixed, and the values of the first to third bits are 110; the values of each bit from the fourth to fifth bits may be 1 or 0; the values of the sixth to seventh bits are fixed, and the values of the sixth to seventh bits are 00; the values of each bit from the eighth to tenth bits may be 1 or 0; the value of the eleventh bit is 1, and the value of the twelfth bit may be 1 or 0; the values of the thirteenth to fourteenth bits are 00, and the values of each bit from the fifteenth to sixteenth bits may be 1 or 0.
[0110] In another possible implementation, the metadata includes a decompression order, a decoding rule or a special mark, etc. In yet another possible implementation, the metadata includes a compression algorithm type: for example, LZ77, LZW or DEFLATE, etc. In yet another possible implementation, the metadata includes parameters of the compression algorithm, such as a compression ratio, a window size, a dictionary size, etc. In yet another possible implementation, the metadata includes context information so as to reconstruct a corresponding context environment during the decompression process.
[0111] By converting metadata into microcode decompression instructions, it is equivalent to converting complex decompression algorithms into simple microcode decompression instructions, making the decompression process more controllable and programmable. In this way, the forwarding plane can perform decompression operations based on microcode decompression instructions without relying on the complete decompression algorithm code, thereby improving the decompression speed and saving the overhead of parsing and executing the complete algorithm. At the same time, instructionization also allows the decompression process to be adjusted and optimized as needed to adapt to different scenarios and data characteristics, improving flexibility and scalability.
[0112] The process of converting metadata into microcode decompression instructions can be performed independently by the control plane or collaboratively by the control plane and the forwarding plane.
[0113] In an exemplary embodiment, the CPU generates a microcode decompression instruction based on metadata by running software, and the CPU loads the microcode decompression instruction into an instruction storage unit inside the network processor. The network processor obtains the microcode decompression instruction from the instruction storage unit, executes the microcode decompression instruction to decompress the compression table entry, and obtains the data in the forwarding table entry. Exemplarily, the CPU hard codes the network processor. The CPU is based on the architecture and instruction set specification of the network processor, and generates a microcode decompression instruction compatible with the network processor according to the architecture and instruction set specification of the network processor.
[0114] Since the software converts metadata into microcode decompression instructions, the software acts as a microcode compiler, achieving compression and decompression in a collaborative manner between the software and the microcode, which has advantages in at least the following aspects.
[0115] First, the overhead of the network processor's memory access IO is reduced, and the forwarding speed of the network processor is improved. Specifically, since the CPU writes the microcode decompression instruction to the instruction storage unit inside the network processor, the network processor can decompress based on the microcode decompression instruction, and the network processor does not need to read metadata from the memory outside the network processor, and decompress based on the read metadata, thereby avoiding the I / O operation caused by the network processor reading metadata from the external memory, saving the overhead caused by the network processor accessing the external memory, and since the overhead of memory access IO is saved, the impact of memory access IO on the line speed search capability of the network processor is further avoided, thereby improving the line speed search capability of the network processor. Line speed search capability refers to the ability of a network device or chip to search, match and process at the highest speed when processing data packets. Line speed search can usually be used to measure the performance and processing power of network devices. For example, the line speed search capability of a router is 10 Gigabits per second (Gbps), which means that the router can search and process data packets at a speed of 1 billion bits per second.
[0116] Second, since the instruction storage unit is located inside the network processor, the instruction storage unit is directly and tightly integrated with the network processor, and the access time (or access time) of the instruction storage unit is very short, the network processor can obtain the microcode decompression instruction from the instruction storage unit very quickly. Usually, the network processor can obtain the microcode decompression instruction from the instruction storage unit within one clock cycle (cycle, also called one beat), thereby improving the decompression speed and minimizing the impact of the decompression characteristics on the performance of the network processor.
[0117] Third, it improves flexibility. Specifically, the role of microcode is equivalent to the programmable tool of the network processor. The CPU can dynamically update the microcode decompression instructions stored in the network processor according to the characteristics of the data in the forwarding table, so as to flexibly configure and control the decompression operation of the network processor, so that the decompression operation performed by the network processor is more matched with the characteristics of the data in the forwarding table.
[0118] If necessary, embodiments of the present application may optionally support microcode decompression instructions carrying metadata. For example, the microcode decompression instruction includes an immediate field. The immediate field of the microcode decompression instruction includes metadata. The immediate field of the microcode decompression instruction includes metadata, for example, the immediate field includes the value of the numeric field in the metadata, and another example is that the immediate field includes the bit range corresponding to the wildcard field in the metadata.
[0119] The correspondence between the position of the wildcard segment and the bit range is, for example, the first wildcard corresponds to bit 0 (pointing to the data at bit 0 in the compression table entry), the second wildcard corresponds to bit 0 (pointing to the data at bit 1 in the compression table entry), and so on. The i-th wildcard corresponds to bit (i-1). The number of wildcards contained in a wildcard segment is, for example, the number of bits contained in the bit range (corresponding to the length of a segment of compressed data).
[0120] Since the metadata is embedded in the immediate field of the microcode instruction, the decompression instruction and the metadata are integrated into one, achieving the effect that the instruction is the data and the data is the instruction, or blurring the boundary between the instruction and the data. Therefore, the network processor can use the relevant metadata immediately while executing the microcode decompression instruction, without having to obtain the metadata from other places other than the microcode instruction, thereby reducing the memory access input / output (IO) caused by obtaining metadata from the memory outside the network processor, improving the efficiency of obtaining metadata, and further improving the efficiency of decompression. Memory access IO refers to the operation of exchanging data between the processor and the memory, such as the process of the processor reading data from the memory or the processor writing data to the memory.
[0121] Moreover, the integration of decompression instructions and metadata helps to simplify the design and implementation of the network processor, so that the network processor can perform decompression operations more compactly, reducing the demand for storage space and bus. In addition, by combining decompression instructions and metadata together, the space required for additional storage of decompression metadata can be reduced by sharing storage space, compared with the storage method of decompression instructions and metadata separately, which requires occupying different storage areas. In addition, due to the close integration of decompression instructions and metadata, instruction scheduling and pipeline optimization can be more easily performed, further improving the performance of the network processor.
[0122] The correspondence between metadata and microcode decompression instructions can be one-to-one or one-to-many.
[0123] In a possible implementation, for a metadata including k segments, a microcode decompression instruction sequence is generated based on the metadata. The microcode decompression instruction sequence includes k microcode decompression instructions. Each of the k microcode decompression instructions includes a segment in the metadata, and the arrangement order of the k microcode decompression instructions matches the arrangement order of the k segments in the metadata. The k microcode decompression instructions indicate k operations to be executed in sequence.
[0124] For example, a metadata includes 110**, and the metadata includes 2 segments, the first segment is the numerical segment 11, and the second segment is the wildcard segment **. Based on the metadata, 2 microcode decompression instructions are obtained. The immediate field in the first microcode decompression instruction includes 110, and the immediate field in the second microcode decompression instruction includes CData[0..1]. CData[0..1] represents bits 0 to 1 in the compression table entry.
[0125] By mapping each segment in the metadata to a microcode decompression instruction sequence, the effects achieved include at least the following aspects.
[0126] First, data consistency: By matching each value segment in the metadata with each microcode decompression instruction, the instruction sequence is made consistent with the metadata. In this way, during the decompression process, the instruction sequence is used to process each value segment in sequence, and the original data can be accurately restored.
[0127] Second, simplify the decompression process: Since each segment in the metadata is mapped to the microcode decompression instruction sequence, the decompression process becomes intuitive and direct. The network processor only needs to process each segment in the order of the instruction sequence without additional addressing or calculation operations.
[0128] Third, improve decompression efficiency: By generating a microcode decompression instruction sequence in the order of the segments in the metadata, the decompression efficiency can be improved. Because the order of the instruction sequence matches the order of the metadata, jump or search operations can be avoided, and instructions can be executed directly in order, saving additional overhead in the decompression process.
[0129] Fourth, flexibility and scalability: The method of generating microcode decompression instruction sequences based on metadata is flexible and scalable. When the metadata changes, only the value of the corresponding segment needs to be updated and the instruction sequence needs to be regenerated, which can easily adapt to different data sets and changing requirements.
[0130] The microcode decompression instruction may also include an opcode field. The opcode field of the microcode decompression instruction includes an opcode for the decompression operation. The opcode for the decompression operation indicates the decompression operation. For example, the opcode includes but is not limited to at least one of put, move, concat, append, or copy. The opcode put indicates that the source data is spliced into the target data. The opcode move is used to indicate that the source data is moved to the target data to implement a data splicing or copying operation. The opcode concat indicates that the source data is connected to the target data to implement a data splicing or merging operation. The opcode append indicates that the source data is appended to the end of the target data to implement a data splicing or appending operation. The opcode copy indicates that the source data is copied to the target data to implement a data copying operation.
[0131] In one possible implementation, the microcode decompression instruction is obtained by hard coding for the network processor. For example, the opcode in the microcode decompression instruction is determined based on the architecture of the network processor. For example, the CPU determines the opcode in the microcode decompression instruction based on the correspondence between the architecture of the network processor and the opcode. For example, for a network processor of a first architecture, the opcode in the microcode decompression instruction generated by the CPU includes Put, and for a network processor of a second architecture, the opcode in the microcode decompression instruction generated by the CPU includes Move.
[0132] By introducing the opcode field into the microcode decompression instruction, the effects achieved include at least the following aspects.
[0133] First, flexible handling of different data types: Different opcodes can adapt to different data types and structures. For example, if you need to concatenate or connect multiple data segments, you can use the concat or append opcodes. If you need to move or copy data, you can use the move or copy opcodes. The introduction of opcodes allows decompression to better adapt to various data types and operation requirements.
[0134] Second, improve decompression efficiency: By using appropriate opcodes, the decompression efficiency can be improved. Different opcodes may provide optimized algorithms or mechanisms for different data operations. For example, using the move opcode can directly move data in memory, avoiding additional copy operations, thereby improving the decompression efficiency.
[0135] Third, simplify the decompression instruction design: The introduction of the opcode field can simplify the decompression instruction design. By clearly specifying the opcode, the purpose and function of the decompression instruction can be directly understood, reducing the complexity of interpreting and understanding the instruction. This can reduce the difficulty of instruction design and implementation and improve development efficiency.
[0136] Fourth, according to the characteristics and requirements of different network processor architectures, selecting appropriate opcodes can optimize the performance, power consumption, and resource utilization efficiency of decompression operations. By selecting different opcodes for specific network processors, decompression operations can be more adapted and optimized to the specific network processor architecture.
[0137] In addition, the microcode decompression instruction may further include an operand field. The operand field of the microcode decompression instruction includes an identifier of the decompressed data. For example, the operand field of the microcode decompression instruction includes a name of the decompressed data, such as the operand field includes Data.
[0138] In a possible implementation of generating microcode decompression instructions based on metadata, the control plane converts the metadata into microcode decompression instructions segment by segment. For example, for a metadata including k segments, in response to determining that the i-th segment among the k segments of the metadata is a numerical segment, the control plane uses the i-th segment to fill the immediate field of the i-th microcode decompression instruction; or, in response to determining that the i-th segment among the k segments of the metadata is a wildcard segment, the control plane determines the bit range corresponding to the position of the wildcard segment based on the position of the wildcard segment in the metadata, and the control plane fills the bit range corresponding to the wildcard segment into the immediate field of the microcode decompression instruction.
[0139] For example, a metadata includes 110**. In the process of generating a microcode decompression instruction based on the metadata, for the numerical segment 110 in the metadata, the numerical segment 110 is saved to the immediate field of the microcode decompression instruction, the opcode put of the decompression operation is saved to the opcode field of the microcode decompression instruction, and the name of the decompressed data Data is saved to the operand field of the microcode decompression instruction, and the first microcode decompression instruction is put 110,Data; for the wildcard segment ** in the metadata, it is determined that the wildcard segment ** includes 2 bits, and the wildcard segment ** is the first wildcard and the second wildcard in the metadata, so the bit range corresponding to the first wildcard segment is determined to be [0..1], then the name of the compressed data is CData, so the bit range CData[0..1] corresponding to the compressed data is saved to the immediate field of the microcode decompression instruction, and the microcode decompression instruction corresponding to the first wildcard segment is put CData[0..1],Data.
[0140] If necessary, the embodiment of the present application may also select the CPU and the compiler of the network processor to collaborate to generate microcode decompression instructions. For example, the CPU obtains the decompression code corresponding to the metadata based on the metadata, and the decompression code is in the form of microcode, for example. The CPU sends the decompression code to the network processor. The network processor compiles the decompression code through the compiler to obtain the microcode decompression instructions in the form of machine code. By collaboratively generating microcode decompression instructions through the compiler, different decompression logics and requirements can be flexibly adapted. For example, the compiler can generate matching microcode instructions based on a specific decompression algorithm and logic to meet non-single and irregular decompression requirements, which is suitable for scenarios with complex decompression logic (such as including multiple different types of operations).
[0141] If necessary, the embodiment of the present application can choose to support the update of the immediate value in the old microcode decompression instruction based on the new metadata when the metadata changes, so that the immediate value in the new microcode decompression instruction matches the new metadata. Specifically, considering that the data in the forwarding table item may change, the metadata of the data also changes. For example, in an exemplary scenario, due to changes in network topology, routing protocols, policies or link status, the data in the forwarding table changes, which in turn causes the common features in different forwarding table items to change, causing the metadata to change. Based on this, by updating the immediate value in the microcode decompression instruction, it is possible to simplify the process of updating the microcode decompression instruction as much as possible while being able to flexibly adapt to the metadata changes during the decompression process, and reduce the overhead of updating the microcode decompression instruction.
[0142] In order to distinguish between the description of the old metadata and the new metadata, "first metadata" and "second metadata" are used to describe the old metadata and the new metadata respectively; in order to distinguish between the description of the old microcode decompression instructions and the new microcode decompression instructions, "first microcode decompression instructions" and "second microcode decompression instructions" are used to describe the old microcode decompression instructions and the new microcode decompression instructions respectively; in order to distinguish between the description of the old forwarding table and the new forwarding table, "first forwarding table" and "second forwarding table" are used to describe the old forwarding table and the new forwarding table respectively.
[0143] In a possible implementation, in response to determining that the first forwarding table is updated to the second forwarding table, the control plane obtains the second metadata based on the second forwarding table; the control plane compares the second metadata with the first metadata; in response to determining that the i-th segment in the second metadata is different from the i-th segment in the first metadata, the control plane updates the immediate segment of the i-th microcode decompression instruction in the first microcode decompression instruction stored by the forwarding plane based on the i-th segment in the second metadata, so that the first microcode decompression instruction stored by the forwarding plane is updated to the second microcode decompression instruction. The i-th segment in the second metadata of the i-th microcode decompression instruction in the second microcode decompression instruction matches. Where i is a positive integer greater than or equal to 1 and less than or equal to the total number of metadata segments.
[0144] By updating the microcode decompression instruction in a manner of updating the immediate value in a specific instruction, the effects achieved include at least the following aspects.
[0145] First, flexibly adapt to scenarios where data in the forwarding table entries changes.
[0146] By updating the microcode decompression instructions, we can adapt to different data situations according to the changes in metadata, so that the updated microcode decompression instructions match the new metadata, thereby helping the decompression operation to match the latest data structure, reducing the probability of decompression failure due to metadata changes, and improving the accuracy and reliability of decompression.
[0147] In particular, in the scenario where network devices are processing forwarding services, considering that network topology and routing information may change frequently, by updating the microcode decompression instructions, it is possible to adapt to the dynamic network environment in a timely manner. For example, when the forwarding strategy changes and the forwarding table changes, by updating the instructions, the decompression operation matches the latest forwarding strategy, which helps the network device to correctly process the new data flow based on the decompressed forwarding table entries.
[0148] Second, reduce the overhead of updating microcode decompression instructions.
[0149] Compared to redesigning the entire decompression algorithm or adding / deleting instructions, updating the value of the immediate field is much simpler, and there is no need to re-allocate storage space for new microcode decompression instructions. Therefore, the processing overhead and operation complexity are relatively small, thereby increasing the speed of updating decompression instructions, saving time and resources, and improving the efficiency of updates.
[0150] In the case where the i-th segment that has changed in the metadata is a numerical segment, in one possible implementation, the control plane uses the i-th segment in the second metadata to update the immediate field of the i-th microcode decompression instruction in the first microcode decompression instruction saved by the forwarding plane, so that the immediate field of the i-th microcode decompression instruction in the second microcode decompression instruction saved by the forwarding plane includes the i-th segment in the second metadata.
[0151] Exemplarily, the first metadata is 110**00, the second metadata is 110**10, the control plane compares the second metadata 110**10 with the first metadata 110**00; in response to determining that the third segment 10 in the second metadata is different from the third segment 00 in the first metadata, the immediate field in the third microcode decompression instruction put 00, Data in the first microcode decompression instruction is updated based on the third segment 10 in the second metadata to obtain the second microcode decompression instruction. The third segment 10 in the second metadata of the i-th microcode decompression instruction put 10, Data in the second microcode decompression instruction matches.
[0152] The above description uses the case where a numerical segment in the metadata changes as an example. In the case where multiple numerical segments in the metadata change at the same time, in one possible implementation, for example, the first numerical segment in the second metadata is different from the first numerical segment in the first metadata, and the second numerical segment in the second metadata is different from the second numerical segment in the first metadata, the control plane updates the microcode decompression instruction corresponding to the first numerical segment based on the first numerical segment in the second metadata, and updates the microcode decompression instruction corresponding to the second numerical segment based on the second numerical segment in the second metadata. Similarly, in scenarios where there are more than two numerical segments in the metadata that change, a similar process is used to update the microcode decompression instruction for each changed numerical segment of the metadata.
[0153] In the case where the i-th segment that has changed in the metadata is a wildcard segment, in one possible implementation, the control plane obtains the corresponding bit range based on the i-th segment in the second metadata, and the control plane updates the immediate field of the i-th microcode decompression instruction in the first microcode decompression instruction saved by the forwarding plane based on the obtained bit range, and the immediate field of the i-th microcode decompression instruction in the obtained second microcode decompression instruction includes the bit range corresponding to the i-th segment in the second metadata.
[0154] Exemplarily, the first metadata is 110**, the second metadata is 110***, and the control plane compares the second metadata 110*** with the first metadata 110**; in response to determining that the second segment *** in the second metadata is different from the second segment ** in the first metadata, the corresponding bit range obtained based on the second segment *** in the second metadata is [0..2], and the CData[0..1] in the immediate field of the second microcode decompression instruction put CData[0..1],Data in the first microcode decompression instruction is updated based on the bit range [0..2], so that the second microcode decompression instruction in the obtained second microcode decompression instruction is put CData[0..2],Data.
[0155] The above description uses the case where a wildcard segment in the metadata changes as an example. In the case where multiple wildcard segments in the metadata change at the same time, in one possible implementation, for example, the first wildcard segment in the second metadata is different from the first wildcard segment in the first metadata, and the second wildcard segment in the second metadata is different from the second wildcard segment in the first metadata, the control plane updates the microcode decompression instruction corresponding to the first wildcard segment based on the first wildcard segment in the second metadata, and updates the microcode decompression instruction corresponding to the second wildcard segment based on the second wildcard segment in the second metadata. Similarly, in the scenario where there are more than two wildcard segments in the metadata that change, a similar process is used to update the microcode decompression instruction for each wildcard segment of the metadata that changes.
[0156] The two methods of updating the microcode decompression instruction for the changed numerical segment and updating the microcode decompression instruction for the changed wildcard segment can be implemented independently or in combination. For the combined implementation method, for example, the first numerical segment in the second metadata is different from the first numerical segment in the first metadata, and the first wildcard segment in the second metadata is different from the first wildcard segment in the first metadata. The control plane updates the immediate field of the microcode decompression instruction corresponding to the first numerical segment stored in the forwarding plane based on the first numerical segment in the second metadata, and updates the immediate field of the microcode decompression instruction corresponding to the first wildcard segment stored in the forwarding plane based on the first wildcard segment in the second metadata. In this way, it adapts to the situation where the numerical segment and the wildcard segment change at the same time, and improves the accuracy and reliability of the decompression operation.
[0157] Exemplarily, the first metadata is 1101*, and the second metadata is 110**. The control plane compares the first segment 110 in the second metadata with the first segment 1101 in the first metadata, and determines that the first segment in the second metadata is different from the first segment in the first metadata. Then, based on the first segment 110 in the second metadata, the value of the immediate field of the first microcode decompression instruction is updated from 1101 to 110. The control plane compares the second segment ** in the second metadata with the second segment * in the first metadata, and determines that the second segment in the second metadata is different from the second segment in the first metadata. Then, based on the bit range [0..1] corresponding to the second segment ** in the second metadata, the value of the immediate field of the second microcode decompression instruction is updated from CData[0..0] to CData[0..1].
[0158] The above method of updating the immediate value in the old microcode decompression instruction may have special advantages when the new and old metadata structures remain consistent. For example, the structure of the above second metadata is the same as the structure of the above first metadata. In one possible implementation, the control plane obtains multiple candidate metadata based on the second forwarding table, and each candidate metadata includes common data in a group of forwarding table items in the second forwarding table. For example, different candidate metadata are extracted from the data of this group of forwarding table items based on different compression algorithms or different compression strategies. The control plane compares whether the number of segments of each candidate metadata in the multiple candidate metadata is the same as the number of segments of the first metadata, and determines the candidate metadata with the same number of segments as the first metadata from the multiple candidate metadata as the second metadata.
[0159] Since the structure of the newly generated metadata (second metadata) is consistent with the structure of the old metadata (first metadata), the method of updating the immediate value in the old microcode decompression instruction based on the new metadata achieves at least the following effects.
[0160] First, it reduces the risk of an increase in the number of microcode instructions. Specifically, since the generated new metadata structure is consistent with the old metadata structure, it indicates that the number of microcode decompression instructions corresponding to the new metadata and the old metadata is the same, but the specific values or positions of wildcards may be different. Therefore, when updating the decompression instructions, after modifying the corresponding microcode decompression instructions based on the new metadata, the same number of microcode instructions can be maintained without increasing or decreasing the number of instructions, thereby reducing the risk of expansion of the storage space occupied by microcode instructions due to an increase in the number of microcode instructions.
[0161] Second, the speed of updating microcode instructions is improved. Since the new metadata structure is consistent with the old one, the update process of the decompression instruction can be simplified. The update process only needs to replace the corresponding part directly into the old decompression instruction according to the changes in the segments in the new metadata, such as the changes in the wildcard or the numerical segment. This can avoid regenerating the entire decompression instruction, thereby achieving fast updates. In addition, since the number of decompression instructions corresponding to the new metadata is the same as the number of decompression instructions corresponding to the old metadata, there is no need to adjust the size of the instruction space, nor to open up a new instruction space, thus avoiding the overhead caused by adjusting or opening up the instruction space, further improving the speed of updating microcode instructions.
[0162] If necessary, the embodiment of the present application may selectively support the control plane to save the location information of the microcode decompression instruction, and locate the microcode decompression instruction to be updated from the instruction storage unit based on the location information of the microcode decompression instruction. The location information of the microcode decompression instruction is used to indicate the location where the microcode decompression instruction is saved in the instruction storage unit. The location information of the microcode decompression instruction includes at least one of an offset or an address.
[0163] The offset of a microcode decompression instruction is the position offset of the address of the microcode decompression instruction relative to the starting address of the instruction storage unit. The offset of a microcode decompression instruction is also the position offset of the address of the microcode decompression instruction relative to the address of the first microcode decompression instruction in the instruction storage unit. For example, if a microcode decompression instruction occupies n bits, the offset of the first microcode decompression instruction is 0, the offset of the second microcode decompression instruction is n, the offset of the third microcode decompression instruction is 3n, and so on. The address of the microcode decompression instruction is used to identify the position of the microcode decompression instruction in the instruction storage unit. The address of the microcode decompression instruction is, for example, a logical address or a physical address. Each microcode instruction can have a unique corresponding address, and the corresponding microcode instruction in the instruction storage unit can be directly accessed by a given address.
[0164] The control plane saves the location information of the microcode decompression instruction so that when the metadata changes, it can accurately locate the specific microcode decompression instruction to be updated based on the location information of the decompression instruction and update the microcode decompression instruction, thereby reducing the operational complexity of updating the microcode decompression instruction.
[0165] If necessary, the embodiments of the present application may optionally support regeneration of microcode decompression instructions based on new metadata when the metadata changes, so that the new microcode decompression instructions match the new metadata, thereby being able to flexibly adapt to changes in metadata while adapting to changes in the metadata structure during the decompression process.
[0166] For example, in response to determining that the first forwarding table is updated to the second forwarding table, the control plane obtains the second metadata based on the second forwarding table; the control plane generates the second microcode decompression instruction based on the second metadata, and the control plane updates the first microcode decompression instruction saved by the forwarding plane to the second microcode decompression instruction. Please refer to the above description for the process of generating the second microcode decompression instruction based on the second metadata.
[0167] By updating the microcode decompression instructions by regenerating the microcode decompression instructions, the effects achieved include at least the following aspects.
[0168] First, it has wider applicability. Since the microcode decompression instructions are regenerated based on the new metadata, the process of updating the microcode decompression instructions basically does not depend on the old metadata and the old microcode decompression instructions. It is not necessary to require the new metadata to be consistent with the old metadata structure. Therefore, it is applicable to a wider range of scenarios, and it also reduces the constraints of the metadata structure on the compression algorithm to a certain extent, and improves flexibility.
[0169] In particular, considering that the data changes of the forwarding table items are uncertain in some business scenarios, this may cause the structure of the metadata corresponding to the forwarding table items to change after the data in the forwarding table items are changed. Updating the microcode decompression instructions by regenerating the microcode decompression instructions will help match the needs of more business scenarios.
[0170] Second, the structure of the microcode decompression instruction can be optimized according to the latest metadata structure, so as to better adapt to the characteristics of the new data and improve the compression rate. For example, in the process of obtaining new metadata (second data), by identifying and utilizing the repetitive, redundant or compressible patterns in the data in the transfer table items, the compression algorithm can be used to represent these redundant information in a more compact form to obtain the second metadata, thereby achieving a higher compression rate. In addition, allowing more wildcard segments in the new metadata can match more data to the same metadata, which increases the flexibility of the compression algorithm and enables it to better adapt to the characteristics of different data, thereby achieving a higher compression rate.
[0171] Third, the probability of successful instruction update is improved. By generating new corresponding decompression instructions based on the new metadata, the new decompression instructions match the new metadata structure, avoiding the risk of failure to update successfully due to mismatch between the metadata structure and the decompression instructions, and by mapping each segment of the new metadata to the immediate field in the corresponding decompression instruction, the probability of successful instruction update is improved.
[0172] If necessary, the embodiments of the present application may choose to support whether the structure of the metadata has changed, and choose between two instruction update methods (updating the immediate value in the old microcode decompression instruction and regenerating the microcode decompression instruction). For example, in response to determining that the first forwarding table is updated to the second forwarding table, the control plane obtains the second metadata based on the second forwarding table; the control plane compares the second metadata with the first metadata; in response to determining that the structure of the second metadata is the same as the structure of the first metadata, the control plane adopts a method of updating the immediate value in the old microcode decompression instruction, such as updating the immediate value field of the first microcode decompression instruction saved by the forwarding plane based on the second metadata. In response to determining that the structure of the second metadata is different from the structure of the first metadata, the control plane adopts a method of regenerating the microcode decompression instruction, such as generating a second microcode decompression instruction based on the second metadata, and the control plane updates the first microcode decompression instruction saved by the forwarding plane to the second microcode decompression instruction.
[0173] In one possible implementation, whether the structure of the metadata is the same is determined based on the number of microcode decompression instructions corresponding to the metadata. The number of microcode decompression instructions corresponding to the metadata is determined, for example, based on the number of segments of the metadata. For example, the control plane obtains the number of segments of the second metadata and the number of segments of the first metadata, and compares the number of segments of the second metadata with the number of segments of the first metadata; in response to determining that the number of segments of the second metadata is the same as the number of segments of the first metadata, the control plane adopts a method of updating the immediate number in the old microcode decompression instruction, and in response to determining that the number of segments of the second metadata is different from the number of segments of the first metadata, the control plane adopts a method of regenerating the microcode decompression instruction.
[0174] For example, the first metadata is 11*0**10, the second metadata is 101**1*1, the number of segments of the first metadata is 5, and the 5 segments in the first metadata are "11", "*", "0", "**", and "10", respectively; the number of segments of the second metadata is 5, and the 5 segments in the second metadata are "101", "**", "1", "*", and "1", respectively. Since the number of segments of the first metadata and the second metadata are both 5, it can be determined that the number of microcode decompression instructions corresponding to the first metadata and the number of microcode decompression instructions corresponding to the second metadata are both 5. Therefore, the second metadata of 101**1*1 is used to update the immediate value in the old microcode decompression instruction.
[0175] If necessary, the embodiment of the present application may choose to support, in the case of metadata changes, in the two instruction update methods, giving priority to the method of updating the immediate value in the old microcode decompression instruction, and secondly choosing the method of regenerating the microcode decompression instruction, so as to flexibly adapt to metadata changes in different situations. In one possible implementation, in response to determining that the first forwarding table is updated to the second forwarding table, the control plane obtains multiple candidate metadata based on the second forwarding table. The control plane compares whether the number of segments of each candidate metadata in the multiple candidate metadata is the same as the number of segments of the first metadata. In response to determining that the number of segments of the second metadata in the multiple candidate metadata is the same as the number of segments of the first metadata, the immediate value in the first microcode decompression instruction is modified based on the second metadata. In response to determining that the number of segments of each candidate metadata in the multiple candidate metadata is different from the number of segments of the first metadata, a second microcode decompression instruction is generated based on the second metadata selected from the multiple candidate metadata. In this way, when new metadata with a structure consistent with the old metadata can be obtained or when new metadata with a structure consistent with the old metadata cannot be obtained, a suitable instruction update method can be selected according to the specific situation, thereby improving adaptability and scalability, and to a certain extent taking into account the advantage of lower overhead in the method of updating the immediate values in the old microcode decompression instructions and the advantage of wider applicability in the method of regenerating microcode decompression instructions.
[0176] If necessary, the embodiment of the present application can optionally support the control plane to send metadata to the forwarding plane. For example, the control plane saves the compressed table items and metadata to the memory of the forwarding plane. The network processor of the forwarding plane obtains the metadata and the compressed table items from the memory, and decompresses the compressed table items based on the metadata. In this way, since the data in the forwarding table items has been compressed, the table item specifications can be effectively improved.
[0177] In a possible implementation, the compression table entry includes a metadata identifier (such as a name or address of the metadata). The network processor reads the metadata from the memory according to the metadata identifier; the network processor decompresses the compression table entry according to the value segment and the wildcard segment included in the metadata.
[0178] If necessary, the embodiment of the present application may selectively support enabling data compression when the number of forwarding table entries stored in the forwarding plane reaches a threshold.
[0179] In a possible implementation, in response to determining that the ratio between the number of forwarding table items stored on the forwarding plane and the forwarding table item specifications of the forwarding plane has reached a ratio threshold, or the number of forwarding table items stored on the forwarding plane has reached a quantity threshold, the control plane enables data compression, compresses the subsequently obtained forwarding table items, sends the compressed table items to the forwarding plane, and sends metadata or microcode decompression instructions to the forwarding plane. Alternatively, in response to determining that the ratio between the number of forwarding table items stored on the forwarding plane and the forwarding table item specifications of the forwarding plane has not reached a ratio threshold, or the number of forwarding table items stored on the forwarding plane has not reached a quantity threshold, the control plane cancels compression of the subsequently obtained forwarding table items, and the control plane sends the original forwarding table items to the forwarding plane.
[0180] When the number of forwarding table entries stored on the forwarding plane reaches a threshold, data compression is enabled, and the effects achieved include at least the following aspects.
[0181] First, in scenarios where the number of forwarding table entries is small, the control plane does not need to compress the forwarding table entries, and the forwarding plane does not need to
[0182] Decompress the compressed table entries, thereby reducing the impact of compression and decompression on the system and saving the performance overhead and forwarding delay caused by decompression on the forwarding plane.
[0183] Second, improve the accuracy of metadata and reduce the computational complexity of metadata. For example, when the number of forwarding table items reaches a certain threshold, metadata is determined for a larger number of forwarding table items, so that the metadata can better represent the characteristics of the entire forwarding table, facilitate more accurate capture of patterns and regularities in the data, and reduce errors caused by metadata deviation or insufficient representation of the characteristics of the entire forwarding table due to determining metadata for too few forwarding table items.
[0184] Regarding the method for determining the number of forwarding table entries stored in the forwarding plane, in one possible implementation, the control plane records the number of forwarding table entries that have been sent to the forwarding plane. For example, the control plane maintains a counter, and each time the control plane sends an entry to the forwarding plane, the counter is incremented by one, thereby determining the number of forwarding table entries that have been sent to the forwarding plane by the result of the counter counting. In another possible implementation, the control plane monitors the number of entries that have been stored in the forwarding plane periodically or in real time. For example, the control plane periodically accesses the forwarding plane storage unit or the forwarding plane periodically reports the number of saved entries to the control plane.
[0185] The CPU sends the microcode decompression instruction to the network processor in a manner including but not limited to dynamic instruction loading or microcode patching.
[0186] Dynamic instruction loading is a mechanism that loads new instructions or program code from external memory (such as main memory, solid-state drive, etc.) into the processor's instruction cache or instruction register. This method allows the processor's instruction set to be dynamically updated during program execution to adjust and expand the processor's behavior. Dynamic instruction loading is usually triggered by specific instruction operations or system calls, and different instructions can be loaded as needed at runtime. Through dynamic instruction loading, new instructions can be added to the microcode without stopping the machine.
[0187] Microcode patching is a mechanism used to fix or optimize the behavior of a processor at runtime. With microcode patching, microcode instructions can be modified and sent to the microcode memory of the processor without changing the processor hardware structure. Microcode patches are usually provided by processor manufacturers to fix errors, vulnerabilities, or performance issues in the processor. Microcode patch updates can be performed through firmware updates or dedicated microcode patch tools.
[0188] Regarding the method of compressing the forwarding table entries, if necessary, the embodiment of the present application may selectively support compressing the data in the forwarding table entries based on the common data and difference data in different forwarding table entries.
[0189] For example, in a possible implementation, the control plane extracts public data from the forwarding table item set according to the data distribution of the forwarding table item set as metadata of each forwarding table item in the forwarding table item set; for each forwarding table item in the forwarding table item set, the remaining data other than the public data in the data in the forwarding table item (equivalent to the difference data between the data in the forwarding table item and the metadata) is extracted from the forwarding table item as a compressed table item. In the decompression stage, the compressed table item can be decompressed by splicing the compressed table item with the metadata, thereby restoring the original forwarding table item. Optionally, the identifier of the metadata is also saved to the compressed table item.
[0190] The data distribution of the forwarding table item set refers to the overall distribution of the data of each forwarding table item in the forwarding table item set, such as the distribution of each field value in the forwarding table item. Since the forwarding table items are usually generated based on the local configuration information of the network device, there is usually a great similarity in the data distribution of most forwarding table items. The similarity of data distribution refers to that different forwarding table items have repeated or similar parts in structure and content. For example, a plurality of forwarding table items may have the same destination IP address segment or the same next hop address. The similarity of data distribution makes it possible to effectively reduce the data volume of the forwarding table items when the forwarding table items are compressed, thereby achieving a higher compression ratio, thereby enabling the network device to provide a larger storage density, that is, more forwarding table items can be stored in a given storage space.
[0191] The compression ratio refers to the ratio between the size of the compressed data and the size of the original data after the data is processed by the compression algorithm. The compression ratio is usually expressed as a percentage or a simplified fraction. For example, the compression ratio can be calculated as: compression ratio = (compressed data size / original data size) * 100%. For example, if the original data size is 100MB, and after the compression algorithm is processed, the compressed data size is 50MB, then the compression ratio is 50%. The higher the compression ratio, the more effective the compression algorithm is in reducing the size of the data, thereby storing more data in the same storage space.
[0192] The following is an example of the operating environment of the embodiment of the present application.
[0193] The operating environment of the embodiment of the present application may be located in the attached Figure 1 , Attachment Figure 2 Or attach Figure 3 The transfer table entry data is shown within the compression device.
[0194] As attached Figure 1 As shown, the forwarding entry data compression device 500 includes a compression unit 510, a decompression unit 521, a compression entry storage unit 522, and a decompression parameter storage unit 524. Optionally, the device 500 further includes an entry generation unit 512 and a forwarding service processing unit 526.
[0195] The entry generation unit 512 is used to generate a forwarding table entry and input the data in the forwarding table entry to the compression unit 510 .
[0196] The compression unit 510 is used to compress the data in the transfer table entry to obtain the compression table entry and the decompression parameter. The compression unit 510 is also used to save the compression table entry to the compression table entry storage unit 522 and save the decompression parameter to the decompression parameter storage unit 524.
[0197] Decompression parameters refer to parameters used in the data decompression process to guide and control the decompression operation. The decompression parameters optionally include at least one of the microcode decompression instructions or metadata. Alternatively, the decompression parameters include a compression algorithm identifier, a dictionary size, or a compression level.
[0198] The forwarding service processing unit 526 is used to send a read request to the compression table entry storage unit 522 in response to the received data message, where the read request includes the address of the compression table entry in the compression table entry storage unit 522 .
[0199] The compression table entry storage unit 522 is used to respond to a read request, read the compression table entry based on the address of the compression table entry in the compression table entry storage unit 522, and send the compression table entry to the decompression unit 521.
[0200] The decompression unit 521 is used to obtain decompression parameters from the decompression parameter storage unit 524, obtain compression table items from the decompression unit 521, decompress the compression table items based on the decompression parameters, obtain data in the forwarding table items, and send the data in the forwarding table items to the forwarding service processing unit 526.
[0201] The forwarding service processing unit 526 is further configured to forward the data message based on the data in the forwarding table entry obtained from the decompression unit 521 .
[0202] Logically, the device 500 includes a control plane component and a forwarding plane component. Optionally, the compression unit 510 and the entry generation unit 512 are provided in the control plane component, and the decompression unit 521, the compressed data storage unit 522, the decompression parameter storage unit 524 and the forwarding service processing unit 526 are provided in the forwarding plane component.
[0203] Figure 2 is a schematic diagram of the structure of another transfer table data compression device provided in an embodiment of the present application, Figure 2 The device shown is Figure 1 A lower level example of the device shown.
[0204] Figure 2 The device shown includes an instruction storage unit 524a, which is Figure 1 The illustrated apparatus is a lower level example of a decompressed parameter storage unit 524. The instruction storage unit 524a is used to provide a microcode instruction space.
[0205] exist Figure 2 In the device shown, the compression unit 510 is specifically used to compress the data in the transfer table entry to obtain the compression table entry and the microcode decompression instruction. The compression unit 510 is also used to save the compression table entry to the compression table entry storage unit 522 and save the microcode decompression instruction to the instruction storage unit 524a.
[0206] The decompression unit 521 is specifically used to obtain the microcode decompression instruction from the instruction storage unit 524a, obtain the compression table entry from the decompression unit 521, execute the microcode decompression instruction to decompress the compression table entry, and obtain the data in the transfer table entry.
[0207] Figure 3 is a structural diagram of another transfer table data compression device provided in an embodiment of the present application, Figure 3 The device shown is Figure 1 Another lower example of the device shown. Figure 2 The device shown and Figure 3 The device shown is equivalent to Figure 1 Two logically parallel implementations of the device shown.
[0208] Figure 3 The device shown includes a metadata storage unit 524b, which is Figure 1 A lower level example of a decompression parameter storage unit 524 in the illustrated apparatus.
[0209] exist Figure 3 In the device shown, the compression unit 510 is specifically used to compress the data in the transfer table entry to obtain the compressed table entry and metadata. The compression unit 510 is also used to save the compressed table entry to the compression table entry storage unit 522 and save the metadata to the metadata storage unit 524b.
[0210] The decompression unit 521 is specifically used to obtain metadata from the metadata storage unit 524b, obtain the compression table item from the decompression unit 521, decompress the compression table item based on the metadata, and obtain the data in the transfer table item.
[0211] Figure 1 , Figure 2 or Figure 3 The device embodiments described are merely illustrative. For example, the division of the above units is only a logical functional division. There may be other division methods in actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The functional units in the various embodiments of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0212] Figure 1 , Figure 2 or Figure 3 Each unit in the shown device may be implemented by software or hardware.
[0213] For example, the following takes the compression unit 510 as an example to introduce the implementation of the compression unit 510. Similarly, the implementation of the decompression unit 521, the entry generation unit 512 and the forwarding service processing unit 526 can refer to the implementation of the compression unit 510.
[0214] The compression unit 510 is an example of software, and the compression unit 510 includes, for example, program codes running on one or more processors.
[0215] The processor is, for example, a general-purpose central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), a neural-network processing units (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the scheme of the present application. For example, the processor includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The processor is, for example, a single-core processor (single-CPU) or a multi-core processor (multi-CPU).
[0216] Optionally, the processor includes a compression accelerator. A compression accelerator is a piece of hardware specifically used to accelerate data compression operations. A hardware accelerator is, for example, a processing chip with computing capabilities. The specific forms of a hardware accelerator include many situations. Exemplarily, a hardware accelerator is an acceleration card or a coprocessor or a graphics processing unit (GPU) or a neural-network processing unit (NPU), etc. One or more hardware accelerators are configured. The hardware accelerator and the CPU are optionally processors with the same physical form, or the hardware accelerator and the CPU are optionally processors with different physical forms.
[0217] In some embodiments, the compression accelerator is used to assist the CPU in compressing the data in the forwarding table entry to reduce the computational burden of the CPU. For example, the CPU determines metadata based on the data distribution of the forwarding table entry; the CPU sends the metadata to the compression accelerator, and the compression accelerator compresses the data in the forwarding table entry according to the metadata.
[0218] The compression accelerator is an optional hardware. In some embodiments, the processor does not include the compression accelerator but includes a CPU. In this case, the CPU independently performs data compression. When the processor includes both the CPU and the compression accelerator, the CPU and the compression accelerator can optionally work together to complete data compression.
[0219] As an example of hardware, the compression unit 510 includes one or more processors. Alternatively, the compression unit 510 includes a portion of processing resources of one or more processors (eg, one core or two cores of a multi-core processor).
[0220] In another possible implementation, the compression unit 510 includes one or more main control boards. The main control board is also called a main processing unit (MPU) or a route processor card, and is used to control and manage various components in the network device, including route calculation, device management, device maintenance, and protocol processing functions.
[0221] In another possible implementation, the compression unit 510 includes one or more service processing units (SPUs). A service processing unit, also known as a value-added service processing unit, is a pluggable module used to expand and provide specific service functions. A service processing unit is usually used in conjunction with a main control unit to add additional functions and services to a network device.
[0222] In another possible implementation, the compression unit 510 includes one or more interface boards. The interface board is also called a line processing unit (LPU) or a line card. The interface board is used to provide various service interfaces and implement the forwarding of data packets. The service interface includes but is not limited to an Ethernet interface, a POS (packet over SDH / SONET) interface, etc., and the Ethernet interface is, for example, a flexible Ethernet service interface (FlexE clients).
[0223] In another possible implementation, the compression unit 510 may include at least one network device, such as a switch, a router, a firewall, or a server.
[0224] Exemplarily, the following takes the decompression parameter storage unit 524 as an example to introduce the implementation of the decompression parameter storage unit 524. Similarly, the implementation of the compression table entry storage unit 522, the instruction storage unit 524a and the metadata storage unit 524b can refer to the implementation of the decompression parameter storage unit 524.
[0225] The decompression parameter storage unit 524 is an example of hardware, and the decompression parameter storage unit 524 may include one or more memories.
[0226] The memory may be, for example, a read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, a random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and capable of being accessed by a computer, but not limited thereto. The RAM may be a dynamic random access memory (DRAM), a storage class memory (SCM), or a static random access memory (SRAM).
[0227] Optionally, the memory is located inside the processor, and the memory and the processor are integrated together. For example, the memory is a register, a cache, a constant memory, a microcode memory, or a control memory. Registers are the fastest and smallest memory units located inside the processor. They are used to store and operate data and instructions in the processor. Cache is a high-speed memory located inside the processor, which is used to temporarily store data read from the main memory. The cache can provide faster access speed to reduce the access delay to the main memory. The cache can include an instruction cache and a data cache. The instruction cache is used to store instructions executed by the processor. It can reduce the acquisition time of instructions and improve the execution efficiency of instructions. The data cache is a cache used to store data during the execution of the processor. It can reduce the number of accesses to the main memory and improve the reading and writing speed of data. Constant memory is a memory unit specifically used to store constant data. It is usually used to store constant values in programs, such as constant strings, constant arrays, etc. Constant memory can provide fast access speed to support efficient processing of constant data. Microcode memory is a memory used to store microcode programs. Microcode memory is usually located inside the CPU or other processors and is used to store microcode instruction sequences to implement the execution and control of low-level instructions. Control memory is a memory used to store control signals and instructions. It is usually used to store instruction opcodes, addresses, and other control-related information. The contents of control memory are used by the CPU or other control units to control the operation and coordination of various components in the computer system.
[0228] Optionally, the memory exists independently and is connected to the processor through an internal connection (such as a bus or a switching network board) or a communication network. For example, the memory is one or more hard disks or hard disk arrays. The hard disk is, for example, a mechanical hard disk (HDD) or a solid state drive (SSD). For another example, the memory is a storage server or a cloud storage system.
[0229] Optionally, the storage is a memory. The memory is also called internal memory or main memory, which refers to the internal memory that directly exchanges data with the processor (such as CPU). The memory can read and write data at any time and at a high speed, and serves as a temporary data storage for the operating system or other running programs. The memory may include multiple memories, for example, the memory can be either RAM or ROM. For example, the memory is a double data rate (Double Data Rate, DDR). DDR memory is a high-speed, synchronous dynamic random access memory (DRAM). DDR memory transmits data at the rising and falling edges of the clock, so that the DDR memory can transmit two data bits in each clock cycle, thereby achieving a double data rate (the origin of the name DDR) and providing higher data transmission efficiency.
[0230] In a possible implementation, the instruction storage unit 524a includes the above-mentioned memory located inside the processor and integrated with the processor. In other words, the microcode instruction space is provided by the processor.
[0231] For example, the instruction storage unit 524a is a microcode memory. Since the instruction storage unit 524a is integrated inside the processor, the processor can read the microcode decompression instruction from the microcode instruction space 524a in one clock cycle, thereby increasing the speed of reading and executing the microcode decompression instruction, thereby increasing the decompression speed.
[0232] In a possible implementation, the compression table entry storage unit 522 includes at least one item in a cache or a memory. For example, the compression table entries whose processor access frequency is higher than a threshold are stored in the cache, and the forwarding table entries whose processor access frequency is lower than a threshold are stored in the memory. Since the cache is located inside the processor, data access latency is low, and faster forwarding table entry lookup can be achieved by storing the compression table entries with high frequency access in the cache. Since the memory usually has a larger capacity, more compression table entries can be stored.
[0233] The implementation of the metadata storage unit 524 b may refer to the implementation of the instruction storage unit 524 a or the compression table entry storage unit 522 .
[0234] The operating environment of the embodiment of the present application may also be located in the attached Figure 4 , Attachment Figure 5 Or attach Figure 6 The network device shown. Figure 1 , Attachment Figure 2 Or attach Figure 3 The device shown can be arranged in the attached Figure 4 , Attachment Figure 5 Or attach Figure 6 The network devices shown.
[0235] Please refer to the attached Figure 4 , attached Figure 4 It is a structural diagram of a network device 600 provided in an embodiment of the present application.
[0236] The network device 600 includes a first processor 601, a second processor 605, a memory 602, a network interface 603, and an internal connection 604. The first processor 601, the second processor 605, the memory 602, and the network interface 603 are connected via the internal connection 604.
[0237] The following is attached Figure 4 The components and accessories in the equipment shown Figure 1 , Attachment Figure 2 Or attach Figure 3 The corresponding relationship between the various units in the device shown is illustrated by way of example.
[0238] The compression unit 510 is provided in the first processor 601. In other words, the first processor 601 is used to implement the function of the compression unit 510. In one possible implementation, the memory 602 stores the program code of the compression algorithm, and the first processor 601 reads the program code of the compression algorithm in the memory 602 and executes the program code of the compression algorithm to implement the function of the compression unit 510. In another possible implementation, the first processor 601 implements the function of the compression unit 510 by executing the program code of the compression algorithm stored internally.
[0239] The decompression parameter storage unit 524 may be provided in the second processor 605 or in the memory 602. In other words, at least one of the second processor 605 or the memory 602 is used to implement the function of the decompression parameter storage unit 524.
[0240] For example, the decompression parameter storage unit 524 is specifically attached Figure 2 In the case of the instruction storage unit 524a shown in FIG. Figure 2 The instruction storage unit 524a shown in the figure is, for example, provided in the second processor 605. In other words, the second processor 605 is used to implement the function of the instruction storage unit 524a. Figure 4 As shown, the second processor 605 stores microcode decompression instructions.
[0241] For example, the decompression parameter storage unit 524 is specifically attached Figure 3 In the case of the metadata storage unit 524b shown in FIG. Figure 3 The metadata storage unit 524b shown is, for example, disposed in the memory 602. In other words, the memory 602 is used to implement the function of the metadata storage unit 524b. Figure 4 As shown, the memory 602 stores metadata.
[0242] The decompression unit 521 is provided in the second processor 605. In other words, the second processor 605 is used to implement the function of the decompression unit 521. In one possible implementation, the second processor 605 is used to execute the microcode decompression instruction stored internally to implement the function of the decompression unit 521. In another possible implementation, the memory 602 stores the program code of the decompression algorithm, and the second processor 605 executes the program code of the decompression algorithm to implement the function of the decompression unit 521.
[0243] The compression entry storage unit 522 is provided in the memory 602. In other words, the memory 602 is used to implement the function of the compression entry storage unit 522. Figure 4 As shown, the memory 602 stores compression table entries.
[0244] The entry generation unit 512 is optionally provided in the first processor 601. In other words, the first processor 601 is optionally further used to implement the function of the entry generation unit 512. The forwarding service processing unit 526 is optionally provided in the second processor 605. In other words, the second processor 605 is optionally further used to implement the function of the forwarding service processing unit 526.
[0245] The network interface 603 uses a device such as a network interface card or a transceiver to communicate with other devices or communication networks. The network interface 603 includes, for example, at least one of a wired network interface or a wireless network interface. The wired network interface is, for example, an Ethernet interface. The Ethernet interface is, for example, an optical interface, an electrical interface, or a combination thereof. The wireless network interface is, for example, a wireless local area network (WLAN) interface, a cellular network interface, or a combination thereof.
[0246] The internal connection 604 includes a path to transmit information between the first processor 601, the second processor 605, the memory 602 and the network interface 603. Optionally, the internal connection 604 is a single board or a bus. The single board includes, for example, a system backplane or a switching fabric board. Optionally, the bus is a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0247] See attached Figure 5 , attached Figure 5It is a structural diagram of a network device provided in an embodiment of the present application. The network device 700 includes: a main control board 710 and an interface board 730.
[0248] The main control board 710 includes: a central processing unit 711 and a memory 712. The interface board 730 includes: a central processing unit 731, a network processor 732, a forwarding table entry memory 734 and a physical interface card (PIC) 733. The main control board 710 and the interface board 730 are coupled. For example. The main control board 710, the interface board 730 and the interface board 740, and the switching network board 720 are connected to the system backplane through a system bus to achieve intercommunication. In a possible implementation, an inter-process communication protocol (IPC) channel is established between the main control board 710 and the interface board 730, and the main control board 710 and the interface board 730 communicate through the IPC channel. The IPC channel includes a pipe, a message queue, a shared memory or a socket, etc.
[0249] The following is attached Figure 5 The components and accessories in the equipment shown Figure 1 , Attachment Figure 2 Or attach Figure 3 The corresponding relationship between the various units in the device shown is illustrated by way of example.
[0250] In a possible implementation, the compression unit 510 is provided in the main control board 710. In other words, the main control board 710 is used to implement the function of the compression unit 510. Exemplarily, the compression unit 510 is provided in the central processing unit 711 in the main control board 710. In other words, the central processing unit 711 is used to implement the function of the compression unit 510. In a possible implementation, the memory 712 stores the program code of the compression algorithm, and the central processing unit 711 executes the program code of the compression algorithm to implement the function of the compression unit 510. In another possible implementation, the central processing unit 711 implements the function of the compression unit 510 by executing the program code of the compression algorithm stored internally.
[0251] In another possible implementation, the compression unit 510 is disposed in the interface board 730. For example, the compression unit 510 is disposed in the central processor 731 in the interface board 730. In one possible implementation, the forwarding entry memory 734 stores the program code of the compression algorithm, and the central processor 731 executes the program code of the compression algorithm to implement the function of the compression unit 510. In another possible implementation, the central processor 731 implements the function of the compression unit 510 by executing the program code of the compression algorithm stored internally.
[0252] In a possible implementation, the decompression parameter storage unit 524 is provided in the interface board 730, for example, in the network processor 732 in the interface board 730, or in the forwarding table entry memory 734. In other words, at least one of the network processor 732 or the forwarding table entry memory 734 is used to implement the function of the decompression parameter storage unit 524.
[0253] For example, the decompression parameter storage unit 524 is specifically attached Figure 2 In the case of the instruction storage unit 524a shown in FIG. Figure 2 The instruction storage unit 524a shown is, for example, provided in the network processor 732. In other words, the network processor 732 is used to implement the function of the instruction storage unit 524a. Figure 4 As shown, the network processor 732 stores microcode decompression instructions.
[0254] For example, the decompression parameter storage unit 524 is specifically attached Figure 3 In the case of the metadata storage unit 524b shown in FIG. Figure 3 The metadata storage unit 524b shown is, for example, disposed in the forwarding table entry storage 734. In other words, the forwarding table entry storage 734 is used to implement the function of the metadata storage unit 524b. Figure 4 As shown, the forwarding entry storage 734 stores metadata.
[0255] In a possible implementation, the decompression parameter storage unit 524 is disposed in the memory 712 in the main control board 710 .
[0256] In one possible implementation, the decompression unit 521 is provided in the interface board 730. For example, the decompression unit 521 is provided in the network processor 732. In other words, the network processor 732 is used to implement the function of the decompression unit 521. In one possible implementation, the network processor 732 is used to execute the microcode decompression instruction stored internally to implement the function of the decompression unit 521. In another possible implementation, the forwarding table entry memory 734 stores the program code of the decompression algorithm, and the network processor 732 executes the program code of the decompression algorithm to implement the function of the decompression unit 521.
[0257] The compression entry storage unit 522 is provided in the forwarding entry storage unit 734. In other words, the forwarding entry storage unit 734 is used to implement the function of the compression entry storage unit 522. Figure 4 As shown, the forwarding entry memory 734 stores the compression table entries.
[0258] The entry generation unit 512 is optionally provided on the main control board 710, for example, on the central processor 711 on the main control board 710. In other words, the central processor 711 is optionally also used to implement the function of the entry generation unit 512. The forwarding service processing unit 526 is provided on the interface board 730. For example, the forwarding service processing unit 526 is provided on the network processor 732 in the interface board 730. In other words, the network processor 732 is optionally also used to implement the function of the forwarding service processing unit 526.
[0259] The central processing unit 731 is used to control and manage the interface board 730 and communicate with the central processing unit 711 on the main control board 710 .
[0260] The network processor 732 is used to implement the forwarding processing of the message. The form of the network processor 732 is, for example, a forwarding chip. Specifically, the network processor 732 is used to forward the received message based on the forwarding table stored in the forwarding table entry memory 734. If the destination address of the message is the address of the network device 700, the message is sent to the CPU (such as the central processor 711) for processing; if the destination address of the message is not the address of the network device 700, the next hop and the output interface corresponding to the destination address are found from the forwarding table according to the destination address, and the message is forwarded to the output interface corresponding to the destination address. Among them, the processing of the uplink message includes: processing of the message input interface, forwarding table search; processing of the downlink message: forwarding table search, etc.
[0261] The physical interface card 733 is used to implement the docking function of the physical layer, and the original traffic enters the interface board 730 from it, and the processed message is sent from the physical interface card 733. The physical interface card 733 is also called a daughter card, which can be installed on the interface board 730, and is responsible for converting the optical signal into a message and forwarding the message to the network processor 732 for processing after checking the legitimacy of the message. In some embodiments, the central processor can also perform the functions of the network processor 732, such as realizing software forwarding based on a general-purpose CPU, so that the network processor 732 is not required in the physical interface card 733.
[0262] Optionally, the network device 700 includes a plurality of interface boards. For example, the network device 700 further includes an interface board 740 . The interface board 740 includes a central processor 741 , a network processor 742 , a forwarding table entry memory 744 , and a physical interface card 743 .
[0263] Optionally, the network device 700 further includes a switching fabric board 720. The switching fabric board 720 is also referred to as a switch fabric unit (SFU). When the network device has multiple interface boards 730, the switching fabric board 720 is used to complete data exchange between the interface boards. For example, the interface board 730 and the interface board 740 communicate with each other, for example, through the switching fabric board 720.
[0264] Logically, the network device 700 includes a control plane and a forwarding plane. The control plane includes a main control board 710 and a central processor 731. The forwarding plane includes various components for performing forwarding, such as a forwarding table entry memory 734, a physical interface card 733, and a network processor 732. The control plane performs functions such as a router, generating a forwarding table, processing signaling and protocol messages, and configuring and maintaining the status of the device. The control plane sends the generated forwarding table to the forwarding plane. On the forwarding plane, the network processor 732 forwards the message received by the physical interface card 733 based on the forwarding table sent by the control plane. The forwarding table sent by the control plane is, for example, stored in the forwarding table entry memory 734. In some embodiments, the control plane and the forwarding plane are, for example, completely separated and are not on the same device.
[0265] The operations on the interface board 740 are consistent with those on the interface board 730 and will not be described in detail for the sake of brevity.
[0266] There may be one or more main control boards. When there are multiple boards, for example, they include a main main control board and a backup main control board. There may be one or more interface boards. The stronger the data processing capability of the network device, the more interface boards are provided. There may also be one or more physical interface cards on the interface board. There may be no switching network board, or there may be one or more switching network boards. When there are multiple switching network boards, they can jointly realize load sharing and redundant backup. In a centralized forwarding architecture, network devices may not need switching network boards, and the interface boards are responsible for processing the business data of the entire system. In a distributed forwarding architecture, network devices can have at least one switching network board, which realizes data exchange between multiple interface boards and provides large-capacity data exchange and processing capabilities. Therefore, the data access and processing capabilities of network devices with distributed architectures are greater than those of devices with centralized architectures. Optionally, the network device may have only one board, that is, no switching board, and the functions of the interface board and the main control board are integrated on the board. In this case, the central processor on the interface board and the central processor on the main control board can be combined into one central processor on the board to perform the functions of the two. This type of device has low data exchange and processing capabilities (for example, low-end switches or routers and other network devices). The specific architecture to be adopted depends on the specific networking deployment scenario, and no limitation is made here.
[0267] See attached Figure 6 , attached Figure 6 is a schematic diagram of a network system provided in an embodiment of the present application, Figure 6 This is an example of an implementation method of the device when the control plane and the forwarding plane are completely separated and are not on the same device.
[0268] like Figure 8As shown, the network system includes a network device 600A and a network device 600B. The network device 600A and the network device 600B are connected via a communication network 600C. The communication network 600C is, for example, a wide area network, a local area network, or a metropolitan area network. Specifically, the network interface of the network device 600A is connected to the communication network 600C. The network interface of the network device 600B is connected to the communication network 600C.
[0269] With attached Figure 4 The embodiment shown is distinguished by Figure 8 In the embodiment, the functions implemented by the compression unit 510 and the table entry generation unit 512 are handed over to Figure 8 The network device 600A shown in FIG. 10 is executed, and the functions implemented by the decompression unit 521, the decompression parameter storage unit 524 (such as the instruction storage unit 524a and the metadata storage unit 524b), the compression table storage unit 522 and the forwarding service processing unit 526 are handed over to Figure 8 The network device 600B shown in FIG. 1 is executed. In one possible implementation, the first processor 601 in the network device 600A is used to implement the function of the compression unit 510. The memory 602 in the network device 600A stores the program code of the decompression algorithm. The second processor 605 in the network device 600B is used to implement the function of the decompression unit 521. The memory 602 in the network device 600B stores the compression table entry.
[0270] The following is an example of the method flow of the embodiment of the present application.
[0271] For example, please refer to the attached Figure 7 ,Attached Figure 7 1 is a flow chart of a method for processing a forwarding table entry provided in an embodiment of the present application. Figure 7 The method shown can be Figure 1 , Attachment Figure 2 Or attach Figure 3 The device shown is executed, or the attached Figure 4 , Attachment Figure 5 Or attach Figure 6 The device shown performs.
[0272] For example, in conjunction with Figure 1 In the device embodiment shown, the entry generation unit 512 executes S110, the compression unit 510 executes S120 and S130, the compression entry storage unit 522 executes the step of storing the compression entry in S140, and the decompression parameter storage unit 524 executes the step of storing the decompression parameter in S140. The decompression unit 521 executes S150. The forwarding service processing unit 526 executes S160.
[0273] For example, in conjunction with Figure 2In the illustrated device embodiment, the instruction storage unit 524a executes the step of storing the microcode decompression instruction in S140.
[0274] For example, in conjunction with Figure 3 In the illustrated device embodiment, the metadata storage unit 524b executes the step of storing metadata in S140.
[0275] For example, in conjunction with Figure 4 In the device embodiment shown, the first processor 601 executes S110, S120 and S130, the memory 602 executes the step of saving the compression table entries in S140, the second processor 605 or the memory 602 executes the step of saving the decompression parameters in S140, the second processor 605 executes S150, and the second processor 605 and the network interface 603 execute S160.
[0276] For example, in conjunction with Figure 4 In the device embodiment shown, the main control board 710 executes S110, S120 and S130, and the interface board 730 executes S140, S150 and S160. Alternatively, the central processor 731 included in the interface board 730 executes S110, S120 and S130, and the network processor 732 included in the interface board 730 executes S150 and S160. The network processor 732 executes the step of saving the compression table entry in S140, and the decompression parameter storage unit 524 executes the step of saving the decompression parameter in S140. The forwarding table entry memory 734 executes the step of saving the compression table entry in S140, and the network processor 732 or the forwarding table entry memory 734 executes the step of saving the decompression parameter in S140.
[0277] S110, the control plane component obtains a forwarding table entry.
[0278] Regarding the source of the forwarding table entry, in one possible implementation, the control plane component obtains the forwarding table entry by performing path calculation based on the routing protocol. In another possible implementation, the control plane component obtains the forwarding table entry according to a static configuration operation. Or the control plane component receives the forwarding table entry from the network controller. Or, the control plane component receives the forwarding table entry from a neighboring network device.
[0279] The scenarios to which this embodiment is applicable include but are not limited to the following scenario A and scenario B.
[0280] Scenario A: Data compression is performed on newly obtained forwarding table entries. For example, the forwarding table entries obtained by the control plane are from a newly generated forwarding table. For example, the forwarding table entries are obtained from the first forwarding table.
[0281] Scenario B: In response to a change in data in a forwarding table entry, the data in the forwarding table entry is recompressed. For example, the control plane obtains the forwarding table entry from a forwarding table generated in a historical time period after data is updated. For example, the forwarding table entry is obtained from the second forwarding table.
[0282] S120: The control plane component compresses the data included in the forwarding table entry to obtain a compressed table entry.
[0283] For example, metadata is determined based on data included in the forwarding table entry, and the data included in the forwarding table entry is compressed based on the metadata to obtain a compressed table entry.
[0284] In a possible implementation, the control plane component uses the content of a forwarding table as a data set targeted by a compression algorithm, and determines metadata according to data distribution in the data set through the compression algorithm.
[0285] For example, the compression algorithm is a BASE+DIFF compression algorithm, and the base value (BASE) + difference (DIFF) compression algorithm is a compression algorithm based on difference coding. BASE is the part of the compression template that represents the base value or base pattern. BASE represents a fixed base value in the compression template, which serves as a reference point for the decompression process. In the compression template, BASE is usually a numerical segment, which is used to represent the common data between different data. DIFF is the part of the compression template that represents the difference value or difference pattern. DIFF represents the difference or change in the compression table item relative to the base value. In the compression template, DIFF is usually a wildcard segment, which is used to represent the variable part in the compression table item. Based on the BASE+DIFF compression algorithm, the original data can be split into a base part (BASE) and a difference part (DIFF) to generate a compression template. For example, the common data of a piece of original data and other original data is extracted as BASE (the numerical segment of the compression template), and the remaining data in the original data except the common data is stored as DIFF (the wildcard segment of the compression template). In the decompression stage, the original data can be restored by adding the base value to the difference. By extracting common data and storing differences, there is no need to store common data for each piece of data in the data set, thereby reducing data storage space and saving storage resources.
[0286] Please refer to the attached Figure 8 , attached Figure 8 2 is a schematic diagram of a method for compressing and decompressing data included in a forwarding table entry based on a BASE+DIFF compression algorithm provided in this embodiment. The control plane component obtains a metadata set 220 based on the data in the forwarding table 210; the control plane component compresses the data in the forwarding table 210 based on the metadata set 220 to obtain a compressed table entry set 230.
[0287] The transfer table 210 includes original data A to original data G. Each original data in the original data A to original data G is, for example, from a transfer table entry in the transfer table 21. Each original data is 16 bits of data. In order to distinguish the common data in different original data and the remaining data (or difference data) in the original data except the common data, italics are used to represent the common data. The value of the original data A is 1100100101110001; the value of the original data B is 1100100001100011; the value of the original data C is 1101100010110010; the value of the original data D is 1100100111110011; the value of the original data E is 0100110111000011; the value of the original data F is 0101010011000011; the value of the original data G is 0100000101001011.
[0288] The metadata set 220 includes metadata T1 and metadata T2. The value of metadata T1 is 110**00***1*00**. The value of metadata T2 is 01****0**100**11.
[0289] The compression table entry set 230 includes compression table entry A′ to compression table entry G′. Each compression table entry in the compression table entry set 230 includes a corresponding metadata ID and 8 bits of data.
[0290] Regarding the process of obtaining the metadata set 220, for example, the control plane component extracts the common data included in the original data A to the original data D as the value segment of metadata T1 based on the similarity of the data distribution of the original data A to the original data D being higher than the threshold, and uses the wildcard to complete the rest of the metadata T1 to obtain metadata T1. Similarly, the control plane component extracts the common data included in the original data E to the original data G as the value segment of metadata T2 based on the similarity of the data distribution of the original data E to the original data G being higher than the threshold, and uses the wildcard to complete the rest of the metadata T2 to obtain metadata T2.
[0291] Regarding the process of obtaining the compression table entry set 230, for example, the control plane component compresses the original data A to the original data D based on the metadata T1 to obtain the compression table entries A' to D'. The control plane component compresses the original data E to the original data G based on the metadata T2 to obtain the compression table entries E' to G'.
[0292] Compression table item A' indicates data obtained by compressing original data A using metadata T1. Compression table item A' includes, for example, the identifier of metadata T1 and data 01101101. Compression table item B' indicates data obtained by compressing original data B using metadata T1. Compression table item B' includes, for example, the identifier of metadata T1 and data 01001011. Compression table item C' indicates data obtained by compressing original data C using metadata T1. Compression table item C' includes, for example, the identifier of metadata T1 and data 11010110. Compression table item D' indicates data obtained by compressing original data D using metadata T1. Compression table item D' includes, for example, the identifier of metadata T1 and data 01111111. Compression table item E' indicates data obtained by compressing original data E using metadata T2. Compression table item E' includes, for example, the identifier of metadata T2 and data 00111100. Compression table item F' indicates data obtained by compressing original data F using metadata T2. The compression table entry F' includes, for example, the identifier of the metadata T2 and the data 01010100. The compression table entry G' indicates data obtained by compressing the original data G using the metadata T2. The compression table entry G' includes, for example, the identifier of the metadata T2 and the data 00001010.
[0293] S130, the control plane component sends the compression table entry and the decompression parameter to the forwarding plane component.
[0294] For example, the control plane component obtains a microcode decompression instruction based on the metadata, and sends a compression table entry and the microcode decompression instruction to the forwarding plane component. In another example, the control plane component sends a compression table entry and the metadata to the forwarding plane component.
[0295] Corresponding to the above-mentioned method of updating the immediate value in the old microcode decompression instruction when the metadata changes, the control plane component keeps the number of microcode decompression instructions unchanged. When the value segment in the metadata changes but the structure remains unchanged, the forwarding plane component modifies the value at a specific offset in the instruction storage unit in the forwarding plane component (corresponding to the immediate value in the decompression instruction).
[0296] For example, please refer to the attached Fig. 9 , attached Fig. 9 Italics indicate changes. Fig. 9 As shown in (a), the first metadata is 110**00***1*00**, and the first metadata is converted into a first microcode decompression instruction. The content of the first microcode decompression instruction is as follows.
[0297]
[0298]
[0299] The above instructions instruct to decompress based on the compressed table item CData, thereby restoring the compressed table item CData to the original data Data. The following is the meaning of each instruction:
[0300] put 110,Data indicates that the value 110 is added to the target data Data.
[0301] put CData[0..1],Data indicates that bits CData[0] and CData[1] in the compression table entry CData are taken out and spliced into the target data Data.
[0302] put 00,Data indicates that the value 00 is added to the target data Data.
[0303] put CData[2..4],Data indicates that bits CData[2], CData[3] and CData[4] in the compression table entry CData are taken out and spliced into the target data Data.
[0304] put 1,Data indicates that the value 1 is added to the target data Data.
[0305] put CData[5..5],Data indicates that the bit CData[5] in the compression table item CData is taken out and spliced into the target data Data.
[0306] put 00,Data indicates that the value 00 is added to the target data Data.
[0307] put CData[6..7],Data indicates that bits CData[6] and CData[7] in the compression table entry CData are taken out and spliced into the target data Data.
[0308] return Data indicates that the final restored data Data is returned.
[0309] These instructions perform decompression operations based on specific bits of the compression table entries, take out the corresponding compression table entry bits and splice them into the target data to restore the original data.
[0310] If the data in the forwarding table entry changes, the control plane component needs to re-compress the data in the forwarding table entry, which may cause the metadata to change. When the metadata changes, the control plane component synchronously updates the corresponding decompression instructions. For example, please refer to the attached Fig. 9, the forwarding table changes from the first forwarding table to the second forwarding table, and the data included in the table items A, B, C, and D in the forwarding table change, and the corresponding metadata changes from 110**00***1*00** to 110**10***1*11**, that is, the value of the third segment in the metadata changes from 00 to 10, and the value of the seventh segment in the metadata changes from 00 to 11. At this time, the control plane component modifies the immediate value in the third instruction of the first microcode decompression instruction in the forwarding plane component from 00 to 10, and modifies the immediate value in the seventh instruction of the first microcode decompression instruction from 00 to 11, and the content of the second microcode decompression instruction is obtained as follows: Fig. 9 As shown in (b).
[0311] The above implementation is relatively simple to implement and is applicable to the case where the metadata structure remains unchanged, so as to avoid the expansion of the space occupied by the microcode instructions due to the metadata change. After the metadata is changed, the CPU only needs to modify the instructions at a specific offset in the microcode instruction space.
[0312] Corresponding to the method of regenerating microcode decompression instructions after the above-mentioned metadata changes, when the data in the transfer table entry changes and the structure of the metadata corresponding to the data in the transfer table entry changes, the corresponding microcode decompression instructions are regenerated according to the new metadata structure.
[0313] For example, please refer to the attached Fig.10 In (a), the first metadata is 110**00***1*00**, and the content of the first microcode decompression instruction corresponding to the first metadata is as follows.
[0314]
[0315] As attached Fig.10 As shown in (b) of FIG. 1 , when the second metadata regenerated based on the changed data is 01000***1*****01, the second microcode decompression instruction regenerated by the CPU based on the second metadata is as shown in the attached Fig.10 As shown in (b) in FIG. 1 , it includes the following contents.
[0316]
[0317]
[0318] Attached Fig.10 For the meaning of the instructions, please refer to the attached Fig. 9 Explanation of the instructions in .
[0319] This implementation is more flexible and is usually used when the metadata structure (compression template) changes. This method will also cause the number of microcode instructions to change (such as from 8 instructions to 5 instructions in the above example).
[0320] S140, the forwarding plane component receives the compression table entry and the decompression parameter, and saves the compression table entry and the decompression parameter.
[0321] S150: In response to receiving a data message corresponding to a compression entry, the forwarding plane component decompresses the compression entry based on a decompression parameter to obtain data included in the forwarding entry.
[0322] For example, please refer to the attached Figure 8 , the forwarding plane component decompresses the compressed table item set 230 based on the metadata set 220 to obtain the forwarding table 210. For example, the forwarding plane component decompresses the compressed table item A' to the compressed table item D' based on the compression template T1 to obtain the original data A to the original data D. The forwarding plane component decompresses the compressed table item E' to the compressed table item G' based on the compression template T2 to obtain the original data E to the original data G.
[0323] S160: The forwarding plane component forwards the data message based on the data included in the forwarding table entry.
[0324] In the method provided in this embodiment, the forwarding plane component compresses the data included in the forwarding table items and sends the compressed forwarding table items to the forwarding plane component, thereby effectively reducing the data volume of the forwarding table items and saving the storage space occupied by the forwarding table items in the forwarding plane component, so that the forwarding plane component can provide a greater storage density, that is, the forwarding plane component can store more forwarding table items in a given storage space, thereby improving the table item specifications of the forwarding plane.
[0325] The following three examples are combined to illustrate the above Figure 7 The following three examples use the CPU and network processor to interact to implement the attached Figure 7 The method shown is described as an example. The following example 1 is an example of the compression and decompression process when the immediate value in the old microcode decompression instruction is updated when the metadata changes, the following example 2 is an example of the compression and decompression process when the microcode decompression instruction is regenerated after the metadata changes, and the following example 3 is an example of the compression and decompression process when the control plane sends metadata to the forwarding plane.
[0326] Example 1
[0327] Fig.11 1 is a flow chart of compression and decompression of the forwarding table entry shown in Example 1. Fig.11 As shown, the process of Example 1 includes the following S310 to S360.
[0328] S310, the CPU determines metadata corresponding to each forwarding table entry in the first forwarding table based on data distribution of the first forwarding table by running a program code of a compression algorithm to obtain first metadata. The first metadata is, for example, a compression template in a BASE+DIFF compression algorithm, and the specific compression algorithm is not limited.
[0329] S320, the CPU generates a first microcode decompression instruction according to the first metadata calculated in S310. The first microcode decompression instruction includes the first metadata. For example, the immediate field of the first microcode decompression instruction includes the bit range corresponding to the numeric field or wildcard field of the first metadata.
[0330] The type of the first microcode decompression instruction can be determined based on the network processor used in the network device. The first microcode decompression instruction can be obtained by compiling the compiler of the network processor, or can be hard-coded by the CPU for the network processor through a compression algorithm.
[0331] S330, the CPU loads the first microcode decompression instruction into the instruction storage unit of the network processor by means including but not limited to microcode instruction patching, instruction dynamic loading, etc.
[0332] S340, when processing the compression table entry, the network processor executes the first microcode decompression instruction issued by the CPU to decompress the compression table entry to obtain a forwarding table entry.
[0333] S350, in response to determining that the data in the first forwarding table has changed, the CPU recalculates metadata corresponding to the second forwarding table entry according to the changed second forwarding table entry by using the program code of the compression algorithm to obtain second metadata.
[0334] The structure of the second metadata is consistent with the structure of the first metadata, so that the number of instructions in the second microcode decompression instruction is consistent with the number of instructions in the first microcode decompression instruction, so that the CPU can quickly update the microcode decompression instruction.
[0335] S360: The CPU updates the first microcode decompression instruction in the instruction storage unit of the network processor based on the second metadata, so that the second microcode decompression instruction is stored in the network processor.
[0336] This embodiment provides a method for collaborative compression and decompression of software and microcode. The software generates a microcode decompression instruction based on the data compression result, and then loads it into the instruction storage unit of the network processor. The network processor decompresses the data by executing the decompression instruction in the instruction storage unit. This does not lose the flexibility of the microcode and does not require additional memory access IO, thus facilitating high-speed decompression of the microcode.
[0337] Example 2
[0338] S310 to S340 of Example 2 refer to S310 to S340 of Example 1. The difference is that S350 of Example 1 is replaced by the following S350', and S360 of Example 1 is replaced by the following S360'.
[0339] S350', when the data in the first forwarding table changes, the CPU recalculates metadata corresponding to the second forwarding table entry according to the changed second forwarding table entry by using the program code of the compression algorithm to obtain second metadata.
[0340] The structure of the second metadata does not need to be consistent with the structure of the first metadata, thereby improving the data compression rate.
[0341] S360', the CPU generates a second microcode decompression instruction based on the second metadata, and the CPU sends the second microcode decompression instruction to the instruction storage unit of the network processor.
[0342] Example 3
[0343] S310 in Example 3 refers to S310 in Example 1. The difference is that S320 to S350 in Example 1 are replaced by the following S320" to S350".
[0344] S320 ”, the CPU saves the first metadata and the compression table entry to a memory (eg, SRAM, DRAM, or other types of memory).
[0345] S330”, in the process of forwarding the data message, the network processor reads the first metadata and the compression table entry from the memory according to the metadata index (eg, the identifier of the compression template) carried in the compression table entry.
[0346] S340 ”, the network processor decompresses the compressed table entry according to the first metadata to obtain data of the forwarding table entry.
[0347] S350", when the data in the forwarding table entry changes, the CPU calculates metadata according to the data distribution of the second forwarding table entry, obtains second metadata, and sends the second metadata to the memory.
[0348] The method provided in this embodiment realizes high-speed compression and decompression through the coordination of software and hardware, and can effectively improve the table entry specifications of the existing network processor.
[0349] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0350] A refers to B, which means that A is the same as B or A is a simple variant of B.
[0351] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order of objects, and cannot be understood as indicating or implying relative importance. For example, the first microcode decompression instruction and the second microcode decompression instruction are used to distinguish different microcode decompression instructions, rather than to describe a specific order of microcode decompression instructions, and cannot be understood as the first microcode decompression instruction being more important than the second microcode decompression instruction.
[0352] In the embodiments of the present application, unless otherwise specified, "at least one" means one or more, and "a plurality" means two or more. For example, a plurality of microcode decompression instructions means two or more microcode decompression instructions.
[0353] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in accordance with the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidState Disk (SSD)), etc.
[0354] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for processing a forwarding table entry, characterized in that: include: Get the first forwarding table entry; Compressing the data in the first forwarding table entry to obtain a first compression table entry and a decompression parameter, wherein the decompression parameter is used to indicate that the first compression table entry is to be decompressed; The first compression table entry and the decompression parameter are saved.
2. The method according to claim 1, characterized in that The decompression parameters include a first microcode decompression instruction, the first microcode decompression instruction includes first metadata and an operation code, the first metadata indicates a feature of data in the first transfer table entry, and the operation code indicates a decompression operation.
3. The method according to claim 1 or 2, characterized in that: The compressing the data in the first forwarding table entry to obtain a first compression table entry and a decompression parameter includes: Compressing the data in the first forwarding table entry to obtain a first compression table entry and the first metadata; The first microcode decompression instruction is obtained based on the first metadata.
4. The method according to claim 3, characterized in that The first metadata includes k segments, the first microcode decompression instruction includes k instructions, and k is a positive integer. The obtaining the first microcode decompression instruction based on the first metadata includes: In response to the i-th segment in the k segments of the metadata being a numerical value, filling the i-th segment in the metadata into the i-th instruction in the k instructions, where i is a positive integer less than or equal to k; or, In response to the i-th segment among the k segments of the metadata being a wildcard, based on the position of the i-th segment in the metadata, a bit range corresponding to the i-th segment is determined, and the bit range is filled into the i-th instruction among the k instructions.
5. The method according to any one of claims 2 to 4, characterized in that The saving of the first compression table entry and the decompression parameter includes: The first microcode decompression instruction is saved in the microcode instruction space.
6. The method according to claim 3, characterized in that Also includes: In response to the first forwarding table entry being updated to a second forwarding table entry, the first microcode decompression instruction is updated based on second metadata, where the second metadata indicates characteristics of data in the second forwarding table entry.
7. The method according to claim 6, characterized in that The structure of the second metadata is the same as that of the first metadata.
8. The method according to claim 3, characterized in that Also includes: In response to the first forwarding table entry being updated to a second forwarding table entry, obtaining a second microcode decompression instruction based on second metadata, the second metadata indicating a characteristic of data in the second forwarding table entry; The second microcode decompression instruction is saved.
9. The method according to claim 8, characterized in that The structure of the second metadata is different from the structure of the first metadata.
10. The method according to claim 1, characterized in that The decompression parameters include first metadata indicating characteristics of data in the first forwarding table entry.
11. The method according to any one of claims 1 to 10, characterized in that Also includes: In response to receiving the data message corresponding to the first compression table entry, decompressing the first compression table entry based on the decompression parameter to obtain the data in the first forwarding table entry; The data message is forwarded based on the data in the first forwarding table entry.
12. The method according to any one of claims 1 to 11, characterized in that Before compressing the data in the first forwarding table entry, the method further includes: It is determined that the number of saved forwarding table entries is greater than or equal to a threshold.
13. A data compression device for a forwarding table entry, characterized in that: include: A control plane component, configured to obtain a first forwarding table entry; compress data in the first forwarding table entry to obtain a first compressed table entry and a decompression parameter, wherein the decompression parameter is used to indicate that the first compressed table entry is to be decompressed; The forwarding plane component is used to store the first compression table entry and the decompression parameter.
14. A computing device, characterized in that The computing device comprises at least one processor coupled to at least one memory, wherein at least one computer program instruction is stored in the at least one memory, and the at least one computer program instruction is loaded and executed by the at least one processor so that the computing device implements the method according to any one of claims 1 to 12.
15. The device according to claim 14, characterized in that The at least one processor includes a first processor and a second processor, the first processor is used to compress the data in the first transfer table entry to obtain a first compression table entry and the first metadata; obtain the first microcode decompression instruction based on the first metadata; save the first microcode decompression instruction to the microcode instruction space of the second processor, and save the first compression table entry.
16. The device according to claim 15, characterized in that It also includes an interface, and the second processor is also used to execute the first microcode decompression instruction to decompress the first compression table entry in response to receiving the data message corresponding to the first compression table entry, and obtain the data in the first forwarding table entry; based on the data in the first forwarding table entry, instruct the interface to forward the data message.
17. The device according to claim 15 or 16, characterized in that The first processor is a central processing unit (CPU), and the second processor is a network processor.