Message forwarding method, apparatus and device, and readable storage medium
By dividing the execution of service-type and error-correction-type packets in the routing and forwarding device, and using error-correction-type packets to detect and correct errors in forwarding table entries, the problem of low packet forwarding efficiency in the prior art is solved, and forwarding efficiency is improved while ensuring reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HUAWEI DIGITAL TECH
- Filing Date
- 2024-10-29
- Publication Date
- 2026-05-01
AI Technical Summary
While ensuring the reliability of message forwarding, existing technologies have low forwarding efficiency, which can easily lead to congestion and packet loss, especially in high-traffic scenarios.
In the routing and forwarding device, service-type packets and error-correction-type packets are executed separately. Error-correction-type packets are used to detect and correct errors in multiple forwarding table entries, while service-type packets only need to query one forwarding table entry to be forwarded, thus decoupling the packet forwarding and forwarding table entry error correction processes.
It improves the forwarding efficiency and reliability of service-related packets, reduces forwarding time, avoids erroneous forwarding loops, and enhances the performance of routing and forwarding devices.
Smart Images

Figure CN121967321A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a message forwarding method, apparatus, device and readable storage medium. Background Technology
[0002] Triple modular redundancy (TMR) technology refers to configuring the same functional module three times, with all three modules running simultaneously and performing the same task, outputting the execution result according to the "majority vote" principle. As a method to improve system reliability, TMR technology has been widely used in many critical fields such as aerospace and nuclear power plants.
[0003] Taking the aerospace field as an example, to ensure that aerospace equipment can still communicate normally under bit-flipping scenarios, triple modular redundancy (TMR) technology is typically used to forward messages. Specifically, the forwarding table used for message forwarding is backed up and stored in multiple (e.g., three) different storage locations. During message forwarding, three copies of the forwarding table are queried from the three storage locations to obtain three query results. Based on the three query results, the forwarding table entries in the three copies are checked and corrected. Then, the final next-hop address of the message is determined based on the corrected forwarding table entries. This not only effectively maintains the forwarding table entries but also ensures the accuracy of the message forwarding path, improving the reliability of message forwarding.
[0004] However, this forwarding method requires querying multiple forwarding table entries for each packet. In high-traffic scenarios, this often leads to congestion and packet loss due to slow processing speed, severely impacting packet forwarding efficiency. Therefore, how to improve packet forwarding efficiency while ensuring reliability has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a message forwarding method, apparatus, device, and readable storage medium to solve the problem of slow data message forwarding speed, which can improve the forwarding efficiency of data messages while ensuring the reliability of data message forwarding.
[0006] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0007] Firstly, a message forwarding method is provided, which is applied in a routing and forwarding device. Multiple forwarding tables are stored in various storage locations within the routing and forwarding device. These forwarding tables specify the message processing method and the message forwarding path. When processing a message, if the message is an error-correction message, the routing and forwarding device checks and corrects errors in the forwarding table entries across the multiple forwarding tables based on the error-correction message type. If the message is a service-related message, the device queries one of the multiple forwarding tables, retrieves the forwarding table entry corresponding to the destination address of the service-related message from that forwarding table, and processes and forwards the service-related message based on the retrieved forwarding table entry.
[0008] In this embodiment, the packets to be processed by the routing and forwarding device include not only service-type packets but also error-correction packets. Different packets perform different functions, decoupling the forwarding process of service-type packets from the error-correction process of forwarding table entries, allowing for separate execution. Compared to the prior art where the routing and forwarding device only receives service-type packets and performs error detection and correction based on the service-type packets to be forwarded, this method first performs error detection and correction on the forwarding table based on the packet before forwarding, improving forwarding efficiency. Furthermore, the routing and forwarding device performs error detection and correction on multiple stored forwarding tables based on error-correction packets to maintain forwarding table entries and increase the data reliability of the forwarding table. Thus, when forwarding service-type packets, forwarding based on a reliable forwarding table can improve the forwarding reliability of service-type packets and avoid continuous error forwarding loops. At the same time, the routing and forwarding device only needs to query one of the multiple forwarding tables, and if a forwarding table entry is matched in one forwarding table, the service-type packet is directly forwarded, which greatly reduces the forwarding time of service-type packets. Therefore, the embodiments of this application can improve the forwarding efficiency of service-type packets while ensuring the reliability of forwarding, thus greatly improving the forwarding performance of the routing and forwarding device.
[0009] In one optional implementation, error correction packets and service packets are cached in a data packet queue, and the routing and forwarding device reads the data packets (packets to be processed) from the data packet queue for processing. The error correction packets are copied from the service packets. Obtaining error correction packets from service packets simplifies the process of generating error correction packets and reduces the processing overhead of the routing and forwarding device.
[0010] Specifically, the routing and forwarding device copies service-type packets to obtain copied packets, and then adds a marker to the copied packets to obtain error-correction-type packets. The data packets containing the marker are error-correction-type packets. In this way, by setting a marker, the routing and forwarding device can determine whether a packet to be processed is an error-correction-type packet or a service-type packet based on the marker, simplifying system design.
[0011] In one optional implementation, the routing and forwarding device needs to forward service-type packets in the network. When the routing and forwarding device receives a service-type packet, it first needs to store the service-type packet in a first data packet queue, and then forward the service-type packets in the first data packet queue sequentially. When processing service-type packets, it needs to determine whether to copy the currently processed service-type packet according to a copying policy. The purpose of copying the service-type packet is to obtain error-correction packets. When it is determined to copy a service-type packet, the copied packet is obtained, and then marked as an error-correction packet by adding a flag, and the marked copied packet is placed in a second data packet queue. In this way, the forwarding of service-type packets is not affected, and error-correction packets are obtained by copying service-type packets. Subsequently, the routing and forwarding device can use the error-correction packets to detect and correct errors in hot forwarding entries in the forwarding table, improving the efficiency of error detection and correction.
[0012] In one optional implementation, after correcting multiple forwarding tables using error-correcting messages, the routing and forwarding device needs to discard the error-correcting messages. This prevents the error-correcting messages from being forwarded, thus not affecting the transmission of service-related messages in the network, and also alleviates the storage pressure on the routing and forwarding device in a timely manner.
[0013] In one optional implementation, the replication strategy can be as follows: After receiving a service-type packet, the routing and forwarding device first generates a random number. Then, it compares the random number with a numerical threshold to determine whether to replicate the service-type packet. Since both the random number and the numerical threshold are within preset ranges, the generated random number may be larger or smaller than the numerical threshold. Based on the relationship between the two, there is a certain probability that the routing and forwarding device will replicate the service-type packet. This avoids replicating every service-type packet, further reducing the forwarding time of service-type packets.
[0014] In one optional implementation, if the generated random number is greater than a numerical threshold, then the service-type packet is copied. If the generated random number is less than or equal to the numerical threshold, then the service-type packet is not copied. Alternatively, if the generated random number is less than or equal to the numerical threshold, then the service-type packet is copied. If the generated random number is greater than the numerical threshold, then the service-type packet is not copied. Thus, the probability of service-type packets being copied can be adjusted by changing the size of the numerical threshold, thereby affecting the number of error-correcting packets and consequently the frequency with which the routing and forwarding device checks and corrects errors in the forwarding table.
[0015] In one optional implementation, service-type packets are only copied if the generated random number is greater than a numerical threshold. When the network traffic volume is at a first-level volume, the numerical threshold is the first value; when the network traffic volume is at a second-level volume, the numerical threshold is the second value. If the first-level volume is greater than the second-level volume, the first value is greater than the second value. In other words, when network traffic is high, the numerical threshold should be larger, thus reducing the probability of the random number exceeding the threshold, decreasing the number of error-correcting packets, and shortening the waiting time for service-type packets, thereby increasing forwarding speed. This can alleviate network congestion. Conversely, when network traffic is low, the numerical threshold should be smaller, increasing the likelihood of service-type packets being copied, thereby increasing the number of error-correcting packets and increasing the frequency of error detection and correction in the forwarding table by the routing and forwarding device, thus improving the data reliability of the forwarding table.
[0016] In one optional implementation, service-type packets are copied only if the generated random number is less than or equal to a numerical threshold. Therefore, when the network traffic volume is the third largest, the numerical threshold is the third value; when the network traffic volume is the fourth largest, the numerical threshold is the fourth value. If the third largest traffic volume is greater than the fourth largest, the third value is less than the fourth value. In other words, when network traffic is high, the numerical threshold should be smaller, thus reducing the probability of the random number being less than the threshold, decreasing the number of error-correcting packets, and shortening the waiting time for service-type packets, thereby increasing forwarding speed. This can alleviate network congestion. Conversely, when network traffic is low, the numerical threshold should be larger, increasing the likelihood of service-type packets being copied, thereby increasing the number of error-correcting packets and increasing the frequency of error detection and correction in the forwarding table by the routing and forwarding device, thus improving the data reliability of the forwarding table.
[0017] In one optional implementation, the routing and forwarding device includes a sampling memory that stores digital thresholds and preset digital ranges. Before processing service-type packets, the routing and forwarding device needs to retrieve the digital thresholds and preset digital ranges from the sampling memory. This allows the digital thresholds in the sampling memory to be flexibly adjusted based on network traffic conditions, thereby adjusting the replication strategy for service-type packets.
[0018] In an optional implementation, the routing and forwarding device can also periodically scan multiple forwarding tables stored in multiple storage locations to identify multiple erroneous entries in the multiple forwarding tables. Then, it corrects the erroneous entries in the multiple forwarding tables. In this way, the error detection and correction of forwarding table entries is not triggered by service-type packets, which can further improve the data reliability of the forwarding table.
[0019] Secondly, a routing forwarding device is provided, the routing forwarding device comprising:
[0020] The acquisition unit is used to read the message to be processed.
[0021] The processing unit is used to correct multiple forwarding tables according to the error correction type message if the message to be processed is an error correction message, wherein the multiple forwarding tables are stored in multiple storage locations.
[0022] The processing unit is further configured to, if the message to be processed is a service-type message, read the first forwarding table and forward the service-type message according to the first forwarding table entry corresponding to the destination address of the service-type message. The first forwarding table is one of multiple forwarding tables.
[0023] In one optional implementation, the acquisition unit is specifically used to read packets to be processed from a data packet queue. The data packet queue includes multiple packets to be processed, which include error correction packets and / or service packets. Error correction packets are obtained by adding a marker to a copied packet (obtained by copying a service packet). The marker indicates that the packet containing the marker is an error correction packet.
[0024] In one optional implementation, the acquisition unit is specifically used to read service-type messages from the first data message queue.
[0025] The processing unit is also used to determine whether to copy service-type messages based on the copying strategy. If it is determined that service-type messages should be copied, then the service-type messages are copied to obtain copied messages. The copied messages are marked as error-correction messages by adding a flag, and the marked copied messages are placed in the second data packet queue.
[0026] In an optional implementation, the processing unit is also configured to delete error correction messages.
[0027] In one optional implementation, the processing unit is specifically configured to generate a random number after the receiving unit receives a service-type message. Based on the relationship between the random number and a numerical threshold, it determines whether to copy the service-type message. Both the random number and the numerical threshold are within a preset numerical range.
[0028] In one optional implementation, the processing unit is specifically configured to copy the service-type message if the random number is greater than a numerical threshold, and not copy the service-type message if the random number is less than or equal to the numerical threshold.
[0029] In one optional implementation, the processing unit is specifically configured to copy the service-type message if the random number is less than or equal to a numerical threshold, and not copy the service-type message if the random number is greater than the numerical threshold.
[0030] In one optional implementation, when the network traffic volume is a first traffic volume, the digital threshold is a first value. When the network traffic volume is a second traffic volume, the digital threshold is a second value. Wherein, the first traffic volume is greater than the second traffic volume, and the first value is greater than the second value.
[0031] In one optional implementation, when the network traffic size is a third traffic size, the digital threshold is a third value. When the network traffic size is a fourth traffic size, the digital threshold is a fourth value. Wherein, the third traffic size is greater than the fourth traffic size, and the third value is less than the fourth value.
[0032] In an optional implementation, the routing and forwarding device includes a sampling memory, in which a preset digital range and a digital threshold are stored.
[0033] In an optional implementation, the processing unit is further configured to periodically scan multiple forwarding tables stored in multiple storage locations, identify multiple erroneous entries in the multiple forwarding tables, and correct the multiple erroneous entries in the multiple forwarding tables.
[0034] In another aspect of this application, a routing and forwarding device is provided, the device comprising: a processor and a memory, the memory storing instructions that, when executed by the processor, cause the device to perform a message forwarding method as provided in the first aspect or any possible implementation thereof.
[0035] Thirdly, a chip is provided, the chip including a processor and an interface circuit, the processor and the interface circuit being used to support the chip in performing a message forwarding method as provided in the first aspect or any possible implementation thereof.
[0036] Fourthly, a computer-readable storage medium is provided, wherein a computer program or instructions are stored therein, which, when executed, implement the message forwarding method provided by the first aspect or any possible implementation thereof.
[0037] Fifthly, a computer program product is provided, comprising: a computer program (or code, or instructions) that, when executed, causes a computer to perform a message forwarding method as provided in the first aspect or any possible implementation thereof.
[0038] It is understood that the beneficial effects achieved by any of the routing and forwarding devices, chips, computer-readable storage media, and computer program products provided above can be referred to in the context of the beneficial effects of the packet forwarding methods provided above, and will not be repeated here. Attached Figure Description
[0039] Figure 1 A system architecture diagram of a routing and forwarding device provided in this application embodiment;
[0040] Figure 2 A hardware structure diagram of a routing and forwarding device provided in an embodiment of this application;
[0041] Figure 3A A flowchart illustrating a message forwarding method provided in an embodiment of this application;
[0042] Figure 3B A schematic diagram of the message structure of an error correction message provided in an embodiment of this application;
[0043] Figure 4 A flowchart illustrating a service message forwarding method provided in an embodiment of this application;
[0044] Figure 5 A flowchart illustrating another service-type message forwarding method provided in this application embodiment;
[0045] Figure 6 A flowchart illustrating a method for correcting errors in forwarding entries provided in an embodiment of this application;
[0046] Figure 7 A flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application;
[0047] Figure 8A A flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application;
[0048] Figure 8B A schematic diagram illustrating the adjustment thread of the forwarding plane unit provided in an embodiment of this application;
[0049] Figure 8C A schematic diagram illustrating another forwarding plane unit adjusting thread provided in an embodiment of this application;
[0050] Figure 9 A flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application;
[0051] Figure 10 A flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application;
[0052] Figure 11A A flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application;
[0053] Figure 11B A schematic diagram of the startup process of the forwarding plane unit provided in an embodiment of this application;
[0054] Figure 12 A flowchart illustrating a method for distributing forwarding entries provided in an embodiment of this application;
[0055] Figure 13 This is a schematic diagram of the structure of a routing and forwarding device provided in an embodiment of this application;
[0056] Figure 14 This is a schematic diagram of the structure of a routing and forwarding device provided in an embodiment of this application. Detailed Implementation
[0057] The technical solutions in the embodiments of this application will be described below with reference to the accompanying drawings. In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that there are three relationships. For example, A and / or B means: A exists alone, A and B exist simultaneously, or B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the related objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c means: a, b, c, a and b, a and c, b and c, a, b, and c; where a, b, and c can be single or multiple.
[0058] The embodiments of this application use terms such as "first" and "second" to distinguish objects with similar names, functions, or effects. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or order of execution. In this application, words such as "exemplarily" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplarily" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.
[0059] TMR (Transmission Reliability Modulation) technology refers to configuring the same functional module three times to obtain three functional modules. These three modules run simultaneously and perform the same task, with the execution result output according to the "majority vote" principle. As a method to improve system reliability, TMR technology has been widely used in many critical fields such as aerospace, military, and nuclear power plants.
[0060] Taking the aerospace field as an example, single-event upsets (SEUs) are a significant cause of malfunctions in aerospace equipment. A SEU occurs when high-energy particles from space collide with microelectronic devices in aerospace equipment, causing a change in the logical state of memory cells, such as a jump from "0" to "1" or vice versa. Because the flux of high-energy particles in the aerospace operating environment is several orders of magnitude higher than on Earth, if the memory chips in aerospace equipment are not radiation-hardened, the frequency of bit jumps can reach more than ten times per day. Bit jumps can lead to a series of problems, including data transmission errors, system failures, and signal interference, severely impacting system reliability, security, and stability. Therefore, how to address bit jumps in memory chips is a crucial issue that must be considered when designing data storage for aerospace equipment.
[0061] Typically, aerospace equipment employs TMR (Transmission Modulation) technology to address bit-jump problems. This technology allows for multiple backups of stored data, with copies stored in three different locations. When querying data, three copies from these three locations are retrieved, and the final result is obtained by comparing these three copies. This ensures that even if one copy of the data in one location becomes corrupted due to a bit-jump, the query result remains accurate because, according to the "majority vote" principle, the query result will be the other two copies that are not corrupted. Therefore, this technology guarantees the reliability of the query result. Furthermore, by comparing the corrupted data with the other two uncorrupted copies, the differences between the corrupted and uncorrupted data can be identified—the erroneous portion. Correcting this erroneous portion further ensures the reliability of the three copies of data, reduces the risk of query errors, and guarantees the aerospace equipment's continued operation even under bit-jump scenarios.
[0062] The following describes how TMR technology handles bit transitions in a data storage context within a communication scenario:
[0063] Packet forwarding is a crucial process in network communication. It refers to the transmission of data packets from one network node to another. In network communication, packet forwarding is typically performed by routing devices. Routing devices forward packets by looking up forwarding entries in a forwarding table. Specifically, forwarding entries specify the packet processing method and forwarding path. For example, in addition to information such as the destination address, next-hop address, and outgoing interface, a forwarding entry may also contain information about packet processing actions, such as prioritizing, encrypting or encapsulating the packet header, or adding a new VPN tag to the header. In other words, forwarding entries not only store the mapping between the destination address and the corresponding outgoing interface or next-hop address, but also the processing method before forwarding. After receiving a data packet, the routing device can use the destination address carried in the data packet as an index to query multiple forwarding entries in the forwarding table, and then determine the data packet processing method and forwarding path based on these entries. In this way, the routing device processes the data packet according to the contents of the forwarding table, and then forwards the data packet to the corresponding next-hop address or outgoing interface, thus achieving the correct transmission of the data packet.
[0064] As can be seen from the above, the key to correct data packet transmission lies in the routing equipment processing and forwarding data based on the correct forwarding table. However, in the aerospace field, the forwarding tables stored by aerospace routing equipment often contain errors due to bit transitions, severely affecting the correct transmission of data packets. To improve the reliability of aerospace network communication, a triple-mode (triple-redundancy) scheme is typically used to store the forwarding table, ensuring its accurate storage. Compared to traditional error-correcting code (ECC) error correction, the triple-mode redundancy method can correct errors in all bits, offering stronger error correction capabilities.
[0065] The following is a detailed description of the three-mode forwarding table scheme: The aerospace routing equipment includes a control plane unit and a forwarding plane unit. The control plane unit is used for routing protocol interaction, forming a routing table, calculating forwarding paths based on the routing table, generating a forwarding table based on the calculation results, and then distributing the forwarding table to the forwarding plane unit. The forwarding plane unit is used to forward data packets based on the forwarding table. Specifically, the control plane unit distributes three copies of the forwarding table to the forwarding plane unit, which stores these three copies in three different storage locations. When forwarding data packets, the forwarding plane unit needs to perform error detection and correction on the three forwarding tables. Specifically, the forwarding plane unit queries the three forwarding tables in the three storage locations based on the received data packet, and then performs a two-out-of-three arbitration on the query results to achieve error detection and correction. Specifically, the arbitration process can involve matching the three forwarding table entries according to the destination address carried in the data packet, and correcting the contents of different forwarding table entries based on the contents of the two identical forwarding table entries. For example, consider three forwarding tables: Forwarding Table A, Forwarding Table B, and Forwarding Table C. The forwarding entries corresponding to the destination addresses carried by data packets in these three tables are Forwarding Entries a, Forwarding Entries b, and Forwarding Entries c, respectively. If the contents of Forwarding Entries a, b, and c are the same, then all three forwarding entries are error-free. If the contents of Forwarding Entries a and b are the same, but the contents of Forwarding Entries c are different from those of Forwarding Entries a and b, then Forwarding Entries c is incorrect. In this case, Forwarding Entries c in Forwarding Table C needs to be corrected by changing its content to the contents of Forwarding Entries a and b. If the contents of Forwarding Entries a, b, and c are all different, then the control plane unit needs to reissue new forwarding entries to replace the old ones in the three tables. This ensures the accuracy of the forwarding entries stored in the three forwarding tables. After error correction is complete, the forwarding plane unit reads a forwarding table entry from one of the forwarding tables based on the destination address of the data packet. It then processes the data packet according to information such as the next-hop address in the forwarding table entry before forwarding it. In a specific example, the hardware implementation of the forwarding plane unit can be a forwarding chip. The threads of the forwarding chip can execute microcode instructions to implement packet processing and forwarding. The forwarding chip includes on-chip memory (LMEM) and also corresponding external extended memory (EMEM).The three forwarding tables can be stored in three different locations within LMEM, such as LMEM1, LMEM2, and LMEM3; or in three different locations within EMEM, such as EMEM1, EMEM2, and EMEM3; or in both LMEM and EMEM, such as EMEM1, EMEM2, and LMEM1, with no specific limitation. In this way, a thread can read the three forwarding tables from the three different storage locations within LMEM or EMEM, correct the forwarding table entries, and then forward the packet based on the corrected entries.
[0066] As described above, the forwarding plane unit needs to perform error checking and correction on three forwarding tables before forwarding each data packet, resulting in slow forwarding speed. In high-traffic scenarios, this often leads to congestion and packet loss, impacting forwarding efficiency. To improve forwarding efficiency, a probabilistic three-mode forwarding technique is proposed. Probabilistic three-mode forwarding means determining whether to perform error checking and correction on forwarding table entries before forwarding a data packet based on a certain probability. If so, all three forwarding table entries are read and corrected before forwarding; otherwise, only one entry is read and forwarded directly. This improves forwarding speed even without error checking and correction on forwarding table entries.
[0067] However, since forwarding plane units typically use multi-threaded packet forwarding, and due to packet ordering requirements, multiple threads acquire a batch of data packets to be forwarded in batches, with each thread processing one data packet from the same batch. Only after all data packets in the same batch have been processed in parallel by multiple threads does the next batch of data packets begin to be forwarded. Therefore, the total processing time for forwarding data packets in the same batch is determined by the thread with the longest processing time. This longest-processing thread reads three forwarding table entries for error correction before forwarding, rather than forwarding directly after reading only one entry. Therefore, even using probabilistic tri-mode forwarding will not affect the forwarding time of the thread with the longest processing time, and thus will not significantly reduce the total packet forwarding processing time. Consequently, using probabilistic tri-mode forwarding technology cannot improve packet transmission efficiency. Therefore, how to improve packet forwarding efficiency (or forwarding speed) while ensuring packet forwarding reliability has become an urgent problem to solve.
[0068] Based on the above description, embodiments of this application provide a message forwarding method, apparatus, device, and readable storage medium. In these embodiments, the message forwarding process and the forwarding table entry error correction process are decoupled. The routing forwarding device uses error-correcting messages to detect and correct errors in forwarding table entries of multiple forwarding tables to ensure the accuracy of the stored forwarding table entries. Then, when forwarding service-type messages, the routing forwarding device only queries one forwarding table and forwards it directly. In this way, the forwarding processing time of service-type messages can be reduced while ensuring the accuracy of forwarding table entries, greatly improving the forwarding performance of the routing forwarding device. The following describes the solution provided by the embodiments of this application in detail with specific examples.
[0069] Before introducing the embodiments of this application, the system architecture used in the embodiments of this application will be described first. Figure 1 This is a system architecture diagram of a routing and forwarding device provided in an embodiment of this application. Figure 1 As shown, the routing and forwarding device includes a control plane unit and a forwarding plane unit.
[0070] The control plane unit is used for operations such as protocol message processing and route calculation. The forwarding plane unit is used for operations such as data forwarding and data packet processing. In this embodiment, the control plane unit is used to send a forwarding table to the forwarding plane unit. The forwarding plane unit is used to receive the forwarding table and data packets (or packets to be forwarded), determine the processing method and forwarding path of the data packets according to the forwarding table entries, and forward the data packets based on the processing method and forwarding path.
[0071] In this process, after receiving multiple forwarding tables from the control plane unit, the forwarding plane unit needs to store these multiple forwarding tables in multiple storage locations within the forwarding plane unit. For example, the forwarding tables can be stored in the forwarding plane unit's memory space or in its extended storage space; this embodiment does not impose any limitations on this.
[0072] For example, the forwarding plane unit operates in a multi-threaded mode. In this embodiment, the processes of packet forwarding and forwarding table entry error correction are independent; therefore, the forwarding plane unit may include a forwarding thread and an error correction thread. The thread used to process data packet forwarding is the forwarding thread, and the thread used to correct forwarding table entries is the error correction thread. It is understood that both the forwarding thread and the error correction thread are ordinary threads that process packets, only they perform different functions for different types of packets. The task execution process of the forwarding thread and the error correction thread will be described in detail below, and will not be repeated here.
[0073] It should be understood that the control plane unit and forwarding plane unit in the routing and forwarding apparatus of this application can be as follows: Figure 1The control plane unit, as shown, can be integrated into the routing forwarding device or deployed separately. For example, the routing forwarding device may contain forwarding plane units, in which case the routing forwarding device possesses the functions of the forwarding plane units, while the control plane units are deployed in other devices outside the routing forwarding device, without restriction. Furthermore, in this application, the routing forwarding device can be a single hardware device or a functional module / unit within a hardware device. When the routing forwarding device is a single hardware device, it can be alternatively described as a routing forwarding device. The internal structure of the routing forwarding device is described below using the example of a routing forwarding device:
[0074] Figure 2 This is a hardware structure diagram of a routing and forwarding device provided in an embodiment of this application. Figure 2 As shown, the routing and forwarding device includes a central processing unit (CPU) and a network processor (NP). It can be understood that this routing and forwarding device is... Figure 2 The diagram illustrates one hardware implementation of the routing device.
[0075] Among them, CPU implementation Figure 1 The control plane unit in the illustrated system architecture functions to execute instructions from the computer program and control the coordinated operation of various components of the routing device. NP implementation Figure 1 The forwarding plane unit in the architecture shown is a programmable device (NP) that can perform tasks such as packet processing in the communication process with high performance.
[0076] In this embodiment, the CPU runs a forwarding adaptation program to implement functions such as issuing forwarding tables, correcting errors in the forwarding tables, and controlling the NP. The forwarding thread and error correction thread running in the NP handle packet forwarding and forwarding table entry error correction, respectively. Specifically, the CPU issues multiple forwarding tables, and after receiving these multiple forwarding tables, the NP stores them in different storage locations. For example, the NP can store the forwarding tables in a location within its on-chip LMEM or in a location within its extended EMEM. The extended EMEM of the NP can be implemented in hardware as Double Data Rate Synchronous Dynamic Random Access Memory (DDR). It is understood that this embodiment does not limit the specific storage location or method for the NP to store the multiple forwarding tables, as long as the multiple forwarding tables are stored in different storage spaces. Finally, the NP performs packet forwarding and forwarding table entry error correction based on the stored forwarding tables.
[0077] Based on the above system architecture and hardware structure, the following describes in detail the data packet forwarding process and the forwarding table entry error correction process.
[0078] Figure 3AThis is a flowchart illustrating a message forwarding method provided in an embodiment of this application. Figure 3A As shown, the message forwarding method includes the following S301-S304:
[0079] S301, Read the message to be processed.
[0080] In this application, the messages to be processed may include service-type messages and / or error-correction messages. Service-type messages may refer to data packets transmitted in the network. Optionally, the routing and forwarding device may receive messages from other devices that are to be forwarded by the routing and forwarding device, and treat the received messages as service-type messages.
[0081] Error correction messages can refer to data packets local to the routing and forwarding device.
[0082] Optionally, error correction messages can be copied from business messages, and then these error correction messages can be used as pending messages. Specifically, the process of obtaining error correction messages can be referred to below. Figure 4 As described in the corresponding embodiments.
[0083] Optionally, before acquiring and processing packets, the routing and forwarding device needs to deploy a forwarding table. Specifically, the control plane unit of the routing and forwarding device sends multiple copies of the forwarding table to the forwarding plane unit, which then stores these copies in different storage locations. The forwarding table can be used to specify packet processing methods and forwarding paths. Some entries in the forwarding table indicate the mapping relationship between the destination address and the next-hop address, while others specify the processing method when a packet is forwarded to a certain exit point.
[0084] S302. Determine the type of the message to be processed. If the message to be processed is an error correction message, then execute S303; if the message to be processed is a business message, then execute S304.
[0085] It should be understood that the pending messages in S302 above include one or more. After reading a pending message, the routing and forwarding device needs to determine whether the pending message is an error correction message or a service message. The routing and forwarding device can process each pending message serially by a single thread, or it can process a batch of pending messages simultaneously / in parallel using multiple threads, without restriction.
[0086] In this application, the type of a message, whether it is an error correction message or a business message, can be distinguished by either Method 1 or Method 2 below:
[0087] Method 1: There is a correspondence between messages and the storage locations used to store messages. Different types of messages correspond to different storage locations, and the message type can be determined through this correspondence.
[0088] For example, error correction messages are stored in cache A, and business messages are stored in cache B. When the routing and forwarding device reads a message to be processed, it can determine the type of the message based on whether its storage location is A or B.
[0089] Method 2: Different types of messages carry different identifiers. For example, error correction messages carry error correction identifiers, while service messages do not. The routing and forwarding device can then determine the type of message to be processed by checking whether it carries an error correction identifier.
[0090] It is understandable that error correction messages and service messages are both ordinary data messages, and the forwarding plane unit can access the forwarding table through both. The only difference between the two is that they instruct the forwarding plane unit to perform different processing actions, and this embodiment does not limit the specific method of differentiation.
[0091] The following describes how error correction flags distinguish the types of messages to be processed:
[0092] In this application, the error correction flag can be implemented by either the value of an extended field in the packet header or a preset field. Specifically, the packet format of error correction packets and service packets are different, and the routing and forwarding device can determine whether the packet to be processed carries an error correction flag by analyzing the packet format of the packet to be processed.
[0093] In one example, the data packet includes a header, which contains an extended field whose value can be used to indicate whether the data packet is an error correction packet or a business packet.
[0094] Optionally, the value of the extended field can include binary bits 0 or 1. If the value of the extended field is 0, it indicates that the message to be processed is an error correction message; if the value of the extended field is 1, it indicates that the message to be processed is a business message. Alternatively, if the value of the extended field is 1, it indicates that the message to be processed is an error correction message; if the value of the extended field is 0, it indicates that the message to be processed is a business message.
[0095] In another example, the data packet includes a header, which may or may not include preset fields.
[0096] If the header of the message to be processed includes a preset field, it means that the message to be processed is an error correction message; if the header does not include the preset field, it means that the message to be processed is a business message.
[0097] Optionally, the default field can be a field of Ethernet type 0x9F00 or other fields, without restriction.
[0098] Based on the above description, in one example, the message structure of an error correction message can be as follows: Figure 3B As shown, the error correction message includes an error correction identifier of Ethernet type 0x9F00, which can be located before the payload of the original service message. The error correction message may also include a destination MAC address field (DMAC) and a source MAC address field (SMAC). It is understood that the error correction identifier may also be located in other fields, and this application embodiment does not limit the specific field position of the error correction identifier.
[0099] S303. Correct errors in multiple forwarding tables based on error correction messages.
[0100] If the message to be processed is an error-correction message, the routing and forwarding device corrects multiple forwarding tables based on the error-correction message. For example, the error correction process can be as follows: Using the destination address of the error-correction message as an index, multiple forwarding tables are queried to determine the target forwarding table entry corresponding to the destination address of the error-correction message in each forwarding table. Then, the multiple target forwarding table entries are compared, and the content of the few different target forwarding table entries is modified using the content of the majority of identical target forwarding table entries to maintain consistency across the multiple target forwarding table entries. This avoids errors in forwarding table entries stored in individual forwarding tables, thereby improving the reliability of the forwarding tables.
[0101] S304. Read the first forwarding table and forward the service class message according to the first forwarding table entry corresponding to the destination address of the service class message in the first forwarding table.
[0102] If the message to be processed is a service-type message, the routing and forwarding device forwards it. During forwarding, the routing and forwarding device simply reads a forwarding table stored in a storage location. Specifically, the routing and forwarding device reads the first forwarding table, matches it with the first forwarding table entry corresponding to the destination address of the service-type message, and then processes the service-type message based on the content of the first forwarding table entry before forwarding it to the corresponding next-hop address. For example, the storage of the routing and forwarding device also includes ECC codes. ECC codes achieve error detection and correction by adding redundant information to the data bits. ECC codes can perform a "correction 1, detection 2" function, meaning that an error in one bit of stored data can be corrected, and an error in two bits can be detected. Therefore, when forwarding service-type messages, after reading the forwarding table entries, the routing and forwarding device can also determine whether each forwarding table entry is erroneous based on its ECC code. If an error is found, the routing and forwarding device needs to read another forwarding table. If no error is found, the service-type message is processed and forwarded based on the forwarding table entry. This further improves the accuracy of forwarding business-related messages.
[0103] Based on the above description, in this embodiment, the packet forwarding process and the forwarding table entry error correction process are decoupled. The routing and forwarding device uses error-correcting packets to detect and correct errors in the forwarding table entries of multiple stored forwarding tables, thereby maintaining the forwarding table entries, improving the data reliability of the forwarding table, and consequently improving the reliability of packet forwarding. When forwarding service-type packets, the forwarding plane unit of the routing and forwarding device only needs to query one of the multiple forwarding tables. After finding the first forwarding table entry corresponding to the destination address of the packet to be forwarded in that forwarding table, the packet to be forwarded is directly forwarded according to the first forwarding table entry. This eliminates the need for error detection and correction of the forwarding table entries before forwarding, greatly reducing the forwarding time of the packet to be forwarded. In this way, both the reliability of packet forwarding and the efficiency of packet forwarding are guaranteed, greatly improving the forwarding performance of the forwarding plane unit.
[0104] Optionally, in this application, after receiving a business-type message, an error-correction message can be copied from the business-type message. Then, the forwarding table is corrected based on the error-correction message, instead of correcting the forwarding table based on the business-type message itself. Instead, the business-type message is forwarded simultaneously with the copied error-correction message, so that an error-correction message is generated during the forwarding of the business-type message without affecting its forwarding. The following section will illustrate this further. Figure 4 right Figure 3A The forwarding process of the service-type message shown in S304 of the illustrated embodiment is described in detail. Figure 4 This is a flowchart illustrating the forwarding method for service-type messages shown in an embodiment of this application, as follows: Figure 4 As shown, the forwarding method for business-type messages includes the following steps:
[0105] S401. Receive service-type messages and put the received service-type messages into the first data message queue.
[0106] In this embodiment, the routing and forwarding device needs to forward data packets in the communication network. The data packets transmitted in the communication network are service-type packets, which need to be forwarded from the source address to the destination address. Each time the routing and forwarding device receives a service-type packet, it needs to buffer it in the first data packet queue. Understandably, the first data packet queue is the ordered message queue, and the routing and forwarding device needs to process the service-type packets in the ordered message queue sequentially to ensure the orderly forwarding of service-type packets.
[0107] S402. Read business-type messages from the first data message queue.
[0108] The routing and forwarding device reads the packets to be processed, i.e. service packets, sequentially from the first data packet queue. Before forwarding a service packet, it needs to determine whether to copy the service packet. The purpose of copying the service packet is to obtain error correction packets.
[0109] S403. Determine whether to replicate business-type messages based on the replication policy. If replication is required, proceed to S404; otherwise, proceed directly to S406.
[0110] Specifically, the routing and forwarding device needs to determine whether to replicate the currently read service-type packets based on the replication policy. The replication policy is described below:
[0111] In this application, the replication strategy can be used to specify under what circumstances service-type packets are replicated and under what circumstances they are not replicated. It is understood that the purpose of replicating service-type packets is to obtain error-correction packets, so the replication strategy will affect the number of error-correction packets. Error-correction packets are used for error detection and correction of forwarding table entries, and the number of error-correction packets will affect the frequency with which the routing and forwarding device performs error detection and correction on forwarding table entries. A higher error detection and correction frequency results in higher reliability of the forwarding table, but also consumes more processing resources. Therefore, the replication strategy needs to be formulated based on actual reliability requirements. Several implementation methods of the replication strategy are shown below:
[0112] Example 1: Replication can be performed at a preset frequency. For example, the routing and forwarding device reads service-type packets from the data packet queue, and copies the next service-type packet read after reading 10 service-type packets.
[0113] Example 2: A probabilistic algorithm can be used to determine whether to copy the read business-type message. The probabilistic algorithm in this application refers to an algorithm that uses random numbers and probability statistics to determine whether to copy the business-type message after it has been read. The probabilistic algorithm is described in detail below:
[0114] Specifically, the routing and forwarding device includes a sampling memory that stores a pre-set digital threshold and a preset digital range, wherein the digital threshold is within the preset digital range.
[0115] After the routing and forwarding device reads a service-type packet, it first generates a random number, which is within a preset numerical range. Then, it compares the random number with a numerical threshold to determine whether to copy the currently read service-type packet.
[0116] In one example, if the random number is greater than a numerical threshold, then the business message is copied; if the random number is less than or equal to the numerical threshold, then the business message is not copied. For instance, if the preset number range is 1-100 and the numerical threshold is 50, then the probability of the generated random number being greater than 50 is 50%, and the probability of it being less than or equal to the numerical threshold is 50%. Thus, the probability of the business message being copied is 50%, and the probability of it not being copied is also 50%.
[0117] In another example, if the random number is greater than a numerical threshold, the business message will not be copied; if the random number is less than or equal to the numerical threshold, the business message will be copied. For instance, if the preset number range is 1-100 and the numerical threshold is 40, then the probability of the generated random number being greater than 40 is 60%, and the probability of it being less than or equal to 40 is 40%. Thus, the probability of the business message being copied is 40%, and the probability of it not being copied is 60%.
[0118] Understandably, in Example 2, the probability of a business-type message being copied determines the number of subsequent error-correction messages generated. The number of error-correction messages determines the frequency at which the routing and forwarding device checks and corrects errors in the forwarding table. The frequency at which the routing and forwarding device checks and corrects errors in the forwarding table determines the reliability of the forwarding table, which in turn affects the forwarding performance of the routing and forwarding device. Therefore, it is necessary to flexibly design the digital threshold according to the actual forwarding performance requirements.
[0119] S404. Copy service-type messages to obtain copied messages.
[0120] If the replication strategy determines that the currently read business-type message should be replicated, then it will be replicated to obtain the replicated message.
[0121] S405. Mark the copied message as an error correction message by adding a marker, and put the marked copied message into the second data message queue.
[0122] Next, the copied message needs to be marked as an error correction message. For example, a marker (i.e., an error correction identifier) can be added to the copied message. Referring to step 302 of the above embodiment, the copied message can be converted into an error correction message by changing the value of the extended field in the message header or by adding a preset field to the message header. Then, the error correction message is added to the second data packet queue. The second data packet queue is a non-order-preserving message queue, meaning that the routing and forwarding device will process the error correction message immediately upon receiving it. After processing the error correction message, the service messages in the first data packet queue are then processed.
[0123] Therefore, the routing and forwarding device processes service-type packets in the first data packet queue sequentially. Upon receiving an error-correction packet, the device immediately processes it, only continuing to process subsequent service-type packets in the first data packet queue after processing the error-correction packet. Thus, the more error-correction packets there are, the longer the processing time for service-type packets in the first data packet queue, and consequently, the longer the forwarding time for those packets. Therefore, the replication strategy needs to be adjusted based on network traffic conditions to control the number of error-correction packets in the data packet queue.
[0124] Based on the replication strategy described in step 403 above, for Example 1, when the network traffic size is the first traffic size, the preset frequency is the first frequency value; when the network traffic size is the second traffic size, the preset frequency is the second frequency value. If the first traffic size is greater than the second traffic size, then the first frequency value is less than the second frequency value. That is, the larger the network traffic, the lower the preset frequency. In other words, in high-traffic scenarios (high-traffic scenarios refer to large-scale service-type packets in the communication network), the routing and forwarding device needs to reduce the replication frequency of service-type packets. This is achieved by reducing the number of error-correcting packets to lower the error detection and correction frequency of the forwarding table. This shortens the waiting time of service-type packets in the data packet queue, increases the forwarding speed of service-type packets, reduces the probability of congestion and packet loss, and improves packet forwarding efficiency.
[0125] Regarding Example 2, if the scenario is "replicating business-type packets when the random number is greater than the numerical threshold, and not replicating business-type packets when the random number is less than or equal to the numerical threshold," the numerical threshold is the first value when the network traffic size is the first size, and the second value when the network traffic size is the second size; where the first size is greater than the second size, the first value is greater than the second value. For example, when the network traffic size is large, with a preset numerical range of 1-100, the numerical threshold can be 50. Therefore, the probability of a random number greater than 50 is 50%, and the probability of business-type packets being replicated is also 50%. When the network traffic size is small, the numerical threshold can be reduced to 40, resulting in a 60% probability of a random number greater than 40, and thus a 60% probability of business-type packets being replicated. Compared to small-traffic scenarios, the probability of business-type packets being replicated is lower in large-traffic scenarios, resulting in fewer error-correction packets. This reduces the waiting time of business-related messages in the data packet queue, resulting in faster forwarding speeds. This reduces the probability of congestion and packet loss, and improves message forwarding efficiency.
[0126] Similarly, in the scenario where "no business-type packets are copied if the random number is greater than the numerical threshold, and business-type packets are copied if the random number is less than or equal to the numerical threshold," the numerical threshold is the third value when the network traffic size is the third size, and the fourth value when the network traffic size is the fourth size; where the third size is greater than the fourth size, and the third value is less than the fourth value. For example, when the network traffic size is large, with a preset numerical range of 1-100 and a numerical threshold of 50, the probability of a random number being less than or equal to 50 is 50%, and the probability of business-type packets being copied is also 50%. However, when the network traffic size is small, the numerical threshold is increased to 60, so the probability of a random number being less than or equal to 60 is 60%, and the probability of business-type packets being copied is also 60%. Compared to small-traffic scenarios, the probability of business-type packets being copied is lower in large-traffic scenarios, resulting in fewer error-correction packets. This reduces the waiting time of business-related messages in the data packet queue, resulting in faster forwarding speeds. This reduces the probability of congestion and packet loss, and improves message forwarding efficiency.
[0127] S406, Forwarding business-related messages.
[0128] Because the forwarding process for service-type packets and the error correction process for error-correction packets are decoupled, the routing and forwarding device only needs to randomly access one of multiple storage locations when forwarding service-type packets. Specifically, the routing and forwarding device queries the first forwarding table at the first storage location. For example, it queries the first forwarding table entry corresponding to the destination address of the service-type packet using the destination address as the index. Then, based on the content of the first forwarding table entry, it processes and forwards the packet to be forwarded. It can be understood that in this embodiment, the routing and forwarding device only looks up the table once when forwarding service-type packets, greatly shortening the packet processing time and improving packet forwarding efficiency.
[0129] The packet forwarding method in the above embodiments is described below in conjunction with the hardware structure:
[0130] Figure 5 This is a flowchart illustrating another service-type packet forwarding method provided in this application embodiment. It is understood that the processing of service-type packets is performed by the forwarding plane unit of the routing and forwarding device. The forwarding plane unit operates in a multi-threaded mode, with each forwarding thread processing one service-type packet at a time, and multiple forwarding threads processing a batch of service-type packets in parallel. After processing the service-type packets, the multiple forwarding threads need to forward the service-type packets sequentially according to their forwarding order. Only after this batch of service-type packets has been forwarded can the next batch of service-type packets be received and processed.
[0131] like Figure 5As shown, for a forwarding thread, the process of processing a business-type message may include the following steps:
[0132] S501, the forwarding thread reads the digital threshold and preset digital range from the sampling register.
[0133] First, before processing service-type packets, the forwarding thread reads the digital threshold and preset digital range from the sampling register in the routing forwarding device. The digital threshold is within the preset digital range.
[0134] S502, the forwarding thread generates random numbers.
[0135] Then, the forwarding thread generates a random number, which is also within a preset number range.
[0136] S503, the forwarding thread determines the random number and the size of the number threshold.
[0137] Next, the forwarding thread compares the random number with the numerical threshold. This comparison determines whether the forwarding thread should copy the currently processed business message.
[0138] S504. If the random number is less than the numerical threshold, the forwarding thread copies the business-type message to obtain the error correction message.
[0139] In one example, if the random number is less than a numerical threshold, the forwarding thread needs to copy the business-type message. This copying aims to generate error-correcting messages. The forwarding thread can mark the copied message as an error-correcting message by adding a flag, and then put the obtained error-correcting message back into the data packet queue.
[0140] S505, the forwarding thread reads the first forwarding table from multiple forwarding tables.
[0141] Then, the forwarding thread forwards the original business-type message. During forwarding, the forwarding thread only needs to query a forwarding table in one storage location; for example, it queries the first forwarding table entry corresponding to the destination address of the business-type message, using the destination address as the index. This first forwarding table entry indicates the forwarding path of the business-type message.
[0142] S506. The forwarding thread forwards the business class message according to the first forwarding table entry corresponding to the destination address of the business class message, and completes the processing of the business class message.
[0143] Then, the forwarding thread processes the service-type packet according to the first forwarding table entry and forwards it. In this way, the forwarding thread completes the processing of the service-type packet. It can be understood that in this embodiment, the routing and forwarding device only looks up the table once when forwarding service-type packets, greatly shortening the packet processing time and improving packet forwarding efficiency.
[0144] Based on the above description, the following is... Figure 3A The process of correcting multiple forwarding tables based on error correction messages, as described in S303 of the illustrated embodiment, is described in detail. Figure 6 A flowchart illustrating the error correction method for forwarding entries provided in this application embodiment is shown below. Figure 6 As shown, the error correction method for forwarded entries includes the following steps:
[0145] S601, Read error correction messages.
[0146] In conjunction with the above embodiments, if the routing and forwarding device obtains an error correction message after copying a service-type message, it places the error correction message into the non-order-preserving message queue and immediately processes it, entering the forwarding table entry error correction process. Specifically, multiple forwarding tables are corrected based on the error correction message to improve the data accuracy of the forwarding tables.
[0147] S602. Query multiple forwarding tables stored in multiple storage locations to determine multiple second forwarding table entries corresponding to the destination address of error correction messages in the multiple forwarding tables.
[0148] Specifically, the routing and forwarding device can use the destination address of the error-correcting packet as an index to query each forwarding table stored in multiple locations, determining the second forwarding table entry corresponding to the destination address of the error-correcting packet in each forwarding table. Understandably, if the contents of the second forwarding table entries in multiple forwarding tables are identical, it means that the multiple forwarding tables are error-free. However, if inconsistent second forwarding table entries appear, it indicates a problem with the forwarding table storage. Therefore, by comparing multiple second forwarding table entries, errors can be detected and corrected in multiple forwarding tables.
[0149] S603. Compare multiple second forwarding entries to obtain the comparison results.
[0150] Understandably, the comparison results are used to detect and correct errors in multiple second-level forwarding table entries. The comparison results include cases where all second-level forwarding table entries are the same, all second-level forwarding table entries are different, and some second-level forwarding table entries are the same. Taking the three-stage mock exam (three forwarding tables) as an example, the comparison results include cases where all three stages are consistent, only two stages are consistent, and all three stages are inconsistent.
[0151] S604. Based on the comparison results, check and correct errors in the second forwarding entries of multiple forwarding tables.
[0152] The following explains how to detect and correct errors based on different scenarios of the comparison results:
[0153] 1) Multiple second-level forwarded entries are identical;
[0154] If multiple queries to various forwarding tables yield the same second forwarding table entries, it indicates that the forwarding tables are correct and can be left as is.
[0155] 2) Multiple second forwarding entries include first and second entries; wherein the number of first entries is greater than the number of second entries, and the content of the first entries is different from the content of the second entries;
[0156] This situation arises when some second-level forwarding table entries are identical. If multiple queries retrieved from various forwarding tables yield multiple second-level forwarding table entries, some of which are identical and others are different, it indicates an error in the stored forwarding table. In this case, the "majority vote" principle must be followed, modifying the fewer second-level entries based on the content of the more numerous first-level entries. Specifically, the content of the second-level entries in each forwarding table needs to be modified to match the content of the first-level entries. Taking a three-mode model as an example, if two modes are consistent and one mode is inconsistent, then the content of the inconsistent entry needs to be flushed back with the content of the consistent entry to ensure consistency across all three modes.
[0157] 3) Multiple second-line headings are different;
[0158] If the contents of all the second forwarding table entries are inconsistent, it becomes impossible to determine which entry is correct. In this case, a new forwarding table entry needs to be issued to replace the old second forwarding table entry. This ensures the accuracy of the forwarding table data, and forwarding data packets based on a highly accurate forwarding table improves the reliability of data packet forwarding.
[0159] S605, Delete error correction messages.
[0160] Understandably, after reading an error-correcting packet from the second data packet queue, the routing and forwarding device places it in the processing buffer for subsequent error detection and correction processing. After the error detection and correction processing is complete, the routing and forwarding device deletes the error-correcting packet from the processing buffer and does not forward it. In other words, error-correcting packets are only used for error detection and correction of forwarding table entries and do not affect the transmission of service packets in the communication network. In this embodiment, using error detection and correction of forwarding table entries with error-correcting packets can quickly and concisely correct errors in forwarding table entries, avoiding continuous error-prone forwarding loops, greatly improving the reliability of packet forwarding and enhancing the robustness of the communication system.
[0161] The error correction method for forwarding table entries in the above embodiments is described below in conjunction with the hardware structure:
[0162] exist Figure 6In the illustrated embodiment, the step of querying multiple forwarding tables based on error-correcting messages is performed by the forwarding plane unit of the routing forwarding device. The step of detecting and correcting errors in the forwarding table entries of the multiple forwarding tables based on the query results can be performed by either the forwarding plane unit or the control plane unit of the routing forwarding device. Based on this, this application provides... Figure 7 and Figure 8A The two embodiments shown are illustrated. It is understood that... Figure 7 and Figure 8A Both embodiments shown take three-mode (three copies of the forwarding table) as an example. In practical applications, the situation of multiple copies of the forwarding table is similar to that of three-mode. The embodiments of this application do not limit the specific number of multiple copies of the forwarding table.
[0163] Figure 7 This is a flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application. For example... Figure 7 As shown, the error correction process of the forwarding plane unit's error correction thread, after reading the error correction class message, includes the following steps based on the error correction class message forwarding table entries:
[0164] S701, the error correction thread queries three forwarding tables to obtain three model table entries.
[0165] The forwarding plane unit operates in a multi-threaded mode, processing service-type packets in the first data packet queue sequentially. For a single thread, after copying an error-correction packet from a service-type packet, the original service-type packet is processed and forwarded first, and then the error-correction packet is processed immediately. The thread currently processing the error-correction packet is called the error-correction thread. The error-correction thread can query multiple forwarding tables using the destination address of the error-correction packet as an index. In this embodiment, the error-correction thread needs to query three forwarding tables to determine the corresponding entry for the destination address of the error-correction packet in each table, thus obtaining a three-level table entry.
[0166] S702, the error correction thread determines whether the three-mode table entries are consistent.
[0167] The error correction thread compares the three-dimensional table entries and performs error detection and correction on the three-dimensional table entries based on the comparison results.
[0168] S703. If only two of the three modular entries are consistent, the error correction thread corrects the inconsistent forwarding entries in the three forwarding tables.
[0169] If only two of the three modular entries are consistent, the inconsistent forwarding entries are determined to be erroneous entries according to the "majority vote" principle. Then, the content of the inconsistent forwarding entries in the forwarding table is corrected to the content of the consistent entries.
[0170] S704. If the three model entries are inconsistent, the error correction thread sends the first exception notification to the control plane unit.
[0171] If the three table entries are inconsistent, the error correction thread cannot determine which forwarding table entry is wrong. In this case, the error correction thread sends a first exception notification to the control plane unit, which is used to instruct the control plane unit to reissue a new table entry.
[0172] S705, The forwarding adapter instructs the component that issues the forwarding entry to reissue multiple new forwarding entries.
[0173] The control plane unit executes the forwarding adaptation procedure. Upon receiving the first exception notification, the forwarding adaptation procedure instructs the component that issued the forwarding table entry to reissue multiple new forwarding table entries.
[0174] S706, The forwarding adapter program reissues multiple new forwarding entries to the forwarding plane unit.
[0175] The forwarding adaptation program sends the new forwarding table entries to the forwarding plane unit. The forwarding plane unit updates the stored forwarding table, replacing the old three-mode table entries in the forwarding table with the new forwarding table entries.
[0176] S707. The error correction thread completes the processing of error correction messages and discards them.
[0177] Figure 8A This is a flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application. For example... Figure 8A As shown, the error correction process of the forwarding plane unit's error correction thread after reading the error correction class message includes the following steps based on the error correction class message forwarding table entry:
[0178] S801, the error correction thread reads three copies of the forwarding table and obtains three modular table entries.
[0179] Understandably, the S801 and Figure 7 S701 in the illustrated embodiment is similar and will not be described in detail here.
[0180] S802. When the three-mode entries are not completely consistent, the error correction thread sends a second exception notification to the control plane unit.
[0181] When the error correction thread determines that the three forwarding table entries are inconsistent, it needs to report the inconsistency to the control plane unit via a second exception notification. For example, the second exception notification can also carry the destination address information of the error correction message, enabling the control plane unit to query the three forwarding tables using the destination address of the error correction message as an index.
[0182] S803, the forwarding adapter queries three forwarding tables to obtain three model entries.
[0183] The control plane unit runs the forwarding adaptation program, queries the three forwarding tables stored in the forwarding plane unit, and obtains the forwarding table entry corresponding to the destination address of error-correcting packets in each forwarding table, thus obtaining the three-mode table entries. Then, the forwarding adaptation program compares the three-mode table entries and performs error detection and correction on the three-mode table entries based on the comparison results.
[0184] S804. If only two of the three forwarding entries are consistent, the forwarding adaptation procedure corrects the inconsistent forwarding entries in the three forwarding tables.
[0185] If only two of the three modular entries are consistent, the forwarding adaptation program determines the inconsistent forwarding entries as erroneous entries based on the "majority vote" principle, and then corrects the content of the inconsistent forwarding entries in the forwarding table to the content of the consistent entries.
[0186] S805. If the three-mode entries are inconsistent, the forwarding adapter program instructs the component that issues the forwarding entries to reissue multiple new forwarding entries.
[0187] If the three forwarding entries are inconsistent, the forwarding adapter cannot determine which forwarding entry is incorrect. In this case, the forwarding adapter instructs the component that issues the forwarding entry to reissue multiple new forwarding entries.
[0188] S806, The forwarding adapter program reissues multiple new forwarding entries to the forwarding plane unit.
[0189] The forwarding adaptation program sends the new forwarding table entries to the forwarding plane unit. The forwarding plane unit updates the stored forwarding table, replacing the old three-mode table entries in the forwarding table with the new forwarding table entries.
[0190] S807. The error correction thread completes the processing of error correction messages and discards them.
[0191] Understandably, the error detection and correction methods of the control plane unit are similar to those of the forwarding plane unit, only the executing entity differs. In practical applications, this application embodiment does not specifically limit the executing entity.
[0192] The forwarding performance of the routing and forwarding device depends on the forwarding performance of the forwarding plane unit. The forwarding performance of the forwarding plane unit, in turn, depends on the number of threads, and specifically the number of forwarding threads and error-correcting threads within those threads. Understandably, the more threads a forwarding plane unit has, and the more forwarding threads within those threads, the higher the forwarding efficiency of service-type packets. Therefore, the forwarding plane unit can adjust the number and type of threads according to network traffic volume. Figure 8BAs shown, in high-traffic scenarios, the forwarding adapter determines the number of idle threads within the forwarding plane unit by reading the idle thread register. If the proportion of idle threads to the total number of threads is less than a first preset threshold, such as less than 20%, the total number of threads in the forwarding plane unit can be increased. For example, the hardware implementation of the forwarding plane unit is an NP, which is a multi-core architecture. In the example above, if the forwarding adapter determines that the proportion of idle threads in the NP is less than 20%, it controls the sleeping cores in the NP to exit sleep mode and enter working mode. Simultaneously, the forwarding adapter can also reduce the number of error-correcting threads to further improve the forwarding rate. For example, when the proportion of idle threads to the total number of threads is less than the first preset threshold, the forwarding adapter can reduce the replication probability of service-type packets by adjusting the value of the digital threshold in the sampling register, for example, reducing the replication probability by 10% each time until the replication probability reaches 0. At this point, error-correcting packets are no longer generated, and all threads in the forwarding plane unit are used to forward service-type packets, improving the forwarding efficiency of service-type packets.
[0193] like Figure 8C As shown, in low-traffic scenarios, the forwarding adapter determines the number of idle threads within the forwarding plane unit by reading the idle thread register. If the proportion of idle threads to the total number of threads is greater than a second preset threshold, such as greater than 50%, the total number of threads in the forwarding plane unit can be reduced. For example, some NP cores can be controlled to sleep. Furthermore, the forwarding adapter can increase the number of error-correcting threads within the threads, thereby improving the accuracy of the forwarding table entries. For example, the forwarding adapter can increase the replication probability of service-type packets by adjusting the numerical threshold in the sampling register, for example, increasing the replication probability by 10% each time until the replication probability reaches 100%. At this point, the forwarding plane unit does not receive new service-type packets but instead corrects errors in the forwarding table entries. Based on the above description, in this embodiment, the routing and forwarding device can also periodically perform a full scan of multiple forwarding tables to detect and correct errors in the forwarding table entries. Understandably, this error detection and correction method is continuously running and does not rely on the forwarding of service-type packets for triggering. That is, even when the routing and forwarding device is not forwarding service-type packets, it continuously checks and corrects errors on the multiple stored forwarding tables. Because this method performs full-coverage error detection and correction on all forwarding entries in the forwarding tables, its error detection and correction time is very long. Therefore, this method is usually used as described above. Figures 6 to 8A The above is a supplementary scheme for detecting and correcting errors in the forwarding table entries corresponding to error correction messages, which further improves the accuracy of the stored forwarding table data and thus improves the reliability of message forwarding.
[0194] Figure 9 This is a flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application. For example... Figure 9 As shown, the error correction method includes the following steps:
[0195] S901: Periodically scan multiple forwarding tables stored in multiple storage locations.
[0196] Specifically, the routing and forwarding device can periodically scan all forwarding table entries, performing error correction and detection on multiple forwarding table copies. Understandably, a full scan of all forwarding table entries, triggered continuously without relying on forwarding services, can further ensure the data reliability of the multiple forwarding table copies stored by the forwarding plane unit. Understandably, accessing each forwarding table entry sequentially can achieve silent fault repair.
[0197] S902. Identify erroneous entries in multiple forwarding tables.
[0198] During error detection and correction, the routing and forwarding device needs to identify erroneous entries in multiple forwarding tables. An erroneous entry refers to a set of forwarding table entries with the same index but different content across multiple tables. The routing and forwarding device needs to update these erroneous entries to ensure consistency across the multiple forwarding tables.
[0199] S903. Compare each entry in the error table to obtain the comparison results.
[0200] Understandably, the error detection and correction methods are the same as those mentioned above. Figures 6 to 8A The content described in the illustrated embodiments is similar. First, multiple erroneous entries are compared, potentially resulting in either partial agreement or complete discrepancy. Then, error detection and correction are performed based on these two comparison results.
[0201] S904. Correct the erroneous entries based on the comparison results.
[0202] Specifically, if the routing and forwarding device determines that the erroneous entries are partially consistent, then the device needs to follow the "majority vote" principle and modify the content of the fourth entry (which has fewer entries) based on the content of the third entry (which has more entries) in the erroneous entries. Taking a three-mode system as an example, if two modes are consistent and one mode is inconsistent, then the content of the inconsistent forwarding entries needs to be flushed back with the content of the consistent forwarding entries to ensure consistency across all three modes.
[0203] If the routing and forwarding device determines that each entry in the erroneous table is different, it means that each stored entry is unreliable. In this case, multiple new forwarding table entries need to be redistributed to replace the erroneous entries in the forwarding table, so as to ensure the reliability of the forwarding table data.
[0204] The following section will discuss the hardware structure. Figure 9 The error correction method for forwarding entries in the illustrated embodiment is described as follows: In Figure 9In the illustrated embodiment, the step of periodically scanning multiple forwarding tables is performed by the forwarding plane unit of the routing forwarding device. The step of correcting erroneous entries can be performed by either the forwarding plane unit or the control plane unit of the routing forwarding device. Based on this, this application provides... Figure 10 and Figure 11A The two embodiments shown are illustrated. It is understood that... Figure 10 and Figure 11A Both embodiments shown take three-mode (three copies of the forwarding table) as an example. In practical applications, the situation of multiple copies of the forwarding table is similar to that of three-mode. The embodiments of this application do not limit the specific number of multiple copies of the forwarding table.
[0205] Figure 10 This is a flowchart illustrating another forwarding entry error correction process provided in an embodiment of this application. For example... Figure 10 As shown, the forwarding plane unit operates in a multi-threaded mode. Therefore, before executing packet forwarding tasks, the control plane unit can deploy at least one background error correction thread for the forwarding plane unit. This background error correction thread performs periodic scans of multiple forwarding tables. Simultaneously, a scan range table needs to be deployed for each background error correction thread. The scan range table is used to partition the forwarding table. The background error correction thread can determine the scan range within the forwarding table based on the scan range table. Understandably, each background error correction thread only needs to periodically scan a portion of the forwarding table entries, and all background error correction threads collectively achieve a full scan of the forwarding table. The scan range table can include the number of tables, the starting address of a single table, the width of a single table entry, and the total number of single table entries. In this way, by deploying the scan range table, the scan range can be partitioned for all background error correction threads.
[0206] The background error correction thread in the forwarding plane unit runs continuously, periodically scanning the forwarding table entries within the scan range. For a single scan, the forwarding table entry error correction process includes the following steps:
[0207] S1001, Background error correction thread reads the scan range table.
[0208] The background error correction thread reads the scan range table to determine the scan range.
[0209] S1002, The background error correction thread reads the forwarding table entries within the scan range and obtains the three-mode table entries.
[0210] The background error correction thread periodically scans multiple forwarding tables to identify forwarding table entries with the same index within the scan range, thus obtaining three-mode table entries.
[0211] S1003, The background error correction thread determines whether the three-mode table entries are consistent.
[0212] The background error correction thread compares the three-dimensional model entries and determines whether an entry is erroneous based on the comparison results. Understandably, if the three-dimensional model entries match, then the entries are not erroneous. If they do not match, then the entries are erroneous.
[0213] S1004. If only two of the three modular entries are consistent, the background error correction thread corrects the inconsistent forwarding entries in the three forwarding tables.
[0214] If only two of the three modular entries are consistent, the inconsistent entries in the forwarding table will be corrected to consistent entries according to the "majority vote" principle.
[0215] S1005. If the three model entries are inconsistent, the background error correction thread sends a third exception notification to the control plane unit.
[0216] If the three table entries are inconsistent, the background error correction thread cannot determine which forwarding table entry is wrong. At this time, the background error correction thread sends a third exception notification to the control plane unit, which is used to instruct the control plane unit to reissue a new table entry.
[0217] S1006, The forwarding adapter instructs the component that issues the forwarding entry to reissue multiple new forwarding entries.
[0218] The control plane unit executes the forwarding adaptation procedure. Upon receiving the third exception notification, the forwarding adaptation procedure instructs the component that issued the forwarding table entry to reissue multiple new forwarding table entries.
[0219] S1007. The forwarding adaptation procedure reissues multiple new forwarding entries to the forwarding plane unit.
[0220] The forwarding adaptation program sends the new forwarding table entries to the forwarding plane unit. The forwarding plane unit updates the stored forwarding table, replacing the old three-mode table entries in the forwarding table with the new forwarding table entries.
[0221] Figure 11A This is a flowchart illustrating another method for correcting forwarding entries provided in an embodiment of this application. For example... Figure 11A As shown, when the background error correction thread periodically scans the forwarding table, the error correction steps for erroneous entries can also be executed by the control plane unit. Thus, the error correction process for forwarding table entries includes the following steps:
[0222] S1101, Background error correction thread reads the scan range table.
[0223] For example, such as Figure 11BAs shown, when the forwarding plane unit starts the message processing flow, it can first deploy multiple forwarding table entries, then determine the scan range table for each background error correction thread, and then deploy and start the background error correction thread. In addition, the preset digital range and digital threshold in the sampling register can be set.
[0224] S1102, The background error correction thread reads the forwarding table entries within the scan range and obtains the three-mode table entries.
[0225] S1103. When the three-mode entries are not completely consistent, the background error correction thread sends a fourth exception notification to the control plane unit.
[0226] When the background error correction thread determines that the three-mode table entries are inconsistent, it needs to report the inconsistency to the control plane unit via a fourth exception notification. For example, the fourth exception notification can also carry the index of the three-mode table entries, allowing the control plane unit to query the three forwarding tables based on the index.
[0227] S1104. The forwarding adapter queries three forwarding tables to obtain three model entries.
[0228] The control plane unit runs the forwarding adaptation program, queries the three forwarding tables stored in the forwarding plane unit, and obtains the three-mode table entries. Then, the forwarding adaptation program compares the three-mode table entries and determines whether the three-mode table entries are erroneous based on the comparison results.
[0229] S1105. If only two of the three forwarding entries are consistent, the forwarding adaptation procedure corrects the inconsistent forwarding entries in the three forwarding tables.
[0230] If only two of the three template entries are consistent, the forwarding adaptation program will correct the inconsistent forwarding entries to the consistent entries based on the "majority vote" principle.
[0231] S1106. If the three-mode table entries are inconsistent, the forwarding adapter program instructs the component that issues the forwarding table entries to reissue multiple new forwarding table entries.
[0232] If the three forwarding entries are inconsistent, the forwarding adapter cannot determine which forwarding entry is incorrect. In this case, the forwarding adapter instructs the component that issues the forwarding entry to reissue multiple new forwarding entries.
[0233] S1107. The forwarding adapter program reissues multiple new forwarding entries to the forwarding plane unit.
[0234] The forwarding adaptation program sends the new forwarding table entries to the forwarding plane unit. The forwarding plane unit updates the stored forwarding table, replacing the old three-mode table entries in the forwarding table with the new forwarding table entries.
[0235] Understandably, the background error correction thread does not rely on forwarding services for triggering. It detects and corrects errors by scanning each entry in the table. This ensures that all forwarding entries are covered, achieving silent fault repair and further improving the reliability and stability of the communication system.
[0236] In one implementation, to avoid incorrect error correction, the control plane unit can pause the error correction thread and background error correction thread of the forwarding plane unit when redistributing forwarding table entries. Figure 12 This is a flowchart illustrating a method for distributing forwarding table entries as provided in an embodiment of this application. Figure 12 As shown, the distribution process includes the following steps:
[0237] S1201, The component that issues forwarding entries issues new forwarding entries to the forwarding adapter.
[0238] For example, the component that sends forwarding entries sends new forwarding entries according to the instructions of the forwarding adapter.
[0239] S1202, The forwarding adapter sets the digital threshold in the sampling register.
[0240] In one implementation, the forwarding adapter can pause the generation of error-correcting packets by setting a numerical threshold in the sampling register, thereby pausing the error-correction thread. For example, if the preset numerical range is 1-100, and packets smaller than the preset threshold require copying of business packets to generate error-correcting packets, then the numerical threshold can be adjusted to 0. If the preset numerical range is 1-100, and packets larger than the preset threshold require copying of business packets to generate error-correcting packets, then the numerical threshold can be adjusted to 100.
[0241] S1203, Forwarding Adapter Instruction Thread Pause Register pauses background error correction thread.
[0242] S1204. The forwarding adapter program reissues multiple new forwarding entries to the forwarding plane unit.
[0243] S1205, Forwarding Adapter Instruction Thread pauses register to resume background error correction thread.
[0244] S1206. The forwarding adapter restores the digital threshold in the sampling register to resume the error correction thread.
[0245] To complement the message forwarding method and forwarding table entry error correction method provided in the embodiments of this application, the embodiments of this application also provide a routing forwarding device 1300, which is used to execute the above-mentioned message forwarding method and forwarding table entry error correction method. Figure 13 As shown, the routing forwarding device 1300 includes:
[0246] The acquisition unit 1301 is used to read the message to be processed.
[0247] The processing unit 1302 is used to correct multiple forwarding tables according to the error correction type message if the message to be processed is an error correction type message, wherein the multiple forwarding tables are stored in multiple storage locations.
[0248] Processing unit 1302 is further configured to, if the message to be processed is a service-type message, read the first forwarding table and forward the service-type message according to the first forwarding table entry corresponding to the destination address of the service-type message. The first forwarding table is one of multiple forwarding tables.
[0249] In an optional implementation, the acquisition unit 1301 is specifically used to read messages to be processed from a data message queue. The data message queue includes multiple messages to be processed, which include error correction messages and / or service messages. Error correction messages are obtained by adding a marker to a copied message obtained from a service message; the marker indicates that the message containing the marker is an error correction message.
[0250] In one optional implementation,
[0251] The acquisition unit 1301 is specifically used to read business-type messages from the first data message queue.
[0252] Processing unit 1302 is further configured to determine whether to copy service-type messages based on the copying strategy. If it is determined that service-type messages should be copied, then the service-type messages are copied to obtain copied messages. The copied messages are marked as error-correction messages by adding a flag, and the marked copied messages are placed in the second data message queue.
[0253] In an optional implementation, the processing unit 1302 is further configured to delete error correction messages.
[0254] In an optional implementation, the processing unit 1302 is specifically configured to generate a random number after the receiving unit 1303 receives a service-type message. Based on the relationship between the random number and a numerical threshold, it determines whether to copy the service-type message. Both the random number and the numerical threshold are within a preset numerical range.
[0255] In an optional implementation, processing unit 1302 is specifically configured to copy service-type messages if the random number is greater than a numerical threshold, and not copy service-type messages if the random number is less than or equal to the numerical threshold.
[0256] In an optional implementation, processing unit 1302 is specifically configured to copy service-type messages if the random number is less than or equal to a numerical threshold, and not copy service-type messages if the random number is greater than the numerical threshold.
[0257] In one optional implementation, when the network traffic volume is a first traffic volume, the digital threshold is a first value. When the network traffic volume is a second traffic volume, the digital threshold is a second value. Wherein, the first traffic volume is greater than the second traffic volume, and the first value is greater than the second value.
[0258] In one optional implementation, when the network traffic size is a third traffic size, the digital threshold is a third value. When the network traffic size is a fourth traffic size, the digital threshold is a fourth value. Wherein, the third traffic size is greater than the fourth traffic size, and the third value is less than the fourth value.
[0259] In an optional implementation, the routing and forwarding device includes a sampling memory, in which a preset digital range and a digital threshold are stored.
[0260] In an optional implementation, the processing unit 1302 is further configured to periodically scan multiple forwarding tables stored in multiple storage locations, identify multiple erroneous entries in the multiple forwarding tables, and correct the multiple erroneous entries in the multiple forwarding tables.
[0261] It should be understood that the above Figure 13 The routing and forwarding device described above is only an example of the functional modules used to illustrate its functions. In practical applications, these functions can be assigned to different functional modules as needed, meaning the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the device and method embodiments provided in the above examples belong to the same concept; their specific implementation processes are detailed in the method embodiments and will not be repeated here.
[0262] like Figure 14 The diagram shown is a schematic diagram of the structure of a routing and forwarding device according to the above embodiments provided in this application. The device, as a network device or a chip in a network device, includes: a processor 1411, a memory 1412, a communication interface 1413, and a bus 1414. The processor 1411, the memory 1412, and the communication interface 1413 are connected through the bus 1414.
[0263] The processor 1411 is used for motion control and management of the device. In one possible embodiment, the processor 1411 can be used to support the device in receiving one or more steps S301 to S304 in the above method embodiments, and / or other technical processes described herein. The communication interface 1413 is used to support communication of the device, such as supporting communication between the device and a switch.
[0264] In this embodiment, the processor 1411 includes a central processor unit (CPU), a general-purpose processor, a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. Optionally, the processor may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application; or, the processor may be a combination of computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, etc. The bus 1414 includes an address bus, a data bus, a control bus, etc.
[0265] In this embodiment, the memory 1412 includes volatile memory or non-volatile memory, or both. The non-volatile memory includes read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory, etc. The volatile memory includes random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0266] In another embodiment of this application, a chip is provided, the chip including a processor and an interface circuit, the processor and the interface circuit being used to support the chip in performing one or more steps in the method embodiments provided above.
[0267] In another embodiment of this application, a computer-readable storage medium is provided, which stores a computer program or instructions that, when executed, implement one or more steps in the method embodiments provided above.
[0268] In another aspect of this application, a computer program product is provided, comprising: a computer program (or code, or instructions) that, when run, causes a computer to perform one or more steps as described in the method embodiments provided above.
[0269] It is understood that all relevant content of each step involved in the above method embodiments is referenced in the embodiments of the routing and forwarding device, and will not be repeated here.
[0270] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules or units is merely a logical functional division, and in actual implementation, there may be other division methods, such as multiple units or components being combined or integrated into another apparatus, or some features being ignored or not executed.
[0271] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units, meaning it can be located in one place or distributed across multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0272] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium, including various media capable of storing program code such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, are embodied in the form of software products.
[0273] In another embodiment of this application, a readable storage medium is also provided, which stores computer-executable instructions when a device (e.g., a microcontroller, chip, etc.) or processor executes the steps in the above method embodiments.
[0274] In another embodiment of this application, a computer program product is also provided, the computer program product including computer instructions stored in a readable storage medium; at least one processor of the device reads the computer instructions from the readable storage medium, and the at least one processor executes the computer instructions to cause the device to perform the steps in the above method embodiments.
[0275] Finally, it should be noted that the above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A message forwarding method, applied to a routing forwarding device; characterized in that, The method includes: Read the message to be processed; If the message to be processed is an error correction message, then multiple forwarding tables are corrected according to the error correction message; the multiple forwarding tables are stored in multiple storage locations. If the message to be processed is a service message, then the first forwarding table is read, and the service message is processed and forwarded according to the first forwarding table entry corresponding to the destination address of the service message in the first forwarding table; the first forwarding table is one of the multiple forwarding tables.
2. The method according to claim 1, characterized in that, The reading of the message to be processed includes: The message to be processed is read from the data message queue; the error correction message is obtained by adding a marker to the copied message obtained by copying the service message; the marker is used to indicate that the message containing the marker is the error correction message.
3. The method according to claim 2, characterized in that, The method further includes: Read the service-type message from the first data message queue; Determine whether to copy the aforementioned service-type messages based on the replication strategy; If it is determined that the service type message is to be copied, then the service type message is copied to obtain a copied message; The copied message is marked as an error correction message by adding a marker, and the marked copied message is placed in the second data message queue.
4. The method according to any one of claims 1 to 3, characterized in that, After correcting multiple forwarding tables based on the error correction message, the method further includes: Delete the error correction message.
5. The method according to claim 3 or 4, characterized in that, The replication strategy is as follows: After reading the aforementioned business type message, a random number is generated; Based on the relationship between the random number and the numerical threshold, it is determined whether to copy the service type message; both the random number and the numerical threshold are within a preset numerical range.
6. The method according to claim 5, characterized in that, The step of determining whether to copy the service-type message based on the relationship between the random number and the numerical threshold includes: If the random number is greater than the numerical threshold, then the business type message is copied; If the random number is less than or equal to the numerical threshold, the service type message will not be copied.
7. The method according to claim 5, characterized in that, The step of determining whether to copy the service-type message based on the relationship between the random number and the numerical threshold includes: If the random number is less than or equal to the numerical threshold, then the service type message is copied; If the random number is greater than the numerical threshold, the service type message will not be copied.
8. The method according to claim 6, characterized in that, When the network traffic volume is the first traffic volume, the digital threshold is the first value; When the network traffic size is the second traffic size, the digital threshold is the second value; wherein the first traffic size is greater than the second traffic size, and the first value is greater than the second value.
9. The method according to claim 7, characterized in that, When the network traffic volume is the third traffic volume, the digital threshold is the third value; When the network traffic size is the fourth traffic size, the digital threshold is the fourth value; wherein the third traffic size is greater than the fourth traffic size, and the third value is less than the fourth value.
10. The method according to any one of claims 5 to 9, characterized in that, The routing and forwarding device includes a sampling memory, in which the preset digital range and the digital threshold are stored.
11. The method according to any one of claims 1 to 9, characterized in that, The method further includes: Periodically scan the multiple forwarding tables stored in the multiple storage locations to identify multiple erroneous entries in the multiple forwarding tables; Correct multiple erroneous entries in the aforementioned multiple forwarding tables.
12. A routing and forwarding device, characterized in that, The routing and forwarding device includes: The acquisition unit is used to read the message to be processed; The processing unit is configured to correct errors in multiple forwarding tables based on the error correction type message if the message to be processed is an error correction message; the multiple forwarding tables are stored in multiple storage locations. The processing unit is further configured to, if the message to be processed is a service message, read the first forwarding table, process and forward the service message according to the first forwarding table entry corresponding to the destination address of the service message in the first forwarding table; the first forwarding table is one of the multiple forwarding tables.
13. The routing and forwarding device according to claim 12, characterized in that, The acquisition unit is specifically used to read the message to be processed from the data message queue; the error correction message is obtained by adding a marker to a copy message obtained by copying the service message; the marker is used to indicate that the message containing the marker is the error correction message.
14. The routing and forwarding device according to claim 13, characterized in that, The acquisition unit is specifically used to read the service type message from the first data message queue; The processing unit is further configured to determine whether to copy the service type message according to the copying strategy; if it is determined to copy the service type message, then the service type message is copied to obtain a copied message. The copied message is marked as an error correction message by adding a marker, and the marked copied message is placed in the second data message queue.
15. The routing and forwarding apparatus according to any one of claims 12 to 14, characterized in that, The processing unit is also used to delete the error correction message.
16. The routing and forwarding apparatus according to claim 14 or 15, characterized in that, The processing unit is specifically used to generate a random number after the acquisition unit reads the service type message; and to determine whether to copy the service type message based on the relationship between the random number and the numerical threshold. Both the random number and the numerical threshold are within a preset numerical range.
17. The routing and forwarding apparatus according to claim 16, characterized in that, The processing unit is specifically configured to copy the service type message if the random number is greater than the numerical threshold, and not copy the service type message if the random number is less than or equal to the numerical threshold.
18. The routing and forwarding apparatus according to claim 16, characterized in that, The processing unit is specifically configured to copy the service type message if the random number is less than or equal to the numerical threshold, and not copy the service type message if the random number is greater than the numerical threshold.
19. The routing and forwarding apparatus according to claim 17, characterized in that, When the network traffic volume is the first traffic volume, the digital threshold is the first value; When the network traffic size is the second traffic size, the digital threshold is the second value; wherein the first traffic size is greater than the second traffic size, and the first value is greater than the second value.
20. The routing and forwarding device according to claim 18, characterized in that, When the network traffic volume is the third traffic volume, the digital threshold is the third value; When the network traffic size is the fourth traffic size, the digital threshold is the fourth value; wherein the third traffic size is greater than the fourth traffic size, and the third value is less than the fourth value.
21. The routing and forwarding apparatus according to any one of claims 16 to 20, characterized in that, The routing and forwarding device includes a sampling memory, in which the preset digital range and the digital threshold are stored.
22. The routing and forwarding apparatus according to any one of claims 12 to 21, characterized in that, The processing unit is also configured to periodically scan the multiple forwarding tables stored at the multiple storage locations, identify multiple erroneous entries in the multiple forwarding tables, and correct the multiple erroneous entries in the multiple forwarding tables.
23. A routing and forwarding device, characterized in that, The routing and forwarding device includes a processor and a memory, wherein the memory stores instructions that, when executed by the processor, cause the device to perform the method as described in any one of claims 1-11.
24. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on the device, cause the device to perform the method as described in any one of claims 1-11.