Communication system, method and device
By setting the table entry status in the forwarded table entry in the VPP technology and delaying the release of the forwarded table entry in the state to be released, the performance degradation caused by the locking processing of the worker thread when the main thread releases the forwarded table entry is solved, and efficient forwarding of the lock-free access forwarded table entry is achieved.
Patent Information
- Application Number
- CN202411330214.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-05-06
AI Technical Summary
In VPP technology, when the main thread releases/deletes the forwarded table entry, the worker thread may access the released forwarded table entry, resulting in a wrong forwarding behavior. If this situation is avoided through lock mutual exclusion technology, it will cause the worker thread to spin and the forwarding performance to be degraded.
By setting the table entry status in the forwarded table entry, if the table entry status is to be released, service messages will no longer be forwarded based on the forwarded table entry, thereby delaying the release of the forwarded table entry, and avoiding performance degradation caused by the worker thread locking process.
The workflow lock-free access to forwarding table entries is realized, which avoids the decline in forwarding performance and solves the performance problems caused by locking the worker thread when the main thread releases the forwarding table entries.
Smart Images

Figure CN119945974A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication system, method and device. Background Art
[0002] Vector Packet Processing (VPP) is a technology for batch processing of packets. VPP replaces the traditional scalar processing mode to improve the performance of packet software forwarding.
[0003] VPP supports multi-threading. In multi-threading mode, the main thread is responsible for management functions, such as maintaining forwarding table entries at all levels, node orchestration, etc.; one or more worker threads are responsible for processing the entire process of message input to output. The main thread and worker threads are usually distributed on multiple cores of the CPU. For example, the main thread runs on core 1, and the worker threads run on cores 2, 3, 4, and so on.
[0004] In VPP technology, a memory pool is used to store VPP forwarding table entries. When forwarding a message, the worker thread accesses the memory pool, obtains the address of the memory block in the memory pool according to the first address and index of the memory pool, and then accesses the forwarding table entry stored in the memory block. However, the above access process also has the following problems: 1) When the main thread releases / deletes the forwarding table entry, the worker thread may be accessing the forwarding table entry through the first address and index, but the forwarding table entry accessed is a released forwarding table entry, and the state of the forwarding table entry is incorrect, causing the forwarding behavior to be wrong; 2) If the content of the forwarding table entry is non-atomic, that is, the worker thread accesses the intermediate state of the forwarding table entry, which also causes the forwarding behavior to be wrong.
[0005] To solve the above problem, when the main thread releases / deletes the forwarding table entry, it calls the vlib_worker_thread_barrier_sync interface to put the worker thread in a spinning state and stop processing the message. After the main thread releases / deletes the forwarding table entry to ensure that the worker thread will not access the forwarding table entry again, the main thread calls the vlib_worker_thread_barrier_release interface to resume the working state of the worker thread and continue processing the message.
[0006] However, the above-mentioned method of preventing the worker thread from accessing incorrect forwarding table entries by locking mutual exclusion or similar mutual exclusion technology also exposes the following problem: after the main thread calls the vlib_worker_thread_barrier_sync interface, the worker thread will be in a spinning state. During the spinning state, the worker thread cannot process the message, which will lead to a decrease in forwarding performance. Summary of the invention
[0007] In view of this, the present application provides a communication system, method and device to solve the problem that when the main thread releases / deletes the forwarding table entry, the working thread is locked, making the working thread unable to process the message, resulting in a decrease in forwarding performance.
[0008] In a first aspect, the present application provides a communication system, the communication system is applied to a network device, the network device includes multiple forwarding cores and a memory pool, and a working thread runs on each forwarding core;
[0009] The working thread is used to access the memory pool and obtain a memory block from the memory pool when forwarding a received business message, wherein at least one forwarding table entry is stored in the memory block; according to a destination address included in the business message, a first forwarding table entry matching the destination address is obtained from the at least one forwarding table entry, wherein the first forwarding table entry includes a table entry status; if the value of the table entry status is a to-be-released state, the business message is no longer forwarded according to the first forwarding table entry.
[0010] In a second aspect, the present application provides a communication method, wherein the communication system is applied to a network device, and the network device includes a memory pool; the method further includes:
[0011] receiving a service message, wherein the service message includes a destination address;
[0012] When forwarding the service message, access the memory pool and obtain a memory block from the memory pool, wherein at least one forwarding table entry is stored in the memory block;
[0013] According to the destination address included in the service message, obtaining a first forwarding table entry matching the destination address from the at least one forwarding table entry, wherein the first forwarding table entry includes a table entry state;
[0014] If the value of the entry state is a pending release state, the service message is no longer forwarded according to the first forwarding entry.
[0015] In a third aspect, the present application provides a communication device, the communication device is applied to a network device, the network device includes a memory pool; the device includes:
[0016] A receiving unit, configured to receive a service message, wherein the service message includes a destination address;
[0017] An access unit, used to access the memory pool and obtain a memory block from the memory pool when forwarding the service message, wherein at least one forwarding table entry is stored in the memory block;
[0018] An acquiring unit, configured to acquire, according to a destination address included in the service message, a first forwarding table entry matching the destination address from the at least one forwarding table entry, wherein the first forwarding table entry includes a table entry state;
[0019] The processing unit is configured to no longer forward the service message according to the first forwarding table entry if the value of the table entry state is a to-be-released state.
[0020] In a fourth aspect, the present application provides a network device, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to execute the method provided in the second aspect of the present application.
[0021] Therefore, by applying the communication system, method and device provided by the present application, when forwarding the received business message, the working thread accesses the memory pool and obtains a memory block from the memory pool, in which at least one forwarding table entry is stored; according to the destination address included in the business message, the working thread obtains a first forwarding table entry that matches the destination address from at least one forwarding table entry, and the first forwarding table entry includes a table entry status; if the value of the table entry status is a pending release state, the working thread no longer forwards the business message according to the first forwarding table entry.
[0022] In this way, by setting the entry status in the forwarding table, the forwarding table entries to be released can still be accessed, delaying the release of the forwarding table entries. This solves the problem that when the main thread releases / deletes the forwarding table entry, the worker thread is locked, making it impossible for the worker thread to process the message, resulting in a decrease in forwarding performance. This achieves that the workflow can access the forwarding table entries without locks and without reducing forwarding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flow chart of a communication method provided in an embodiment of the present application;
[0024] Figure 2 A structural diagram of a communication device provided in an embodiment of the present application;
[0025] Figure 3 The network device hardware structure provided in the embodiment of the present application. DETAILED DESCRIPTION
[0026] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0027] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.
[0028] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0029] The communication method provided in the embodiment of the present application is described in detail below. Figure 1 , Figure 1 A flow chart of a communication method provided in an embodiment of the present application. The method is applied to a network device, and the network device includes a memory pool. The communication method provided in an embodiment of the present application may include the following steps.
[0030] Step 110: receiving a service message, wherein the service message includes a destination address;
[0031] Specifically, the network device receives a service message sent by the previous-hop network device, and obtains a destination address therefrom.
[0032] In the embodiment of the present application, the network device may specifically be any network device in the forwarding path, and after receiving the service message, the network device will forward the service message.
[0033] The network device also includes multiple forwarding cores, each of which runs a working thread. Each working thread can perform different business processing on the business message. In the embodiment of the present application, the forwarding processing of the business message by the working thread is taken as an example for explanation.
[0034] In this step, after receiving the service message, the working thread obtains the destination address from it.
[0035] Step 120: when forwarding the service message, access the memory pool and obtain a memory block from the memory pool, wherein at least one forwarding table entry is stored in the memory block;
[0036] Specifically, according to the description of step 110, after the working thread obtains the destination address, if the destination address is not its own address, it needs to forward the service message according to the destination address.
[0037] The worker thread accesses its own memory pool and obtains a memory block from the memory pool, in which at least one forwarding table entry is stored.
[0038] Optionally, in an embodiment of the present application, before the worker thread accesses the memory pool, it first obtains the first address of the memory pool and the index of the memory block from the local. After the worker thread obtains the first address of the memory pool and the index of the memory block, it first accesses the memory pool according to the first address. Then, according to the index of the memory block, the worker thread obtains the corresponding memory block from the memory pool.
[0039] The memory pool is a storage structure based on vector dynamic arrays and bitmaps, used to store fixed-length user data. It is mainly used in scenarios where fixed-size memory needs to be frequently requested and released. When the memory is released, it is first released to the memory pool, and when the memory is requested again, it is obtained from the memory pool to improve efficiency. In this way, the memory loading rate can be improved and the generation of memory fragmentation can be effectively avoided.
[0040] The memory pool includes at least one memory block, and the memory block is used to store information, table items and other data. In an embodiment of the present application, the memory block is used to store forwarding table items, and each forwarding table item includes a forwarding information field (for example, a destination address field, a next hop field, an outbound interface field, etc.) and a table item status field. The first address of the memory pool is a memory address, specifically a user-mode memory address. For example, in the form of 0x160252c00, 0x160252c80, etc.; the index of the memory block is specifically an array subscript. For example, in the form of 0, 1, 2, etc.
[0041] The memory pool data structure is as follows:
[0042] typedef struct
[0043] {
[0044] / **Bitmap of indices of free objects.* /
[0045] uword* free_bitmap;
[0046] / **Bitmap of indices of prepare free objects.* /
[0047] uword* prefree_bitmap;
[0048] / **Vector of free indices.One element for each set bit in bitmap.* /
[0049] u32*free_indices;
[0050] / *The following fields are set for fixed-size, preallocated pools* /
[0051] / **Maximum size of the pool,in elements* /
[0052] u32 max_elts;
[0053] / **mmap segment info:base+length* /
[0054] u8* mmap_base;
[0055] u64 mmap_size;
[0056] }pool_header_t;
[0057] The memory pool data structure includes multiple structure members, as follows: free_bitmap, which memory blocks are free (i.e. not in use, set to 1) and which memory blocks are in use (i.e. in use, set to 0) in the current memory pool. free_indices, which represents a dynamic array. Each element included in the data is the number of a free block. The length of the array is the same as the number of bits set to 1 in free_bitmap. prefree_bitmap, which indicates whether the forwarding table entry is in a pending release state. When the forwarding table entry is released, it is set to the pending release state; when the forwarding table entry is retained, it is set to empty.
[0058] The memory pool can be constructed using pre-allocated memory or dynamic arrays. The following three elements are only used for memory pools constructed using pre-allocated memory. max_elts indicates the maximum number of elements supported by the memory pool; mmap_base indicates the first address of the memory pool; mmap_size indicates the memory size of the memory pool in bytes.
[0059] Step 130: According to the destination address included in the service message, obtain a first forwarding table entry matching the destination address from the at least one forwarding table entry, wherein the first forwarding table entry includes a table entry state;
[0060] Specifically, according to the description of step 120, after the working thread obtains the memory block, it obtains the first forwarding table entry matching the destination address from at least one forwarding table entry stored in the memory block according to the destination address included in the service message.
[0061] The working thread identifies a value of an entry state included in the first forwarding entry.
[0062] Step 140: If the value of the entry state is a pending release state, the service message is no longer forwarded according to the first forwarding entry.
[0063] Specifically, according to the description of step 130, when the worker thread identifies the value of the entry state, if the value of the entry state is a pending release state, the worker thread determines that the first forwarding table item is invalid, and if it continues to forward according to the first forwarding table item, it will cause a forwarding error. The worker thread no longer forwards the service message according to the forwarding information included in the first forwarding table item. At this point, the worker thread can discard the service message.
[0064] Optionally, in an embodiment of the present application, when the worker thread identifies the value of the entry state, if the value of the entry state is empty, the worker thread determines that the first forwarding table entry is valid, and can continue to forward the service message according to the forwarding information included in the first forwarding table entry. At this time, the worker thread continues to obtain the forwarding information from the first forwarding table entry, and subsequently forwards the service message according to the forwarding information.
[0065] Optionally, in the embodiment of the present application, the network device further includes a service module (eg, an ARP module, a BGP module, etc.). The value of the entry state of each forwarding entry is set by the service module that generates the forwarding entry.
[0066] Specifically, after the service module generates the first forwarding table item, when the first forwarding table item reaches the aging time or the first forwarding table item needs to be updated (for example, when the destination address remains unchanged, the outgoing interface is updated, or the next hop is updated, or other fields of the forwarding table item are updated, and the service module regenerates the forwarding table item), the service module determines to release the first forwarding table item.
[0067] When the business module determines that the first forwarding table item is released, the business module first accesses the memory pool, obtains the memory block and the first forwarding table item (the access and acquisition process are the same as the aforementioned worker thread access and acquisition process, which will not be repeated here). Then, the business module sets the value of the entry state included in the first forwarding table item to the pending release state.
[0068] When the service module determines to keep the first forwarding table item, the service module may also first access the memory pool, obtain the memory block and the first forwarding table item. Then, the service module sets the value of the entry state included in the first forwarding table item to null. Alternatively, when the service module determines to keep the first forwarding table item, no operation is performed on the first forwarding table item. That is, the network device no longer accesses the memory pool, obtains the memory block and the first forwarding table item.
[0069] Optionally, in an embodiment of the present application, the network device further includes a user-space read-copy update (URCU) management thread. After the service module sets the value of the entry state included in the first forwarding table entry to a pending release state, the service module starts a release process for the first forwarding table entry.
[0070] Specifically, the service module implements delayed release of the first forwarding table entry through the URCU mechanism. The service module calls the URCU interface and calls the URCU management thread through the URCU interface.
[0071] The URCU management thread identifies whether each forwarding core has completed a silent period operation. If each forwarding core has completed a silent period operation, the URCU management thread determines that the working threads running on each forwarding core no longer access or use the first forwarding table entry. At this time, the URCU management thread releases the first forwarding table entry. If there is a forwarding core that has not completed a silent period operation, the URCU management thread determines that there is still a possibility that the working thread may access or use the first forwarding table entry. At this time, the URCU management thread continues to maintain the first forwarding table entry.
[0072] Therefore, when the network device processes the forwarding of service messages, even if the value of the entry state of the forwarding table entry is in the pending release state, the forwarding table entry will not be released immediately, but after waiting for each forwarding core to complete a silent period operation and ensuring that there are no worker threads accessing or using the forwarding table entry, the forwarding table entry will be released. The entire process does not require locking, and the forwarding processing of service messages by the worker thread is not affected, which improves the message processing efficiency and reduces the occurrence of message processing errors or interruptions due to shared resource updates.
[0073] The URCU management thread maintains a preset global linked list, which contains online working threads. The specific process of URCU identifying whether each forwarding core has completed a silent period operation is as follows: identifying whether each forwarding core to which each online working thread in the global linked list belongs has completed a silent period operation.
[0074] It is understandable that after each working thread goes online, it sends its own thread identifier and thread state parameters to the URCU management thread. The URCU management thread writes the thread identifier and thread state parameters of the working thread in the online state into the global linked list.
[0075] It should be noted that the URCU management thread determines whether the forwarding cores have completed a silent period operation by identifying the global count and the per-thread count of each forwarding core. For example, if the global count is the same as the per-thread count, the URCU management thread determines that the forwarding core has completed a silent period operation, otherwise, it determines that the forwarding core has not completed a silent period operation.
[0076] Each time a worker thread performs a URCU write operation, the URCU management thread adds 1 to the global count; each time the forwarding core calls a silent period, the per-thread count is updated to the global count. In the forwarding core, when a worker thread processes a service message, the forwarding core calls a silent period every preset time (for example, 5 microseconds) or after processing a certain number of service messages (for example, 1000).
[0077] Therefore, by applying the communication method provided by the present application, when forwarding the received business message, the working thread accesses the memory pool and obtains a memory block from the memory pool, in which at least one forwarding table entry is stored; according to the destination address included in the business message, the working thread obtains a first forwarding table entry that matches the destination address from at least one forwarding table entry, and the first forwarding table entry includes a table entry status; if the value of the table entry status is a pending release state, the working thread no longer forwards the business message according to the first forwarding table entry.
[0078] In this way, by setting the entry status in the forwarding table, the forwarding table entries to be released can still be accessed, delaying the release of the forwarding table entries. This solves the problem that when the main thread releases / deletes the forwarding table entry, the worker thread is locked, making it impossible for the worker thread to process the message, resulting in a decrease in forwarding performance. This allows the workflow to access the forwarding table entry without locking, without reducing forwarding performance.
[0079] The communication system provided by the embodiment of the present application is described in detail below. The communication system method is applied to a network device, which includes multiple forwarding cores and a memory pool, and each forwarding core runs a working thread.
[0080] A working thread is used to access a memory pool when forwarding a received service message. The working thread obtains a memory block from the memory pool. The memory block stores at least one forwarding table entry. According to a destination address included in the service message, the working thread obtains a first forwarding table entry that matches the destination address from the at least one forwarding table entry, and the first forwarding table entry includes a table entry state.
[0081] The working thread identifies the value of the entry state, and if the value of the entry state is a pending release state, the working thread no longer forwards the service message according to the first forwarding entry. If the value of the entry state is null, the working thread forwards the service message according to the first forwarding entry.
[0082] Optionally, before the working thread accesses the memory pool, the working thread is also used to obtain the first address of the memory pool and the index of the memory block from the local when forwarding the received service message.
[0083] The specific process of the worker thread accessing the memory pool and obtaining the memory block from the memory pool is as follows: according to the first address, the worker thread accesses the memory pool, and according to the index of the memory block, the worker thread obtains the corresponding memory block from the memory pool.
[0084] Optionally, the network device also includes a business module; the business module is used to set the value of the table entry state included in the first forwarding table entry to a to-be-released state when it is determined that the first forwarding table entry is to be released; when it is determined that the first forwarding table entry is to be maintained, the value of the table entry state included in the first forwarding table entry is set to empty.
[0085] Optionally, the network device also includes a URCU management thread; the business module is also used to call the URCU interface; through the URCU interface, the URCU management thread is called; the URCU management thread is used to identify whether each forwarding core has completed a silent period operation; if so, the first forwarding table entry is released; if not, the first forwarding table entry is retained.
[0086] Therefore, by applying the communication system, method and device provided by the present application, when forwarding the received business message, the working thread accesses the memory pool and obtains a memory block from the memory pool, in which at least one forwarding table entry is stored; according to the destination address included in the business message, the working thread obtains a first forwarding table entry that matches the destination address from at least one forwarding table entry, and the first forwarding table entry includes a table entry status; if the value of the table entry status is a pending release state, the working thread no longer forwards the business message according to the first forwarding table entry.
[0087] In this way, by setting the entry status in the forwarding table, the forwarding table entries to be released can still be accessed, delaying the release of the forwarding table entries. This solves the problem that when the main thread releases / deletes the forwarding table entry, the worker thread is locked, making it impossible for the worker thread to process the message, resulting in a decrease in forwarding performance. This achieves that the workflow can access the forwarding table entries without locks and without reducing forwarding performance.
[0088] Based on the same inventive concept, the present application embodiment also provides a communication device corresponding to the communication method. Figure 2 , Figure 2 A communication device provided in an embodiment of the present application is applied to a network device, wherein the network device includes a memory pool; the device includes:
[0089] The receiving unit 210 is used to receive a service message, wherein the service message includes a destination address;
[0090] An access unit 220, configured to access the memory pool and obtain a memory block from the memory pool when forwarding the service message, wherein at least one forwarding table entry is stored in the memory block;
[0091] An acquiring unit 230, configured to acquire, according to a destination address included in the service message, a first forwarding table entry matching the destination address from the at least one forwarding table entry, wherein the first forwarding table entry includes a table entry state;
[0092] The processing unit 240 is configured to no longer forward the service message according to the first forwarding entry if the value of the entry state is a to-be-released state.
[0093] Optionally, the acquisition unit 230 is further configured to acquire the first address of the memory pool and the index of the memory block from the local computer when forwarding the received service message;
[0094] The access unit 220 is specifically configured to access the memory pool according to the first address, and obtain a corresponding memory block from the memory pool according to the index of the memory block.
[0095] Optionally, the device further comprises:
[0096] A sending unit (not shown in the figure) is used to forward the service message according to the first forwarding table entry if the value of the table entry state is empty.
[0097] Optionally, the device further comprises:
[0098] A setting unit (not shown in the figure), configured to set the value of the entry state included in the first forwarding table entry to a to-be-released state when it is determined that the first forwarding table entry is to be released;
[0099] The setting unit (not shown in the figure) is further configured to, when it is determined to keep the first forwarding table entry, set the value of the entry state included in the first forwarding table entry to null.
[0100] Optionally, the network device further includes a plurality of forwarding cores, and the apparatus further includes:
[0101] A startup unit (not shown in the figure) is used to call the URCU interface and call the URCU management thread;
[0102] An identification unit (not shown in the figure), used to identify whether each forwarding core has completed a silent period operation;
[0103] a releasing unit (not shown in the figure), configured to release the first forwarding table entry if yes;
[0104] A holding unit (not shown in the figure) is used to hold the first forwarding table entry if no.
[0105] Therefore, by applying the communication device provided by the present application, when forwarding a received service message, the network device accesses the memory pool and obtains a memory block from the memory pool, in which at least one forwarding table entry is stored; according to the destination address included in the service message, the network device obtains a first forwarding table entry that matches the destination address from at least one forwarding table entry, and the first forwarding table entry includes a table entry status; if the value of the table entry status is a to-be-released state, the network device no longer forwards the service message according to the first forwarding table entry.
[0106] In this way, by setting the entry status in the forwarding table, the forwarding table entries to be released can still be accessed, delaying the release of the forwarding table entries. This solves the problem that when the main thread releases / deletes the forwarding table entry, the worker thread is locked, making it impossible for the worker thread to process the message, resulting in a decrease in forwarding performance. This achieves that the workflow can access the forwarding table entries without locks and without reducing forwarding performance.
[0107] Based on the same inventive concept, the embodiment of the present application also provides a network device, such as Figure 3 As shown, it includes a processor 310, a transceiver 320 and a machine-readable storage medium 330, the machine-readable storage medium 330 stores machine-executable instructions that can be executed by the processor 310, and the processor 310 is prompted by the machine-executable instructions to execute the communication method provided in the embodiment of the present application. Figure 2 The communication device shown can be used as Figure 3The network device hardware structure shown is implemented.
[0108] The computer-readable storage medium 330 may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. Optionally, the computer-readable storage medium 330 may also be at least one storage device located away from the processor 310.
[0109] The processor 310 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components.
[0110] In the embodiment of the present application, the processor 310 reads the machine executable instructions stored in the machine readable storage medium 330, and the machine executable instructions enable the processor 310 itself and the transceiver 320 to execute the communication method described in the aforementioned embodiment of the present application.
[0111] In addition, an embodiment of the present application provides a machine-readable storage medium 330, which stores machine-executable instructions. When called and executed by the processor 310, the machine-executable instructions prompt the processor 310 itself and the calling transceiver 320 to execute the communication method described in the aforementioned embodiment of the present application.
[0112] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0113] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0114] As for the communication device and machine-readable storage medium embodiments, since the method contents involved are basically similar to the aforementioned method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0115] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A communication system, characterized in that: The communication system is applied to a network device, the network device includes a plurality of forwarding cores and a memory pool, and a working thread runs on each forwarding core; The working thread is used to access the memory pool and obtain a memory block from the memory pool when forwarding a received business message, wherein at least one forwarding table entry is stored in the memory block; according to a destination address included in the business message, a first forwarding table entry matching the destination address is obtained from the at least one forwarding table entry, wherein the first forwarding table entry includes a table entry status; if the value of the table entry status is a to-be-released state, the business message is no longer forwarded according to the first forwarding table entry.
2. The communication system according to claim 1, characterized in that Before accessing the memory pool, the working thread is further used to obtain the first address of the memory pool and the index of the memory block from the local when forwarding the received service message; The working thread is specifically used to access the memory pool according to the first address, and obtain the corresponding memory block from the memory pool according to the index of the memory block.
3. The communication system according to claim 1, characterized in that: The working thread is further configured to forward the service message according to the first forwarding table entry if the value of the entry status is empty.
4. The communication system according to claim 1, characterized in that: The network device also includes a service module; The service module is used to set the value of the entry state included in the first forwarding entry to a to-be-released state when it is determined that the first forwarding entry is to be released; and to set the value of the entry state included in the first forwarding entry to empty when it is determined that the first forwarding entry is to be maintained.
5. The communication system according to claim 4, characterized in that: The network device also manages the URCU thread; The business module is also used to call the URCU interface; through the URCU interface, call the URCU management thread; The URCU management thread is used to identify whether each forwarding core has completed a silent period operation; if so, the first forwarding table entry is released; if not, the first forwarding table entry is retained.
6. A communication method, characterized in that: The communication system is applied to a network device, and the network device includes a memory pool; the method further includes: receiving a service message, wherein the service message includes a destination address; When forwarding the service message, access the memory pool and obtain a memory block from the memory pool, wherein at least one forwarding table entry is stored in the memory block; According to the destination address included in the service message, obtaining a first forwarding table entry matching the destination address from the at least one forwarding table entry, wherein the first forwarding table entry includes a table entry state; If the value of the entry state is a pending release state, the service message is no longer forwarded according to the first forwarding entry.
7. The communication method according to claim 6, characterized in that: The method further comprises: If the value of the entry status is empty, forwarding processing is performed on the service message according to the first forwarding entry.
8. The communication method according to claim 6, characterized in that: The method further comprises: When it is determined that the first forwarding table entry is to be released, setting the value of the entry state included in the first forwarding table entry to a to-be-released state; When it is determined to keep the first forwarding table entry, the value of the entry state included in the first forwarding table entry is set to null.
9. The communication method according to claim 6, characterized in that: The network device further includes a plurality of forwarding cores, and the method further includes: Calling the URCU interface, and calling the URCU management thread through the URCU interface; Identify whether each forwarding core has completed a silent period operation; If yes, releasing the first forwarding table entry; If not, the first forwarding table entry is retained.
10. A communication device, characterized in that: The communication device is applied to a network device, and the network device includes a memory pool; the device includes: A receiving unit, configured to receive a service message, wherein the service message includes a destination address; An access unit, used to access the memory pool and obtain a memory block from the memory pool when forwarding the service message, wherein at least one forwarding table entry is stored in the memory block; An acquiring unit, configured to acquire, according to a destination address included in the service message, a first forwarding table entry matching the destination address from the at least one forwarding table entry, wherein the first forwarding table entry includes a table entry state; The processing unit is configured to no longer forward the service message according to the first forwarding table entry if the value of the table entry state is a to-be-released state.
11. The communication device according to claim 10, characterized in that: The device also includes: A sending unit is used to forward the service message according to the first forwarding table entry if the value of the table entry status is empty.
12. The communication device according to claim 10, characterized in that: The device also includes: A setting unit, configured to set the value of the entry state included in the first forwarding table entry to a to-be-released state when it is determined that the first forwarding table entry is to be released; The setting unit is further configured to, when it is determined to keep the first forwarding table entry, set the value of the entry state included in the first forwarding table entry to null.
13. The communication device according to claim 10, characterized in that: The network device further includes a plurality of forwarding cores, and the apparatus further includes: The startup unit is used to call the URCU interface and the URCU management thread; An identification unit, used for identifying whether each forwarding core has completed a silent period operation; a releasing unit, configured to release the first forwarding table entry if yes; A retaining unit is configured to retain the first forwarding table entry if no.