Packet header parsing apparatus and method, device, storage medium, and program product

By introducing a data distribution module and multiple parsing modules into the message header parsing device, the wiring congestion problem caused by multi-layer message protocols in the prior art is solved, and more efficient message header parsing is achieved.

WO2025016261A1PCT designated stage expired Publication Date: 2025-01-23SHENZHEN JAGUAR MICROSYSTEMS CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/104690
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-07-14
Filing Date
2024-07-10
Publication Date
2025-01-23

AI Technical Summary

Technical Problem

The existing message header parsing device needs to connect multiple resolution modules in series to identify multi-layer message protocols, resulting in reduced cabling congestion and throughput.

Method used

Design a message header parsing device, including a data distribution module, a data output module and multiple parsing modules. The data distribution module distributes different message data to multiple parsing modules, so that each parsing module parses the protocol type of at least one message header in the received message data in at least one parsing cycle.

Benefits of technology

It realizes that each parsing module can cyclically parse all the headers in a message data, reducing the wiring on the header parsing device, avoiding wiring congestion caused by too many fan-out lines, and improving the parsing throughput rate. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024104690_23012025_PF_FP_ABST
    Figure CN2024104690_23012025_PF_FP_ABST
Patent Text Reader

Abstract

A packet header parsing apparatus and method, a device, a storage medium, and a program product. The apparatus comprises: a data distribution module (201), a data output module (204), and a plurality of parsing modules (202). The data distribution module (201) is used for acquiring working state indication information of the plurality of parsing modules (202), and respectively sending different pieces of packet data to the plurality of parsing modules (202) on the basis of the working state indication information of the plurality of parsing modules (202), wherein the packet data comprises at least one packet header; the parsing modules (202) are used for parsing, in at least one parsing cycle, the packet data received by the parsing modules (202), and determining a parsing result; and the data distribution module (204) is used for outputting the parsing result.
Need to check novelty before this filing date? Find Prior Art

Description

Message header parsing device, method, equipment, storage medium and program product

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on July 14, 2023, with application number 202310866446.1 and invention name “Message header parsing device, method, equipment, storage medium and program product”. The entire contents of the patent application are incorporated into this application by reference. Technical Field

[0003] The present application relates to the field of computer network technology, and in particular to a packet header parsing device, method, equipment, storage medium, and program product. Background Art

[0004] In a network device, a message enters the device through a physical link. After being processed by the physical link layer, the message parsing module parses the message header, identifies the protocol type in the message header, and extracts the information in the message. The network device can then filter, forward, and perform other processing on the message.

[0005] In related technologies, the packet header parsing process is similar to the jump process of a state machine. Specifically, the packet header parsing device in a network device can connect multiple parsing modules in series, each of which only identifies a layer of packet protocol type or subtype in the packet header data. The packet header parsing device also includes a register, from which the parsing module can obtain type comparison configuration information and associated parsing information to perform packet parsing.

[0006] However, since each message data may include multiple layers of message protocols, complete identification of the protocol types of all message headers in the message data requires connecting multiple parsing modules in series, resulting in wiring congestion in the design of the message header parsing device due to the large number of fan-out lines.

[0007] Summary of the Invention

[0008] According to various embodiments of the present application, a packet header parsing apparatus, method, device, storage medium, and program product are provided.

[0009] In a first aspect, the present application provides a packet header parsing device, comprising: a data distribution module, a data output module, and a plurality of parsing modules;

[0010] The data distribution module is configured to obtain the working status indication information of the multiple parsing modules, and send different message data to the multiple parsing modules respectively according to the working status indication information of the multiple parsing modules, wherein the message data includes at least one message header;

[0011] The parsing module is configured to parse the message data received by the parsing module in at least one parsing cycle to determine a parsing result, wherein the parsing result includes a protocol type of at least one message header parsed from the message data received by the parsing module, and each parsing cycle is configured to parse one message header in the message data received by the parsing module;

[0012] The data distribution module is used to output the analysis result.

[0013] In one embodiment, the packet header parsing device further includes a data storage module;

[0014] The data storage module is used to store type comparison configuration information and associated analysis information;

[0015] The parsing module is specifically configured to obtain the type comparison configuration information and the associated parsing information from the data storage module, and parse the message data received by the parsing module in the at least one parsing cycle according to the type comparison configuration information and the associated parsing information to determine the parsing result;

[0016] Among them, the type comparison configuration information includes the mapping relationship between the status information of the message header parsed in the current parsing cycle and the protocol type of the message header to be identified in the next parsing cycle, and the associated parsing information includes the mapping relationship between the status information of the message header to be identified in the next parsing cycle and the extraction control information of the message header to be identified in the next parsing cycle, the status information of the message header is used to indicate the protocol identifier of the corresponding message header, and the extraction control information is used to indicate the protocol location information of the corresponding message header.

[0017] In one embodiment, the parsing module includes a message header identification unit and a type comparison unit;

[0018] The message header identification unit is used to identify the protocol field segment of the message header parsed by the current parsing cycle and determine the status information of the message header parsed by the current parsing cycle;

[0019] The type comparison unit is used to obtain the type comparison configuration information from the data storage module, and determine the protocol type of the message header to be identified in the next parsing cycle based on the status information of the message header parsed in the current parsing cycle and the type comparison configuration information.

[0020] In one embodiment, the parsing module further includes a data selection unit and a domain segment extraction unit;

[0021] The data selection unit is configured to obtain the associated parsing information from the data storage module, and determine field extraction information of the message header to be identified in the next parsing cycle based on the associated parsing information and status information of the message header to be identified in the next parsing cycle, wherein the status information of the message header corresponds to the protocol type of the message header;

[0022] The field segment extraction unit is used to extract information based on the field segments of the message header to be identified in the next parsing cycle, and extract the protocol field segments of the message header to be parsed in the next parsing cycle from the message data received by the parsing module.

[0023] In one embodiment, the data distribution module is further configured to add an order-preserving tag to the message data;

[0024] The parsing module is further configured to add the sequence preservation tag in the received message data to the parsing result;

[0025] The data output module is further configured to output the parsing results of the multiple parsing modules in sequence according to the output order corresponding to the sequence-preserving tags.

[0026] In one embodiment, the data storage module is further configured to receive modification indication information, where the modification indication information is used to instruct modification of the mapping relationship in the type comparison configuration information and / or the association resolution information.

[0027] In a second aspect, the present application provides a method for parsing a message header, which is applied to the device for parsing the message header described in the first aspect. The method comprises:

[0028] Controlling the data distribution module to obtain the working status indication information of the multiple analysis modules;

[0029] Controlling the data distribution module to send different message data to the multiple parsing modules respectively according to the working status indication information of the multiple parsing modules, wherein the message data includes at least one message header;

[0030] Controlling the parsing module to parse the received message data in at least one parsing cycle and determine a parsing result, the parsing result including a protocol type of at least one message header parsed from the message data received by the parsing module, each parsing cycle being used to parse one message header in the message data received by the parsing module;

[0031] Control the data distribution module to output the analysis result.

[0032] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program and the processor executes the above-mentioned packet header parsing method.

[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to perform the above-mentioned packet header parsing method.

[0034] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and the computer program is executed by a processor to perform the above-mentioned packet header parsing method. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, without paying any creative labor, obtaining other drawings based on these drawings still falls within the scope of the present application.

[0036] FIG1 is a schematic diagram of a network device processing a message in the related art;

[0037] FIG2 is a schematic diagram of a message format in the related art;

[0038] FIG3 is a schematic diagram of parsing a message header in the related art;

[0039] FIG4 is a schematic diagram of an abstract model of a packet header parsing device in the related art;

[0040] FIG5 is a schematic diagram of the structure of a parsing module in the related art;

[0041] FIG6 is a schematic structural diagram of a packet header parsing device in the related art;

[0042] FIG7 is a schematic structural diagram of a packet header parsing device provided in an embodiment of the present application;

[0043] FIG8 is a schematic structural diagram of another packet header parsing device provided in an embodiment of the present application;

[0044] FIG9 is a flow chart of a method for parsing a message header according to an embodiment of the present application;

[0045] FIG10 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0047] First, the related technology will be described below.

[0048] Figure 1 is a schematic diagram of a network device processing a message in the related art. As shown in Figure 1, the message enters the network device from the physical link and undergoes physical link layer processing (e.g., alignment, verification, etc.) through the input interface (Input Port). Secondly, the physical interface can send the message to the message header parser device for message parsing and identifying the type of message header. Thirdly, the message header parser can extract information from the message and send the message to the network ingress (Ingress) for filtering, forwarding, and other processing. Finally, the network ingress sends the message to the message analysis (Deparser) device for modification and processing. After modifying the message, the message analysis device can send the message to the packet buffer (Packet Buffer) for message caching.

[0049] Correspondingly, when a message is scheduled, it can also be parsed by the message header parsing device first, sent to the network exit (Egress) for message filtering, forwarding and other processing, then sent to the message analysis device for modification, and finally sent to the output interface (Output Port), so that the output interface sends the message to the corresponding physical interface.

[0050] The packet header parsing device plays an important role in packet parsing in network devices, which may include routers, switches, network cards, and other devices.

[0051] For example, Figure 2 is a schematic diagram of a message format in the related art. As shown in Figure 2, the message includes message data and multiple message headers. The first message header is an Ethernet header, followed by an Internet Protocol version 4 (IPv4) header, followed by a Transmission Control Protocol (TCP) header, and followed by the TCP header is the message data.

[0052] The lengths of different message headers are different. For example, the Ethernet header is 14 bytes, the IPv4 header is 20 bytes, and the TCP header is 20 bytes.

[0053] Exemplarily, the type of the message header can be identified by parsing the message header with a message header parsing device. For example, whether the message header data contains an Ethernet header can be used to determine whether the message is a standard Ethernet message. Whether the message is an IP message can be determined by checking whether the Ethernet header carries a Virtual Local Area Network (VLAN) tag. Exemplarily, some message headers can also include a next-layer protocol field (Next field) to determine the next-layer protocol. For example, the type of the next-layer protocol can be determined by determining whether the next-layer protocol field of IP is TCP, User Datagram Protocol (UDP), or other protocols.

[0054] It should be noted that the above-mentioned packet header parsing device can be applied to any type of packet header parsing, for example, it can be used to parse tunnel packet headers.

[0055] It should be understood that after determining the message type to be identified in the message header, the message header field information can also be extracted to identify the message header. For example, if the network device is a Layer 2 switch, the Destination Data Media Access Control (DMAC) protocol in the message header can be extracted. The DMAC is used to query the Media Access Control (MAC) address table to determine the destination port. For example, if the network device is a router, the Deterministic Internet Protocol (DIP) in the IP header is used to find the next hop address and ultimately determine the destination port.

[0056] FIG3 is a schematic diagram of a message header parsing process in the related art. As shown in FIG3, the message parsing process is similar to the jump process of the state machine. At the first parsing node Ethernet header, the 13th and 14th bytes at the front of the message can be judged first to determine whether the 13th and 14th bytes are equal to 0x0800 or 0x8100. If the 13th and 14th bytes are equal to 0x0800, the next layer protocol is IPv4. If the 13th and 14th bytes are equal to 0x8100, the next layer protocol is VLAN. In the VLAN state, continue to judge whether the 17th and 18th bytes of the message are equal to 0x0800 or 0x8100. If the 17th and 18th bytes are equal to 0x0800, the next layer protocol is IPv4. If the 17th and 18th bytes are equal to 0x8100, the next layer protocol is VLAN. In the second VLAN state, determine whether the 21st and 22nd bytes of the message are equal to 0x0800. If the 21st and 22nd bytes are equal to 0x0800, then enter the IPv4 state. The subsequent state jump process is similar to the previous one. The above-mentioned parsing nodes can also include Transmission Control Protocol (TCP), UDP, Generic Routing Encapsulation (GRE), Virtual eXtensible Local Area Network (VXLAN), Network Virtualization using Generic Routing Encapsulation (NVGRE) and other nodes.

[0057] Figure 4 is a schematic diagram of an abstract model of a header parsing device in related art. As shown in Figure 4, after header data is input into the header parsing device, the device first performs header recognition, identifying the offset positions of the current and next headers. Subsequently, based on the offset positions of the current and next headers, the device extracts the protocol field of the next header from the header data, stores it in a field buffer, and outputs it to the next-level module for the next header recognition.

[0058] It should be understood that in the related art, a packet header parsing device may include multiple parsing modules. Figure 5 is a schematic diagram of the structure of a parsing module in the related art. As shown in Figure 5, the parsing module includes a packet header identification unit, a terminating content addressable memory (TCAM) unit, a static random-access memory (SRAM) unit, a domain segment extraction unit, and a domain segment cache unit.

[0059] The message header identification unit determines the status information of the current message header based on the protocol segment field of the current message header. Subsequently, the TCAM module compares the status information of the current message header with the preset mapping relationship to determine the type of the next message header to be identified. After the TCAM hits, it accesses the associated data in the SRAM and then determines the field segment extraction information of the next message header to be identified. Subsequently, the field segment extraction unit extracts the protocol field segment of the next message header to be identified from the message data based on the field segment extraction information of the next message header to be identified. The above-mentioned protocol field segment of the next message header to be identified is stored in the field segment cache unit for parsing the next message header to be identified.

[0060] The TCAM module may include a user-configured mapping between the status information of the current packet header and the type of the next packet header to be identified. The protocol field may include a specific field in the packet data for identifying the packet header. The packet status information may be used to indicate the protocol identifier of the corresponding packet header.

[0061] In some embodiments, due to the large TCAM access latency and the long total latency for reading the SRAM storing associated data after a TCAM hit, which generally requires 5 to 6 clock cycles, and the status information of the next packet header needs to depend on the result of the current table lookup, which in turn affects the throughput of the packet header parsing device. In order to reduce latency, registers can be used to replace the TCAM and SRAM, and a multi-stage pipeline can be used to improve throughput.

[0062] Figure 6 is a schematic diagram of the structure of a packet header parsing device in related art. As shown in Figure 6, the packet header parsing device can connect multiple parsing modules in series, each of which is used to parse a packet header in the packet data and identify only one layer of the packet protocol type or subtype in the packet data. The packet header parsing device also includes a register, from which the parsing module can obtain type comparison configuration information and associated parsing information to perform packet parsing.

[0063] However, since each message header may include multiple layers of message protocols, complete identification of the protocol types of all message headers in the message data requires connecting multiple parsing modules in series, resulting in wiring congestion in the design of the message header parsing device due to the large number of fan-out lines.

[0064] In order to solve the above technical problems, the embodiments of the present application provide a packet header parsing device, method, equipment, storage medium and program product. Since different packet data are distributed to multiple parsing modules through a data distribution module, and a parsing module can parse the protocol type of at least one packet header in the received packet data in at least one parsing cycle, each parsing module can cyclically parse out all packet headers in a packet data, thereby eliminating the need to layout a corresponding number of parsing modules on the chip based on the number of protocol layers in the packet header, reducing the wiring on the packet header parsing device and avoiding wiring congestion caused by too many fan-out lines.

[0065] In one embodiment, as shown in FIG7 , a packet header parsing device is provided. The packet header parsing device includes: a data distribution module 201 , a data output module 204 and a plurality of parsing modules 202 .

[0066] The data distribution module 201 will be described first.

[0067] The data distribution module 201 is configured to obtain working status indication information of the multiple parsing modules 202 and send different message data to the multiple parsing modules respectively according to the working status indication information of the multiple parsing modules 202 , wherein the message data includes at least one message header.

[0068] The above-mentioned working status indication information is used to indicate whether the parsing module 202 is in an idle state or a busy state.

[0069] In some embodiments, parsing module 202 may determine its own working status at preset time intervals and send working status indication information to data distribution module 201 based on its own working status. In other embodiments, after parsing a target packet header, parsing module 202 may change its own working status to an idle state. Upon detecting that its own working status is an idle state, parsing module 202 may send working status indication information to data distribution module 201.

[0070] In some embodiments, if multiple parsing modules 202 are in an idle state, the data distribution module 201 may randomly select one or more parsing modules 202 from the idle parsing modules 202 to send message data, thereby allowing the parsing modules receiving the message data to parse different message data simultaneously. In other embodiments, the data distribution module 201 may also sort the parsing modules 202 based on the length of time they have been in the idle state and send the message data in the sorted order.

[0071] It should be understood that the message header parsing device provided in the embodiment of the present application can parse multiple message data at the same time. Accordingly, the data distribution module can send multiple message data to different parsing modules respectively, and each parsing module parses the received message data, thereby realizing simultaneous parsing of multiple message data.

[0072] For example, if two tunnel layer messages and one inner layer message are parsed simultaneously, the data distribution module may send message data corresponding to the two tunnel layer messages and one inner layer message to three parsing modules respectively for simultaneous parsing.

[0073] In some embodiments, the data distribution module 201 is further configured to add an order-preserving tag to the message data. The parsing module 202 is further configured to add the order-preserving tag in the received message data to the parsing result. The data output module 204 is further configured to sequentially output the parsing results of the multiple parsing modules according to the output order corresponding to the order-preserving tags.

[0074] For example, data distribution module 201 may add sequence-preserving tag 1 to message data 1, add sequence-preserving tag 2 to message data 2, and add sequence-preserving tag 3 to message data 3. Accordingly, parsing module 202 may also add sequence-preserving tag 1 to the parsing result corresponding to message data 1, add sequence-preserving tag 2 to the parsing result corresponding to message data 2, and add sequence-preserving tag 3 to the parsing result corresponding to message data 3. Subsequently, data output module 204 may output the parsing result after adding sequence-preserving tag 1, the parsing result after adding sequence-preserving tag 2, and the parsing result after adding sequence-preserving tag 3, in sequence, based on the order of the sequence-preserving tags.

[0075] The analysis module 202 is described below.

[0076] The above-mentioned parsing module 202 is used to parse the message data received by the parsing module 202 in at least one parsing cycle to determine the parsing result.

[0077] The parsing result includes a protocol type of at least one message header parsed from the message data received by the parsing module 202 , and each parsing cycle is used to parse a message header in the message data received by the parsing module 202 .

[0078] For example, if the message data includes Ethernet, IPv4, and TCP protocols, the parsing module 202 first parses out the Ethernet protocol type in the first parsing loop, then parses out the Ethernet protocol type in the second parsing loop, and finally parses out the TCP protocol type in the third parsing loop. The protocol types parsed in the three parsing loops are used as the parsing result of the message data.

[0079] In some embodiments, the packet header parsing device further includes a data storage module 203 .

[0080] The data storage module 203 is used to store type comparison configuration information and associated resolution information.

[0081] The parsing module 202 is specifically configured to obtain type comparison configuration information and associated parsing information from the data storage module, and parse the message data received by the parsing module in at least one parsing cycle according to the type comparison configuration information and the associated parsing information to determine a parsing result.

[0082] Among them, the type comparison configuration information includes the mapping relationship between the status information of the message header parsed in the current parsing cycle and the protocol type of the message header to be identified in the next parsing cycle, and the associated parsing information includes the mapping relationship between the status information of the message header to be identified in the next parsing cycle and the extraction control information of the message header to be identified in the next parsing cycle. The status information of the message header is used to indicate the protocol identifier of the corresponding message header, and the extraction control information is used to indicate the protocol location information of the corresponding message header.

[0083] It should be understood that the parsing module 202 can directly obtain the above-mentioned type comparison configuration information from the data storage module 203. The type comparison configuration information can include multiple configuration entries. Each configuration entry corresponds to a mapping relationship between the status information of the message header parsed in the current parsing cycle and the protocol type of the message header to be identified in the next parsing cycle.

[0084] For example, the protocol identifier of the packet header "Ethernet" may correspond to the packet header state 0. The configuration entry of the type comparison configuration information may include a mapping relationship between the packet header state 0 and the protocol type IPv4, and a mapping relationship between the packet header state 0 and the protocol type IPv6. Accordingly, when the packet header parsed in the current parsing cycle is in state 0, the configuration entry can be used to determine whether the packet header to be identified in the next parsing cycle is IPv4 or IPv6.

[0085] Exemplarily, the associated resolution information also includes configuration entries, which may include a mapping relationship between state 1 of the message header and extraction control information for IPv4, and a mapping relationship between state 1 of the message header and extraction control information for IPv6. When it is determined that the message header to be identified in the next resolution cycle is IPv4 or IPv6, it can be determined that the message header in the next resolution cycle is in state 1. At this time, the extraction control information for the protocol type IPv4 and the extraction control information for IPv6 can be obtained through the configuration entries in the associated resolution information.

[0086] In some embodiments, the data storage module 203 is further configured to receive modification indication information, where the modification indication information is used to indicate modification of a mapping relationship in the type comparison configuration information and / or the associated resolution information. Exemplarily, the data storage module 203 may receive modification indication information for the type comparison configuration information and / or the associated resolution information, and then modify configuration items in the comparison configuration information and / or the associated resolution information based on the modification indication information.

[0087] The modification of the configuration items may include changing the mapping relationship in the configuration items, deleting the configuration items, and adding new configuration items.

[0088] In the embodiment of the present application, since the mapping relationships in the type comparison configuration information and / or the associated resolution information can be modified at will according to the user's modification instruction information, the number of protocol types that can be resolved is not limited by the number of resolution modules, but only depends on the number of mapping relationships in the type comparison configuration information and / or the associated resolution information. The greater the number of mapping relationships, the more protocol types that can be resolved.

[0089] FIG8 is a schematic diagram of the structure of another packet header parsing device provided in an embodiment of the present application. As shown in FIG8 , the packet header parsing device includes a packet header identification unit 2021 and a type comparison unit 2022 .

[0090] The message header identification unit 2021 is used to identify the protocol field of the message header parsed in the current parsing cycle and determine the status information of the message header parsed in the current parsing cycle.

[0091] In some embodiments, the status information of the message header parsed by the current parsing cycle can be determined based on the protocol field of the above-mentioned message header and the status of the message header parsed by the previous parsing cycle. For example, if the message header parsed by the previous parsing cycle is in status 0, it can be determined that the message header parsed by the previous parsing cycle is ethernet, and accordingly, the next layer protocol of ethernet is IPv4 or IPv6. Therefore, by identifying whether the protocol field of the message header parsed by the current parsing cycle is the field value 0x800 corresponding to IPv4 or the field value 0x86dd corresponding to IPv6, it can be determined whether the message header parsed by the current parsing cycle is IPv4 or IPv6, and then the status information of the message header parsed by the current parsing cycle can be determined.

[0092] In some embodiments, the packet header identification unit 2021 of the parsing module 202 can obtain the protocol field segment of the packet header parsed in the current parsing cycle and the status of the packet header parsed in a parsing cycle from the previous parsing cycle of the parsing module 202.

[0093] The type comparison unit 2022 is configured to obtain type comparison configuration information from the data storage module, and determine the protocol type of the message header to be identified in the next parsing cycle based on the status information and type comparison configuration information of the message header parsed in the current parsing cycle.

[0094] Exemplarily, the type comparison unit 2022 may match the type comparison configuration information with the state information of the packet header parsed in the current parsing cycle. If a match is found, the protocol type of the packet header to be identified in the next parsing cycle corresponding to the state information of the packet header parsed in the current parsing cycle is determined based on the configuration entry corresponding to the matching mapping relationship.

[0095] Continuing to refer to FIG8 , the parsing module 202 further includes a data selection unit 2023 and a domain segment extraction unit 2024 .

[0096] The above-mentioned data selection unit 2023 is used to obtain the associated parsing information in the data storage module, and determine the field segment extraction information of the message header to be identified in the next parsing cycle based on the associated parsing information and the status information of the message header to be identified in the next parsing cycle. The status information of the message header corresponds to the protocol type of the message header.

[0097] The field extraction information is used to indicate the offset position of the protocol field to be extracted in the next parsing cycle in the message data.

[0098] Exemplarily, the data selection unit 2023 may match the associated parsing information with the state information of the packet header to be identified in the next parsing cycle. If a match is found, the configuration entry corresponding to the matched mapping relationship is used to determine the field extraction information of the packet header to be identified in the next parsing cycle that corresponds to the state information of the packet header to be identified in the next parsing cycle.

[0099] The field extraction unit 2024 is specifically configured to extract information based on the field of the message header to be identified in the next parsing cycle, and extract the protocol field of the message header to be parsed in the next parsing cycle from the message data received by the parsing module.

[0100] Illustratively, after obtaining the domain extraction information of the next parsing cycle, the domain extraction unit 2024 can locate the field at the offset position indicated by the domain extraction information, and extract the field as the protocol domain of the message header parsed in the next parsing cycle.

[0101] In some embodiments, the data storage module 203 is used to store type comparison configuration information and associated resolution information.

[0102] The data storage module 203 can be a data register or other storage device. Since the data register is used instead of TCAM and SRAM to store type comparison configuration information and association parsing information respectively, the data throughput rate during packet header parsing is improved and the delay is reduced.

[0103] In some embodiments, the data output module 204 is used to output the parsing results of the message header data.

[0104] In the present application, a data distribution module dispatches multiple parsing modules to process different message data respectively. Each parsing module cyclically parses multiple message headers in a message data, thereby achieving time-division multiplexing of the parsing module resources, thereby reducing the number of parsing modules in the message header parsing device, reducing the area occupied by the parsing modules, and making the number of parseable protocol types no longer dependent on the number of parsing modules. At the same time, each parsing module can output the parsing result of the message data as soon as it parses the message data. Unlike related technologies, it is not necessary to complete the parsing of a message data at an intermediate node and then complete the parsing of the last serial parsing module before outputting the parsing result, thus reducing delays.

[0105] The packet header parsing device provided in the embodiment of the present application distributes different packet data to multiple parsing modules through a data distribution module, and enables a parsing module to parse the protocol type of at least one packet header in the received packet data in at least one parsing cycle, so that each parsing module can cyclically parse out all the packet headers in a packet data, thereby eliminating the need to layout a corresponding number of parsing modules on the chip based on the number of protocol layers in the packet header, reducing the wiring on the packet header parsing device and avoiding wiring congestion caused by too many fan-out lines.

[0106] FIG9 is a diagram of a packet header parsing method provided in an embodiment of the present application. The packet header parsing method is applied to the packet header parsing device described above. As shown in FIG9 , the packet parsing method includes steps S301 to S304:

[0107] S301: Control a data distribution module to obtain working status indication information of multiple parsing modules.

[0108] The above-mentioned working status indication information is used to indicate whether the parsing module is in an idle state or a busy state.

[0109] In some embodiments, the parsing module can determine its own operating status at preset time intervals and send operating status indication information to the data distribution module based on its own operating status. In other embodiments, after the parsing module has parsed a target message header, it can change its own operating status to an idle state. When the parsing module detects that its own operating status is an idle state, it can send operating status indication information to the data distribution module.

[0110] S302: Control the data distribution module to send different message data to the multiple parsing modules respectively according to the working status indication information of the multiple parsing modules.

[0111] The message data includes at least one message header.

[0112] In some embodiments, if multiple parsing modules are in an idle state, the data distribution module may randomly select one or more parsing modules from the idle parsing modules to send message data, thereby allowing the parsing modules that receive the message data to parse different message data simultaneously. In other embodiments, the data distribution module may also sort the parsing modules based on the length of time they have been in the idle state and send the message data in the sorted order.

[0113] It should be understood that the message header parsing device provided in the embodiment of the present application can parse multiple message data at the same time. Accordingly, the data distribution module can send multiple message data to different parsing modules respectively, and each parsing module parses the received message data, thereby realizing simultaneous parsing of multiple message data.

[0114] S303: Control the parsing module to parse the received message data in at least one parsing cycle and determine a parsing result.

[0115] The parsing result includes a protocol type of at least one message header parsed from the message data received by the parsing module, and each parsing cycle is used to parse a message header in the message data received by the parsing module.

[0116] In some embodiments, the parsing module can be controlled to obtain type comparison configuration information and associated parsing information from the data storage module, and, based on the type comparison configuration information and associated parsing information, parse the message data received by the parsing module in at least one parsing cycle to determine the parsing result.

[0117] Among them, the type comparison configuration information includes the mapping relationship between the status information of the message header parsed in the current parsing cycle and the protocol type of the message header to be identified in the next parsing cycle, and the associated parsing information includes the mapping relationship between the status information of the message header to be identified in the next parsing cycle and the extraction control information of the message header to be identified in the next parsing cycle. The status information of the message header is used to indicate the protocol identifier of the corresponding message header, and the extraction control information is used to indicate the protocol location information of the corresponding message header.

[0118] S304: Control the data distribution module to output the analysis results.

[0119] In some embodiments, the data distribution module can add an order-preserving tag to the message data. The parsing module can add the order-preserving tag in the received message data to the parsing results. The data output module can output the parsing results of multiple parsing modules in sequence according to the output order corresponding to the order-preserving tags.

[0120] The packet header parsing method provided in the embodiment of the present application distributes different packet data to multiple parsing modules through a data distribution module, and enables a parsing module to parse the protocol type of at least one packet header in the received packet data in at least one parsing cycle, so that each parsing module can cyclically parse out all packet headers in a packet data, thereby eliminating the need to layout a corresponding number of parsing modules on the chip based on the number of protocol layers in the packet header, reducing the wiring on the packet header parsing device, and avoiding wiring congestion caused by too many fan-out lines.

[0121] In one embodiment, a computer device is provided, which may be a network device, and its internal structure diagram may be shown in Figure 10. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless communication, and the wireless communication may be implemented via Wi-Fi, a mobile cellular network, NFC (near field communication), or other technologies. When executed by the processor, the computer program implements a method for parsing message headers.

[0122] Those skilled in the art will understand that the structure shown in FIG10 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0123] In one embodiment, a chip is provided, which includes the above-mentioned packet header parsing device.

[0124] In one embodiment, a computer device is provided, comprising the above chip.

[0125] 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, the above-mentioned packet header parsing method is implemented.

[0126] In one embodiment, a computer program product is provided, including a computer program, which implements the above-mentioned message header parsing method when executed by a processor.

[0127] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.

[0128] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0129] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A packet header parsing device, characterized in that: The device comprises: a data distribution module, a data output module and a plurality of parsing modules; The data distribution module is used to obtain the working status indication information of the multiple analysis modules, and send different message data to the multiple analysis modules respectively according to the working status indication information of the multiple analysis modules, wherein the message data includes at least one message header; The parsing module is used to parse the message data received by the parsing module in at least one parsing cycle to determine a parsing result, wherein the parsing result includes a protocol type of at least one message header parsed from the message data received by the parsing module, and each parsing cycle is used to parse a message header in the message data received by the parsing module; The data distribution module is used to output the analysis result.

2. The device according to claim 1, characterized in that The packet header parsing device further includes a data storage module; The data storage module is used to store type comparison configuration information and associated parsing information; The parsing module is specifically configured to obtain the type comparison configuration information and the associated parsing information from the data storage module, and parse the message data received by the parsing module in the at least one parsing cycle according to the type comparison configuration information and the associated parsing information to determine the parsing result; Among them, the type comparison configuration information includes a mapping relationship between the status information of the message header parsed in the current parsing cycle and the protocol type of the message header to be identified in the next parsing cycle, and the associated parsing information includes a mapping relationship between the status information of the message header to be identified in the next parsing cycle and the extraction control information of the message header to be identified in the next parsing cycle, the status information of the message header is used to indicate the protocol identifier of the corresponding message header, and the extraction control information is used to indicate the protocol location information of the corresponding message header.

3. The device according to claim 2, characterized in that The parsing module includes a message header identification unit and a type comparison unit; The message header identification unit is used to identify the protocol domain segment of the message header parsed by the current parsing cycle, and determine the state information of the message header parsed by the current parsing cycle; The type comparison unit is used to obtain the type comparison configuration information from the data storage module, and determine the protocol type of the message header to be identified in the next parsing cycle according to the status information of the message header parsed in the current parsing cycle and the type comparison configuration information.

4. The device according to claim 2, characterized in that The parsing module also includes a data selection unit and a domain segment extraction unit; The data selection unit is used to obtain the associated parsing information from the data storage module, and determine the field segment extraction information of the message header to be identified in the next parsing cycle according to the associated parsing information and the state information of the message header to be identified in the next parsing cycle, wherein the state information of the message header corresponds to the protocol type of the message header; The domain segment extraction unit is used to extract the protocol domain segment of the message header to be identified in the next parsing cycle from the message data received by the parsing module according to the domain segment extraction information of the message header to be identified in the next parsing cycle.

5. The device according to any one of claims 1 to 4, characterized in that: The data distribution module is also used to add an order-preserving label to the message data; The parsing module is further used to add the sequence preservation label in the received message data to the parsing result; The data output module is further configured to output the parsing results of the multiple parsing modules in sequence according to the output sequence corresponding to the sequence preservation tags.

6. The device according to any one of claims 2 to 4, characterized in that The data storage module is further used to receive modification indication information, where the modification indication information is used to indicate modification of the mapping relationship in the type comparison configuration information and / or the association resolution information.

7. A method for parsing a message header, characterized in that: The method applied to the packet header parsing device according to any one of claims 1 to 6 comprises: Controlling the data distribution module to obtain the working status indication information of the multiple analysis modules; Controlling the data distribution module to send different message data to the multiple analysis modules respectively according to the working status indication information of the multiple analysis modules, wherein the message data includes at least one message header; Controlling the parsing module to parse the received message data in at least one parsing cycle and determine a parsing result, wherein the parsing result includes a protocol type of at least one message header parsed from the message data received by the parsing module, and each parsing cycle is used to parse a message header in the message data received by the parsing module; Control the data distribution module to output the analysis result.

8. The method according to claim 7, characterized in that The controlling the parsing module to parse the received message data in at least one parsing cycle and determine the parsing result includes: Controlling the data storage module in the parsing device of the message header to store type comparison configuration information and associated parsing information; Controlling the parsing module to obtain the type comparison configuration information and the associated parsing information from the data storage module, and, according to the type comparison configuration information and the associated parsing information, parsing the message data received by the parsing module in the at least one parsing cycle to determine the parsing result; Among them, the type comparison configuration information includes a mapping relationship between the status information of the message header parsed in the current parsing cycle and the protocol type of the message header to be identified in the next parsing cycle, and the associated parsing information includes a mapping relationship between the status information of the message header to be identified in the next parsing cycle and the extraction control information of the message header to be identified in the next parsing cycle, the status information of the message header is used to indicate the protocol identifier of the corresponding message header, and the extraction control information is used to indicate the protocol location information of the corresponding message header.

9. The method according to claim 8, characterized in that The method further comprises: The control message header identification unit identifies the protocol domain segment of the message header parsed by the current parsing cycle, and determines the state information of the message header parsed by the current parsing cycle; The control type comparison unit obtains the type comparison configuration information from the data storage module, and determines the protocol type of the message header to be identified in the next parsing cycle according to the status information of the message header parsed in the current parsing cycle and the type comparison configuration information.

10. The method according to claim 8, characterized in that The method further comprises: The control data selection unit obtains the associated parsing information from the data storage module, and determines the field segment extraction information of the message header to be identified in the next parsing cycle according to the associated parsing information and the state information of the message header to be identified in the next parsing cycle, wherein the state information of the message header corresponds to the protocol type of the message header; The control field segment extraction unit extracts the protocol field segment of the message header to be identified in the next parsing cycle from the message data received by the parsing module according to the field segment extraction information of the message header to be identified in the next parsing cycle.

11. The method according to any one of claims 7 to 10, characterized in that: The method further comprises: Control the data distribution module to add an order-preserving tag to the message data; Controlling the parsing module, and further used to add the sequence preservation tag in the received message data to the parsing result; The data output module is controlled to output the parsing results of the multiple parsing modules in sequence according to the output sequence corresponding to the sequence preservation tags.

12. The method according to any one of claims 8 to 10, characterized in that The method further comprises: The control data storage module receives modification indication information, where the modification indication information is used to indicate modification of the mapping relationship in the type comparison configuration information and / or the association resolution information.

13. A chip, characterized in that: The chip includes a packet header parsing device as described in any one of claims 1 to 6.

14. A computer device, characterized in that: The computer device comprises the chip as claimed in claim 13.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 7 to 12 are implemented.

16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 7 to 12 are implemented.

Citation Information

Patent Citations

  • Message parser and design method thereof

    CN111131159A

  • Message analysis method and network equipment

    CN113824706A

  • Programmable protocol processing engine for network packet devices

    US20020191621A1