Multi-core processor-based OAM (Operation Administration and Maintenance) traffic processing method and equipment

By reasonably allocating OAM message load on a multi-core processor, using a single producer, multi-consumer and multi-core parallel single producer model, the problem of primary core resource preemption caused by OAM message load concentration is solved, and the OAM packetization efficiency and device forwarding performance are improved.

CN120281664APending Publication Date: 2025-07-08CHENGDU FIBERHOME CLOUD NETWORK INFORMATION TECH CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510334659.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In the prior art, OAM packet load is concentrated on the main core, resulting in preemption of the main core resource and reducing the processing efficiency of the main core message. Especially when the amount of OAM packet data is large, it may cause the packet to be unable to be sent in time.

Method used

The OAM traffic processing method based on multi-core processors is adopted to disassemble the OAM processing process into packet grouping and packet transmission processes. The OAM message load is reasonably allocated by decision makers, and the single producer multi-consumer model and the multi-core parallel single producer model are used to reasonably allocate the OAM message load to improve the utilization rate of nuclear resources.

Benefits of technology

While improving the efficiency of OAM packet transmission, it does not reduce or reduce the device forwarding performance, optimizes the utilization rate of core resources, and avoids the preemption and delayed transmission of OAM packets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120281664A_ABST
    Figure CN120281664A_ABST
Patent Text Reader

Abstract

The invention provides an OAM (Operation Administration and Maintenance) traffic processing method and equipment based on a multi-core processor, and the method comprises the steps: a decision maker selects one lcore as a new first producer when there are lcores meeting a preset condition, and takes each lcore as a consumer of the first producer, the preset condition is used for predicting the lcore which can read fewer network port messages in the future according to the number of the network port messages read in the lcore history; the first producer packs the OAM messages of all the table items and writes the packed OAM messages into a lockable buffer area, and the first producer and consumers thereof lock the buffer area when performing read-write operation on the buffer area; and when the number of the network port messages read by the consumer at the last time is smaller than or equal to the network port high threshold value, the consumer of the first producer reads the OAM messages from a lockable buffer area, and sends the read OAM messages out from the Ethernet interface. According to the method and the device, the forwarding performance of the equipment is not reduced or reduced slightly while the OAM packet sending efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of soft forwarding technology, and particularly relates to an OAM traffic processing method and device based on a multi-core processor. Background Art

[0002] In a network link, OAM (Operation Administration and Maintenance) is usually widely used by various upper-layer protocols as a detection tool for quickly detecting communication faults between systems and notifying upper-layer applications when a fault occurs. In the prior art, an OAM timer is configured on a fixed core, called the main core, and the main core is triggered to execute the OAM packet sending function every certain period of time. However, in the existing solution, the OAM packet load is concentrated on the main core, which will preempt the main core resources, resulting in slower processing of main core packets and reduced operating efficiency. When the OAM packet sending data volume is large, it will also cause the problem that OAM packets cannot be sent in time. Summary of the Invention

[0003] This application provides an OAM traffic processing method and device based on a multi-core processor, which can reasonably allocate the OAM packet load, improve the utilization rate of core resources, and thus improve the OAM packet sending efficiency without reducing or reducing the device forwarding performance less.

[0004] In a first aspect, an embodiment of this application provides an OAM traffic processing method based on a multi-core processor. The OAM traffic processing method includes:

[0005] When there is an lcore that meets the preset conditions, a decision maker selects one lcore as the new first producer from them, and uses each lcore as a consumer of the first producer, where the preset conditions are used to predict an lcore that will read fewer network interface packets in the future based on the number of network interface packets that the lcore has read historically;

[0006] The first producer assembles the OAM packets of all entries, selects a lockable buffer as the first target buffer, and writes the assembled OAM packets into the first target buffer. Each lcore has a buffer, and the first producer and its consumers will lock when reading and writing to the buffer;

[0007] When the number of network interface packets read by the consumer of the first producer is less than or equal to the network interface high threshold in its most recent read, a lockable buffer is selected as the second target buffer, the OAM packets are read from the second target buffer, and the read OAM packets are sent out from the Ethernet interface.

[0008] Further, in an embodiment, the OAM traffic processing method further includes:

[0009] When there is no lcore that meets the preset conditions, the decision maker takes each lcore as the second producer and its consumer;

[0010] The second producer packets the OAM packets of the corresponding entry it is responsible for, and writes the packeted OAM packets into its own buffer;

[0011] The consumer of the second producer reads the OAM packets from its own buffer, and sends the read OAM packets out through the Ethernet interface.

[0012] Further, in one embodiment, each lcore periodically performs the following operations:

[0013] If the number of network interface packets read most recently by itself is greater than the network interface high threshold, update its first flag bit to A1; if the number of network interface packets read most recently by itself is less than the network interface low threshold, update its first flag bit to A3; otherwise, update its first flag bit to A2;

[0014] If the number of network interface packets read most recently by itself is equal to the number of network interface packets requested to be read, increment its first count by one; otherwise, decrement its first count by one, where the initial value of the first count is zero and the minimum value is zero;

[0015] If its first count is greater than the full fetch threshold, update its second flag bit to B2; otherwise, update its second flag bit to B1, where the initial value of the second flag bit is B1;

[0016] If the number of network interface packets read most recently by itself is equal to zero, increment its second count by one; otherwise, clear its second count to zero, where the initial value of the second count is zero;

[0017] If its second count is greater than the empty fetch threshold, update its third flag bit to C2; otherwise, update its third flag bit to C1, where the initial value of the third flag bit is C1;

[0018] For the decision maker, the step of selecting one lcore as the new first producer from the lcores that meet the preset conditions includes:

[0019] If there is an lcore with the third flag bit being C2, select one lcore from them as the new first producer;

[0020] If there is no lcore with the third flag bit being C2 and there is an lcore with the second flag bit being B1, select one lcore with the highest priority of the first flag bit from them as the new first producer, where the priorities of A1, A2, and A3 increase in sequence.

[0021] Further, in one embodiment, each lcore updates its number of packets to be processed according to the number of packets read, the number of packets sent, and the number of packets discarded.

[0022] For the decision maker, the step of selecting one lcore with the highest priority of the first flag bit as the new first producer includes:

[0023] When the second flag bit is B1 and the lcore with the highest priority of the first flag bit is unique, use this lcore as the new first producer;

[0024] When the second flag bit is B1 and the lcores with the highest priority of the first flag bit are not unique, select one lcore with the least number of packets to be processed as the new first producer.

[0025] Further, in one embodiment, the OAM traffic processing method further includes:

[0026] When there is no lcore with the third flag bit C2 and no lcore with the second flag bit B1, the decision maker uses each lcore as the second producer and its consumer;

[0027] The second producer assembles the OAM packets for the corresponding table entries it is responsible for, and writes the assembled OAM packets into its own buffer;

[0028] The consumer of the second producer reads the OAM packets from its own buffer and sends the read OAM packets out through the Ethernet interface.

[0029] Further, in one embodiment, each lcore periodically performs the following operations:

[0030] If the number of OAM packets in its own buffer is greater than the OAM high threshold, update its fourth flag bit to D1; if the number of OAM packets in its own buffer is less than the OAM low threshold, update its fourth flag bit to D3; otherwise, update its fourth flag bit to D2.

[0031] For the first producer, the step of selecting a lockable buffer as the first target buffer includes:

[0032] If the number of OAM packets in its own buffer is less than or equal to the OAM high threshold and its own buffer is lockable, select its own buffer as the first target buffer;

[0033] If the number of OAM packets in its own buffer is greater than the OAM high threshold, or its own buffer cannot be locked, then determine whether the buffer of the lcore can be locked according to the priority order of the fourth flag bit being D3, D2, D1 from front to back, and select the lockable buffer as the first target buffer.

[0034] Further, in one embodiment, each lcore periodically performs the following operations:

[0035] If the number of OAM packets in its own buffer is greater than the OAM high threshold, then update its fourth flag bit to D1. If the number of OAM packets in its own buffer is less than the OAM low threshold, then update its fourth flag bit to D3. Otherwise, update its fourth flag bit to D2;

[0036] For the consumers of the first producer, the step of selecting a lockable buffer as the second target buffer includes:

[0037] If the number of network interface packets read by itself last time is greater than or equal to the network interface low threshold, and its own buffer can be locked, then select its own buffer as the second target buffer;

[0038] If the number of network interface packets read by itself last time is less than the network interface low threshold, or its own buffer cannot be locked, then determine whether the buffer of the lcore can be locked according to the priority order of the fourth flag bit being D1, D2, D3 from front to back, and select the lockable buffer as the second target buffer.

[0039] Further, in one embodiment, each lcore periodically performs the following operations:

[0040] If the number of network interface packets read by itself last time is equal to the number of network interface packets requested to be read, then increment its first count by one. Otherwise, decrement its first count by one, where the initial value of the first count is zero and the minimum value is zero;

[0041] If the number of network interface packets read by itself last time is equal to zero, then increment its second count by one. Otherwise, clear its second count to zero, where the initial value of the second count is zero;

[0042] For the consumers of the first producer, the step of reading OAM packets from the second target buffer includes:

[0043] Calculate a first intermediate result based on its own first count. If the rounded result of the first intermediate result is greater than zero, then update the target quantity to the rounded result of the first intermediate result. If the rounded result of the first intermediate result is less than or equal to zero, then update the target quantity to zero, where the larger the first count, the smaller the first intermediate result;

[0044] Calculate a second intermediate result according to one's own second count. If the integer result of the second intermediate result is greater than zero, update the target number of times to the integer result of the second intermediate result. If the integer result of the second intermediate result is less than or equal to zero, update the target number of times to one. Among them, the larger the second count, the larger the second intermediate result;

[0045] Read the OAM packets of the target number of times from the second target buffer, and request to read the target number of OAM packets each time.

[0046] Furthermore, in one embodiment, the OAM traffic processing method further includes:

[0047] The decision maker takes the new first producer as the new decision maker.

[0048] Furthermore, in one embodiment, after the multi-core processor is started, one lcore is defaulted as the decision maker, one lcore is the first producer, and each lcore is the consumer of the first producer.

[0049] Furthermore, in one embodiment, the buffer of the lcore is a circular buffer.

[0050] In a second aspect, an embodiment of the present application further provides an OAM traffic processing device based on a multi-core processor. The OAM traffic processing device includes a multi-core processor, a memory, and an OAM traffic processing program stored on the memory and executable by the multi-core processor. When the OAM traffic processing program is executed by the multi-core processor, the steps of the above OAM traffic processing method are implemented.

[0051] In the present application, the OAM processing process is disassembled into a packet assembly and packet sending process. The roles of the lcores are divided into a decision maker, a first producer, and a consumer of the first producer. The decision maker takes the lcore that is predicted to read fewer network interface packets in the future as the new first producer, and each lcore as the consumer of the first producer. The first producer assembles the OAM packets of all entries and writes them into the buffer of one of the lcores. When the number of network interface packets read by the consumer of the first producer is small in the most recent reading, it reads the OAM packets from the buffer of one of the lcores and sends them. Through the present application, the OAM packet load is reasonably allocated, the core resource utilization rate is improved, so that while improving the OAM packet sending efficiency, the device forwarding performance is not reduced or less reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 It is a schematic flowchart of the OAM traffic processing method in an embodiment of the present application;

[0053] Figure 2Schematic diagram of the relationship between the first producer, its consumers and each buffer in an embodiment of the present application;

[0054] Figure 3 For the OAM traffic processing method in another embodiment of the present application relative to Figure 1 Schematic diagram of the newly added process;

[0055] Figure 4 Schematic diagram of the relationship between the second producer, its consumers and each buffer in an embodiment of the present application;

[0056] Figure 5 Schematic diagram of the hardware structure of the OAM traffic processing device based on a multi-core processor involved in the embodiment solution of the present application. Detailed implementation manners

[0057] In order to enable those skilled in the art of the present technology to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0058] First, some technical terms in the present application are explained to facilitate the understanding of the present application by those skilled in the art.

[0059] Multi-core processor: A multi-core processor refers to a physical chip integrated with multiple processing cores. The use of a multi-core processor can execute multiple tasks in parallel, improving the overall processing capacity of the system. By using the parallel computing ability of the multi-core processor, the simultaneous processing and scheduling of network traffic can be achieved.

[0060] DPDK (Data Plane Development Kit): DPDK is a development toolset for fast packet processing. By bypassing the operating system kernel and directly performing packet reception, transmission and processing in the user space, the performance of network applications can be improved. DPDK provides a series of optimization and acceleration technologies, enabling network packets to be efficiently processed on a multi-core processor.

[0061] lcore (Logical Core): In DPDK, lcore represents a logical core. It is a concept in DPDK for abstracting processor resources. In a multi-core processor system, DPDK treats each physical core or hyper-thread as a logical unit that can be independently scheduled to execute tasks, and these logical units are lcores. For example, a processor with 4 physical cores, when hyper-threading technology is supported (each physical core can have 2 threads), the system may have 8 lcores available for DPDK to use.

[0062] OAM (Operation Administration and Maintenance): OAM is a key technology for monitoring and managing network performance, fault diagnosis, and ensuring network service quality. OAM can quickly detect and monitor the forwarding connectivity status of links or IP routes in the network to improve network performance. When adjacent systems detect communication failures through quick detection, they can establish backup channels faster to restore communication and ensure network reliability. OAM provides support for many upper-layer protocols.

[0063] OAM entry: A data structure in a network device for supporting the OAM function, mainly used to store information related to network operation, management, and maintenance. The device processes corresponding operations according to different OAM tasks through OAM entries. Common OAM entries include connectivity detection entries, performance monitoring entries, configuration management entries, etc.

[0064] Buffer: In DPDK, buffers are often used to transfer data packets between different processing modules.

[0065] To make the objectives, technical solutions, and advantages of this application clearer, the following will further describe the embodiments of this application in detail with reference to the accompanying drawings.

[0066] In a first aspect, an embodiment of this application provides an OAM traffic processing method based on a multi-core processor.

[0067] Figure 1 The flowchart of the OAM traffic processing method based on a multi-core processor in an embodiment of this application is shown.

[0068] Refer to Figure 1 , in an embodiment, the OAM traffic processing method based on a multi-core processor includes the following steps:

[0069] S1. When there is an lcore that meets the preset conditions, the decision maker selects one lcore as the new first producer, and each lcore is regarded as a consumer of the first producer. The preset conditions are used to predict an lcore that will read fewer network interface packets in the future based on the number of network interface packets already read by the lcore history.

[0070] Specifically, the multi-core processor has multiple lcores, and each lcore reads network interface packets from the Ethernet interface regularly. Network interface packets and OAM packets are different types of packets. The content of network interface packets is mainly service data, while the content of OAM packets is network management data.

[0071] In this embodiment, the OAM processing process is disassembled into a packet assembly process and a packet sending process. The lcore responsible for OAM packet assembly is defined as the producer, and the lcore responsible for OAM packet sending is defined as the consumer. In the traditional solution, both OAM packet assembly and packet sending are responsible by a fixed lcore, which is called the main core. In this embodiment, the OAM packet sending load is shared, and a single-producer multi-consumer mode is adopted. One lcore is used as the producer to be responsible for packet assembly, and each lcore (including the producer itself) is used as a consumer of the producer to be responsible for packet sending. The producer in this mode is defined as the first producer. On this basis, an lcore is also designated to be responsible for allocating the role of the first producer to a suitable lcore, and this lcore is defined as the decision maker. The decision maker may be the first producer or its consumer.

[0072] It can be understood that for an lcore, the more network interface packets read in the history, the more network interface packets that may be read in the future, the more resources required to process network interface packets, and correspondingly, the fewer resources available for other operations. And the lcore that is the first producer is also the consumer of the first producer, and needs to perform OAM packet assembly and packet sending, and the resources consumed are higher than other lcores.

[0073] Therefore, in this embodiment, the decision maker predicts an lcore that will read fewer network interface packets in the future based on the number of network interface packets already read by the lcore history, and selects one of them as the first producer for the next decision cycle, which helps to reasonably allocate the OAM packet load.

[0074] Exemplarily, the decision maker executes step S1 every first time period to select the lcore that will be the first producer within the next first time period.

[0075] Optionally, the decision maker and the first producer can be served by the same lcore or different lcores.

[0076] Optionally, the decision maker can be a fixed lcore, or the current decision maker can designate a new decision maker according to a certain strategy.

[0077] S2. The first producer packages the OAM messages of all table entries, selects a lockable buffer as the first target buffer, and writes the packaged OAM messages into the first target buffer, wherein each lcore has a buffer, and the first producer and its consumers will lock the buffer when performing read and write operations.

[0078] Figure 2 A schematic diagram showing the relationship between the first producer and its consumers and each buffer zone in an embodiment of the present application is shown.

[0079] Reference Figure 2 , the first producer may write OAM messages to any buffer, and each consumer of the first producer may read OAM messages from any buffer.

[0080] In this embodiment, the first producer and its consumers will lock the buffer when performing read and write operations, thereby ensuring data consistency, avoiding race conditions, and ensuring the correctness and stability of the program in a single-producer and multi-consumer mode.

[0081] It should be noted that being lockable is a basic condition for selecting the first target buffer, and other conditions may be selectively added.

[0082] For example, the first producer executes step S2 once every second time period.

[0083] S3. When the number of network port messages read by the consumer of the first producer most recently is less than or equal to the network port high threshold, the consumer of the first producer selects a lockable buffer as the second target buffer, reads the OAM message from the second target buffer, and sends the read OAM message out from the Ethernet interface.

[0084] In this embodiment, the consumer of the first producer will read OAM messages from the buffer only when the number of network port messages read most recently is less than or equal to the network port high threshold, thereby avoiding OAM packet sending from occupying the resources required for processing network port messages to ensure forwarding performance.

[0085] It should be noted that being lockable is a basic condition for selecting the second target buffer, and other conditions may be optionally added.

[0086] By way of example, the consumer of the first producer executes step S3 once every third time period.

[0087] Thus, through this embodiment, the OAM packet assembly load will be shared by one lcore with a relatively low network interface packet load, and the OAM packet sending load will be shared by all lcores. By reasonably allocating the OAM packet load, the utilization rate of core resources is improved, so that while the OAM packet sending efficiency is enhanced, the forwarding performance of the device is not reduced or only slightly reduced.

[0088] Figure 3 shows the OAM traffic processing method in another embodiment of the present application relative to Figure 1 a schematic diagram of the newly added process; Figure 4 shows a schematic diagram of the relationship between the second producer, its consumer, and each buffer in an embodiment of the present application.

[0089] Further, in one embodiment, the OAM traffic processing method further includes:

[0090] When there is no lcore that meets the preset conditions, the decision maker regards each lcore as the second producer and its consumer;

[0091] The second producer assembles the OAM packets of the corresponding table entries it is responsible for, and writes the assembled OAM packets into its own buffer;

[0092] The consumer of the second producer reads the OAM packets from its own buffer and sends the read OAM packets out from the Ethernet interface.

[0093] In this embodiment, when there is no lcore that meets the preset conditions, it is predicted that all lcores will read a relatively large number of network interface packets in the future, and the mode is changed from the single producer and multiple consumers mode to the multi-core parallel single producer and single consumer mode. The producer in this mode is defined as the second producer. Each lcore is responsible for processing the OAM packets of the corresponding table entries. For example, lcore1 processes the OAM packets with table entry ID 1, and lcore2 processes the OAM packets with table entry IDs 2 and 3, so as to distribute the OAM packet load to each lcore.

[0094] Referring to Figure 4 , the second producer only writes OAM packets into its own buffer, and the consumer of the second producer only reads OAM packets from its own buffer. The reading and writing order will not conflict. Therefore, the second producer and its consumer do not need to lock when performing reading and writing operations on the buffer.

[0095] Optionally, each lcore is responsible for processing the OAM packets of one or more table entries, and the total sending frequency of the responsible table entries is close to the reserved OAM packet processing capacity of the lcore.

[0096] Further, in one embodiment, each lcore periodically performs the following operations:

[0097] If the number of network interface packets read most recently by itself is greater than the network interface high threshold, update its first flag bit to A1; if the number of network interface packets read most recently by itself is less than the network interface low threshold, update its first flag bit to A3; otherwise, update its first flag bit to A2;

[0098] If the number of network interface packets read most recently by itself is equal to the number of network interface packets requested to be read, increment its first count by one; otherwise, decrement its first count by one, where the initial value of the first count is zero and the minimum value is zero;

[0099] If its first count is greater than the full fetch threshold, update its second flag bit to B2; otherwise, update its second flag bit to B1, where the initial value of the second flag bit is B1;

[0100] If the number of network interface packets read most recently by itself is equal to zero, increment its second count by one; otherwise, clear its second count to zero, where the initial value of the second count is zero;

[0101] If its second count is greater than the empty fetch threshold, update its third flag bit to C2; otherwise, update its third flag bit to C1, where the initial value of the third flag bit is C1;

[0102] For the decision maker, the step of selecting one lcore as the new first producer from the lcores that meet the preset conditions includes:

[0103] If there is an lcore with the third flag bit being C2, select one lcore from them as the new first producer;

[0104] If there is no lcore with the third flag bit being C2 and there is an lcore with the second flag bit being B1, select one lcore with the highest priority of the first flag bit from them as the new first producer, where the priorities of A1, A2, and A3 increase in sequence.

[0105] Specifically, each lcore requests to read a fixed number of network interface packets. If the number of network interface packets in the Ethernet interface is greater than or equal to the requested number, the lcore will read the requested number of network interface packets; if the number of network interface packets in the Ethernet interface is less than the requested number, it will read all the network interface packets in the Ethernet interface.

[0106] The first flag bit is updated based on the relationship between the number of network interface packets read by the lcore last time and the high threshold and low threshold of the network interface. When the first flag bit is A1, it indicates that the network interface packet load of the lcore is high; when the first flag bit is A2, it indicates that the network interface packet load of the lcore is average; when the first flag bit is A3, it indicates that the network interface packet load of the lcore is low. The decision maker increases the priority of selecting the lcore with the first flag bit being A1, A2, and A3 as the first producer in turn.

[0107] The situation where the number of network interface packets read by the lcore is equal to the number of network interface packets requested to be read is simply referred to as the network interface packets being fully fetched. The first count is updated based on the number of times the network interface packets of the lcore are fully fetched. The second flag bit is updated based on the relationship between the first count and the full fetch threshold. When the second flag bit is B1, it indicates that the probability of the network interface packets of the lcore being fully fetched is average; when the second flag bit is B2, it indicates that the probability of the network interface packets of the lcore being fully fetched is high. The decision maker believes that the lcore with the second flag bit being B2 is not suitable as the first producer.

[0108] The situation where the number of network interface packets read by the lcore is equal to zero is simply referred to as the network interface packets being emptied. The second count is updated based on the number of times the network interface packets of the lcore are emptied. The third flag bit is updated based on the relationship between the second count and the empty threshold. When the third flag bit is C1, it indicates that the probability of the network interface packets of the lcore being emptied is average; when the third flag bit is C2, it indicates that the probability of the network interface packets of the lcore being emptied is high. The decision maker believes that the lcore with the third flag bit being C2 is suitable as the first producer.

[0109] It should be noted that in actual operation, it is almost impossible for the second flag bit of the same lcore to be B2 and the third flag bit to be C2. Even if this situation occurs, the decision maker will take the result of the third flag bit as the standard, that is, consider that the lcore is suitable as the first producer.

[0110] Therefore, in this embodiment, "there is an lcore that meets the preset conditions" specifically means "there is an lcore with the third flag bit being C2 or there is an lcore with the second flag bit being B1". When the decision maker selects a new first producer, it preferentially selects the lcore with the third flag bit being C2, and then selects the lcore with the second flag bit being B1. Among the lcores with the second flag bit being B1, it selects in the priority order of the first flag bit being A3, A2, and A1 from front to back. Through this embodiment, the first producer selected by the decision maker is most likely to be the lcore that will read the fewest network interface packets in the future, thereby further optimizing the OAM packet load distribution.

[0111] Further, in one embodiment, each lcore updates its own pending packet count according to the number of packets read, the number of packets sent, and the number of packets discarded.

[0112] For the decision maker, the step of selecting an lcore with the highest priority of the first flag bit as the new first producer includes:

[0113] When the second flag is B1 and the lcore with the highest priority in the first flag is unique, the lcore is used as the new first producer;

[0114] When the second flag bit is B1 and the lcore with the highest priority of the first flag bit is not unique, a lcore with the least number of messages to be processed is selected as the new first producer.

[0115] For example, each time the lcore reads a message, the number of messages to be processed is increased by one, and each time a message is sent or discarded, the number of messages to be processed is reduced by one. The above messages include OAM messages and network port messages.

[0116] In this embodiment, among the lcores with the same first flag bit, selection is made in order of priority from small to large number of messages to be processed. In this way, the first producer selected will most likely be the lcore with the most allocatable resources, thereby further optimizing the OAM message load distribution.

[0117] Furthermore, in one embodiment, the OAM traffic processing method further includes:

[0118] When there is no lcore with the third flag bit of C2 and no lcore with the second flag bit of B1, the decision maker regards each lcore as the second producer and its consumer;

[0119] The second producer packages the OAM messages of the corresponding table entries for which it is responsible, and writes the packaged OAM messages into its own buffer;

[0120] The consumer of the second producer reads the OAM message from its own buffer and sends the read OAM message out from the Ethernet interface.

[0121] In this embodiment, "there is no lcore that meets the preset conditions" specifically means "there is no lcore whose third flag bit is C2 and there is no lcore whose second flag bit is B1". The relevant description of the second producer and its consumer refers to the previous embodiment and will not be repeated here.

[0122] Furthermore, in one embodiment, when there is no lcore whose third flag bit is C2 and no lcore whose second flag bit is B1, the decision maker selects an lcore whose first flag bit has the highest priority as the new decision maker, wherein the priorities of A1, A2, and A3 are increased in sequence.

[0123] In this embodiment, considering that the operation of the decision maker also consumes certain resources, when adopting the single-producer single-consumer mode with multi-core parallelism, the current decision maker selects the lcore with the lowest network interface message load as the new decision maker according to the first flag bit, thereby further optimizing the overall load distribution.

[0124] Further, in one embodiment, each lcore periodically performs the following operations:

[0125] If the number of OAM messages in its own buffer is greater than the OAM high threshold, update its fourth flag bit to D1; if the number of OAM messages in its own buffer is less than the OAM low threshold, update its fourth flag bit to D3; otherwise, update its fourth flag bit to D2.

[0126] For the first producer, the step of selecting a lockable buffer as the first target buffer includes:

[0127] If the number of OAM messages in its own buffer is less than or equal to the OAM high threshold and its own buffer is lockable, select its own buffer as the first target buffer;

[0128] If the number of OAM messages in its own buffer is greater than the OAM high threshold or its own buffer is not lockable, determine whether the buffer of the lcore can be locked according to the priority order of the fourth flag bit being D3, D2, D1 from front to back, and select the lockable buffer as the first target buffer.

[0129] Specifically, the fourth flag bit is updated based on the size relationship between the number of OAM messages in the buffer and the OAM high threshold and the OAM low threshold. The fourth flag bit being D1 indicates that the backlog of OAM messages in the buffer is high, the fourth flag bit being D2 indicates that the backlog of OAM messages in the buffer is average, and the fourth flag bit being D3 indicates that the backlog of OAM messages in the buffer is low.

[0130] On the one hand, since the first producer needs to write OAM messages to the first target buffer, in order to balance the number of OAM messages in each buffer as much as possible and avoid overflow, a buffer with a small number of OAM messages should be selected as the first target buffer as much as possible.

[0131] On the other hand, for the first producer, the number of OAM messages in its own buffer is updated in real time and has the highest reliability. The number of OAM messages in the buffers of other lcores can only be known through the fourth flag bit about the interval, and the reliability is low. Moreover, the farther the current time is from the last update time of the fourth flag bit, the lower the reliability of the interval where the number of OAM messages is located.

[0132] Therefore, in this embodiment, the first producer first determines whether its own buffer is suitable as the first target buffer. As long as the backlog of OAM packets is not high and the buffer can be locked, it selects its own buffer as the first target buffer. Secondly, it determines whether the buffer of the lcore can be locked in the priority order of the OAM packet backlog from low to high, and selects the buffer that can be locked as the first target buffer. Through this embodiment, the first target buffer can be selected more reasonably, avoiding overflow.

[0133] Further, in one embodiment, each lcore periodically performs the following operations:

[0134] If the number of OAM packets in its own buffer is greater than the OAM high threshold, update its fourth flag bit to D1. If the number of OAM packets in its own buffer is less than the OAM low threshold, update its fourth flag bit to D3. Otherwise, update its fourth flag bit to D2;

[0135] For the consumers of the first producer, the step of selecting a lockable buffer as the second target buffer includes:

[0136] If the number of network port packets read last time by itself is greater than or equal to the network port low threshold, and its own buffer can be locked, select its own buffer as the second target buffer;

[0137] If the number of network port packets read last time by itself is less than the network port low threshold, or its own buffer cannot be locked, determine whether the buffer of the lcore can be locked in the priority order of the fourth flag bit being D1, D2, D3 from front to back, and select the buffer that can be locked as the second target buffer.

[0138] Specifically, the relevant description of the fourth flag bit refers to the previous embodiment and will not be elaborated here.

[0139] On the one hand, since each lcore is a consumer of the first producer, when the load of network port packets is not too high, it is necessary to select the second target buffer. To avoid excessive lock judgment affecting efficiency, the consumers of the first producer prefer to select their own buffers as the second target buffer.

[0140] On the other hand, when the load of network port packets of the consumers of the first producer is low, more resources can be allocated to OAM packet transmission, and the processing efficiency is high. At this time, selecting the buffer with more OAM packets as the second target buffer can improve resource utilization and help balance the number of OAM packets in each buffer, avoiding overflow.

[0141] Therefore, in this embodiment, the first producer first determines whether its own buffer is suitable as the second target buffer. If the load of the network interface packet is average and its buffer can be locked, it selects its own buffer as the second target buffer. Secondly, it determines whether the buffer of the lcore can be locked in the priority order of the OAM packet backlog from high to low, and selects the buffer that can be locked as the second target buffer. Through this embodiment, the second target buffer can be selected more reasonably, overflow can be avoided, and resource utilization can be improved.

[0142] Further, in one embodiment, each lcore periodically performs the following operations:

[0143] If the number of network interface packets read last time by itself is equal to the number of network interface packets requested to be read, increment its first count by one; otherwise, decrement its first count by one, where the initial value of the first count is zero and the minimum value is zero;

[0144] If the number of network interface packets read last time by itself is equal to zero, increment its second count by one; otherwise, clear its second count to zero, where the initial value of the second count is zero;

[0145] For the consumer of the first producer, the step of reading the OAM packet from the second target buffer includes:

[0146] Calculate a first intermediate result based on its own first count. If the integer result of the first intermediate result is greater than zero, update the target quantity to the integer result of the first intermediate result; if the integer result of the first intermediate result is less than or equal to zero, update the target quantity to zero, where the larger the first count, the smaller the first intermediate result;

[0147] Calculate a second intermediate result based on its own second count. If the integer result of the second intermediate result is greater than zero, update the target number of times to the integer result of the second intermediate result; if the integer result of the second intermediate result is less than or equal to zero, update the target number of times to one, where the larger the second count, the larger the second intermediate result;

[0148] Read the OAM packets for the target number of times from the second target buffer, and request to read the OAM packets of the target quantity each time.

[0149] Specifically, the relevant descriptions of the first count and the second count refer to the previous embodiment and will not be elaborated here.

[0150] For the consumer of the first producer, in order to ensure the forwarding performance, the higher the possibility of filling the network interface packets, the fewer resources are planned to be allocated to OAM packet sending; in order to make full use of resources, the higher the possibility of emptying the network interface packets, the more resources are planned to be allocated to OAM packet sending.

[0151] In this embodiment, the number of OAM packets read by the consumer of the first producer each time a request is made is controlled by the first count, and the number of times the consumer of the first producer requests to read OAM packets within the consumption cycle is controlled by the second count, so as to ensure the forwarding performance while making full use of resources.

[0152] Exemplarily, the first intermediate result = a * (1 - the first count / b), where both a and b are positive integers, and the first intermediate result calculated in this way must be less than or equal to a.

[0153] Exemplarily, the second intermediate result = c * the second count / (the second count + 1), where c is a positive integer, and the second intermediate result calculated in this way must be less than c.

[0154] Furthermore, in one embodiment, the OAM traffic processing method further includes:

[0155] The decision maker takes the new first producer as the new decision maker.

[0156] In this embodiment, considering that the operation of the decision maker also consumes certain resources, when adopting the single-producer multi-consumer mode, the current decision maker also takes the new first producer as the new decision maker, so as to further optimize the overall load distribution without additional computational effort.

[0157] Furthermore, in one embodiment, after the multi-core processor is started, one lcore is defaulted as the decision maker, one lcore is defaulted as the first producer, and each lcore is a consumer of the first producer.

[0158] In this embodiment, after the multi-core processor is started, the single-producer multi-consumer mode is adopted. The decision maker and the first producer in the first decision cycle are specified in advance by the user. Whether to adopt the single-producer multi-consumer mode in each subsequent decision cycle, and which lcore to select as the first producer when adopting the single-producer multi-consumer mode, are dynamically determined by the decision maker according to the running situation.

[0159] Of course, in other embodiments, other modes can also be adopted after the multi-core processor is started. As long as the number of network interface packets read by the lcore history is counted, the decision maker can predict the lcore that will read fewer network interface packets in the future as the new first producer.

[0160] Furthermore, in one embodiment, the buffer of the lcore is a circular buffer.

[0161] A ring buffer is essentially a fixed-size array whose head and tail are connected to form a ring. Two pointers, namely the read pointer and the write pointer, are used to manage the read and write operations of data. The write pointer is used to indicate the next position where data can be written, and the read pointer indicates the next position where data can be read.

[0162] In this embodiment, the buffer of the lcore is a ring buffer, which can efficiently utilize memory, ensure the order of data, reduce the latency of data access, and is easy to implement and maintain.

[0163] In a second aspect, an OAM traffic processing device based on a multi-core processor is provided in an embodiment of the present application. The OAM traffic processing device can be a device with data processing functions such as a personal computer (PC), a laptop, or a server.

[0164] Figure 5 The schematic diagram of the hardware structure of the OAM traffic processing device based on a multi-core processor involved in the solution of the embodiment of the present application is shown.

[0165] Refer to Figure 5 , in the embodiment of the present application, the OAM traffic processing device based on a multi-core processor may include a multi-core processor, a memory, a communication interface, and a communication bus.

[0166] Among them, the communication bus can be of any type and is used to interconnect the multi-core processor, the memory, and the communication interface.

[0167] The communication interface includes interfaces such as input / output (I / O) interfaces, physical interfaces, and logical interfaces for implementing the interconnection of components inside the OAM traffic processing device, as well as interfaces for implementing the interconnection of the OAM traffic processing device with other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display, a keyboard, etc.

[0168] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical memory, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0169] The multi-core processor can call the OAM traffic processing program stored in the memory and execute the OAM traffic processing method provided by the embodiments of the present application. Among them, the method executed when the OAM traffic processing program is called can refer to the various embodiments of the OAM traffic processing method of the present application, which will not be elaborated here.

[0170] Those skilled in the art can understand that Figure 5 the hardware structure shown in

[0171] It should be noted that the serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments.

[0172] The terms "including" and "having" and any variations thereof in the specification, claims and drawings of the present application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices. The descriptions of "first", "second", "third", etc. are used to distinguish different objects, etc., and do not represent the order of precedence, nor do they limit that "first", "second" and "third" are different types.

[0173] In the description of the embodiments of the present application, "exemplary", "for example" or "for instance" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplary", "for example" or "for instance" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of the words "exemplary", "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0174] In the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may mean A or B. The "and / or" in the text is merely a description of the relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality of" means two or more than two.

[0175] In some processes described in the embodiments of the present application, there are a plurality of operations or steps that appear in a specific order. However, it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or may be executed in parallel. The serial numbers of the operations are only used to distinguish different operations, and the serial numbers themselves do not represent any order of execution. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.

[0176] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases, the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium as described above (such as ROM / RAM, magnetic disk, optical disc), and includes several instructions to enable a terminal device to execute the methods described in the various embodiments of the present application.

[0177] The above are only the preferred embodiments of the present application, and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present application.

Claims

1. An OAM traffic processing method based on a multi-core processor, characterized in that, The described OAM traffic processing method includes: When there is an lcore that meets the preset conditions, the decision maker selects one lcore as the new first producer from them, and each lcore is used as the consumer of the first producer, where the preset conditions are used to predict the lcore that will read fewer network interface packets in the future based on the number of network interface packets already read by the lcore history; The first producer packs the OAM packets of all entries, selects a lockable buffer as the first target buffer, and writes the packed OAM packets into the first target buffer. Each lcore has a buffer, and the first producer and its consumers will lock when reading and writing to the buffer; When the number of network interface packets read by the consumer of the first producer is less than or equal to the network interface high threshold in its most recent read, it selects a lockable buffer as the second target buffer, reads the OAM packets from the second target buffer, and sends the read OAM packets out from the Ethernet interface.

2. The OAM traffic processing method based on a multi-core processor according to claim 1, wherein The described OAM traffic processing method further includes: When there is no lcore that meets the preset conditions, each lcore is used as the second producer and its consumer; The second producer packs the OAM packets of the corresponding entries it is responsible for and writes the packed OAM packets into its own buffer; The consumer of the second producer reads the OAM packets from its own buffer and sends the read OAM packets out from the Ethernet interface.

3. The OAM traffic processing method based on a multi-core processor according to claim 1, wherein, Each lcore regularly performs the following operations: If the number of network interface packets read in its most recent read is greater than the network interface high threshold, it updates its first flag bit to A1. If the number of network interface packets read in its most recent read is less than the network interface low threshold, it updates its first flag bit to A3. Otherwise, it updates its first flag bit to A2; If the number of network interface packets read in its most recent read is equal to the number of network interface packets requested to be read, it increments its first count by one. Otherwise, it decrements its first count by one, where the initial value of the first count is zero and the minimum value is zero; If its first count is greater than the full fetch threshold, it updates its second flag bit to B2. Otherwise, it updates its second flag bit to B1, where the initial value of the second flag bit is B1; If the number of network interface packets read in its most recent read is equal to zero, it increments its second count by one. Otherwise, it clears its second count, where the initial value of the second count is zero; If its second count is greater than the empty fetch threshold, it updates its third flag bit to C2. Otherwise, it updates its third flag bit to C1, where the initial value of the third flag bit is C1; For the decision maker, the step of selecting one lcore as the new first producer when there is an lcore that meets the preset conditions includes: If there is an lcore with the third flag bit being C2, select one lcore from them as the new first producer; If there is no lcore with the third flag bit being C2 and there is an lcore with the second flag bit being B1, then select one lcore with the highest priority of the first flag bit as the new first producer, where the priorities of A1, A2, and A3 increase in sequence.

4. The OAM traffic processing method based on a multi-core processor according to claim 3, wherein Each lcore updates its pending packet count according to the number of packets read, the number of packets sent, and the number of packets discarded. For the decision maker, the step of selecting one lcore with the highest priority of the first flag bit as the new first producer includes: When the second flag bit is B1 and the lcore with the highest priority of the first flag bit is unique, use this lcore as the new first producer; When the second flag bit is B1 and the lcores with the highest priority of the first flag bit are not unique, select one lcore with the least pending packet count as the new first producer.

5. The OAM traffic processing method based on a multi-core processor according to claim 3, characterized in that, The OAM traffic processing method further includes: When there is no lcore with the third flag bit being C2 and no lcore with the second flag bit being B1, the decision maker uses each lcore as a second producer and its consumer; The second producer assembles the OAM packets for the corresponding table entries it is responsible for and writes the assembled OAM packets into its buffer; The consumer of the second producer reads the OAM packets from its buffer and sends the read OAM packets out through the Ethernet interface.

6. The OAM traffic processing method based on a multi-core processor according to claim 1, characterized in that, Each lcore periodically performs the following operations: If the number of OAM packets in its buffer is greater than the OAM high threshold, update its fourth flag bit to D1; if the number of OAM packets in its buffer is less than the OAM low threshold, update its fourth flag bit to D3; otherwise, update its fourth flag bit to D2; For the first producer, the step of selecting a lockable buffer as the first target buffer includes: If the number of OAM packets in its buffer is less than or equal to the OAM high threshold and its buffer is lockable, select its buffer as the first target buffer; If the number of OAM packets in its buffer is greater than the OAM high threshold or its buffer is not lockable, then determine whether the buffer of the lcore can be locked in the priority order of the fourth flag bit being D3, D2, D1 from front to back, and select the lockable buffer as the first target buffer.

7. The OAM traffic processing method based on a multi-core processor according to claim 1, characterized in that Each lcore periodically performs the following operations: If the number of OAM packets in its buffer is greater than the OAM high threshold, update its fourth flag bit to D1; if the number of OAM packets in its buffer is less than the OAM low threshold, update its fourth flag bit to D3; otherwise, update its fourth flag bit to D2; For the consumer of the first producer, the step of selecting a lockable buffer as the second target buffer includes: If the number of network interface packets read most recently is greater than or equal to the network interface low threshold and its buffer is lockable, select its buffer as the second target buffer; If the number of network interface packets read most recently by itself is less than the lower threshold of the network interface, or the buffer of itself cannot be locked, then determine whether the buffer of the lcore can be locked according to the priority order of the fourth flag bits being D1, D2, D3 from front to back, and select the buffer that can be locked as the second target buffer.

8. The OAM traffic processing method based on a multi-core processor according to claim 1, characterized in that Each lcore regularly performs the following operations: If the number of network interface packets read most recently by itself is equal to the number of network interface packets requested to be read, then increment its first count by one, otherwise decrement its first count by one, where the initial value of the first count is zero and the minimum value is zero; If the number of network interface packets read most recently by itself is equal to zero, then increment its second count by one, otherwise clear its second count to zero, where the initial value of the second count is zero; For the consumer of the first producer, the step of reading the OAM packets from the second target buffer includes: Calculate a first intermediate result based on its first count. If the rounded result of the first intermediate result is greater than zero, then update the target quantity to the rounded result of the first intermediate result. If the rounded result of the first intermediate result is less than or equal to zero, then update the target quantity to zero, where the larger the first count, the smaller the first intermediate result; Calculate a second intermediate result based on its second count. If the rounded result of the second intermediate result is greater than zero, then update the target number of times to the rounded result of the second intermediate result. If the rounded result of the second intermediate result is less than or equal to zero, then update the target number of times to one, where the larger the second count, the larger the second intermediate result; Read the target number of OAM packets from the second target buffer, and request to read the target quantity of OAM packets each time.

9. The OAM traffic processing method based on a multi-core processor according to claim 1, characterized in that, The OAM traffic processing method further includes: The decision maker takes the new first producer as the new decision maker.

10. The OAM traffic processing method based on a multi-core processor according to claim 1, characterized in that, After the multi-core processor is started, by default, one lcore is used as the decision maker, one lcore is used as the first producer, and each lcore is used as a consumer of the first producer.

11. The OAM traffic processing method based on a multi-core processor according to claim 1, characterized in that, The buffer of the lcore is a circular buffer.

12. An OAM traffic processing device based on a multi-core processor, characterized in that, The OAM traffic processing device includes a multi-core processor, a memory, and an OAM traffic processing program stored on the memory and executable by the multi-core processor. When the OAM traffic processing program is executed by the multi-core processor, it implements the steps of the OAM traffic processing method according to any one of claims 1 to 11.