Message header analysis device and method, equipment, storage medium and program product
Through the data distribution module, different message data are distributed to multiple analytical modules, so that each analytical module can parse all message headers in the message data in at least one loop, solving the problem of wiring congestion of the message header analysis device and improving the Analytical efficiency and throughput.
Patent Information
- Application Number
- CN202310866446.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-14
- Publication Date
- 2025-01-14
AI Technical Summary
The existing message header parsing device needs to connect multiple resolution modules in series, resulting in wiring congestion and cannot effectively identify the protocol type of the multi-layer message protocol.
The data distribution module obtains the working status indication information of multiple parsing modules, and distributes different message data to each parsing module, so that each parsing module can parse the protocol type of one message header in at least one loop, reducing wiring and parsing Number of modules.
It realizes that multiple parsing modules are laid out according to the protocol number of packet headers, reducing wiring congestion, and improving analysis efficiency and throughput.
Smart Images

Figure CN119316496A_ABST
Abstract
Description
Technical Field
[0001] 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
[0002] In a network device, a message enters the network device from a physical link, and 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 information from the message. Subsequently, the network device can filter, forward, and process the message.
[0003] In the related art, the parsing process of the message header is similar to the jump process of the state machine. Specifically, the message header parsing device in the network device can connect multiple parsing modules in series, and each parsing module only identifies a layer of message protocol type or subtype in the message header data. The message header parsing device also includes a register, and the parsing module can obtain type comparison configuration information and associated parsing information from the register to perform message parsing.
[0004] However, since each message data may include multiple layers of message protocols, multiple parsing modules need to be connected in series to fully identify the protocol types of all message headers in the message data, which causes wiring congestion when designing the message header parsing device due to the large number of fan-out lines. Summary of the invention
[0005] Based on this, it is necessary to provide a packet header parsing device, method, equipment, storage medium and program product that can avoid wiring congestion of the packet header parsing device in order to address the above technical problems.
[0006] In a first aspect, the present application provides a packet header parsing device, which includes: a data distribution module, a data output module, and a plurality of parsing modules;
[0007] 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;
[0008] 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;
[0009] The data distribution module is used to output the analysis result.
[0010] In one of the embodiments, the packet header parsing device further includes a data storage module;
[0011] The data storage module is used to store type comparison configuration information and associated parsing information;
[0012] 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;
[0013] 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.
[0014] In one of the embodiments, the parsing module includes a message header identification unit and a type comparison unit;
[0015] 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;
[0016] 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.
[0017] In one of the embodiments, the parsing module further includes a data selection unit and a domain segment extraction unit;
[0018] 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;
[0019] 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.
[0020] In one of the embodiments, the data distribution module is further used to add an order-preserving tag to the message data;
[0021] The parsing module is further used to add the sequence preservation label in the received message data to the parsing result;
[0022] 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.
[0023] In one of the embodiments, 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.
[0024] In a second aspect, the present application provides a method for parsing a message header, which is applied to the device for parsing a message header described in the first aspect. The method comprises:
[0025] Controlling the data distribution module to obtain the working status indication information of the multiple analysis modules;
[0026] 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;
[0027] 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;
[0028] Control the data distribution module to output the analysis result.
[0029] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor executes the above-mentioned message header parsing method.
[0030] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor to perform the above-mentioned packet header parsing method.
[0031] 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 message header parsing method.
[0032] The above-mentioned message header parsing device, method, equipment, storage medium and program product, the message header parsing device includes a data distribution module, a data output module and multiple parsing modules. The data distribution module is used to obtain the working status indication information of multiple parsing modules, and according to the working status indication information of multiple parsing modules, send different message data to multiple parsing modules respectively, and 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, and determine the parsing result, and the parsing result includes the 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 parsing result. Since different message data are distributed to multiple parsing modules through the data distribution module, and one parsing module can parse the protocol type of at least one message header in the received message data in at least one parsing cycle, each parsing module can cyclically parse out all message headers in one message data, and thus there is no need to layout a corresponding number of parsing modules on the chip based on the number of protocol layers in the message header, thereby reducing the wiring on the parsing device of the message header and avoiding wiring congestion caused by too many fan-out lines. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A schematic diagram of a network device processing a message in the related art;
[0034] Figure 2 A schematic diagram of a message format in the related art;
[0035] Figure 3 A schematic diagram of parsing a message header in the related art;
[0036] Figure 4 It is a schematic diagram of an abstract model of a packet header parsing device in the related art;
[0037] Figure 5 It is a structural diagram of a parsing module in the related art;
[0038] Figure 6 It is a structural schematic diagram of a packet header parsing device in the related art;
[0039] Figure 7 A schematic diagram of the structure of a packet header parsing device provided in an embodiment of the present application;
[0040] Figure 8 A schematic diagram of the structure of another packet header parsing device provided in an embodiment of the present application;
[0041] Fig. 9A flowchart of a method for parsing a message header provided in an embodiment of the present application;
[0042] Fig.10 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] First, the related technology will be described below.
[0045] Figure 1 FIG. 1 is a schematic diagram of a network device processing a message in a related technology. Figure 1 As shown, the message enters the network device from the physical link and is processed at the physical link layer (for example, alignment, verification, etc.) through the input interface (Input Port). Secondly, the physical interface can send the message to the message header parsing device for message parsing and identifying the type of the message header. Thirdly, the message header parsing device can extract the information in 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 to modify the message. After modifying the message, the message analysis device can send the message to the packet buffer (Packet Buffer) for message caching.
[0046] Correspondingly, when a message is scheduled, it can also be parsed by the message header parsing device first, sent to the network egress (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.
[0047] 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.
[0048] For example, Figure 2 FIG. 1 is a schematic diagram of a message format in the related art. Figure 2As shown in the figure, the message contains 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.
[0049] Among them, 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.
[0050] Exemplarily, the type of the message header can be identified by parsing the message header through the message header parsing device. For example, it can be determined whether the message is a standard Ethernet message by identifying whether the message header data contains an Ethernet header. By checking whether the Ethernet header carries a virtual local area network (VLAN) tag, it is determined whether it is an IP message. Exemplarily, some message headers may also include a next layer protocol field (Next field) to determine the next layer protocol. For example, the type of the next layer protocol is determined by whether the next layer protocol field of IP is TCP, User Datagram Protocol (UDP) or other protocols.
[0051] 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 for parsing tunnel packet headers.
[0052] It should be understood that after determining the type of message to be identified in the message header, the field information of the message header can also be extracted to identify the message header. Exemplarily, if the network device is a layer 2 switch, the destination data media access control (DMAC) protocol in the message header can be extracted, and DMAC is used to look up the media access control (MAC) MAC address table to determine the destination port. Exemplarily, if the network device is a router, the destination internet protocol (DIP) in the IP header is used to find the next hop address and finally determine the destination port.
[0053] Figure 3 FIG. 1 is a schematic diagram of parsing a message header in the related art. Figure 3As shown in the figure, the parsing process of the message is similar to the jump process of the state machine. At the Ethernet header of the first parsing node, 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, 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.
[0054] Figure 4 FIG. 1 is a schematic diagram of an abstract model of a packet header parsing device in the related art. Figure 4 As shown, after the header data is input into the header parsing device, the header is first identified to identify the offset position of the current header and the next header. Then, according to the offset position of the current header and the next header, the protocol domain of the next header is extracted from the header data, filled into the domain cache, and output to the next level module to identify the next header.
[0055] It should be understood that in the related art, the packet header parsing device may include multiple parsing modules. Figure 5 FIG. 1 is a schematic diagram of the structure of the analysis module in the related art. Figure 5 As shown, the parsing module includes a message 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.
[0056] The message header identification unit determines the status information of the current message header according to 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 to determine the domain segment extraction information of the next message header to be identified. Subsequently, the domain segment extraction unit extracts the protocol domain segment of the next message header to be identified from the message data according to the domain segment extraction information of the next message header to be identified. The above-mentioned protocol domain segment of the next message header to be identified is stored in the domain segment cache unit for parsing the next message header to be identified.
[0057] The TCAM module may include a mapping relationship between the status information of the current message header configured by the user and the type of the next message header to be identified. The protocol domain may include a specific field in the message data for identifying the message header. The message status information may be used to indicate the protocol identifier of the corresponding message header.
[0058] 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 message header must rely on the result of the current table lookup, which in turn affects the throughput of the message header parsing device. In order to reduce latency, registers can be used to replace TCAM and SRAM, and a multi-stage pipeline can be used to improve throughput.
[0059] Figure 6 FIG. 1 is a schematic diagram of the structure of a packet header parsing device in the related art. Figure 6 As shown, the packet header parsing device can connect multiple parsing modules in series, each parsing module is used to parse a packet header in the packet data, and only identify a layer of packet protocol type or subtype in the packet data. The packet header parsing device also includes a register, and the parsing module can obtain type comparison configuration information and associated parsing information from the register to perform packet parsing.
[0060] However, since each message header may include multiple layers of message protocols, multiple parsing modules need to be connected in series to fully identify the protocol types of all message headers in the message data, which causes wiring congestion when designing the message header parsing device due to the large number of fan-out lines.
[0061] In order to solve the above technical problems, the embodiments of the present application provide a message header parsing device, method, equipment, storage medium and program product. Since different message 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 message header in the received message data in at least one parsing cycle, each parsing module can cyclically parse out all message headers in a message data, and there is no need to layout a corresponding number of parsing modules on the chip based on the number of protocol layers in the message header, thereby reducing the wiring on the message header parsing device and avoiding wiring congestion caused by too many fan-out lines.
[0062] In one embodiment, Figure 7 As shown, a packet header parsing device is provided, and the packet header parsing device includes: a data distribution module 201, a data output module 204 and a plurality of parsing modules 202.
[0063] The data distribution module 201 will be described first.
[0064] The data distribution module 201 is used to obtain the 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.
[0065] The above working status indication information is used to indicate whether the parsing module 202 is in an idle state or a busy state.
[0066] In some embodiments, the parsing module 202 may determine its own working state at a preset time interval, and send working state indication information to the data distribution module 201 based on its own working state. In other embodiments, after the parsing module 202 parses a target message header data, it may change its own working state to an idle state. When it is detected that its own working state is an idle state, it may send working state indication information to the data distribution module 201.
[0067] In some embodiments, if multiple parsing modules 202 are in an idle state, the data distribution module 201 can randomly select one or more parsing modules 202 from the parsing modules 202 in an idle state to send message data, so that the parsing modules that receive the message data can parse different message data at the same time. In other embodiments, the data distribution module 201 can also sort the parsing modules 202 according to the length of time in the idle state, and send the message data according to the sorted order.
[0068] 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 the multiple message data to different parsing modules respectively, and each parsing module parses the received message data, thereby realizing simultaneous parsing of multiple text data.
[0069] Exemplarily, 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.
[0070] In some embodiments, the data distribution module 201 is further used to add an order-preserving tag to the message data. The parsing module 202 is further used to add the order-preserving tag in the received message data to the parsing result. The data output module 204 is further used to output the parsing results of multiple parsing modules in sequence according to the output order corresponding to the order-preserving tag.
[0071] Exemplarily, the data distribution module 201 may add the sequence preservation label 1 to the message data 1, add the sequence preservation label 2 to the message data 2, and add the sequence preservation label 3 to the message data 3. Correspondingly, the parsing module 202 also adds the sequence preservation label 1 to the parsing result corresponding to the message data 1, adds the sequence preservation label 2 to the parsing result corresponding to the message data 2, and adds the sequence preservation label 3 to the parsing result corresponding to the message data 3. Subsequently, the data output module 204 may output the parsing result after adding the sequence preservation label 1, the parsing result after adding the sequence preservation label 2, and the parsing result after adding the sequence preservation label 3 in sequence according to the order of the sequence preservation labels.
[0072] The analysis module 202 is described below.
[0073] 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.
[0074] 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 .
[0075] For example, if the message data includes the Ethernet protocol, the IPv4 protocol and the TCP protocol, the parsing module 202 first parses out the type of the Ethernet protocol in the first parsing cycle, and then parses out the type of the Ethernet protocol in the second parsing cycle. Finally, the type of the TCP protocol is parsed in the third parsing cycle, so that the protocol types parsed in the three parsing cycles are used as the parsing results of the message data.
[0076] In some embodiments, the packet header parsing device further includes a data storage module 203 .
[0077] The data storage module 203 is used to store type comparison configuration information and associated analysis information.
[0078] The parsing module 202 is specifically used 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 the parsing result.
[0079] 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.
[0080] It should be understood that, for the above type comparison configuration information, the parsing module 202 can directly obtain it 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.
[0081] For example, the protocol identifier of the packet header Ethernet can correspond to the state 0 of the packet header. The configuration entry of the type comparison configuration information can include the mapping relationship between the state 0 of the packet header and the protocol type IPv4, and the mapping relationship between the state 0 of the packet header 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 the next parsing cycle.
[0082] The packet header to be identified is IPv4 or IPv6.
[0083] Exemplarily, the associated resolution information also includes configuration entries, which may include a mapping relationship between the state 1 of the message header and the extraction control information of IPv4, and a mapping relationship between the state 1 of the message header and the extraction control information of 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 of the next resolution cycle is in state 1. At this time, the extraction control information of the protocol type IPv4 and the extraction control information of IPv6 can be obtained through the configuration entries in the associated resolution information.
[0084] In some embodiments, the data storage module 203 is further used to receive modification indication information, which is used to indicate modification of the mapping relationship in the type comparison configuration information and / or the associated resolution information. Exemplarily, the data storage module 203 can receive modification indication information of the type comparison configuration information and / or the associated resolution information, and then the data storage module 203 modifies the configuration items in the comparison configuration information and / or the associated resolution information according to the modification indication information.
[0085] The modification of the configuration entry may include changing the mapping relationship in the configuration entry, deleting the configuration entry, and adding a new configuration entry.
[0086] In the embodiment of the present application, since the mapping relationship 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 will not be 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 larger the number of mapping relationships, the more protocol types that can be resolved are supported.
[0087] Figure 8 A schematic diagram of the structure of another packet header parsing device provided in an embodiment of the present application. Figure 8 As shown, the packet header parsing device includes a packet header identification unit 2021 and a type comparison unit 2022.
[0088] The message header identification unit 2021 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.
[0089] In some embodiments, the status information of the message header parsed by the current parsing cycle can be determined based on the protocol domain of the above-mentioned message header and the status of the message header parsed by the previous parsing cycle. Exemplarily, if the message header parsed by the previous parsing cycle is in state 0, it can be determined that the message header parsed by the previous parsing cycle is ethernet, and correspondingly, the next layer protocol of ethernet is Ipv4 or Ipv6. Therefore, by identifying whether the protocol domain of the message header parsed by the current parsing cycle is the domain value 0x800 corresponding to Ipv4, or the domain 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.
[0090] In some embodiments, the message header identification unit 2021 of the parsing module 202 can obtain the protocol field segment of the message header parsed in the current parsing cycle and the status of the message header parsed in a parsing cycle from the previous parsing cycle of the parsing module 202.
[0091] The type comparison unit 2022 is used 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 according to the status information and type comparison configuration information of the message header parsed in the current parsing cycle.
[0092] Exemplarily, the type comparison unit 2022 can match the type comparison configuration information with the state information of the message header parsed by the current parsing cycle. If a match is found, the protocol type of the message header to be identified in the next parsing cycle corresponding to the state information of the message header parsed by the current parsing cycle is determined through the configuration entry corresponding to the matched mapping relationship.
[0093] Continue to refer Figure 8 The parsing module 202 also includes a data selection unit 2023 and a domain segment extraction unit 2024.
[0094] 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.
[0095] The domain extraction information is used to indicate the offset position of the extracted protocol domain in the message data in the next parsing cycle.
[0096] Exemplarily, the data selection unit 2023 may match the associated parsing information through the state information of the message header to be identified in the next parsing cycle. If a match is found, the domain segment extraction information of the message header to be identified in the next parsing cycle corresponding to the state information of the message header to be identified in the next parsing cycle is determined through the configuration entry corresponding to the hit mapping relationship.
[0097] The above-mentioned field segment extraction unit 2024 is specifically used to extract the protocol field segment of the message header to be parsed 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.
[0098] Exemplarily, after acquiring the domain extraction information of the next parsing cycle, the domain extraction unit 2024 may 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 to be parsed in the next parsing cycle.
[0099] In some embodiments, the data storage module 203 is used to store type comparison configuration information and associated resolution information.
[0100] The data storage module 203 can be a storage device such as a data register. Since the data register is used instead of TCAM and SRAM to store type comparison configuration information and associated parsing information respectively, the data throughput rate during packet header parsing is improved and the delay is reduced.
[0101] In some embodiments, the data output module 204 is used to output the parsing results of the message header data.
[0102] In the present application, a plurality of parsing modules are scheduled to process different message data respectively through a data distribution module, and each parsing module cyclically parses a plurality of message headers in a message data, so that time-division multiplexing of the resources of the parsing module can be realized, thereby reducing the number of parsing modules of the parsing device for the message header, reducing the area occupied by the parsing module, and making the number of parsable protocol types no longer dependent on the number of parsing modules. At the same time, as long as each parsing module parses the message data, it can output the parsing result of the message data, without the need to complete the parsing of a message data at the intermediate node as in the related art, and then finish the last serial parsing module before outputting the parsing result, thereby reducing the delay.
[0103] 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 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, thereby reducing the wiring on the packet header parsing device and avoiding wiring congestion caused by too many fan-out lines.
[0104] Fig. 9 A method for parsing a message header is provided in an embodiment of the present application. The method for parsing a message header is applied to the parsing device for the message header, such as Fig. 9 As shown, the message parsing method includes S301-S304:
[0105] S301. Control a data distribution module to obtain working status indication information of multiple analysis modules.
[0106] The above-mentioned working status indication information is used to indicate whether the parsing module is in an idle state or a busy state.
[0107] In some embodiments, the parsing module can determine its own working state at a preset time interval, and send working state indication information to the data distribution module based on its own working state. In other embodiments, after the parsing module parses a target message header data, it can change its own working state to an idle state. When it is detected that its own working state is an idle state, it can send working state indication information to the data distribution module.
[0108] 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.
[0109] The message data includes at least one message header.
[0110] In some embodiments, if multiple parsing modules are in an idle state, the data distribution module can randomly select one or more parsing modules from the parsing modules in the idle state to send message data, so that the parsing modules that receive the message data can parse different message data at the same time. In other embodiments, the data distribution module can also sort the parsing modules according to the length of time in the idle state, and send the message data according to the sorted order.
[0111] 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 the multiple message data to different parsing modules respectively, and each parsing module parses the received message data, thereby realizing simultaneous parsing of multiple text data.
[0112] S303: Control the parsing module to parse the received message data in at least one parsing cycle and determine a parsing result.
[0113] 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.
[0114] 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 the associated parsing information, parse the message data received by the parsing module in at least one parsing cycle to determine the parsing result.
[0115] 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.
[0116] S304, control the data distribution module to output the analysis result.
[0117] 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 result. 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 tag.
[0118] The message header parsing method provided in the embodiment of the present application distributes different message data to multiple parsing modules through a data distribution module, and enables a parsing module to parse the protocol type of at least one message header in the received message data in at least one parsing cycle, so that each parsing module can cyclically parse out all the message headers in a message data, and thus there is no need to layout a corresponding number of parsing modules on the chip based on the number of protocol layers in the message header, thereby reducing the wiring on the message header parsing device and avoiding wiring congestion caused by too many fan-out lines.
[0119] In one embodiment, a computer device is provided. The computer device may be a network device, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through 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 the 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 an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for parsing a message header is implemented.
[0120] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part 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 those shown in the figure, or combine certain components, or have a different arrangement of components.
[0121] In one embodiment, a chip is provided, wherein the chip includes the above-mentioned message header parsing device.
[0122] In one embodiment, a computer device is provided, the computer device comprising the above chip.
[0123] 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 message header parsing method is implemented.
[0124] 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.
[0125] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed 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 the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an 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 each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0126] The technical features of the above embodiments may 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.
[0127] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached 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. A chip, characterized in that: The chip includes a packet header parsing device as described in any one of claims 1-6.
9. A computer device, characterized in that: The computer device comprises the chip as claimed in claim 8.
10. 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 claim 7 are implemented.
11. 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 claim 7 are implemented.
Citation Information
Cited By
Network message analysis device and chip
CN121728177A
A network packet parsing device and chip
CN121728177B