A method, device, equipment and storage medium for distributing routing table entries
By adopting hash table cache and issuance separation task design in the data center network, parallel processing of routing table entries is realized, and the inefficiency problem in traditional methods is solved, routing delivery efficiency is improved and the stability of network equipment is enhanced.
Patent Information
- Application Number
- CN202211115976.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-14
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2042-09-14
AI Technical Summary
In large or super-large data center networks, the traditional routing table entry issuance method is inefficient, especially in large-scale routing application scenarios. The single-threaded serial accumulated cache table entry method leads to frequent PCI-E bus calls, affecting the issuance efficiency.
The task design of hash table caching and issuance is adopted, and the parallel cache and issuance of routing table entries is realized through hash table polling and semaphore management, and two independent tasks are used to improve efficiency.
It improves the efficiency of routing issuance, enhances the stability of network equipment, and solves the problem of inefficiency in traditional methods.
Smart Images

Figure CN115510057B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technologies, and in particular, to a method, apparatus, device, and storage medium for distributing routing table entries. Background Art
[0002] In large or extra-large data center networks, a large number of servers or virtual machines usually need to be supported. In this networking application scenario, requirements are put forward for the specifications of routing table entries. Generally, network devices need to support routing table entry specification requirements from dozens of K to hundreds of K. In the scenario of large-scale routing applications, there are also performance requirements for the fast and reliable distribution of routing table entries.
[0003] Conventional network device frameworks are as Figure 1 shown. The distribution of routing table entries is implemented in the hardware forwarding component. The hardware forwarding component of the network device can be served by an ASIC (Application Specific Integrated Circuit) network forwarding chip, an NP (Network Processor) network processor, a DPU (Data Processing Unit) data processor, an FPGA (Field Programmable Gate Array), etc. The hardware forwarding component is connected to the CPU through the PCI-E bus.
[0004] Traditional routing distribution adopts the scheme of distributing routes one by one. The efficiency of routing distribution is positively correlated with the number of routing entries S, and the time complexity is O(S). However, this scheme involves frequent calls to the PCI-E bus, which affects the efficiency of routing distribution. For this reason, the method of accumulating cache entries can be used. After accumulating X routes, the routing batch distribution interface is uniformly called to distribute the routes to the hardware forwarding component. In this way, the efficiency of routing distribution can be optimized to O(S / X).
[0005] However, the method of accumulating cache entries is carried out serially in a single thread. When configuring the hardware forwarding component by calling the interface, only the write-waiting scheme can be adopted. Only after the write operation of the forwarding hardware is completed can the subsequent entry distribution operation be carried out. There is still a problem of low distribution efficiency. Summary of the Invention
[0006] In view of this, the purpose of the present invention is to provide a method, apparatus, device, and medium for distributing routing table entries to improve the above problems.
[0007] An embodiment of the present invention provides a method for distributing routing table entries, which includes:
[0008] Receiving the routing table entries to be distributed, and obtaining a first hash table pointed to by the pointer ID of the current active hash table;
[0009] Store the routing table entry according to the current state of the first hash table;
[0010] Poll the first hash table to determine whether the hash table meets the requirement for distribution;
[0011] When the hash table meets the requirement for distribution, update the current active hash table pointer ID to point to the new second hash table, and distribute the routing table entries in the first hash table to the hardware forwarding component.
[0012] Preferably, when it is determined that the first hash table is full, block itself.
[0013] Preferably, storing the routing table entry according to the current state of the first hash table specifically includes:
[0014] Obtain the semaphore of the routing cache table;
[0015] Judge whether the first hash table is currently idle according to the semaphore of the routing cache table;
[0016] If so, cache the routing table entry into the first hash table and then release the semaphore of the routing cache table;
[0017] If not, cache the routing table entry into the first hash table after waiting for the semaphore of the routing cache table to be released.
[0018] Preferably, polling the first hash table to determine whether the hash table meets the requirement for distribution and when the hash table meets the requirement for distribution, updating the current active hash table pointer ID to point to the new second hash table, and distributing the routing table entries in the first hash table to the hardware forwarding component specifically includes:
[0019] Obtain the semaphore of the routing cache table;
[0020] Judge whether the first hash table currently meets the requirement for distribution according to the semaphore of the routing cache table;
[0021] If not, release the semaphore of the routing cache table and then delay for a set time;
[0022] If so, after updating the current active hash table pointer ID, release the semaphore of the routing cache table;
[0023] Judge whether the first hash table is full;
[0024] If full, release the semaphore of the routing cache table, and distribute the routing table entries in the first hash table to the hardware forwarding component;
[0025] If it is not full, the routing table entries in the first hash table are sent to the hardware forwarding component.
[0026] An embodiment of the present invention further provides a routing table entry sending device, which includes:
[0027] A receiving unit, configured to receive the routing table entries to be sent and obtain the first hash table pointed to by the current active hash table pointer ID;
[0028] A caching unit, configured to store the routing table entries according to the current state of the first hash table;
[0029] A polling unit, configured to poll the first hash table to determine whether the first hash table meets the sending requirements;
[0030] A sending unit, configured to, when the first hash table meets the sending requirements, update the current active hash table pointer ID to execute the second hash table, and send the routing table entries in the first hash table to the hardware forwarding component.
[0031] Preferably, when it is determined that the first hash table is full, it blocks itself.
[0032] Preferably, the caching unit is specifically configured to:
[0033] Obtain the semaphore of the routing cache table;
[0034] Judge whether the first hash table is currently idle according to the semaphore of the routing cache table;
[0035] If so, cache the routing table entries into the first hash table and then release the semaphore of the routing cache table;
[0036] If not, cache the routing table entries into the first hash table after waiting for the semaphore of the routing cache table to be released.
[0037] Preferably, the sending unit is specifically configured to:
[0038] Obtain the semaphore of the routing cache table;
[0039] Judge whether the first hash table currently meets the sending requirements according to the semaphore of the routing cache table;
[0040] If not, release the semaphore of the routing cache table and then delay for a set time;
[0041] If so, after updating the current active hash table pointer ID, release the semaphore of the routing cache table;
[0042] Judge whether the first hash table is full;
[0043] If it is full, release the semaphore of the routing cache table, and send the routing table entries in the first hash table to the hardware forwarding component;
[0044] If it is not full, send the routing table entries in the first hash table to the hardware forwarding component.
[0045] An embodiment of the present invention also provides a routing table entry sending device, which includes a memory and a processor. A computer program is stored in the memory, and the computer program can be executed by the processor to implement the routing table entry sending method as described above.
[0046] An embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by the processor of the device where the computer-readable storage medium is located to implement the routing table entry sending method as described above.
[0047] In summary, in the embodiment of the present invention, the caching of routing table entries and the sending of routing table entries adopt two independent tasks, which can parallelize the caching and sending of routing, effectively improve the efficiency of routing sending, and can effectively improve the stability of network devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0049] Figure 1 Shows a schematic diagram of a conventional network device framework.
[0050] Figure 2 Is a flowchart of the routing table entry sending method provided by the first embodiment of the present invention.
[0051] Figure 3 Is a schematic diagram of the principle of the routing double hash table caching scheme.
[0052] Figure 4 Is a specific flowchart of routing table entry caching.
[0053] Figure 5 Is a specific flowchart of routing table entry sending.
[0054] Figure 6 Is a schematic diagram of the structure of the routing table entry sending device provided by the second embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0055] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0056] To better understand the technical solutions of the present invention, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.
[0057] It should be clear that the described embodiments are only a part of the embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0058] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "the", and "said" used in the embodiments of the present invention and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.
[0059] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments:
[0060] Please refer to Figure 2 , the first embodiment of the present invention provides a method for distributing routing table entries, which can be executed by a routing table entry distribution device (hereinafter referred to as the distribution device), and specifically, by one or more processors in the distribution device to implement the following steps:
[0061] S101, receive the routing table entries to be distributed, and obtain the first hash table pointed to by the current active hash table pointer ID.
[0062] In this embodiment, the distribution device can be various network devices, and the routing table entries can be generated by a routing reception task.
[0063] In this embodiment, as Figure 3 shown, the current active hash table pointer ID is used to point to the current active first hash table, and this first hash table is used to cache the distributed routing table entries.
[0064] S102, store the routing table entries according to the current state of the first hash table.
[0065] Specifically, as Figure 4As shown, in this embodiment, the first hash table and the current active hash table pointer ID are protected by using a "routing cache table semaphore". Specifically, after receiving the issued routing table entry, first obtain the routing cache table semaphore, and determine whether the first hash table is currently idle according to the routing cache table semaphore; if so, cache the routing table entry into the first hash table and then release the routing cache table semaphore; if not, after waiting for the routing cache table semaphore to be released, hold the routing cache table semaphore, and then cache the routing table entry into the first hash table based on the held routing cache table semaphore. If the first hash table pointed to by the current active hash table pointer ID is full, block itself and wait until the current active hash table pointer ID is switched (i.e., points to a new second hash table), and then activate itself.
[0066] S103, poll the first hash table to determine whether the first hash table meets the issued requirements.
[0067] S104, when the first hash table meets the issued requirements, update the current active hash table pointer ID to execute the second hash table, and issue the routing table entries in the first hash table to the hardware forwarding component.
[0068] Specifically, as Figure 5 shown, it includes:
[0069] Obtain the routing cache table semaphore;
[0070] Judge whether the first hash table currently meets the issued requirements according to the routing cache table semaphore;
[0071] In this embodiment, the issued requirements can be set according to specific needs, and the present invention does not make specific limitations.
[0072] If not, release the routing cache table semaphore and delay for a set time.
[0073] Among them, the set time is the time to release the CPU, and after delaying for the set time, repeat and return to the step: obtain the routing cache table semaphore.
[0074] If it meets the requirements, after updating the current active hash table pointer ID to point to a new second hash table, release the routing cache table semaphore;
[0075] Judge whether the first hash table is full;
[0076] If it is full, release the routing cache table semaphore and issue the routing table entries in the first hash table to the hardware forwarding component;
[0077] If it is not full, issue the routing table entries in the first hash table to the hardware forwarding component.
[0078] Among them, when issuing, first delete the routing table entry, and then add the routing table entry. Issuing first and then adding can avoid the problem that the routing space is full and the addition cannot be performed.
[0079] In summary, in the embodiments of the present invention, caching of routing table entries and issuing of routing table entries adopt two independent tasks, which can parallelize the caching and issuing of routes, effectively improve the efficiency of route issuing, and effectively improve the stability of network devices.
[0080] Please refer to Figure 6 , the embodiments of the present invention also provide a routing table entry issuing device, which includes:
[0081] A receiving unit 210, configured to receive a routing table entry to be issued and obtain a hash table pointed to by the current active hash table pointer ID;
[0082] A caching unit 220, configured to store the routing table entry according to the current state of the hash table;
[0083] A polling unit 230, configured to poll the hash table to determine whether the hash table meets the issuing requirements;
[0084] An issuing unit 240, configured to update the current active hash table pointer ID when the hash table meets the issuing requirements, and issue the routing table entries in the first hash table to the hardware forwarding component.
[0085] Preferably, when it is determined that the first hash table is full, it blocks itself.
[0086] Preferably, the caching unit 220 is specifically configured to:
[0087] Obtain a routing cache table semaphore;
[0088] Judge whether the first hash table is currently idle according to the routing cache table semaphore;
[0089] If so, cache the routing table entry into the first hash table and then release the routing cache table semaphore;
[0090] If not, cache the routing table entry into the first hash table after waiting for the routing cache table semaphore to be released.
[0091] Preferably, the issuing unit 230 is specifically configured to:
[0092] Obtain a routing cache table semaphore;
[0093] Judge whether the first hash table currently meets the issuing requirements according to the routing cache table semaphore;
[0094] If not satisfied, delay for a set time after releasing the routing cache table semaphore;
[0095] If satisfied, update the current active hash table pointer ID, execute the new second hash table, and then release the routing cache table semaphore;
[0096] Determine whether the first hash table is full;
[0097] If full, release the routing cache table semaphore and send the routing table entries in the first hash table to the hardware forwarding component;
[0098] If not full, send the routing table entries in the first hash table to the hardware forwarding component.
[0099] The third embodiment of the present invention also provides a routing table entry sending device, which includes a memory and a processor. A computer program is stored in the memory and can be executed by the processor to implement the routing table entry sending method as described above.
[0100] The fourth embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program that can be executed by the processor of the device where the computer-readable storage medium is located to implement the routing table entry sending method as described above.
[0101] In several embodiments provided by the embodiments of the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device and method embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0102] In addition, in each embodiment of the present invention, each functional module can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0103] If the above-mentioned functions are implemented in the form of software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes. It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article, or device. Without further limitations, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device including the said element.
[0104] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for distributing routing table entries, characterized in that including: Receiving a routing table entry to be dispatched, and obtaining a first hash table pointed to by the current active hash table pointer ID; Storing the routing table entry according to the current state of the first hash table; specifically including: obtaining a routing cache table semaphore; judging whether the first hash table is currently idle according to the routing cache table semaphore; if so, caching the routing table entry into the first hash table and then releasing the routing cache table semaphore; if not, caching the routing table entry into the first hash table after waiting for the routing cache table semaphore to be released; Polling the first hash table to judge whether the hash table meets the dispatch requirement; When the hash table meets the dispatch requirement, updating the current active hash table pointer ID to point to a new second hash table, and dispatching the routing table entries in the first hash table to a hardware forwarding component; specifically including: obtaining a routing cache table semaphore; judging whether the first hash table currently meets the dispatch requirement according to the routing cache table semaphore; if not, releasing the routing cache table semaphore and then delaying for a set time; if so, updating the current active hash table pointer ID and then releasing the routing cache table semaphore; judging whether the first hash table is full; if full, releasing the routing cache table semaphore and dispatching the routing table entries in the first hash table to the hardware forwarding component; if not full, dispatching the routing table entries in the first hash table to the hardware forwarding component.
2. The method for distributing a routing table entry according to claim 1, wherein When it is judged that the first hash table is full, blocking itself.
3. A routing table entry distribution device, characterized in that, including: A receiving unit, configured to receive a routing table entry to be dispatched, and obtain a first hash table pointed to by the current active hash table pointer ID; hash table; A caching unit, configured to store the routing table entry according to the current state of the first hash table; specifically, the caching unit is configured to: obtain a routing cache table semaphore; judge whether the first hash table is currently idle according to the routing cache table semaphore; if so, cache the routing table entry into the first hash table and then release the routing cache table semaphore; if not, cache the routing table entry into the first hash table after waiting for the routing cache table semaphore to be released; A polling unit, configured to poll the first hash table to judge whether the first hash table meets the dispatch requirement; A distribution unit, which is used to update the pointer ID of the current active hash table to execute the second hash table when the first hash table meets the distribution requirement, and distribute the routing table entries in the first hash table to the hardware forwarding component; specifically, the distribution unit is used to: obtain the semaphore of the routing cache table; judge whether the first hash table currently meets the distribution requirement according to the semaphore of the routing cache table; if not, release the semaphore of the routing cache table and delay for a set time; if so, release the semaphore of the routing cache table after updating the pointer ID of the current active hash table; judge whether the first hash table is full; if it is full, release the semaphore of the routing cache table and distribute the routing table entries in the first hash table; if it is not full, distribute the routing table entries in the first hash table; where, when distributing, first delete the routing table entries and then add the routing table entries.
4. The routing table entry distribution device according to claim 3, wherein When it is judged that the first hash table is full, block itself.
5. A routing table entry distribution device, characterized in that, It includes a memory and a processor, and the memory stores a computer program, and the computer program can be executed by the processor to implement the routing table entry distribution method according to any one of claims 1 to 2.
6. A computer-readable storage medium, characterized in that, Stores a computer program, and the computer program can be executed by the processor of the device where the computer-readable storage medium is located to implement the routing table entry distribution method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Method and device for searching route entries in intelligent optical network
CN102801621A
Route searching result cache method based on network processor
CN1863169A