Message analysis system and message analysis method
By combining fixed and programmable parsers, the scalability and efficiency issues of parsers under diverse network protocols are solved, realizing a low-latency and flexible message parsing system and reducing resource requirements.
Patent Information
- Application Number
- CN202411090541.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2025-01-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing fixed parsers have limited scalability when facing diverse network protocols, while programmable parsers are insufficient in terms of efficiency and resource requirements, making it difficult to simultaneously meet the needs of low latency and flexibility.
By combining a fixed parser and a programmable parser, the fixed parser parses the parsable protocol, while the unparsed part is handed over to the programmable parser for further processing, thus realizing the caching and dynamic parsing of the protocol stack.
It achieves a balance between low latency and flexibility requirements, reduces system resource requirements, and improves message parsing efficiency.
Smart Images

Figure CN119299536A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more specifically, to a message parsing system and a message parsing method. Background Art
[0002] The process of extracting keywords from the message header to identify information such as the message type and header length is called message parsing. Any network device, such as network cards, switches, routers, etc., needs to parse the message header information to determine the subsequent processing method of the message. In order to meet various network requirements, today's network protocols are diverse and ever-changing. The traditional message parsing method based on a fixed message format (that is, the message parsing method based on a fixed parser) has the characteristics of simple implementation, low latency, and less hardware resources required. However, fixed parsers usually support existing protocols, and their scalability is greatly limited. For more and more network protocols, it is difficult to implement them using fixed parsers. The current programmable parsers can well support various new protocols, user-defined protocols, etc., but the efficiency is low, requiring more hardware overhead, latency, and greater power consumption. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a message parsing system and a message parsing method to combine a fixed parser and a programmable parser, and use the fixed parser to parse the message protocols that it can parse, and use the programmable parser to parse the message protocols that the fixed parser cannot parse, so that the message parsing system can meet the low latency requirements and flexibility requirements, while also reducing the system resource requirements.
[0004] In a first aspect, an embodiment of the present invention provides a message parsing system, the message parsing system comprising:
[0005] The fixed parser is configured to receive and parse the original message, and in response to the original message not being parsed completely, send message parsing information to the programmable parser, wherein the message parsing information includes a parsed result and a message header of the original message;
[0006] The programmable parser is configured to perform message parsing according to the received parsed result and the message header to obtain the message parsing result.
[0007] Furthermore, the programmable parser is further configured to remove the parsed protocol header from the message header according to the parsed result, so as to parse the unparsed protocol header in the message header.
[0008] Furthermore, the message parsing system further includes:
[0009] A cache is configured to cache the message parsing results sent by the fixed parser or the programmable parser.
[0010] Further, the fixed parser is configured to generate and send a message parsing result to the buffer in response to completion of message parsing.
[0011] Further, the programmable parser comprises:
[0012] A parsing allocation unit, configured to receive at least one message parsing information sent by the fixed parser, and allocate a corresponding parsing unit to each message parsing information;
[0013] A header cache unit, configured to cache the message header information in each of the message parsing information;
[0014] At least one parsing unit is configured to parse the unparsed protocol header in the corresponding message header according to the received message parsing information.
[0015] Furthermore, the programmable parser also includes:
[0016] an addressing unit, configured to receive the field information obtained by the parsing unit, and perform a matching operation according to the field information to obtain a corresponding pointer, wherein the pointer is used to point to a protocol type corresponding to a next parsing state and / or action information corresponding to the field information;
[0017] The action storage unit is configured to store the protocol type or action associated with the addressing unit, and obtain the protocol type and / or corresponding action information corresponding to the next parsing state according to the pointer determined by the addressing unit.
[0018] Furthermore, the parsing unit is further configured to parse the next unparsed protocol header obtained from the header cache unit according to the protocol type and / or corresponding action information returned by the action storage unit.
[0019] Furthermore, the programmable parser also includes:
[0020] The processing unit is configured to perform corresponding actions according to the action information, and the actions include domain segment extraction, arithmetic and / or logical operations.
[0021] Further, the parsing unit is further configured to generate a message parsing result and a parsing completion feedback message in response to the completion of the parsing of the original message, and send the parsing completion feedback message to the parsing allocation unit;
[0022] The parsing allocation unit is further configured to update the state of the corresponding parsing unit to an idle state according to the parsing completion feedback message.
[0023] Further, the fixed parser includes:
[0024] A header recognition module is configured to receive the original message, perform header recognition on the original message, and obtain header information, wherein the header information includes header type and field segment location information;
[0025] A domain segment extraction module is configured to receive the original message and the header information, and extract the domain segment information from the original message according to the domain segment position information in the header information;
[0026] The domain segment cache module is configured to cache the domain segment information.
[0027] In a second aspect, an embodiment of the present invention provides a message parsing method, the message parsing method comprising:
[0028] Receive and parse the original message through a fixed parser;
[0029] In response to the fixed parser not completing the parsing of the original message, sending corresponding message parsing information to the programmable parser, the message parsing information including the parsed result and the message header of the original message;
[0030] The programmable parser performs message parsing according to the received parsed result and the message header to obtain the message parsing result.
[0031] In a third aspect, an embodiment of the present invention provides a message parsing device, the message parsing device comprising:
[0032] A first parsing unit is configured to receive and parse the original message through a fixed parser;
[0033] a second parsing unit, configured to send corresponding message parsing information to the programmable parser in response to the fixed parser not completing the parsing of the original message, the message parsing information including the parsed result and the message header of the original message;
[0034] The third parsing unit is configured to perform message parsing according to the received parsed result and the message header through a programmable parser to obtain a message parsing result.
[0035] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0036] In a fifth aspect, an embodiment of the present invention provides a computer program product, which, when executed on a computer, enables the computer to execute the method described above.
[0037] The message parsing system of the embodiment of the present invention includes a fixed parser and a programmable parser, the fixed parser is configured to receive and parse the original message, and in response to the message not being parsed, the message parsing information including the parsed result and the message header is sent to the programmable parser, and the programmable parser is configured to continue parsing the message according to the received parsed result and the message header to obtain the message parsing result. Therefore, the embodiment of the present invention can combine the fixed parser and the programmable parser, parse the message protocol that it can parse through the fixed parser, and parse the message protocol that the fixed parser cannot parse through the programmable parser, so that the message parsing system can meet the low latency requirements and flexibility requirements, while also reducing the system resource requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0039] Figure 1 is a schematic diagram of a message parsing system according to an embodiment of the present invention;
[0040] Figure 2 is a schematic diagram of a fixed parser according to an embodiment of the present invention;
[0041] Figure 3 is a schematic diagram of a header recognition module of a fixed parser in an embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of a parsing diagram of a fixed parser according to an embodiment of the present invention;
[0043] Figure 5 is a schematic diagram of a programmable parser according to an embodiment of the present invention;
[0044] Figure 6 is a schematic diagram of a message parsing process according to an embodiment of the present invention;
[0045] Figure 7-Figure 8 It is a schematic diagram of the packet rate and the performance requirements of the packet parsing system as a function of the packet length;
[0046] Fig. 9 is a flow chart of a message parsing method according to an embodiment of the present invention;
[0047] Fig.10 It is a schematic diagram of a message parsing device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The present application is described below based on embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, some specific details are described in detail. It is possible for those skilled in the art to fully understand the present application without the description of these details. In order to avoid confusing the essence of the present application, known methods, processes, flows, components and circuits are not described in detail.
[0049] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.
[0050] At the same time, it should be understood that in the following description, "circuit" refers to a conductive loop composed of at least one element or subcircuit through electrical connection or electromagnetic connection. When an element or circuit is said to be "connected to" another element or an element / circuit is said to be "connected between" two nodes, it can be directly coupled or connected to another element or there can be an intermediate element, and the connection between the elements can be physical, logical, or a combination thereof. On the contrary, when an element is said to be "directly coupled to" or "directly connected to" another element, it means that there is no intermediate element between the two.
[0051] Unless the context clearly requires otherwise, the words "include", "comprising" and similar words throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, the meaning is "including but not limited to".
[0052] In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more.
[0053] To facilitate understanding, technical terms that may be involved in the embodiments of the present invention are first explained.
[0054] SDN (Software-Defined Networking) is a network architecture approach that abstracts the network control layer from traditional network hardware devices (such as switches and routers), making network control a function that can be programmed and managed through software applications. The purpose of SDN is to improve the flexibility and programmability of the network, allowing network administrators to adapt to changing needs more quickly, simplify network configuration and management, and achieve automated and centralized network management. Through SDN, network policies and traffic management become more dynamic and customizable, thereby supporting the development of innovative technologies and applications such as cloud computing, data center virtualization, and mobile communications.
[0055] RDMA (Remote Direct Memory Access) is a computer network communication technology that allows a computer in a network to directly access the memory of another computer without going through the operating system to handle data transfer, thereby greatly improving the efficiency of data transfer and reducing latency and CPU usage.
[0056] TCAM (Ternary Content-Addressable Memory) is a special type of high-speed memory used to quickly match packet header information in network devices, such as implementing high-speed packet filtering, classification, and routing lookups in routers and switches. Unlike traditional RAM (Random Access Memory), which accesses data by address, TCAM allows the use of the data content itself as an access parameter. This means that when a query is made to the TCAM, it can query all stored entries in parallel and return the address of the data entry that matches the query. This makes TCAM suitable for applications that require fast lookup operations, such as network routing and switching. TCAM supports three-value logic: 0, 1, and X ("don't care" or wildcard). The wildcard X allows the TCAM to ignore certain bits when performing a match operation, which allows the TCAM to very efficiently support complex lookup and match operations, including those involving masks or subnets.
[0057] RoCEv2 (RDMA over Converged Ethernet version 2) is an extended version of the RoCE protocol that allows RDMA (Remote Direct Memory Access) data transfer to be implemented on the Ethernet layer. RoCEv1 is the first version of the protocol that relies on a specific type of Ethernet network, called a 'lossless' network, which eliminates the possibility of packet loss through mechanisms such as PFC (Priority Flow Control). RoCEv2 is an improvement on RoCEv1 that adds support for IP networks so that RDMA communication can be carried out on a wider range of standard Ethernet networks, including those that do not support PFC. RoCEv2 achieves this by encapsulating IP / UDP (User Datagram Protocol) headers before RDMA. In this way, RoCEv2 packets can be forwarded by standard Ethernet devices and routed through existing IP networks. This capability of RoCEv2 greatly expands the scope and flexibility of RDMA technology, allowing high-performance, low-latency data transmission in a variety of network topologies, especially suitable for data centers and high-performance computing environments.
[0058] VxLAN (Virtual Extensible LAN) is a network virtualization technology designed to solve the scalability problem in large cloud computing environments, especially when traditional VLAN (Virtual Local Area Network) only supports 4096 network identifiers. VxLAN uses encapsulation technology to enable the network to support up to 16 million virtual network identifiers (VNIs) on the existing IP network infrastructure, which greatly exceeds the limit of VLAN. It works between Layer 2 and Layer 3 of the OSI (Open Systems Interconnection) model, allowing the creation of overlay networks (Overlay Networks), also known as "tunnels", on the physical network to transparently transmit large amounts of virtualized traffic between servers in a data center or cloud environment. The working principle of VxLAN is mainly to encapsulate the original Ethernet frames, add VxLAN headers to their outside, and then encapsulate standard UDP / IP datagrams on the outside of this new header, so that the encapsulated data packets can be routed and forwarded in a regular IP network. When the data reaches the destination, the VxLAN header will be removed and the original Ethernet frame will be restored to the target virtual machine or host. VxLAN technology has greatly improved the scalability and flexibility of the network, and is very useful for implementing virtual network isolation, load balancing, multi-tenant environments, and other scenarios within or across data centers.
[0059] ASIC (Application-Specific Integrated Circuit) is an integrated circuit specially designed for a specific application or task. Compared with general-purpose integrated circuits, ASIC design is more efficient, has better performance, and can usually better meet the needs of that specific application.
[0060] The Transmission Control Protocol / Internet Protocol (TCP / IP) model is the basis of today's Internet Protocol (IP) network. According to the TCP / IP model, the entire data communication task can be divided into different functional layers, each layer corresponding to different functions and protocol types. It is understandable that when data is transmitted and / or processed at different layers, it is necessary to match the protocol type of the corresponding layer, and the data specified by different protocol types, including the location of specific fields, is different. Therefore, in order to be able to be transmitted and / or processed at different layers, the data needs to be able to match multiple different protocol types at the same time.
[0061] Data can be transmitted and processed in the form of a message. In order to match different protocol types, the message can be composed of multiple protocol headers and message data payloads. Among them, each of the multiple protocol headers corresponds to a protocol type of a layer. The protocol header may include multiple control fields, and the corresponding functions are implemented through these multiple control fields, such as extracting corresponding data from the message data payload. Furthermore, the multiple protocol headers included in the message can be parsed separately to obtain the protocol types corresponding to the multiple protocol headers and the offset of each protocol header in the message. Therefore, when it is necessary to extract the control field of a certain protocol type, the specific position of the required control field in the message is determined according to the offset of the protocol header of the corresponding protocol type for extraction, so that the transmission and processing of data in different layers can be realized.
[0062] Figure 1 Schematic diagram of a message parsing system according to an embodiment of the present invention. Figure 1 As shown, the message parsing system 1 of the embodiment of the present invention includes a fixed parser 11 and a programmable parser 12. The fixed parser 11 is configured to receive and parse the original message (i.e., the data packet Packet Data), and in response to the original message not being parsed, the message parsing information is sent to the programmable parser 12. The message parsing information includes the parsed result and the message header (PacketHeader) of the original message.
[0063] In this embodiment, the fixed parser 11 parses the received original message based on the configured parsing graph (Parse Graph). The parsing graph is a directed acyclic graph, in which each node represents a protocol type, and the lines between the nodes represent the sequence relationship between the two protocols, that is, the protocol type represented by the latter node may appear after the protocol type represented by the former node, and the protocol header corresponding to the former node contains a field (i.e., type field) indicating the protocol type corresponding to the next node. The parsing process of the parsing graph includes state jumps between nodes and extraction of key fields within nodes.
[0064] The message header is the starting part of the data packet, including the source address, destination address, port number and checksum, etc. It is used to help network devices identify the source, destination and how to process the data packet, and to control and manage data transmission information. The protocol header refers to the data packet header format defined by a specific network protocol to help network devices process data packets according to the protocol of that layer. For example, the IP protocol header contains IP address information, and the TCP protocol header contains port information and sequence number, etc.
[0065] Optionally, the fixed parser 11 receives the original message from the corresponding port and caches it, and parses the received original message based on the corresponding parsing graph. Since the protocol types that the fixed parser 11 can parse are generally fixed and limited, the fixed parser 11 may be able to completely parse the original message, or may only be able to parse part of the protocol in the original message. Further, based on the message type and the parsing graph of the fixed parser 11, it can be determined which type of message the fixed parser 11 can completely parse.
[0066] In this embodiment, if the fixed parser 11 cannot parse the original message or can only parse part of the protocol in the message header of the original message, the fixed parser 11 can send the message parsing information to the programmable parser 12, so that the programmable parser 12 continues to parse the message header of the original message based on the analysis of the fixed parser 11 to obtain the message parsing result of the original message.
[0067] Furthermore, if the fixed parser 11 can completely parse the original message, the parsing result of the parsed message is obtained.
[0068] Optionally, the message parsing result of the original message may include a protocol stack obtained by parsing. Further, the message parsing result may also include a protocol header sequence and / or an original message. The protocol stack includes relevant information of each layer protocol obtained by parsing.
[0069] In an optional implementation, the message parsing system 1 of the embodiment of the present invention further includes a buffer 13. The buffer 13 is configured to cache message parsing results sent by a fixed parser or a programmable parser.
[0070] In an optional implementation, if the original message is parsed by the fixed parser 11, the fixed parser 11 generates a message parsing result and sends the message parsing result to the buffer 13 for caching. Further, the fixed parser 11 can package and send the original message, the protocol stack obtained by parsing, the protocol header sequence, etc. in the message parsing result, or send them separately, which is not limited in this embodiment.
[0071] In an optional implementation, if the original message is parsed by the combination of the fixed parser 11 and the programmable parser 12, the fixed parser 11 can send the parsed result and the message header of the original message to the programmable parser 12 for further parsing, and send the original message to the buffer for caching. The programmable parser 12 removes the parsed protocol from the message header based on the received parsed result, continues to parse the unparsed protocol header, obtains the parsed protocol stack, and sends the parsed protocol stack to the buffer 13 for caching. In other optional implementations, the message parsing information sent by the fixed parser 11 to the programmable parser 12 may also include the original message. After completing the parsing of the message header of the original message, the programmable parser 12 sends the parsed protocol stack and the original message to the buffer for caching.
[0072] In an optional implementation, the buffer 13 includes a message buffer unit and a protocol stack buffer unit. The message buffer unit is used to buffer the original message, and the protocol stack buffer unit is used to buffer the protocol stack obtained by parsing. Further optionally, the protocol stack buffer unit can be implemented using RAM (Random Access Memory). It should be understood that this embodiment does not limit the memory for implementing the message buffer unit and the protocol stack buffer unit, and it only needs to be able to implement data caching.
[0073] Figure 2 Schematic diagram of a fixed parser in an embodiment of the present invention. Figure 2 As shown, the fixed parser 11 of the embodiment of the present invention includes a header recognition module 21, a domain segment extraction module 22 and a domain segment cache module 23. Among them, the header recognition module 21 is used to identify each header information in the original message. Specifically, the header recognition module 21 is configured to receive the original message, perform header recognition on the original message, obtain header information, and send the header information to the domain segment extraction module 22. Among them, the header information includes header types and domain segment location information. The domain segment extraction module 22 is configured to receive the original message and the header information sent by the header recognition module 21, and extract specific domain segment information from the original message based on the header information, such as IP address, port number, etc. The domain segment information is determined based on the corresponding header type. Furthermore, the domain segment extraction module 22 is used to locate the domain segment position of each domain segment information to be extracted based on the header information provided by the header identification module 21, and extract the information of the specific domain segment from the original message based on the domain segment position, and convert the extracted domain segment information into a usable format (for example, converting the IP address into a dotted decimal format, etc.) and then send it to the domain segment cache module 23 for caching.
[0074] Figure 3 is a schematic diagram of a header recognition module of a fixed parser in an embodiment of the present invention. Figure 4 Schematic diagram of a parsing diagram of a fixed parser according to an embodiment of the present invention. Figure 4 As shown, analysis Figure 4 It includes protocol nodes such as Ethernet, VLAN, IPv4, IPv6, Programmable L2 Type~N, UDP, TCP, Programmable L3 Type~M, RoCE v2, Programmable L4 Type~L, and lines representing jump relationships between protocol types. Figure 4 Fixed parsing acceleration is performed for RoCEv2 messages without VLAN protocol, with one VLAN protocol and with two VLAN protocols, TCP messages, programmable layer 2 messages, programmable layer 3 messages and programmable layer 4 messages. RoCEv2 messages are sensitive to latency, TCP messages are the most common messages, and programmable layer 2, layer 3 and layer 4 messages are mainly for periodically sent message types (such as ARP, RARP, PTP messages, etc.) and user-defined latency-sensitive message types. The software can customize the accelerated message types according to needs. It should be understood that this embodiment does not affect the parsing configured by the fixed parser 11. Figure 4 Restrictions are imposed, which can be configured according to specific application requirements and currently known parsing graphs.
[0075] like Figure 3 As shown, the head recognition module 21 of the fixed parser 11 of the embodiment of the present invention includes a cache unit 31, a parsing state machine 32, head processors 331-33n (n is greater than or equal to 1) and a sequence selection unit 34.
[0076] The cache unit 31 is configured to receive and cache the original message from the corresponding port (such as the MAC port, etc.). The parsing state machine 32 is configured to receive and cache the original message according to the pre-configured parsing diagram (such as Figure 4 The cache unit 31 is also configured to be controlled by the parsing state machine 32 to read the message header and distribute it to the corresponding header processor 33i (1≤i≤n) for processing. The header processor 33i is used to process the corresponding type of protocol header, and there are one or more header processors for processing the same protocol type. Multiple header processors 33i can process multiple original messages in parallel. The sequence selection unit 34 is used to select a matching protocol type from the output result of the header processor 33i and input it into the parsing state machine 32, so that the parsing state machine 32 determines the protocol type of the next layer jump according to the parsing diagram.
[0077] Specifically, the parsing state machine 32 is in an initial state when the message parsing starts, usually pointing to the starting position of the original message. The cache unit 31 reads the corresponding message header based on the starting position, and distributes the message header to the corresponding header processor 33i for processing the corresponding type of protocol header to obtain the header information. The header processor 33i outputs the obtained header information to the sequence selection unit 34, and the sequence selection unit 34 selects an appropriate parsing sequence or path according to the header information received from the header processor 33i, that is, selects a matching protocol type according to the received header information and inputs it into the parsing state machine 32, so that the parsing state machine 32 determines the protocol type of the next layer jump according to the parsing sequence determined by the sequence selection unit and the parsing diagram. The parsing state machine 32 sends the protocol type of the protocol layer jump and the location information of the original message to be read to the cache unit 31, so that the cache unit 31 obtains the corresponding header information based on the location information of the original message and distributes it to the header processor 33i that processes the corresponding protocol type.
[0078] Further, the header identification module 21 sends the header information obtained by parsing to the field segment extraction module 22. The field segment extraction module 22 extracts the corresponding field segment information from the original message according to the pre-configured field segment extraction table (Field extract Table), and caches the extracted field segment information to the field segment cache module 23. The field segment extraction table can be a configuration file or a data structure, which defines how to extract specific fields from the message header, including the position and length of each field segment and how to process these fields. Further, the field segment extraction table can include the field segment name (that is, the identifier of the field segment), the field segment position (that is, the starting position of the field segment in the message header (that is, the offset)), the field segment length (that is, the number of bytes or bits occupied by the field segment) and the processing logic (for example, whether the data format needs to be converted, etc.). Therefore, the field segment extraction module 22 of this embodiment can obtain the field segment information corresponding to the protocol based on the header information such as the protocol type identified by the field segment extraction table and the header identification module 21.
[0079] It should be understood that Figure 3 The fixed parser shown is merely exemplary, and any existing type of fixed parser or a fixed parser produced by future technological development may be applied to the embodiments of the present invention, and the specific structure of the fixed parser is not limited herein.
[0080] Furthermore, in this embodiment, the header recognition module 21, the domain segment extraction module 22 and the domain segment cache module 23 in the fixed parser 11 execute the above process in a loop until the original message parsing is completed or the original message cannot be parsed any further.
[0081] In this embodiment, when the fixed parser 11 cannot continue parsing after parsing some protocol types of the original message, the obtained message parsing information is sent to the programmable parser 12 for further parsing.
[0082] Figure 5 is a schematic diagram of a programmable parser according to an embodiment of the present invention. Figure 5 As shown, the programmable parser 12 of the embodiment of the present invention includes a parsing allocation unit 51, a header cache unit 52 and at least one parsing unit 53. The parsing allocation unit 51 is configured to receive at least one message parsing information sent by the fixed parser, and allocate a corresponding parsing unit to each message parsing information. The header cache unit 52 is configured to cache the message header information in each message parsing information. At least one parsing unit 53 is configured to parse the unparsed protocol header in the corresponding message header according to the received message parsing information. Optionally, multiple parsing units 53 can process different original messages synchronously.
[0083] Furthermore, if Figure 5 As shown, the parsing allocation unit 51 is used to receive the message parsing information of at least one original message sent by the fixed parser 11, and cache it in the header cache unit 52. In this embodiment, in response to receiving the message parsing information, the parsing allocation unit 51 queries the idle parsing unit 53, allocates the message parsing information to the corresponding idle parsing unit 53 for parsing, and updates the state of the parsing unit 53, that is, from the idle state to the busy state.
[0084] In an optional implementation, when some or all of the parsing units 53 share a header cache unit 52, a multiplexing unit MUX1 can be connected between the header cache unit 52 and the parsing unit 53 to achieve accurate transmission of information between the header cache unit 52 and multiple parsing units 53 by setting the multiplexing unit MUX1.
[0085] Further optionally, each parsing unit 53 has a corresponding storage area in the corresponding header cache unit 52. After being assigned a corresponding parsing task, the parsing unit 53 reads the next protocol header to be parsed from the corresponding storage area in the header cache unit 52 for parsing and extracts the field information in the protocol header. Optionally, the parsing unit 53 can read the required field information from the protocol header based on a pre-set field extraction rule. The pre-set field extraction rule is used to define which fields should be extracted, which can be set according to actual application requirements, and this embodiment does not limit this.
[0086] In an optional implementation, the programmable parser 12 further includes an addressing unit 54 to obtain corresponding address information by matching based on the field information parsed by the parsing unit 53. The addressing unit 54 may store a bit sequence for message header identification, which is used to identify the corresponding protocol type.
[0087] In an optional implementation, the parsing units 53 in the programmable parser 12 can share the same addressing unit 54, or can share multiple addressing units 54 (that is, multiple parsing units 53 can be grouped, and each group is configured with an addressing unit 54), or an addressing unit 54 can be configured for each parsing unit 53. This embodiment does not limit the number of addressing units 54, which can be configured according to actual application requirements.
[0088] Further optionally, when some or all of the parsing units 53 share one addressing unit 54, a multiplexing unit MUX2 may be connected between the addressing unit 54 and the parsing unit 53, so as to achieve accurate transmission of information between the addressing unit 54 and multiple parsing units 53 by setting the multiplexing unit MUX2.
[0089] In this embodiment, the parsing unit 53 sends the extracted field information to the addressing unit 54 for matching processing, so as to match and determine the protocol type corresponding to the field information based on the bit sequence stored therein. Optionally, the addressing unit 54 can be implemented using TCAM. The addressing unit 54 compares the field information obtained from the parsing unit 53 with the TCAM entry, and points to the corresponding protocol type when the match is successful. Among them, the TCAM entry includes a matching field, a mask, and a result pointer. The mask allows partial field matching, and the result pointer is used to point to the protocol type and / or action information corresponding to the next parsing state.
[0090] In an optional implementation, the programmable parser 12 also includes an action storage unit (e.g., ActionRAM) 55. The action storage unit 55 stores actions or protocol types associated with TCAM entries. After determining the matching item corresponding to the acquired field information, the addressing unit 54 determines a pointer to the corresponding position in the action storage unit. Among them, the actions stored in the action storage unit 55 may include domain segment extraction, arithmetic and / or logical operations, etc., and the protocols stored therein may include various types of protocols, such as specific protocols, user-defined protocols, or other known protocol types. This embodiment does not limit the protocol types or specific actions stored in the action storage unit 55, which can be configured according to actual application conditions. Further optionally, the action storage unit 55 also stores the domain segment extraction position and other information required for parsing, such as domain segment extraction tables, arithmetic, or related information of logical operations, etc.
[0091] In an optional implementation, the parsing units 53 in the programmable parser 12 can share the same action storage unit 55, or can share multiple action storage units 55 (that is, multiple parsing units 53 can be grouped, and each group is configured with an action storage unit 55), or an action storage unit 55 can be configured for each parsing unit 53. This embodiment does not limit the number of action storage units 55, which can be configured according to actual application requirements.
[0092] Further optionally, when some or all of the parsing units 53 share an action storage unit 55, a multiplexing unit MUX3 may be connected between the action storage unit 55 and the parsing unit 53 to achieve accurate transmission of information between the action storage unit 55 and multiple parsing units 53 by setting the multiplexing unit MUX3.
[0093] In an optional implementation, after determining the pointer pointing to the corresponding position in the action storage unit, the addressing unit 54 returns the pointer information to the corresponding parsing unit 53, and the corresponding parsing unit 53 obtains the corresponding protocol type, domain information or action information from the action storage unit 55 based on the pointer information. In another optional implementation, the addressing unit 54 sends the determined pointer information to the action storage unit 55, and the action storage unit 55 obtains the corresponding action information or protocol type based on the pointer information, extracts the relevant domain information based on the obtained protocol type and the domain extraction table, and returns the action information, protocol type or domain information to the corresponding parsing unit 53. This embodiment does not limit the connection relationship and information transmission process between the parsing unit 53, the addressing unit 54 and the action storage unit 55, and it can realize the corresponding functions. Further, the parsing unit 53 is also configured to parse the next unparsed protocol header obtained from the header cache unit according to the protocol type and / or corresponding action information returned by the action storage unit.
[0094] In an optional implementation, this embodiment may further include a processing unit 56 for receiving the action information sent by the parsing unit 53 , performing corresponding processing, and returning the processing result to the parsing unit 53 .
[0095] In an optional implementation, the parsing units 53 in the programmable parser 12 may share the same processing unit 56, or may share multiple processing units 56 (that is, multiple parsing units 53 may be grouped, and each group may be configured with a processing unit 56), or a processing unit 56 may be configured for each parsing unit 53. This embodiment does not limit the number of processing units 56, which may be configured according to actual application requirements.
[0096] Further optionally, when some or all of the parsing units 53 share a processing unit 56, a multiplexing unit MUX4 may be connected between the action storage unit 55 and the processing unit 56 to achieve accurate transmission of information between the processing unit 56 and multiple parsing units 53 by setting the multiplexing unit MUX4.
[0097] The parsing unit 53 continues to read the next protocol header to be parsed from the corresponding storage area in the header cache unit 52 based on the next parsing state determined by the action storage unit 55 until the corresponding message header parsing is completed, outputs the protocol stack obtained by the parsing to the cache 13 for caching, and sends a parsing completion feedback message to the parsing allocation unit 51, so that the parsing allocation unit 51 updates the state of the parsing unit 53, that is, from the busy state to the idle state.
[0098] It should be understood that Figure 5 The programmable parser 12 shown is merely exemplary, and any existing type of programmable parser or programmable parser produced by future technological development may be applied to the embodiments of the present invention, and the specific structure of the programmable parser is not limited herein.
[0099] Therefore, the embodiment of the present invention receives and parses the original message through a fixed parser, and in response to the message not being parsed, sends the message parsing information including the parsed result and the message header to the programmable parser, and the programmable parser continues to parse the message according to the received parsed result and the message header to obtain the message parsing result. The embodiment of the present invention can combine the fixed parser and the programmable parser, and parse the message protocol that the fixed parser can parse through the fixed parser, and parse the message protocol that the fixed parser cannot parse through the programmable parser, so that the message parsing system can meet the low latency requirements and flexibility requirements, while also reducing the system resource requirements.
[0100] Figure 6 FIG. 1 is a schematic diagram of a message parsing process according to an embodiment of the present invention. Figure 6 As shown, it is assumed that the original message d1 is parsed by the message parsing system of this embodiment. Among them, the original message d1 includes a message header h1 and a payload, and the message header h1 includes protocol headers t1-t4. The fixed parser 11 receives the original message d1 and parses the original message d1. Assuming that after the fixed parser 11 completes the parsing of the protocol header t2, it is unable to continue to parse the protocol header t3, and then sends the current message parsing information to the programmable parser 12. Among them, the current message parsing information may include the protocol stack [t1, t2] and the message header h1 parsed by the fixed parser 11. Among them, the protocol stack [t1, t2] includes the information of the protocol header t1 and the protocol header t2 obtained by parsing, such as the protocol type, protocol header offset, port, source address, destination address, and / or the corresponding action information to be performed.
[0101] After receiving the message parsing information sent by the fixed parser 11, the programmable parser 12 determines the location information of the protocol header that needs to be further parsed in the message header h1 based on the parsed result (that is, the protocol stack [t1, t2]). It should be understood that the location information can point to the initial position of the protocol header t3 or to the end position of the protocol header t2. The programmable parser 12 continues to parse the protocol header t3 and the protocol header t4 based on the location information, obtains the final message parsing result (for example, the protocol stack [t1, t2, t3, t4]), and sends the message parsing result of the original message d1 to the buffer 13 for caching. Further, the fixed parser 11 sends the original message d1 to the buffer 13 for caching.
[0102] Among them, the internal structure and parsing process of the fixed parser and the programmable parser are as described in the above embodiments and will not be repeated here.
[0103] Figure 7-Figure 8 This is a schematic diagram showing how packet rate and packet parsing system performance requirements change with packet length. Taking a single-port 200Gbps Ethernet as an example, the packet rate changes with packet length. Figure 7 As shown in the figure, the packet rate corresponding to the minimum packet length of 64 bytes is close to 300Mpps. Assuming that the average length of the Ethernet protocol header is 8 bytes and the maximum number of protocol layers is 16, the performance requirements of the message parsing system are as follows: Figure 8 As shown, the maximum performance requirement is close to 2800Mops.
[0104] Furthermore, assuming that the working clock frequency of the parsing unit in the programmable parser is 1 GHz and the single-layer protocol parsing cycle is 8 clock cycles, then if the processing capacity of each parsing unit is 125 Mops, a total of 23 parsing units are required. However, since the embodiment of the present invention adopts a combination of a fixed parser and a programmable parser to parse the message, the fixed parser can be used to parse the three- to four-layer protocol in the message, and the programmable parser can save three- to four-layer protocol parsing, and the parsing unit saving ratio is 3 / 16 to 4 / 16, which can save 5 parsing units.
[0105] For example, for tunnel messages such as VxLAN encapsulated in the UDP layer, the fixed parser can parse the outer layer protocol and push the parsed protocol stack to the programmable parser. The programmable parser removes the parsed protocol layer and starts parsing after the parsed protocol layer. Taking the VxLAN message as an example, the protocol header sequence is {MAC, VLAN, VLAN, IPv6, UDP, VxLAN, MAC, IPv4, UDP, PAYLOAD}. If the fixed parser can parse to the UDP layer, then after the fixed parser parses to the UDP layer, the protocol sequence {MAC, VLAN, VLAN, IPv6, UDP} and the protocol header offset sequence {0,14,18,22,62} can be pushed to the programmable parser. The programmable parser removes the 62-byte length of data and starts parsing from the UDP protocol header, which can save 4 rounds of parsing cycles for a total of 32 clock cycles. The programmable parser needs 40 clock cycles to parse the remaining 5 layers of protocols. Even if the fixed parsing delay, engine allocation delay, cache read and write delay are added, the overall delay of VxLAN message parsing is within 50 clock cycles. If only a programmable parser is used for VxLAN message parsing, at least 80 clock cycles are required. It can be seen that the embodiment of the present invention receives and parses the original message through a fixed parser, and in response to the message not being parsed, sends the message parsing information including the parsed result and the message header to the programmable parser, and the programmable parser continues to parse the message according to the received parsed result and message header to obtain the message parsing result. The embodiment of the present invention can combine a fixed parser with a programmable parser, parse the message protocol that it can parse through the fixed parser, and parse the message protocol that the fixed parser cannot parse through the programmable parser, so that the message parsing system can meet the low latency requirements and flexibility requirements, while also reducing the system resource requirements.
[0106] Fig. 9 FIG. 1 is a flow chart of a message parsing method according to an embodiment of the present invention. Fig. 9 As shown, the message parsing method of the embodiment of the present invention includes the following steps:
[0107] Step S110, receiving and parsing the original message through a fixed parser.
[0108] Step S120, in response to the fixed parser not completing the parsing of the original message, controlling to send the corresponding message parsing information to the programmable parser, wherein the message parsing information includes the parsed result and the message header of the original message.
[0109] In an optional implementation, in response to the fixed parser completing the parsing of the original message, a message parsing result is generated and the fixed parser is controlled to send the message parsing result to a corresponding buffer for caching.
[0110] Step S130, the programmable parser performs message parsing according to the received parsed result and the message header to obtain a message parsing result. Further optionally, the message parsing method of this embodiment further includes controlling the programmable parser to send the message parsing result to a corresponding buffer for caching.
[0111] Embodiments of the present invention Figure 1 The message parsing method of the message parsing system shown in FIG. Figure 1-Figure 6 The corresponding embodiments or implementations are similar and will not be described in detail here.
[0112] The embodiment of the present invention receives and parses the original message through a fixed parser, and in response to the message not being parsed, sends the message parsing information including the parsed result and the message header to the programmable parser, and the programmable parser continues to parse the message according to the received parsed result and the message header to obtain the message parsing result. The embodiment of the present invention can combine the fixed parser and the programmable parser, and parse the message protocol that the fixed parser can parse through the fixed parser, and parse the message protocol that the fixed parser cannot parse through the programmable parser, so that the message parsing system can meet the low latency requirements and flexibility requirements, while also reducing the system resource requirements.
[0113] Fig.10 Schematic diagram of a message parsing device according to an embodiment of the present invention. Fig.10 As shown, the message parsing device 10 according to the embodiment of the present invention includes a first parsing unit 101 , a second parsing unit 102 and a third parsing unit 103 .
[0114] The first parsing unit 101 is configured to receive and parse the original message through a fixed parser. The second parsing unit 102 is configured to send corresponding message parsing information to the programmable parser in response to the fixed parser not completing the parsing of the original message, wherein the message parsing information includes the parsed result and the message header of the original message. The third parsing unit 103 is configured to perform message parsing according to the received parsed result and the message header through the programmable parser to obtain the message parsing result.
[0115] In an optional implementation, the second parsing unit 102 is further configured to generate a message parsing result in response to the fixed parser completing the parsing of the original message and control the fixed parser to send the message parsing result to a corresponding buffer for caching.
[0116] In an optional implementation, the third parsing unit 103 is further configured to control the programmable parser to send the message parsing result to a corresponding buffer for caching.
[0117] The embodiment of the present invention receives and parses the original message through a fixed parser, and in response to the message not being parsed, sends the message parsing information including the parsed result and the message header to the programmable parser, and the programmable parser continues to parse the message according to the received parsed result and the message header to obtain the message parsing result. The embodiment of the present invention can combine the fixed parser and the programmable parser, and parse the message protocol that the fixed parser can parse through the fixed parser, and parse the message protocol that the fixed parser cannot parse through the programmable parser, so that the message parsing system can meet the low latency requirements and flexibility requirements, while also reducing the system resource requirements.
[0118] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.
[0119] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0120] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A message parsing system, characterized in that: The message parsing system comprises: The fixed parser is configured to receive and parse the original message, and in response to the original message not being parsed completely, send message parsing information to the programmable parser, wherein the message parsing information includes a parsed result and a message header of the original message; The programmable parser is configured to perform message parsing according to the received parsed result and the message header to obtain the message parsing result.
2. The message parsing system according to claim 1, characterized in that: The programmable parser is further configured to remove the parsed protocol header from the message header according to the parsed result to parse the unparsed protocol header in the message header.
3. The message parsing system according to claim 1, characterized in that: The message parsing system also includes: A cache is configured to cache the message parsing results sent by the fixed parser or the programmable parser.
4. The message parsing system according to claim 3, characterized in that: The fixed parser is configured to generate and send a message parsing result to the buffer in response to completion of message parsing.
5. The message parsing system according to claim 1, characterized in that: The programmable parser comprises: A parsing allocation unit, configured to receive at least one message parsing information sent by the fixed parser, and allocate a corresponding parsing unit to each message parsing information; A header cache unit, configured to cache the message header information in each of the message parsing information; At least one parsing unit is configured to parse the unparsed protocol header in the corresponding message header according to the received message parsing information.
6. The message parsing system according to claim 5, characterized in that: The programmable parser also includes: an addressing unit, configured to receive the field information obtained by the parsing unit, and perform a matching operation according to the field information to obtain a corresponding pointer, wherein the pointer is used to point to a protocol type corresponding to a next parsing state and / or action information corresponding to the field information; The action storage unit is configured to store the protocol type or action associated with the addressing unit, and obtain the protocol type and / or corresponding action information corresponding to the next parsing state according to the pointer determined by the addressing unit.
7. The message parsing system according to claim 6, characterized in that: The parsing unit is further configured to parse the next unparsed protocol header obtained from the header cache unit according to the protocol type and / or corresponding action information returned by the action storage unit.
8. The message parsing system according to claim 6, characterized in that: The programmable parser also includes: The processing unit is configured to perform corresponding actions according to the action information, and the actions include domain segment extraction, arithmetic and / or logical operations.
9. The message parsing system according to claim 5, characterized in that: The parsing unit is further configured to generate a message parsing result and a parsing completion feedback message in response to completion of the parsing of the original message, and send the parsing completion feedback message to the parsing allocation unit; The parsing allocation unit is further configured to update the state of the corresponding parsing unit to an idle state according to the parsing completion feedback message.
10. The message parsing system according to claim 1, characterized in that: The fixed parser includes: A header recognition module is configured to receive the original message, perform header recognition on the original message, and obtain header information, wherein the header information includes header type and field segment location information; A domain segment extraction module is configured to receive the original message and the header information, and extract the domain segment information from the original message according to the domain segment position information in the header information; The domain segment cache module is configured to cache the domain segment information.
11. A message parsing method, characterized in that: The message parsing method comprises: Receive and parse the original message through a fixed parser; In response to the fixed parser not completing the parsing of the original message, sending corresponding message parsing information to the programmable parser, the message parsing information including the parsed result and the message header of the original message; The programmable parser performs message parsing according to the received parsed result and the message header to obtain the message parsing result.
12. A message parsing device, characterized in that: The message parsing device comprises: A first parsing unit is configured to receive and parse the original message through a fixed parser; a second parsing unit, configured to send corresponding message parsing information to the programmable parser in response to the fixed parser not completing the parsing of the original message, the message parsing information including the parsed result and the message header of the original message; The third parsing unit is configured to perform message parsing according to the received parsed result and the message header through a programmable parser to obtain a message parsing result.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to claim 11 is implemented.
14. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to execute the method as claimed in claim 11 .
Citation Information
Patent Citations
Message processing method and device and storage medium
CN113872878A
Hybrid fixed / programmable header parser for network devices
CN115088239A
Hybrid analysis method and system of data packet
CN115633103A
Programmable message parsing basic processing unit and parsing device based on hierarchical protocol
CN117579721A
Packet processing method, programmable network card device, physical server, and storage medium
WO2024067336A1
Cited By
Message analysis device and method
CN119946168A
Network message analysis method and device, electronic equipment and storage medium
CN120751040A
Network message analysis device and chip
CN121728177A