Packet information extraction method and device based on packet snapshot
By using the message snapshot method to extract message information in the event of a fault or abnormal message in the forwarding path of the switching chip, the problem of not being able to obtain message information in the prior art is solved, and fault location and analysis are supported.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WXILICON TECH CO LTD
- Filing Date
- 2023-06-14
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies cannot effectively extract message information when there is a fault or abnormal message in the forwarding path of the switching chip, making troubleshooting difficult.
By using a message snapshot-based method, the message forwarding processing results and ingress port information are received and obtained. Snapshot trigger conditions are set, and hardware logic is used to perform snapshot operations when a fault or abnormal message occurs in the forwarding path of the switching chip, thereby extracting and caching message information.
It enables the extraction of message information even in the event of a fault or abnormal message in the forwarding path of the switching chip, supporting fault location and analysis.
Smart Images

Figure CN116545959B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network communication technology, and in particular to a method and apparatus for extracting message information based on message snapshots, a computing device, and a computer-readable storage medium. Background Technology
[0002] Commonly used methods for extracting packet information include packet redirection and packet mirroring. Redirecting or mirroring packets to the observation port allows for packet analysis and troubleshooting. Both methods rely on a complete forwarding path within the switching chip. However, in certain fault conditions, the switching chip may discard packets, or discard certain abnormal packets. In both of these cases, it becomes impossible to forward packets to the observation port, making troubleshooting difficult. Summary of the Invention
[0003] In view of the above problems of the prior art, this application provides a method and apparatus for extracting message information based on message snapshots, a computing device and a computer-readable storage medium, which solves the problem that message information cannot be extracted in the case of failure of the forwarding path of the switching chip and message discarding or in the case of certain abnormal messages.
[0004] To achieve the above objectives, the first aspect of this application provides a method for extracting message information based on message snapshots, comprising:
[0005] Receive the message after it has been processed by the message forwarding system, and obtain the message forwarding processing result and message ingress port information based on the message;
[0006] When the packet forwarding processing result and the packet ingress port information meet the preset snapshot triggering conditions, a snapshot operation is performed on the packet to obtain snapshot packet information.
[0007] This application does not rely on the complete forwarding path inside the switching chip. The user sets the snapshot trigger conditions and uses hardware logic to automatically extract the packet information. Even if the forwarding path of the switching chip fails and the packet is discarded, or if there are some abnormal packets, the packet information can still be extracted.
[0008] To achieve the above objectives, a second aspect of this application provides a message information extraction apparatus based on message snapshots, comprising:
[0009] The information acquisition module is used to receive messages processed by the message forwarding system, and to acquire message forwarding processing results and message ingress port information based on the messages.
[0010] The message snapshot module is used to perform a snapshot operation on the message and obtain snapshot message information when the message forwarding processing result and the message ingress port information meet the preset snapshot triggering conditions.
[0011] A third aspect of this application provides a computing device, comprising:
[0012] Communication interface;
[0013] At least one processor connected to the communication interface; and
[0014] At least one memory, connected to the processor and storing program instructions, which, when executed by the at least one processor, cause the at least one processor to perform any of the methods described in the first aspect above.
[0015] A fourth aspect of this application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a computer, cause the computer to perform any of the methods described in the first aspect above.
[0016] These and other aspects of the invention will become more apparent from the following description of several embodiments. Attached Figure Description
[0017] The various features of the present invention and the relationships between them are further explained below with reference to the accompanying drawings. The drawings are exemplary; some features are not shown to scale, and some drawings may omit conventional features in the field of this application that are not essential to this application, or additional features that are not essential to this application may be shown. The combination of features shown in the drawings is not intended to limit the present application. Furthermore, throughout this specification, the same reference numerals refer to the same things. Specific descriptions of the drawings are as follows:
[0018] Figure 1 A schematic diagram of an embodiment of the message information extraction method based on message snapshot provided in this application;
[0019] Figure 2 A flowchart illustrating a specific implementation of the message information extraction method based on message snapshots provided in this application;
[0020] Figure 3 A schematic diagram of an embodiment of the message information extraction device based on message snapshot provided in this application;
[0021] Figure 4 This is a schematic diagram of the computing device used in this application. Detailed Implementation
[0022] The terms "first, second, third, etc." or similar terms such as module A, module B, module C, etc., used in the specification and claims are only used to distinguish similar objects and do not represent a specific ordering of objects. It is understood that a specific order or sequence may be interchanged where permitted so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0023] In the following description, the labels of the steps, such as S110, S120, etc., do not necessarily mean that the steps will be executed in this way. The order of the steps can be interchanged or executed simultaneously if permitted.
[0024] The term "comprising" as used in the specification and claims should not be construed as limiting itself to what follows; it does not exclude other elements or steps. Therefore, it should be interpreted as specifying the presence of the mentioned feature, integral, step, or component, but does not exclude the presence or addition of one or more other features, integrals, steps, or components, or groups thereof. Thus, the statement "device comprising means A and B" should not be limited to a device consisting solely of components A and B.
[0025] The term "an embodiment" or "an embodiment" as used in this specification means that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in at least one embodiment of the invention. Therefore, the terms "in one embodiment" or "in an embodiment" appearing throughout this specification do not necessarily refer to the same embodiment, but may refer to the same embodiment. Furthermore, in one or more embodiments, the particular features, structures, or characteristics can be combined in any suitable manner, as will be apparent to those skilled in the art from this disclosure.
[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. In case of any inconsistency, the meaning set forth in this specification or derived from the content described herein shall prevail. Furthermore, the terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application. To accurately describe the technical content of this application and to accurately understand the invention, the following explanations or definitions of the terms used in this specification are provided before describing specific embodiments.
[0027] To address the technical problem of packet dropping due to forwarding path failures in switching chips or the inability to extract packet information in cases of abnormal packets, this application provides a packet information extraction method based on packet snapshots. This application does not rely on the complete forwarding path within the switching chip. Instead, the user sets snapshot trigger conditions and uses hardware logic to extract packet information that the switching chip determines to be dropped due to forwarding path failures or certain abnormal packet information where the destination port cannot be found during the forwarding process. The packet information is extracted and cached through snapshots, and then the CPU reads and analyzes the cached packet information to obtain the working status of the switching chip and locate the fault.
[0028] This application is applied to the scenario of extracting forwarded message information within a switching chip.
[0029] [First Embodiment of a Message Information Extraction Method Based on Message Snapshots]
[0030] The following reference Figure 1 The flowchart shown illustrates the first embodiment of the message information extraction method based on message snapshots according to this application. This method is applied to switching chips, such as... Figure 1 As shown, the method includes:
[0031] S110: Receive the message after it has been processed by the message forwarding system, and obtain the message forwarding processing result and message ingress port information based on the message.
[0032] In some embodiments, the message processed by the message forwarding system refers to the message processed by the message forwarding system within the switching chip. This message may be a message forwarded through the complete forwarding path inside the switching chip, a message that is determined to be discarded by the switching chip due to a failure in the forwarding path, or an abnormal message for which the destination port cannot be found.
[0033] The message forwarding processing result can include the message processing type, namely:
[0034] When a message is forwarded through the complete forwarding path inside the switching chip, the message forwarding processing result obtained from the message indicates that the message has been forwarded, that is, the message processing type is forwarded.
[0035] When a packet is determined to be discarded by the switching chip due to a failure in the forwarding path, the packet forwarding processing result obtained from the packet indicates that the packet has been discarded, that is, the packet processing type is discarded.
[0036] When certain abnormal packets cannot find the destination port, the packet forwarding processing result obtained from the packet indicates that the packet cannot find the outgoing port, that is, the packet processing type is "outgoing port not found".
[0037] The message ingress port information refers to the port through which the message enters the switching chip.
[0038] S120: When the packet forwarding processing result and the packet ingress port information meet the preset snapshot triggering conditions, perform a snapshot operation on the packet to obtain snapshot packet information.
[0039] In some embodiments, the preset snapshot triggering conditions include preset packet ingress port information and preset packet type to be snapshotted. The preset packet type to be snapshotted may include being discarded or not having an egress port found.
[0040] This application enables the packet snapshot function based on a preset ingress port and selects the packet to be snapshotted according to the preset packet type.
[0041] Specifically, when the packet forwarding processing result and the packet ingress port information meet the preset snapshot triggering conditions, a snapshot operation is performed on the packet, including:
[0042] When the packet ingress port information is consistent with the preset packet ingress port information, and the packet processing type is consistent with the preset packet type to be snapshotted, a snapshot operation is performed on the packet.
[0043] In some embodiments, a snapshot operation is performed on the message to obtain snapshot message information, including:
[0044] Perform a snapshot operation on the message according to the preset snapshot content to obtain snapshot message information.
[0045] In this embodiment, the preset snapshot content includes a first preset custom header and a second preset message header. The first preset custom header refers to a 24-byte custom header, and the second preset message header refers to a 64-byte message header. The custom header records the intermediate results of message forwarding processing, such as message unicast / multicast type, drop level, internal priority, and other information.
[0046] In some embodiments, this application further includes:
[0047] Set the snapshot trigger conditions and the snapshot content.
[0048] In this embodiment, the snapshot triggering conditions and snapshot content are configured by the CPU and sent to the switching chip.
[0049] In some embodiments, this application further includes:
[0050] The snapshot message information is cached.
[0051] In this embodiment, the finally extracted snapshot message information can be directly sent to an external processor for processing, or it can be cached in a buffer area set inside the switching chip. This buffer area can be a set of registers or SRAM.
[0052] In some embodiments, this application further includes:
[0053] Set the snapshot completion flag after the snapshot operation is complete.
[0054] Also includes:
[0055] The system checks whether the snapshot completion flag is set. If the snapshot completion flag is set, the snapshot operation is completed. If the snapshot completion flag is not set, the snapshot operation continues.
[0056] In this embodiment, a snapshot completion flag can be set. When no snapshot operation is performed, the snapshot completion flag is not set. When the snapshot operation is completed, the snapshot completion flag is set. The snapshot completion flag is used to determine whether the snapshot operation has been completed.
[0057] This application also allows the CPU to query the snapshot completion flag status. If the snapshot completion flag is found to be valid (i.e., set), the contents of the buffer can be read, the snapshot completion flag can be reset, and then the operating status of the switching chip can be obtained based on the read contents. If it is necessary to continue snapshotting messages, the snapshot completion flag is reset; otherwise, the current snapshot is terminated.
[0058] This application does not rely on the complete forwarding path inside the switching chip. The user sets the snapshot trigger conditions and uses hardware logic to automatically extract the packet information. Even if the forwarding path of the switching chip fails and the packet is discarded, or if there are some abnormal packets, the packet information can still be extracted.
[0059] [First Specific Implementation of the Message Information Extraction Method Based on Message Snapshots]
[0060] See below Figure 2 The flowchart shown is a specific embodiment of the message information extraction method based on message snapshots provided in this application. This specific embodiment is described and includes the following steps:
[0061] S210: Set the ingress port for which snapshots are required, and set the packet type to be snapshotted.
[0062] S220: Receives messages processed by the message forwarding system, obtains the message forwarding processing result and the message ingress port.
[0063] S230: Determine if the snapshot completion flag is set. If yes, execute S240; otherwise, execute S250.
[0064] S240: Indicates that the buffer contains valid message information, and no further snapshot will be taken.
[0065] S250: Continue this snapshot, determine whether the packet ingress port and packet type are consistent with the configuration. If yes, execute S260; otherwise, return to execute S220.
[0066] S260: If the ingress port of the message is consistent with the ingress port that needs to be snapshotted, and the message type is consistent with the message type that needs to be snapshotted, then extract the message information (24-byte custom header and 64-byte message header), store the extracted content in the buffer, and then set the snapshot completion flag.
[0067] S270: CPU query snapshot completion flag status; if set, read cache contents.
[0068] S280: Determine whether to continue the snapshot. If yes, execute S290; otherwise, end the current snapshot.
[0069] S290: If snapshotting is required, reset the snapshot completion flag and return to execute S220.
[0070] [Examples of the message information extraction device based on message snapshots in this application]
[0071] like Figure 3 As shown, this application also provides an embodiment of a message information extraction device based on message snapshots. For the beneficial effects of the device or the technical problems it solves, please refer to the descriptions in the methods corresponding to each device, or to the descriptions in the invention content, which will not be repeated here.
[0072] In an embodiment of the message information extraction device based on message snapshots, the device includes:
[0073] Information acquisition module 310 is used to receive messages processed by the message forwarding system, and to acquire message forwarding processing results and message ingress port information based on the messages.
[0074] The message snapshot module 320 is used to perform a snapshot operation on the message and obtain snapshot message information when the message forwarding processing result and the message ingress port information meet the preset snapshot triggering conditions.
[0075] Specifically, the message snapshot module 320 message snapshot unit mainly completes the extraction of message information, extracts the 24-byte custom header and 64-byte message header information generated during the forwarding process, and maintains the snapshot completion flag.
[0076] In some embodiments, such as Figure 3 As shown, the device may further include:
[0077] Buffer 330 is used to store message information extracted by the message snapshot unit. It can be a set of registers or SRAM.
[0078] The configuration management module 340 is used to process configuration commands issued by the CPU, set the ingress port for snapshots, the packet type to be snapshotted, query the snapshot completion status, and read the snapshot content.
[0079] [Examples of the computing device in this application]
[0080] Figure 4 This is a schematic structural diagram of a computing device 900 provided in an embodiment of this application. The computing device 900 includes: a processor 910, a memory 920, and a communication interface 930.
[0081] It should be understood that Figure 4 The communication interface 930 in the computing device 900 shown can be used to communicate with other devices.
[0082] The processor 910 can be connected to the memory 920. The memory 920 can be used to store the program code and data. Therefore, the memory 920 can be a storage unit inside the processor 910, an external storage unit independent of the processor 910, or a component that includes both the storage unit inside the processor 910 and the external storage unit independent of the processor 910.
[0083] Optionally, the computing device 900 may also include a bus. The memory 920 and communication interface 930 can be connected to the processor 910 via the bus. The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0084] It should be understood that in the embodiments of this application, the processor 910 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Alternatively, the processor 910 may employ one or more integrated circuits to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0085] The memory 920 may include read-only memory and random access memory, and provides instructions and data to the processor 910. A portion of the processor 910 may also include non-volatile random access memory. For example, the processor 910 may also store device type information.
[0086] When the computing device 900 is running, the processor 910 executes the computer execution instructions in the memory 920 to perform the operation steps of the above method.
[0087] It should be understood that the computing device 900 according to the embodiments of this application can correspond to the corresponding subject in executing the methods according to the various embodiments of this application, and the above and other operations and / or functions of each module in the computing device 900 are respectively for implementing the corresponding processes of the methods of this embodiment. For the sake of brevity, they will not be described in detail here.
[0088] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0089] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0090] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0091] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0092] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0093] If the aforementioned functions are implemented as software functional units 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 application, in essence, 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 application. 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.
[0094] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is used to perform the above-described method, which includes at least one of the schemes described in the above embodiments.
[0095] The computer storage medium in this application embodiment can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0096] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0097] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including, but not limited to, wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0098] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0099] Note that the above are merely preferred embodiments and the technical principles employed in this application. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present application has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, all of which fall within the scope of protection of the present invention.
Claims
1. A method for extracting message information based on message snapshots, characterized in that, It operates through the hardware logic on the switching chip of the switch, including: The system receives packets processed by the packet forwarding system and obtains packet forwarding processing results and packet ingress port information based on the packets. The packet forwarding processing results include packet processing type, which includes forwarded, discarded, and no outgress port found. When the packet forwarding processing result and the packet ingress port information meet the preset snapshot triggering conditions, a snapshot operation is performed on the packet to obtain the snapshot packet information, which is stored in the cache on the switching chip for the CPU of the switch to obtain. This enables the CPU to still extract the packet information of the switching chip even when the forwarding path of the switching chip fails, thereby obtaining the working status of the switching chip and performing fault location. Set the snapshot completion flag after the snapshot operation is complete; The preset snapshot triggering conditions include preset packet ingress port information and preset packet type to be snapshotted. The preset packet type to be snapshotted includes dropped packet and packet with no outgress port found. The snapshot packet information includes: a first preset custom header and a second preset packet header information. The first preset custom header includes: intermediate results of packet forwarding processing. The intermediate results include packet unicast / multicast type, drop level, and internal priority information.
2. The method according to claim 1, characterized in that, When the packet forwarding processing result and the packet ingress port information meet the preset snapshot triggering conditions, a snapshot operation is performed on the packet, including: When the packet ingress port information is consistent with the preset packet ingress port information, and the packet processing type is consistent with the preset packet type to be snapshotted, a snapshot operation is performed on the packet.
3. The method according to claim 1, characterized in that, Perform a snapshot operation on the message to obtain snapshot message information, including: Perform a snapshot operation on the message according to the preset snapshot content to obtain snapshot message information.
4. The method according to claim 3, characterized in that, Also includes: Set the snapshot trigger conditions and the snapshot content.
5. The method according to claim 1, characterized in that, Also includes: The system checks whether the snapshot completion flag is set. If the snapshot completion flag is set, the snapshot operation is completed. If the snapshot completion flag is not set, the snapshot operation continues.
6. A message information extraction device based on message snapshots, characterized in that, The hardware deployed on the switching chip of the switch includes: The information acquisition module is used to receive messages processed by the message forwarding system, and to acquire message forwarding processing results and message ingress port information based on the messages; the message forwarding processing results include message processing type, which includes forwarded, discarded, and no outgress port found; The packet snapshot module is used to perform a snapshot operation on the packet when the packet forwarding processing result and the packet ingress port information meet the preset snapshot trigger conditions, obtain the snapshot packet information, and store it in the cache on the switching chip for the CPU of the switch to obtain. This enables the CPU to still extract the packet information of the switching chip even when the forwarding path of the switching chip fails, thereby obtaining the working status of the switching chip, performing fault location, and setting the snapshot completion flag after the snapshot operation is completed. The preset snapshot triggering conditions include preset packet ingress port information and preset packet type to be snapshotted. The preset packet type to be snapshotted includes dropped packet and packet with no outgress port found. The snapshot packet information includes: a first preset custom header and a second preset packet header information. The first preset custom header includes: intermediate results of packet forwarding processing. The intermediate results include packet unicast / multicast type, drop level, and internal priority information.
7. A computing device, characterized in that, include: Communication interface; At least one processor connected to the communication interface; as well as At least one memory connected to the processor and storing program instructions that, when executed by the at least one processor, cause the at least one processor to perform the method of any one of claims 1-5.