Message processing method and system
The on-site programmable gate array unit receives messages and querys the flow table, which solves the problem of message forwarding delay caused by the long flow table configuration time, realizes the rapid configuration of the flow table and timely forwarding of messages, and improves the user experience of network connections.
Patent Information
- Application Number
- CN202411774028.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-14
AI Technical Summary
The current flow table configuration time is long, resulting in a large delay in forwarding of packets. Especially when processing a large number of packets, the accumulated forwarding delay makes the network connection efficiency and poor user experience.
The message is received through the field programmable gate array unit and query the flow table; if it is missed, it is forwarded to the processor unit for packaging, and after obtaining the new message, it is parsed and configured into the flow table.
The flow table configuration is realized through the field programmable gate array, which reduces multiple data interactions during processor configuration, shortens the flow table configuration time, enables packets to hit the flow table in time, realizes rapid forwarding, reduces forwarding delay and improves the user experience of network connections.
Smart Images

Figure CN119629099A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to a message processing method and system. Background Art
[0002] After receiving a user message, the Smart NIC needs to query the flow table to determine the next port to forward the message and then forward the message to the next port. Currently, flow table configuration is typically completed by the NIC processor unit through multiple interactions with the registers storing the flow table via a channel between the NIC processor unit and the field programmable gate array. This makes flow table configuration time-consuming. As a result, packet forwarding delays are long, and the cumulative forwarding delay increases when processing a large number of messages, resulting in low network connection efficiency and a poor user experience. Summary of the Invention
[0003] In view of this, an embodiment of the present invention provides a message processing method and system, which receives a first message through a field programmable gate array unit and queries a flow table based on the message information carried in the first message; in response to not finding the message information carried by the first message in the flow table, forwards the first message to a processor unit so that the processor unit encapsulates the first message to obtain a second message; receives the second message sent by the processor unit, parses the second message to obtain encapsulation information, configures the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sends the second message to the message outlet. In this way, flow table configuration is achieved through the field programmable gate array, avoiding the multiple data interactions when configuring the flow table using the processor, shortening the time required to configure the flow table, and thus enabling new messages to hit the flow table in a timely manner, achieving timely forwarding of messages, reducing message forwarding delay, and improving the user experience of establishing a network connection.
[0004] To achieve the above objective, according to one aspect of an embodiment of the present invention, a message processing method is provided.
[0005] A message processing method according to an embodiment of the present invention is applied to a field programmable gate array unit, comprising: receiving a first message and querying a flow table based on message information carried in the first message; in response to not finding the message information carried by the first message in the flow table, forwarding the first message to a processor unit so that the processor unit encapsulates the first message to obtain a second message; receiving the second message sent by the processor unit, parsing the second message to obtain encapsulation information, configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sending the second message to a message exit.
[0006] Optionally, parsing the second message to obtain encapsulation information, configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sending the second message to the message exit, including: copying the second message to obtain two second messages; asynchronously executing the following steps: parsing one of the second messages to obtain encapsulation information, configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; sending the other second message to the message exit.
[0007] Optionally, configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table includes: using the message information corresponding to the first message and the encapsulation information corresponding to the second message as table item attribute values and filling in the table item corresponding to the flow table.
[0008] Optionally, the message information includes five-tuple information, and the encapsulation information includes intermediate port information; the five-tuple information includes the source port number and source Internet Protocol address for sending the first message, the destination port number and destination Internet Protocol address corresponding to the first message, and the transmission protocol agreed upon between the source port and the destination port; the intermediate port information includes the intermediate port number, the intermediate Internet Protocol address and the media access control protocol of the intermediate port; the intermediate port is the port that the first message passes through from the source port to the destination port.
[0009] Optionally, querying the flow table based on the message information carried in the first message includes: querying whether the flow table contains the five-tuple information included in the message information; in response to the existence of the five-tuple information in the flow table, querying the intermediate port information corresponding to the five-tuple information from the flow table; and using the intermediate port number, the intermediate Internet Protocol address and the media access control protocol of the intermediate port included in the queried intermediate port information as encapsulation information.
[0010] Optionally, the action configuration table is queried according to the message information corresponding to the first message to obtain the target action corresponding to the first message; wherein the target action includes one of the following actions: discarding, continuing transmission, encapsulating and decapsulating; the target action, the message information corresponding to the first message and the encapsulation information corresponding to the second message are configured into the flow table.
[0011] Optionally, in response to querying the message information corresponding to the first message and its corresponding target action in the flow table; in response to the target action indicating encapsulation, obtaining the encapsulation information corresponding to the message information from the flow table, using the encapsulation information to encapsulate the first message to obtain a third message, and sending the third message to the message exit.
[0012] To achieve the above objective, according to another aspect of an embodiment of the present invention, a message processing system is provided.
[0013] A message processing system according to an embodiment of the present invention includes a processor unit and a field programmable gate array unit, wherein the processor unit is used to: obtain encapsulation information corresponding to a first message, and use the encapsulation information to encapsulate the first message to obtain a second message; and send the encapsulated second message to the field programmable gate array unit; the field programmable gate array unit is used to: receive the second message sent by the processor unit, parse the second message to obtain encapsulation information, configure the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and send the second message to the message exit.
[0014] Optionally, the processor unit is used to: use the message information carried by the first message as a query condition, query the routing table and the address resolution protocol table, and obtain the encapsulation information corresponding to the first message; and add a data packet encapsulation header including the encapsulation information to the first message to obtain the encapsulated second message.
[0015] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device for message processing is provided.
[0016] An electronic device for message processing according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a message processing method according to an embodiment of the present invention.
[0017] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided.
[0018] A computer-readable storage medium according to an embodiment of the present invention stores a computer program, which, when executed by a processor, implements a message processing method according to an embodiment of the present invention.
[0019] To achieve the above objective, according to another aspect of the embodiments of the present invention, a computer program product is provided.
[0020] A computer program product according to an embodiment of the present invention includes a computer program, and when the program is executed by a processor, a message processing method according to an embodiment of the present invention is implemented.
[0021] One embodiment of the above invention has the following advantages or beneficial effects: receiving a first message through a field programmable gate array unit, and querying a flow table based on the message information carried in the first message; in response to not finding the message information carried by the first message in the flow table, forwarding the first message to a processor unit so that the processor unit encapsulates the first message to obtain a second message; receiving the second message sent by the processor unit, parsing the second message to obtain encapsulation information, configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sending the second message to the message exit. Thus, flow table configuration is implemented through the field programmable gate array, avoiding the large number of data interactions when configuring the flow table using the processor, shortening the time required to configure the flow table, and thus enabling new messages to hit the flow table in a timely manner, achieving timely forwarding of messages, reducing message forwarding delay, and improving the user experience of establishing a network connection.
[0022] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.
[0024] Figure 1 is a schematic diagram of the main steps of a message processing method according to an embodiment of the present invention;
[0025] Figure 2 is a schematic diagram of the main steps of another message processing method according to an embodiment of the present invention;
[0026] Figure 3 is a module diagram of a message processing system according to an embodiment of the present invention;
[0027] Figure 4 It is a module diagram of a message processing system in the prior art;
[0028] Figure 5 is a module diagram of another message processing system according to an embodiment of the present invention;
[0029] Figure 6 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0030] Figure 7It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0032] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, and storage of user personal information involved in the technical solutions disclosed herein all comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken with respect to user personal information to prevent unauthorized access to user personal information data and to safeguard the security of user personal information, network security, and national security.
[0033] It should be pointed out that, in the absence of conflict, the embodiments of the present invention and the technical features therein may be combined with each other.
[0034] Figure 1 FIG. 4 is a schematic diagram of main steps of a message processing method according to an embodiment of the present invention.
[0035] like Figure 1 As shown, the message processing method according to the embodiment of the present invention is applied to a field programmable gate array unit and mainly includes steps S101-S103:
[0036] Step S101: Receive a first message and query a flow table based on message information carried in the first message;
[0037] Step S102: In response to not finding the message information carried by the first message in the flow table, forwarding the first message to a processor unit so that the processor unit encapsulates the first message to obtain a second message;
[0038] Step S103: receiving the second message sent by the processor unit, parsing the second message to obtain encapsulation information, configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sending the second message to the message egress;
[0039] The message processing method of this embodiment can be applied to message processing when establishing a TCP (Transmission Control Protocol) connection on a smart network card. Specifically, this message processing method is applied to a field programmable gate array (FPGA) unit, hereinafter referred to as the FPGA unit. Using this message processing method, the process of establishing a network connection is as follows: the FPGA unit receives a first message, extracts the message information carried by the first message, and uses this message information as a query to determine whether the message information exists in the current flow table. If the message information does not exist in the current flow table, that is, a table miss occurs, the first message needs to be forwarded to the processor unit, which encapsulates the first message to obtain a second message and sends the second message back to the FPGA unit. After receiving the second message, the FPGA unit parses the second message to obtain message information and encapsulation information, and configures the message information and encapsulation information into the current flow table. While configuring the flow table, the FPGA unit also sends the second message to the message outlet for forwarding through the message outlet. The message outlet may be an optical port of a network card at the requesting end for establishing a network connection.
[0040] In order to enable message forwarding and flow table configuration to be performed asynchronously, thereby improving message forwarding efficiency and reducing message forwarding delay, in an optional embodiment of the present invention, the second message is parsed to obtain encapsulation information, and the message information corresponding to the first message and the encapsulation information corresponding to the second message are configured into the flow table; and the second message is sent to the message exit, including: copying the second message to obtain two copies of the second message; asynchronously performing the following steps: parsing one of the second messages to obtain encapsulation information, and configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sending the other copy of the second message to the message exit. That is, after receiving the second message, the FPGA unit copies it into two copies, one for flow table configuration and the other for message forwarding. The FPGA unit performs flow table configuration, specifically configuring the message information and encapsulation information into the flow table.
[0041] Wherein, in an optional embodiment of the present invention, the message information includes five-tuple information, and the encapsulation information includes intermediate port information; the five-tuple information includes the source port number and source Internet Protocol address of the first message, the destination port number and destination Internet Protocol address corresponding to the first message, and the transmission protocol agreed upon between the source port and the destination port; the intermediate port information includes the intermediate port number, the intermediate Internet Protocol address, and the media access control protocol of the intermediate port; the intermediate port is the port that the first message passes through from the source port to the destination port. That is, the information configured in the flow table includes: source port information, destination port information, the transmission protocol between the source port and the destination port, and intermediate port information.
[0042] The five-tuple information includes the destination Internet Protocol address (DIP), destination port number (DPORT), source port number, source Internet Protocol address, and protocol type, which are specifically represented as follows: 1. Source Internet Protocol (SIP) address: The IP address of the device that initiates the connection, that is, the IP address of the device that sends the first message. 2. Destination IP (DIP): The IP address of the device receiving the connection, that is, the IP address of the device receiving the first message. 3. Source Port (SP): The port number used by the device initiating the connection, that is, the IP address of the device sending the first message. 4. Destination Port (DP): The port number that the connected device monitors, that is, the IP address of the device that receives the first message. 5. Protocol type: Indicates the transport layer protocol used, usually TCP or UDP.
[0043] In addition, the intermediate port serves as the next port for the FPGA to forward the current message (but not the final destination port of the message). The intermediate port information includes the intermediate port number, intermediate Internet Protocol address, and the Media Access Control Protocol (MAC) of the intermediate port.
[0044] In an optional embodiment of the present invention, configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table includes: using the message information corresponding to the first message and the encapsulation information corresponding to the second message as table item attribute values and filling in the table item corresponding to the flow table. Specifically, the information configured by the FPGA unit in the flow table includes: the source port number and source Internet Protocol address for sending the first message, the destination port number and destination Internet Protocol address corresponding to the first message, and the transmission protocol agreed upon between the source port and the destination port; the intermediate port information includes the intermediate port number, the intermediate Internet Protocol address, and the media access control protocol of the intermediate port. The information configured in the flow table includes: source port information, destination port information, the transmission protocol between the source port and the destination port, and intermediate port information, and these configured information correspond to each other. Based on two or more of the source port information, the destination port information, the transmission protocol between the source port and the destination port, and the intermediate port information, the information of the other remaining items can be determined.
[0045] When configuring flow table entries, write the five-tuple information and intermediate port information as attribute values to each corresponding entry, for example: Source IP: 192.168.1.10 Destination IP: 192.168.1.20 Source port: 12345 Destination port: 80; Protocol: TCP; Intermediate port number: 1; Intermediate Internet Protocol address: XXX.XXX.X.XX; MAC address of the intermediate port: YYY.YYY.Y.YY.
[0046] The FPGA unit configures the flow table and can directly interact with the Data Direction Register (DDR) through the FPGA's write register interface, writing the quintuple information and intermediate port information as table entry attribute values directly into the corresponding table entry in the flow table.
[0047] In an optional embodiment of the present invention, querying the flow table based on the message information carried in the first message includes: querying the flow table for the presence of the five-tuple information included in the message information; in response to the presence of the five-tuple information in the flow table, querying the flow table for intermediate port information corresponding to the five-tuple information; and using the intermediate port number, the intermediate Internet Protocol address, and the media access control protocol of the intermediate port included in the queryed intermediate port information as encapsulation information. Specifically, after receiving the first message, the FPGA unit queries the flow table for the message information carried by the first message, i.e., the five-tuple information, and queries the flow table for the five-tuple information, i.e., the destination port information, the source port information, and the transmission protocol between the two. If the five-tuple information is found, the intermediate port information corresponding to the five-tuple information, i.e., the intermediate port number, the intermediate Internet Protocol address, and the media access control protocol of the intermediate port, is determined from the flow table. In other words, based on the source port and destination port of the first message, the intermediate port can be determined in the flow table, so that the message is sent through the intermediate port to the destination port. Among them, the intermediate port refers to the switch or gateway port that the message needs to pass through from the source port to the destination port.
[0048] After the FPGA unit queries the message information of the first message from the flow table, it queries the intermediate port information corresponding to the message information from the current flow table, and uses the queried intermediate port information to encapsulate the first message to obtain the encapsulated message. The FPGA unit then forwards the encapsulated message through the message outlet. This avoids the problem that the FPGA unit needs to forward each message to the processor unit so that the processor unit encapsulates it, and after encapsulation, sends the encapsulated message to the FPGA unit, and finally sends the encapsulated message to the message outlet through the FPGA unit, resulting in low message forwarding efficiency and large message forwarding delay. The message outlet can be the network card optical port of the requesting end for establishing a network connection. The intermediate port information is the first switch port that the first message arrives at after being sent from the FPGA unit, and the switch port directly or indirectly sends the first message to the destination port.
[0049] As the name implies, a flow table is a data flow table used to manage data flow, such as which port to send the message to, discard the message, encapsulate the message, decapsulate the message, etc. In addition to configuring the message information and encapsulation information in the flow table, it is also necessary to configure some target actions corresponding to the message information and encapsulation information. The target action indicates how to process the message corresponding to the message information and encapsulation information. In an optional embodiment of the present invention, the action configuration table is queried according to the message information corresponding to the first message to obtain the target action corresponding to the first message; wherein, the target action includes one of the following actions: discard, continue transmission, encapsulate and decapsulate; the target action, the message information corresponding to the first message and the encapsulation information corresponding to the second message are configured in the flow table. Among them, discard means directly discarding the message and no longer transmitting it; continue transmission means forwarding the message to the next port; encapsulation means encapsulating the message; decapsulation means decapsulating the message.
[0050] In an optional embodiment of the present invention, in response to querying the message information corresponding to the first message and its corresponding target action in the flow table; in response to the target action indicating encapsulation, the encapsulation information corresponding to the message information is obtained from the flow table, the first message is encapsulated using the encapsulation information to obtain a third message, and the third message is sent to the message exit.
[0051] Among them, the target action indicates what kind of processing to perform on the message. Accordingly, when querying the flow table for the first message, in addition to querying the intermediate port information, you can also query the processing strategy for the message, such as discarding, recording, encapsulating, decapsulating and other processing operations. For example, if the target action corresponding to the five-tuple information is queried in the flow table as encapsulation, then the intermediate port information corresponding to the five-tuple information is queried from the flow table, and the intermediate port information is used as the data packet encapsulation header to encapsulate the message to obtain the encapsulated message, and then forward the encapsulated message to the message outlet. For another example, if the flow table is queried to determine that the target action corresponding to the five-tuple information is discard, then the message is discarded, that is, the message is no longer forwarded. In this embodiment, configuring the target action in the flow table can manage the flow direction of the message in a more diverse and accurate manner.
[0052] The processing method of the reply message of the first message is the same as the processing method of the first message. In addition, a flow table needs to be configured separately for the reply message. The following describes how to process the message information returned by the destination end, that is, the reply message, through an embodiment. In an optional embodiment of the present invention, the field programmable gate array unit, in response to receiving the reply message sent by the destination port to the source port, extracts the intermediate port information and the destination port information included in the reply message for the first message, queries the corresponding flow table for whether the intermediate port information and the destination port information included in the reply message exist, and in response to the presence of the intermediate port information and the destination port information included in the reply message in the corresponding flow table, queries the target action corresponding to the intermediate port information and the destination port information from the corresponding flow table; in response to the target action indicating decapsulation, decapsulates the reply message, and sends the decapsulated reply message to the source port according to the source port information. It should be noted that a flow table also needs to be configured for the reply message returned by the destination port. The flow table corresponding to the reply message returned by the destination port has its send port and receive port reversed with the send port and receive port in the flow table corresponding to the first message sent by the source port. That is, the send port in the flow table corresponding to the reply message is the same as the receive port in the flow table corresponding to the first message; and the receive port in the flow table corresponding to the reply message is the same as the send port in the flow table corresponding to the first message.
[0053] After receiving the reply message, the intermediate port information and the port information from which the reply message was sent, i.e., the destination port information, are extracted from the reply message ("destination port" here refers to the receiving port corresponding to the first message, which is also the sending port of the reply message. This port name is used to maintain consistency with the port names previously mentioned). Using the intermediate port information and the destination port information as query criteria, the flow table corresponding to the reply message is queried to determine whether an entry in the flow table is hit. If an entry in the flow table is hit, the hit entry and its corresponding source port information are determined, i.e., the receiving port of the reply message (which is also the sending port of the initial message). After determining the source port information, the reply message is sent to the source port. Alternatively, after determining the source port information, a corresponding target action is determined. If the target action indicates decapsulating the reply message, the reply message is decapsulated and the decapsulated reply message is sent to the source port. The reply message can be a confirmation message from the requested end agreeing to establish a TCP connection with the requesting end, or it can be another data message.
[0054] The message processing method of the embodiment of the present invention is further described below by a specific embodiment. The message processing method includes steps S201-S209. Figure 2 As shown:
[0055] Step S201: Receive a first message sent from a source port to a destination port through a field programmable gate array unit, and extract quintuple information included in the first message.
[0056] Step S202: query whether there is quintuple information in the flow table through the field programmable gate array unit. If yes, execute step S203; if not, execute step S205.
[0057] Step S203: querying the intermediate port information corresponding to the five-tuple information from the flow table through the field programmable gate array unit; using the intermediate port information, encapsulating the first message to obtain an encapsulated third message.
[0058] Step S204: Send the third message to the message exit through the field programmable gate array unit, so that the third message reaches the intermediate port through the message exit.
[0059] Step S205: Send the first message to the processor unit through the field programmable gate array unit.
[0060] Step S206: The processor unit uses the five-tuple information included in the first message as a query condition to query the routing table and the address resolution protocol table to obtain the intermediate port information corresponding to the first message.
[0061] Step S207: The processor unit uses the intermediate port information as encapsulation information to encapsulate the first message to obtain a second message.
[0062] Step S208: Send the new second message to the field programmable gate array unit through the processor unit.
[0063] Step S209: configuring a flow table according to the second message through the field programmable gate array unit, and forwarding the second message to the message egress.
[0064] In the prior art, configuring a flow table is implemented by a processor unit, and the implementation process is as follows: When the result obtained by the FPGA unit in querying the current flow table is empty, the FPGA unit sends the first message to the processor unit. The processor unit extracts the five-tuple information of the first message and uses the five-tuple information as a query condition to query the routing table information and address protocol resolution table of the current network to determine the information of the first switching port through which the first message passes after being sent from the FPGA, namely the intermediate port information, including the intermediate port number, the intermediate Internet Protocol address, and the media access control protocol of the intermediate port. The processor unit uses the channel between it and the FPGA unit to write the five-tuple information and the intermediate port information into the flow table in the register. Because the bandwidth of the channel used to configure the flow table is relatively narrow, writing the five-tuple information and the intermediate port information into the flow table requires multiple interactions with the register. For example, the data volume of the five-tuple information and the intermediate port information is 500 bits, but only 32 bits can be written at a time. Therefore, it takes more than ten writes to complete. In addition, the operation of confirming whether the write is successful after writing takes a long time.
[0065] To shorten the time it takes to configure a flow table, allowing subsequent messages to hit the flow table in a timely manner and avoiding unnecessary delays in message forwarding, the present invention replaces the processor unit with an FPGA unit to configure the flow table. The FPGA unit's write register interface directly writes the attribute values of the flow table entries in the registers, significantly improving the speed of flow table configuration and shortening the time it takes to configure the flow table. This allows subsequent flow tables to hit the entries in a timely manner, preventing the FPGA unit from forwarding messages that should have hit the entries to the processor unit, causing the processor unit 101 to configure the flow table for the messages and encapsulate them. This overall reduces message forwarding delays.
[0066] The message processing method of an embodiment of the present invention receives a first message through a field programmable gate array unit, and queries a flow table based on the message information carried in the first message; in response to not finding the message information carried by the first message in the flow table, forwards the first message to a processor unit so that the processor unit encapsulates the first message to obtain a second message; receives the second message sent by the processor unit, parses the second message to obtain encapsulation information, configures the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sends the second message to the message outlet. Thus, flow table configuration is achieved through the field programmable gate array, avoiding the large number of data interactions when configuring the flow table using the processor, shortening the time required to configure the flow table, and thus enabling new messages to hit the flow table in a timely manner, achieving timely forwarding of messages, reducing message forwarding delay, and improving the user experience of establishing a network connection.
[0067] Figure 3 FIG. 4 is a schematic diagram of main modules of a message processing system according to an embodiment of the present invention.
[0068] like Figure 3 As shown, the message processing system of the embodiment of the present invention includes: a processor unit 301 and a field programmable gate array unit 302, wherein:
[0069] The processor unit 301 is configured to: obtain encapsulation information corresponding to the first message, and use the encapsulation information to encapsulate the first message to obtain a second message; and send the encapsulated second message to the field programmable gate array unit;
[0070] The field programmable gate array unit 302 is used to: receive the second message sent by the processor unit, parse the second message to obtain encapsulation information, configure the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and send the second message to the message exit.
[0071] In an optional embodiment of the present invention, the processor unit 301 is configured to: query the routing table and the address resolution protocol table using the message information carried by the first message as a query condition to obtain the encapsulation information corresponding to the first message; and add a data packet encapsulation header including the encapsulation information to the first message to obtain an encapsulated second message. The encapsulation information includes intermediate port information, and the intermediate port information includes the intermediate port number, intermediate Internet Protocol address, and media access control protocol of the next port of the first message. The Address Resolution Protocol (ARP) table primarily maps the network layer address (e.g., IP address) of the first message to a data link layer address (e.g., MAC address). The routing table records the path information from the source port to different destinations in the network, including the address and port of the next hop, and is used to determine the optimal forwarding path for the first message.
[0072] The following further illustrates the process of executing message processing in the message processing system of the embodiment of the present invention through a specific embodiment. In order to highlight the difference between the message processing system of the embodiment of the present invention and the message processing system of the prior art, the message processing system of the prior art is first introduced. The schematic diagram of the modules and processing logic included in the existing message processing system is shown in FIG. Figure 4 The following is an illustrative example of a method for processing messages in an existing message processing system using a specific embodiment. The processing process includes the following steps:
[0073] 1) The HOST CPU sends a SYN message to the FPGA via the PCIE corresponding to the HOST CPU;
[0074] 2) The syn message is sent to the SOC CPU via the PCIE corresponding to the SOC CPU inside the FPGA;
[0075] 3) The SOC CPU receives the SYN message and queries the routing table and address protocol resolution table based on the five-tuple information of the SYN message. It adds the intermediate port information to the SYN message, i.e., the outer IP+VXLAN encapsulation, and sends the encapsulated message to the FPGA via the PCIE corresponding to the SOC CPU.
[0076] 4) The SOC CPU configures the flow table flow_table based on the acquired five-tuple information and intermediate port information through the indirect access channel between the SOC CPU and FPGA;
[0077] 5) FPGA sends the encapsulated message sent by the SOC CPU to the peer device through the optical port.
[0078] In addition, for the syn_ack message returned by the peer device, the message processing system processes the message in the reverse order of the above syn message. The processing flow is as follows:
[0079] Remote device -> Local network card optical port -> FPGA -> SOC CPU -> FPGA -> HOST CPU.
[0080] A schematic diagram of the modules and processing logic included in the message processing system of another embodiment of the present invention is shown in FIG. Figure 5 The following is an illustrative example of a method for message processing by a message processing system according to an embodiment of the present invention, using a specific embodiment. The processing process includes the following steps:
[0081] 1. The FPGA receives the encapsulated message sent by the PCIE corresponding to the SOC CPU, uses the added message copy module, that is, the COPY module, to identify the encapsulated message as a syn or syn_ack message, and copies the encapsulated message;
[0082] 2. FPGA sends the original syn or syn_ack to the optical port or HOST CPU according to the original processing flow;
[0083] 3. FPGA parses the copied syn message or syn_ack message to obtain the intermediate port information and the inner encapsulated quintuple information;
[0084] 4. FPGA sends the above information to the flow table configuration module, namely the FLOW_CFG module;
[0085] 5. The FLOW_CFG module receives the five-tuple information, intermediate port information, etc., and configures the flow table flow_table through the DDR interface according to the flow table configuration format.
[0086] In addition, subsequent ack, fin, and ordinary data messages can be directly and quickly forwarded inside the FPGA by looking up the flow_table, reducing the transmission delay of all messages during the link establishment process.
[0087] In the prior art, the flow table flow_table is configured via an indirect access channel between the SOC CPU and the FPGA. Due to the narrow bandwidth of this channel, writing the quintuple information and intermediate port information into the flow table requires multiple interactions with registers. For example, the quintuple information and intermediate port information are 500 bits in size, but only 32 bits can be written at a time. Therefore, the write operation requires more than a dozen writes to complete. Furthermore, the post-write confirmation process consumes considerable time. In the present invention, however, flow table configuration is replaced by FPGA configuration instead of the SOC CPU. The FPGA's write register interface directly writes entry attribute values into the flow table entries in the registers. This significantly speeds up flow table configuration and shortens the time it takes to configure the flow table. This allows subsequent flow tables to match entries promptly, avoiding the FPGA unit forwarding messages that should have matched entries to the SOC CPU, which then configures the flow table and encapsulates the messages. This reduces the overall latency of message forwarding.
[0088] The message processing system of an embodiment of the present invention receives a first message through a field programmable gate array unit, and queries a flow table based on the message information carried in the first message; in response to not finding the message information carried by the first message in the flow table, forwards the first message to a processor unit so that the processor unit encapsulates the first message to obtain a second message; receives the second message sent by the processor unit, parses the second message to obtain encapsulation information, configures the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sends the second message to the message outlet. Thus, flow table configuration is achieved through the field programmable gate array, avoiding the large number of data interactions when configuring the flow table using the processor, shortening the time required to configure the flow table, and thus enabling new messages to hit the flow table in a timely manner, achieving timely forwarding of messages, reducing message forwarding delay, and improving the user experience of establishing a network connection.
[0089] Figure 6 An exemplary system architecture 600 is shown to which a message processing method or a message processing system according to an embodiment of the present invention may be applied.
[0090] like Figure 6 As shown, system architecture 600 may include a host client 601, networks 602 and 603, a message processing system 604, and servers 605, 606, and 607. Networks 602 and 603 are used to provide a medium for communication links between the host client 601, the message processing system 604, and the servers 605, 606, and 607. Networks 602 and 603 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0091] Host client 601 and servers 605, 606, and 607 interact with message processing system 604 via networks 602 and 603 to receive or send messages. Host client 601 is the client that initiates a connection request. Message processing system 604 receives a first message from host client 601 requesting a connection, and sends the first message to one of servers 605, 606, and 607 indicated by the first message.
[0092] The message processing system 604 may be a smart network card that provides various services. For example, the message processing system 604 may be a smart network card that provides support for obtaining a first message from the host client 601 and performing analysis and processing on the first message. The smart network card may perform analysis and other processing on the obtained first message and send the processing result, such as an encapsulated second message, to one of the servers 605, 606, and 607.
[0093] It should be noted that the message processing method provided in the embodiment of the present invention is generally executed by the message processing system 604 .
[0094] It should be understood that Figure 6 The number of host clients, networks, message processing systems and servers in the embodiment is merely illustrative. Any number of host clients, networks, message processing systems and servers may be used as needed.
[0095] Reference below Figure 7 , which shows a schematic structural diagram of a computer system 700 of an electronic device suitable for implementing an embodiment of the present invention. Figure 7 The host client shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0096] like Figure 7As shown, computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for the operation of computer system 700 are also stored in RAM 703. CPU 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to bus 704.
[0097] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, and the like; an output section 707 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 708 including devices such as a hard disk; and a communication section 709 including a network interface card such as a LAN card or a modem. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. Removable media 711, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 710 as needed, so that computer programs read from the media can be installed in the storage section 708 as needed.
[0098] In particular, according to embodiments disclosed herein, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed herein include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program containing program code for executing the methods illustrated in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709 and / or installed from removable media 711. When executed by central processing unit (CPU) 701, the computer program performs the aforementioned functions defined in the system of the present invention.
[0099] It should be noted that the computer-readable medium described in the present invention may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. Computer-readable storage media may include, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such a propagated data signal may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0101] The modules described in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor. For example, they may be described as comprising a processor unit and a field programmable gate array unit. The names of these modules do not, in some cases, limit the modules themselves. For example, a field programmable gate array unit may also be described as a "module for sending a second message to a message outlet."
[0102] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: receiving a first message and querying a flow table based on the message information carried in the first message; in response to not finding the message information carried by the first message in the flow table, forwarding the first message to a processor unit so that the processor unit encapsulates the first message to obtain a second message; receiving the second message sent by the processor unit, parsing the second message to obtain encapsulation information, configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and sending the second message to the message exit.
[0103] According to the technical solution of an embodiment of the present invention, a first message is received through a field programmable gate array unit, and a flow table is queried based on the message information carried in the first message; in response to not finding the message information carried by the first message in the flow table, the first message is forwarded to a processor unit so that the processor unit encapsulates the first message to obtain a second message; the second message sent by the processor unit is received, the second message is parsed to obtain encapsulation information, and the message information corresponding to the first message and the encapsulation information corresponding to the second message are configured into the flow table; and the second message is sent to the message outlet. Thus, the flow table configuration is realized through the field programmable gate array, which avoids the large number of data interactions when configuring the flow table using the processor, shortens the time required to configure the flow table, and enables the new message to hit the flow table in time, realizes the timely forwarding of the message, reduces the message forwarding delay, and improves the user experience of establishing a network connection.
[0104] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A message processing method, characterized in that: Applicable to field programmable gate array units, including: receiving a first message, and querying a flow table according to message information carried in the first message; In response to not finding the message information carried by the first message in the flow table, forwarding the first message to a processor unit so that the processor unit encapsulates the first message to obtain a second message; Receive the second message sent by the processor unit, parse the second message to obtain encapsulation information, configure the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and send the second message to the message exit.
2. The method according to claim 1, characterized in that The second message is parsed to obtain encapsulation information, and the message information corresponding to the first message and the encapsulation information corresponding to the second message are configured into the flow table; And, sending the second message to a message exit includes: Copying the second message to obtain two copies of the second message; Asynchronously execute the following steps: Parsing one of the second messages to obtain encapsulation information, and configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; Send another second message to the message exit.
3. The method according to claim 1, characterized in that The configuring the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table includes: The message information corresponding to the first message and the encapsulation information corresponding to the second message are used as table entry attribute values and filled into the table entry corresponding to the flow table.
4. The method according to claim 3, characterized in that The message information includes five-tuple information, and the encapsulation information includes intermediate port information; The five-tuple information includes the source port number and source Internet Protocol address of sending the first message, the destination port number and destination Internet Protocol address corresponding to the first message, and the transmission protocol agreed between the source port and the destination port; the intermediate port information includes the intermediate port number, the intermediate Internet Protocol address and the media access control protocol of the intermediate port; the intermediate port is the port that the first message passes through from the source port to the destination port.
5. The method according to claim 4, characterized in that The querying the flow table according to the message information carried in the first message includes: Querying the flow table whether there is quintuple information included in the message information; In response to the five-tuple information existing in the flow table, querying the intermediate port information corresponding to the five-tuple information from the flow table; The intermediate port number, the intermediate Internet Protocol address and the media access control protocol of the intermediate port included in the queried intermediate port information are used as encapsulation information.
6. The method according to claim 1, characterized in that Also includes: Querying the action configuration table according to the message information corresponding to the first message to obtain the target action corresponding to the first message; wherein the target action includes one of the following actions: discarding, continuing to transmit, encapsulating and decapsulating; The target action, the message information corresponding to the first message, and the encapsulation information corresponding to the second message are configured into the flow table.
7. The method according to claim 6, characterized in that Also includes: In response to querying in the flow table the message information corresponding to the first message and the corresponding target action; In response to the target action indicating encapsulation, encapsulation information corresponding to the message information is obtained from the flow table, the first message is encapsulated using the encapsulation information to obtain a third message, and the third message is sent to the message exit.
8. A message processing system, characterized in that: It includes a processor unit and a field programmable gate array unit, wherein: The processor unit is used to: obtain encapsulation information corresponding to the first message, and use the encapsulation information to encapsulate the first message to obtain a second message; and send the encapsulated second message to the field programmable gate array unit; The field programmable gate array unit is used to: receive the second message sent by the processor unit, parse the second message to obtain encapsulation information, configure the message information corresponding to the first message and the encapsulation information corresponding to the second message into the flow table; and send the second message to the message exit.
9. The system according to claim 8, characterized in that The processor unit is used to: query the routing table and the address resolution protocol table using the message information carried by the first message as a query condition to obtain the encapsulation information corresponding to the first message; and add a data packet encapsulation header including the encapsulation information to the first message to obtain an encapsulated second message.
10. An electronic device for message processing, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in claims 1 to 7.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method as claimed in claims 1 to 7 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the program is executed by a processor, the method as claimed in claims 1 to 7 is implemented.