Methods, devices, electronic equipment and computer-readable storage media for packet loss diagnosis
By introducing an embedded CPU and a multi-stage pipeline to detect packet loss signals in the network device chip, and processing and editing alarm messages in the embedded CPU, the problem of limited chip resources in traditional methods being unable to handle a large number of packet losses is solved, and efficient packet loss diagnosis and forwarding are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU CENTEC COMM CO LTD
- Filing Date
- 2023-02-17
- Publication Date
- 2026-05-26
AI Technical Summary
Traditional packet loss diagnosis methods cannot effectively handle the diagnosis of network device chips under conditions of heavy packet loss, resulting in limited chip resources and an inability to process packet loss in a timely manner.
By introducing an embedded CPU into the chip of the network device, packet loss detection is performed through a multi-stage pipeline, a packet loss signal is generated, and the signal is reported to the embedded CPU for processing. After adding additional information, an alarm message is edited and forwarded to the target monitoring device for visualization, thereby reducing the occupation of chip resources.
It enables timely diagnosis and processing in the event of significant packet loss in the chip, improves message processing efficiency, reduces chip resource consumption, and can diagnose and forward messages with packet loss information in batches.
Smart Images

Figure CN116319448B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and more specifically, to a packet loss diagnosis method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] Network device chips typically employ a multi-stage pipeline architecture, which includes an inbound processing pipeline, a traffic management unit, and an outbound processing pipeline. Packets received by the network device pass sequentially through each stage of the pipeline—that is, through the inbound processing pipeline, the traffic management unit, and the outbound processing pipeline—to perform table lookup, editing, and forwarding processing of the packets.
[0003] To address packet loss during chip message processing, traditional packet loss diagnosis methods involve setting up diagnostic information buffer registers at each stage of the chip's pipeline. These registers record the lookup information for each passing message in the pipeline, allowing the CPU (Central Processing Unit) to read and translate the diagnostic information from each register via I / O. However, traditional packet loss diagnosis methods are inadequate for diagnosing cases with significant packet loss. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a packet loss diagnosis method, apparatus, electronic device and computer-readable storage medium, which can improve the problem that traditional methods cannot perform diagnosis and processing when chips suffer a large number of packet losses.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows:
[0006] In a first aspect, embodiments of the present invention provide a packet loss diagnosis method applied to a chip in a network device. The chip includes an embedded CPU and a multi-stage pipeline. The multi-stage pipeline includes an inbound processing pipeline, a traffic management unit, and an outbound processing pipeline. The method includes:
[0007] When receiving the original message sent by the external device, packet loss detection is performed on the original message at each stage of the pipeline. When packet loss is detected at any stage of the pipeline, a packet loss signal is generated according to the cause of packet loss.
[0008] If the retained packet loss signal is detected, the original message and the packet loss signal are reported to the embedded CPU, and the embedded CPU adds first additional information to the original message; wherein, the first additional information includes the packet loss reason in the packet loss signal of the single pipeline.
[0009] After the multi-stage pipeline has completed all packet loss detection and the first additional information corresponding to each stage of the pipeline has been added to the original message, the second additional information and the original message are parsed from the message that has been added; wherein, the second additional information includes the packet loss reason in all packet loss signals;
[0010] The embedded CPU edits an alarm message based on the path information from the network device to the target monitoring device, the second additional information, and the original message, and sends the alarm message to the outgoing processing pipeline.
[0011] The alarm message is forwarded to the target monitoring device through the outgoing processing pipeline, so that the alarm message can be visualized on the target monitoring device.
[0012] Furthermore, the embedded CPU includes an analysis device and a cache device;
[0013] After the step of parsing the second additional information and the original message from the completed message, and before the step of editing the alarm message using the embedded CPU based on the path information from the network device to the target monitoring device, the second additional information, and the original message, the method further includes:
[0014] The analysis device transmits the second additional information and the original message to the buffer device; wherein, the second additional information further includes the forwarding information, source port, egress port, and ingress timestamp of the original message entering the network device;
[0015] The caching device queries a preset packet loss record table to see if the packet loss record information of the original message has been recorded, based on the second additional information and the original message.
[0016] If not, record the packet loss information of the original packet in the packet loss record table;
[0017] If so, update the packet loss record information; wherein the packet loss record information includes the feature fields and packet identifier of the original message, packet loss identifier ID, ingress timestamp, and packet loss count value.
[0018] Further, the step of querying a preset packet loss record table to see if the packet loss record information of the original packet has been recorded based on the second additional information and the original packet includes:
[0019] A hash value is obtained by performing a hash calculation based on the second additional information and the original message;
[0020] Based on the hash value and the message identifier, query the preset packet loss record table to see if there is a message identical to the original message.
[0021] Furthermore, the method also includes:
[0022] The embedded CPU is used to obtain the original packet corresponding to the packet loss identifier ID and the reason for the packet loss of the original packet.
[0023] Based on all the stated reasons for packet loss, a diagnostic identifier is added to the header of the original message to obtain a diagnostic message, and the diagnostic message is resent back to the multi-stage pipeline; wherein, the diagnostic identifier includes a first identifier and a second identifier, the first identifier indicating that the diagnostic message needs to be re-diagnosed, and the second identifier including the diagnostic values of each stage of the pipeline.
[0024] For each pipeline level, if the diagnostic value corresponding to that pipeline level indicates that a diagnosis is needed, the original message is re-detected for packet loss through that pipeline level to obtain diagnostic information; wherein, the diagnostic information includes packet loss bits and / or packet loss content;
[0025] The diagnostic information obtained from each stage of the pipeline is written into the chip register, and a message carrying all diagnostic information is reported to the embedded CPU.
[0026] Further, the step of editing the alarm message based on the path information from the network device to the target monitoring device, the second additional information, and the original message includes:
[0027] According to a preset fixed format, the second additional information and the original message are adjusted and assembled to obtain an adjusted message;
[0028] Determine the path information from the network device to the target monitoring device, and add the path information to the header of the adjustment message;
[0029] For the message carrying all diagnostic information, add all the parsed diagnostic information to the header of the adjustment message;
[0030] The adjustment message containing the aforementioned path information and all diagnostic information will be used as an alarm message.
[0031] Furthermore, the method also includes:
[0032] When the number of packet losses reaches the reporting threshold, the following steps are performed: using the embedded CPU, an alarm message is edited based on the path information from the network device to the target monitoring device, the second additional information, and the original message, and the alarm message is sent to the outgoing processing pipeline.
[0033] Furthermore, after the step of generating a packet loss signal based on the cause of packet loss, and before the step of reporting the original message and the packet loss signal to the embedded CPU when the retained packet loss signal is detected, the method further includes:
[0034] When generating the packet loss signal, a random value is generated, and it is determined whether the random value is greater than a preset threshold. If not, the packet loss signal is retained; if so, the packet loss signal is deleted.
[0035] Secondly, embodiments of the present invention provide a packet loss diagnosis device applied to a chip in a network device. The chip includes an embedded CPU and a multi-stage pipeline. The multi-stage pipeline includes an inbound processing pipeline, a traffic management unit, and an outbound processing pipeline. The packet loss diagnosis device includes a packet loss detection module, a reporting module, a receiving module, a parsing module, a sending module, and a forwarding module.
[0036] The packet loss detection module is used to perform packet loss detection on the original message sent by the external device at each stage of the pipeline when receiving the original message. When packet loss is detected at any stage of the pipeline, a packet loss signal is generated according to the cause of packet loss.
[0037] The reporting module is used to report the original message and the packet loss signal to the embedded CPU when the retained packet loss signal is detected.
[0038] The receiving module is configured to add first additional information to the original message via the embedded CPU; wherein, the first additional information includes the reason for packet loss in the packet loss signal of the single-stage pipeline.
[0039] The parsing module is used to parse the second additional information and the original message from the message after all packet loss detections have been completed in the multi-stage pipeline and the first additional information corresponding to each stage of the pipeline has been added to the original message; wherein, the second additional information includes the packet loss reason in all packet loss signals;
[0040] The sending module is used to edit an alarm message based on the path information from the network device to the target monitoring device, the second additional information and the original message through the embedded CPU, and send the alarm message to the outgoing processing pipeline.
[0041] The forwarding module is used to forward the alarm message to the target monitoring device through the outgoing processing pipeline, so that the alarm message can be visualized on the target monitoring device.
[0042] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the packet loss diagnosis method as described in the first aspect.
[0043] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the packet loss diagnosis method as described in the first aspect.
[0044] The packet loss diagnosis method, apparatus, electronic device, and computer-readable storage medium provided in this invention, when the chip of a network device receives an original packet, sequentially performs packet loss detection on the original packet through an inbound processing pipeline, a traffic management unit, and an outbound processing pipeline, and generates packet loss information. The retained packet loss signals are reported to the embedded CPU set on the chip. The embedded CPU adds first additional information corresponding to the packet loss signals of each pipeline stage to the original packet. Then, the embedded CPU parses the packet after all the first additional information has been added to obtain second additional information and the original packet. Combined with the path information from the network device to the target monitoring device, an alarm message is edited. The edited message is then forwarded to the target monitoring device through the outbound processing pipeline for visualization. The embedded CPU is used as an independent resource to process packet loss in batches in a timely manner without occupying the chip's processing resources. Moreover, by adding packet loss information (i.e., first additional information and second additional information) to the packet, it realizes batch diagnosis of packets and batch forwarding of packets with added packet loss information based on the chip's original pipeline, which can greatly improve the packet processing efficiency.
[0045] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0046] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 A schematic diagram of the packet loss diagnosis system provided in an embodiment of the present invention is shown.
[0048] Figure 2 A block diagram of a network device provided in an embodiment of the present invention is shown.
[0049] Figure 3 This is a schematic flowchart of one of the packet loss diagnosis methods provided in an embodiment of the present invention.
[0050] Figure 4 The second schematic flowchart of the packet loss diagnosis method provided in the embodiment of the present invention is shown.
[0051] Figure 5 The third schematic flowchart of the packet loss diagnosis method provided in the embodiment of the present invention is shown.
[0052] Figure 6 The fourth flowchart of the packet loss diagnosis method provided in the embodiment of the present invention is shown.
[0053] Figure 7 A schematic diagram of the message format provided in an embodiment of the present invention is shown.
[0054] Figure 8 It shows Figure 3 or Figure 4 A flowchart illustrating some sub-steps of step S17.
[0055] Figure 9 A schematic diagram of the alarm message structure provided in an embodiment of the present invention is shown.
[0056] Figure 10 A block diagram of the packet loss diagnosis device provided in an embodiment of the present invention is shown.
[0057] Figure 11 A block diagram of an electronic device provided in an embodiment of the present invention is shown.
[0058] Reference numerals: 100-Packet loss diagnosis system; 110-Network equipment; 111-Chip; 112-External CPU; 113-Embedded CPU; 114-Incoming processing pipeline; 115-Traffic management unit; 116-Outgoing processing pipeline; 120-External equipment; 130-Monitoring equipment; 140-Packet loss diagnosis device; 150-Packet loss detection module; 160-Reporting module; 170-Receiving module; 180-Parsing module; 190-Sending module; 200-Forwarding module; 210-Electronic equipment. Detailed Implementation
[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0060] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0061] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0062] Traditional packet loss diagnosis methods involve setting up diagnostic information buffer registers at each stage of the chip's pipeline. These registers record the lookup information for each passing packet, allowing the CPU (Central Processing Unit) to read and translate the diagnostic information from these registers via I / O. However, due to chip resource limitations, while ensuring stable packet reception, editing, and forwarding, the chip cannot handle situations with significant packet loss.
[0063] Based on the above considerations, embodiments of the present invention provide a packet loss diagnosis method, which can improve the problem that traditional methods cannot perform diagnosis and processing when there is a large amount of packet loss in the chip. The following is a description of the solution.
[0064] The packet loss diagnosis method provided in this embodiment of the invention can be applied to... Figure 1 The packet loss diagnosis system 100 shown includes a network device 110, multiple monitoring devices 130, and multiple external devices 120. The network device 110 and the multiple external devices 120 can be connected via network communication. The monitoring devices 130 can communicate directly with the network device 110, or they can communicate with the network device 110 through one or more external devices 120.
[0065] Reference Figure 2The network device 110 may include a chip 111 and an external CPU 112. The chip 111 may include an embedded CPU 113 and a multi-stage pipeline. The multi-stage pipeline includes an ingress processing pipeline 114 (Ingress Process Engine, IPE), a traffic management unit 115 (Taffic Manager, TM), and an egress processing pipeline 116 (Egress Process Engine, EPE).
[0066] The inbound processing pipe 114 is used to look up the pre-stored forwarding table and determine the exit point based on the destination address, source address, and other forwarding information of the original message when it is received. The flow management unit 115 is used for flow management such as message rate limiting and congestion management. The outbound processing pipe 116 is used to edit messages, such as adding or deleting VLAN fields in the message.
[0067] External device 120 is used to forward the original message to network device 110.
[0068] The chip 111 of the network device 110 is used to implement the packet loss diagnosis method provided in the embodiments of the present invention.
[0069] Among them, network devices 110 include, but are not limited to, switches and gateways. External devices 120 include, but are not limited to, switches, gateways, laptops, servers (which may be standalone servers or server clusters), personal computers, mobile terminals, wearable portable devices, etc.
[0070] In one possible implementation, embodiments of the present invention provide a packet loss diagnosis method, referring to... Figure 3 This may include the following steps. In this embodiment, the method is applied to... Figure 1 Let's take the chip 111 of the network device 110 as an example.
[0071] S11, when receiving the original message sent by the external device, performs packet loss detection on the original message at each pipeline level. When packet loss is detected at any pipeline level, a packet loss signal is generated according to the cause of packet loss.
[0072] The packet loss signal includes the reason for packet loss, i.e., the packet loss type. Different reasons for packet loss can be represented by different information; for example, a few bits of discardType can be used to record different types of packet loss reasons. It should be understood that each stage of the pipeline uses a preset packet loss detection rule or algorithm to perform packet loss detection. The packet loss detection rule or algorithm includes, but is not limited to, deep packet inspection technology, neural network algorithms, etc., and is not specifically limited in this embodiment.
[0073] S13, if a retained packet loss signal is detected, the original message and the packet loss signal are reported to the embedded CPU, and the embedded CPU adds the first additional information to the original message.
[0074] It should be noted that, in this embodiment, the first additional information may include the packet loss reason and packet loss prompt in the packet loss signal of the single-stage pipeline.
[0075] S15: After all packet loss detections have been completed in the multi-level pipeline and the first additional information corresponding to each level of the pipeline has been added to the original message, the second additional information and the original message are parsed from the message that has been added.
[0076] In this embodiment, the second additional information may include the packet loss reasons in all packet loss signals. For example, if packet loss is detected in the inbound processing pipeline 114, the flow management unit 115, and the outbound processing pipeline 116, the second additional information includes the packet loss reasons detected by the inbound processing pipeline 114, the packet loss reasons detected by the flow management unit 115, and the packet loss reasons detected by the outbound processing pipeline 116.
[0077] S17, through its embedded CPU, edits the alarm message based on the path information from the network device to the target monitoring device, the second additional information, and the original message, and sends the alarm message to the outgoing processing pipeline.
[0078] S19 forwards the alarm message to the target monitoring device through the outgoing processing pipeline so that the alarm message can be visualized on the target monitoring device.
[0079] It is important to emphasize that, in this embodiment, the detection focus of packet loss detection for the original packets at each pipeline level is related to the processing content of the packets at each pipeline level. The detection focus of the inbound processing pipeline 114 includes whether the forwarding information is abnormal, such as illegal MAC addresses, Martian IPs (i.e., unidentifiable IPs), and incorrect forwarding table configurations. The detection focus of the traffic management unit 115 may include whether any fields are missing in the stored traffic management information, such as whether packets are missing from the dequeue in chip 111, whether they are occupying the buffer, whether the buffer check results are incorrect, and whether security policies are causing packet loss. The detection focus of the outbound management unit may include whether outbound information is missing, such as whether the table entry index for editing behavior in chip 111 is missing.
[0080] When network device 110 receives a raw packet from external device 120, the raw packet first enters the inbound processing pipe 114 of chip 111. The inbound processing pipe 114 (IPE) parses and looks up the raw packet, and during the parsing and lookup process, it detects whether packet loss has occurred, such as illegal MAC addresses, Martian IPs (i.e., unrecognizable IPs), or forwarding table configuration errors. If packet loss occurs, a packet loss signal is generated based on the cause of packet loss. After the inbound processing pipe 114 (IPE) finishes processing the raw packet, the raw packet enters the traffic management unit 115 (TM). While performing traffic management, the traffic management unit 115 also performs packet loss detection on the raw packet. If packet loss occurs, a packet loss signal is generated based on the cause of packet loss. The outgoing processing pipeline 116 (EPE) transmits data from the flow management unit 115 to the outgoing processing management. The outgoing processing pipeline 116 edits the original message and forwards it. During this process, the outgoing processing pipeline 116 performs packet loss detection on the original message, such as whether forwarding failed or whether the decrypted information is incorrect. If packet loss occurs, a packet loss signal is generated according to the cause of packet loss.
[0081] When chip 111 detects a retained packet loss signal, it reports the original message and the packet loss signal together to the embedded CPU 113 on chip 111. The embedded CPU 113 adds the first additional information corresponding to the packet loss signal (including the packet loss reason in the packet loss signal) to the original message (which may be the message header). After all packet loss detections are completed in the multi-stage pipeline and all the first additional information corresponding to all packet loss signals has been added, the second additional information and the original message are parsed from the added message. At this time, the second additional information includes all packet loss reasons detected by each stage of the pipeline.
[0082] Chip 111 identifies the target monitoring device 130 (which can be pre-specified or determined according to a certain strategy, such as the shortest path strategy) and determines the forwarding path from network device 110 to the target monitoring device 130. It then combines the forwarding path, second additional information, and the original packet to compile an alarm message. The outgoing processing pipe 116 forwards the alarm message according to the forwarding path in the alarm message, thus forwarding the alarm message to the target monitoring device 130. Upon receiving the alarm message, the target monitoring device 130 displays it visually so that maintenance personnel can promptly be aware of and handle the alarm message.
[0083] Compared with traditional packet loss diagnosis methods, the packet loss diagnosis method provided in this embodiment of the invention sets up an embedded CPU on the chip of the network device as an independent resource to process packet loss in batches in a timely manner, without occupying the chip's processing resources to process packet loss. Furthermore, by adding packet loss information (i.e., first additional information and second additional information) to the packets, it realizes batch diagnosis of packets and batch forwarding of packets with added packet loss information based on the chip's original pipeline, which can greatly improve packet processing efficiency.
[0084] Considering the limited resources of the chip, and the fact that reporting packet loss signals and the original messages to the embedded CPU consumes chip resources, this can easily affect the chip's message reception, editing, and forwarding, reducing message forwarding efficiency. Based on these considerations, one possible implementation introduces a reporting rate for packet loss signals. Specifically, refer to... Figure 4 After step S11 and before step S13, the packet loss diagnosis method provided in this embodiment of the invention may further include step S12.
[0085] S12, when generating a packet loss signal, generate a random value and determine whether the random value is greater than a preset threshold. If not, retain the packet loss signal; if so, delete the packet loss signal.
[0086] The random value can be any number from 0 to 99, and the preset threshold can also be any number from 0 to 99. The preset threshold value can be adjusted according to actual needs. When chip 111 detects a packet loss signal, it generates a random value. If the random value is greater than the preset threshold, the packet loss signal is retained; otherwise, it is cleared or deleted, thereby reducing the amount of reported packets. For example, when the preset threshold is 49, the probability of retaining a packet loss signal is 50%, which can significantly reduce the amount of retained packet loss signals.
[0087] Considering that the original packet being detected can be forwarded to network device 110 multiple times, it is highly likely that alarm messages for the same original packet will be repeatedly sent, causing the embedded CPU 113 to consume resources and affecting batch processing efficiency. Based on the above considerations, in order to reduce the resource consumption caused by repeatedly processing the diagnostic and alarm messages of the same original packet, a buffer and record are introduced in one possible implementation. Specifically, the embedded CPU 113 may include a receiving device, an analysis device, a buffer configuration, and a sending device, as described above. Figure 5 After step S15 and before step S17, the packet loss diagnosis method provided in this embodiment of the invention may further include the following steps.
[0088] S161, the analysis device transmits the second additional information and the original message to the buffer device.
[0089] S162: Using the caching device, based on the second additional information and the original message, query the preset packet loss record table to see if the packet loss record information of the original message has been recorded. If not, proceed to step S163; if yes, proceed to step S164.
[0090] S163, record the packet loss information of the original packet in the packet loss record table.
[0091] S164, Update packet loss record information.
[0092] In this embodiment, the packet loss record information includes, but is not limited to: the characteristic fields and packet identifier of the original message, the original message, the packet loss identifier ID, the ingress timestamp, and the number of packet losses.
[0093] The receiving device with embedded CPU 113 (eCPU) continuously monitors the reporting signals of chip 111. When it receives the original message and packet loss signal, it adds first additional information to the header of the original message according to the packet loss signal. After adding the first additional information corresponding to the packet loss signal of each pipeline to the header of the original message, the receiving device with embedded CPU 113 sends the added message to the analysis device with embedded CPU 113.
[0094] The analysis device embedded in CPU 113 parses the received packets to obtain the original packet and second additional information. The second additional information includes, but is not limited to: the reason for packet loss detected by each stage of the pipeline, and information such as the source port, egress port, ingress timestamp, source MAC address, destination MAC address, source IP address, destination IP address, IP Protocol, L4Srcport, and L4Dstport of the original packet. The ingress timestamp refers to the timestamp when the original packet entered network device 110. The analysis device then sends the original packet and the second additional information to the buffer device embedded in CPU 113.
[0095] After receiving the original packet and the second additional information, the caching device checks if the packet loss record information for the original packet is already recorded in the preset packet loss record table. If it is, the ingress timestamp of the original packet is added to the recorded packet loss record information, and the original packet loss count is incremented by one. For example, if the original packet loss count was 1, it will be updated to 2, meaning that the count of packet loss for the original packet is being recorded. If it is not recorded, the packet loss record information for the original packet is recorded in the packet loss record table.
[0096] Based on the steps S161-S164 above, in order to reduce the resource overhead of the embedded CPU, in one possible implementation, it can be implemented as follows: when the packet loss count reaches the reporting threshold, step S17 is executed. That is, for each packet loss record in the packet loss record table in the cache device, when the packet loss count in the packet loss record reaches the reporting threshold, step S17 is executed.
[0097] For example, if the reporting threshold is 2, then when the number of packet loss exceeds 2, step S17 is executed to report the corresponding alarm message to the target monitoring device.
[0098] In another possible implementation, step S17 can be executed when the number of packet losses meets the reporting interval. For example, if the reporting interval is 2, then step S17 can be executed when the number of packet losses is 1, 3, 5, etc.
[0099] Regarding step S162, the method for querying whether packet loss records of the original message have been recorded can be flexibly selected. For example, matching can be performed by feature fields or by identifiers. In this embodiment, no specific limitation is made.
[0100] In one possible implementation, to reduce matching time, improve query speed, and increase query accuracy, hash calculation is introduced. Based on this, step S162 can be further implemented as follows: performing hash calculation based on the second additional information and the original message to obtain a hash value; and querying a preset packet loss record table to see if there is a message identical to the original message based on the hash value and the message identifier.
[0101] You can choose a feature field for hash calculation, or you can choose a second additional information for matching, or you can extract a field of a preset length from the original message for hash calculation to obtain a hash value.
[0102] The packet loss record information can include a hash value. If no packet with the same hash value as the original packet is found, it means that the original packet was the first packet. If a packet with the same hash value is found, it means that it was not the first packet.
[0103] The above implementation method eliminates the need to match all information of the original message with the recorded messages, greatly reducing matching time. Simultaneously, a hash value ensures that identical original messages are cached only once; subsequent repeated original messages only update the ingress timestamp and packet loss count.
[0104] In one possible implementation, the packet loss identifier ID (also known as dropframeID) in the packet loss log information can be an assigned value used to trigger the retransmission of the original packet back to the chip for detailed packet loss diagnosis. (See also...) Figure 6 This may include the following steps.
[0105] S21, through the embedded CPU, obtains the original packet corresponding to the packet loss identifier ID and the reason for the packet loss of the original packet.
[0106] S22, based on all reasons for packet loss, add a diagnostic identifier to the header of the original message to obtain a diagnostic message, and resend the diagnostic message back to the multi-stage pipeline.
[0107] It should be noted that the diagnostic identifier includes a first identifier and a second identifier. The first identifier indicates that the diagnostic message needs to be re-diagnosed, while the second identifier includes the diagnostic values of each pipeline stage. Taking a three-stage pipeline (inbound processing pipeline 114, flow management unit 115, and outbound processing pipeline 116) as an example, the first identifier is a single-bit value. When the diagnostic value of the first identifier is 1, it indicates that the original message has packet loss. The second identifier can be a diagnostic value composed of three bits. The first bit corresponds to inbound processing management, the second bit corresponds to flow management unit 115, and the third bit corresponds to outbound processing pipeline 116. When the diagnostic values of all three bits of the second identifier are 1, it indicates that packet loss has been detected in inbound processing pipeline 114, flow management unit 115, and outbound processing pipeline 116.
[0108] S23, For each pipeline level, if the diagnostic value corresponding to that pipeline level indicates that a diagnosis is needed, the original message is re-detected for packet loss through that pipeline level to obtain diagnostic information.
[0109] It should be emphasized that, in this embodiment, the diagnostic information in step S23 may include the packet loss location and / or packet loss content. That is, the location and / or content of the packet loss are diagnosed.
[0110] S24 writes the diagnostic information obtained from each stage of the pipeline into the chip register and reports the message carrying all diagnostic information to the embedded CPU.
[0111] Steps S21 and S22 can be executed by the embedded CPU 113 itself or by the external CPU 112 of the network device 110. For example, when the embedded CPU 113 recognizes the packet loss identifier ID in the packet loss record information, it can inform the external CPU 112 of the original packet and the second additional information through an interrupt. The external CPU 112 can also read the packet loss record information recorded in the cache device through I / O. When it reads the packet loss identifier ID, it reads the original packet and the second additional information and triggers step S22. That is, the external CPU 112 adds a diagnostic identifier to the header of the original packet according to all packet loss reasons, obtains a diagnostic packet, and resends the diagnostic packet back to the chip 111, so that the diagnostic packet re-enters the multi-stage pipeline.
[0112] For each pipeline stage, when a message is identified as a diagnostic message, the diagnostic value of the corresponding bit in the first and second identifiers of the diagnostic identifier is read. For example, for the inbound processing pipeline 114, when the diagnostic value of the first bit in both the first and second identifiers is 1, the inbound processing pipeline 114 uses a preset packet loss detection method or rule to detect the original message, determine the location or content of the packet loss, and obtain diagnostic information (which may include the cause of the packet loss, the packet loss bit, and / or the packet loss content). Similarly, the detection principle of diagnostic messages by the flow management unit 115 and the outbound processing pipeline 116 is the same as described above.
[0113] It should be noted that the packet loss detection principle for raw messages at each stage of the pipeline is the same as the packet loss detection principle for diagnostic messages described above. The difference is that for raw messages, only the cause of packet loss can be obtained, while for diagnostic messages, the packet loss location and / or packet loss content will be determined. Furthermore, for raw messages, the outgoing processing pipeline 116 will forward the raw message, while for diagnostic messages, the outgoing processing pipeline 116 will not forward the diagnostic message.
[0114] The format of diagnostic messages in chip 111 and the format of non-diagnostic messages (e.g., raw messages) in chip 111 can be found in [reference needed]. Figure 7 Chip 111 and its various pipeline stages can quickly identify diagnostic and non-diagnostic messages based on the message format.
[0115] For each pipeline level, when forwarding a message (diagnostic message or raw message) to the next pipeline level, a header of several bytes can be inserted before the message data content. This header is used to transmit information required between pipeline levels. Some of this information is essential for forwarding, while some is optional and can be shared. Diagnostic messages can reuse this optional additional information. For example, when debugPacketEn in the header is 1, it is in diagnostic header mode, and the additional information records the diagnostic information of each pipeline level.
[0116] Similarly, for the original message, each stage of the pipeline can also insert a header of several bytes before the data content of the original message. The header records the reason for packet loss detected by that stage of the pipeline.
[0117] When all pipelines have completed packet loss detection (diagnostic or raw packets), the embedded CPU reports either the packet carrying all diagnostic information or the packet carrying all reasons for packet loss. Upon receiving a packet carrying diagnostic information, the embedded CPU adds the diagnostic information to the packet loss record information of that packet in the packet loss record table. Simultaneously, upon receiving a packet carrying diagnostic information, the embedded CPU can clear the packet loss flag ID from the packet loss record information of the raw packet.
[0118] Based on the above, in order to enable maintenance personnel to be aware of packet loss, in one possible implementation, refer to... Figure 8 The method of editing the alarm message in step S17 above can be further implemented as follows:
[0119] S171, according to a preset fixed format, the second additional information and the original message are adjusted and assembled to obtain an adjusted message.
[0120] S172, determine the path information from the network device to the target monitoring device, and add the path information to the header of the adjustment message.
[0121] S173, for messages carrying all diagnostic information, add all the parsed diagnostic information to the header of the adjustment message.
[0122] S174 will add the adjustment message containing path information and all diagnostic information as an alarm message.
[0123] In other implementations, alarm messages can be obtained from path information, second additional information, and original message editing when diagnostic information is not available.
[0124] It should be noted that the path information may include the target monitoring port and the header editing index. The target monitoring port is an outgoing port on network device 110 and is the designated exit point for packets arriving at target monitoring device 130. The header editing index is used to obtain forwarding information arriving at target monitoring device 130.
[0125] In one possible implementation, the transmitting device with embedded CPU 113 sends the edited alarm message to the DMA transmitting channel, which then sends the alarm message to the outgoing processing pipeline 116. Upon receiving the alarm message, the outgoing processing pipeline 116 extracts the header editing index from the alarm message header, retrieves the corresponding L2 / L3 / L4 header and other forwarding information based on the header editing index, edits and inserts it into the alarm message header, and then sends the final alarm message out from the target monitoring network. The format of the final alarm message can be as follows: Figure 9 As shown.
[0126] Figure 9 In the L2 / L3 / L4 headers, the monitoring message forwarding header information configured in the chip by the external network management system is used. MessageType indicates that the message is an event-type alarm message. Length indicates the total data length following the L4 header. SequenceId indicates the sequence number of the message, incrementing by 1 for each message sent. DeviceId represents the configurable sequence number of the current device, uniquely identifying the device number within the network. UserMetadata represents application-layer customizable data. TLV indicates standard TLV format data. TLV.Type indicates that TLV.Data is packet loss information. TLV.Len indicates the current TLV data length. For TLV.Data, Drop Reason indicates the reason for packet loss in chip 111, such as an illegal MAC address, a Martian IP address, a forwarding table configuration error, or packet loss due to security policies. Drop Position indicates the location of packet loss in chip 111, such as IPE / EPE / TM. SourcePort indicates the source port from which the message enters chip 111. DestPort indicates the destination port from which the message will exit chip 111. IngressTs indicates the timestamp of the packet entering the ingress port of chip 111. DeviceTs indicates the current device timestamp. Drop Count indicates the number of times the packet has been dropped. Flags indicates the validity of the MAC DA / MAC SA information carried after it.
[0127] Through steps S171 to S174 above, the target monitoring device 130 can display detailed packet loss information such as the cause of packet loss and the location of packet loss, making it clear to network administrators or maintenance personnel.
[0128] Compared to traditional packet loss diagnosis methods, the packet loss diagnosis method provided in this invention outputs packet loss information from the chip via telemetry, which can be visualized and displayed on a remote monitoring device. Traditional external CPUs have many tasks to handle and cannot allocate dedicated resources for timely packet loss processing. This method, however, combines a chip and an embedded CPU for more flexible and efficient packet loss diagnosis. Diagnostic information obtained at each stage of the pipeline is recorded in the packet header for pipelined linear diagnosis, enabling batch diagnosis of packets. Furthermore, a packet loss tag ID is assigned to each lost packet, allowing the chip's forwarding process to be retried based on the packet loss tag ID for more detailed packet loss diagnosis, without requiring external retransmission of the packet.
[0129] Based on the same inventive concept as the packet loss diagnosis method described above, in one possible implementation, the present invention also provides a packet loss diagnosis device 140, which can be applied to... Figure 1 In the chip 111 of the network device 110. (Refer to...) Figure 10 The packet loss diagnosis device 140 may include a packet loss detection module 150, a reporting module 160, a receiving module 170, a parsing module 180, a sending module 190, and a forwarding module 200.
[0130] The packet loss detection module 150 is used to perform packet loss detection on the original message sent by the external device at each pipeline level. When packet loss is detected at any pipeline level, a packet loss signal is generated according to the cause of packet loss.
[0131] The reporting module 160 is used to report the original message and the packet loss signal to the embedded CPU when a retained packet loss signal is detected.
[0132] The receiving module 170 is used to add first additional information to the original message via an embedded CPU. The first additional information includes the reason for packet loss in the packet loss signal of the single-stage pipeline.
[0133] The parsing module 180 is used to parse the second additional information and the original message from the message after all packet loss detection has been completed in the multi-stage pipeline and the first additional information corresponding to each pipeline stage has been added to the original message. The second additional information includes the reason for packet loss in all packet loss signals.
[0134] The sending module 190 is used to edit an alarm message based on the path information from the network device to the target monitoring device, the second additional information and the original message through the embedded CPU, and send the alarm message to the outgoing processing pipeline.
[0135] The forwarding module 200 is used to forward alarm messages to the target monitoring device through the outgoing processing pipeline, so that the alarm messages can be visualized on the target monitoring device.
[0136] In the aforementioned packet loss diagnosis device 140, through the coordinated action of the packet loss detection module 150, the reporting module 160, the receiving module 170, the parsing module 180, the sending module 190, and the forwarding module 200, an embedded CPU is set on the chip of the network device as an independent resource to process packet loss in batches in a timely manner, without occupying the chip's processing resources to process packet loss. Furthermore, by adding packet loss information (i.e., first additional information and second additional information) to the message, it realizes batch diagnosis of messages and batch forwarding of messages with added packet loss information based on the chip's original pipeline, which can greatly improve message processing efficiency.
[0137] For specific limitations regarding the packet loss diagnostic device 140, please refer to the limitations of the packet loss diagnostic method above, which will not be repeated here. Each module in the packet loss diagnostic device 140 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the electronic device, or stored in software in the memory of the electronic device, so that the processor can call and execute the corresponding operations of each module.
[0138] In one embodiment, an electronic device 210 is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11 As shown, the electronic device 210 includes a processor, memory, communication interface, display screen, and input device connected via a system bus. The processor of the electronic device 210 provides computing and control capabilities. The memory of the electronic device 210 includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the electronic device 210 is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, near-field communication (NFC), or other technologies. When the computer program is executed by the processor, it implements the packet loss diagnosis method provided in the above embodiment.
[0139] Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the electronic device 210 to which the present invention is applied. The specific electronic device 210 may include, but is not limited to, the following: Figure 11 The diagram shows more or fewer components, or combinations of certain components, or different component arrangements.
[0140] In one embodiment, the packet loss diagnosis device 140 provided by the present invention can be implemented as a computer program, which can be implemented in, for example... Figure 11 The device operates on the electronic device 210 shown. The memory of the electronic device 210 can store the various program modules that make up the packet loss diagnostic device 140, for example, Figure 10 The diagram shows a packet loss detection module 150, a reporting module 160, a receiving module 170, a parsing module 180, a sending module 190, and a forwarding module 200. The computer program comprised of these modules causes the processor to execute the steps in the packet loss diagnosis method described in this specification.
[0141] For example, Figure 11 The electronic device 210 shown can be used as follows Figure 10 The packet loss detection module 150 in the packet loss diagnostic device 140 shown executes step S11. The electronic device 210 can execute step S13 via the reporting module 160, reporting the original message and the packet loss signal to the embedded CPU 113 upon detecting a retained packet loss signal. The electronic device 210 can execute step S13 via the receiving module 170, adding first additional information to the original message via the embedded CPU 113. The electronic device 210 can execute step S15 via the parsing module 180. The electronic device 210 can execute step S17 via the sending module 190. The electronic device 210 can execute step S19 via the forwarding module 200.
[0142] In one embodiment, an electronic device 210 is provided, including a memory and a processor. The memory stores machine-executable instructions, and the processor executes the machine-executable instructions to perform the following steps: upon receiving an original message sent by an external device, performing packet loss detection on the original message at each stage of the pipeline; when packet loss is detected at any stage of the pipeline, generating a packet loss signal based on the cause of the packet loss; if a retained packet loss signal is detected, reporting the original message and the packet loss signal to an embedded CPU, and adding first additional information to the original message through the embedded CPU; after all packet loss detections are completed in the multi-stage pipeline and the first additional information corresponding to each stage of the pipeline has been added to the original message, parsing out second additional information and the original message from the message that has been added; using the embedded CPU, editing an alarm message based on the path information from the network device to the target monitoring device, the second additional information, and the original message, and sending the alarm message to the outgoing processing pipeline; forwarding the alarm message to the target monitoring device through the outgoing processing pipeline for visual display of the alarm message on the target monitoring device.
[0143] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it performs the following steps: upon receiving an original message sent by an external device, packet loss detection is performed on the original message at each stage of the pipeline; when packet loss is detected at any stage of the pipeline, a packet loss signal is generated according to the cause of packet loss; if a retained packet loss signal is detected, the original message and the packet loss signal are reported to an embedded CPU, and the embedded CPU adds first additional information to the original message; after all packet loss detections are completed in the multi-stage pipeline and the first additional information corresponding to each stage of the pipeline has been added to the original message, second additional information and the original message are parsed from the message that has been added; using the embedded CPU, an alarm message is edited according to the path information from the network device to the target monitoring device, the second additional information, and the original message, and the alarm message is sent to the outgoing processing pipeline; the alarm message is forwarded to the target monitoring device through the outgoing processing pipeline for visualization display of the alarm message on the target monitoring device.
[0144] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0145] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0146] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0147] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A packet loss diagnosis method, characterized by, A chip used in network equipment, the chip including an embedded CPU and a multi-stage pipeline, the multi-stage pipeline including an inbound processing pipeline, a traffic management unit, and an outbound processing pipeline, the method including: When receiving the original message sent by the external device, packet loss detection is performed on the original message at each stage of the pipeline. When packet loss is detected at any stage of the pipeline, a packet loss signal is generated according to the cause of packet loss. If the retained packet loss signal is detected, the original message and the packet loss signal are reported to the embedded CPU, and the embedded CPU adds first additional information to the original message; wherein, the first additional information includes the packet loss reason in the packet loss signal of the single pipeline. After the multi-stage pipeline has completed all packet loss detection and the first additional information corresponding to each stage of the pipeline has been added to the original message, the second additional information and the original message are parsed from the message that has been added; wherein, the second additional information includes the packet loss reason in all packet loss signals; The embedded CPU edits an alarm message based on the path information from the network device to the target monitoring device, the second additional information, and the original message, and sends the alarm message to the outgoing processing pipeline. The alarm message is forwarded to the target monitoring device through the outgoing processing pipeline, so that the alarm message can be visualized on the target monitoring device.
2. The packet loss diagnosis method according to claim 1, characterized in that, The embedded CPU includes an analysis unit and a cache unit; After the step of parsing the second additional information and the original message from the completed message, and before the step of editing the alarm message using the embedded CPU based on the path information from the network device to the target monitoring device, the second additional information, and the original message, the method further includes: The analysis device transmits the second additional information and the original message to the buffer device; wherein, the second additional information further includes the forwarding information, source port, egress port, and ingress timestamp of the original message entering the network device; The caching device queries a preset packet loss record table to see if the packet loss record information of the original message has been recorded, based on the second additional information and the original message. If not, record the packet loss information of the original packet in the packet loss record table; If so, update the packet loss record information; wherein the packet loss record information includes the feature fields and packet identifier of the original message, packet loss identifier ID, ingress timestamp, and packet loss count value.
3. The packet loss diagnosis method according to claim 2, characterized in that, The step of querying a preset packet loss record table to see if the packet loss record information of the original packet has been recorded based on the second additional information and the original packet includes: A hash value is obtained by performing a hash calculation based on the second additional information and the original message; Based on the hash value and the message identifier, query the preset packet loss record table to see if there is a message identical to the original message.
4. The packet loss diagnosis method according to claim 2, characterized in that, The method further includes: The embedded CPU is used to obtain the original packet corresponding to the packet loss identifier ID and the reason for the packet loss of the original packet. Based on all the stated reasons for packet loss, a diagnostic identifier is added to the header of the original message to obtain a diagnostic message, and the diagnostic message is resent back to the multi-stage pipeline; wherein, the diagnostic identifier includes a first identifier and a second identifier, the first identifier indicating that the diagnostic message needs to be re-diagnosed, and the second identifier including the diagnostic values of each stage of the pipeline. For each pipeline level, if the diagnostic value corresponding to that pipeline level indicates that a diagnosis is needed, the original message is re-detected for packet loss through that pipeline level to obtain diagnostic information; wherein, the diagnostic information includes packet loss bits and / or packet loss content; The diagnostic information obtained from each stage of the pipeline is written into the chip register, and a message carrying all diagnostic information is reported to the embedded CPU.
5. The packet loss diagnosis method according to claim 4, characterized in that, The step of editing the alarm message based on the path information from the network device to the target monitoring device, the second additional information, and the original message includes: According to a preset fixed format, the second additional information and the original message are adjusted and assembled to obtain an adjusted message; Determine the path information from the network device to the target monitoring device, and add the path information to the header of the adjustment message; For the message carrying all diagnostic information, add all the parsed diagnostic information to the header of the adjustment message; The adjustment message containing the aforementioned path information and all diagnostic information will be used as an alarm message.
6. The packet loss diagnosis method according to claim 2, characterized in that, The method further includes: When the number of packet losses reaches the reporting threshold, the following steps are performed: using the embedded CPU, an alarm message is edited based on the path information from the network device to the target monitoring device, the second additional information, and the original message, and the alarm message is sent to the outgoing processing pipeline.
7. The packet loss diagnosis method according to claim 1, characterized in that, After the step of generating a packet loss signal based on the cause of packet loss, and before the step of reporting the original message and the packet loss signal to the embedded CPU when the retained packet loss signal is detected, the method further includes: When generating the packet loss signal, a random value is generated, and it is determined whether the random value is greater than a preset threshold. If not, the packet loss signal is retained; if so, the packet loss signal is deleted.
8. A packet loss diagnostic device, characterized in that, A chip used in network equipment, the chip including an embedded CPU and a multi-stage pipeline, the multi-stage pipeline including an inbound processing pipeline, a traffic management unit and an outbound processing pipeline, the packet loss diagnosis device including a packet loss detection module, a reporting module, a receiving module, a parsing module, a sending module and a forwarding module; The packet loss detection module is used to perform packet loss detection on the original message sent by the external device at each stage of the pipeline when receiving the original message. When packet loss is detected at any stage of the pipeline, a packet loss signal is generated according to the cause of packet loss. The reporting module is used to report the original message and the packet loss signal to the embedded CPU when the retained packet loss signal is detected. The receiving module is configured to add first additional information to the original message via the embedded CPU; wherein, the first additional information includes the reason for packet loss in the packet loss signal of the single-stage pipeline. The parsing module is used to parse the second additional information and the original message from the message after all packet loss detections have been completed in the multi-stage pipeline and the first additional information corresponding to each stage of the pipeline has been added to the original message; wherein, the second additional information includes the packet loss reason in all packet loss signals; The sending module is used to edit an alarm message based on the path information from the network device to the target monitoring device, the second additional information and the original message through the embedded CPU, and send the alarm message to the outgoing processing pipeline. The forwarding module is used to forward the alarm message to the target monitoring device through the outgoing processing pipeline, so that the alarm message can be visualized on the target monitoring device.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the packet loss diagnosis method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the packet loss diagnosis method as described in any one of claims 1 to 7.