Message processing method, network processing equipment and computer readable storage medium

By introducing the EFSM mechanism into the PISA architecture, the stateful pipeline processing of stateful messages is solved, and the P4 programming language in the prior art is unable to effectively process stateful messages, improving applicability and ability to support complex network applications.

CN119603309APending Publication Date: 2025-03-11ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311138864.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-04
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The programmable forwarding surface based on the P4 programming language in the prior art cannot effectively process and forward stateful packets, resulting in poor applicability and inability to support complex network applications.

Method used

By introducing an extended limited automata (EFSM) mechanism into the PISA architecture based on the P4 programming language, the processing and forwarding of stateful messages by a stateful pipeline is realized, and more complex network applications are supported.

Benefits of technology

It realizes effective processing and forwarding of stateful messages, improves the applicability of processing stateful messages, and supports more complex network applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119603309A_ABST
    Figure CN119603309A_ABST
Patent Text Reader

Abstract

The invention relates to a message processing method, network processing equipment and a computer readable storage medium, and the method comprises the steps: carrying out the state matching of a first message from first communication equipment based on a first stateful pipeline, and obtaining a target message; based on a second stateful assembly line, state matching is carried out on the target message to obtain a second message, and the first stateful assembly line and the second stateful assembly line both comprise stateful processing units used for processing stateful messages; and sending the second message to the second communication equipment. The problem of poor applicability caused by processing stateful messages by a programmable forwarding surface based on a P4 programming language in related technologies is at least solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a message processing method, a network processing device and a computer-readable storage medium. Background Art

[0002] At present, as stateful network functions become more and more common, data plane support for processing stateful messages has become a key research direction for various manufacturers. In the existing technology, the programmable forwarding plane based on the P4 (Programming Protocol-Independent Packet Processors, a high-level language for protocol-independent packet processors) programming language can only support the message forwarding of stateless or weak-state network services, and does not support the processing of transport layer protocols and stateful messages, and does not support complex network applications, and has poor applicability.

[0003] Therefore, how to improve the applicability of processing stateful messages has become an urgent problem to be solved. Summary of the invention

[0004] The present invention provides a message processing method, a network processing device and a computer-readable storage medium, which solve the problem in the related art that a programmable forwarding surface based on the P4 programming language has poor applicability in processing and forwarding stateful messages.

[0005] In a first aspect, the present invention provides a message processing method, the method comprising:

[0006] Based on a first stateful pipeline, a first message from a first communication device is state-matched to obtain a target message; based on a second stateful pipeline, a second message is state-matched to obtain the target message, and both the first stateful pipeline and the second stateful pipeline include a stateful processing unit for processing stateful messages; and the second message is sent to a second communication device.

[0007] The above-mentioned message processing method performs state matching on the received first message based on the first stateful pipeline, and performs state matching on the target message based on the second stateful pipeline. Since both the first stateful pipeline and the second stateful pipeline include stateful processing units for processing stateful messages, it is possible to process stateful messages using an architecture that supports stateful message processing, thereby solving the problem in the related art that the programmable forwarding surface based on the P4 programming language has poor applicability in processing and forwarding stateful messages, and can support more complex network applications, thereby improving the applicability of processing stateful messages.

[0008] In a second aspect, the present invention further provides a network processing device, which includes a processor and a memory; the memory is used to store programs; the processor is used to call the program in the memory to implement the message processing method as described above.

[0009] In a third aspect, the present invention further provides a computer-readable storage medium for readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the message processing method as described above.

[0010] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0012] Figure 1 is a hardware structure block diagram of a network processing device provided by an embodiment of the present invention;

[0013] Figure 2 It is a software structure block diagram of a network processing device provided by an embodiment of the present invention;

[0014] Figure 3 is a schematic diagram of a first stateful pipeline provided by an embodiment of the present invention;

[0015] Figure 4 is a schematic structural diagram of a matching-action component provided by an embodiment of the present invention;

[0016] Figure 5 is a schematic flow chart of a message processing method provided by an embodiment of the present invention;

[0017] Figure 6 It is a schematic flowchart of the sub-steps of state matching provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0019] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0020] It should be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0021] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0022] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0023] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no special meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.

[0024] The embodiments of the present invention provide a message processing method, a network processing device and a computer-readable storage medium. The message processing method can be applied to a network processing device, by matching the state of a received first message based on a first stateful pipeline, and matching the state of a target message based on a second stateful pipeline. Since both the first stateful pipeline and the second stateful pipeline include a stateful processing unit for processing stateful messages, it is possible to process stateful messages using a stateful message processing architecture, thereby solving the problem of poor applicability of programmable forwarding based on the P4 programming language in the related art for processing and forwarding stateful messages, supporting more complex network applications, and improving the applicability of processing stateful messages.

[0025] Exemplarily, the network processing device may include, but is not limited to, a programmable switch, a programmable router, an intelligent network card, and a DPU (Data Processing Unit) and other devices involved in Ethernet data plane forwarding.

[0026] In the embodiment of the present invention, the processing of stateful messages means that the processing behavior of the message received at the current time T0 depends on some states generated by the message received before the time T0, that is, the processing of the current message depends on the previous message. The processing of stateless messages means that the processing behavior of the message received at the current time T0 is only related to the current message and does not depend on the message before the time T0.

[0027] In some embodiments, the first stateful pipeline and the second stateful pipeline are pipelines that add extended finite automata to a protocol-independent switch architecture based on a programming language.

[0028] It should be noted that the programming language may be the P4 programming language, which is used to describe how the network processing device processes packets. The Protocol-Independent Switch Architecture (PISA) is an architecture that processes data packets at the highest speed under full program control of the user. Among them, the protocol-independent switch architecture based on the programming language can highly abstract the message forwarding process from a lower level, so that the network processing device has both the high performance of an Application Specific Integrated Circuit (ASIC) and the programmability of a Field-Programmable Gate Array (FPGA).

[0029] Since the P4 programming language is a weak-state programmable description method, although it can well describe the stateless or weak-state message forwarding process, it cannot describe a large number of stateful behaviors in the network, such as some behaviors of the transport layer. The embodiment of the present invention introduces an extended finite automaton (EFSM) mechanism in the PISA architecture based on the P4 programming language to realize the processing of stateful network behaviors, and at the same time abstracts part of the states in the transport layer protocol, such as timeout, retransmission, fragmentation and reassembly, etc., so that not only can the P4 programming language be used to describe the message forwarding behavior, but also can be used to describe the forwarding behavior of transport layer protocol messages such as TCP (Transmission Control Protocol), NDP (Neighbor Discovery Protocols, also known as Re-architecting data center networks and stacks for low latency and highperformance, a new transmission protocol designed for a data center network environment), HOMA, etc., and realize complex network functions such as stateful load balancing. This will enable network processing devices to have stronger network behavior description capabilities and stronger programmability to cope with emerging new network technologies. Among them, HOMA, also known as A Receiver-Driven Low-Latency Transport Protocol, is a low-latency transmission protocol driven by a receiver using network priority. NDP protocol, also known as Re-architecting data center networks and stacks for low latency and high performance, is a new transmission protocol designed for data center network environments.

[0030] It should be noted that the pipeline of Extended Finite State Machines (EFSM) added to the protocol-independent switch architecture based on programming languages ​​is referred to as a stateful pipeline. The Extended Finite State Machines are used to record the message state based on the flow and perform corresponding state jumps according to the received message.

[0031] See also Figure 1 , Figure 11 is a hardware structure block diagram of a network processing device 10 provided in an embodiment of the present invention. The network processing device 10 may include a processor 101 and a memory 102, wherein the processor 101 and the memory 102 may be connected via a communication bus, such as an Inter-integrated Circuit (I2C) bus or any other suitable communication bus.

[0032] The memory 102 may include a storage medium and an internal memory. The storage medium may store an operating system and a computer program. The computer program includes program instructions, which, when executed, may enable the processor to execute the message processing method described in any embodiment.

[0033] The processor 101 is used to provide computing and control capabilities to support the operation of the entire network processing device 10 .

[0034] The processor 101 may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other types of processors such as programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components. A general-purpose processor may be a microprocessor, or a general-purpose processor may be any conventional processor.

[0035] In one embodiment, the processor 101 is used to run a computer program stored in the memory 102 to implement the following steps:

[0036] Based on the first stateful pipeline, a first message from a first communication device is state-matched to obtain a target message; based on the second stateful pipeline, a second message is state-matched to obtain a second message, and both the first stateful pipeline and the second stateful pipeline include a stateful processing unit for processing stateful messages; and the second message is sent to the second communication device.

[0037] In one embodiment, when the processor 101 performs state matching on the first message based on the first stateful pipeline to obtain the target message, it is configured to implement:

[0038] The first message is parsed to obtain the payload information and the initial message header vector of the first message; the initial message header vector is state matched to obtain the first message header vector; the first message header vector is reassembled to obtain the target message header vector; the target message header vector is combined with the payload information to obtain the initial message; and the target message is generated according to the initial message.

[0039] In one embodiment, when the processor 101 performs state matching on the initial message header vector to obtain the first message header vector, it is configured to implement:

[0040] Information is extracted from the initial message header vector to obtain first key value information and second key value information; action matching is performed according to the first key value information to obtain a first action instruction; action matching is performed according to the second key value information to obtain a second action instruction; action processing is performed on the initial message header vector according to the first action instruction and the second action instruction to obtain a first message header vector.

[0041] In one embodiment, when the processor 101 performs action matching according to the first key value information to obtain the first action instruction, it is configured to implement:

[0042] A preset action instruction table is queried, and a first action instruction is determined according to the action instruction corresponding to the first key value information.

[0043] In one embodiment, the stateful processing unit includes a three-state memory addressing storage table and an instruction memory; when the processor 101 performs action matching according to the second key value information and obtains the second action instruction, it is used to implement:

[0044] Determine the state judgment condition corresponding to the second key value information; determine the third key value information according to the second key value information and the state judgment condition; and determine the second action instruction according to the third key value information based on the three-state memory addressing storage table and the instruction memory.

[0045] In one embodiment, the stateful processing unit further includes a shared memory; when the processor 101 implements the state judgment condition corresponding to the second key value information, it is used to implement:

[0046] The current state variable value in the shared memory is obtained; and the state variable value is compared with the second key value information to obtain the state judgment condition.

[0047] In one embodiment, when the processor 101 determines the second action instruction according to the third key value information based on the ternary memory addressing storage table and the instruction memory, it is used to implement:

[0048] According to the third key value information, the three-state memory addressing storage table is queried to obtain the instruction storage address; according to the instruction storage address, the instruction memory is queried to obtain at least one action instruction; the instruction operation object corresponding to each action instruction is determined, and according to the action instruction whose instruction operation object is the message header vector, the second action instruction is determined.

[0049] In one embodiment, when the processor 101 generates a target message according to an initial message, it is configured to implement:

[0050] If the initial message is a non-fragmented message, the initial message is sent to the preset traffic management unit so that the traffic management unit generates a target message based on the initial message; if the initial message is a fragmented message and the fragmented message of the initial message has not been transmitted for a timeout, the initial message is sent to the traffic management unit so that the traffic management unit generates a target message based on the initial message; if the initial message is a fragmented message and the fragmented message transmission of the initial message has timed out, the initial message is retransmitted as a fragmented message, and when the fragmented message retransmission is completed, the initial message is sent to the traffic management unit so that the traffic management unit generates a target message based on the initial message.

[0051] In one embodiment, when implementing fragment message retransmission of an initial message, the processor 101 is configured to implement:

[0052] Determine the fragment message information to be retransmitted and generate a retransmission instruction message; generate a message retransmission message according to the fragment message information and the retransmission instruction message; and send the message retransmission message to the first communication device.

[0053] See also Figure 2 , Figure 2 1 is a software structure diagram of a network processing device provided by an embodiment of the present invention. Figure 2 As shown, in order to realize the programmable forwarding plane, the network processing device may include a first stateful pipeline 201, a message fragmentation reassembly unit 202, an inbound timer 203, a programmable congestion control unit 204, a traffic management unit 205, a message fragmentation retransmission unit 206, a message generation unit 207, an outbound timer 208, a sending arbitration unit 209 and a second stateful pipeline 210. Among them, the first stateful pipeline 201, the programmable congestion control unit 204, the message generation unit 207 and the second stateful pipeline 210 are programmable components, and the P4 programming language, C language or other domain-specific languages ​​can be used to redefine, compile and dynamically update the programmable components. The remaining components are fixed function modules, and the functions cannot be changed during use after the function definition is completed. The following will be Figure 2 The functions of each unit in are described below.

[0054] The first stateful pipeline 201, i.e., the inbound stateful PISA pipeline, adds the function of stateful processing based on the standard stateless PISA pipeline based on the P4 programming language. In addition to being able to perform message matching-action operations, it can also record the message state based on the flow and perform corresponding state jumps according to the received message. The first stateful pipeline 201 can also output the modified message and related metadata, generate a fragmentation reassembly event and send it to the message fragmentation reassembly unit module 202. The first stateful pipeline 201 can also send a reception timing start message to the inbound timer 203, so that the inbound timer 203 starts the inbound timeout detection.

[0055] Message fragmentation and reassembly unit 202: According to the granularity of the flow and the fragmentation information according to the protocol, the modified message output by the first stateful pipeline 201 and the related metadata are cached in the cache of the message fragmentation and reassembly unit 202. If all the fragmented messages arrive within the timing time set by the inbound timer 203, the message fragmentation and reassembly unit 202 sends the collected fragmented messages to the traffic management unit 205 for further processing; if there is a fragmented message timeout during the receiving process, the message fragmentation and reassembly unit 202 generates a reception timeout event message and notifies the programmable congestion control unit 204, and at the same time, the congestion control information in the metadata, such as RTT (Round-Trip Time, round trip delay), etc., is transparently transmitted to the programmable congestion control unit 204 as a control basis for congestion control.

[0056] Inbound timer 203: generates a timer with flow granularity according to the inbound timing event. When the timeout condition of a certain flow is met, a timeout event message is generated and sent to the message fragmentation reassembly unit 202.

[0057] Programmable congestion control unit 204: Based on the congestion control information transmitted by the message fragmentation and reassembly unit 202, it completes the calculation of outbound congestion control parameters according to the congestion control algorithm defined by user programming, and transmits the congestion control parameters to the message fragmentation and retransmission unit 206 in the form of event messages and metadata.

[0058] Traffic management unit 205: performs buffering, flow control, shaping, packet loss, forwarding, etc. on the message data according to the outgoing port, priority, QoS (Quality of Service) parameter, message type, remote memory address, etc. of the incoming message data. The traffic management unit 205 can send messages generated by other message processing units (such as messages generated by the CPU) to the second stateful pipeline 210, and can also send incoming reassembled messages to the second stateful pipeline 205 or other message processing units.

[0059] The message fragment retransmission unit 206 receives the message sent by the traffic management unit 205, controls the fragment size, quantity and rate of the message to be sent according to the fragment threshold set by the user and the congestion control parameters transmitted by the programmable congestion control unit 204, and sends a timing event message to the outgoing timer 208 with the flow as the granularity. When the control message transmitted from the first stateful pipeline 201 is within the timing, it is sent successfully and recorded; if the sent message encounters a packet loss and other situations, resulting in a sending timeout event, the message fragment retransmission unit 206 starts the retransmission of the lost packet fragment according to the sending record.

[0060] The message generation unit 207 receives metadata and event messages generated by the programmable congestion control unit 204 and generates user-defined messages, most of which are control messages, such as ACK messages of certain protocols, delay measurement messages, etc.

[0061] Outgoing timer 208: responds to the outgoing timing event generated by the message fragment retransmission unit 206, and sends a timeout event of a certain flow to the message fragment retransmission unit 206 according to the timeout time set by the user.

[0062] The sending arbitration unit 209 performs sending arbitration on the messages according to the priorities of the arriving messages, and determines the order of the messages sent to the second stateful pipeline 210 .

[0063] The second stateful pipeline 210, i.e., the outbound stateful PISA pipeline, adds stateful processing functionality to the standard stateless PISA pipeline based on the P4 programming language. In addition to being able to perform message matching-action operations, it can also record flow-based message states and perform corresponding state jumps based on the sent messages.

[0064] It should be noted that the message processing method provided by the embodiment of the present invention is suitable for implementation using hardware (FPGA or ASIC), which can break through the bottleneck of the current processor and its memory access performance limitations, and can achieve a programmable forwarding plane with high throughput and low processing delay. In addition, the programmable forwarding plane implemented by the message processing method provided by the embodiment of the present invention contains a large number of programmable components, and users can use enhanced P4 programming language, C language or other field-customized languages ​​to program the programmable components. And it adopts a stateful message processing architecture to improve flexibility and support more complex network applications in the future.

[0065] In the embodiment of the present invention, the structure of the first stateful pipeline 201 is the same as the structure of the second stateful pipeline 210. For the convenience of description, the first stateful pipeline 201 is taken as an example for description.

[0066] See also Figure 3 , Figure 3FIG. 2 is a schematic diagram of a first stateful pipeline 201 provided in an embodiment of the present invention. Figure 3 As shown, the first stateful pipeline 201 includes a message parser 2010, at least one match-action component 2011, and a message inverse parser 2012, and each match-action component 2011 may include a stateless processing unit and a stateful processing unit.

[0067] The message parser 2010 is used to parse the message to obtain the payload information and the message header vector (Packet Header Vector, PHV) of the message. The message header vector may include a stateless message header vector and a stateful message header vector.

[0068] The stateless processing unit in the match-action component 2011 is used to process the stateless message header vector. The stateful processing unit in the match-action component 2011 is used to process the stateful message header vector.

[0069] The message inverse parser 2012 is used to reassemble the message header vector output by the matching-action component 2011, and combine the message after the message header reassembly with the payload information.

[0070] See also Figure 4 , Figure 4 2 is a schematic structural diagram of a matching-action component 2011 provided in an embodiment of the present invention. Figure 4 As shown, the match-action component 2011 may include a key value extraction unit 301, a stateless processing unit 302, a stateful processing unit 303, and a stateless arithmetic logic unit 304. The stateful processing unit 303 may include an EFSM state transfer unit 3031, a shared memory 3032, a condition judgment unit 3033, a stateful processing arithmetic logic unit 3034, and a processing command generation unit 3035. Figure 4 The functions of each unit in are described below.

[0071] The key value extraction unit 301 extracts the first key value information corresponding to the stateless processing unit 302 and the second key value information corresponding to the stateful processing unit 303 from the message header vector according to the user programming instruction. The first key value information may include the message header field and metadata, and the second key value information may include the stateful processed message header vector.

[0072] The stateless processing unit 302 performs action matching according to the first key value information. For example, the user-defined action instruction table can be queried based on ternary matching, longest matching or exact matching to obtain the first action instruction. The stateless processing unit 302 is the core module for executing the matching-action component 2011; after obtaining the first action instruction, the first action instruction is passed to the stateless arithmetic logic unit 304.

[0073] The stateless arithmetic logic unit 304 performs arithmetic and / or logic operations on the message header field according to the first action instruction, such as addition, subtraction, and assignment operations.

[0074] EFSM state transfer unit 3031: The EFSM state transfer unit 3031 includes a ternary content addressable memory (TCAM) table and an instruction memory. The EFSM state transfer unit 3031 is used to query the TCAM table according to the second key value information and the state judgment condition combination to form a table lookup key value to obtain a series of action instructions for the next state jump. The action instructions may include the next state, the relevant state variable update value, the location of the write-back shared memory 3032, and the message header vector modification instruction. The instruction memory is used to store the action instructions.

[0075] Shared memory 3032: used to store state variable values ​​defined by user programming, such as TCP (Transmission Control Protocol) link establishment state, RDMA (Remote Direct Memory Access) receiving state, etc.

[0076] Conditional judgment unit 3033: uses the second key value information as judgment data, compares it with the state variable value in the shared memory 3032, and uses the judgment result as the input of the EFSM state transfer unit. Conditional judgment unit 3033 supports if-else type conditional judgment syntax mapping.

[0077] Stateful processing arithmetic logic unit 3034: only processes the state variable value defined by the user, and does not process the message header vector. Compared with the stateless arithmetic logic unit 304, it supports more operation codes, such as fixed-point and floating-point calculations, and supports memory load and store instructions.

[0078] The processing command generating unit 3035 extracts the instructions related to the message header vector from the action instructions generated by the query of the EFSM state transfer unit to obtain a second action instruction. The processing command generating unit 3035 can also convert the second action instruction into a format required by the stateless arithmetic logic unit 304, so that the stateless arithmetic logic unit 304 can combine the second action instruction after the format conversion with the first action instruction for execution.

[0079] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. The following embodiments and features of the embodiments can be combined with each other without conflict. Figure 5 , Figure 5 FIG. 1 is a schematic flow chart of a message processing method provided by an embodiment of the present invention. Figure 5 As shown, the message processing method includes steps S401 to S403.

[0080] Step S401: Based on a first stateful pipeline, a first message from a first communication device is state matched to obtain a target message.

[0081] It should be noted that state matching refers to executing different action instructions according to the state type of the message. For example, for a stateful message, a corresponding state jump can be performed based on the message state of the flow and according to the received stateful message. For example, for a stateless message, a corresponding arithmetic and / or logical operation can be directly performed on the stateless message.

[0082] For example, in a message receiving scenario, the network processing device can perform state matching on the first message from the first communication device based on the first stateful pipeline to obtain the target message. Figure 3 and Figure 4 The following will be combined with Figures 2 to 4 , the process of state matching for the first message is described in detail.

[0083] See also Figure 6 , Figure 6 FIG. 1 is a schematic flow chart of the sub-steps of state matching provided by an embodiment of the present invention. Figure 6 As shown, in step S401, based on the first stateful pipeline, state matching is performed on the first message from the first communication device, which may include the following steps S4011 to S4015.

[0084] Step S4011: parse the first message to obtain payload information and an initial message header vector of the first message.

[0085] For example, Figure 3As shown, the first message can be parsed by the message parser 2010 to obtain the payload information and the initial message header vector of the first message. The specific parsing process is not limited here.

[0086] Step S4012: Perform state matching on the initial message header vector to obtain a first message header vector.

[0087] After the initial message header vector is obtained, state matching may be performed on the initial message header vector to obtain a first message header vector.

[0088] For example, Figure 3 As shown, each matching-action component 2011 can sequentially perform state matching on the initial message header vector to obtain the first message header vector. For ease of description, one matching-action component will be taken as an example to illustrate how to perform state matching.

[0089] In some embodiments, performing state matching on the initial message header vector to obtain a first message header vector may include: extracting information on the initial message header vector to obtain first key value information and second key value information; performing action matching based on the first key value information to obtain a first action instruction; performing action matching based on the second key value information to obtain a second action instruction; performing action processing on the initial message header vector according to the first action instruction and the second action instruction to obtain the first message header vector.

[0090] For example, Figure 3 and Figure 4 As shown, the key value extraction unit 301 can extract the first key value information and the second key value information from the message header vector. After obtaining the first key value information and the second key value information, the stateless processing unit 302 can perform action matching according to the first key value information to obtain a first action instruction. The stateless arithmetic logic unit 304 performs action processing on the initial message header vector according to the first action instruction and the second action instruction to obtain a first message header vector, and transmits the first message header vector to the next matching-action component 2011 or the message inverse parser 2012.

[0091] In the above embodiment, by extracting information from the initial message header vector, performing action matching according to the first key value information to obtain a first action instruction, performing action matching according to the second key value information to obtain a second action instruction, and performing action processing on the initial message header vector according to the first action instruction and the second action instruction, stateful matching-action processing of the message header vector can be achieved.

[0092] In some embodiments, performing action matching according to the first key value information to obtain the first action instruction may include: querying a preset action instruction table, and determining the first action instruction according to the action instruction corresponding to the first key value information.

[0093] It should be noted that the preset action instruction table may be predefined, and the action instruction table may include a correspondence between key value information and action instructions.

[0094] Exemplarily, the action instruction table may be searched according to the first key value information, and the action instruction corresponding to the first key value information may be determined as the first action instruction. The first action instruction may include but is not limited to instructions such as addition, subtraction or assignment.

[0095] In the above embodiment, by querying a preset action instruction table according to the first key value information, a first action instruction for stateless processing can be obtained, and subsequently a stateless arithmetic and / or logic operations can be performed on the message header vector according to the first action instruction through the stateless arithmetic logic unit.

[0096] like Figure 4 As shown, the stateful processing unit 303 includes a three-state memory addressing storage table and an instruction memory, wherein the three-state memory addressing storage table and the instruction memory are set in the EFSM state transfer unit 3031.

[0097] In some embodiments, performing action matching according to the second key value information to obtain a second action instruction may include: determining a state judgment condition corresponding to the second key value information; determining the third key value information according to the second key value information and the state judgment condition; and determining the second action instruction according to the third key value information based on a three-state memory addressing storage table and an instruction memory.

[0098] Determining the state judgment condition corresponding to the second key value information may include: acquiring the current state variable value in the shared memory; and comparing the second key value information with the state variable value to obtain the state judgment condition.

[0099] For example, Figure 4 As shown, the condition judgment unit 3033 can obtain the current state variable value in the shared memory 3032, compare the current state variable value with the second key value information, and obtain the state judgment condition corresponding to the second key value information. The state judgment condition may include the size relationship between the current state variable value and the second key value information.

[0100] By acquiring the current state variable value in the shared memory, the state variable value can be compared with the second key value information to obtain the state judgment condition.

[0101] Exemplarily, after determining the state judgment condition corresponding to the second key value information, the third key value information may be generated according to the second key value information and the state judgment condition. For example, the second key value information and the state judgment condition may be combined to obtain the third key value information. The specific combination method is not limited here.

[0102] In the embodiment of the present invention, after obtaining the third key value information, the EFSM state transfer unit can be queried according to the third key value information to obtain the second action instruction for stateful processing. How to determine the second action instruction will be described in detail below.

[0103] In some embodiments, based on the ternary memory addressing storage table and the instruction memory, determining the second action instruction according to the third key value information may include: querying the ternary memory addressing storage table according to the third key value information to obtain the instruction storage address; querying the instruction memory according to the instruction storage address to obtain at least one action instruction; determining the instruction operation object corresponding to each action instruction, and determining the second action instruction according to the action instruction whose instruction operation object is the message header vector.

[0104] For example, Figure 4 As shown, the TCAM table can be queried according to the third key value information to obtain the instruction storage address; then the instruction memory can be queried according to the instruction storage address to obtain at least one action instruction. Among them, the instruction operation object corresponding to each action instruction obtained may be different. In an embodiment of the present invention, the instruction operation object can be a state variable value or a message header vector.

[0105] Exemplarily, the instruction operation object corresponding to each action instruction can be determined, and the second action instruction can be determined according to the action instruction whose instruction operation object is the message header vector. It should be noted that, since the stateful processing arithmetic logic unit only processes the state variable value defined by the user and does not process the message header vector, only the action instruction whose instruction operation object is the message header vector can be determined as the second action instruction.

[0106] For example, Figure 4 As shown, after obtaining the second action instruction, the processing command generation unit 3035 can also convert the second action instruction into the format required by the stateless arithmetic logic unit 304, and the second action instruction after format conversion is provided for the stateless arithmetic logic unit 304 to combine the second action instruction after format conversion with the first action instruction for execution.

[0107] In the above embodiment, by addressing the storage table and the instruction memory based on the ternary memory, the second action instruction for performing the stateful processing can be accurately and quickly determined according to the third key value information.

[0108] Step S4013: reorganize the first message header vector to obtain a target message header vector.

[0109] For example, Figure 3 and Figure 4 As shown, the first message header vector enters the message inverse parser 2012 after being modified by the matching-action units 2011 of all levels in the first stateful pipeline 201. The message inverse parser 2012 reassembles the first message header vector according to the message header reassembly instruction defined by the user program to obtain the target message header vector. The message header reassembly instruction may include but is not limited to adding a field, deleting a field, replacing a field, etc.

[0110] Step S4014: Combine the target message header vector and the payload information to obtain an initial message.

[0111] For example, Figures 2 to 3 As shown, after obtaining the target message header vector, the message inverse parser 2012 combines the target message header vector with the payload information to obtain the initial message. Then the message inverse parser 2012 sends the initial message to the message fragmentation and reassembly unit 202.

[0112] Step S4015: Generate a target message according to the initial message.

[0113] It should be noted that, in the embodiment of the present invention, when generating a target message according to an initial message, it is also necessary to determine whether the initial message is a fragment message and whether the fragment message has timed out. If the initial message is a fragment message and the transmission has timed out, the fragment message needs to be retransmitted. How to generate a target message according to an initial message is described in detail below.

[0114] In some embodiments, generating a target message based on an initial message may include: if the initial message is a non-fragmented message, sending the initial message to a preset traffic management unit so that the traffic management unit generates a target message based on the initial message; if the initial message is a fragmented message and the fragmented messages of the initial message have not timed out, sending the initial message to the traffic management unit so that the traffic management unit generates a target message based on the initial message; if the initial message is a fragmented message and the fragmented message transmission of the initial message has timed out, retransmitting the initial message as a fragmented message, and when the fragmented message retransmission is completed, sending the initial message to the traffic management unit so that the traffic management unit generates a target message based on the initial message.

[0115] For example, Figure 2As shown, the message fragmentation and reassembly unit 202 can determine whether the initial message is a fragmented message according to the fragmentation information; if the initial message is a non-fragmented message, the initial message is sent to the traffic management unit 205, so that the traffic management unit 205 generates a target message according to the initial message. If the initial message is a non-fragmented message and the timeout event message of the inbound timer 203 is not received, the initial message is sent to the traffic management unit 205, so that the traffic management unit 205 generates a target message according to the initial message. If the initial message is a fragmented message and the timeout event message of the inbound timer 203 is received, the initial message is retransmitted as a fragmented message, and when the retransmission of the fragmented message is completed, the initial message is sent to the traffic management unit 205, so that the traffic management unit 505 generates a target message according to the initial message.

[0116] In some embodiments, retransmitting the initial message as fragmented messages may include: determining information of the fragmented messages to be retransmitted and generating a retransmission instruction message; generating a message retransmission message based on the fragmented message information and the retransmission instruction message; and sending the message retransmission message to the first communication device.

[0117] For example, Figure 2 As shown, when retransmitting the initial message as fragmented messages, the message fragment reassembly unit 202 may send congestion control information to the programmable congestion control unit 204. The programmable congestion control unit 204 calculates the congestion control parameter according to the user control information, and sends the congestion control parameter to the message fragment retransmission unit 206 and the message generation unit 207. The message fragment retransmission unit 206 may determine the fragmented message information to be retransmitted according to the congestion control parameter, and the message generation unit 207 may generate a retransmission instruction message according to the congestion control parameter.

[0118] It should be noted that the fragment message information is used to determine the fragment messages that need to be retransmitted, and the retransmission instruction message is used to instruct the first communication device to retransmit according to the fragment message information.

[0119] Exemplarily, after determining the fragment message information to be retransmitted and generating the retransmission instruction message, a message retransmission message may be generated according to the fragment message information and the retransmission instruction message, and the message retransmission message may be sent to the first communication device. Figure 2 As shown, the message retransmission message can be sent to the first communication device through the second stateful pipeline.

[0120] The above embodiment determines the fragment message information to be retransmitted, generates a retransmission instruction message, generates a message retransmission message according to the fragment message information and the retransmission instruction message, and sends the message retransmission message to the first communication device, thereby instructing the first communication device to retransmit the lost fragment message.

[0121] Step S402: Based on the second stateful pipeline, state matching is performed on the target message to obtain a second message. Both the first stateful pipeline and the second stateful pipeline include a stateful processing unit for processing stateful messages.

[0122] It should be noted that if Figure 2 As shown, in the message sending scenario, after the traffic management unit 205 generates the target message based on the initial message of the message fragmentation reassembly unit 202, it can pass the target message to the message fragmentation retransmission unit 206, and the message fragmentation retransmission unit 206 passes the target message to the second stateful pipeline 210 through the sending arbitration unit 209.

[0123] In some embodiments, the target message may be state matched based on the second stateful pipeline to obtain the second message. The specific process of state matching the target message is similar to the state matching of the first message, and will not be described in detail here.

[0124] Step S403: Send a second message to the second communication device.

[0125] Exemplarily, after the state of the target message is matched based on the second stateful pipeline to obtain the second message, the second message may be sent to the second communication device. The specific sending process is not limited here.

[0126] In the above embodiment, state matching is performed on the first received message based on the first stateful pipeline, and state matching is performed on the target message based on the second stateful pipeline. Since both the first stateful pipeline and the second stateful pipeline include a stateful processing unit for processing stateful messages, it is possible to process stateful messages using an architecture that supports stateful message processing, thereby solving the problem in the related art that a programmable forwarding surface based on the P4 programming language has poor applicability in processing and forwarding stateful messages, and can support more complex network applications, thereby improving the applicability of processing stateful messages.

[0127] The following will be combined Figures 2 to 4 , illustrating the processing flow of an incoming message (ie, a first message). The processing flow of an incoming message includes steps 501 to 507.

[0128] Step 501, the incoming message enters the message parser 2010 in the first stateful pipeline 201, and the message parser 2010 extracts the message header vector of the incoming message according to the functions implemented by the user using the P4 programming language or other domain-specific languages. For example, the destination MAC address and source MAU address of the Ethernet message; the IP address or port number of the IP message and other information. The payload information of the incoming message enters the cache of the message reverse parser 2012 for temporary storage for subsequent use.

[0129] Step 502, the message header vector enters the matching-action unit 2011 at each level. The matching-action unit 2011 modifies the message header vector according to the user's programming instructions and the configured EFSM state transfer unit. At the same time, the state variables defined by the user programming are recorded according to the value of the message header vector, and are updated according to some conditions and saved in the shared memory 3032 for subsequent message status updates.

[0130] Step 503, the message header vector enters the message inverse parser 2012 after being modified by the matching-action unit 2011 of all levels in the first stateful pipeline 201, and reassembles the message header according to the message header reassembly instructions (three operations of adding, deleting, and replacing fields) defined by the user programming, and then combines the payload information temporarily stored in the message inverse parser 2012 with the newly generated message header and sends it to the message fragment reassembly unit 202.

[0131] Step 504: The message deparser 2012 sends a flow-based timing request event message to the inbound timer 203 according to the information in the metadata of the message, so as to start the inbound timer 203 to start timing.

[0132] Step 505, the message fragmentation and reassembly unit 202 judges the incoming message and the metadata and event message carried. If the incoming message is a non-fragmented message, the incoming message is directly transparently transmitted to the traffic management unit 205 for subsequent forwarding processing. If the incoming message is a fragmented message, the payload of the fragmented message is extracted, stored in a stream-based buffer according to the fragmentation information (payload length, fragment ID or sequence number, etc.), and the number and sequence number of all fragments are recorded to determine whether all fragmented messages have been received. If all fragmented messages have been received within the time range set by the incoming timer 203, all contents are sent to the traffic management unit 205 for subsequent forwarding processing. If the incoming timer 203 has timed out, it is confirmed that there is a situation where the fragmented message is lost. At this time, it is necessary to clear the receiving cache of the message fragmentation and reassembly unit 202 according to the user's settings, and send a message generation event of timeout retransmission or related packet loss information to the programmable congestion control unit 204.

[0133] Step 506 , the programmable congestion control unit 204 receives the congestion control information generated by the message fragmentation and reassembly unit 202 , calculates congestion control parameters according to the congestion control algorithm programmed by the user, and sends a congestion and control message generation event to the message generation unit 207 .

[0134] Step 507, after the traffic management unit 205 receives the incoming message or the payload information of the inbound message, it performs traffic priority sorting, shaping, flow control, etc. on the inbound message or the payload information according to the QoS information and event message in the metadata carried by the inbound message, and sends the inbound message or the payload information to the outbound processing flow or other processing flow (such as the central processing unit or the graphics processing unit) according to the agreement of the destination port.

[0135] The following will be combined Figures 2 to 4 , illustrating the processing flow of outgoing messages. The processing flow of outgoing messages includes steps 601 to 604.

[0136] Step 601, the message fragmentation retransmission unit 206 determines the outgoing message or the payload information of the outgoing message and the corresponding metadata sent by the traffic management unit 205. If the outgoing message or the payload information does not need to be fragmented, the outgoing message or the payload information and the metadata carried by it are directly sent to the sending arbitration unit 209 for subsequent processing. If fragmentation is required (for example, the Ethernet message length exceeds the preset MTU (Maximum Transmission Unit) limit, or the TCP payload exceeds the preset MSS (Maximum Segment Unit) limit, the outgoing message or the payload information and the metadata carried by it are directly sent to the sending arbitration unit 209 for subsequent processing. Size, maximum segment length), the incoming message and payload information are cached, and the slices and metadata are copied and updated according to the slice size configured by the user to obtain the sliced ​​message and new metadata; and then the sliced ​​message and the new metadata are sent to the sending arbitration unit 209. At the same time, for the network protocol that requires a response signal, the message fragment retransmission unit 206 sends a timing request to the outgoing timer 208. If no response signal is received from the other end from the first stateful pipeline 201 within the preset time, the timeout retransmission mechanism is started and the message is resent. For the successfully sent sliced ​​message, the sending slice information is updated. If all the sliced ​​messages are successfully sent, the next outgoing message can be sent in slices. At the same time, the message fragment retransmission unit 206 can also receive the flow control time message of the programmable congestion control unit 204 to adjust the size of the sending window at any time.

[0137] Step 602: The message generation unit 207 receives the message generation event message and metadata transmitted by the programmable congestion control unit 204, and generates a response message and a flow control message of a preset protocol. The preset protocol can be set according to actual conditions and is not limited here.

[0138] Step 603: The sending arbitration unit 209 selects a suitable outgoing message or payload information from the two messages according to the priority information (absolute priority or weight) in the metadata of the received outgoing message, and sends it to the second stateful pipeline 210 for processing.

[0139] Step 604, the outgoing message or payload information enters the second stateful pipeline 210, which is similar to the processing flow in the first stateful pipeline 201. First, the message parser must be used to perform header parsing and extract the message header vector. For the payload information, no header vector needs to be extracted in the message parser. In the subsequent matching-action component processing, the message header vector is looked up and modified according to the message header vector. The payload information is looked up according to the information contained in the metadata, and a new message header vector is obtained. Finally, the message inverse parser completes the reorganization of the message header vector and combines it with the payload information to obtain the target message to be sent, and sends the target message. Since the outgoing direction of most network protocols does not involve stateful processing, the outgoing stateful processing process will not be described here. If some new network protocols need to perform stateful processing in the message sending direction, the stateful processing process is similar to the incoming direction, and will not be repeated here.

[0140] A storage medium is also provided in an embodiment of the present invention for readable storage. The storage medium stores a program, and the program includes program instructions. The processor executes the program instructions to implement any message processing method provided in the embodiment of the present invention.

[0141] For example, the program is loaded by the processor and may execute the following steps:

[0142] Based on the first stateful pipeline, a first message from a first communication device is state-matched to obtain a target message; based on the second stateful pipeline, a second message is state-matched to obtain a second message, and both the first stateful pipeline and the second stateful pipeline include a stateful processing unit for processing stateful messages; and the second message is sent to the second communication device.

[0143] The storage medium may be an internal storage unit of the network processing device in the aforementioned embodiment, such as a hard disk or memory of the network processing device. The storage medium may also be an external storage device of the network processing device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital card (Secure Digital Card, SD Card), a flash card (Flash Card), etc. equipped on the network processing device.

[0144] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0145] In hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a storable medium, and the storage medium may include a computer storage medium (or a non-temporary medium) and a communication medium (or a temporary medium). As known to those of ordinary skill in the art, the term storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0146] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the present invention is not limited thereby. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the present invention shall be within the scope of the present invention.

Claims

1. A message processing method, the method comprising: Based on the first stateful pipeline, a first message from the first communication device is state matched to obtain a target message; Based on the second stateful pipeline, state matching is performed on the target message to obtain a second message, wherein both the first stateful pipeline and the second stateful pipeline include a stateful processing unit for processing the stateful message; Send the second message to the second communication device.

2. The message processing method according to claim 1, characterized in that: The performing state matching on the first message based on the first stateful pipeline to obtain a target message includes: Parsing the first message to obtain payload information and an initial message header vector of the first message; Performing state matching on the initial message header vector to obtain a first message header vector; Performing message header reorganization on the first message header vector to obtain a target message header vector; Combining the target message header vector with the payload information to obtain an initial message; A target message is generated according to the initial message.

3. The message processing method according to claim 2, characterized in that: The performing state matching on the initial message header vector to obtain a first message header vector includes: Extracting information from the initial message header vector to obtain first key value information and second key value information; Perform action matching according to the first key value information to obtain a first action instruction; Perform action matching according to the second key value information to obtain a second action instruction; The initial message header vector is subjected to action processing according to the first action instruction and the second action instruction to obtain the first message header vector.

4. The message processing method according to claim 3, characterized in that: The performing action matching according to the first key value information to obtain a first action instruction includes: A preset action instruction table is queried, and the first action instruction is determined according to the action instruction corresponding to the first key value information.

5. The message processing method according to claim 3, characterized in that: The stateful processing unit includes a three-state memory addressing storage table and an instruction memory; performing action matching according to the second key value information to obtain a second action instruction includes: Determine a status judgment condition corresponding to the second key value information; Determine third key value information according to the second key value information and the state judgment condition; Based on the ternary memory addressing storage table and the instruction memory, the second action instruction is determined according to the third key value information.

6. The message processing method according to claim 5, characterized in that: The stateful processing unit further includes a shared memory; the determining of the state judgment condition corresponding to the second key value information includes: Obtaining the current state variable value in the shared memory; The state judgment condition is obtained by comparing the second key value information with the state variable value.

7. The message processing method according to claim 5, characterized in that: The determining the second action instruction based on the ternary memory addressing storage table and the instruction memory and according to the third key value information includes: According to the third key value information, the three-state memory addressing storage table is searched to obtain the instruction storage address; Query the instruction memory according to the instruction storage address to obtain at least one action instruction; Determine the instruction operation object corresponding to each of the action instructions, and determine the second action instruction according to the action instruction whose instruction operation object is the message header vector.

8. The message processing method according to claim 2, characterized in that: The generating a target message according to the initial message comprises: If the initial message is a non-fragmented message, the initial message is sent to a preset traffic management unit, so that the traffic management unit generates the target message according to the initial message; If the initial message is a fragment message and the fragment message of the initial message has not been transmitted for a timeout, the initial message is sent to the traffic management unit so that the traffic management unit generates the target message according to the initial message; If the initial message is a fragmented message and the fragmented message transmission of the initial message times out, the initial message is retransmitted as a fragmented message, and when the fragmented message retransmission is completed, the initial message is sent to the traffic management unit so that the traffic management unit generates the target message according to the initial message.

9. The message processing method according to claim 8, characterized in that: The retransmitting the initial message in fragmented form includes: Determine the fragment message information to be retransmitted and generate a retransmission instruction message; Generate a message retransmission message according to the fragment message information and the retransmission instruction message; Send the message retransmission to the first communication device.

10. The message processing method according to any one of claims 1 to 9, characterized in that: The first stateful pipeline and the second stateful pipeline are pipelines in which an extended finite automaton is added to a protocol-independent switch architecture based on a programming language.

11. A network processing device, characterized in that: The network processing device includes a processor and a memory; The memory is used to store programs; The processor is used to execute the program and implement the message processing method according to any one of claims 1 to 10 when executing the program.

12. A computer-readable storage medium for readable storage, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the message processing method according to any one of claims 1 to 10.